Construct a ResourceLink with the same ResourceReference as your Image. On Fri, Aug 5, 2011 at 11:06 AM, Miroslav F. <mir...@seznam.cz> wrote:
> With this I have problem that then I need to take url from Image component > and put it into Link component: > <a href="#" <!-- <-this atribute --> wicket:id="anchor" > rel="lightbox" > title=""> > <img style="border: 3px solid #DCD4A7; > padding: 1px 1px 1px 1px; width: 199px; height: 149px;" alt="" src="" <!-- > <-and this atribute --> > wicket:id="image"> > </a> > <!-- have to had the same url + .jpg at the end. Otherwise Lightbox won't > work --> > > No problem make Image component as in example (my first attempt was same) > but not know how then take url from image component and put into Link > component. > > > > > -----Original Message----- > > From: Dan Retzlaff [mailto:dretzl...@gmail.com] > > Sent: Friday, 05. August 2011 19:58 > > To: users@wicket.apache.org > > Subject: Re: tomcat eats memory > > > > It sounds like a shared resource is not the right solution > > for your problem. > > Just throw a wicket:id on your Lightbox image tag and create > > a Wicket Image like "image5" of the wicketstuff examples link I sent. > > > > On Fri, Aug 5, 2011 at 10:46 AM, Miroslav F. <mir...@seznam.cz> wrote: > > > > > Answer myself: should be solution before > > > Start.get().getSharedResources().add("image" + random.toString() + > > > ".jpg", image); do something like "unmount all previosly mounted > > > images"? > > > > > > In Application.init() isn't possible to mount them - I don't know > > > which page user click. In database is around 1.000 images and there > > > are on around 100 pages (every page has around 10 images). > > For me it > > > looks crazy in Application.init() take all images from DB and mount > > > them. > > > > > > > > > > -----Original Message----- > > > > From: Miroslav F. [mailto:mir...@seznam.cz] > > > > Sent: Friday, 05. August 2011 18:54 > > > > To: users@wicket.apache.org > > > > Subject: RE: tomcat eats memory > > > > > > > > Using non-shared images? My problem is that I need same > > url for href > > > > in <a> and for src in <img> for lightbox to work. > > > > > > > > > > > > > > > > > -----Original Message----- > > > > > From: Dan Retzlaff [mailto:dretzl...@gmail.com] > > > > > Sent: Friday, 05. August 2011 18:45 > > > > > To: users@wicket.apache.org > > > > > Subject: Re: tomcat eats memory > > > > > > > > > > This is your problem: > > > > > > > > > > Start.get().getSharedResources().add("image" + > > > > > > random.toString() + ".jpg", image); > > > > > > > > > > > > > > > Adding shared resources during page construction is > > very unusual. > > > > > Consider registering shared resources in > > > > Application.init(), or using > > > > > non-shared images. Refer to > > http://wicketstuff.org/wicket/images/ > > > > > > > > > > On Fri, Aug 5, 2011 at 9:20 AM, Miroslav F. > > > > <mir...@seznam.cz> wrote: > > > > > > > > > > > Hi folks, > > > > > > > > > > > > I have these classes: > > > > > > > > > > > > package com.myapp; > > > > > > public class Minerals extends WebPage{ > > > > > > public Minerals(){ > > > > > > RepeatingView repeater = new > > > > > RepeatingView("repeater"); > > > > > > //data from database - images and descriptions > > > > > > ArrayList dataFromDB = (new > > > > ImagesMinerals()).load(); > > > > > > //descriptions > > > > > > ArrayList desc = new ArrayList(); > > > > > > desc = (ArrayList) dataFromDB.get(0); > > > > > > //images > > > > > > ArrayList images = new ArrayList(); > > > > > > images = (ArrayList) dataFromDB.get(1); > > > > > > int size = images.size(); > > > > > > for(int i = 0; i < size; i++){ > > > > > > String repeaterID = > > repeater.newChildId(); > > > > > > ImageRepeater repeaterChild = new > > > > > > ImageRepeater(repeaterID); > > > > > > //add description > > > > > > repeaterChild.add(new > > > > > > Label("description", > > > > > > (String) desc.get(i))); > > > > > > //add image > > > > > > DBImage image = new DBImage(); > > > > > > image.setImageData((byte[]) > > images.get(i)); > > > > > > //not caching on browser > > > > > > Double random = Math.random(); > > > > > > //put shared resource (image) on clean > > > > > > path > > > > > > > > > > > Start.get().getSharedResources().add("image" + > > > > > > random.toString() + ".jpg", image); > > > > > > ResourceReference imageResource = new > > > > > > ResourceReference("image" + random.toString() + ".jpg"); > > > > > > String url = > > > > > > RequestCycle.get().urlFor(imageResource).toString(); > > > > > > //href in <a> and src in <img> > > > > > should have same > > > > > > path because lightbox won't work... > > > > > > ExternalLink odkaz = new > > > > > ExternalLink("anchor", > > > > > > url); > > > > > > WebMarkupContainer imageSrcAttribute = > > > > > > new WebMarkupContainer("image"); > > > > > > imageSrcAttribute.add(new > > > > > > AttributeModifier("src", new Model<String>(url))); > > > > > > odkaz.add(imageSrcAttribute); > > > > > > odkaz.add(new > > > > > SimpleAttributeModifier("title", > > > > > > (String) desc.get(i))); > > > > > > repeaterChild.add(odkaz); > > > > > > repeater.add(repeaterChild); > > > > > > } > > > > > > this.add(repeater); > > > > > > } > > > > > > } > > > > > > > > > > > > package com.myapp; > > > > > > public class ImagesMinerals extends > > > > > > LoadableDetachableModel<ArrayList<byte[]>>{ > > > > > > @Override > > > > > > protected ArrayList load(){ > > > > > > DBGetImages databaseMinerals = new > > DBGetImages(); > > > > > > ArrayList dataMineraly = > > > > databaseMinerals.getData(); > > > > > > return dataMinerals; > > > > > > } > > > > > > } > > > > > > > > > > > > My problem is that when i again and again click on page the > > > > > memory in > > > > > > tomcat is eaten and I end-up with Java heap space > > error. Doesn't > > > > > > matter if heap is 64MB or 1GB on start, after some clicks > > > > memory is > > > > > > eaten. > > > > > > > > > > > > Somethink wrong with my LDM? > > > > > > > > > > > > Miro > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -------------------------------------------------------------------- > > > > - > > > > > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > > > > > For additional commands, e-mail: users-h...@wicket.apache.org > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -------------------------------------------------------------------- > > > > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > > > For additional commands, e-mail: users-h...@wicket.apache.org > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > > > For additional commands, e-mail: users-h...@wicket.apache.org > > > > > > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >