Re: [1.5 MIGRATION] State handling / inter-page events / versioning
the problem is indeed that you are sharing state between pages which is not allowed. you are doing it via one page passing in an anonymous SelectionCallback to another page, which is the same as passing in an instance of one page to another. what you should do instead, especially since you already have the popup page calling an ajax method on the opener as a close callback, is pass the selection to the javascript callback method. this way the callback method can pass the selection back to the page when it executes the ajax callback. this way you dont have to share state between page instances. hope this gets you started. -igor On Wed, Feb 9, 2011 at 9:52 AM, Daniel Soneira wrote: > Hi fellow Wicketeers, > > I have some (general) classes that handle the common flow of selecting one / > several entities from a search page (as popup). > > Basically it looks like this: > User opens detail page. > User clicks on search link. > System opens search page (as pop-up). > User enters filtering criteria, begins search. > User selects one of the shown entities in the result grid. > System closes search page. > System refreshes detail page (AJAX) with selected entity. > > > Those general classes worked fine with 1.4 but somehow they are not > executing as intended anymore with 1.5. > The state of my pop-up selection links seems to get "lost" somehow. > I guess it has something to do with the no more existing page maps and the > way pages are versioned now? > > I've attached a quickstart to illustrate my problem (stripped down to a > minimum, just a text field instead of real entities). > Since I was probably abusing something in 1.4 regarding serialization / page > map handling I'm curious to know of some better ways to achieve this. > > -- > Regards, > Daniel Soneira > www.joyn-it.at > > > - > 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 1.5 and custom request cycle
In the meantime, I am using the following workaround: lazy init the desired CustomRequestCycle member. e.g Instead of @Override protected void onBeginRequest() { super.onBeginRequest(); Long userId = CustomSession.get().getCurrentUserId(); if (userId != null) currentUserModel = // fetch user } and a simple getCurrentUserModel(), I use public DetachableUserModel getCurrentUserModel() { if (currentUserModel == null) { Long userId = CustomSession.get().getCurrentUserId(); if (userId != null) currentUserModel = // fetch user } return currentUserModel; } On 10/02/2011 2:41 PM, Igor Vaynberg wrote: no i do not. there are still a lot of reported bugs that need to be fixed before we release it. you can always use a snapshot or run a build yourself if you need it now. -igor On Thu, Feb 10, 2011 at 11:31 AM, Zhubin Salehi wrote: I had the same issue. Do you have any estimate on the release date of RC2? Zhubin -Original Message- From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] Sent: February 10, 2011 1:54 PM To: users@wicket.apache.org Subject: Re: Wicket 1.5 and custom request cycle i just fixed this last night, will be part of rc2. -igor On Thu, Feb 10, 2011 at 10:46 AM, Bertrand Guay-Paquet wrote: Hello, Disclaimer: I am a relatively new Wicket user I use a custom session to store the current user Id and I want to use the request cycle to store the current user object which is fetched from the DB on each request following advice from http://wicket-users.markmail.org/search/?q=cart+thread+safe#query:cart%20thread%20safe+page:1+mid:m3kgdjxv2fmeebvt+state:results and http://wicket-users.markmail.org/search/?q=session+thread+safe#query:session%20thread%20safe+page:1+mid:oh4v4ivhubc3ao4s+state:results To this end, I followed the instructions from https://cwiki.apache.org/WICKET/migration-to-wicket-15.html#MigrationtoWicket1.5-RequestCycle However, the method WebApplication#addRequestCycleListener() does not exist. I searched for a replacement but only found Application#getRequestCycleListeners() which gives access to the listener list. Its Javadoc however states that the returned list is unmodifiable so I avoided this route. So instead I used Application#setRequestCycleProvider() to create my CustomRequestCycle class. This class has the following method: @Override protected void onBeginRequest() { super.onBeginRequest(); Long userId = (CustomSession)Session.get().getCurrentUserId(); if (userId != null) // fetch user... } My problem is that I get a NullPointerException in Session#get(). When first accessing a page, there is no session associated with the TheadContext. So the following line is then executed in Session#get(): Application.get().fetchCreateAndSetSession(RequestCycle.get()) RequestCycle.get() returns null because ThreadContext.requestCycle has not been set yet when onBeginRequest() is called. I am doing something wrong? Is this a bug? Thanks! - 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 - 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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket 1.5 and custom request cycle
no i do not. there are still a lot of reported bugs that need to be fixed before we release it. you can always use a snapshot or run a build yourself if you need it now. -igor On Thu, Feb 10, 2011 at 11:31 AM, Zhubin Salehi wrote: > I had the same issue. Do you have any estimate on the release date of RC2? > > Zhubin > > -Original Message- > From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] > Sent: February 10, 2011 1:54 PM > To: users@wicket.apache.org > Subject: Re: Wicket 1.5 and custom request cycle > > i just fixed this last night, will be part of rc2. > > -igor > > On Thu, Feb 10, 2011 at 10:46 AM, Bertrand Guay-Paquet > wrote: >> Hello, >> >> Disclaimer: I am a relatively new Wicket user >> >> I use a custom session to store the current user Id and I want to use the >> request cycle to store the current user object which is fetched from the DB >> on each request following advice from >> http://wicket-users.markmail.org/search/?q=cart+thread+safe#query:cart%20thread%20safe+page:1+mid:m3kgdjxv2fmeebvt+state:results >> and >> http://wicket-users.markmail.org/search/?q=session+thread+safe#query:session%20thread%20safe+page:1+mid:oh4v4ivhubc3ao4s+state:results >> >> To this end, I followed the instructions from >> https://cwiki.apache.org/WICKET/migration-to-wicket-15.html#MigrationtoWicket1.5-RequestCycle >> However, the method WebApplication#addRequestCycleListener() does not exist. >> I searched for a replacement but only found >> Application#getRequestCycleListeners() which gives access to the listener >> list. Its Javadoc however states that the returned list is unmodifiable so I >> avoided this route. >> >> So instead I used Application#setRequestCycleProvider() to create my >> CustomRequestCycle class. This class has the following method: >> @Override >> protected void onBeginRequest() { >> super.onBeginRequest(); >> Long userId = (CustomSession)Session.get().getCurrentUserId(); >> if (userId != null) >> // fetch user... >> } >> >> My problem is that I get a NullPointerException in Session#get(). When first >> accessing a page, there is no session associated with the TheadContext. So >> the following line is then executed in Session#get(): >> Application.get().fetchCreateAndSetSession(RequestCycle.get()) >> >> RequestCycle.get() returns null because ThreadContext.requestCycle has not >> been set yet when onBeginRequest() is called. >> >> I am doing something wrong? Is this a bug? >> >> Thanks! >> >> - >> 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 > > > - > 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 1.5 and custom request cycle
I had the same issue. Do you have any estimate on the release date of RC2? Zhubin -Original Message- From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] Sent: February 10, 2011 1:54 PM To: users@wicket.apache.org Subject: Re: Wicket 1.5 and custom request cycle i just fixed this last night, will be part of rc2. -igor On Thu, Feb 10, 2011 at 10:46 AM, Bertrand Guay-Paquet wrote: > Hello, > > Disclaimer: I am a relatively new Wicket user > > I use a custom session to store the current user Id and I want to use the > request cycle to store the current user object which is fetched from the DB > on each request following advice from > http://wicket-users.markmail.org/search/?q=cart+thread+safe#query:cart%20thread%20safe+page:1+mid:m3kgdjxv2fmeebvt+state:results > and > http://wicket-users.markmail.org/search/?q=session+thread+safe#query:session%20thread%20safe+page:1+mid:oh4v4ivhubc3ao4s+state:results > > To this end, I followed the instructions from > https://cwiki.apache.org/WICKET/migration-to-wicket-15.html#MigrationtoWicket1.5-RequestCycle > However, the method WebApplication#addRequestCycleListener() does not exist. > I searched for a replacement but only found > Application#getRequestCycleListeners() which gives access to the listener > list. Its Javadoc however states that the returned list is unmodifiable so I > avoided this route. > > So instead I used Application#setRequestCycleProvider() to create my > CustomRequestCycle class. This class has the following method: > @Override > protected void onBeginRequest() { > super.onBeginRequest(); > Long userId = (CustomSession)Session.get().getCurrentUserId(); > if (userId != null) > // fetch user... > } > > My problem is that I get a NullPointerException in Session#get(). When first > accessing a page, there is no session associated with the TheadContext. So > the following line is then executed in Session#get(): > Application.get().fetchCreateAndSetSession(RequestCycle.get()) > > RequestCycle.get() returns null because ThreadContext.requestCycle has not > been set yet when onBeginRequest() is called. > > I am doing something wrong? Is this a bug? > > Thanks! > > - > 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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket 1.5 and custom request cycle
i just fixed this last night, will be part of rc2. -igor On Thu, Feb 10, 2011 at 10:46 AM, Bertrand Guay-Paquet wrote: > Hello, > > Disclaimer: I am a relatively new Wicket user > > I use a custom session to store the current user Id and I want to use the > request cycle to store the current user object which is fetched from the DB > on each request following advice from > http://wicket-users.markmail.org/search/?q=cart+thread+safe#query:cart%20thread%20safe+page:1+mid:m3kgdjxv2fmeebvt+state:results > and > http://wicket-users.markmail.org/search/?q=session+thread+safe#query:session%20thread%20safe+page:1+mid:oh4v4ivhubc3ao4s+state:results > > To this end, I followed the instructions from > https://cwiki.apache.org/WICKET/migration-to-wicket-15.html#MigrationtoWicket1.5-RequestCycle > However, the method WebApplication#addRequestCycleListener() does not exist. > I searched for a replacement but only found > Application#getRequestCycleListeners() which gives access to the listener > list. Its Javadoc however states that the returned list is unmodifiable so I > avoided this route. > > So instead I used Application#setRequestCycleProvider() to create my > CustomRequestCycle class. This class has the following method: > @Override > protected void onBeginRequest() { > super.onBeginRequest(); > Long userId = (CustomSession)Session.get().getCurrentUserId(); > if (userId != null) > // fetch user... > } > > My problem is that I get a NullPointerException in Session#get(). When first > accessing a page, there is no session associated with the TheadContext. So > the following line is then executed in Session#get(): > Application.get().fetchCreateAndSetSession(RequestCycle.get()) > > RequestCycle.get() returns null because ThreadContext.requestCycle has not > been set yet when onBeginRequest() is called. > > I am doing something wrong? Is this a bug? > > Thanks! > > - > 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
Wicket 1.5 and custom request cycle
Hello, Disclaimer: I am a relatively new Wicket user I use a custom session to store the current user Id and I want to use the request cycle to store the current user object which is fetched from the DB on each request following advice from http://wicket-users.markmail.org/search/?q=cart+thread+safe#query:cart%20thread%20safe+page:1+mid:m3kgdjxv2fmeebvt+state:results and http://wicket-users.markmail.org/search/?q=session+thread+safe#query:session%20thread%20safe+page:1+mid:oh4v4ivhubc3ao4s+state:results To this end, I followed the instructions from https://cwiki.apache.org/WICKET/migration-to-wicket-15.html#MigrationtoWicket1.5-RequestCycle However, the method WebApplication#addRequestCycleListener() does not exist. I searched for a replacement but only found Application#getRequestCycleListeners() which gives access to the listener list. Its Javadoc however states that the returned list is unmodifiable so I avoided this route. So instead I used Application#setRequestCycleProvider() to create my CustomRequestCycle class. This class has the following method: @Override protected void onBeginRequest() { super.onBeginRequest(); Long userId = (CustomSession)Session.get().getCurrentUserId(); if (userId != null) // fetch user... } My problem is that I get a NullPointerException in Session#get(). When first accessing a page, there is no session associated with the TheadContext. So the following line is then executed in Session#get(): Application.get().fetchCreateAndSetSession(RequestCycle.get()) RequestCycle.get() returns null because ThreadContext.requestCycle has not been set yet when onBeginRequest() is called. I am doing something wrong? Is this a bug? Thanks! - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: cleanup form values and feedback messages
You could try for one field : yourField.clearIput(); or for a form : yourForm.clearInput() Regards, Gabriel. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/cleanup-form-values-and-feedback-messages-tp3275588p3299704.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: onInitialize / onBeforeRender
failing to do so will throw an exception. -igor On Thu, Feb 10, 2011 at 8:58 AM, Matthias Keller wrote: > On 2011-02-10 17:49, Brown, Berlin [GCG-PFS] wrote: >> >> Version: wicket1.4.13 >> >> Is there any reason onInitialize would not be called? And is it always >> called before onBeforeRender? When I look at my logs, it looks like >> there are cases where onInitialize wasn't called. But onBeforeRender >> was always called. >> > > Just a quick thought: > Do you call super.onInitialize() in every onInitialize() mehod? Failing to > do this could expose such a behaviour... > > Matt > > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: onInitialize / onBeforeRender
On 2011-02-10 17:49, Brown, Berlin [GCG-PFS] wrote: Version: wicket1.4.13 Is there any reason onInitialize would not be called? And is it always called before onBeforeRender? When I look at my logs, it looks like there are cases where onInitialize wasn't called. But onBeforeRender was always called. Just a quick thought: Do you call super.onInitialize() in every onInitialize() mehod? Failing to do this could expose such a behaviour... Matt smime.p7s Description: S/MIME Cryptographic Signature
Re: onInitialize / onBeforeRender
create a quickstart that reproduces this, oninitialize() should always be called on components after they are added to the page. -igor On Thu, Feb 10, 2011 at 8:49 AM, Brown, Berlin [GCG-PFS] wrote: > Version: wicket1.4.13 > > Is there any reason onInitialize would not be called? And is it always > called before onBeforeRender? When I look at my logs, it looks like > there are cases where onInitialize wasn't called. But onBeforeRender > was always called. > > Berlin Brown > - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
onInitialize / onBeforeRender
Version: wicket1.4.13 Is there any reason onInitialize would not be called? And is it always called before onBeforeRender? When I look at my logs, it looks like there are cases where onInitialize wasn't called. But onBeforeRender was always called. Berlin Brown
wicketstuff-annotation - No 1.5 compatible release available
Hi, I've searched for a binary releaseof wicketstuff-annotation that is compatible with Wicket 1.5 RC1 / trunk (snapshot) in the sonatype and official maven repository to no avail. Where can I get the latest JAR file (please note: We don't use maven for our projects)? Regards, Daniel Soneira www.joyn-it.at - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Form/Enter Key Problem
My solution is to AjaxFormValidatingBehavior on form : I do that to intercept (by submit btn or ENTER key on every components form) the submit form : form.add(new AjaxFormValidatingBehavior(form, "onsubmit") { @Override protected CharSequence getEventHandler() { AppendingStringBuffer handler = new AppendingStringBuffer(); handler.append(super.getEventHandler()); handler.append("; return false;"); // < very importante return handler; } }); If that's can help. Best regards - Duto -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Form-Enter-Key-Problem-tp1869795p3298877.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: TextField submit via Ajax
I do that to intercept (by submit btn or ENTER key on every components form) the submit form : form.add(new AjaxFormValidatingBehavior(form, "onsubmit") { @Override protected void onSubmit(AjaxRequestTarget target) { setResponsePage(ResultPage.class, null); } @Override protected CharSequence getEventHandler() { AppendingStringBuffer handler = new AppendingStringBuffer(); handler.append(super.getEventHandler()); handler.append("; return false;"); // < very importante return handler; } }); If that can help. Best regards - Duto -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/TextField-submit-via-Ajax-tp3002094p3298872.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: TextField submit via Ajax
Hello, Just a question : why we can't add Behavior on onsubmit event on form to do that ? - Duto -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/TextField-submit-via-Ajax-tp3002094p3298726.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