Re: Event or Notice when a ListView's Model changes
I'm trying to do this, to send an Event in the DataView's onBeforeRender(), but now I encounter another issue. On the receiving side of the Event, in the onEvent(Component component, IEvent? event), I need a AjaxRequestTarget. Can I create an AjaxRequestTarget and pass it with the Event? I tried this with new AjaxRequestTarget(getPage()), but it doesn't work. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Event-or-Notice-when-a-ListView-s-Model-changes-tp4157030p4164550.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: Event or Notice when a ListView's Model changes
Hi, hfriederichs wrote I'm trying to do this, to send an Event in the DataView's onBeforeRender(), but now I encounter another issue. On the receiving side of the Event, in the onEvent(Component component, IEvent? event), I need a AjaxRequestTarget. Can I create an AjaxRequestTarget and pass it with the Event? I tried this with new AjaxRequestTarget(getPage()), but it doesn't work. Inside an Ajax-Request you can do AjaxRequestTarget.get() at any time - -- Regards, Hans http://cantaa.de -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Event-or-Notice-when-a-ListView-s-Model-changes-tp4157030p4164694.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: Event or Notice when a ListView's Model changes
But when the event is processed, I'm not in an AjaxRequest. Anyway, I have something working, now, I am able to update a version field (by sending an inter-component event in the onBeforeRender() of the ListView that has it's own Form; the Event is processed by another Form at the top of the same Panel - that's where the version field is), but I still need an AbstractAjaxTimerBehavior - now at 3 seconds - to make the updates visible for the user. That worries me, I would like to have an update interval of a second, or even less, but I wonder if this is wise. My solution now on the receiving side looks something like: add(new AbstractAjaxTimerBehavior(Duration.seconds(3)) { // add to the Fom @Override public void onEvent(Component component, IEvent? event) { if (event.getPayload() instanceof ProcessReadyNotfication) { == Update VersionField super.onEvent(component, event); } } @Override protected void onTimer(AjaxRequestTarget target) { // This can take up to 3 seconds! target.add(VersionField); } }); Of course, I would like something like: @Override public void onEvent(Component component, IEvent? event) { if (event.getPayload() instanceof ProcessReadyNotfication) { == Update VersionField target.add(VersionField); super.onEvent(component, event); } } But I don't have a AjaxRequestTarget there, and obtaining one by AjaxRequestTarget.get() causes an IllegalStateException (As far as I can remember). -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Event-or-Notice-when-a-ListView-s-Model-changes-tp4157030p4166278.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
Event or Notice when a ListView's Model changes
Hello, I have a Wicket ListView, who's Model is based on a select on a process-database. Users can initiate a (deploy-)process, and when the process is finished, a row is added in the database, and so also in the ListView's Model's backing List. When this happens, I want to rerender another part of the same Panel. That other part has it's own Form. So I need an event when a row is added. The Wicket Events to send after that I can figure out for myself, my concern is about reacting to the database inserts. I tried various methods, onChange and the like, on various components, but to no avail. Please help, I'm using Wicket 1.5.3 Regards, Hans -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Event-or-Notice-when-a-ListView-s-Model-changes-tp4157030p4157030.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: Event or Notice when a ListView's Model changes
Hi, have you tried overriding onModelChanged()? You can fire event in this method. Hello, I have a Wicket ListView, who's Model is based on a select on a process-database. Users can initiate a (deploy-)process, and when the process is finished, a row is added in the database, and so also in the ListView's Model's backing List. When this happens, I want to rerender another part of the same Panel. That other part has it's own Form. So I need an event when a row is added. The Wicket Events to send after that I can figure out for myself, my concern is about reacting to the database inserts. I tried various methods, onChange and the like, on various components, but to no avail. Please help, I'm using Wicket 1.5.3 Regards, Hans -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Event-or-Notice-when-a-ListView-s-Model-changes-tp4157030p4157030.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: Event or Notice when a ListView's Model changes
Yes, I'm sorry, I wrote /I tried various methods, onChange and the like/ by which I meant onModelChanged(). But onModelChanged() isn't called when a row is added. I think that makes sense, because the backing List on itself hasn't changed. Furthermore, I experimented by replacing the ListView by a DataView, but no calling of onModelChanged() there either. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Event-or-Notice-when-a-ListView-s-Model-changes-tp4157030p4157831.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: Event or Notice when a ListView's Model changes
call manually listview.modelChanged() after the update of its List this will call onModelChanged On Sun, Dec 4, 2011 at 8:37 PM, hfriederichs h.friederi...@ohra.nl wrote: Yes, I'm sorry, I wrote /I tried various methods, onChange and the like/ by which I meant onModelChanged(). But onModelChanged() isn't called when a row is added. I think that makes sense, because the backing List on itself hasn't changed. Furthermore, I experimented by replacing the ListView by a DataView, but no calling of onModelChanged() there either. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Event-or-Notice-when-a-ListView-s-Model-changes-tp4157030p4157831.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 -- Martin Grigorov jWeekend Training, Consulting, Development http://jWeekend.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Event or Notice when a ListView's Model changes
But the List isn't updated by a user's action. There's a decoupling here: the user's action inserts a row that has a 'state-column' that's initialized with, let's call it 'unfinished'. The processes are executed asynchronously by another thread, that, after some minutes, updates the state-column to 'finished'. My ListView represents a list of finished processes, so you can never know when the selection on the database changes. So how do I know when an update has taken place? I need a sort of listener there. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Event-or-Notice-when-a-ListView-s-Model-changes-tp4157030p4158107.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: Event or Notice when a ListView's Model changes
the label that outputs the status can keep its last status, and in onbeforerender can check if the new status coming from the model is different then the old. if it is, it can fire the event. -igor On Sun, Dec 4, 2011 at 12:59 PM, hfriederichs h.friederi...@ohra.nl wrote: But the List isn't updated by a user's action. There's a decoupling here: the user's action inserts a row that has a 'state-column' that's initialized with, let's call it 'unfinished'. The processes are executed asynchronously by another thread, that, after some minutes, updates the state-column to 'finished'. My ListView represents a list of finished processes, so you can never know when the selection on the database changes. So how do I know when an update has taken place? I need a sort of listener there. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Event-or-Notice-when-a-ListView-s-Model-changes-tp4157030p4158107.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: Event or Notice when a ListView's Model changes
I'm sorry if my writing is confusing. But there isn't a label that outputs the state, because the list shows /only/ finished processes. Maybe the following flow explains what happens: - A user chooses an application he wants to deploy to a certain stage, let's say production - When he has chosen, a label shows the current version of the application in production - The user clicks the 'deploybutton', as a result of which a row is inserted with state 'unfinished' - Another thread picks up the process and executes a script that deploys the application - At the end of this, that other thread updates the state-field to 'finished' - At the bottom of the panel my listview with finished processes is updated, and the user will notice that because I added a AjaxSelfUpdatingTimerBehavior. - But when the list is refreshed I want the version label that I mentioned in the beginning to be refreshed also, because there's a new current version -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Event-or-Notice-when-a-ListView-s-Model-changes-tp4157030p4158203.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: Event or Notice when a ListView's Model changes
If you override listview's onBeforeRender you could check if finished processes' list contains version displayed by label and if so, you could update it. I'm sorry if my writing is confusing. But there isn't a label that outputs the state, because the list shows /only/ finished processes. Maybe the following flow explains what happens: - A user chooses an application he wants to deploy to a certain stage, let's say production - When he has chosen, a label shows the current version of the application in production - The user clicks the 'deploybutton', as a result of which a row is inserted with state 'unfinished' - Another thread picks up the process and executes a script that deploys the application - At the end of this, that other thread updates the state-field to 'finished' - At the bottom of the panel my listview with finished processes is updated, and the user will notice that because I added a AjaxSelfUpdatingTimerBehavior. - But when the list is refreshed I want the version label that I mentioned in the beginning to be refreshed also, because there's a new current version -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Event-or-Notice-when-a-ListView-s-Model-changes-tp4157030p4158203.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