Could anybody explain me what wicket's AjaxFallbackLink actually doing?
I learn wicket since last week and this is my first wicket project.
I've create application for image gallery. On the first panel I would place
an fullsize image and on the next panel I wanna put a scrollable thumbnail
panel. So, I need to send Ajax request through the separate panels..
My thumbnail panel works pretty nice themself. Now I going to add Ajax
functionality to display fullsize image by clicking any thumbnail and I was
stuck. Actually I don't understand what AjaxFallbackLink doing, which data
it should be transfer to RequestTarget??. IModel? Pojo? What exactly? Please
help me! My next code don't return me anything errors but simultaneously
didn't doing what I want.
My appologize if similar question already was sounds here but I can't find..
// ThumbnailPanel constructor
public ThumbnailPanel(String id) {
super(id);
// invoke service method to get image filenames, checking file
formats, etc..
Set<String> imageFiles = getResourceFileNames("/resources");
// invoke service method to create ready-to-display thumbnail list
List<WebResource> thumbnailList = getThumbnailsList(imageFiles);
// add a repeater with clickable thumbnails
ListView listview = new ListView("listview", thumbnailList) {
protected void populateItem(ListItem item) {
Link link = new AjaxFallbackLink("link", item.getModel()) {
public void onClick(AjaxRequestTarget target) {
if (target != null) {
Object model = getModelObject();
// --???--
// What i should to do here ??
// --???--
// here getImageDisplayComponent() is a getter
method for local fild with ImagePanel reference
// Image.class is a child of ImagePanel
target.addChildren(getImageDisplayComponent(),
Image.class); //
}
};
};
link.add(new Image("thumbnailitem", item.getModel()));
item.add(link);
}
};
//
WebMarkupContainer thumbnailDiv = new
WebMarkupContainer("thumbnailpanel");
thumbnailDiv.add(new SimpleAttributeModifier("style", "width: " +
getThumbnailPanelWidth().toString() + "px;" ));
add(thumbnailDiv.add(listview));
}
// ImagePanel constructor
public ImagePanel(String id) {
super(id);
Image image = new Image("image");
image.setOutputMarkupId(true);
add(image);
}
// page constructor
public HomePage() {
ImagePanel imagePanel = new ImagePanel("imagepanel");
ThumbnailPanel thumbnailPanel = new
ThumbnailPanel("thumbnailtoolpanel");
thumbnailPanel.setImageDisplayComponent(imagePanel);
add(imagePanel);
ThumbnailBorder border = new ThumbnailBorder("thumbnailwidget");
border.setRenderBodyOnly(true);
border.getBodyContainer().add(new
NavButtonPanelLeft("navpanelleft"));
border.getBodyContainer().add(thumbnailPanel);
border.getBodyContainer().add(new
NavButtonPanelRight("navpanelright"));
add(border);
}
--
View this message in context:
http://apache-wicket.1842946.n4.nabble.com/How-AjaxFallbackLink-work-tp4171539p4171539.html
Sent from the Users forum mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]