I want that all image files in a given directory are shown on my site so that
the admin can simply add/delete image files by editing the directory. So I
do this with ListView:

ImgListView imgListView = new ImgListView("listImageData", new
LoadableDetachableModel()
                {
                                protected Object load()
                                {
                                        Folder folder = new
Folder("D:/wicketex/Kunsthaus/context/WEB-INF/classes/ueberuns/images1");
                        return Arrays.asList(folder.listFiles());
                    }
                });
                add(imgListView);

So my first problem is: how can I get the absolut path for my Folder?

The images are added in the following way:

    public ImgListView(String name, final IModel files)
        {
            super(name, files);
        }
        protected void populateItem(ListItem listItem)
        {
            final File file = (File)listItem.getModelObject();
            Resource resource = new WebResource() {
                
        public IResourceStream getResourceStream() {
                IResourceStream stream = new FileResourceStream(file);
                return stream;
                }
            };
            Image image = new Image("imageFile", resource);
            image.add(new SimpleAttributeModifier("class", "bildlinks"));
            listItem.add(image);
    }
    }

Is there a better way of adding the "src" to my image component?

Thank you for your help!
-- 
View this message in context: 
http://www.nabble.com/ListView-with-images-and-getting-absolut-path-tp16580373p16580373.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