Your code's looking good - you're on the right track.  The ease of the next
step will blow your mind and you'll love wicket even more....  (I hope :)

NonCachingImage image = new NonCachingImage("attachment",
   new AbstractReadOnlyModel() {
           @Override
           public Object getObject() {
                   return new ImageResource(x.getFileThumb(), "jpg");
           }
   };

// create your link
Link<?> link = new Link<?>("link") {
    public void onClick() {
        setResponsePage(MyPageThatShowsImage(x));
    }
}

// add the image to the link
link.add(image);
// add the link to your list item
item.add(link);


-- 
Jeremy Thomerson
http://www.wickettraining.com
HTML:
<li wicket:id="attachments">
    <a href="#" wicket:id="link"><img wicket:id="image" /></a>
</li>



On Thu, Feb 5, 2009 at 6:00 PM, frankmuel <[email protected]> wrote:

>
> Hi there,
>
> I am looking for a small hint about how to do the next step, if possible. I
> know, it looks a bit like the old "please do my homework"-question, duh,
> but
> I am a beginner and working on my first big project.
>
> I can't come up with any new idea because it is a bit too complicated for
> my
> own beginner-wicket standard, and l could not come up with a simpler
> solution that I can develop on my own because I simply need those clickable
> thumbnails on my page and not the big, original pictures.
>
> As I said, what I'd like is a clickable thumbnail. When I click on the
> thumbnail, the image can either be direct in the browser or on another
> page.
>
> This is my code so far. Please, what is the next step to add a link. Or do
> I
> have to change the approach?
>
> FYI the thumbnail image is stored in a byte[] array in the database, like
> the big image. Thanks.
>
> Frank Mueller
>
>
> add(new ListView("attachments", new Model((Serializable) cu)) {
>        @Override
>        protected void populateItem(ListItem item) {
>                final CaseUpload x = (CaseUpload) item.getModelObject();
>                item.add(new Label("description", x.getDescription()));
>                item.add(new Label("fileName", x.getFileName()));
>                item.add(new NonCachingImage("attachment",
>                                new AbstractReadOnlyModel() {
>                                        @Override
>                                        public Object getObject() {
>                                                return new
> ImageResource(x.getFileThumb(), "jpg");
>                                        }
>                                }));
>        }
> });
> --
> View this message in context:
> http://www.nabble.com/Clickable-Image-in-a-ListView-%28thumbnail-principle%29-tp21864007p21864007.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to