You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Marco Santos <mp...@gmail.com> on 2007/12/22 20:53:31 UTC
Problems Refreshin a Image from AjaxLink
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: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Problems Refreshin a Image from AjaxLink
Posted by Zhubin Salehi <zh...@yahoo.com>.
OK I couldn't figure out what was wrong so I did it as a last resort:
/* advanced search link */
AjaxSubmitLink advancedSearchLink;
mainTable.add(advancedSearchLink = new AjaxSubmitLink("advancedSearch") {
private static final long serialVersionUID = 4373219220751138123L;
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
advancedSearch = !advancedSearch;
target.addComponent(mainTable);
}
});
advancedSearchLink.add(new WebComponent("expand") {
private static final long serialVersionUID = 1566267580506427230L;
@Override
public boolean isVisible() {
return !advancedSearch;
}
});
advancedSearchLink.add(new WebComponent("collapse") {
private static final long serialVersionUID = 4204455496315941511L;
@Override
public boolean isVisible() {
return advancedSearch;
}
});
It's not the best way to go, but it works.
Zhubin
Zhubin Salehi wrote:
>
> I figured out if the page starts with 'advancedSearch = false' the image
> is always expand.gif and if it starts with 'advancedSearch = true' the
> image is always collapse.gif. So the value of Model object is cached
> somewhere, but not in the browser for sure.
>
> What I don't understand is that every time the panel is rendered,
> getObject() method is called but apparently the return value is ignored.
>
>
>
> Zhubin Salehi wrote:
>>
>> advancedSearch is in PersonDetailTab that is a panel in an AbstractTab in
>> a PanelCachingTab in FindUserAcountForm.
>>
>> Zhubin
>>
>>
>> igor.vaynberg wrote:
>>>
>>> is advancedSearch inside findUserAccountForm?
>>>
>>> -igor
>>>
>>> On Fri, Mar 6, 2009 at 9:23 AM, Zhubin Salehi <zh...@yahoo.com>
>>> wrote:
>>>>
>>>> Here is the source code without tabs:
>>>>
>>>> /* advanced search link */
>>>> add(new AjaxSubmitLink("advancedSearch") {
>>>>
>>>> private static final long serialVersionUID =
>>>> 3847759110695405700L;
>>>>
>>>> @Override
>>>> protected void onSubmit(AjaxRequestTarget target, Form<?> form)
>>>> {
>>>> advancedSearch = !advancedSearch;
>>>> target.addComponent(findUserAcountForm);
>>>> }
>>>> }.add(new NonCachingImage("expandCollapse", new Model<String>() {
>>>>
>>>> private static final long serialVersionUID =
>>>> 3430522655787763141L;
>>>>
>>>> @Override
>>>> public String getObject() {
>>>> return advancedSearch ? "/img/collapse.gif" :
>>>> "/img/expand.gif";
>>>> }
>>>> })));
>>>>
>>>> I hope it's more readable this way :-)
>>>>
>>>> Zhubin
>>>>
>>>> Zhubin Salehi wrote:
>>>>>
>>>>> Hi guys,
>>>>>
>>>>> I have a similar problem that NonCachingImage does not solve. I have
>>>>> implemented a simple expand/collapse button. I check the rendered page
>>>>> source in FireFox and image name is always "/img/expand.gif". Here is
>>>>> the
>>>>> code:
>>>>>
>>>>> /* advanced search link */
>>>>> add(new AjaxSubmitLink("advancedSearch") {
>>>>>
>>>>> private static final long
>>>>> serialVersionUID = 3847759110695405700L;
>>>>>
>>>>> @Override
>>>>> protected void
>>>>> onSubmit(AjaxRequestTarget target, Form<?> form) {
>>>>> advancedSearch =
>>>>> !advancedSearch;
>>>>>
>>>>> target.addComponent(findUserAcountForm);
>>>>> }
>>>>> }.add(new NonCachingImage("expandCollapse", new
>>>>> Model<String>() {
>>>>>
>>>>> private static final long
>>>>> serialVersionUID = 3430522655787763141L;
>>>>>
>>>>> @Override
>>>>> public String getObject() {
>>>>> return advancedSearch ?
>>>>> "/img/collapse.gif" : "/img/expand.gif";
>>>>> }
>>>>> })));
>>>>>
>>>>> Thanks,
>>>>> Zhubin
>>>>>
>>>>>
>>>>> Marco Santos wrote:
>>>>>>
>>>>>> 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-tp14472713p22376853.html
>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>>
>>
>
>
--
View this message in context: http://www.nabble.com/Problems-Refreshin-a-Image-from-AjaxLink-tp14472713p22380009.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Problems Refreshin a Image from AjaxLink
Posted by Zhubin Salehi <zh...@yahoo.com>.
I figured out if the page starts with 'advancedSearch = false' the image is
always expand.gif and if it starts with 'advancedSearch = true' the image is
always collapse.gif. So the value of Model object is cached somewhere, but
not in the browser for sure.
What I don't understand is that every time the panel is rendered,
getObject() method is called but apparently the return value is ignored.
Zhubin Salehi wrote:
>
> advancedSearch is in PersonDetailTab that is a panel in an AbstractTab in
> a PanelCachingTab in FindUserAcountForm.
>
> Zhubin
>
>
> igor.vaynberg wrote:
>>
>> is advancedSearch inside findUserAccountForm?
>>
>> -igor
>>
>> On Fri, Mar 6, 2009 at 9:23 AM, Zhubin Salehi <zh...@yahoo.com> wrote:
>>>
>>> Here is the source code without tabs:
>>>
>>> /* advanced search link */
>>> add(new AjaxSubmitLink("advancedSearch") {
>>>
>>> private static final long serialVersionUID =
>>> 3847759110695405700L;
>>>
>>> @Override
>>> protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
>>> advancedSearch = !advancedSearch;
>>> target.addComponent(findUserAcountForm);
>>> }
>>> }.add(new NonCachingImage("expandCollapse", new Model<String>() {
>>>
>>> private static final long serialVersionUID =
>>> 3430522655787763141L;
>>>
>>> @Override
>>> public String getObject() {
>>> return advancedSearch ? "/img/collapse.gif" :
>>> "/img/expand.gif";
>>> }
>>> })));
>>>
>>> I hope it's more readable this way :-)
>>>
>>> Zhubin
>>>
>>> Zhubin Salehi wrote:
>>>>
>>>> Hi guys,
>>>>
>>>> I have a similar problem that NonCachingImage does not solve. I have
>>>> implemented a simple expand/collapse button. I check the rendered page
>>>> source in FireFox and image name is always "/img/expand.gif". Here is
>>>> the
>>>> code:
>>>>
>>>> /* advanced search link */
>>>> add(new AjaxSubmitLink("advancedSearch") {
>>>>
>>>> private static final long
>>>> serialVersionUID = 3847759110695405700L;
>>>>
>>>> @Override
>>>> protected void onSubmit(AjaxRequestTarget
>>>> target, Form<?> form) {
>>>> advancedSearch = !advancedSearch;
>>>>
>>>> target.addComponent(findUserAcountForm);
>>>> }
>>>> }.add(new NonCachingImage("expandCollapse", new
>>>> Model<String>() {
>>>>
>>>> private static final long
>>>> serialVersionUID = 3430522655787763141L;
>>>>
>>>> @Override
>>>> public String getObject() {
>>>> return advancedSearch ?
>>>> "/img/collapse.gif" : "/img/expand.gif";
>>>> }
>>>> })));
>>>>
>>>> Thanks,
>>>> Zhubin
>>>>
>>>>
>>>> Marco Santos wrote:
>>>>>
>>>>> 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-tp14472713p22376853.html
>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>
>
>
--
View this message in context: http://www.nabble.com/Problems-Refreshin-a-Image-from-AjaxLink-tp14472713p22378723.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Problems Refreshin a Image from AjaxLink
Posted by Zhubin Salehi <zh...@yahoo.com>.
I figured out if the page starts with 'advancedSearch = false' the image is
always expand.gif and if it starts with 'advancedSearch = true' the image is
always collapse.gif. So the value of Model object is cached somewhere, but
not in the browser for sure.
What I don't understand is that every time the panel is rendered,
getObject() method is called but apparently the return value is ignored.
Zhubin Salehi wrote:
>
> advancedSearch is in PersonDetailTab that is a panel in an AbstractTab in
> a PanelCachingTab in FindUserAcountForm.
>
> Zhubin
>
>
> igor.vaynberg wrote:
>>
>> is advancedSearch inside findUserAccountForm?
>>
>> -igor
>>
>> On Fri, Mar 6, 2009 at 9:23 AM, Zhubin Salehi <zh...@yahoo.com> wrote:
>>>
>>> Here is the source code without tabs:
>>>
>>> /* advanced search link */
>>> add(new AjaxSubmitLink("advancedSearch") {
>>>
>>> private static final long serialVersionUID =
>>> 3847759110695405700L;
>>>
>>> @Override
>>> protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
>>> advancedSearch = !advancedSearch;
>>> target.addComponent(findUserAcountForm);
>>> }
>>> }.add(new NonCachingImage("expandCollapse", new Model<String>() {
>>>
>>> private static final long serialVersionUID =
>>> 3430522655787763141L;
>>>
>>> @Override
>>> public String getObject() {
>>> return advancedSearch ? "/img/collapse.gif" :
>>> "/img/expand.gif";
>>> }
>>> })));
>>>
>>> I hope it's more readable this way :-)
>>>
>>> Zhubin
>>>
>>> Zhubin Salehi wrote:
>>>>
>>>> Hi guys,
>>>>
>>>> I have a similar problem that NonCachingImage does not solve. I have
>>>> implemented a simple expand/collapse button. I check the rendered page
>>>> source in FireFox and image name is always "/img/expand.gif". Here is
>>>> the
>>>> code:
>>>>
>>>> /* advanced search link */
>>>> add(new AjaxSubmitLink("advancedSearch") {
>>>>
>>>> private static final long
>>>> serialVersionUID = 3847759110695405700L;
>>>>
>>>> @Override
>>>> protected void onSubmit(AjaxRequestTarget
>>>> target, Form<?> form) {
>>>> advancedSearch = !advancedSearch;
>>>>
>>>> target.addComponent(findUserAcountForm);
>>>> }
>>>> }.add(new NonCachingImage("expandCollapse", new
>>>> Model<String>() {
>>>>
>>>> private static final long
>>>> serialVersionUID = 3430522655787763141L;
>>>>
>>>> @Override
>>>> public String getObject() {
>>>> return advancedSearch ?
>>>> "/img/collapse.gif" : "/img/expand.gif";
>>>> }
>>>> })));
>>>>
>>>> Thanks,
>>>> Zhubin
>>>>
>>>>
>>>> Marco Santos wrote:
>>>>>
>>>>> 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-tp14472713p22376853.html
>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>
>
>
--
View this message in context: http://www.nabble.com/Problems-Refreshin-a-Image-from-AjaxLink-tp14472713p22378722.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Problems Refreshin a Image from AjaxLink
Posted by Zhubin Salehi <zh...@yahoo.com>.
advancedSearch is in PersonDetailTab that is a panel in an AbstractTab in a
PanelCachingTab in FindUserAcountForm.
Zhubin
igor.vaynberg wrote:
>
> is advancedSearch inside findUserAccountForm?
>
> -igor
>
> On Fri, Mar 6, 2009 at 9:23 AM, Zhubin Salehi <zh...@yahoo.com> wrote:
>>
>> Here is the source code without tabs:
>>
>> /* advanced search link */
>> add(new AjaxSubmitLink("advancedSearch") {
>>
>> private static final long serialVersionUID = 3847759110695405700L;
>>
>> @Override
>> protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
>> advancedSearch = !advancedSearch;
>> target.addComponent(findUserAcountForm);
>> }
>> }.add(new NonCachingImage("expandCollapse", new Model<String>() {
>>
>> private static final long serialVersionUID = 3430522655787763141L;
>>
>> @Override
>> public String getObject() {
>> return advancedSearch ? "/img/collapse.gif" :
>> "/img/expand.gif";
>> }
>> })));
>>
>> I hope it's more readable this way :-)
>>
>> Zhubin
>>
>> Zhubin Salehi wrote:
>>>
>>> Hi guys,
>>>
>>> I have a similar problem that NonCachingImage does not solve. I have
>>> implemented a simple expand/collapse button. I check the rendered page
>>> source in FireFox and image name is always "/img/expand.gif". Here is
>>> the
>>> code:
>>>
>>> /* advanced search link */
>>> add(new AjaxSubmitLink("advancedSearch") {
>>>
>>> private static final long serialVersionUID
>>> = 3847759110695405700L;
>>>
>>> @Override
>>> protected void onSubmit(AjaxRequestTarget
>>> target, Form<?> form) {
>>> advancedSearch = !advancedSearch;
>>>
>>> target.addComponent(findUserAcountForm);
>>> }
>>> }.add(new NonCachingImage("expandCollapse", new
>>> Model<String>() {
>>>
>>> private static final long serialVersionUID
>>> = 3430522655787763141L;
>>>
>>> @Override
>>> public String getObject() {
>>> return advancedSearch ?
>>> "/img/collapse.gif" : "/img/expand.gif";
>>> }
>>> })));
>>>
>>> Thanks,
>>> Zhubin
>>>
>>>
>>> Marco Santos wrote:
>>>>
>>>> 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-tp14472713p22376853.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/Problems-Refreshin-a-Image-from-AjaxLink-tp14472713p22376970.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Problems Refreshin a Image from AjaxLink
Posted by Igor Vaynberg <ig...@gmail.com>.
is advancedSearch inside findUserAccountForm?
-igor
On Fri, Mar 6, 2009 at 9:23 AM, Zhubin Salehi <zh...@yahoo.com> wrote:
>
> Here is the source code without tabs:
>
> /* advanced search link */
> add(new AjaxSubmitLink("advancedSearch") {
>
> private static final long serialVersionUID = 3847759110695405700L;
>
> @Override
> protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
> advancedSearch = !advancedSearch;
> target.addComponent(findUserAcountForm);
> }
> }.add(new NonCachingImage("expandCollapse", new Model<String>() {
>
> private static final long serialVersionUID = 3430522655787763141L;
>
> @Override
> public String getObject() {
> return advancedSearch ? "/img/collapse.gif" : "/img/expand.gif";
> }
> })));
>
> I hope it's more readable this way :-)
>
> Zhubin
>
> Zhubin Salehi wrote:
>>
>> Hi guys,
>>
>> I have a similar problem that NonCachingImage does not solve. I have
>> implemented a simple expand/collapse button. I check the rendered page
>> source in FireFox and image name is always "/img/expand.gif". Here is the
>> code:
>>
>> /* advanced search link */
>> add(new AjaxSubmitLink("advancedSearch") {
>>
>> private static final long serialVersionUID = 3847759110695405700L;
>>
>> @Override
>> protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
>> advancedSearch = !advancedSearch;
>> target.addComponent(findUserAcountForm);
>> }
>> }.add(new NonCachingImage("expandCollapse", new Model<String>() {
>>
>> private static final long serialVersionUID = 3430522655787763141L;
>>
>> @Override
>> public String getObject() {
>> return advancedSearch ? "/img/collapse.gif" : "/img/expand.gif";
>> }
>> })));
>>
>> Thanks,
>> Zhubin
>>
>>
>> Marco Santos wrote:
>>>
>>> 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-tp14472713p22376853.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Problems Refreshin a Image from AjaxLink
Posted by Zhubin Salehi <zh...@yahoo.com>.
Here is the source code without tabs:
/* advanced search link */
add(new AjaxSubmitLink("advancedSearch") {
private static final long serialVersionUID = 3847759110695405700L;
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
advancedSearch = !advancedSearch;
target.addComponent(findUserAcountForm);
}
}.add(new NonCachingImage("expandCollapse", new Model<String>() {
private static final long serialVersionUID = 3430522655787763141L;
@Override
public String getObject() {
return advancedSearch ? "/img/collapse.gif" : "/img/expand.gif";
}
})));
I hope it's more readable this way :-)
Zhubin
Zhubin Salehi wrote:
>
> Hi guys,
>
> I have a similar problem that NonCachingImage does not solve. I have
> implemented a simple expand/collapse button. I check the rendered page
> source in FireFox and image name is always "/img/expand.gif". Here is the
> code:
>
> /* advanced search link */
> add(new AjaxSubmitLink("advancedSearch") {
>
> private static final long serialVersionUID = 3847759110695405700L;
>
> @Override
> protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
> advancedSearch = !advancedSearch;
> target.addComponent(findUserAcountForm);
> }
> }.add(new NonCachingImage("expandCollapse", new Model<String>() {
>
> private static final long serialVersionUID = 3430522655787763141L;
>
> @Override
> public String getObject() {
> return advancedSearch ? "/img/collapse.gif" : "/img/expand.gif";
> }
> })));
>
> Thanks,
> Zhubin
>
>
> Marco Santos wrote:
>>
>> 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-tp14472713p22376853.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Problems Refreshin a Image from AjaxLink
Posted by Zhubin Salehi <zh...@yahoo.com>.
Hi guys,
I have a similar problem that NonCachingImage does not solve. I have
implemented a simple expand/collapse button. I check the rendered page
source in FireFox and image name is always "/img/expand.gif". Here is the
code:
/* advanced search link */
add(new AjaxSubmitLink("advancedSearch") {
private static final long serialVersionUID = 3847759110695405700L;
@Override
protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
advancedSearch = !advancedSearch;
target.addComponent(findUserAcountForm);
}
}.add(new NonCachingImage("expandCollapse", new Model<String>() {
private static final long serialVersionUID = 3430522655787763141L;
@Override
public String getObject() {
return advancedSearch ? "/img/collapse.gif" : "/img/expand.gif";
}
})));
Thanks,
Zhubin
Marco Santos wrote:
>
> 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-tp14472713p22376598.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Problems Refreshin a Image from AjaxLink
Posted by Eelco Hillenius <ee...@gmail.com>.
> Wicket in Action is definitely a long way from finished
Not really... we're working on the last chapter now.
Eelco
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Problems Refreshin a Image from AjaxLink
Posted by Loren Cole <lo...@gmail.com>.
I haven't found anything that does a good job covering Wicket 1.3 and I
haven't looked at books which cover older versions. There is "Enjoying Web
Development With Wicket" which is available as an ebook, but it is really a
series of how-to's - fairly superficial, with no real discussion of how the
guts of the thing work or best practices.
Wicket in Action is definitely a long way from finished but the available
chapters do provide a good grounding in fundamental concepts like models and
page layout/navigation.
On Dec 22, 2007 2:50 PM, Marco Santos <mp...@gmail.com> wrote:
>
> Thanks a lot! I worked!
>
> Tell me, do you know a good book about wicket? I have red the 1st chapter
> o
> Wicket in Action from manning and it seams nice, but it is not finished
> yet.
>
> Thanks again!
>
> --ms
>
>
> Matej Knopp-2 wrote:
> >
> > Image doesn't change because it's being cached by the browser.
> > To ensure that browser doesn't cache the image you need to append a
> > string to url that changes on every refresh.
> > Just like NonCachingImage does.
> >
> > -Matej
> >
> > On Dec 22, 2007 8:53 PM, Marco Santos <mp...@gmail.com> wrote:
> >>
> >> 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: users-unsubscribe@wicket.apache.org
> >> For additional commands, e-mail: users-help@wicket.apache.org
> >>
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Problems-Refreshin-a-Image-from-AjaxLink-tp14472713p14473189.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
Re: Problems Refreshin a Image from AjaxLink
Posted by Marco Santos <mp...@gmail.com>.
Thanks a lot! I worked!
Tell me, do you know a good book about wicket? I have red the 1st chapter o
Wicket in Action from manning and it seams nice, but it is not finished yet.
Thanks again!
--ms
Matej Knopp-2 wrote:
>
> Image doesn't change because it's being cached by the browser.
> To ensure that browser doesn't cache the image you need to append a
> string to url that changes on every refresh.
> Just like NonCachingImage does.
>
> -Matej
>
> On Dec 22, 2007 8:53 PM, Marco Santos <mp...@gmail.com> wrote:
>>
>> 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: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/Problems-Refreshin-a-Image-from-AjaxLink-tp14472713p14473189.html
Sent from the Wicket - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org
Re: Problems Refreshin a Image from AjaxLink
Posted by Matej Knopp <ma...@gmail.com>.
Image doesn't change because it's being cached by the browser.
To ensure that browser doesn't cache the image you need to append a
string to url that changes on every refresh.
Just like NonCachingImage does.
-Matej
On Dec 22, 2007 8:53 PM, Marco Santos <mp...@gmail.com> wrote:
>
> 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: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org