Re: Component disabled if it contains data
Hello, Thank you all for the help. Is there a way to only rerender the two components (inputtext fields) and not all the page? So submit should remain like this: @Override protected void onSubmit() { //other stuff } The logic is that I should be able to commit changes only if both input textfields are filled with data, or if both are empty. If both have data, then components should become disabled, if both are empty, then the components should remain editable, if only one of them has data then I should not be let to submit any change. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Component-disabled-if-it-contains-data-tp4674313p4674321.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: Adding multiple WebSocketBehavior instances to the same page
Hi Martin, thanks for your prompt reply. Are you suggesting that the best practice is to add WebSocketBehavior at most once per page - and possibly to the page itself? My current situation is that I have defined three different anonymous WebSocketBehavior instances, added to three different panels [1][2][3]: panel [1] is added to BasePage, panel [2] and [3] are added to Dashboard, extending BasePage. With this configuration, only the onConnect() method from [1] is invoked. If instead I disable [1] (via the if reported below), both [2] and [3] onConnect() methods are invoked. So my actual issue it not really how to asses when to add [1] or not, but to have [1][2][3] all added to Dashboard, and [1] to the remaining pages. Regards. [1] https://github.com/apache/syncope/blob/master/client/console/src/main/java/org/apache/syncope/client/console/widgets/ApprovalsWidget.java#L179-L189 [2] https://github.com/apache/syncope/blob/master/client/console/src/main/java/org/apache/syncope/client/console/widgets/JobWidget.java#L119-L128 [3] https://github.com/apache/syncope/blob/master/client/console/src/main/java/org/apache/syncope/client/console/widgets/ReconciliationWidget.java#L144-L155 On 19/04/2016 18:07, Martin Grigorov wrote: Hi, You could use something like: if (getBehaviors(WebSocketBehavior.class).isEmpty()) { add(new WebSocketBehavior() {...}); } This way only one instance will be added to one page instance. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Tue, Apr 19, 2016 at 5:50 PM, Francesco Chicchiriccòwrote: Hi all, in the upcoming Syncope 2.0 we are enjoying WebSocketBehavior for making our admin console UI more reactive. It mostly works - thanks for this! - but we are experiencing some troubles lately. There is a class BasePage which is extended by all other pages, and contains a panel which adds WebSocketBehavior. One of such pages (Dashboard) also contains two panels, each of which adds in turn WebSocketBehavior. I observe that when the first WebSocketBehavior (in BasePage) is added, the other two WebSocketBehavior instances' onConnect() method is not invoked at all. If instead, I do something like as following, in BasePage: if (!(pageRef.getPage() instanceof Dashboard)) { add(new WebSocketBehavior() {...}); } everything works as expected (naturally BasePages's WebSocketBehavior does not come into play): both on Dashboard and other pages. Any hint? TIA Regards. -- Francesco Chicchiriccò Tirasa - Open Source Excellence http://www.tirasa.net/ Involved at The Apache Software Foundation: member, Syncope PMC chair, Cocoon PMC, Olingo PMC, CXF committer http://home.apache.org/~ilgrosso/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Component disabled if it contains data
Hello, Thank you all for the help. Is there a way to only rerender the two components (inputtext fields) and not all the page? So submit should remain like this: @Override protected void onSubmit() { //other stuff } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Component-disabled-if-it-contains-data-tp4674313p4674320.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: Component disabled if it contains data
Yes, you can do that: simply change the components that you are adding to the AjaxRequestTarget object to be the form components rather than the entire form. You'll need to use something like an AjaxButton so you have access to the AjaxRequestTarget: FormComponent c1 = ... FormComponent c2 = ... ... new AjaxButton(...) { public void onSubmit(AjaxRequestTarget target, Form form) { target.add(c1, c2); } } On Wed, Apr 20, 2016 at 3:21 AM, Iamuserwrote: > Hello, > > Thank you all for the help. > > Is there a way to only rerender the two components (inputtext fields) and > not all the page? > > So submit should remain like this: > > @Override > protected void onSubmit() { > //other stuff > } > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Component-disabled-if-it-contains-data-tp4674313p4674320.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 way" to show a "Are you sure you want to navigate away" page?
Did it worked? On Wed, Apr 20, 2016 at 2:15 PM, Ernesto Reinaldo Barreiro < reier...@gmail.com> wrote: > Just guessing > > OnEventHeaderItem forScript("window", "*beforeunload*", "*function*() { > *return > '**Sure do you want to leave us?'*; }"); > > On Wed, Apr 20, 2016 at 1:31 PM, Lorne Malvo> wrote: > >> Thanks Ernesto. >> >> I tried using OnEventHeaderItem but can't quite get it to work. >> What would I use as a target? >> >> Thanks! >> >> >> >> -- >> View this message in context: >> http://apache-wicket.1842946.n4.nabble.com/Wicket-way-to-show-a-Are-you-sure-you-want-to-navigate-away-page-tp4674323p4674326.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 >> >> > > > -- > Regards - Ernesto Reinaldo Barreiro > -- Regards - Ernesto Reinaldo Barreiro
Re: "Wicket way" to show a "Are you sure you want to navigate away" page?
Thanks Ernesto. I tried using OnEventHeaderItem but can't quite get it to work. What would I use as a target? Thanks! -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-way-to-show-a-Are-you-sure-you-want-to-navigate-away-page-tp4674323p4674326.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: Component disabled if it contains data
It sounds like that, in addition to the behavior, you also need a wicket validator. Since the validation condition involves two fields, you'll need to implement an IFormValidator and add it to the containing form [1]. The #getDependentComponents() method should return the two textfields. In the #validate(Form) method, you'll want to get the converted input from the two components and check that they're both null/empty or both not null/not empty [2]. The reason you need to use the converted input on the form component, not the model, is that Wicket doesn't update the backing model until the form is valid. Andrew [1] https://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/markup/html/form/validation/IFormValidator.html [2] https://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/markup/html/form/FormComponent.html#getConvertedInput() On Wed, Apr 20, 2016 at 4:09 AM, Iamuserwrote: > Hello, > > Thank you all for the help. > > Is there a way to only rerender the two components (inputtext fields) and > not all the page? > > So submit should remain like this: > > @Override > protected void onSubmit() { > //other stuff > } > > The logic is that I should be able to commit changes only if both input > textfields are filled with data, or if both are empty. If both have data, > then components should become disabled, if both are empty, then the > components should remain editable, if only one of them has data then I > should not be let to submit any change. > > > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Component-disabled-if-it-contains-data-tp4674313p4674321.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 way" to show a "Are you sure you want to navigate away" page?
Modal window does this like *// Wicket.Window.unloadConfirmation is deprecated but we need to check it // for backward compatibility. Remove it after Wicket 7.0 **if *(*this*.settings.unloadConfirmation && Wicket.Window.unloadConfirmation) { Wicket.Event.add(window, *'beforeunload'*,*this*.onbeforeunload); } I see there is also an OnEventHeaderItem... On Wed, Apr 20, 2016 at 11:57 AM, Lorne Malvowrote: > Does Wicket have any built in support for showing a "Are you sure you want > to > navigate away from this page" message when the user navigates away from the > page? > > What would be the simplest way to detect when a user is trying to navigate > away from a page, execute some Java code, and then show a "Are you sure you > want to navigate away..." message? > > Thanks! > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Wicket-way-to-show-a-Are-you-sure-you-want-to-navigate-away-page-tp4674323.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 > > -- Regards - Ernesto Reinaldo Barreiro
Re: "Wicket way" to show a "Are you sure you want to navigate away" page?
Just guessing OnEventHeaderItem forScript("window", "*beforeunload*", "*function*() { *return '**Sure do you want to leave us?'*; }"); On Wed, Apr 20, 2016 at 1:31 PM, Lorne Malvowrote: > Thanks Ernesto. > > I tried using OnEventHeaderItem but can't quite get it to work. > What would I use as a target? > > Thanks! > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Wicket-way-to-show-a-Are-you-sure-you-want-to-navigate-away-page-tp4674323p4674326.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 > > -- Regards - Ernesto Reinaldo Barreiro
Re: "Wicket way" to show a "Are you sure you want to navigate away" page?
In this case yes, I do have to execute some logic server side anyway... Thanks again. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-way-to-show-a-Are-you-sure-you-want-to-navigate-away-page-tp4674323p4674339.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: AjaxCheckBox ListView Bug
Hi, Please try by calling listModules.setReuseItems(true); Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Wed, Apr 20, 2016 at 5:23 PM, alexandre ricciardi < alexandre.ricciardi.reac...@gmail.com> wrote: > Hello, > > > I want to update a dropdown list with ajax calls triggered by checkboxes. > I have a ListView of AjaxCheckBoxes but only the first AjaxCheckBox is > callbacked. > It appears that all ajax calls are triggered by the first check box. > Changing the following checkboxes have not effect. > > DropDownChoice ddc = new DropDownChoice("ddcName", > listProps); > ddc.setOutputMarkupId(true); > add(ddc); > > final IModel thisModel = getModel(); > ListView listModules = new > ListView("list.module.beans", > PluginsConfigHelper.getModules()) { > private static final long serialVersionUID = 1L; > @Override > protected void populateItem(ListItem item) { > AjaxCheckBox box = new AjaxCheckBox("myCheckBox", Model.of(Boolean.TRUE) { > > private static final long serialVersionUID = 1L; > > @Override > protected void onUpdate(AjaxRequestTarget target) > { target.add(ddc); } > > }; > box.setOutputMarkupId(true); > box.setOutputMarkupPlaceholderTag(true); > item.add(box); > } > }; > > Thanks for your help. > > Alexandre >
"Wicket way" to show a "Are you sure you want to navigate away" page?
Does Wicket have any built in support for showing a "Are you sure you want to navigate away from this page" message when the user navigates away from the page? What would be the simplest way to detect when a user is trying to navigate away from a page, execute some Java code, and then show a "Are you sure you want to navigate away..." message? Thanks! -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-way-to-show-a-Are-you-sure-you-want-to-navigate-away-page-tp4674323.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 way" to show a "Are you sure you want to navigate away" page?
Hi Ernesto, thanks - but that didn't quite work. Wicket Ajax Debug tells me "window" is not in the DOM. Any other ideas? Thanks! -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-way-to-show-a-Are-you-sure-you-want-to-navigate-away-page-tp4674323p4674331.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
AjaxCheckBox ListView Bug
Hello, I want to update a dropdown list with ajax calls triggered by checkboxes. I have a ListView of AjaxCheckBoxes but only the first AjaxCheckBox is callbacked. It appears that all ajax calls are triggered by the first check box. Changing the following checkboxes have not effect. DropDownChoice ddc = new DropDownChoice("ddcName", listProps); ddc.setOutputMarkupId(true); add(ddc); final IModel thisModel = getModel(); ListView listModules = new ListView("list.module.beans", PluginsConfigHelper.getModules()) { private static final long serialVersionUID = 1L; @Override protected void populateItem(ListItem item) { AjaxCheckBox box = new AjaxCheckBox("myCheckBox", Model.of(Boolean.TRUE) { private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { target.add(ddc); } }; box.setOutputMarkupId(true); box.setOutputMarkupPlaceholderTag(true); item.add(box); } }; Thanks for your help. Alexandre
Re: "Wicket way" to show a "Are you sure you want to navigate away" page?
Hi, Please show us your code. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Wed, Apr 20, 2016 at 2:35 PM, Lorne Malvowrote: > Hi Ernesto, > > thanks - but that didn't quite work. Wicket Ajax Debug tells me "window" is > not in the DOM. > > Any other ideas? > > Thanks! > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Wicket-way-to-show-a-Are-you-sure-you-want-to-navigate-away-page-tp4674323p4674331.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 way" to show a "Are you sure you want to navigate away" page?
Ernesto thanks for the help. I made it work by using an AjaxEventBehavior and adding it directly to the page, like so: AjaxEventBehavior event = new AjaxEventBehavior("beforeunload") { @Override protected void onEvent(final AjaxRequestTarget target) { // do stuff here target.appendJavaScript("alert('are you sure want to navigate away?');"); } } add(event); -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Wicket-way-to-show-a-Are-you-sure-you-want-to-navigate-away-page-tp4674323p4674333.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 way" to show a "Are you sure you want to navigate away" page?
No idea... You add this with a panel that is updated via AJAX? I will try it with simple example. On Wed, Apr 20, 2016 at 2:35 PM, Lorne Malvowrote: > Hi Ernesto, > > thanks - but that didn't quite work. Wicket Ajax Debug tells me "window" is > not in the DOM. > > Any other ideas? > > Thanks! > > > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Wicket-way-to-show-a-Are-you-sure-you-want-to-navigate-away-page-tp4674323p4674331.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 > > -- Regards - Ernesto Reinaldo Barreiro
Re: "Wicket way" to show a "Are you sure you want to navigate away" page?
Ok. But this makes an extra roundtrip to the server.. is that what you want? On Wed, Apr 20, 2016 at 3:16 PM, Lorne Malvowrote: > Ernesto thanks for the help. > > I made it work by using an AjaxEventBehavior and adding it directly to the > page, like so: > > > AjaxEventBehavior event = new AjaxEventBehavior("beforeunload") { > @Override > protected void onEvent(final AjaxRequestTarget target) { > // do stuff here > target.appendJavaScript("alert('are you sure want to navigate > away?');"); > } > } > add(event); > > -- > View this message in context: > http://apache-wicket.1842946.n4.nabble.com/Wicket-way-to-show-a-Are-you-sure-you-want-to-navigate-away-page-tp4674323p4674333.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 > > -- Regards - Ernesto Reinaldo Barreiro
Re: Adding multiple WebSocketBehavior instances to the same page
Hi, There is no point in having more than one WebSocket connections per page. And actually, Wicket Native WebSockets do not support it out of the box. The registry with the websocket connections at the server side uses a keyso there could be just one connection per page. Now the next problem is how to be notified when a message comes from the client, because the behavior is registered somewhere else and not in the current component... You could override component's #onEvent() and do something when the payload is TextMessage but this is not very user friendly :-/ Please create a ticket for improvement! Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Wed, Apr 20, 2016 at 9:16 AM, Francesco Chicchiriccò wrote: > Hi Martin, > thanks for your prompt reply. > > Are you suggesting that the best practice is to add WebSocketBehavior at > most once per page - and possibly to the page itself? > > My current situation is that I have defined three different anonymous > WebSocketBehavior instances, added to three different panels [1][2][3]: > panel [1] is added to BasePage, panel [2] and [3] are added to Dashboard, > extending BasePage. > > With this configuration, only the onConnect() method from [1] is invoked. > > If instead I disable [1] (via the if reported below), both [2] and [3] > onConnect() methods are invoked. > > So my actual issue it not really how to asses when to add [1] or not, but > to have [1][2][3] all added to Dashboard, and [1] to the remaining pages. > > Regards. > > [1] > https://github.com/apache/syncope/blob/master/client/console/src/main/java/org/apache/syncope/client/console/widgets/ApprovalsWidget.java#L179-L189 > [2] > https://github.com/apache/syncope/blob/master/client/console/src/main/java/org/apache/syncope/client/console/widgets/JobWidget.java#L119-L128 > [3] > https://github.com/apache/syncope/blob/master/client/console/src/main/java/org/apache/syncope/client/console/widgets/ReconciliationWidget.java#L144-L155 > > > On 19/04/2016 18:07, Martin Grigorov wrote: > >> Hi, >> >> You could use something like: >> >> if (getBehaviors(WebSocketBehavior.class).isEmpty()) { >>add(new WebSocketBehavior() {...}); >> } >> >> This way only one instance will be added to one page instance. >> >> Martin Grigorov >> Wicket Training and Consulting >> https://twitter.com/mtgrigorov >> >> On Tue, Apr 19, 2016 at 5:50 PM, Francesco Chicchiriccò < >> ilgro...@apache.org> wrote: >> >>> Hi all, >>> in the upcoming Syncope 2.0 we are enjoying WebSocketBehavior for making >>> our admin console UI more reactive. >>> >>> It mostly works - thanks for this! - but we are experiencing some >>> troubles >>> lately. >>> >>> There is a class BasePage which is extended by all other pages, and >>> contains a panel which adds WebSocketBehavior. >>> One of such pages (Dashboard) also contains two panels, each of which >>> adds >>> in turn WebSocketBehavior. >>> >>> I observe that when the first WebSocketBehavior (in BasePage) is added, >>> the other two WebSocketBehavior instances' onConnect() method is not >>> invoked at all. >>> >>> If instead, I do something like as following, in BasePage: >>> >>> if (!(pageRef.getPage() instanceof Dashboard)) { >>>add(new WebSocketBehavior() {...}); >>> } >>> >>> everything works as expected (naturally BasePages's WebSocketBehavior >>> does >>> not come into play): both on Dashboard and other pages. >>> >>> Any hint? >>> TIA >>> >>> Regards. >>> >> > -- > Francesco Chicchiriccò > > Tirasa - Open Source Excellence > http://www.tirasa.net/ > > Involved at The Apache Software Foundation: > member, Syncope PMC chair, Cocoon PMC, Olingo PMC, CXF committer > http://home.apache.org/~ilgrosso/ > > > > - > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org > For additional commands, e-mail: users-h...@wicket.apache.org > >
Re: AjaxCheckBox ListView Bug
Hi, check your markup - you should not have an id in there: id="all_checkboxes_have_the_same_id"/> Have fun Sven On 20.04.2016 17:23, alexandre ricciardi wrote: Hello, I want to update a dropdown list with ajax calls triggered by checkboxes. I have a ListView of AjaxCheckBoxes but only the first AjaxCheckBox is callbacked. It appears that all ajax calls are triggered by the first check box. Changing the following checkboxes have not effect. DropDownChoice ddc = new DropDownChoice("ddcName", listProps); ddc.setOutputMarkupId(true); add(ddc); final IModel thisModel = getModel(); ListView listModules = new ListView("list.module.beans", PluginsConfigHelper.getModules()) { private static final long serialVersionUID = 1L; @Override protected void populateItem(ListItem item) { AjaxCheckBox box = new AjaxCheckBox("myCheckBox", Model.of(Boolean.TRUE) { private static final long serialVersionUID = 1L; @Override protected void onUpdate(AjaxRequestTarget target) { target.add(ddc); } }; box.setOutputMarkupId(true); box.setOutputMarkupPlaceholderTag(true); item.add(box); } }; Thanks for your help. Alexandre - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
HTTP ERROR:500
Hey all, I’m new to wicket and I got this horrendous error earlier today: I had NO idea what it meant. :P I was able to debug it and see what was left in queue, and that reminded me that I hadn’t finished the html for a new component I had added in the constructor. My question is, isn’t there a better way to explain to the developer what’s going on? It would be super helpful to newbs like me. ;D Just a thought. Thanks, Lon