Re: Components/Behaviour execution order
Hi, @Patrick Yes, we had a behavior sequence order issue [1] that we just solved by calling super.onConfigure(component); at the end of #onConfigure. @Colin When I've complex cases, I am using the event bus. The key point is my magic AjaxPayload base class, so you can create ZStateChangedAjaxPayload extends AjaxPayload, sent from Z, and caught in Y#onEvent and/or any components/behaviors you want... I don't know if you already used the event bus in the past, but if it's not the case, you will like it! :) public class AjaxPayload { private final AjaxRequestTarget target; public AjaxPayload(AjaxRequestTarget target) { this.target = target; } public AjaxRequestTarget getTarget() { return this.target; } public void reload(Component... components) { this.getTarget().add(components); } } Hope this helps, Sebastien. [1] https://github.com/sebfz1/wicket-jquery-ui/issues/43 On Thu, Oct 1, 2015 at 8:57 AM, Patrick Davidswrote: > Hi Col., > sometimes I try to cheat by using onBeforeRender() in such cases to 'fake' > an order, because its called after onConfigure(). > But this has some restrictions concerning visibility issues of components. > But in simple dependencies this sometimes works for me. > > I think somewhere in wickets jira is an issue for a similar problem, to > feature defining a kind of order of behaviors. > Unfort. I'm not able to find it right away. > > (@Sebastien: I think, we had such problem someday... do you remember > maybe?) > > best regards > Patrick > > > Am 01.10.2015 um 06:27 schrieb Colin Rogers: > >> Wicketeers, >> >> This question is to do with lifecycle execution order - it's not a bug as >> such, just a usage question - I hope you can help. >> >> I have component X with an AjaxFormComponentUpdatingBehavior, that >> triggers updates in Components Y and Z by adding to target. >> >> Y has a generic Behaviour that updates it's data. Z needs to hide or show >> itself depending on Y's data state. >> >> Y needs to use that generic Behaviour, as it's complex, does loads of >> stuff and is used throughout the system - so I can't change this. >> >> Originally, in Z's onConfigure() we set the setVisible() depending on Y's >> state. But that doesn't work as Z's onConfigure() executes after Y's >> Behaviours onConfigure(). Which is just the way Component.configure() >> works. Which is fair enough. >> >> So, I figured if Behaviours execute after onConfigure, I simply put the >> setVisible() code into a Behaviour on Z, and bingo! >> >> Only Y's Behaviour always executes first. Always. Even if I create it >> second, even if I add Z to their parent container before Y. I can't work >> out how to affect the order of Components/Behaviour execution. >> >> Note - I did extend the Y's Behaviour to update Z, but as Z has already >> completed its cycle, the state didn't actually update. >> >> Can anyone help? >> >> Cheers, >> Col. >> EMAIL DISCLAIMER This email message and its attachments are confidential >> and may also contain copyright or privileged material. If you are not the >> intended recipient, you may not forward the email or disclose or use the >> information contained in it. If you have received this email message in >> error, please advise the sender immediately by replying to this email and >> delete the message and any associated attachments. Any views, opinions, >> conclusions, advice or statements expressed in this email message are those >> of the individual sender and should not be relied upon as the considered >> view, opinion, conclusions, advice or statement of this company except >> where the sender expressly, and with authority, states them to be the >> considered view, opinion, conclusions, advice or statement of this company. >> Every care is taken but we recommend that you scan any attachments for >> viruses. >> >> >
Re: Overriding wicket-ajax-jquery.js
What's happening now is the custom js is being loaded first hence i am getting reference error. Is there a way that the ajax js gets loaded after wicket's jquery and event js? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Overriding-wicket-ajax-jquery-js-tp4672051p4672080.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: Cannot set select2choice component in wicket tester
Thank you so much. Lois -Original Message- From: Martin Grigorov [mailto:mgrigo...@apache.org] Sent: Thursday, October 01, 2015 11:59 AM To: users@wicket.apache.org Subject: Re: Cannot set select2choice component in wicket tester Hi, Since Select2 is a JavaScript widget usually in WicketTester tests you just need to submit a value for it. FormTester ft = tester.newFormTester("theForm"); ft.setValue("path:to:select2Choice", "selectedOptionValue"); ft.submit(); Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Thu, Oct 1, 2015 at 7:44 AM, Lois GreeneHernandez < lgreenehernan...@knoa.com> wrote: > Hello All, > > My form has a select2choice component. I cannot seem to set this > field in my testing unit test. > > Any advice on how to deal with this would be greatly appreciated. > > Thanks > > Lois > >
Re: Cannot set select2choice component in wicket tester
Hi, Since Select2 is a JavaScript widget usually in WicketTester tests you just need to submit a value for it. FormTester ft = tester.newFormTester("theForm"); ft.setValue("path:to:select2Choice", "selectedOptionValue"); ft.submit(); Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Thu, Oct 1, 2015 at 7:44 AM, Lois GreeneHernandez < lgreenehernan...@knoa.com> wrote: > Hello All, > > My form has a select2choice component. I cannot seem to set this field in > my testing unit test. > > Any advice on how to deal with this would be greatly appreciated. > > Thanks > > Lois > >
RE: placeholder causes the BaseWicketTester#startComponentInPage to fail
Hello Martin: I created the following ticket: https://issues.apache.org/jira/browse/WICKET-5989 Thank you, - Ephraim -Original Message- From: Martin Grigorov [mailto:mgrigo...@apache.org] Sent: Wednesday, September 30, 2015 5:45 PM To: users@wicket.apache.org Subject: Re: placeholder causes the BaseWicketTester#startComponentInPage to fail Hi, Please create a quickstart app with 6.20.0 and attach it to a ticket in JIRA. Thanks! Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Wed, Sep 30, 2015 at 11:37 PM, Ephraim Rosenfeldwrote: > Hello Wicket Team: > > After adding the placeholder to the tag > of my base web page, my unit tests fails when the > BaseWicketTester#startComponentInPage is called, with the following message: > Error while parsing the markup for the autogenerated page: More than > one detected in the element. Only one is > allowed. > > I am overriding the BaseWicketTester#createPageMarkup to return the > markup of a dummy page that extends my base page w/ the > placeholder. > > When I put a break-point in the test, I see that the String returned > from the BaseWicketTester#createPageMarkup test method makes the > placeholder a non-emtpy tag, i.e. > "" instead of > "", although that may not matter. > > I am using Wicket version 6.15.0. > > Any idea as to why this is happening would greatly be appreciated. > > Thank you, > > - Ephraim >
Wicket ListView ajax removes always removes last element in list
Hi I posted this question on Stackoverflow, I'd like to do the same here as well now: I have a way to add panels in a listview. Each panel is associated with an Object of type Type. I have an 'add' and an some 'remove' AjaxSubmitLinks. Both have setDefaultFormProcessing(false) because I want non-submitted / validated values to remain when someone add or removes an element. setReuseItems(true) is set for the ListView. Please see the code snippet below. ListView itemContainer = new ListView("list", getList()) { @Override protected void populateItem(final ListItem listItem) { final Component element = createComponent(listItem.getModel()); listItem.add(element); listItem.add(new AjaxSubmitLink("remove") { @Override protected void onSubmit(AjaxRequestTarget target, Form form) { getList().remove(listItem.getIndex()); target.add(wrapper); } }.setDefaultFormProcessing(false)); } }; itemContainer.setReuseItems(true); add(itemContainer); add(new AjaxSubmitLink("add") { @Override protected void onSubmit(AjaxRequestTarget target, Form form) { Type object = addObject(); getList().add(object); target.add(wrapper); } @Override public boolean isVisible() { return getList().size() < DSAddableField.this.max && isEditable(); } }.setDefaultFormProcessing(false)); Where wrapper contains everything, so everything is reloaded with Ajax. All works well, expcet no matter which remove link I click the last element is being removed. equals() method is overriden on Type based on a UUID check. I did a debug and it would seem to me that the right element is removed from the ListModel, but wrong values are sent down by the ajax response. How can I get this to work? I tried to remove setReuseItem(true), but than the non-saved values for list items were not reloaded. (Panels contain lot of input fields) Any suggestions? UPDATE: I already tried to remove the object with getList().remove(listItem.getModelObject()), this was second solution but still failed. Regardless if I use remove by index or by modelobject the right element is being removed from the list when using debugger. UDAPTE 2: If I remove "final int index = listItem.getIndex();" the right element is removed opposed to the last one but when I add a new one to the list non saved inputs are cleared which is the original problem I'm trying to solve. Please advise. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-ListView-ajax-removes-always-removes-last-element-in-list-tp4672088.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket ListView ajax removes always removes last element in list
Hi, please show us #createComponent(). It seems to me that the item is correctly removed from the list, but your components still cling to the former item under their index. Have fun Sven On 01.10.2015 22:55, petivagyoken wrote: Hi I posted this question on Stackoverflow, I'd like to do the same here as well now: I have a way to add panels in a listview. Each panel is associated with an Object of type Type. I have an 'add' and an some 'remove' AjaxSubmitLinks. Both have setDefaultFormProcessing(false) because I want non-submitted / validated values to remain when someone add or removes an element. setReuseItems(true) is set for the ListView. Please see the code snippet below. ListView itemContainer = new ListView("list", getList()) { @Override protected void populateItem(final ListItem listItem) { final Component element = createComponent(listItem.getModel()); listItem.add(element); listItem.add(new AjaxSubmitLink("remove") { @Override protected void onSubmit(AjaxRequestTarget target, Form form) { getList().remove(listItem.getIndex()); target.add(wrapper); } }.setDefaultFormProcessing(false)); } }; itemContainer.setReuseItems(true); add(itemContainer); add(new AjaxSubmitLink("add") { @Override protected void onSubmit(AjaxRequestTarget target, Form form) { Type object = addObject(); getList().add(object); target.add(wrapper); } @Override public boolean isVisible() { return getList().size() < DSAddableField.this.max && isEditable(); } }.setDefaultFormProcessing(false)); Where wrapper contains everything, so everything is reloaded with Ajax. All works well, expcet no matter which remove link I click the last element is being removed. equals() method is overriden on Type based on a UUID check. I did a debug and it would seem to me that the right element is removed from the ListModel, but wrong values are sent down by the ajax response. How can I get this to work? I tried to remove setReuseItem(true), but than the non-saved values for list items were not reloaded. (Panels contain lot of input fields) Any suggestions? UPDATE: I already tried to remove the object with getList().remove(listItem.getModelObject()), this was second solution but still failed. Regardless if I use remove by index or by modelobject the right element is being removed from the list when using debugger. UDAPTE 2: If I remove "final int index = listItem.getIndex();" the right element is removed opposed to the last one but when I add a new one to the list non saved inputs are cleared which is the original problem I'm trying to solve. Please advise. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-ListView-ajax-removes-always-removes-last-element-in-list-tp4672088.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket ListView ajax removes always removes last element in list
Show us the code. Sven On 01.10.2015 23:42, petivagyoken wrote: createComponent is an abstract method that creates a simple Panel with input fields, it has no markupid set or anything. Maybe that is the issue? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-ListView-ajax-removes-always-removes-last-element-in-list-tp4672088p4672090.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket ListView ajax removes always removes last element in list
createComponent is an abstract method that creates a simple Panel with input fields, it has no markupid set or anything. Maybe that is the issue? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-ListView-ajax-removes-always-removes-last-element-in-list-tp4672088p4672090.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Components/Behaviour execution order
Hi Col., sometimes I try to cheat by using onBeforeRender() in such cases to 'fake' an order, because its called after onConfigure(). But this has some restrictions concerning visibility issues of components. But in simple dependencies this sometimes works for me. I think somewhere in wickets jira is an issue for a similar problem, to feature defining a kind of order of behaviors. Unfort. I'm not able to find it right away. (@Sebastien: I think, we had such problem someday... do you remember maybe?) best regards Patrick Am 01.10.2015 um 06:27 schrieb Colin Rogers: Wicketeers, This question is to do with lifecycle execution order - it's not a bug as such, just a usage question - I hope you can help. I have component X with an AjaxFormComponentUpdatingBehavior, that triggers updates in Components Y and Z by adding to target. Y has a generic Behaviour that updates it's data. Z needs to hide or show itself depending on Y's data state. Y needs to use that generic Behaviour, as it's complex, does loads of stuff and is used throughout the system - so I can't change this. Originally, in Z's onConfigure() we set the setVisible() depending on Y's state. But that doesn't work as Z's onConfigure() executes after Y's Behaviours onConfigure(). Which is just the way Component.configure() works. Which is fair enough. So, I figured if Behaviours execute after onConfigure, I simply put the setVisible() code into a Behaviour on Z, and bingo! Only Y's Behaviour always executes first. Always. Even if I create it second, even if I add Z to their parent container before Y. I can't work out how to affect the order of Components/Behaviour execution. Note - I did extend the Y's Behaviour to update Z, but as Z has already completed its cycle, the state didn't actually update. Can anyone help? Cheers, Col. EMAIL DISCLAIMER This email message and its attachments are confidential and may also contain copyright or privileged material. If you are not the intended recipient, you may not forward the email or disclose or use the information contained in it. If you have received this email message in error, please advise the sender immediately by replying to this email and delete the message and any associated attachments. Any views, opinions, conclusions, advice or statements expressed in this email message are those of the individual sender and should not be relied upon as the considered view, opinion, conclusions, advice or statement of this company except where the sender expressly, and with authority, states them to be the considered view, opinion, conclusions, advice or statement of this company. Every care is taken but we recommend that you scan any attachments for viruses. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org