I have an Image (imgThumbnailSelected) that shows the thumbnail (Resource
thumbnailResource) of a selected image (selectedImage object).
If no image is selected imgThumbnailSelected should show a placeholder
(ResourceReference DialogImagePage.IMG_NO_IMAGE).

I defined the Image and its Model like this:

// thumbnail of selected image
imgThumbnailSelected = new
wicket.markup.html.image.Image("imgThumbnailSelected", new Model()
    {
        public Object getObject(Component comp)
        {
            PixoCMSRepository repository = PixoCMSRepository.getInstance();
            Resource thumbnailResource =
repository.getThumbnailResource(selectedImage);
            if (thumbnailResource == null)
            {
               ResourceReference result = DialogImagePage.IMG_NO_IMAGE;
               return result;
            } else {
               return thumbnailResource;
            }
        }
    });
imgThumbnailSelected.setOutputMarkupId(true);
add(imgThumbnailSelected);

At the beginning when there is no image selected I always get an empty page
because of this warning:

wicket.markup.html.PackageResource getResourceStream
WARNUNG: Unable to find package resource [path =
de/pixotec/webapps/kms/wicket/panels/[ResourceReference name =
res/noimage.jpg, scope = class
wicket.extensions.markup.html.form.wysiwyg.DialogImagePage, locale = null,
style = null], style = null, locale = de_DE]


"de/pixotec/webapps/kms/wicket/panels" is the package of the panel
containing above code.
the ResourceReference logged is correct.

When I do a static Model like this:
imgThumbnailSelected = new
wicket.markup.html.image.Image("imgThumbnailSelected",DialogImagePage.IMG_NO_IMAGE);


it works and the "no image"-image is shown.

How to make the dynamic code work?
Is it a problem that the returned model-object is once a ResourceReference
and once a Reference (Image has constructors for both arguments...)?
Is the Model converted to String as argument for the Image-constructor? If
so: how to force using returned ResourceReference/Reference-objects as
argument for constructors?

-- 
View this message in context: 
http://www.nabble.com/Dynamic-Resource-ResourceReference-as-Model-for-Image-tp16068578p16068578.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