Re: updating components on Page from ModalWindow's internal Page's components

2007-10-29 Thread Martijn Dashorst
Not sure if it is relevant, but to update images using ajax you need
to generate a unique URL by adding a timestamp or random number to it.

Martijn

On 10/29/07, Kirk Israel [EMAIL PROTECTED] wrote:
 I'm still having the fundamental problem of an Image refusing to
 update. (A coworker suggested that it might be that I wasn't (yet)
 updating the underlying model that the page was drawing from, which
 didn't smell like the problem to me, since I could see the
 component-based updating I thought I was doing, but I put in that
 change of updating the model, but still I  can NOT get the image part
 of the page to update.) The Label subcomponent of the component is
 updating fine, but, the ImageComponent (a wrapper to a Wicket Image)
 seems as fix'd as the north star.

 I'm working with my own MediaComponent class. It has one of our
 ImageComponent, added thus:
   mImageComponent = new 
 ImageComponent(mediaimage,mResource,pClassStyle);
 mImageComponent.setOutputMarkupId(true);
 add(mImageComponent);

 (the mResource here is our MMSDataResource which extends Wicket's
 DynamicImageResource )

 Then when it comes time to update w/ the MMSDataResource passed back
 from the ModalWindow, I do this:
 ImageComponent newImageComponent = new
 ImageComponent(mediaimage,mResource,mClassStyle);
 newImageComponent.setOutputMarkupId(true);
 mImageComponent.replaceWith(newImageComponent);
 mImageComponent = newImageComponent;
 pTarget.addComponent(MediaPanel.this);

 i can add a pTarget.addComponent(mImageComponent); to no avail; if I
 put it before the swap so the reference is to the old
 mImageComponent, it rightly complains, and doesn't make a difference
 coming later... I think adding the MediaPanel itself means the
 imageComponent inside of it gets redrawn via Ajax too.

 So I see that MMSDataResource's getImageData() is NOT being called by
 DynamicImageResource for the Ajax re-render. I see the whole
 MediaPanel getting redrawn in the Ajax debug window, but apparently
 the Image reference from ImageComponent is the same old thing.

 I know there are a few places in my group's code that I might be the
 actual source of the problem, but can anyone see if I'm doing
 something wrong? Can't you swap in a new subcomponent during an
 AjaxRequestTarget-driven update? Is there a likely culprit, or
 something else that needs to be explicitly added to the
 AjaxRequestTarget ?

 Thanks...
 Kirk

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-- 
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.0-beta4 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta4/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: updating components on Page from ModalWindow's internal Page's components

2007-10-29 Thread Kirk Israel
I'm still having the fundamental problem of an Image refusing to
update. (A coworker suggested that it might be that I wasn't (yet)
updating the underlying model that the page was drawing from, which
didn't smell like the problem to me, since I could see the
component-based updating I thought I was doing, but I put in that
change of updating the model, but still I  can NOT get the image part
of the page to update.) The Label subcomponent of the component is
updating fine, but, the ImageComponent (a wrapper to a Wicket Image)
seems as fix'd as the north star.

I'm working with my own MediaComponent class. It has one of our
ImageComponent, added thus:
  mImageComponent = new ImageComponent(mediaimage,mResource,pClassStyle);
mImageComponent.setOutputMarkupId(true);
add(mImageComponent);

(the mResource here is our MMSDataResource which extends Wicket's
DynamicImageResource )

Then when it comes time to update w/ the MMSDataResource passed back
from the ModalWindow, I do this:
ImageComponent newImageComponent = new
ImageComponent(mediaimage,mResource,mClassStyle);
newImageComponent.setOutputMarkupId(true);
mImageComponent.replaceWith(newImageComponent);
mImageComponent = newImageComponent;
pTarget.addComponent(MediaPanel.this);

i can add a pTarget.addComponent(mImageComponent); to no avail; if I
put it before the swap so the reference is to the old
mImageComponent, it rightly complains, and doesn't make a difference
coming later... I think adding the MediaPanel itself means the
imageComponent inside of it gets redrawn via Ajax too.

So I see that MMSDataResource's getImageData() is NOT being called by
DynamicImageResource for the Ajax re-render. I see the whole
MediaPanel getting redrawn in the Ajax debug window, but apparently
the Image reference from ImageComponent is the same old thing.

I know there are a few places in my group's code that I might be the
actual source of the problem, but can anyone see if I'm doing
something wrong? Can't you swap in a new subcomponent during an
AjaxRequestTarget-driven update? Is there a likely culprit, or
something else that needs to be explicitly added to the
AjaxRequestTarget ?

Thanks...
Kirk

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: updating components on Page from ModalWindow's internal Page's components

2007-10-29 Thread Matej Knopp
Are you sure that the newly added image has different src attribute 
(e.g. adding a timestamp) than the old one? No-cache and no-store 
headers on the image itself don't prevent the browser from caching 
images on one page.


-Matej

Kirk Israel  wrote / napĂ­sal(a):

I'm still having the fundamental problem of an Image refusing to
update. (A coworker suggested that it might be that I wasn't (yet)
updating the underlying model that the page was drawing from, which
didn't smell like the problem to me, since I could see the
component-based updating I thought I was doing, but I put in that
change of updating the model, but still I  can NOT get the image part
of the page to update.) The Label subcomponent of the component is
updating fine, but, the ImageComponent (a wrapper to a Wicket Image)
seems as fix'd as the north star.

I'm working with my own MediaComponent class. It has one of our
ImageComponent, added thus:
  mImageComponent = new ImageComponent(mediaimage,mResource,pClassStyle);
mImageComponent.setOutputMarkupId(true);
add(mImageComponent);

(the mResource here is our MMSDataResource which extends Wicket's
DynamicImageResource )

Then when it comes time to update w/ the MMSDataResource passed back
from the ModalWindow, I do this:
ImageComponent newImageComponent = new
ImageComponent(mediaimage,mResource,mClassStyle);
newImageComponent.setOutputMarkupId(true);
mImageComponent.replaceWith(newImageComponent);
mImageComponent = newImageComponent;
pTarget.addComponent(MediaPanel.this);

i can add a pTarget.addComponent(mImageComponent); to no avail; if I
put it before the swap so the reference is to the old
mImageComponent, it rightly complains, and doesn't make a difference
coming later... I think adding the MediaPanel itself means the
imageComponent inside of it gets redrawn via Ajax too.

So I see that MMSDataResource's getImageData() is NOT being called by
DynamicImageResource for the Ajax re-render. I see the whole
MediaPanel getting redrawn in the Ajax debug window, but apparently
the Image reference from ImageComponent is the same old thing.

I know there are a few places in my group's code that I might be the
actual source of the problem, but can anyone see if I'm doing
something wrong? Can't you swap in a new subcomponent during an
AjaxRequestTarget-driven update? Is there a likely culprit, or
something else that needs to be explicitly added to the
AjaxRequestTarget ?

Thanks...
Kirk

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: updating components on Page from ModalWindow's internal Page's components

2007-10-29 Thread Martijn Dashorst
search the list for updating images using ajax. It should give about
5-10 threads easily.

And this finds:
http://issues.apache.org/jira/browse/WICKET-939

Martijn

On 10/30/07, Kirk Israel [EMAIL PROTECTED] wrote:
 This might well be the problem.
 How do you explicitly postpend something to the URL of a Wicket Image?
 The URLs we've been using are autogenerated, and my Google mojo is
 failing me... it doesn't have anything to do with .forURL(), does it?

 On 10/29/07, Martijn Dashorst [EMAIL PROTECTED] wrote:
  Not sure if it is relevant, but to update images using ajax you need
  to generate a unique URL by adding a timestamp or random number to it.
 
  Martijn
 
  On 10/29/07, Kirk Israel [EMAIL PROTECTED] wrote:
   I'm still having the fundamental problem of an Image refusing to
   update. (A coworker suggested that it might be that I wasn't (yet)
   updating the underlying model that the page was drawing from, which
   didn't smell like the problem to me, since I could see the
   component-based updating I thought I was doing, but I put in that
   change of updating the model, but still I  can NOT get the image part
   of the page to update.) The Label subcomponent of the component is
   updating fine, but, the ImageComponent (a wrapper to a Wicket Image)
   seems as fix'd as the north star.
  
   I'm working with my own MediaComponent class. It has one of our
   ImageComponent, added thus:
 mImageComponent = new 
   ImageComponent(mediaimage,mResource,pClassStyle);
   mImageComponent.setOutputMarkupId(true);
   add(mImageComponent);
  
   (the mResource here is our MMSDataResource which extends Wicket's
   DynamicImageResource )
  
   Then when it comes time to update w/ the MMSDataResource passed back
   from the ModalWindow, I do this:
   ImageComponent newImageComponent = new
   ImageComponent(mediaimage,mResource,mClassStyle);
   newImageComponent.setOutputMarkupId(true);
   mImageComponent.replaceWith(newImageComponent);
   mImageComponent = newImageComponent;
   pTarget.addComponent(MediaPanel.this);
  
   i can add a pTarget.addComponent(mImageComponent); to no avail; if I
   put it before the swap so the reference is to the old
   mImageComponent, it rightly complains, and doesn't make a difference
   coming later... I think adding the MediaPanel itself means the
   imageComponent inside of it gets redrawn via Ajax too.
  
   So I see that MMSDataResource's getImageData() is NOT being called by
   DynamicImageResource for the Ajax re-render. I see the whole
   MediaPanel getting redrawn in the Ajax debug window, but apparently
   the Image reference from ImageComponent is the same old thing.
  
   I know there are a few places in my group's code that I might be the
   actual source of the problem, but can anyone see if I'm doing
   something wrong? Can't you swap in a new subcomponent during an
   AjaxRequestTarget-driven update? Is there a likely culprit, or
   something else that needs to be explicitly added to the
   AjaxRequestTarget ?
  
   Thanks...
   Kirk
  
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
  
 
 
  --
  Buy Wicket in Action: http://manning.com/dashorst
  Apache Wicket 1.3.0-beta4 is released
  Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta4/
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]




-- 
Buy Wicket in Action: http://manning.com/dashorst
Apache Wicket 1.3.0-beta4 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta4/

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: updating components on Page from ModalWindow's internal Page's components

2007-10-29 Thread Kirk Israel
This might well be the problem.
How do you explicitly postpend something to the URL of a Wicket Image?
The URLs we've been using are autogenerated, and my Google mojo is
failing me... it doesn't have anything to do with .forURL(), does it?

On 10/29/07, Martijn Dashorst [EMAIL PROTECTED] wrote:
 Not sure if it is relevant, but to update images using ajax you need
 to generate a unique URL by adding a timestamp or random number to it.

 Martijn

 On 10/29/07, Kirk Israel [EMAIL PROTECTED] wrote:
  I'm still having the fundamental problem of an Image refusing to
  update. (A coworker suggested that it might be that I wasn't (yet)
  updating the underlying model that the page was drawing from, which
  didn't smell like the problem to me, since I could see the
  component-based updating I thought I was doing, but I put in that
  change of updating the model, but still I  can NOT get the image part
  of the page to update.) The Label subcomponent of the component is
  updating fine, but, the ImageComponent (a wrapper to a Wicket Image)
  seems as fix'd as the north star.
 
  I'm working with my own MediaComponent class. It has one of our
  ImageComponent, added thus:
mImageComponent = new 
  ImageComponent(mediaimage,mResource,pClassStyle);
  mImageComponent.setOutputMarkupId(true);
  add(mImageComponent);
 
  (the mResource here is our MMSDataResource which extends Wicket's
  DynamicImageResource )
 
  Then when it comes time to update w/ the MMSDataResource passed back
  from the ModalWindow, I do this:
  ImageComponent newImageComponent = new
  ImageComponent(mediaimage,mResource,mClassStyle);
  newImageComponent.setOutputMarkupId(true);
  mImageComponent.replaceWith(newImageComponent);
  mImageComponent = newImageComponent;
  pTarget.addComponent(MediaPanel.this);
 
  i can add a pTarget.addComponent(mImageComponent); to no avail; if I
  put it before the swap so the reference is to the old
  mImageComponent, it rightly complains, and doesn't make a difference
  coming later... I think adding the MediaPanel itself means the
  imageComponent inside of it gets redrawn via Ajax too.
 
  So I see that MMSDataResource's getImageData() is NOT being called by
  DynamicImageResource for the Ajax re-render. I see the whole
  MediaPanel getting redrawn in the Ajax debug window, but apparently
  the Image reference from ImageComponent is the same old thing.
 
  I know there are a few places in my group's code that I might be the
  actual source of the problem, but can anyone see if I'm doing
  something wrong? Can't you swap in a new subcomponent during an
  AjaxRequestTarget-driven update? Is there a likely culprit, or
  something else that needs to be explicitly added to the
  AjaxRequestTarget ?
 
  Thanks...
  Kirk
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 


 --
 Buy Wicket in Action: http://manning.com/dashorst
 Apache Wicket 1.3.0-beta4 is released
 Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.0-beta4/

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: updating components on Page from ModalWindow's internal Page's components

2007-10-24 Thread Kirk Israel
I came to a similar conclusion shortly before reading this.

So now I seem to be updating in the correct place, but I'm having
trouble getting the image component to swap out within the
onClose(AjaxRequestTarget pTarget)

Inside the ModalWindow, assuming I previously did a setOutputMarkupId
on the original component, something like this works:

Component newComponent = new Component();
origComponent.replaceWith(newComponent);
origComponent = newComponent;

Should I be able to do something similar inside the onClose, and get
Ajax to replace the component? I add both the old and the new object
to the AjaxRequestTarget w/ addComponent, but it doesn't seem to be
updating properly...




On 10/23/07, Matej Knopp [EMAIL PROTECTED] wrote:
 Problem is that AjaxRequestTarget only applies to one page. If you
 want to update the outer page (assuming that you have another page
 inside modal window, not a panel), the only way to do it is from
 within WindowClosedCallback registered to modal window. So you have to
 mark somehow dirty components on parent page and then update those
 when modal window closes.

 -Matej

 On 10/23/07, Kirk Israel [EMAIL PROTECTED] wrote:
  So I spoke too soon about this working out... I think the core problem
  is kind of simple:
  How can a component of a page inside a ModalWindow update components
  on the page that holds the Modal Window?
 
  More Specifically:
  I have an EditCreativePage that creates an instance of
  UploadMediaPanelPage, then creates a ModalWindow with a createPage()
  that gets the instance of the  UploadMediaPanelPage.
  EditCreativePage has a MediaPanel that has a link that sets a
  callback inside of UploadMediaPanelPage and calls the
  ModalWindow.show()
 
  UploadMediaPanelPage has an upload Form, whose onSubmit seems to do
  a fine job of parsing data of the uploaded image, and shows a preview
  panel w/ the image etc. UploadMediaPanelPage also has its own
  AjaxLinks for Ok and Cancel - when I pass the AjaxRequestTarget
  the onClick for OK gets back to the MediaPanel, and it tries to
  update itself and its embedded ImageComponent.
 
  Now, when I forget to call MediaPanel.setOutputMarkupId(true), the
  ModalWindow shows the exception
 
   java.lang.IllegalArgumentException: cannot update component that does
  not have setOutputMarkupId property set to true.
 
  when I do call MediaPanel.setOutputMarkupId(true), there's no
  exception, but the Ajax Debug window *inside the ModalWindow* shows
  something like
 
  ERROR: Component with id [[mediaimage40]] a was not found while trying
  to perform markup update. Make sure you called
  component.setOutputMarkupId(true) on the component whose markup you
  are trying to update.
 
  and nothing shows up in th Ajax Debug of EditCreativePage, which is
  probably the problem...
 
  Is there a work around for this? Either direct, or do I need to
  somehow override the ModalWindow setWindowClosedCallback ? But in that
  case, what do I use for an AjaxRequestTarget ?
 
  Thanks for any help...
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



updating components on Page from ModalWindow's internal Page's components

2007-10-23 Thread Kirk Israel
So I spoke too soon about this working out... I think the core problem
is kind of simple:
How can a component of a page inside a ModalWindow update components
on the page that holds the Modal Window?

More Specifically:
I have an EditCreativePage that creates an instance of
UploadMediaPanelPage, then creates a ModalWindow with a createPage()
that gets the instance of the  UploadMediaPanelPage.
EditCreativePage has a MediaPanel that has a link that sets a
callback inside of UploadMediaPanelPage and calls the
ModalWindow.show()

UploadMediaPanelPage has an upload Form, whose onSubmit seems to do
a fine job of parsing data of the uploaded image, and shows a preview
panel w/ the image etc. UploadMediaPanelPage also has its own
AjaxLinks for Ok and Cancel - when I pass the AjaxRequestTarget
the onClick for OK gets back to the MediaPanel, and it tries to
update itself and its embedded ImageComponent.

Now, when I forget to call MediaPanel.setOutputMarkupId(true), the
ModalWindow shows the exception

 java.lang.IllegalArgumentException: cannot update component that does
not have setOutputMarkupId property set to true.

when I do call MediaPanel.setOutputMarkupId(true), there's no
exception, but the Ajax Debug window *inside the ModalWindow* shows
something like

ERROR: Component with id [[mediaimage40]] a was not found while trying
to perform markup update. Make sure you called
component.setOutputMarkupId(true) on the component whose markup you
are trying to update.

and nothing shows up in th Ajax Debug of EditCreativePage, which is
probably the problem...

Is there a work around for this? Either direct, or do I need to
somehow override the ModalWindow setWindowClosedCallback ? But in that
case, what do I use for an AjaxRequestTarget ?

Thanks for any help...

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: updating components on Page from ModalWindow's internal Page's components

2007-10-23 Thread Matej Knopp
Problem is that AjaxRequestTarget only applies to one page. If you
want to update the outer page (assuming that you have another page
inside modal window, not a panel), the only way to do it is from
within WindowClosedCallback registered to modal window. So you have to
mark somehow dirty components on parent page and then update those
when modal window closes.

-Matej

On 10/23/07, Kirk Israel [EMAIL PROTECTED] wrote:
 So I spoke too soon about this working out... I think the core problem
 is kind of simple:
 How can a component of a page inside a ModalWindow update components
 on the page that holds the Modal Window?

 More Specifically:
 I have an EditCreativePage that creates an instance of
 UploadMediaPanelPage, then creates a ModalWindow with a createPage()
 that gets the instance of the  UploadMediaPanelPage.
 EditCreativePage has a MediaPanel that has a link that sets a
 callback inside of UploadMediaPanelPage and calls the
 ModalWindow.show()

 UploadMediaPanelPage has an upload Form, whose onSubmit seems to do
 a fine job of parsing data of the uploaded image, and shows a preview
 panel w/ the image etc. UploadMediaPanelPage also has its own
 AjaxLinks for Ok and Cancel - when I pass the AjaxRequestTarget
 the onClick for OK gets back to the MediaPanel, and it tries to
 update itself and its embedded ImageComponent.

 Now, when I forget to call MediaPanel.setOutputMarkupId(true), the
 ModalWindow shows the exception

  java.lang.IllegalArgumentException: cannot update component that does
 not have setOutputMarkupId property set to true.

 when I do call MediaPanel.setOutputMarkupId(true), there's no
 exception, but the Ajax Debug window *inside the ModalWindow* shows
 something like

 ERROR: Component with id [[mediaimage40]] a was not found while trying
 to perform markup update. Make sure you called
 component.setOutputMarkupId(true) on the component whose markup you
 are trying to update.

 and nothing shows up in th Ajax Debug of EditCreativePage, which is
 probably the problem...

 Is there a work around for this? Either direct, or do I need to
 somehow override the ModalWindow setWindowClosedCallback ? But in that
 case, what do I use for an AjaxRequestTarget ?

 Thanks for any help...

 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]