Hi,

The problem is the same.
In your first question you were asking for MyPanel.this, now you ask for
TextField.this.

If you cannot use Panel backed ModalWindow then use
pageRef.getPage().send(pageRef.getPage(), Broadcast.BREADTH, new
MyModalClosedEvent()) and listen for this event in all components which
should be repainted.

Martin Grigorov
Wicket Training and Consulting
https://twitter.com/mtgrigorov

On Fri, Apr 15, 2016 at 4:01 PM, durairaj t <[email protected]> wrote:

> "openerPage.getPageReference()"  is working with the pages, not in the
> customized wicket component classes (like TextField and Panels..etc). do we
> have any other way to get the modified objects from the customized
> component classes?
>
> for example;
> ------------------
> public class FieldSearchTextField  extends MaskedTextField{
>
>  ResultRow selectedRow;
>
> /* window close call back*/
>
>    modalWindow.setWindowClosedCallback(new
> ModalWindow.WindowClosedCallback()  {
>    @Override
>    public void onClose(AjaxRequestTarget target)
>    {
>     onFieldSearchWindowClose(selectedRow, target);*// selectedRow is null
> here.*
>    }
>
> /*   page creator */
>
>   modalWindow.setPageCreator (new ModalWindow.PageCreator() {
>    public Page createPage() {
>       FieldSearchModalPage casePartyModalPage = new
> FieldSearchModalPage(searchOption, modalWindow){
>         @Override
>    public void updateValue(ResultRow row, AjaxRequestTarget target) {
>         selectedRow = row;* //selectedRow is not null here*
>         }
>        }
>       }
>      }
>
>
> Parent classes:
> -------------------------
> public class MaskedTextField  extends StringTextField implements
> ITextFormatProvider {}
> public class StringTextField extends ErroringTextField<String> {}
> public class ErroringTextField<T>  extends TextField<T> {}
>
> Like "MyTextFieldPanel" I'm not getting modified values in the customized
> components. This is the cases I'm facing in all the customized components
> not only in the "MyTextFieldPanel".
>
>
> Any help?
>
>
> On Tue, Apr 12, 2016 at 4:54 AM, Martin Grigorov <[email protected]>
> wrote:
>
> > Hi,
> >
> > If you use ModalWindow based on a Page then you have to keep a reference
> to
> > that page by using openerPage.getPageReference().
> > Later when you need to update the opener page you have to use
> > "pageRef.getPage()".
> > You can see
> >
> >
> https://github.com/apache/wicket/blob/686058119dd795b3de7f2016e3e64fb8f025f813/wicket-examples/src/main/java/org/apache/wicket/examples/ajax/builtin/modal/ModalContent1Page.java
> > for example.
> >
> > The problem in your case is that the opener's instance of
> MyTextFieldPanel
> > is serialized when the modal window's page is opened. Later when you
> close
> > the modal it works on the old version, not the latest one that is
> > deserialized with the opener page.
> >
> > If you use ModalWindow with a Panel then there is no such issue.
> >
> > Martin Grigorov
> > Wicket Training and Consulting
> > https://twitter.com/mtgrigorov
> >
> > On Mon, Apr 11, 2016 at 10:42 PM, durairaj t <[email protected]>
> > wrote:
> >
> > > Hi,
> > >
> > >
> > >
> > > I'm using "*new* ModalWindow.WindowClosedCallback(){}" to update the
> > > modified value in a text field box by invoking the * target.add(*
> > > *MyTextFieldPanel.this**)*, but it is always giving the old values.
> > >
> > >
> > > I'm seeing only old values in *MyTextFieldPanel.this. *
> > >
> > >
> > > Code snippet for a clear picture.
> > >
> > >
> > > public class AimShuttleTextFieldPanel extends Panel
> > >
> > >
> > > modalShuttleWindow.setWindowClosedCallback(new
> > > ModalWindow.WindowClosedCallback() {
> > >
> > > public void onClose(AjaxRequestTarget target) {
> > >
> > > target.add(*MyTextFieldPanel.this*);
> > >
> > > onWindowClose(target);
> > >
> > > }
> > >
> > > });
> > >
> > >
> > > Any help?
> > >
> > >
> > >
> > > Thanks,
> > >
> >
>

Reply via email to