Hello there!
I'm with problems refreshing an Image. On my web application i'm trying to
refresh or change an Image that is on a Panel. On the panel there is a Image
(it is rendered the first time) and a label. Outside the panel i have
AjaxLink's (that are images too) that refresh the panel, and consequently
the components on it, the image and the label. when the link is clicked, the
label e refreshed with the new text, but the image still the same. The code
is the following:
/**
*The Panel with the image to be refreshed:
*(the label on the panel is freshed when the link is pressed.
**/
public class PhotoPanel extends Panel {
/** Creates a new instance of PhotoPanel*/
public PhotoPanel(String id, byte[] photoData, int size, Integer index)
{
super(id);
setOutputMarkupId(true);
MyImage mainPhoto = new MyImage("mainPhoto", photoData,
size);//component that extends Image
mainPhoto.setOutputMarkupId(true);
Label label = new Label("index", "MYLABEL: " + index.toString());
add(mainPhoto);
add(label);
}
}
/**
* The AjaxLink's on a Parent panel that holds a panel with the links, and
the panel with the image
* to be refreshed
**/
private class PhotoSlideLink extends AjaxLink {
private byte[] photoSlideData = null;
Integer index = 0;
public PhotoSlideLink(String id, byte[] photoSlideData ) {
super(id);
this.photoSlideData = photoSlideData ;
MyImage photoSlide = new MyImage("photoSlide", photoSlideData ,
100);
add(photoSlide );
}
@Override
public void onClick(AjaxRequestTarget ajaxRequestTarget) {
Panel newMainPhotoPanel = new PhotoPanel("mainPhotoPanel",
photoSlideData , MAIN_PHOTO_SIZE, index++);
newMainPhotoPanel .setOutputMarkupId(true);
/*the first PhotoPanel created when the page was loaded*/
mainPhotoPanel.replaceWith(newMainPhotoPanel);
mainPhotoPanel= newMainPhotoPanel ;
ajaxRequestTarget.addComponent(newMainPhotoPanel);
}
}
Does any one know why refreshing the panel, the label change, but not the
image? Am i forgetting to do something?
Thanks a lot
--
View this message in context:
http://www.nabble.com/Problems-Refreshin-a-Image-from-AjaxLink-tp14472713p14472713.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]