Please use some pastebin service. It is hard to read and follow this code. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov
On Fri, Apr 22, 2016 at 10:43 PM, durairaj t <[email protected]> wrote: > Thank you Martin. I tried with examples but those are not working in my > case. I don't know how to call the onEvent in line number 19 in the below > code snippet. Please share me if you have any examples. > > > 1. public class FieldSearchTextField extends MaskedTextField{ > 2. ResultRow selectedRow; > 3. /* page creator */ > 4. modalWindow.setPageCreator (new ModalWindow.PageCreator() { > 5. public Page createPage() { > 6. FieldSearchModalPage casePartyModalPage = new > FieldSearchModalPage(searchOption, modalWindow){ > 7. @Override > 8. public void updateValue(ResultRow row, AjaxRequestTarget target) { > 9. selectedRow = row;* //selectedRow is not null here* > 10. getPageReference().getPage().send( getPage(), Broadcast.BREADTH,new > GridValueChangeEvent(target)); > 11. } > 12. } > 13. } > 14. } > 15. /* window close call back*/ > 16. modalWindow.setWindowClosedCallback(new > ModalWindow.WindowClosedCallback() { > 17. @Override > 18. public void onClose(AjaxRequestTarget target) { > 19. *??????????????????????????????* > 20. onFieldSearchWindowClose(selectedRow, target);*// selectedRow is > null here.* > 21. } > 22. } > 23. @Override > 24. public void onEvent(IEvent event) { > 25. if(event.getPayload() instanceof GridValueChangeEvent) { > 26. GridValueChangeEvent gridValueChangeEvent = ((GridValueChangeEvent) > event.getPayload()); > 27. } > 28. } > 29. } > 30. > > > On Sat, Apr 16, 2016 at 3:03 PM, Martin Grigorov <[email protected]> > wrote: > > > 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, > > > > > > > > > > > > > > >
