Re: Clicking a button should fire a 'CSS event'
Chris, Seems like a lot of work just to get a div to blink. Write a behavior with some javascript for the blinking and do that on the client only separate from your form submission or whatever else your button is doing. Warren On Feb 3, 2015, at 1:30 PM, Chris chris...@gmx.at wrote: Hi guys, I would like to control a DIV element when clicking on a button, so that it sort of reacts to this event by „blinking“ for a short time. Currently, when clicking the button, a CSS attribute is added to the DIV’s class and the page is reloaded so that this event is triggered. However, the event should fire only once so I would therefore need to delete the attribute after that. Is there a more elegant solution so that the „CSS event“ is fired once when clicking the button? Thanks, Chris - 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: Wicketstuff Restannotations AbortWithHttpErrorCodeException always results in 500 Internal Server Error
Hans, I handle all exceptions and set status codes in my mapped method with AbstractRestResource#setResponseStatusCode(…). I don’t ever throw any exceptions from there. Setting a status code is the only thing that is really happening in AbstractRestResource#invokeMappedMethod(…) when an exception is caught anyway. Just spare the throwing of an exception and set the status code in your mapped method. throw new AbortWithHttpErrorCodeException(“500”, “Ouch”); versus setResponseStatusCode(“500”); Also, I believe AbortWithHttpErrorCodeException is part of Wicket core, not something meant to be used in rest-annotations. Hope this helps, Warren Bell On Jan 28, 2015, at 7:58 AM, Hans Lesmeister hans.lesmeis...@lessy-software.de wrote: Hi, We use the great rest-annotation from wicketstuff. One thing that bothers is if the AbortWithHttpErrorCodeException with a specific code (404, 402, etc) is thrown by the mapped method, those error codes do not make it to the calling client. The client always seems to get a 500. I debugged through the request/response and found this in AbstractRestResource: http://pastebin.com/NKNmNHv6 Is there any way of getting the correct error codes to the client? If not, how are other people handling this? I would be glad to invest some time and apply a patch if necessary -- Thanks and Cheers, Hans - 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: What is the proper way to start a secondary process in Wicket 6
Ernesto, That’s kind of what I ended up doing except with a different ThreadPoolExecutor implementation. ExecutorService executorService = new ScheduledThreadPoolExecutor(20) { @Override protected void beforeExecute(Thread t, Runnable r) { ThreadContext.setApplication(MyApplication.this); } @Override protected void afterExecute(Runnable r, Throwable t) { ThreadContext.detach(); } }; No particular reason why I picked ScheduledThreadPoolExecutor other than it looked a little easier to use. I need to look more into the different types of Thread pools and such. I used: ThreadContext.detach(); instead of: ThreadContext.setApplication(null); Warren Bell On Nov 22, 2014, at 11:18 AM, Ernesto Reinaldo Barreiro reier...@gmail.com wrote: pushed a new version including injecting a Guice managed service class On Sat, Nov 22, 2014 at 8:08 PM, Ernesto Reinaldo Barreiro reier...@gmail.com wrote: Warren, Something like: ExecutorService executorService = new ThreadPoolExecutor(10, 10, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueueRunnable()) { @Override protected void beforeExecute(final Thread t, final Runnable r) { ThreadContext.setApplication(BgProcessApplication.this); }; @Override protected void afterExecute(final Runnable r, final Throwable t) { ThreadContext.setApplication(null); } }; seems to work. On Thu, Nov 20, 2014 at 8:33 PM, Warren Bell warr...@clarksnutrition.com wrote: I have seen this from a 2010 post: final Application app = Application.get(); final ExecutorService service = new ScheduledThreadPoolExecutor(1) { @Override protected void beforeExecute(final Thread t, final Runnable r) { Application.set(app); }; @Override protected void afterExecute(final Runnable r, final Throwable t) { Application.unset(); } }; But there is no more Application#set(app) and Application#unset() in Wicket 6. Does Wicket 6 have some built in way of creating secondary processes, maybe an internal thread pool that can be set-up ? Warren Bell On Nov 20, 2014, at 10:03 AM, Warren Bell warr...@clarksnutrition.com mailto:warr...@clarksnutrition.com wrote: Ernesto, great job putting all that code together so quickly. I cloned your project and cherry picked out the code that I needed, I don’t need all the process progress code you have. I don’t really care what the process progress is or even if it completes ok, just don’t want it holding up my response. I ended up using your ExecutionBridge, TasksRunnable, and ITask classes and interfaces. But I still don’t know where and how to inject my service into this new task/thread or ExecutionBridge without getting this exception: Exception in thread pool-1-thread-1 org.apache.wicket.WicketRuntimeException: There is no application attached to current thread pool-1-thread-1 Do I need to get the application attached to my new threads somehow so I can use my injected service, and if so, how do I do that ? Warren On Nov 20, 2014, at 5:47 AM, Ernesto Reinaldo Barreiro reier...@gmail.commailto:reier...@gmail.commailto:reier...@gmail.com wrote: Martin, I have created https://github.com/reiern70/antilia-bits/tree/master/bgprocess My only caveats are https://github.com/reiern70/antilia-bits/blob/master/bgprocess/src/main/java/com/antilia/panel/TasksListPanel.java#L50 and https://github.com/reiern70/antilia-bits/blob/master/bgprocess/src/main/java/com/antilia/panel/TasksListPanel.java#L70 I had to re-add Timer behavior: I do not see yet why? It is as if the timer is not re-rendered: they are not isTemporar :-( I will check when I have more time. I would appreciate if you can review the code... before I write anything on my fork of Wicket in Action. This probably could be done in a leaner way mounting a resource to serve JSON for task states and building the UI at client side... But example illustrates how to do it with plain Wicket. On Thu, Nov 20, 2014 at 8:40 AM, Ernesto Reinaldo Barreiro reier...@gmail.commailto:reier...@gmail.commailto:reier...@gmail.com wrote: Ok. Let me see what I can do this weekend while I wait for my son to finish he's shower after he's football match ;-) On Thu, Nov 20, 2014 at 8:30 AM, Martin Grigorov mgrigo...@apache.org mailto:mgrigo...@apache.orgmailto:mgrigo...@apache.org wrote: Sure! Thanks! It could be as fancy as you wish. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Thu, Nov 20, 2014 at 10:17 AM, Ernesto Reinaldo Barreiro reier...@gmail.com wrote: Can I give it a try? Something event showing some progress at client side? On Thu
Re: What is the proper way to start a secondary process in Wicket 6
Ernesto, I am not sure that creating a service holder will do the trick without still attaching the app to the new thread. I am currently injecting a service into your ExecutionBridge class that is instantiated in the request thread. All is good until that ExecutionBridge gets passed to the new thread. Injecting the service in a Service holder is the same thing, isn’t it ? I haven’t tried attaching the app to the new thread and injecting the service straight into the new task/thread itself. I think that would be cleaner. I will try that out. Warren Bell On Nov 21, 2014, at 8:19 AM, Ernesto Reinaldo Barreiro reier...@gmail.com wrote: @Warren, Apologies for the extra t on your name: texting on a mobile phone is a pain... I will update de demo to include a service. Just one question: the app not in context is when you try to inject that service? Or because you are using something else from WEB layer? On Fri, Nov 21, 2014 at 11:05 AM, Ernesto Reinaldo Barreiro reier...@gmail.com wrote: Thanks for your answer! There is no hurry. I will add a service to the mix to cover Warrent use case. Eg using Guice integration. On 21 Nov 2014 09:34, Martin Grigorov mgrigo...@apache.org wrote: Hi Ernesto, I'm traveling now. I'll be able to take a look at Sunday. On Nov 20, 2014 3:48 PM, Ernesto Reinaldo Barreiro reier...@gmail.com wrote: Martin, I have created https://github.com/reiern70/antilia-bits/tree/master/bgprocess My only caveats are https://github.com/reiern70/antilia-bits/blob/master/bgprocess/src/main/java/com/antilia/panel/TasksListPanel.java#L50 and https://github.com/reiern70/antilia-bits/blob/master/bgprocess/src/main/java/com/antilia/panel/TasksListPanel.java#L70 I had to re-add Timer behavior: I do not see yet why? It is as if the timer is not re-rendered: they are not isTemporar :-( I will check when I have more time. I would appreciate if you can review the code... before I write anything on my fork of Wicket in Action. This probably could be done in a leaner way mounting a resource to serve JSON for task states and building the UI at client side... But example illustrates how to do it with plain Wicket. On Thu, Nov 20, 2014 at 8:40 AM, Ernesto Reinaldo Barreiro reier...@gmail.com wrote: Ok. Let me see what I can do this weekend while I wait for my son to finish he's shower after he's football match ;-) On Thu, Nov 20, 2014 at 8:30 AM, Martin Grigorov mgrigo...@apache.org wrote: Sure! Thanks! It could be as fancy as you wish. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Thu, Nov 20, 2014 at 10:17 AM, Ernesto Reinaldo Barreiro reier...@gmail.com wrote: Can I give it a try? Something event showing some progress at client side? On Thu, Nov 20, 2014 at 7:54 AM, Martin Grigorov mgrigo...@apache.org wrote: Hi, Someday I'll write a blog (with a demo) about this at http://wicketinaction.com. The question is being asked regularly. Actually anyone can send a Pull Request at https://github.com/dashorst/wicketinaction.com with such article. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Thu, Nov 20, 2014 at 7:26 AM, Ernesto Reinaldo Barreiro reier...@gmail.com wrote: Hi Warren, On Thu, Nov 20, 2014 at 12:46 AM, Warren Bell warrenbe...@gmail.com wrote: I am using Wicket 6 REST annotations and want to asynchronously start a process that writes some logging data to a db. I don’t need the response to wait for this process. I have tried using threads, but I get the “App not attached to this thread” exception when I try to use an injected service. This logging process is a little more complicated than what log4j or loopback can do. The bottom line is that I do not want the request/response process to have to wait for the logging process to complete. What is the proper way of doing this in Wicket 6 using an injected service. Sometimes what I do is I create a context class ServiceHolder, inject what I need on this class (e.g. services) and pass this to the non web thread (e.g as an argument to the runnable). Injector.inject will have WicketApp in context. 1) Get request 2) Log some data (Do not wait for this to complete) 3) Process request 4) Return response You could use the same ServiceHolder as a bridge to pass info to the WEB layer. 1) keep a reference to it 2) in another (polling) request use it to see how back-ground job is progressing. Sometimes I also use it to control the Job: e.g. stop/pause it, cancel it. Once Job finishes just let service holder go. Thanks, Warren Bell - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Regards - Ernesto Reinaldo
Re: What is the proper way to start a secondary process in Wicket 6
Ernesto, great job putting all that code together so quickly. I cloned your project and cherry picked out the code that I needed, I don’t need all the process progress code you have. I don’t really care what the process progress is or even if it completes ok, just don’t want it holding up my response. I ended up using your ExecutionBridge, TasksRunnable, and ITask classes and interfaces. But I still don’t know where and how to inject my service into this new task/thread or ExecutionBridge without getting this exception: Exception in thread pool-1-thread-1 org.apache.wicket.WicketRuntimeException: There is no application attached to current thread pool-1-thread-1 Do I need to get the application attached to my new threads somehow so I can use my injected service, and if so, how do I do that ? Warren On Nov 20, 2014, at 5:47 AM, Ernesto Reinaldo Barreiro reier...@gmail.commailto:reier...@gmail.com wrote: Martin, I have created https://github.com/reiern70/antilia-bits/tree/master/bgprocess My only caveats are https://github.com/reiern70/antilia-bits/blob/master/bgprocess/src/main/java/com/antilia/panel/TasksListPanel.java#L50 and https://github.com/reiern70/antilia-bits/blob/master/bgprocess/src/main/java/com/antilia/panel/TasksListPanel.java#L70 I had to re-add Timer behavior: I do not see yet why? It is as if the timer is not re-rendered: they are not isTemporar :-( I will check when I have more time. I would appreciate if you can review the code... before I write anything on my fork of Wicket in Action. This probably could be done in a leaner way mounting a resource to serve JSON for task states and building the UI at client side... But example illustrates how to do it with plain Wicket. On Thu, Nov 20, 2014 at 8:40 AM, Ernesto Reinaldo Barreiro reier...@gmail.commailto:reier...@gmail.com wrote: Ok. Let me see what I can do this weekend while I wait for my son to finish he's shower after he's football match ;-) On Thu, Nov 20, 2014 at 8:30 AM, Martin Grigorov mgrigo...@apache.orgmailto:mgrigo...@apache.org wrote: Sure! Thanks! It could be as fancy as you wish. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Thu, Nov 20, 2014 at 10:17 AM, Ernesto Reinaldo Barreiro reier...@gmail.com wrote: Can I give it a try? Something event showing some progress at client side? On Thu, Nov 20, 2014 at 7:54 AM, Martin Grigorov mgrigo...@apache.org wrote: Hi, Someday I'll write a blog (with a demo) about this at http://wicketinaction.com. The question is being asked regularly. Actually anyone can send a Pull Request at https://github.com/dashorst/wicketinaction.com with such article. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Thu, Nov 20, 2014 at 7:26 AM, Ernesto Reinaldo Barreiro reier...@gmail.com wrote: Hi Warren, On Thu, Nov 20, 2014 at 12:46 AM, Warren Bell warrenbe...@gmail.com wrote: I am using Wicket 6 REST annotations and want to asynchronously start a process that writes some logging data to a db. I don’t need the response to wait for this process. I have tried using threads, but I get the “App not attached to this thread” exception when I try to use an injected service. This logging process is a little more complicated than what log4j or loopback can do. The bottom line is that I do not want the request/response process to have to wait for the logging process to complete. What is the proper way of doing this in Wicket 6 using an injected service. Sometimes what I do is I create a context class ServiceHolder, inject what I need on this class (e.g. services) and pass this to the non web thread (e.g as an argument to the runnable). Injector.inject will have WicketApp in context. 1) Get request 2) Log some data (Do not wait for this to complete) 3) Process request 4) Return response You could use the same ServiceHolder as a bridge to pass info to the WEB layer. 1) keep a reference to it 2) in another (polling) request use it to see how back-ground job is progressing. Sometimes I also use it to control the Job: e.g. stop/pause it, cancel it. Once Job finishes just let service holder go. Thanks, Warren Bell - 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 -- Regards - Ernesto Reinaldo Barreiro -- Regards - Ernesto Reinaldo Barreiro -- This email was Virus checked by Clark's Nutrition's Astaro Security Gateway.
Re: What is the proper way to start a secondary process in Wicket 6
I have seen this from a 2010 post: final Application app = Application.get(); final ExecutorService service = new ScheduledThreadPoolExecutor(1) { @Override protected void beforeExecute(final Thread t, final Runnable r) { Application.set(app); }; @Override protected void afterExecute(final Runnable r, final Throwable t) { Application.unset(); } }; But there is no more Application#set(app) and Application#unset() in Wicket 6. Does Wicket 6 have some built in way of creating secondary processes, maybe an internal thread pool that can be set-up ? Warren Bell On Nov 20, 2014, at 10:03 AM, Warren Bell warr...@clarksnutrition.commailto:warr...@clarksnutrition.com wrote: Ernesto, great job putting all that code together so quickly. I cloned your project and cherry picked out the code that I needed, I don’t need all the process progress code you have. I don’t really care what the process progress is or even if it completes ok, just don’t want it holding up my response. I ended up using your ExecutionBridge, TasksRunnable, and ITask classes and interfaces. But I still don’t know where and how to inject my service into this new task/thread or ExecutionBridge without getting this exception: Exception in thread pool-1-thread-1 org.apache.wicket.WicketRuntimeException: There is no application attached to current thread pool-1-thread-1 Do I need to get the application attached to my new threads somehow so I can use my injected service, and if so, how do I do that ? Warren On Nov 20, 2014, at 5:47 AM, Ernesto Reinaldo Barreiro reier...@gmail.commailto:reier...@gmail.commailto:reier...@gmail.com wrote: Martin, I have created https://github.com/reiern70/antilia-bits/tree/master/bgprocess My only caveats are https://github.com/reiern70/antilia-bits/blob/master/bgprocess/src/main/java/com/antilia/panel/TasksListPanel.java#L50 and https://github.com/reiern70/antilia-bits/blob/master/bgprocess/src/main/java/com/antilia/panel/TasksListPanel.java#L70 I had to re-add Timer behavior: I do not see yet why? It is as if the timer is not re-rendered: they are not isTemporar :-( I will check when I have more time. I would appreciate if you can review the code... before I write anything on my fork of Wicket in Action. This probably could be done in a leaner way mounting a resource to serve JSON for task states and building the UI at client side... But example illustrates how to do it with plain Wicket. On Thu, Nov 20, 2014 at 8:40 AM, Ernesto Reinaldo Barreiro reier...@gmail.commailto:reier...@gmail.commailto:reier...@gmail.com wrote: Ok. Let me see what I can do this weekend while I wait for my son to finish he's shower after he's football match ;-) On Thu, Nov 20, 2014 at 8:30 AM, Martin Grigorov mgrigo...@apache.orgmailto:mgrigo...@apache.orgmailto:mgrigo...@apache.org wrote: Sure! Thanks! It could be as fancy as you wish. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Thu, Nov 20, 2014 at 10:17 AM, Ernesto Reinaldo Barreiro reier...@gmail.com wrote: Can I give it a try? Something event showing some progress at client side? On Thu, Nov 20, 2014 at 7:54 AM, Martin Grigorov mgrigo...@apache.org wrote: Hi, Someday I'll write a blog (with a demo) about this at http://wicketinaction.com. The question is being asked regularly. Actually anyone can send a Pull Request at https://github.com/dashorst/wicketinaction.com with such article. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Thu, Nov 20, 2014 at 7:26 AM, Ernesto Reinaldo Barreiro reier...@gmail.com wrote: Hi Warren, On Thu, Nov 20, 2014 at 12:46 AM, Warren Bell warrenbe...@gmail.com wrote: I am using Wicket 6 REST annotations and want to asynchronously start a process that writes some logging data to a db. I don’t need the response to wait for this process. I have tried using threads, but I get the “App not attached to this thread” exception when I try to use an injected service. This logging process is a little more complicated than what log4j or loopback can do. The bottom line is that I do not want the request/response process to have to wait for the logging process to complete. What is the proper way of doing this in Wicket 6 using an injected service. Sometimes what I do is I create a context class ServiceHolder, inject what I need on this class (e.g. services) and pass this to the non web thread (e.g as an argument to the runnable). Injector.inject will have WicketApp in context. 1) Get request 2) Log some data (Do not wait for this to complete) 3) Process request 4) Return response You could use the same ServiceHolder as a bridge to pass info to the WEB layer. 1) keep a reference to it 2) in another (polling) request use it to see how back-ground job is progressing. Sometimes I also use it to control the Job: e.g. stop/pause
Re: What is the proper way to start a secondary process in Wicket 6
After doing a little digging, I found the ThreadContext class. ExecutorService executorService = new ScheduledThreadPoolExecutor(20) { @Override protected void beforeExecute(Thread t, Runnable r) { ThreadContext.setApplication(app); } @Override protected void afterExecute(Runnable r, Throwable t) { ThreadContext.detach(); } }; That got rid of the initial no application attached to current thread …” exception. Is this the correct way of creating a new process when you need to use an injected service in it ? Warren Bell On Nov 20, 2014, at 11:33 AM, Warren Bell warr...@clarksnutrition.com wrote: I have seen this from a 2010 post: final Application app = Application.get(); final ExecutorService service = new ScheduledThreadPoolExecutor(1) { @Override protected void beforeExecute(final Thread t, final Runnable r) { Application.set(app); }; @Override protected void afterExecute(final Runnable r, final Throwable t) { Application.unset(); } }; But there is no more Application#set(app) and Application#unset() in Wicket 6. Does Wicket 6 have some built in way of creating secondary processes, maybe an internal thread pool that can be set-up ? Warren Bell On Nov 20, 2014, at 10:03 AM, Warren Bell warr...@clarksnutrition.commailto:warr...@clarksnutrition.com wrote: Ernesto, great job putting all that code together so quickly. I cloned your project and cherry picked out the code that I needed, I don’t need all the process progress code you have. I don’t really care what the process progress is or even if it completes ok, just don’t want it holding up my response. I ended up using your ExecutionBridge, TasksRunnable, and ITask classes and interfaces. But I still don’t know where and how to inject my service into this new task/thread or ExecutionBridge without getting this exception: Exception in thread pool-1-thread-1 org.apache.wicket.WicketRuntimeException: There is no application attached to current thread pool-1-thread-1 Do I need to get the application attached to my new threads somehow so I can use my injected service, and if so, how do I do that ? Warren On Nov 20, 2014, at 5:47 AM, Ernesto Reinaldo Barreiro reier...@gmail.commailto:reier...@gmail.commailto:reier...@gmail.com wrote: Martin, I have created https://github.com/reiern70/antilia-bits/tree/master/bgprocess My only caveats are https://github.com/reiern70/antilia-bits/blob/master/bgprocess/src/main/java/com/antilia/panel/TasksListPanel.java#L50 and https://github.com/reiern70/antilia-bits/blob/master/bgprocess/src/main/java/com/antilia/panel/TasksListPanel.java#L70 I had to re-add Timer behavior: I do not see yet why? It is as if the timer is not re-rendered: they are not isTemporar :-( I will check when I have more time. I would appreciate if you can review the code... before I write anything on my fork of Wicket in Action. This probably could be done in a leaner way mounting a resource to serve JSON for task states and building the UI at client side... But example illustrates how to do it with plain Wicket. On Thu, Nov 20, 2014 at 8:40 AM, Ernesto Reinaldo Barreiro reier...@gmail.commailto:reier...@gmail.commailto:reier...@gmail.com wrote: Ok. Let me see what I can do this weekend while I wait for my son to finish he's shower after he's football match ;-) On Thu, Nov 20, 2014 at 8:30 AM, Martin Grigorov mgrigo...@apache.orgmailto:mgrigo...@apache.orgmailto:mgrigo...@apache.org wrote: Sure! Thanks! It could be as fancy as you wish. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Thu, Nov 20, 2014 at 10:17 AM, Ernesto Reinaldo Barreiro reier...@gmail.com wrote: Can I give it a try? Something event showing some progress at client side? On Thu, Nov 20, 2014 at 7:54 AM, Martin Grigorov mgrigo...@apache.org wrote: Hi, Someday I'll write a blog (with a demo) about this at http://wicketinaction.com. The question is being asked regularly. Actually anyone can send a Pull Request at https://github.com/dashorst/wicketinaction.com with such article. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Thu, Nov 20, 2014 at 7:26 AM, Ernesto Reinaldo Barreiro reier...@gmail.com wrote: Hi Warren, On Thu, Nov 20, 2014 at 12:46 AM, Warren Bell warrenbe...@gmail.com wrote: I am using Wicket 6 REST annotations and want to asynchronously start a process that writes some logging data to a db. I don’t need the response to wait for this process. I have tried using threads, but I get the “App not attached to this thread” exception when I try to use an injected service. This logging process
Is there a hook where I can run code after response and connection is closed
Just a follow up on a previous post where I was trying to log some data to a db and not have the response wait. Is there a hook somewhere that is called after the response has left to the client and the connection is closed. onAfterConnectionClosed(…)? This would need to be accessible somehow in my “REST Annotations” implementation of IResource. Thanks, Warren Bell - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
What is the proper way to start a secondary process in Wicket 6
I am using Wicket 6 REST annotations and want to asynchronously start a process that writes some logging data to a db. I don’t need the response to wait for this process. I have tried using threads, but I get the “App not attached to this thread” exception when I try to use an injected service. This logging process is a little more complicated than what log4j or loopback can do. The bottom line is that I do not want the request/response process to have to wait for the logging process to complete. What is the proper way of doing this in Wicket 6 using an injected service. 1) Get request 2) Log some data (Do not wait for this to complete) 3) Process request 4) Return response Thanks, Warren Bell - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Integrating Wicket with an Angular app
I have an Angular app with a Wicket back end. I am using Wicket rest annotations located at https://github.com/bitstorm/Wicket-rest-annotations . Seems to be working pretty good. Warren On Oct 30, 2014, at 2:04 PM, BenjaminV bvellac...@yahoo.commailto:bvellac...@yahoo.com wrote: Hi guys Is this thread still alive? I have reasons to consider using wicket and angular together and I was wondering how you got on? -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Integrating-Wicket-with-an-Angular-app-tp4656794p4668180.html Sent from the Users forum mailing list archive at Nabble.comhttp://Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.orgmailto:users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.orgmailto:users-h...@wicket.apache.org
Re: how to handle null pointer exception while submit button
OK, a little confused, AWT, Applet ? Is Wicket up to something I haven’t heard about ? Warren On Oct 5, 2014, at 7:57 PM, Taught by SM qaidjoharbarbh...@gmail.com wrote: This code will help to handle exceptions when there is a single TextField: import java.awt.*; import java.awt.event.*; import java.applet.*; /* applet code=throwsDemo.class height=250 width=300 /applet */ class FieldZeroException extends Exception { FieldZeroException() { } public String toString() { return Text field is empty.; } } public class throwsDemo extends Applet implements ActionListener { Button b1; TextField tf1,tf2; Label l1,l2; public void init() { setLayout(new FlowLayout(FlowLayout.LEFT)); l1=new Label(NULL); l1.setForeground(Color.RED); l2=new Label(); l2.setForeground(Color.GREEN); tf1=new TextField(10); b1=new Button(Check); add(tf1); add(b1); add(l1); add(l2); b1.addActionListener(this); } public void actionPerformed(ActionEvent ae) { if(ae.getSource()==b1) { String str1=tf1.getText(); int i=str1.length(); try { if(i==0) { throw new FieldZeroException(); } else { l1.setText(Success); } } catch(FieldZeroException fze) { l1.setText(fze.toString()); } } } } -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/how-to-handle-null-pointer-exception-while-submit-button-tp4666392p4667826.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 -- This email was Virus checked by Clark's Nutrition's Astaro Security Gateway. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Wicket serving AngularJS app
I am using Wicket 6 to manage an AngularJS app. Currently I am just letting Tomcat serve the AngularJS client i.e. index.html and using Wicket for authentication, authorization and REST. But I would like to use Wicket to serve up the client so that I can manage css and js resources and set an initial cookie. What would be the best way to do this ? I was thinking of just making the index.html file a wicket page with no components or should I use a WebExternalResourceRequestHandler or something similar ? Thanks, Warren -- This email was Virus checked by Clark's Nutrition's Astaro Security Gateway. lt;div style='font-size:11.0pt;font-family:quot;Tahomaquot;'gt;The information contained in this e-mail is intended only for use of the individual or entity named above. This e-mail, and any documents, files, previous e-mails or other information attached to it, may contain confidential information that is legally privileged. If you are not the intended recipient of this e-mail, or the employee or agent responsible for delivering it to the intended recipient, you are hereby notified that any disclosure, dissemination, distribution, copying or other use of this e-mail or any of the information contained in or attached to it is strictly prohibited. If you have received this e-mail in error, please immediately notify us by return e-mail or by telephone at (951)321-1960, and destroy the original e-mail and its attachments without reading or saving it in any manner. Thank you.lt;/divgt; lt;div align=quot;centerquot; style='font-size:12.0pt;font-family:quot;Tahomaquot;,quot;sans-serifquot;'gt;lt;stronggt;Clark’s Nutrition is a registered trademark of Clarks Nutritional Centers, Inc.lt;/stronggt;lt;/divgt; - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
How do I access Wicket's string resources in a non component class ?
I want to access Wicket's string resources in a non component class. I am aware of getLocalizer().getString(...) for a component, but how do you do this in a non Component based class and how do you make Wicket aware of the message bundle ? All of the Localizer#getString(...) methods require a Component. I am using Wicket version 6.10.0. I have a REST resource named UserResource.java and messages in UserResource.properties. Thanks Warren -- This email was Virus checked by Clark's Nutrition's Astaro Security Gateway. lt;div style='font-size:11.0pt;font-family:quot;Tahomaquot;'gt;The information contained in this e-mail is intended only for use of the individual or entity named above. This e-mail, and any documents, files, previous e-mails or other information attached to it, may contain confidential information that is legally privileged. If you are not the intended recipient of this e-mail, or the employee or agent responsible for delivering it to the intended recipient, you are hereby notified that any disclosure, dissemination, distribution, copying or other use of this e-mail or any of the information contained in or attached to it is strictly prohibited. If you have received this e-mail in error, please immediately notify us by return e-mail or by telephone at (951)321-1960, and destroy the original e-mail and its attachments without reading or saving it in any manner. Thank you.lt;/divgt; lt;div align=quot;centerquot; style='font-size:12.0pt;font-family:quot;Tahomaquot;,quot;sans-serifquot;'gt;lt;stronggt;Clark’s Nutrition is a registered trademark of Clarks Nutritional Centers, Inc.lt;/stronggt;lt;/divgt; - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How do I access Wicket's string resources in a non component class ?
I think this is exactly what I am looking for. I had an older version of Wicket REST Annotations that did not have this class. I do have a question about its usage. I did the following in my resource class and it does work. DefaultBundleResolver defaultBundleResolver = new DefaultBundleResolver(MyRestResource.class); String message = defaultBundleResolver.getMessage(test, null); Is this the correct way to use this class or is their a way for it to plug into Wicket via Application#Init() method and then get the Localizer and use it? Thanks, Warren On Dec 11, 2013, at 1:30 PM, Andrea Del Bene wrote: Hi, maybe you can have a look here: https://github.com/wicketstuff/core/blob/master/jdk-1.6-parent/wicketstuff-restannotations-parent/restannotations/src/main/java/org/wicketstuff/rest/utils/wicket/bundle/DefaultBundleResolver.java That's a resource bundle resolver that works with the stringResourceLoaders of the Application. I want to access Wicket's string resources in a non component class. I am aware of getLocalizer().getString(...) for a component, but how do you do this in a non Component based class and how do you make Wicket aware of the message bundle ? All of the Localizer#getString(...) methods require a Component. I am using Wicket version 6.10.0. I have a REST resource named UserResource.java and messages in UserResource.properties. Thanks Warren - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- This email was Virus checked by Clark's Nutrition's Astaro Security Gateway. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How do I access Wicket's string resources in a non component class ?
Answered my own question. Found this in Wicket REST Annotation tests. DefaultBundleResolver resolver = new DefaultBundleResolver(RestResourceFullAnnotated.class); assertEquals(resolver.getMessage(CustomValidator, Collections.EMPTY_MAP), response); On Dec 11, 2013, at 2:26 PM, Warren Bell wrote: I think this is exactly what I am looking for. I had an older version of Wicket REST Annotations that did not have this class. I do have a question about its usage. I did the following in my resource class and it does work. DefaultBundleResolver defaultBundleResolver = new DefaultBundleResolver(MyRestResource.class); String message = defaultBundleResolver.getMessage(test, null); Is this the correct way to use this class or is their a way for it to plug into Wicket via Application#Init() method and then get the Localizer and use it? Thanks, Warren On Dec 11, 2013, at 1:30 PM, Andrea Del Bene wrote: Hi, maybe you can have a look here: https://github.com/wicketstuff/core/blob/master/jdk-1.6-parent/wicketstuff-restannotations-parent/restannotations/src/main/java/org/wicketstuff/rest/utils/wicket/bundle/DefaultBundleResolver.java That's a resource bundle resolver that works with the stringResourceLoaders of the Application. I want to access Wicket's string resources in a non component class. I am aware of getLocalizer().getString(...) for a component, but how do you do this in a non Component based class and how do you make Wicket aware of the message bundle ? All of the Localizer#getString(...) methods require a Component. I am using Wicket version 6.10.0. I have a REST resource named UserResource.java and messages in UserResource.properties. Thanks Warren - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- This email was Virus checked by Clark's Nutrition's Astaro Security Gateway. - 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: Refreshing repeating view
I just got done with a problem similar to this. It may be because your RepeatingView is useing ReuseIfModelsEqualStrategy. In my situation the component never thought the value changed so it reused the old value. It sounds like that is what is happening to you. My fix was to call Component#modelChanged() on the component. This forces it to use the new value. I finally figured this out with some help from Cemal Bayramoglu. Hopefully you won't spend as much time as I did. Thanks, Warren Bell On 11/29/11 6:38 AM, mohan mohan wrote: Hi I am using RepeatingView to add dynamic text fields on a plus button click in a panel. When I add new text field to the repeating view on a plus button click and refresh it, the user input for the other text fields gone. Does repeating view reconstructs the components on refresh? How can I preserve user input? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: WiQuery vs JQWicket
Have you tried the InMethod grid, and if you have is there a reason you are looking for something different? I am just curious. Thanks, Warren On 11/23/11 8:26 AM, Brian Mulholland wrote: As I am looking at them, I am not noticing either implementing the jQuery grid, much less the paging scrollbar. Am I overlooking it? Brian Mulholland On Wed, Nov 23, 2011 at 10:56 AM, Pointbreak pointbreak+wicketst...@ml1.net wrote: I've never used either framework, but your question made me curious again. (Years ago I evaluated the existing wicket-jquery integrations and wasn't happy with how they were designed. Since than I've always just used jquery inside wicket, it's not that hard for simple designs, and for complex designs these frameworks may be just to rigid). That being said I just had a quick glance at the projects again and it seems that WiQuery does the integration via Components (i.e. you create an Accordion Component), while JqWicket does the integration via Bahaviors (i.e. you add an AccordionBehavior to an existing Component, e.g. a ListView). The latter (thus using Behaviors) is how I have always done it, feels more natural to me, and is a lot more flexible. On Wednesday, November 23, 2011 10:16 AM, Brian Mulholland blmulholl...@gmail.com wrote: We are considering WiQuery and JQWicket. 1) Which is better and why? 2) Is one more established or better supported than the other? 3) Is one more full featured? What differentiates the two? Brian Mulholland - 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: InMethod grid, Hidden Field in column does not get updated
Any takers, this one has me stumped. Is there anything special with how a HiddenField gets updated after an Ajax call. The HiddenField is in the same panel as a TextField. The TextField gets updated but the HiddenField does not. I have checked and the values have changed on the model object for both fields. I thought that when you add a component to the target that the component and all its children would get updated. I see the HiddenField coming back in the Ajax response, it just has the old value. Thanks, Warren -Original Message- From: Warren Bell Sent: Wednesday, November 16, 2011 11:04 AM To: 'users@wicket.apache.org' Subject: InMethod grid, Hidden Field in column does not get updated I have an Inmethod grid with a HiddenField in a panel in a column. This HiddenField does not get updated after a SubmitCancelColumn is clicked. All the other fields get updated correctly except for the HiddenField. There is also a TextField in the same panel as the HiddenField, the TextField gets updated correctly. Here is the column code, newPriceTextField gets updated correctly and oldNewPriceHiddenField does not get updated: WicketColumnAdapter newPriceColumn = new WicketColumnAdapter(newPriceColumnAdapter, new org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumnString(new ModelString(New Price), newPrice)) { @Override public Component newCell(WebMarkupContainer parent, String componentId, IModel rowModel) { final PriceChange priceChange = (PriceChange)rowModel.getObject(); final TextFieldDouble newPriceTextField = new TextFieldDouble(newPrice, new PropertyModelDouble(priceChange, newPrice), Double.class) final HiddenFieldDouble oldNewPriceHiddenField = new HiddenFieldDouble(oldNewPrice, new PropertyModelDouble(priceChange, oldNewPrice), Double.class); CostNewPricePanel panel = new CostNewPricePanel(newPriceTextField, oldNewPriceHiddenField); return panel; } }; Also, the oldNewPrice property of the oldNewPriceHiddenField does change after SubmitCancelColumn gets clicked. What do I need to do to get the HiddenField to update correctly? Thanks, Warren Bell - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
InMethod grid, Hidden Field in column does not get updated
I have an Inmethod grid with a HiddenField in a panel in a column. This HiddenField does not get updated after a SubmitCancelColumn is clicked. All the other fields get updated correctly except for the HiddenField. There is also a TextField in the same panel as the HiddenField, the TextField gets updated correctly. Here is the column code, newPriceTextField gets updated correctly and oldNewPriceHiddenField does not get updated: WicketColumnAdapter newPriceColumn = new WicketColumnAdapter(newPriceColumnAdapter, new org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumnString(new ModelString(New Price), newPrice)) { @Override public Component newCell(WebMarkupContainer parent, String componentId, IModel rowModel) { final PriceChange priceChange = (PriceChange)rowModel.getObject(); final TextFieldDouble newPriceTextField = new TextFieldDouble(newPrice, new PropertyModelDouble(priceChange, newPrice), Double.class) final HiddenFieldDouble oldNewPriceHiddenField = new HiddenFieldDouble(oldNewPrice, new PropertyModelDouble(priceChange, oldNewPrice), Double.class); CostNewPricePanel panel = new CostNewPricePanel(newPriceTextField, oldNewPriceHiddenField); return panel; } }; Also, the oldNewPrice property of the oldNewPriceHiddenField does change after SubmitCancelColumn gets clicked. What do I need to do to get the HiddenField to update correctly? Thanks, Warren Bell -- This email was Virus checked by Clark's Nutrition's Astaro Security Gateway. The information contained in this e-mail is intended only for use of the individual or entity named above. This e-mail, and any documents, files, previous e-mails or other information attached to it, may contain confidential information that is legally privileged. If you are not the intended recipient of this e-mail, or the employee or agent responsible for delivering it to the intended recipient, you are hereby notified that any disclosure, dissemination, distribution, copying or other use of this e-mail or any of the information contained in or attached to it is strictly prohibited. If you have received this e-mail in error, please immediately notify us by return e-mail or by telephone at (951)321-1960, and destroy the original e-mail and its attachments without reading or saving it in any manner. Thank you.
RE: dynamically adding validators to TextFields in a ListView
I have that working ok, but I am trying to add an atribute to the TextField when it is invalid. The problem is that a new TextField is created when the page is rerendered. I have a workaround, but it is ugly. Any sugestions? -Original Message- From: Igor Vaynberg [mailto:igor.vaynb...@gmail.com] Sent: Wednesday, August 18, 2010 10:40 PM To: users@wicket.apache.org Subject: Re: dynamically adding validators to TextFields in a ListView whatever is creating the textfield should add the appropriate validator -igor On Wed, Aug 18, 2010 at 10:01 PM, Warren Bell warr...@clarksnutrition.com wrote: I have a ListView that adds one TextField to each ListItem. These TextFields need to have different types of validators added to them depending on a condition. One TextField in the first ListItem may need an email validator while the TextField in the next ListItem may need a number range validator and so on. What is the best way to do this type of validation? Warren - 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
dynamically adding validators to TextFields in a ListView
I have a ListView that adds one TextField to each ListItem. These TextFields need to have different types of validators added to them depending on a condition. One TextField in the first ListItem may need an email validator while the TextField in the next ListItem may need a number range validator and so on. What is the best way to do this type of validation? Warren
RE: Localizer in a new Thread
I am not sure how to preload the the values. I am trying this, but am not getting anywhere. myApp.getResourceSettings().getPropertiesFactory().load(ScanManTask.clas s, com.scanman.cron.task) I have a properties file named ScanManTask.properties and have added it to my app like this: getResourceSettings().addStringResourceLoader(new ClassStringResourceLoader(ScanManTask.class)); ScanManTask is not a commponent. The load method has a clazz and path argument. I am assummeing the class is the class associated with the property file and the path is the package it is in? I guess I could just load them manually, but I would like to take advantage of localization. How do I get a localized version of a Properties object with my messages in it? -Original Message- From: Wilhelmsen Tor Iver [mailto:toriv...@arrive.no] Sent: Thursday, July 29, 2010 11:19 PM To: users@wicket.apache.org Subject: SV: Localizer in a new Thread To clarify, I want to use Localizer#getString(...) in a thraed I create. I have seen other posts on this issue, but haven't been able to figure out the solution. The Localizer.getString() looks for its messages in Wicket's property file structure, which depends on Application, the resource-oriented classes, hierarchies and so forth. Your best bet is to pre-read the values you need into a Properties object that you pass to the thread code. - Tor Iver - 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
Localizer in a new Thread
I want to take advantage of Wicket's message localization in a new thread I have created. I am trying to pass the localizer to a thread that runs background tasks. I am geting an org.apache.wicket.WicketRuntimeException: There is no application attached to current thread I am sure I am going about this the wrong way. What's the best way to get message localization in a new thread ? Thanks, Warren mailto:don...@prosolutionssd.com
RE: Localizer in a new Thread
To clarify, I want to use Localizer#getString(...) in a thraed I create. I have seen other posts on this issue, but haven't been able to figure out the solution. Warren -Original Message- From: Warren Bell [mailto:warr...@clarksnutrition.com] Sent: Thursday, July 29, 2010 3:31 PM To: users@wicket.apache.org Subject: Localizer in a new Thread I want to take advantage of Wicket's message localization in a new thread I have created. I am trying to pass the localizer to a thread that runs background tasks. I am geting an org.apache.wicket.WicketRuntimeException: There is no application attached to current thread I am sure I am going about this the wrong way. What's the best way to get message localization in a new thread ? Thanks, Warren - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Which form componnent had focus when form was submitted?
Is there a way to figure out in a forms onSubmit which text field or button had focus when the form is submitted. I have done something in js to achieve this, but wanted to see if there was something already built in Wicket. I am limited to using form submit only no Ajax. Windows CE is having problems with some of the Ajax I tried to use. Thanks, Warren
Re: Which form componnent had focus when form was submitted?
Thats what I am currently doing. It just felt to much like something I used to do in Struts. I don't know if there is much call for this, but it would be nice to have an onSubmit for a text field or other form components that would get fired off if that component was in focus when the form was submited, or maybe a Form onSubmit(Component componentInFocus). Just a thought, I end up doing a lot of this. Warren Igor Vaynberg wrote: you have to keep a HiddenField component and populate its value using javascript. -igor On Wed, Apr 21, 2010 at 9:41 AM, Warren Bell warr...@clarksnutrition.com wrote: Is there a way to figure out in a forms onSubmit which text field or button had focus when the form is submitted. I have done something in js to achieve this, but wanted to see if there was something already built in Wicket. I am limited to using form submit only no Ajax. Windows CE is having problems with some of the Ajax I tried to use. Thanks, Warren - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Thanks, Warren Bell
Adding attributes to child components in a behavior.
Is there a way to add attributes to child components in a behavior that is added to a page? I want to create a behavior that is added to a page that adds some js to the header and then adds some js in an onfocus attribute of each child form component on the page. I have the list of child form components, but can't figure out how to add the attribute to the components. Warren
Re: Adding attributes to child components in a behavior.
I have that figured out, I just don't know how to add the attribute to each component. I can't add a behavior, since Cannot modify component hierarchy after render phase has started (page version cant change then anymore) Can I even do this in a behavior? Cemal Bayramoglu wrote: Warren, See MarkupContainer#visitChildren Regards - Cemal jWeekend OO Java Technologies, Wicket Consulting, Development, Training http://jWeekend.com On 15 April 2010 18:44, Warren Bell warr...@clarksnutrition.com wrote: Is there a way to add attributes to child components in a behavior that is added to a page? I want to create a behavior that is added to a page that adds some js to the header and then adds some js in an onfocus attribute of each child form component on the page. I have the list of child form components, but can't figure out how to add the attribute to the components. Warren - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Thanks, Warren Bell - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: Adding attributes to child components in a behavior.
Sorry if this got double posted, I didn't see it up there. I have that figured out, I just don't know how to add the attribute to each component. I can't add a behavior, since Cannot modify component hierarchy after render phase has started (page version cant change then anymore) Can I even do this in a behavior? Cemal Bayramoglu wrote: Warren, See MarkupContainer#visitChildren Regards - Cemal jWeekend OO Java Technologies, Wicket Consulting, Development, Training http://jWeekend.com On 15 April 2010 18:44, Warren Bell warr...@clarksnutrition.com wrote: Is there a way to add attributes to child components in a behavior that is added to a page? I want to create a behavior that is added to a page that adds some js to the header and then adds some js in an onfocus attribute of each child form component on the page. I have the list of child form components, but can't figure out how to add the attribute to the components. Warren - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Thanks, Warren Bell - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Adding attributes to child components in a behavior.
I ended up doing it in bind of the behavior and it works fine. I just have to remember to add the behavior to the page after all the other components. Thanks I assume you were trying this in beforeRender of your behaviour, which as you say is too late. If you really need to use a behaviour encapsulate all this, try something like the following, but some may feel its a little politically incorrect to do this in bind. class MyBehaviour extends AbstractBehavior{ @Override public void bind(Component component) { if(!(component instanceof MarkupContainer)){ throw new RuntimeException(contaıners only please); } visitChildren(new IVisitorComponent(){ @Override public Object component(Component component) { component.add(new SimpleAttributeModifier(class,goodChild)); return IVisitor.CONTINUE_TRAVERSAL; } }); } } Regards - Cemal jWeekend OO Java Technologies, Wicket Consulting, Development, Training http://jWeekend.com On 15 April 2010 20:17, Warren Bell warrenbe...@gmail.com wrote: I have that figured out, I just don't know how to add the attribute to each component. I can't add a behavior, since Cannot modify component hierarchy after render phase has started (page version cant change then anymore) Can I even do this in a behavior? Cemal Bayramoglu wrote: Warren, See MarkupContainer#visitChildren Regards - Cemal jWeekend OO Java Technologies, Wicket Consulting, Development, Training http://jWeekend.com On 15 April 2010 18:44, Warren Bell warr...@clarksnutrition.com wrote: Is there a way to add attributes to child components in a behavior that is added to a page? I want to create a behavior that is added to a page that adds some js to the header and then adds some js in an onfocus attribute of each child form component on the page. I have the list of child form components, but can't figure out how to add the attribute to the components. Warren - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Thanks, Warren Bell - 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
Behavior does not work when visibility is changed from false to true
I have a TextField with an AjaxFormSubmitBehavior attached to it. The behavior works fine when the page is loaded with the TextField visible but does not work if the page is loaded with it not visible and then made visible with an ajax call. I can see everything in the ajax response including the head js. The head js has a function that gets called by the TextFields onkeypress event before the wicket ajax is called. Firebug says it can't find the function, but it is in the ajax response. There is no js in this behavior that is associated with the page loading. What do I need to do to make this behavior work after visibility is changed from false to true? -- Thanks, Warren Bell - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
InMethod grid AbstractColumn#getHeaderCssClass() problem.
I am having a problem with AbstractColumn#getHeaderCssClass() in an inmethod datagrid. It is writing my css class to the th tag but my css class is not working. I think it is something to do with IE8. Unfortunately the company that uses this app uses IE8 and the app is written for IE8. Digging threw the code, I can see were the css class name is added, but there does not seem to be any way to modify it or implementing my own ColumnHeader panel without copying a whole lot of classes. I think it would probably be better if the users css class was added to its own div tag. Anyway, does anyone know of a simple way of getting my css class to work in an InMethod grid header? All I want to do is center the header text. Customers can get real nit picky. The same class works for an individual cell: @Override public String getCellCssClass(IModel rowModel, int rowNum) { return centerAlign; } but, this does not work for the header: @Override public String getHeaderCssClass() { return centerAlign; } The th tag that is getting created is: th style=width:125px class=imxt-want-prelight centerAligndiv class=imxt-adiv class=imxt-ba id=id20 href=# class=imxt-sort-header imxt-sort-header-none onclick=var wcall=wicketAjaxGet('?wicket:interface=:4:body:grid:header:header:getOrderCostFromItems::IBehaviorListener:0:',null,null, function() {return Wicket.$('id20') != null;}.bind(this));return !wcall; div class=imxt-sort-header1divTotal/div/div /a/diva class=imxt-handle href=# onclick=return false/a/div/th My css class: .centerAlign { text-align: center; } -- Thanks, Warren - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: InMethod grid AbstractColumn#getHeaderCssClass() problem.
Your first suggestion worked: th.centerAlign * { text-align: center !important; } Sorry about that, I just don't know my css very well. Just a suggestion, but maybe the JavaDocs should mention something about that? Also, what is the future of InMethod? Warren Matej Knopp wrote: But the css class is in the output. Can't it be a styling problem? I.e. the css being by more specific rule? Can you try something like th.centerAlign * { text-align: center !important; } Or even more specific clas th.centerAlign div.imxt-a { text-align:center !important; } If that doesn't work, this should div.imxt-vista table.imxt-head th.centerAlign div.imxt-a { text-align:center !important; } You should use firebug (or something similar) to inspect the elements to see which CSS ruels get applied and how to override them. -Matej On Mon, Feb 1, 2010 at 4:45 PM, Warren Bell warrenbe...@gmail.com wrote: I am having a problem with AbstractColumn#getHeaderCssClass() in an inmethod datagrid. It is writing my css class to the th tag but my css class is not working. I think it is something to do with IE8. Unfortunately the company that uses this app uses IE8 and the app is written for IE8. Digging threw the code, I can see were the css class name is added, but there does not seem to be any way to modify it or implementing my own ColumnHeader panel without copying a whole lot of classes. I think it would probably be better if the users css class was added to its own div tag. Anyway, does anyone know of a simple way of getting my css class to work in an InMethod grid header? All I want to do is center the header text. Customers can get real nit picky. The same class works for an individual cell: @Override public String getCellCssClass(IModel rowModel, int rowNum) { return centerAlign; } but, this does not work for the header: @Override public String getHeaderCssClass() { return centerAlign; } The th tag that is getting created is: th style=width:125px class=imxt-want-prelight centerAligndiv class=imxt-adiv class=imxt-ba id=id20 href=# class=imxt-sort-header imxt-sort-header-none onclick=var wcall=wicketAjaxGet('?wicket:interface=:4:body:grid:header:header:getOrderCostFromItems::IBehaviorListener:0:',null,null, function() {return Wicket.$('id20') != null;}.bind(this));return !wcall; div class=imxt-sort-header1divTotal/div/div /a/diva class=imxt-handle href=# onclick=return false/a/div/th My css class: .centerAlign { text-align: center; } -- Thanks, Warren - 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 -- Thanks, Warren Bell - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Maven problem with wicketstuff
I am trying to retrieve wicketstuff-core from repository and am getting the following Missing artifact. Missing artifact org.wicketstuff:wicketstuff-core:jar:1.4.2-SNAPSHOT:compile my pom ... repository idwicket-snaps/id urlhttp://wicketstuff.org/maven/repository/url snapshots enabledtrue/enabled /snapshots releases enabledtrue/enabled /releases /repository ... dependency groupIdorg.wicketstuff/groupId artifactIdwicketstuff-core/artifactId version1.4.2-SNAPSHOT/version /dependency ... What am I doing wrong? Thanks, Warren - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Maven problem with wicketstuff
wicketstuff-minis I found it: dependency groupIdorg.wicketstuff/groupId artifactIdminis/artifactId version1.4.1/version /dependency Thanks mbrictson wrote: What part of wicketstuff do you want to use in your project? The wicketstuff-core artifact is not a JAR artifact. You have to specify the actual JAR you need, like annotation, for example: dependency groupIdorg.wicketstuff/groupId artifactIdannotation/artifactId version1.4.2-SNAPSHOT/version /dependency Warren Bell-2 wrote: I am trying to retrieve wicketstuff-core from repository and am getting the following Missing artifact. Missing artifact org.wicketstuff:wicketstuff-core:jar:1.4.2-SNAPSHOT:compile my pom ... repository idwicket-snaps/id urlhttp://wicketstuff.org/maven/repository/url snapshots enabledtrue/enabled /snapshots releases enabledtrue/enabled /releases /repository ... dependency groupIdorg.wicketstuff/groupId artifactIdwicketstuff-core/artifactId version1.4.2-SNAPSHOT/version /dependency ... What am I doing wrong? Thanks, Warren - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Thanks, Warren Bell - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Model object properties go null after RestartResponseAtInterceptPageException.
No it looks like it is the same instance, Its constructor is only being called once. I can watch the model object and see when it gets set to null, though I am not sure what I am looking for as far as what is setting it to null. It gets set to null on the way back to the page from the login. The model object is a ValueMap that I store in the Application object. I am also using wicket-security. Here is how my model is being created. super(name, new CompoundPropertyModelValueMap(getScanManApp().getAppProperties()) { @Override public ValueMap getObject() { return getScanManApp().getAppProperties(); } }); Johan Compagner wrote: isnt your page not just a brand new shiny new instance? place a breakpoint in your constructor On 14/12/2009, Warren Bell warr...@clarksnutrition.com wrote: Does Any body have any ideas, I am stuck and can't figure this out. I have a page with about 10 text fields. The model for the page is a ValueMap. All of the values in the ValueMap get set to null when a user gets redirected back to the original page after a RestartResponseAtInterceptPageException. All of the keys in the ValueMap are still there. What do I need to do to fix this? Warren - 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 -- Thanks, Warren Bell - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: Model object properties go null after RestartResponseAtInterceptPageException.
Does Any body have any ideas, I am stuck and can't figure this out. I have a page with about 10 text fields. The model for the page is a ValueMap. All of the values in the ValueMap get set to null when a user gets redirected back to the original page after a RestartResponseAtInterceptPageException. All of the keys in the ValueMap are still there. What do I need to do to fix this? Warren - 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
Model object properties go null after RestartResponseAtInterceptPageException.
I have a page with about 10 text fields. The model for the page is a ValueMap. All of the values in the ValueMap get set to null when a user gets redirected back to the original page after a RestartResponseAtInterceptPageException. All of the keys in the ValueMap are still there. What do I need to do to fix this? Warren - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: Choose one
I needed to do the same thing. I saw this on another post and it works fine. Override getDefaultChoice: protected CharSequence getDefaultChoice(Object selected) { return option selected=\selected\ value=\\Choose One/option; } You can use getLocalizer().getString(yourpage.dropdownchoice.defaultvalue, this) for your different languages. Warren -Original Message- From: Gatos [mailto:ega...@gmail.com] Sent: Thursday, August 27, 2009 5:46 AM To: users@wicket.apache.org Subject: Choose one After I choose something in DropDownChoice then 'Choose one' item is removed from the list. If I will try to use setNullValid(true) then 'Choose one' string is replaced with '' (emptry string). How is it possible to display 'Choose one' if another item has been selected? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: AbstractAjaxTimerBehavior on Modal Window causes PageExpiredException
Yes all my objects that need to be serialized are being serialized. I put together a workaround. In the onClick() that closes the Modal Window. I called AbstractAjaxTimerBehavior#stop() then waited for a period longer than the Duration of the AbstractAjaxTimerBehavior and then closed the Modal Window. This worked, but it is kinda clunky and I could see cases where it wouldn't. I think what is happening is that the AbstractAjaxTimerBehavior requests are conflicting with the closeing of the Modal Window. I was looking for a way that would close the Modal Window only after the last request/response was made from the AbstractAjaxTimerBehavior. Is there a way of finding out when the last AbstractAjaxTimerBehavior response comes back from the server before closeing the Modal Window or am I going down the wrong path here? Warren -Original Message- From: Mathias Nilsson [mailto:wicket.program...@gmail.com] Sent: Thursday, August 27, 2009 12:18 PM To: users@wicket.apache.org Subject: Re: AbstractAjaxTimerBehavior on Modal Window causes PageExpiredException Does all your models and objects that you use in the wicket page implement Serializable? -- View this message in context: http://www.nabble.com/AbstractAjaxTimerBehavior-on-Modal-Window-causes-P ageExpiredException-tp25159539p25178263.html Sent from the Wicket - User 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
AbstractAjaxTimerBehavior on Modal Window causes PageExpiredException
I am getting a PageExpiredException when I close a modal window that has an AbstractAjaxTimerBehavior on it. What do I need to do to fix this? Thanks
RE: LoadableDetachableModel#load() called twice
I need to read you response a little better. The choice id is being submitted with the form the button is on. Now if I have the button on a different form, can I update the ListChoice by simply adding the ListChoice to the target? Warren -Original Message- From: Warren Bell [mailto:warr...@clarksnutrition.com] Sent: Friday, August 21, 2009 12:43 PM To: users@wicket.apache.org Subject: RE: LoadableDetachableModel#load() called twice Ok, I see what is happening. I am using one of the selected choice objects in the onSubmit and then adding a new choice object to the list. In order for me to use that selected object, LDM#load() has to be called first to get it. But how does it know I am going to use that chosen object if I am not calling getObject()? Now if the selected object is a member of the page and I don't use the selected object anywhere or add the ListChoice to the tagret, does the ListChoice choices LDM#load get called everytime any AjaxButton is pressed regardless of what form it is on? Or to put it another way, in the situation below what are the conditions that cause the LDM#load() to be called? class MyPage extends WebPage { private MyObject myListChoiceSelectedObject; public MyPage() { setDefaultModel(new CompoundPropertyModelMyPage(this)); ... someForm.add(new ListChoiceMyObject(myListChoiceSelectedObject, new LoadableDetachableModelListMyObject(){...}, new IChoiceRendererMyObject(){...})); ... } } Thanks for your help Warren -Original Message- From: jWeekend [mailto:jweekend_for...@cabouge.com] Sent: Friday, August 21, 2009 11:37 AM To: users@wicket.apache.org Subject: Re: LoadableDetachableModel#load() called twice Warren, Unless you are indirectly calling load() yourself, eg by calling getObject(), on your LDM) during form processing it's Wicket converting the selected item (by choice id) to the actual choice object, by matching the id against the list of choices, calling load() on your LDM in the process. This implies that you may be submitting the selected value from the list which is probably unnecessary if that particular submit is designed to just add a value to the choices' backing model (eg the List or table etc... you are deriving your list of choices from). One way to get around your issue would be to have your Add an item to my list button and, the associated component where you add that new list object, both on a separate form. Then, after that new form's submit, your LDM's load() should only be called during any rendering, which is probably what you want. Does that do it? Regards - Cemal jWeekend OO Java Technologies, Wicket Training and Development http://jWeekend.com Warren Bell-3 wrote: I have a ListChoice that I add a choice to. I do this in an AjaxButton#onSubmit(...). The problem is that load() has been called before onSubmit() and I have to call LoadableDetachableMode#detach() and have load() called again. This seems like a waste to have load() called twice in order to get the new choice added to the ListChoice. Is there a better way of doing this? Warren -- View this message in context: http://www.nabble.com/LoadableDetachableModel-load%28%29-called-twice-tp 25082195p25085222.html Sent from the Wicket - User 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 - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: Model question ?
Is there any issues you need to be concerned with when using the page itself as the model object? Warren -Original Message- From: jWeekend [mailto:jweekend_for...@cabouge.com] Sent: Friday, August 14, 2009 5:43 PM To: users@wicket.apache.org Subject: RE: Model question ? Warren, If you don't mind your wicket:ids becoming rather misleading and arguably slightly harder to follow (magical) Java, you can even do ... public class HomePage extends WebPage { private ListVendor vendors = Arrays.asList(new Vendor(v1), new Vendor(v2)); private Vendor vendor = new Vendor(default vendor); public HomePage(final PageParameters parameters) { setDefaultModel(new CompoundPropertyModelHomePage(this)); FormVoid form = new FormVoid(form); add(form); form.add(new ListChoiceVendor(vendor, vendors)); FormVendor editForm = new FormVendor(vendorEditForm); add(editForm); editForm.add(new TextFieldString(vendor.name)); } private class Vendor { private String name; Vendor(String name) {this.name = name;} @Override public String toString() {return name;} } } I haven't worked out how to properly paste html into nabble, so drop me a line at the jWeekend site if you want the template code to go with this, or a QuickStart. Any comments on the type-parameters used above anybody?! Regards - Cemal jWeekend OO Java Technologies, Wicket Training and Development http://jWeekend.com Warren Bell-3 wrote: In your second example the Vendor in the vendorModel becomes the selected Vendor from the ListChoice and that Vendor name property becomes the value of the TextField? -Original Message- From: jWeekend [mailto:jweekend_for...@cabouge.com] Sent: Friday, August 14, 2009 3:47 PM To: users@wicket.apache.org Subject: Re: Model question ? Warren, ... and if you prefer using a CPM for your vendorEditForms: public class HomePage extends WebPage { private ListVendor vendors = Arrays.asList(new Vendor(v1), new Vendor(v2)); private Vendor vendor = new Vendor(default vendor); public HomePage(final PageParameters parameters) { IModel vendorModel = new PropertyModelVendor(this, vendor); FormVoid form = new FormVoid(form); add(form); // use your existing LDM instead of this hard-wired // List of vendors but // make sure you merge your edits properly! form.add(new ListChoiceVendor(vendors, vendorModel, vendors)); // using a PropertyModel per field FormVoid editForm1 = new FormVoid(vendorEditForm1); add(editForm1); editForm1.add(new TextFieldVendor(name, new PropertyModelVendor(this, vendor.name))); // using a CompoundPropertyModel FormVendor editForm2 = new FormVendor(vendorEditForm2, new CompoundPropertyModelVendor(vendorModel)); add(editForm2); editForm2.add(new TextFieldVendor(name)); } private class Vendor implements Serializable{ private String name; protected Vendor(String name) {this.name = name;} public String toString(){return name;} // safer to have accessors mutators } // safer to have accessors mutators } Regards - Cemal jWeekend OO Java Technologies, Wicket Training and Development http://jWeekend.com Warren Bell-3 wrote: How should I set up my model for the following situation. I have a form with a ListChoice and a TextField. The TextField needs to access a property of the object selected of the ListChoice. I have it all working using a ValueMap, but that seems like overkill to use a ValueMap for one object. Here is how I have it: super(new CompoundPropertyModelValueMap(new ValueMap())); ListChoiceVendor vendorListChoice = new ListChoiceVendor(vendor, new LoadableDetachableModelListVendor(){...}, new IChoiceRendererVendor(){...}); TextFieldString accountNumberField = new TextFieldString(vendor.accountNumber); I thought I could do something like this: super(new CompoundPropertyModelVendor(new Vendor())); The ListChoice is the same as above and the TextField like this: TextFieldString accountNumberField = new TextFieldString(accountNumber); The problem with this is that the ListChoice is trying to set a property on the model named vendor when I realy want the selected ListChoice vendor object be the model object and have the TextField access the accountNumber property of the ListChoice vendor. How should I set up my model to deal with this type of situation or is a ValueMap the best way? Thanks, Warren - To unsubscribe, e-mail: users-unsubscr
Model question ?
How should I set up my model for the following situation. I have a form with a ListChoice and a TextField. The TextField needs to access a property of the object selected of the ListChoice. I have it all working using a ValueMap, but that seems like overkill to use a ValueMap for one object. Here is how I have it: super(new CompoundPropertyModelValueMap(new ValueMap())); ListChoiceVendor vendorListChoice = new ListChoiceVendor(vendor, new LoadableDetachableModelListVendor(){...}, new IChoiceRendererVendor(){...}); TextFieldString accountNumberField = new TextFieldString(vendor.accountNumber); I thought I could do something like this: super(new CompoundPropertyModelVendor(new Vendor())); The ListChoice is the same as above and the TextField like this: TextFieldString accountNumberField = new TextFieldString(accountNumber); The problem with this is that the ListChoice is trying to set a property on the model named vendor when I realy want the selected ListChoice vendor object be the model object and have the TextField access the accountNumber property of the ListChoice vendor. How should I set up my model to deal with this type of situation or is a ValueMap the best way? Thanks, Warren - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: Model question ?
In your second example the Vendor in the vendorModel becomes the selected Vendor from the ListChoice and that Vendor name property becomes the value of the TextField? -Original Message- From: jWeekend [mailto:jweekend_for...@cabouge.com] Sent: Friday, August 14, 2009 3:47 PM To: users@wicket.apache.org Subject: Re: Model question ? Warren, ... and if you prefer using a CPM for your vendorEditForms: public class HomePage extends WebPage { private ListVendor vendors = Arrays.asList(new Vendor(v1), new Vendor(v2)); private Vendor vendor = new Vendor(default vendor); public HomePage(final PageParameters parameters) { IModel vendorModel = new PropertyModelVendor(this, vendor); FormVoid form = new FormVoid(form); add(form); // use your existing LDM instead of this hard-wired // List of vendors but // make sure you merge your edits properly! form.add(new ListChoiceVendor(vendors, vendorModel, vendors)); // using a PropertyModel per field FormVoid editForm1 = new FormVoid(vendorEditForm1); add(editForm1); editForm1.add(new TextFieldVendor(name, new PropertyModelVendor(this, vendor.name))); // using a CompoundPropertyModel FormVendor editForm2 = new FormVendor(vendorEditForm2, new CompoundPropertyModelVendor(vendorModel)); add(editForm2); editForm2.add(new TextFieldVendor(name)); } private class Vendor implements Serializable{ private String name; protected Vendor(String name) {this.name = name;} public String toString(){return name;} // safer to have accessors mutators } // safer to have accessors mutators } Regards - Cemal jWeekend OO Java Technologies, Wicket Training and Development http://jWeekend.com Warren Bell-3 wrote: How should I set up my model for the following situation. I have a form with a ListChoice and a TextField. The TextField needs to access a property of the object selected of the ListChoice. I have it all working using a ValueMap, but that seems like overkill to use a ValueMap for one object. Here is how I have it: super(new CompoundPropertyModelValueMap(new ValueMap())); ListChoiceVendor vendorListChoice = new ListChoiceVendor(vendor, new LoadableDetachableModelListVendor(){...}, new IChoiceRendererVendor(){...}); TextFieldString accountNumberField = new TextFieldString(vendor.accountNumber); I thought I could do something like this: super(new CompoundPropertyModelVendor(new Vendor())); The ListChoice is the same as above and the TextField like this: TextFieldString accountNumberField = new TextFieldString(accountNumber); The problem with this is that the ListChoice is trying to set a property on the model named vendor when I realy want the selected ListChoice vendor object be the model object and have the TextField access the accountNumber property of the ListChoice vendor. How should I set up my model to deal with this type of situation or is a ValueMap the best way? Thanks, Warren - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- View this message in context: http://www.nabble.com/Model-question---tp24978225p24979787.html Sent from the Wicket - User 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
AbstractAjaxTimerBehavior on Modal Window causes PageExpiredException
I am getting a PageExpiredException when I close a modal window with an AbstractAjaxTimerBehavior on it. It does not seem to cause a problem, but I would rather it not happen. I use the AbstractAjaxTimerBehavior to auto close a modal window after a certain period of time if it is not closed manually. I think the two ajax requests are conflicting with each other, one to close the window and the other from the timer. Is there a way to prevent this PageExpiredException from happening or is there a better way to auto close a modal window? Thanks, Warren
Re: How to Hidden/Disabled Wicket tree with implementation wicket security
Your hive should have something like this with whatever actions you want: permission ${ComponentPermission} ${MyPage}:myPanel:myForm:myWebMarkupContainer, inherit, render, enable; And also secure anything in the container like buttons: permission ${ComponentPermission} ${MyPage}:myPanel:myForm:myWebMarkupContainer:myButton, inherit, render, enable; I seem to remember a similar problem that I had. It involved the way I used a WebMarkupContainer, a form and a panel. I messed around with how I nested the different components and I got it to work. Go figure? Warren Rizal Indra wrote: Thanks for quick reply Warren, exactly my code SecureWebMarkupContainer.java is same as with your code. But its still not working. I am newbie in java wicket, so i need more example/hint for understanding its. I am sure that missing something but i dont know how to solve it. Can anyone help me? thanks --- Pada Kam, 16/7/09, Warren Bell warrenbe...@gmail.com menulis: Dari: Warren Bell warrenbe...@gmail.com Judul: Re: How to Hidden/Disabled Wicket tree with implementation wicket security Kepada: users@wicket.apache.org, bujang_kuan...@yahoo.com Tanggal: Kamis, 16 Juli, 2009, 11:09 AM Try this: Warren public class SecureWebMarkupContainer extends WebMarkupContainer implements ISecureComponent { public SecureWebMarkupContainer(String id) { super(id); setSecurityCheck(new ComponentSecurityCheck(this)); } public SecureWebMarkupContainer(String id, IModel model) { super(id, model); setSecurityCheck(new ComponentSecurityCheck(this)); } public final void setSecurityCheck(ISecurityCheck check) { SecureComponentHelper.setSecurityCheck(this, check); } public final ISecurityCheck getSecurityCheck() { return SecureComponentHelper.getSecurityCheck(this); } public boolean isActionAuthorized(String action) { return SecureComponentHelper.isActionAuthorized(this, action); } public boolean isActionAuthorized(WaspAction action) { return SecureComponentHelper.isActionAuthorized(this, action); } public boolean isAuthenticated() { return SecureComponentHelper.isAuthenticated(this); } public boolean isAuthenticatedAndAuthorized(String action) { return isAuthenticated() isActionAuthorized(action); } { Rizal Indra wrote: Hi, I have created my welcome page with menu tree (http://wicketstuff.org/wicket13/nested/ ). I want to hide/disabled some item menu depend on user right principal. I have try put some tricks but not work :-) MyTree.java public class MyTree extends Tree { @Override protected void populateTreeItem(WebMarkupContainer item, int level) { System.out.println( getting populateTreeItem...); super.populateTreeItem(item, level); final TreeNode node = (TreeNode)item.getModelObject(); MarkupContainer nodeLink = newNodeLink(item, nodeLink, node); SecureWebMarkupContainer swmc = new SecureWebMarkupContainer(hiddenMenu); swmc.add(nodeLink); //item.add(nodeLink); item.add(swmc); } } SecureWebMarkupContainer.java public class SecureWebMarkupContainer extends WebMarkupContainer implements ISecureComponent { ... } can anyone give some example/advice how to make it work. thanks Pemanasan global? Apa sih itu? Temukan jawabannya di Yahoo! Answers! http://id.answers.yahoo.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 Berbagi foto Flickr dengan teman di dalam Messenger. Jelajahi Yahoo! Messenger yang serba baru sekarang! http://id.messenger.yahoo.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How to Hidden/Disabled Wicket tree with implementation wicket security
Try this: Warren public class SecureWebMarkupContainer extends WebMarkupContainer implements ISecureComponent { public SecureWebMarkupContainer(String id) { super(id); setSecurityCheck(new ComponentSecurityCheck(this)); } public SecureWebMarkupContainer(String id, IModel model) { super(id, model); setSecurityCheck(new ComponentSecurityCheck(this)); } public final void setSecurityCheck(ISecurityCheck check) { SecureComponentHelper.setSecurityCheck(this, check); } public final ISecurityCheck getSecurityCheck() { return SecureComponentHelper.getSecurityCheck(this); } public boolean isActionAuthorized(String action) { return SecureComponentHelper.isActionAuthorized(this, action); } public boolean isActionAuthorized(WaspAction action) { return SecureComponentHelper.isActionAuthorized(this, action); } public boolean isAuthenticated() { return SecureComponentHelper.isAuthenticated(this); } public boolean isAuthenticatedAndAuthorized(String action) { return isAuthenticated() isActionAuthorized(action); } { Rizal Indra wrote: Hi, I have created my welcome page with menu tree (http://wicketstuff.org/wicket13/nested/ ). I want to hide/disabled some item menu depend on user right principal. I have try put some tricks but not work :-) MyTree.java public class MyTree extends Tree { @Override protected void populateTreeItem(WebMarkupContainer item, int level) { System.out.println( getting populateTreeItem...); super.populateTreeItem(item, level); final TreeNode node = (TreeNode)item.getModelObject(); MarkupContainer nodeLink = newNodeLink(item, nodeLink, node); SecureWebMarkupContainer swmc = new SecureWebMarkupContainer(hiddenMenu); swmc.add(nodeLink); //item.add(nodeLink); item.add(swmc); } } SecureWebMarkupContainer.java public class SecureWebMarkupContainer extends WebMarkupContainer implements ISecureComponent { ... } can anyone give some example/advice how to make it work. thanks Pemanasan global? Apa sih itu? Temukan jawabannya di Yahoo! Answers! http://id.answers.yahoo.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: wicketstuff mini veil
I don't know about the mini veil, but shouldn't your label and button be set up something like this: In the class add a member that is your model string and then modify it in in the AjaxButton#onSubmit(...) String modelString = ... final Label label = new Label(testLabel, new ModelString() { @Override protected String getObject() { return modelString; } }); ... AjaxButton button = new AjaxButton(testVeil) { @Override protected void onSubmit(AjaxRequestTarget arg0, Form? arg1) { modelString = + new Random().nextLong(); arg0.addComponent(label); } } I have not used setDefaultModelObject(...) before. I read that you shouldn't set a model object this way. Maybe that is causing a problem? Warren Jing Ge (Besitec IT DEHAM) wrote: Hello, After doing this change, the project can be compiled and run. But I get another problem. Here is my test code: final Label label = new Label(testLabel, new ModelString()); add(label); Form form = new Form(testForm); AjaxButton button = new AjaxButton(testVeil) { @Override protected void onSubmit(AjaxRequestTarget arg0, Form? arg1) { try { Thread.sleep(5000); label.setDefaultModelObject( + new Random().nextLong()); arg0.addComponent(label); } catch (InterruptedException ex) { Logger.getLogger(HomePage.class.getName()).log(Level.SEVERE, null, ex); } } }; button.add(new Veil()); form.add(button); add(form); After the application is deployed and running, the ajax button is disabled. Did I do something wrong? Best regards! Jing Ge -Original Message- From: Jing Ge (Besitec IT DEHAM) [mailto:j...@besitec.com] Sent: Mittwoch, 17. Juni 2009 10:18 To: users@wicket.apache.org Subject: RE: wicketstuff mini veil Hello, Should it be: super.bind(component); if (this.component != null) { . } regards! Jing Ge -Original Message- From: Jing Ge (Besitec IT DEHAM) [mailto:j...@besitec.com] Sent: Mittwoch, 17. Juni 2009 10:15 To: users@wicket.apache.org Subject: wicketstuff mini veil Hallo, I have checked out the source code and taken a look at the class Veil. I found the following code: public void bind(Component component) { super.bind(component); if (component != null) { throw new IllegalStateException( This behavior is already bound to component. An instance of this behavior cannot be reused between components. Bound component: + this.component.toString()); } this.component = component; } From the code we can see, the component will be checked after binding. If it is null, an exception will be thrown. Well, actually, I don't get it. Since the component can not be null after binding, the exception will be always thrown. Show me if I am wrong. Has anyone ever used the mini veil? Could anyone give me hand? Thanks. Best regards! Jing Ge - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Thanks, Warren Bell 909-645-8864 warrenbe...@gmail.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: getting started with swarm/wasp - rendering links to secure pages
Try securing the link on your HomePage and do not secure the HomePage itself. The link has to implement ISecureComponent. Add the permission for the link to your basic principal. org.apache.wicket.security.hive.authorization.SimplePrincipal basic { //Permission for link on HomePage permission org.apache.wicket.security.hive.authorization.permissions.ComponentPermission com.webperformance.portal.web.HomePage:securelinktopage2, inherit, render, enable; permission org.apache.wicket.security.hive.authorization.permissions.ComponentPermission com.webperformance.portal.web.Page2, inherit, render; permission org.apache.wicket.security.hive.authorization.permissions.ComponentPermission com.webperformance.portal.web.Page2, enable; }; Warren Luca Provenzani wrote: i don't think it is possible to do... because HomePage isn't a secure page and then it's not under swarm control when it's rendered. i'm afraid that you have to do by your hand... but i'm not an expert! ;-) Luca 2009/6/9 Christopher L Merrill ch...@webperformance.com I have a question about rendering of links to secure pages when the user has not been authenticated. Based on this line from the tutorial: In addition we granted links to our homepage the right to be clicked (enable). I expected the link to either be non-visible or non-clickable - since I did not grant the enable permission for this page until login. The link is enabled (though the user is redirected to the login page when clicked). I've made my way through the getting-started guide ( http://wicketstuff.org/confluence/display/STUFFWIKI/Getting+started+with+Swarm ) and have a simple example working in my prototype. I have 3 pages: - HomePage (non-secure) - LoginPage (non-secure...obviously) - Page2 (secure) My authorization file looks like this: grant principal org.apache.wicket.security.hive.authorization.SimplePrincipal basic { permission org.apache.wicket.security.hive.authorization.permissions.ComponentPermission com.webperformance.portal.web.Page2, inherit, render; permission org.apache.wicket.security.hive.authorization.permissions.ComponentPermission com.webperformance.portal.web.Page2, enable; }; When the user logs in, they get the basic principal via a UsernamePasswordContext. I have a link from the HomePage to Page2 (secure page). When the HomePage renders and the user had not logged in, the link is enabled. Clicking the link does not take the user to the page - it takes them to the login page. I was expecting the link to be disabled - so you don't even get the clickable cursor for it. Am I simply mistaken in my understanding of what right to be clicked means? Or have I missed some crucial bit somewhere to allow it to function as I expected? If user is not authorized for an action, we will either want links to be disabled (i.e. non- clickable) or be not rendered at all...depending on the context. Is this something that should be done via wasp/swarm or should I be doing this manually during page construction? TIA! Chris -- - Chris Merrill | Web Performance, Inc. ch...@webperformance.com| http://webperformance.com 919-433-1762| 919-845-7601 Website Load Testing and Stress Testing Software Services - - 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: ModalWindows...
I am not sure this is what you are looking for. Check setWindowClosedCallback yourModalWindow.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { public void onClose(AjaxRequestTarget target) { // do what you need to do } }); Warren Vidhya Kailash wrote: 3. Can somebody please tell how to communicate between the page and the modal window? thanks - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Redirect to a static pdf in popup/new tab
I have a situation where a user needs to click on many links on one page and display many static pdfs each in a new tab or popup. The problem is that I need to do some processing on the original page in the Link#onClick before I open up the pdf in a new tab or popup. I do not want the pdfs added to any existing or new pageMaps either. Something like this: new AjaxLink(...) { public void onClick(AjaxRequestTarget target) { // do some processing // add component to target // open up new window or tab with static pdf } I have tried different combinations of ExternalLink with setPopupSettings(popupSettings). A modal window that uses an AbstractAjaxTimerBehavior while processing is being done and then allows user to click on an ExternalLink that displays pdf in popup. And other combinations. Each has little quirks or added steps required by the user. Is there a better way of getting this to work? Thanks, Warren - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Redirect to a static pdf in popup/new tab
As far as I can tell, there are no Ajax related links that can use PopupSettings. I need to refresh a component as part of the processing. Steve Swinsburg wrote: Could you use PopupSettings to specify it should be a new window and just process whatever you need in the onClick() of the link? cheers, Steve On 28 Apr 2009, at 17:11, Warren Bell wrote: I have a situation where a user needs to click on many links on one page and display many static pdfs each in a new tab or popup. The problem is that I need to do some processing on the original page in the Link#onClick before I open up the pdf in a new tab or popup. I do not want the pdfs added to any existing or new pageMaps either. Something like this: new AjaxLink(...) { public void onClick(AjaxRequestTarget target) { // do some processing // add component to target // open up new window or tab with static pdf } I have tried different combinations of ExternalLink with setPopupSettings(popupSettings). A modal window that uses an AbstractAjaxTimerBehavior while processing is being done and then allows user to click on an ExternalLink that displays pdf in popup. And other combinations. Each has little quirks or added steps required by the user. Is there a better way of getting this to work? Thanks, Warren - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Thanks, Warren Bell 909-645-8864 warrenbe...@gmail.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Button markup id is missing on Modal Window
I have a Modal Window that acts like a progress indicator. It has an AbstractAjaxTimerBehavior that checks to see if a condition is met. When it is met an image on the Modal Window is removed and a form with an AjaxButton is added. The image starts with isVisible() = true and the form and button start with it set false. The image comes off fine, but the form and button never get added. The Ajax debugger error is: ERROR: Component with id [[processingForm]] a was not found while trying to perform markup update. Make sure you called component.setOutputMarkupId(true) on the component whose markup you are trying to update. ERROR: Component with id [[okButton]] a was not found while trying to perform markup update. Make sure you called component.setOutputMarkupId(true) on the component whose markup you are trying to update. I am calling Component#setOutputMarkupId(true), Component#setMarkupId(String id) and Component#setOutputMarkupPlaceholderTag(true). If I start with everything visible and then remove all of them, it works fine. It looks like Component#setOutputMarkupPlaceholderTag(true) is not working. What do I need to do to make this work? Thanks, Warren - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Closeing 1st Modal Window from 2nd Modal Window
I have a situation that is like the Wicket example that opens two modal windows one from another. Everything is working correctly, but I need to close the 1st window when the 2nd window is closed. How would you do this? Thanks, Warren - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Correct use of RangeValidator
I thought that I was telling the TextField, by the type Integer, that it's model object is an integer. And I thought that it would retrieve its value from the model I set on it's form. super(name, new CompoundPropertyModelValueMap(valueMap) valueMap is an existing ValueMap with a value with key intField and that ValueMap#getAsInteger(intField) would be called. I guess ValueMap#getString(intField) is being called. Is it the ValueMap that is messing me up? What am I missing? Igor Vaynberg wrote: to construct a textfield that works with integer you either have to pass Integer.class as a constructor arg, or call setType(Integer.class); -igor On Tue, Mar 17, 2009 at 8:21 AM, Wilhelmsen Tor Iver toriv...@arrive.no wrote: WicketMessage: Exception 'java.lang.ClassCastException: java.lang.Integer' occurred during validation org.apache.wicket.validation.validator.RangeValidator on component 2:body:recvAnalisysForm:intField Root cause:java.lang.ClassCastException: java.lang.Integer at java.lang.String.compareTo(String.java:90) According to the error message, the validator gets a String value here; have you checked the actual IModel used by the field? The default Model for *TextField uses String IIRC... IModelInteger model = new PropertyModelInteger(theBean, intField); RequiredTextFieldInteger intField = new RequiredTextFieldInteger(intField, model); intField.add(new RangeValidatorInteger(0, 100)); - 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 -- Thanks, Warren Bell 909-645-8864 warrenbe...@gmail.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Correct use of RangeValidator
I am getting a ClassCastException when using RangeValidator like this: RequiredTextFieldInteger intField = new RequiredTextFieldInteger(intField); intField.add(new RangeValidator(0, 100)); or like this: RequiredTextFieldInteger intField = new RequiredTextFieldInteger(intField); intField.add(new RangeValidatorInteger(0, 100)); WicketMessage: Exception 'java.lang.ClassCastException: java.lang.Integer' occurred during validation org.apache.wicket.validation.validator.RangeValidator on component 2:body:recvAnalisysForm:intField Root cause:java.lang.ClassCastException: java.lang.Integer at java.lang.String.compareTo(String.java:90) The example app shows it coded this way, but NumberValidator has been deprecated. add(new RequiredTextFieldInteger(integerInRangeProperty).add(NumberValidator.range(0, 100))); What is the correct way of using RangeValidator and how do you type it? Warren - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket-Security security check on component on a panel
Doing the security check in onBeforeRender() in the Panel fixed it. I did not have a Page yet. Warren I am trying to do a security check on a component that is on a panel like this: if(SecureComponentHelper.isAuthenticated(myComponent) SecureComponentHelper.isActionAuthorized(myComponent, enable)) { // Do Something } I have also tried this: if(myComponent.isAuthenticated() !myComponent.isActionAuthorized(enable)) { // Do Something } Basically the same thing. myComponent implements ISecureComponent. setSecurityCheck(new ComponentSecurityCheck(this)) is called in the constructors of myComponent. This works fine if myComponent is on a page, but does not work if myComponent is on a panel. I get the following exception: Caused by: org.apache.wicket.security.strategies.SecurityException: Unable to create alias for component: [MarkupContainer [Component id = myComponent]] at org.apache.wicket.security.components.SecureComponentHelper.alias(SecureComponentHelper.java:263) at org.apache.wicket.security.hive.authorization.permissions.ComponentPermission.init(ComponentPermission.java:54) at org.apache.wicket.security.swarm.strategies.SwarmStrategy.isComponentAuthorized(SwarmStrategy.java:228) at org.apache.wicket.security.checks.ComponentSecurityCheck.isActionAuthorized(ComponentSecurityCheck.java:127) at org.apache.wicket.security.components.SecureComponentHelper.isActionAuthorized(SecureComponentHelper.java:177) at com.scanman.panels.menus.MainMenuHandHeldPanel.init(MainMenuHandHeldPanel.java:123) at com.scanman.pages.menus.MainMenu$2.init(MainMenu.java:157) at com.scanman.pages.menus.MainMenu.init(MainMenu.java:157) ... 28 more Caused by: java.lang.IllegalStateException: No Page found for component [MarkupContainer [Component id = resetButtonContainer]] at org.apache.wicket.Component.getPage(Component.java:1729) at org.apache.wicket.security.components.SecureComponentHelper.alias(SecureComponentHelper.java:259) ... 35 more How do you do a security check on a component that is on a panel? Thanks, Warren
Wicket-Security security check on component on a panel
I am trying to do a security check on a component that is on a panel like this: if(SecureComponentHelper.isAuthenticated(myComponent) SecureComponentHelper.isActionAuthorized(myComponent, enable)) { // Do Something } I have also tried this: if(myComponent.isAuthenticated() !myComponent.isActionAuthorized(enable)) { // Do Something } Basically the same thing. myComponent implements ISecureComponent. setSecurityCheck(new ComponentSecurityCheck(this)) is called in the constructors of myComponent. This works fine if myComponent is on a page, but does not work if myComponent is on a panel. I get the following exception: Caused by: org.apache.wicket.security.strategies.SecurityException: Unable to create alias for component: [MarkupContainer [Component id = myComponent]] at org.apache.wicket.security.components.SecureComponentHelper.alias(SecureComponentHelper.java:263) at org.apache.wicket.security.hive.authorization.permissions.ComponentPermission.init(ComponentPermission.java:54) at org.apache.wicket.security.swarm.strategies.SwarmStrategy.isComponentAuthorized(SwarmStrategy.java:228) at org.apache.wicket.security.checks.ComponentSecurityCheck.isActionAuthorized(ComponentSecurityCheck.java:127) at org.apache.wicket.security.components.SecureComponentHelper.isActionAuthorized(SecureComponentHelper.java:177) at com.scanman.panels.menus.MainMenuHandHeldPanel.init(MainMenuHandHeldPanel.java:123) at com.scanman.pages.menus.MainMenu$2.init(MainMenu.java:157) at com.scanman.pages.menus.MainMenu.init(MainMenu.java:157) ... 28 more Caused by: java.lang.IllegalStateException: No Page found for component [MarkupContainer [Component id = resetButtonContainer]] at org.apache.wicket.Component.getPage(Component.java:1729) at org.apache.wicket.security.components.SecureComponentHelper.alias(SecureComponentHelper.java:259) ... 35 more How do you do a security check on a component that is on a panel? Thanks, Warren - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Passing a PageParameters to a RedirectRequestTarget
Is there a way of passing a PageParameters to a RedirectRequestTarget without pulling apart PageParameters and adding them to the url? Thanks, Warren - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How can I injecting a Springbean into a custom session.
Do you still have to use addComponentInstantiationListener(new SpringComponentInjector(this)) in your WebApplication#init() in order to use @SpringBean in sub classes of Component or is that done automatically now? Warren Igor Vaynberg wrote: all subclasses of Component are injected automatically, you only need to do this in classes outside the Component hierarchy. -igor On Fri, Mar 6, 2009 at 9:32 AM, CrocodileShoes markjohndo...@googlemail.com wrote: By the way is this safe to use in any Wicket component, for example, a Panel? I can't think of any reason why not, but this is my first foray into web development. -- View this message in context: http://www.nabble.com/How-can-I-inject-a-Springbean-into-a-custom-session.-tp22340379p22377028.html Sent from the Wicket - User 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
Maurice Marrink will be greatly missed.
I just recently found out, via this list, that Maurice Marrink had passed away. I wanted to let everyone know how much I appreciated Maurice. He helped me better understand Wicket and helped me customize wicket-security to meet my needs. He was very generous with his time and he will be greatly missed. Thanks, Warren Bell - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: What's your take on handling markup in properties, html, wicket
Create a panel with just the markup you need and switch them out with the isvisible based on the current language needed? Similar to the post for Re: Adding/Replacing links in Panels by Michael Sparer below. I use WebMarkupContainer, but I only have two states. 14 may get a little messy Warren Mathias P.W Nilsson wrote: Hi, Just wondering how this should be handled without DRY. In many scenarios we have multiple languages that should have the same markup but different text. This could be handled by using variation and put every language in an own html file like myWicketPage_style_en.html. However, this is not the optimal way and I don't think variation is made for this either. It would be very annoing having 14 different html files if we have 14 different languages that we should support. Sometimes the languages should look different ( not the same look. Different positioning of elements ) and here we could use variation. As far as I'm concerned this is not the right way of handling look and feel. Different css should be used instead and then place position, coloring of the markup in a css. The html file should be the same and the css should handle the layout. Take a look at http://www.csszengarden.com/ http://www.csszengarden.com/ Every time I'm dealing with multiple languages the user wants bold, italic, color in the text. Many times a list will appear just containing text. ( Nothing to do with extracting data from database and let wicket handle it ) This could be added in a properties file but then we would have bold tags, italic and style tags in the properties file. If something should change we need to go thru 14 properties files to change the markup in the properties. Let's say we have the following text in many different languages. Some markup is changed so you know what I mean. boldWelcome to our company/boldbrbrHere is some long text.ullisome [BOLD]text[/BOLD]/liliother text/li/ul Now imaging this text to be very long. Now, my question is this. How do you handle tagged markup for different languages without repeating markup tags. * Variation and the text in the html file. * different properties file with markup in it * Other technique? - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How to get a reference to the holding page from a panel
I have a simmilar situation where I want to put a panel nested in a panel nested in a page. The panel that is nested in the page stays the same for many different pages, but the panel nested into the panel changes. Would you do an anonymous panel class within an anonymous panel class within the page so that you can do the same type of referencing MyPage.this? Or is there a better way of doing this? Actually I also find that using getPage() on beforeRender() to get the page is ok as long as do deal with any problems in case you cannot get the page. Pieter On Fri, Feb 13, 2009 at 6:34 PM, Igor Vaynberg igor.vaynb...@gmail.comwrote: make the panel an anonymous or inner class of the page and use MyPage.this. -igor On Fri, Feb 13, 2009 at 6:14 AM, pieter claassen pie...@claassen.co.uk wrote: Is there a simple answer for how to get a reference from a panel to the holding page that is available at compile time (something other than getPage() on beforeRender())? Thanks, Pieter - 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: inmethod grid and add/delete examples
The books Wicket in Action and Enjoying Web Development with Wicket helped me a lot when I first started using Wicket. Warren On Wed, Feb 11, 2009 at 9:58 AM, Will Jaynes wjay...@gmail.com wrote: I have just started to look at the inmethod datagrid in wicketstuff. The one thing that the examples don't show are how to add and delete items. Are there such examples somewhere? Will I'm really missing a lot with regard to the datagrid examples. Perhaps it's because I'm still relatively new to Wicket and very new to the Ajax stuff in Wicket. As I've said, I don't see how to add or delete rows to the datagrid. But also I don't see in the examples how to actually update the database with any edited values. Nor do I see, once a row is selected, how to get that selected row and do something with it. So, I'm pretty clueless, which makes it hard to help me, but I'd appreciate any info or pointers. Will -- Thanks, Warren Bell 909-645-8864 warrenbe...@gmail.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Redirecting to external URL
I need to redirect to an external page. I saw this solution, but was not sure how to use it. Where does this exception get thrown? I do not want to instantiate some kind of dummy page. public class RedirectToExternalException extends AbstractRestartResponseException { private static final long serialVersionUID = 1L; public RedirectToExternalException(String url) { RequestCycle rc = RequestCycle.get(); if (rc == null) { throw new IllegalStateException( This exception can only be thrown from within request processing cycle); } else { Response r = rc.getResponse(); if (!(r instanceof WebResponse)) { throw new IllegalStateException( This exception can only be thrown when wicket is processing an http request); } // abort any further response processing rc.setRequestTarget(new RedirectRequestTarget(url)); } } } Thanks, Warren - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Redirecting to external URL
I need to explain myself a little better. This is the situation, I have several locations that are on different subnets. They are all connected with a VPN. Each subnet has its own server running this wicket app. The app clients are running on mobile scanning PDAs. These PDAs get moved between each subnet. The PDAs need to know what server to access the app at. One of the subnets has a Headquarters server. How I see this working is that each PDA would access the HQ server and then be redirected to its subnet server. For instance the PDA client would have its browsers home page set to the HQs url: http://HQserverIP/redirectPDA The HQ server would then redirect to the PDAs local server based on the ip address the response came from: http://LocalserverIP/login I did not want to create a page on the HQ server just so that it could be redirected thinking there could be some issues doing that. I was going to do this redirecting in a separate servlet, but I wanted to keep it all in one app. I saw the RedirectToExternalException solution thinking that this could be used. Jonathan Locke wrote: try: RequestCycle.get().setRequestTarget(new RedirectRequestTarget(url)); Warren Bell wrote: I need to redirect to an external page. I saw this solution, but was not sure how to use it. Where does this exception get thrown? I do not want to instantiate some kind of dummy page. public class RedirectToExternalException extends AbstractRestartResponseException { private static final long serialVersionUID = 1L; public RedirectToExternalException(String url) { RequestCycle rc = RequestCycle.get(); if (rc == null) { throw new IllegalStateException( This exception can only be thrown from within request processing cycle); } else { Response r = rc.getResponse(); if (!(r instanceof WebResponse)) { throw new IllegalStateException( This exception can only be thrown when wicket is processing an http request); } // abort any further response processing rc.setRequestTarget(new RedirectRequestTarget(url)); } } } Thanks, Warren - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Thanks, Warren Bell 909-645-8864 war...@clarksnutrition.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Redirecting to external URL
I don't always have access to those resources. I will try the setRequestTarget code. I would still have to set-up a dummy page to do this, since I am coming in from an external source, correct? Where else could I place this code? public class DummyPage extends ... { public DummyPage() { super ... RequestCycle.get().setRequestTarget(new RedirectRequestTarget(url)); } } http://HQserverIP/appname/DummyPage Jonathan Locke wrote: isn't this outside the scope of wicket? it sounds like it might be solvable with some kind of load balancer, router or DNS resolver... Warren Bell wrote: I need to explain myself a little better. This is the situation, I have several locations that are on different subnets. They are all connected with a VPN. Each subnet has its own server running this wicket app. The app clients are running on mobile scanning PDAs. These PDAs get moved between each subnet. The PDAs need to know what server to access the app at. One of the subnets has a Headquarters server. How I see this working is that each PDA would access the HQ server and then be redirected to its subnet server. For instance the PDA client would have its browsers home page set to the HQs url: http://HQserverIP/redirectPDA The HQ server would then redirect to the PDAs local server based on the ip address the response came from: http://LocalserverIP/login I did not want to create a page on the HQ server just so that it could be redirected thinking there could be some issues doing that. I was going to do this redirecting in a separate servlet, but I wanted to keep it all in one app. I saw the RedirectToExternalException solution thinking that this could be used. Jonathan Locke wrote: try: RequestCycle.get().setRequestTarget(new RedirectRequestTarget(url)); Warren Bell wrote: I need to redirect to an external page. I saw this solution, but was not sure how to use it. Where does this exception get thrown? I do not want to instantiate some kind of dummy page. public class RedirectToExternalException extends AbstractRestartResponseException { private static final long serialVersionUID = 1L; public RedirectToExternalException(String url) { RequestCycle rc = RequestCycle.get(); if (rc == null) { throw new IllegalStateException( This exception can only be thrown from within request processing cycle); } else { Response r = rc.getResponse(); if (!(r instanceof WebResponse)) { throw new IllegalStateException( This exception can only be thrown when wicket is processing an http request); } // abort any further response processing rc.setRequestTarget(new RedirectRequestTarget(url)); } } } Thanks, Warren - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Thanks, Warren Bell 909-645-8864 war...@clarksnutrition.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org -- Thanks, Warren Bell 909-645-8864 war...@clarksnutrition.com - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Where has InMethod.com gone?
I am looking for an advance datagrid component. I see that inMethod is mentioned as having one. When I go to their sight, it talks about WiFi Video for iPhone. Where do I go to find info on their datagrid? And if they are gone, Does anyone else have some sort of advance datagrid? -- Thanks, Warren - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How do you get a LoadableDetachableModel to load again
I have a page that displays a list of items backed by a LoadableDetachableModel. The page allows you to delete one item from the list and then shows the list less the item you just deleted. How do I get the LoadableDetachableModel to load the list of items again after the one item has been deleted? I want the page to go back to itself after the item is deleted. I do not want to create a new page. -- Thanks, Warren - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: FeedbackPanel not displaying message
Here is how I submit a form from a text field when the user presses the enter key. I haven't tried this on an AjaxSubmitLink. textField.add(new AjaxFormSubmitBehavior(onkeypress) { protected void onSubmit(AjaxRequestTarget target) { // do something } protected void onError(AjaxRequestTarget target) { } protected IAjaxCallDecorator getAjaxCallDecorator() { return new AjaxCallDecorator() { public CharSequence decorateScript(CharSequence script) { return if(window.event.keyCode == 13){ + script + };; } }; } }); and then add onsubmit=return false; in your form markup form onsubmit=return false; ... -Original Message- From: Ryan O'Hara [mailto:[EMAIL PROTECTED] Sent: Thursday, May 01, 2008 1:12 PM To: users@wicket.apache.org Subject: FeedbackPanel not displaying message I'm having trouble getting messages to display in the FeedbackPanel. Also, any idea how to get the form to submit after the user presses enter/return in a textfield (when using AjaxSubmitLink)? Any ideas? Below is my code. //feedbackPanel FeedbackPanel feedbackPanel = new FeedbackPanel (feedbackPanel); feedbackPanel.add(new AttributeModifier(class, true, new Model(feedbackPanel))); feedbackPanel.setFilter(new ContainerFeedbackMessageFilter (form)); form.add(feedbackPanel); form.add(new TextField(name)); //submit button AjaxSubmitLink submit = new AjaxSubmitLink(submit) { public void onSubmit(AjaxRequestTarget target, Form form) { try { groupsDisplay.add(new AttributeModifier(class, true, new Model(groupsDisplay))); target.addComponent(groupsDisplay); info(Groups for + name + .); } catch (Exception e) { error(Unable to get groups for + name + .); } } }; form.add(submit); Thanks, Ryan - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Difficulty getting QuickStart
I was having some problems until I went to this site: http://herebebeasties.com/2007-10-07/wicket-quickstart/ There is a screencast there that will show you everything. It was real helpful. -Original Message- From: Frank Silbermann [mailto:[EMAIL PROTECTED] Sent: Thursday, May 01, 2008 1:52 PM To: users@wicket.apache.org Subject: Difficulty getting QuickStart I wrote in earlier about a problem I had in less-old releases of Wicket 1.2. Since no more work is being done on that version, I thought I'd try the sample on Wicket 1.2. I figured the easiest approach was to download the Wicket 1.3 QuickStart application. That requires Maven, which I've never before used. I downloaded and installed Maven (I assume correctly) and then followed the instructions to get the QuckStart application, but the Maven command failed with the following output. Can anyone tell me what I did wrong? (I apologize if this is really a Maven question, but obtaining QuickStart is my only reason for messing with Maven.) C:\mvn archetype:create -DarchetypeGroupId=org.apache.wicket -DarchetypeArtifactId=wicket-archetype-quickstart -DarchetypeVersion=1.3.3 -DgroupId=com.mycompany -DartifactId=myproject [INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'archetype'. [INFO] org.apache.maven.plugins: checking for updates from central [WARNING] repository metadata for: 'org.apache.maven.plugins' could not be retrieved from repository: central due to an error: Error transferring file [INFO] Repository 'central' will be blacklisted [INFO] [ERROR] BUILD ERROR [INFO] [INFO] The plugin 'org.apache.maven.plugins:maven-archetype-plugin' does not exist or no valid version could be found [INFO] [INFO] For more information, run Maven with the -e switch [INFO] [INFO] Total time: 21 seconds [INFO] Finished at: Thu May 01 15:42:12 CDT 2008 [INFO] Final Memory: 1M/2M [INFO] /Frank - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Return to Original Destination gets the ajax response and not the page
The problem was with 1.3.1. I moved to 1.3.3 and its fixed. -Original Message- From: Michael Sparer [mailto:[EMAIL PROTECTED] Sent: Thursday, April 24, 2008 1:53 AM To: users@wicket.apache.org Subject: Re: Return to Original Destination gets the ajax response and not the page What wicket version are you using? I know this bug has been fixed for version 1.3.2 and above regards, Michael Warren Bell wrote: I am getting an ajax response xml instead of the page when I return to original destination page that is ajax enabled after a RestartResponseAtInterceptPageException is thrown. Here is the URL: http://127.0.0.1:8080/blahblah/?wicket:interface=:8:body:receiveIt emDetailFo rm:lineItem.item.upc::IActivePageBehaviorListener:0:-1wicket:ignoreIfNotAct ive=truerandom=0.8907246112298193 What am I doing wrong? Thanks, Warren Bell - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Michael Sparer http://talk-on-tech.blogspot.com -- View this message in context: http://www.nabble.com/Return-to-Original-Destination-gets-the-ajax-response- and-not-the-page-tp16845566p16847805.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: isVisible() with surrounding Markup and LoadableDetachableModel
1.3.1. I have created a quickstart of the problem and have sent it to Igor. -Original Message- From: Johan Compagner [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 22, 2008 2:23 PM To: users@wicket.apache.org Subject: Re: isVisible() with surrounding Markup and LoadableDetachableModel which version do you use of wicket? because WebPage.onDetach() should already be gone because this part: java.lang.Exception at load.Load$LoadForm$1.isVisible(Load.java:46) at org.apache.wicket.Component.renderHead(Component.java:2528) at org.apache.wicket.markup.html.WebPage$1.component(WebPage.java:432) at org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java:821) at org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java:836) at org.apache.wicket.MarkupContainer.visitChildren(MarkupContainer.java:861) at org.apache.wicket.markup.html.WebPage.onDetach(WebPage.java:425) was just for checking for headers that really wasnt correct. But this was already fixed in 1.3.3 if i am not mistaken johan On Tue, Apr 22, 2008 at 6:07 AM, Warren [EMAIL PROTECTED] wrote: Stack trace in load() and onDetach() java.lang.Exception at load.Load$1.load(Load.java:26) at org.apache.wicket.model.LoadableDetachableModel.getObject(Loadable Detachable Model.java:114) at org.apache.wicket.model.CompoundPropertyModel.getObject(CompoundPr opertyMode l.java:60) at org.apache.wicket.model.AbstractPropertyModel.getTarget(AbstractPr opertyMode l.java:187) at org.apache.wicket.model.AbstractPropertyModel.getObject(AbstractPr opertyMode l.java:110) at org.apache.wicket.Component.getModelObject(Component.java:1539) at org.apache.wicket.Component.getModelObjectAsString(Component.java:1561) at load.Load$LoadForm$1.isVisible(Load.java:54) at org.apache.wicket.Component.internalBeforeRender(Component.java:990) at org.apache.wicket.Component.beforeRender(Component.java:1027) at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupCon tainer.jav a:1513) at org.apache.wicket.Component.onBeforeRender(Component.java:3657) at org.apache.wicket.Component.internalBeforeRender(Component.java:995) at org.apache.wicket.Component.beforeRender(Component.java:1027) at org.apache.wicket.Component.prepareForRender(Component.java:2139) at org.apache.wicket.ajax.AjaxRequestTarget.respondComponent(AjaxRequ estTarget. java:698) at org.apache.wicket.ajax.AjaxRequestTarget.respondComponents(AjaxReq uestTarget .java:605) at org.apache.wicket.ajax.AjaxRequestTarget.respond(AjaxRequestTarget .java:520) at org.apache.wicket.request.AbstractRequestCycleProcessor.respond(Ab stractRequ estCycleProcessor.java:103) at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycl e.java:117 2) at org.apache.wicket.RequestCycle.step(RequestCycle.java:1241) at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1316) at org.apache.wicket.RequestCycle.request(RequestCycle.java:493) at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:354) at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter .java:194) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(A pplication FilterChain.java:186) at org.apache.catalina.core.ApplicationFilterChain.doFilter(Applicati onFilterCh ain.java:157) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapp erValve.ja va:214) at org.apache.catalina.core.StandardContextValve.invoke(StandardConte xtValve.ja va:178) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValv e.java:126 ) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValv e.java:105 ) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngine Valve.java :107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter. java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.pr ocessConne ction(Http11Protocol.java:731) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEn dpoint.jav a:524) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(Leader FollowerWo rkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(Thre adPool.jav a:684) at java.lang.Thread.run(Thread.java:595) # load() called=3 java.lang.Exception at load.Load$1.onDetach(Load.java
Return to Original Destination gets the ajax response and not the page
I am getting an ajax response xml instead of the page when I return to original destination page that is ajax enabled after a RestartResponseAtInterceptPageException is thrown. Here is the URL: http://127.0.0.1:8080/blahblah/?wicket:interface=:8:body:receiveItemDetailFo rm:lineItem.item.upc::IActivePageBehaviorListener:0:-1wicket:ignoreIfNotAct ive=truerandom=0.8907246112298193 What am I doing wrong? Thanks, Warren Bell - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
isVisible() with surrounding Markup and LoadableDetachableModel
I have a form that has a lot of labels with surrounding markup that needs to be visible based on whether their is a value or empty string. The form uses a CompoundPropertyModel based on a LoadableDetachableModel. How do I check the model value of a Label in isVisible() without having load() of LoadableDetachableModel being called twice. wicket:enclosure child=lineItem.item.department.departmentName brDept: span wicket:id=lineItem.item.department.departmentNameSupplements/span /wicket:enclosure Label departmentName = new Label(lineItem.item.department.departmentName) { public boolean isVisible() { // How do I check value without load() being called again } }; Thanks, Warren Bell - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: isVisible() with surrounding Markup and LoadableDetachableModel
I did this in isVisible() and load was called twice. public boolean isVisible() { return !super.getModelObjectAsString().equals(); } -Original Message- From: Igor Vaynberg [mailto:[EMAIL PROTECTED] Sent: Monday, April 21, 2008 7:08 PM To: users@wicket.apache.org Subject: Re: isVisible() with surrounding Markup and LoadableDetachableModel loadable detachable model caches the value for the request, so even though getobject() is called multiple times, load() is only called once. -igor On Mon, Apr 21, 2008 at 6:59 PM, Warren [EMAIL PROTECTED] wrote: I have a form that has a lot of labels with surrounding markup that needs to be visible based on whether their is a value or empty string. The form uses a CompoundPropertyModel based on a LoadableDetachableModel. How do I check the model value of a Label in isVisible() without having load() of LoadableDetachableModel being called twice. wicket:enclosure child=lineItem.item.department.departmentName brDept: span wicket:id=lineItem.item.department.departmentNameSupplements/span /wicket:enclosure Label departmentName = new Label(lineItem.item.department.departmentName) { public boolean isVisible() { // How do I check value without load() being called again } }; Thanks, Warren Bell - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: isVisible() with surrounding Markup and LoadableDetachableModel
); Label firstName = new Label(firstName) { @Override public boolean isVisible() { new Exception().printStackTrace(); return !super.getModelObjectAsString().equals(); } }; firstName.setOutputMarkupId(true); firstName.setOutputMarkupPlaceholderTag(true); add(firstName); Label lastName = new Label(lastName); lastName.setOutputMarkupId(true); add(lastName); TextField testTextField = new TextField(textTest, new Model()); testTextField.setOutputMarkupId(true); testTextField.add(new AjaxFormSubmitBehavior(onkeypress) { protected void onSubmit(AjaxRequestTarget target) { target.addComponent(LoadForm.this); } protected void onError(AjaxRequestTarget target) { } protected IAjaxCallDecorator getAjaxCallDecorator() { return new AjaxCallDecorator() { public CharSequence decorateScript(CharSequence script) { return if(window.event.keyCode == 13){ + script + };return false;; } }; } }); add(testTextField); } } public final class Dummy { private String firstName = First Name; private String lastName = Last Name; public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } } } -Original Message- From: Igor Vaynberg [mailto:[EMAIL PROTECTED] Sent: Monday, April 21, 2008 8:09 PM To: users@wicket.apache.org Subject: Re: isVisible() with surrounding Markup and LoadableDetachableModel are you sure it is the same request and there is no redirect in between? do new Exception().printStackTrace() inside your isvisible to see where it is being called from -igor On Mon, Apr 21, 2008 at 7:15 PM, Warren [EMAIL PROTECTED] wrote: I did this in isVisible() and load was called twice. public boolean isVisible() { return !super.getModelObjectAsString().equals(); } -Original Message- From: Igor Vaynberg [mailto:[EMAIL PROTECTED] Sent: Monday, April 21, 2008 7:08 PM To: users@wicket.apache.org Subject: Re: isVisible() with surrounding Markup and LoadableDetachableModel loadable detachable model caches the value for the request, so even though getobject() is called multiple times, load() is only called once. -igor On Mon, Apr 21, 2008 at 6:59 PM, Warren [EMAIL PROTECTED] wrote: I have a form that has a lot of labels with surrounding markup that needs to be visible based on whether their is a value or empty string. The form uses a CompoundPropertyModel based on a LoadableDetachableModel. How do I check the model value of a Label in isVisible() without having load() of LoadableDetachableModel being called twice. wicket:enclosure child=lineItem.item.department.departmentName brDept: span wicket:id=lineItem.item.department.departmentNameSupplements/span /wicket:enclosure Label departmentName = new Label(lineItem.item.department.departmentName) { public boolean isVisible() { // How do I check value without load() being called again } }; Thanks, Warren Bell - To unsubscribe, e-mail: [EMAIL PROTECTED
RE: isVisible() with surrounding Markup and LoadableDetachableModel
Stack trace in load() and onDetach() java.lang.Exception at load.Load$1.load(Load.java:26) at org.apache.wicket.model.LoadableDetachableModel.getObject(LoadableDetachable Model.java:114) at org.apache.wicket.model.CompoundPropertyModel.getObject(CompoundPropertyMode l.java:60) at org.apache.wicket.model.AbstractPropertyModel.getTarget(AbstractPropertyMode l.java:187) at org.apache.wicket.model.AbstractPropertyModel.getObject(AbstractPropertyMode l.java:110) at org.apache.wicket.Component.getModelObject(Component.java:1539) at org.apache.wicket.Component.getModelObjectAsString(Component.java:1561) at load.Load$LoadForm$1.isVisible(Load.java:54) at org.apache.wicket.Component.internalBeforeRender(Component.java:990) at org.apache.wicket.Component.beforeRender(Component.java:1027) at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupContainer.jav a:1513) at org.apache.wicket.Component.onBeforeRender(Component.java:3657) at org.apache.wicket.Component.internalBeforeRender(Component.java:995) at org.apache.wicket.Component.beforeRender(Component.java:1027) at org.apache.wicket.Component.prepareForRender(Component.java:2139) at org.apache.wicket.ajax.AjaxRequestTarget.respondComponent(AjaxRequestTarget. java:698) at org.apache.wicket.ajax.AjaxRequestTarget.respondComponents(AjaxRequestTarget .java:605) at org.apache.wicket.ajax.AjaxRequestTarget.respond(AjaxRequestTarget.java:520) at org.apache.wicket.request.AbstractRequestCycleProcessor.respond(AbstractRequ estCycleProcessor.java:103) at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java:117 2) at org.apache.wicket.RequestCycle.step(RequestCycle.java:1241) at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1316) at org.apache.wicket.RequestCycle.request(RequestCycle.java:493) at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:354) at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:194) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:186) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:157) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja va:214) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja va:178) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126 ) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105 ) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java :107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConne ction(Http11Protocol.java:731) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.jav a:524) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWo rkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav a:684) at java.lang.Thread.run(Thread.java:595) # load() called=3 java.lang.Exception at load.Load$1.onDetach(Load.java:35) at org.apache.wicket.model.LoadableDetachableModel.detach(LoadableDetachableMod el.java:102) at org.apache.wicket.model.CompoundPropertyModel.detach(CompoundPropertyModel.j ava:107) at org.apache.wicket.Component.detachModel(Component.java:3342) at org.apache.wicket.Component.detachModels(Component.java:1142) at org.apache.wicket.Component.detach(Component.java:1088) at org.apache.wicket.MarkupContainer.detachChildren(MarkupContainer.java:1454) at org.apache.wicket.Component.detach(Component.java:1092) at org.apache.wicket.request.target.component.PageRequestTarget.detach(PageRequ estTarget.java:80) at org.apache.wicket.RequestCycle.detach(RequestCycle.java:1046) at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1334) at org.apache.wicket.RequestCycle.request(RequestCycle.java:493) at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:354) at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:194) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application FilterChain.java:186) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh ain.java:157) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja va:214) at
RE: isVisible() with surrounding Markup and LoadableDetachableModel
Well the Ajax Debug window just keeps scrolling with each new request and shows the previous requests. If it was a standard request, a new debug window would be created with the new page, wouldn't it. The form I am testing has a standard html submit button that is not linked to a component. I am using AjaxFormSubmitBehavior(onkeypress) added to a text field with a Decorator that returns false and only sends a request if the enter key is pressed. testTextField.add(new AjaxFormSubmitBehavior(onkeypress) { protected void onSubmit(AjaxRequestTarget target) { target.addComponent(LoadForm.this); } protected void onError(AjaxRequestTarget target) { } protected IAjaxCallDecorator getAjaxCallDecorator() { return new AjaxCallDecorator() { public CharSequence decorateScript(CharSequence script) { return if(window.event.keyCode == 13){ + script + };return false;; } }; } }); -Original Message- From: Igor Vaynberg [mailto:[EMAIL PROTECTED] Sent: Monday, April 21, 2008 9:17 PM To: users@wicket.apache.org Subject: Re: isVisible() with surrounding Markup and LoadableDetachableModel are you really sure this is all one request, because it looks like once detach is called from a page request target, and once from ajax request target, which would indicate a normal request followed by an ajax one... -igor On Mon, Apr 21, 2008 at 9:07 PM, Warren [EMAIL PROTECTED] wrote: Stack trace in load() and onDetach() java.lang.Exception at load.Load$1.load(Load.java:26) at org.apache.wicket.model.LoadableDetachableModel.getObject(Loadable Detachable Model.java:114) at org.apache.wicket.model.CompoundPropertyModel.getObject(CompoundPr opertyMode l.java:60) at org.apache.wicket.model.AbstractPropertyModel.getTarget(AbstractPr opertyMode l.java:187) at org.apache.wicket.model.AbstractPropertyModel.getObject(AbstractPr opertyMode l.java:110) at org.apache.wicket.Component.getModelObject(Component.java:1539) at org.apache.wicket.Component.getModelObjectAsString(Component.java:1561) at load.Load$LoadForm$1.isVisible(Load.java:54) at org.apache.wicket.Component.internalBeforeRender(Component.java:990) at org.apache.wicket.Component.beforeRender(Component.java:1027) at org.apache.wicket.MarkupContainer.onBeforeRenderChildren(MarkupCon tainer.jav a:1513) at org.apache.wicket.Component.onBeforeRender(Component.java:3657) at org.apache.wicket.Component.internalBeforeRender(Component.java:995) at org.apache.wicket.Component.beforeRender(Component.java:1027) at org.apache.wicket.Component.prepareForRender(Component.java:2139) at org.apache.wicket.ajax.AjaxRequestTarget.respondComponent(AjaxRequ estTarget. java:698) at org.apache.wicket.ajax.AjaxRequestTarget.respondComponents(AjaxReq uestTarget .java:605) at org.apache.wicket.ajax.AjaxRequestTarget.respond(AjaxRequestTarget .java:520) at org.apache.wicket.request.AbstractRequestCycleProcessor.respond(Ab stractRequ estCycleProcessor.java:103) at org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycl e.java:117 2) at org.apache.wicket.RequestCycle.step(RequestCycle.java:1241) at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1316) at org.apache.wicket.RequestCycle.request(RequestCycle.java:493) at org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:354) at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter .java:194) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(A pplication FilterChain.java:186) at org.apache.catalina.core.ApplicationFilterChain.doFilter(Applicati onFilterCh ain.java:157) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapp erValve.ja va:214) at org.apache.catalina.core.StandardContextValve.invoke(StandardConte xtValve.ja va:178) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValv e.java:126
LoadableDetachableModel and load() method question
I have a page that displays a lot of labels and two text field. It is refreshed thru an AjaxFormSubmitBehavior that just refreshes the same page with a new item using a LoadableDetachableModel. I need to update the item displayed and retrieve a new one. I am doing this within the load method. protected Object load() { // Update last Item // Retrieve next Item } Everything works, but load() gets called twice. I understand why that happens, but I only need it to be called once. I can use a flag to make the body of load run once, but this does not seem very clean and I can see it causing problems. Is there a better way to achieve what I am trying to do? Thanks, Warren Bell - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Notification on session destroyed?
What is wrong with extending HttpSessionStore and overiding AbstractHttpSessionStore#onBind(Request request, Session newSession) and AbstractHttpSessionStore#onUnbind(java.lang.String sessionId)? These two methods look like they are there to do exactly what you are talking about. Docs on onUnbind says: Template method that is called when the session is being detached from the store, which typically happens when the httpsession was invalidated. It is also called when the session becomes expired. Add your sessions to a map in onBind and in onUnbind update your pojo and remove the session from the map. onUnbind gives you a sessionId. It looks like it was meant to be used to look up a session and do something with it. -Original Message- From: Nino Saturnino Martinez Vazquez Wael [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 16, 2008 2:20 AM To: users@wicket.apache.org Subject: Re: Notification on session destroyed? But I guess there are no easy way todo this one..:/ Nino Saturnino Martinez Vazquez Wael wrote: I know(hopefully session object should be GC'ed at some time), it really bothers me that it's such an hard thing todo, being aware of session state... So I just wanted an easy way. jweekend wrote: Using Object#finalize() for this type of thing is generally NOT a good idea; it may get called much later than you would expect, if at all. Regards - Cemal http://jWeekend.co.uk Nino.Martinez wrote: Thanks for the example.. I just think it feels very weird to go around wicket in order to achieve this, because the pojo I have are already attached to the wicket session(so I would have double overhead for this). However it could be the case that it's not simply possible from withing wicket. If not, it would be practical to have a method that you could override on wicket session called onBeforeCreate and onBeforeDestroy or something along those lines. Could I use finalize for this? sander v F wrote: You could also use a HttpSessionListener for knowing when a session is destroyed. The problem is indeed that you can't get the attributes when the session is invalidated, but you can get the sessionId. So you could use a Map to register the session id with the Pojo you would like to update. So when the session get's destroyed you can update the Pojo. See http://www.stardeveloper.com/articles/display.html?article=2001112 001page=1for an example with the HttpSessionListener. 2008/4/16, Nino Saturnino Martinez Vazquez Wael [EMAIL PROTECTED]: So what do you think? Im not sure how common a case this is ? regards Nino Nino Saturnino Martinez Vazquez Wael wrote: Hmm, that feels a bit hacky.. Then I'll need to implement a way of tracking sessions, and I saw something about keeping references to destroyed sessions arent that great. It might be me that's just way of context(not knowing all of the internals), but should something like this be easy todo in wicket? Like maybe have a onDestroy or onExpire(or both?) in session class? However I have no idea on how much overhead this would bring to applications that does not use the feature. regards Nino Johan Compagner wrote: attached to a session of the session that is just invalided/expired? That wont work. You cant get to a http sessions attributes when it is invalidated. To know which session id's are destroyed: public void sessionDestroyed(String sessionId) of WebApplication johan On Tue, Apr 15, 2008 at 9:07 AM, Nino Saturnino Martinez Vazquez Wael [EMAIL PROTECTED] wrote: Hi I've checked a little around, but could not find anything directly. This is what I want todo: When a user either logs out or expire I want to update a pojo attached to session. So does anyone have an example on how todo this(if possible)? -- -Wicket for love Nino Martinez Wael Java Specialist @ Jayway DK http://www.jayway.dk +45 2936 7684 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Wicket for love Nino Martinez Wael Java Specialist @ Jayway DK http://www.jayway.dk +45 2936 7684 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Wicket for love Nino Martinez Wael Java Specialist @ Jayway DK http://www.jayway.dk +45 2936 7684 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- -Wicket for love Nino Martinez Wael Java Specialist @ Jayway DK http://www.jayway.dk +45 2936 7684
LoadableDetachableModel load() question
I have a page with a form that uses a LoadableDetachableModel nested in a CompoundPropertyModel. The form has a lot of labels and one text field. The page is refreshed thru an AjaxFormSubmitBehavior so load only gets called once. The problem is that I need the value of the text field in order to load the next object. How do I get a hold of that text field's value in the LoadableDetachableModel load method? public class ReceiveItemDetail { public ReceiveItemDetail() { super(); IModel receiveModel = new LoadableDetachableModel() { protected Object load() { // I need the TextField value here ... } }; add(new ReceiveItemDetailForm(receiveItemDetailForm, new CompoundPropertyModel(receiveModel))); ... } public final class ReceiveItemDetailForm extends Form { public ReceiveItemDetailForm(final String id, final IModel model) { super(id, model); setOutputMarkupId(true); add(new AjaxFormSubmitBehavior(onsubmit) { protected void onSubmit(AjaxRequestTarget target) { // refresh page } ... }); TextField upc = new TextField(upc); upc.setOutputMarkupId(true); add(upc); // Other Labels ... } } } Thanks, Warren Bell - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Get informed about invalidation of a session
I am extending HttpSessionStore and keeping track of my sessions there. I am able to get a hold of members of my Session while it is being invalidated. I am not quite sure what you mean by on the unBind() / onDestroy the actual session object does not exist anymore, the session seems to be available and I am able to access members of it as long as I store the Session in onBind(...). This is what I am doing: public class ScanManSessionStore extends HttpSessionStore { ... private MapString, Session sessions = new ConcurrentHashMap(); private MapString, Device devices = new ConcurrentHashMap(); protected void onBind(Request request, Session newSession) { sessions.put(newSession.getId(), newSession); } protected void onUnbind(String sessionId) { if(sessions.containsKey(sessionId)) { Device device = ((ScanManSession)sessions.get(sessionId)).getDevice(); if(device != null) { devices.remove(device.getDeviceId()); } sessions.remove(sessionId); } } ... } Please let me know if there is a problem doing it this way. Warren -Original Message- From: Robert Novotny [mailto:[EMAIL PROTECTED] Sent: Thursday, April 03, 2008 3:37 AM To: users@wicket.apache.org Subject: RE: Get informed about invalidation of a session This has been discussed multiple times and the only reasonable solution that I found (and just implemented) is to have a concurrent hashmap of session ids into session objects in the custom Application class. The reason is that on the unBind() / onDestroy the actual session object does not exist anymore - the only thing you have is the destroyed session ID. I needed to persist some user info on the logout. My solution goes like this: public class DavanoApplication extends org.apache.wicket.protocol.http.WebApplication { private MapString, User activeUsersMap = new ConcurrentHashMapString, User(); ... @Override public void sessionDestroyed(String sessionId) { User user = activeUsersMap.get(sessionId); if(user != null) { userDao.saveOrUpdate(user); userDao.updateLastLogin(user); activeUsersMap.remove(sessionId); } super.sessionDestroyed(sessionId); } } I am not sure whether this is correct solution, but it did help me. Robert BatiB80 wrote: Hi Warren, thanks for your answer. But I'm not sure how I could use this. The information that I need to access are stored in the session. How can I access a single instance of this session from the session store? Thanks, Sebastian -- View this message in context: http://www.nabble.com/Get-informed-about-invalidation-of-a-session -tp16447452p16467385.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Get informed about invalidation of a session
Can't I rely on HttpSessionStore#onBind(...) and HttpSessionStore#onUnbind(...) to manage a ConcurrentHashMap() of Sessions? I remove the session in onUnbind(). And doesn't invalidating and onUnbind() happen in the same request?. I have some special use cases that require one device to communicate with another, logging off all users at once and only allowing no more than 100 devices to be logged on at a time. -Original Message- From: Johan Compagner [mailto:[EMAIL PROTECTED] Sent: Thursday, April 03, 2008 12:52 PM To: users@wicket.apache.org Subject: Re: Get informed about invalidation of a session when a session is invalidated you cant call get or set attribute anymore on it also holding on the sessions outside of request is not something you should do On Thu, Apr 3, 2008 at 5:51 PM, Warren [EMAIL PROTECTED] wrote: I am extending HttpSessionStore and keeping track of my sessions there. I am able to get a hold of members of my Session while it is being invalidated. I am not quite sure what you mean by on the unBind() / onDestroy the actual session object does not exist anymore, the session seems to be available and I am able to access members of it as long as I store the Session in onBind(...). This is what I am doing: public class ScanManSessionStore extends HttpSessionStore { ... private MapString, Session sessions = new ConcurrentHashMap(); private MapString, Device devices = new ConcurrentHashMap(); protected void onBind(Request request, Session newSession) { sessions.put(newSession.getId(), newSession); } protected void onUnbind(String sessionId) { if(sessions.containsKey(sessionId)) { Device device = ((ScanManSession)sessions.get(sessionId)).getDevice(); if(device != null) { devices.remove(device.getDeviceId()); } sessions.remove(sessionId); } } ... } Please let me know if there is a problem doing it this way. Warren -Original Message- From: Robert Novotny [mailto:[EMAIL PROTECTED] Sent: Thursday, April 03, 2008 3:37 AM To: users@wicket.apache.org Subject: RE: Get informed about invalidation of a session This has been discussed multiple times and the only reasonable solution that I found (and just implemented) is to have a concurrent hashmap of session ids into session objects in the custom Application class. The reason is that on the unBind() / onDestroy the actual session object does not exist anymore - the only thing you have is the destroyed session ID. I needed to persist some user info on the logout. My solution goes like this: public class DavanoApplication extends org.apache.wicket.protocol.http.WebApplication { private MapString, User activeUsersMap = new ConcurrentHashMapString, User(); ... @Override public void sessionDestroyed(String sessionId) { User user = activeUsersMap.get(sessionId); if(user != null) { userDao.saveOrUpdate(user); userDao.updateLastLogin(user); activeUsersMap.remove(sessionId); } super.sessionDestroyed(sessionId); } } I am not sure whether this is correct solution, but it did help me. Robert BatiB80 wrote: Hi Warren, thanks for your answer. But I'm not sure how I could use this. The information that I need to access are stored in the session. How can I access a single instance of this session from the session store? Thanks, Sebastian -- View this message in context: http://www.nabble.com/Get-informed-about-invalidation-of-a-session -tp16447452p16467385.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Get informed about invalidation of a session
Just for my information, what would be some of the uses of AbstractHttpSessionStore#onBind(...) and AbstractHttpSessionStore#onUnbind(...)? It looks like they are there to manage sessions in some way. My use cases are a little more complicated, but you made some good points and I do need to rethink how I am doing things. Thanks, Warren -Original Message- From: Johan Compagner [mailto:[EMAIL PROTECTED] Sent: Thursday, April 03, 2008 1:56 PM To: users@wicket.apache.org Subject: Re: Get informed about invalidation of a session that there only can be 100 can be checked by just having a counter And communication should just be pulled from a central data object you shouldn't push that in into the session objects (same for logging off) Ofcourse this can all work but you dont know what the container does and failover or loadbalanching is also out. invalidating can happen anytime. In a request and when there is no request (session time out) johan On Thu, Apr 3, 2008 at 10:49 PM, Warren [EMAIL PROTECTED] wrote: Can't I rely on HttpSessionStore#onBind(...) and HttpSessionStore#onUnbind(...) to manage a ConcurrentHashMap() of Sessions? I remove the session in onUnbind(). And doesn't invalidating and onUnbind() happen in the same request?. I have some special use cases that require one device to communicate with another, logging off all users at once and only allowing no more than 100 devices to be logged on at a time. -Original Message- From: Johan Compagner [mailto:[EMAIL PROTECTED] Sent: Thursday, April 03, 2008 12:52 PM To: users@wicket.apache.org Subject: Re: Get informed about invalidation of a session when a session is invalidated you cant call get or set attribute anymore on it also holding on the sessions outside of request is not something you should do On Thu, Apr 3, 2008 at 5:51 PM, Warren [EMAIL PROTECTED] wrote: I am extending HttpSessionStore and keeping track of my sessions there. I am able to get a hold of members of my Session while it is being invalidated. I am not quite sure what you mean by on the unBind() / onDestroy the actual session object does not exist anymore, the session seems to be available and I am able to access members of it as long as I store the Session in onBind(...). This is what I am doing: public class ScanManSessionStore extends HttpSessionStore { ... private MapString, Session sessions = new ConcurrentHashMap(); private MapString, Device devices = new ConcurrentHashMap(); protected void onBind(Request request, Session newSession) { sessions.put(newSession.getId(), newSession); } protected void onUnbind(String sessionId) { if(sessions.containsKey(sessionId)) { Device device = ((ScanManSession)sessions.get(sessionId)).getDevice(); if(device != null) { devices.remove(device.getDeviceId()); } sessions.remove(sessionId); } } ... } Please let me know if there is a problem doing it this way. Warren -Original Message- From: Robert Novotny [mailto:[EMAIL PROTECTED] Sent: Thursday, April 03, 2008 3:37 AM To: users@wicket.apache.org Subject: RE: Get informed about invalidation of a session This has been discussed multiple times and the only reasonable solution that I found (and just implemented) is to have a concurrent hashmap of session ids into session objects in the custom Application class. The reason is that on the unBind() / onDestroy the actual session object does not exist anymore - the only thing you have is the destroyed session ID. I needed to persist some user info on the logout. My solution goes like this: public class DavanoApplication extends org.apache.wicket.protocol.http.WebApplication { private MapString, User activeUsersMap = new ConcurrentHashMapString, User(); ... @Override public void sessionDestroyed(String sessionId) { User user = activeUsersMap.get(sessionId); if(user != null) { userDao.saveOrUpdate(user); userDao.updateLastLogin(user); activeUsersMap.remove(sessionId); } super.sessionDestroyed(sessionId); } } I am not sure whether this is correct solution, but it did help me. Robert BatiB80 wrote: Hi Warren, thanks
RE: Get informed about invalidation of a session
I am doing kind of the same thing in HttpSessionStore#onUnbind(String sessionId), but I have to keep track of all the sessions. I have a use case that requires me to log off everyone at once. Hope this helps you. -Original Message- From: BatiB80 [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 02, 2008 10:11 AM To: users@wicket.apache.org Subject: Get informed about invalidation of a session Hi together, I want to store some user related information (something like last viewed articles) in the session instance for this user. During one session I simply store the information directly in the session. But when the session is being invaldidated I want to persist the information in the database. Therefore I need to get informed when a session is being invalidated. Does anybody know how I can reach this? Thanks in advance, Sebastian -- View this message in context: http://www.nabble.com/Get-informed-about-invalidation-of-a-session -tp16447452p16447452.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Swarm Examples
http://wicketstuff.org/confluence/display/STUFFWIKI/Wicket-Security+Examples -Original Message- From: Gareth Segree [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 01, 2008 8:21 PM To: users@wicket.apache.org Subject: Re: Swarm Examples Where can I download source code for the swarm examples. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Wicket-Security Back Button and Login more than once
How do you deal with the situation where a user uses the browser back button and ends up on a login page and then trys to login again? In other words, how do you allow a user to login more than once. I am also running into this same situation when I manually throw a RestartResponseAtInterceptPageException(Login.class) exception. I need a 5 minute screen saver type of time out and then the regular session expired time out. The screen saver would require the user to login again and the pick-up where they left off, but if a new user logged in it would invalidate the previous users session and start the new user from the home page. I wrote something that kind of works, but I keep running into little problems with it. What would be the best way to do this? Thanks, Warren Bell - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Wicket-Security Back Button and Login more than once
Where would you check to see if the same user was trying to log on again, in the LoginContext? I can check in the Session and see if a user is logged on or not, but I can not check to see if it is the same user unless I keep the userid and password in the session. I would like to do it in the LoginContext and throw an Exception if it is the same user. The way it is now, I get a LoginException from the LoginContainer if I try to log on again, but I have no way of knowing if it is because the same user is logged on or not. public void login(LoginContext context) throws LoginException { ... if (subjects.containsKey(key)) throw new LoginException(Already logged in through this context ).setLoginContext(context); ... } How would you suggest figuring out if it is the same user or not? -Original Message- From: Maurice Marrink [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 25, 2008 10:02 AM To: users@wicket.apache.org Subject: Re: Wicket-Security Back Button and Login more than once We also use a screensaver but it does not use the login routines, instead it just verifies the user input against the username and password from the loggedin user. Also you can a check on the loginpage to determine if there is already a logged in user, if there is and it is the same username you can skip logging in again. Maurice On Tue, Mar 25, 2008 at 5:41 PM, Warren [EMAIL PROTECTED] wrote: How do you deal with the situation where a user uses the browser back button and ends up on a login page and then trys to login again? In other words, how do you allow a user to login more than once. I am also running into this same situation when I manually throw a RestartResponseAtInterceptPageException(Login.class) exception. I need a 5 minute screen saver type of time out and then the regular session expired time out. The screen saver would require the user to login again and the pick-up where they left off, but if a new user logged in it would invalidate the previous users session and start the new user from the home page. I wrote something that kind of works, but I keep running into little problems with it. What would be the best way to do this? Thanks, Warren Bell - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Wicket-Security Back Button and Login more than once
Your checking in your constructor or in an onSubmit() of a form on your Login Page? I'm sorry, I am not quite following you. And are you keeping password info in your User reference or are you looking it up from db or wherever every time? -Original Message- From: Maurice Marrink [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 25, 2008 1:24 PM To: users@wicket.apache.org Subject: Re: Wicket-Security Back Button and Login more than once Well, we do it by also keeping a reference to the user (not the subject that swarm uses) in the session. And we check if the the user is already logged in in the constructor of our login page. The login context is not intended to check if the same user is already logged in. The logincontext does however prevent (if so ordered, which is the case by default) multiple logins. I don't think multiple logins is what you want, but if that is the case you could take a look at the constructors of LoginContext, they let you change the default behavior. Maurice On Tue, Mar 25, 2008 at 7:07 PM, Warren [EMAIL PROTECTED] wrote: Where would you check to see if the same user was trying to log on again, in the LoginContext? I can check in the Session and see if a user is logged on or not, but I can not check to see if it is the same user unless I keep the userid and password in the session. I would like to do it in the LoginContext and throw an Exception if it is the same user. The way it is now, I get a LoginException from the LoginContainer if I try to log on again, but I have no way of knowing if it is because the same user is logged on or not. public void login(LoginContext context) throws LoginException { ... if (subjects.containsKey(key)) throw new LoginException(Already logged in through this context ).setLoginContext(context); ... } How would you suggest figuring out if it is the same user or not? -Original Message- From: Maurice Marrink [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 25, 2008 10:02 AM To: users@wicket.apache.org Subject: Re: Wicket-Security Back Button and Login more than once We also use a screensaver but it does not use the login routines, instead it just verifies the user input against the username and password from the loggedin user. Also you can a check on the loginpage to determine if there is already a logged in user, if there is and it is the same username you can skip logging in again. Maurice On Tue, Mar 25, 2008 at 5:41 PM, Warren [EMAIL PROTECTED] wrote: How do you deal with the situation where a user uses the browser back button and ends up on a login page and then trys to login again? In other words, how do you allow a user to login more than once. I am also running into this same situation when I manually throw a RestartResponseAtInterceptPageException(Login.class) exception. I need a 5 minute screen saver type of time out and then the regular session expired time out. The screen saver would require the user to login again and the pick-up where they left off, but if a new user logged in it would invalidate the previous users session and start the new user from the home page. I wrote something that kind of works, but I keep running into little problems with it. What would be the best way to do this? Thanks, Warren Bell - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Wicket-Security Back Button and Login more than once
Ok, that makes sense. Is there a problem logging off and then immediately logging a new user on. I am doing this in the case that a RestartResponseAtInterceptPageException was thrown but a different user logs on then the one that threw the RestartResponseAtInterceptPageException. I go to the home page instead of continueToOriginalDestination(). I see that logging off causes the Session to be marked dirty, but when I immediately log on a new user, the session does not get invalidated. Do you see any reason why I should not do this? -Original Message- From: Maurice Marrink [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 25, 2008 2:19 PM To: users@wicket.apache.org Subject: Re: Wicket-Security Back Button and Login more than once I checked to be sure :) we check it in the constructor: // prevent double logins if (isUserLoggedIn()) { throw new RestartResponseException(HomePage.class); } ofcourse that way you can not check if it is the same user. So if you really want to do that you have to check it in the onsubmit before you use the logincontext. Our user object does have a password field which is encrypted so we have to encrypt the user input first to match it against the password. However we do not store the user entity in the session but just the id, during a request if the user is needed it is loaded once from the db and then that is used throughout the request. after the request we detach it again. Maurice On Tue, Mar 25, 2008 at 10:03 PM, Warren [EMAIL PROTECTED] wrote: Your checking in your constructor or in an onSubmit() of a form on your Login Page? I'm sorry, I am not quite following you. And are you keeping password info in your User reference or are you looking it up from db or wherever every time? -Original Message- From: Maurice Marrink [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 25, 2008 1:24 PM To: users@wicket.apache.org Subject: Re: Wicket-Security Back Button and Login more than once Well, we do it by also keeping a reference to the user (not the subject that swarm uses) in the session. And we check if the the user is already logged in in the constructor of our login page. The login context is not intended to check if the same user is already logged in. The logincontext does however prevent (if so ordered, which is the case by default) multiple logins. I don't think multiple logins is what you want, but if that is the case you could take a look at the constructors of LoginContext, they let you change the default behavior. Maurice On Tue, Mar 25, 2008 at 7:07 PM, Warren [EMAIL PROTECTED] wrote: Where would you check to see if the same user was trying to log on again, in the LoginContext? I can check in the Session and see if a user is logged on or not, but I can not check to see if it is the same user unless I keep the userid and password in the session. I would like to do it in the LoginContext and throw an Exception if it is the same user. The way it is now, I get a LoginException from the LoginContainer if I try to log on again, but I have no way of knowing if it is because the same user is logged on or not. public void login(LoginContext context) throws LoginException { ... if (subjects.containsKey(key)) throw new LoginException(Already logged in through this context ).setLoginContext(context); ... } How would you suggest figuring out if it is the same user or not? -Original Message- From: Maurice Marrink [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 25, 2008 10:02 AM To: users@wicket.apache.org Subject: Re: Wicket-Security Back Button and Login more than once We also use a screensaver but it does not use the login routines, instead it just verifies the user input against the username and password from the loggedin user. Also you can a check on the loginpage to determine if there is already a logged in user, if there is and it is the same username you can skip logging in again. Maurice On Tue, Mar 25, 2008 at 5:41 PM, Warren [EMAIL PROTECTED] wrote: How do you deal with the situation where a user uses the browser back button and ends up on a login page and then trys to login again? In other words, how do you allow a user to login more than once. I am also running into this same situation when I manually throw a RestartResponseAtInterceptPageException(Login.class) exception. I need a 5 minute screen saver type of time out and then the regular session
RE: Wicket-Security Back Button and Login more than once
I did not mess with WaspSession.logoff at all. I am doing the following: 1. Set all my references I may have in my session to null 2. Clear all the page maps from the session 3. Call logoff(getScanManApp().getLogoffContext()); 4. Call login(context); In my base page I am setting the headers so that the page is not cached. It seems to be working, and I am not able to back button on to the previous user's pages. And the session does not get invalidated. Do you see any problem doing it this way? -Original Message- From: Maurice Marrink [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 25, 2008 3:37 PM To: users@wicket.apache.org Subject: Re: Wicket-Security Back Button and Login more than once Logging off using WaspSession.logoff should by default invalidate the session which would erase the user credentials of the new user. But i am not sure what modifications you made, i remember us talking about not invalidating the session but have no idea what you ultimately decided on. The trick with reusing a session with different credentials is that you do not want the new user to use the backbutton to access pages available to the previous user but not to the current user. You could use a http header for that (no-store i think) just override setHeaders in your base-page(s). This will force the browser to make a trip to the server even when using the backbutton. It will not prevent the user from accessing pages the previous user visited if he also has permission to access that page though. for that you really need a new session. Maurice On Tue, Mar 25, 2008 at 11:14 PM, Warren [EMAIL PROTECTED] wrote: Ok, that makes sense. Is there a problem logging off and then immediately logging a new user on. I am doing this in the case that a RestartResponseAtInterceptPageException was thrown but a different user logs on then the one that threw the RestartResponseAtInterceptPageException. I go to the home page instead of continueToOriginalDestination(). I see that logging off causes the Session to be marked dirty, but when I immediately log on a new user, the session does not get invalidated. Do you see any reason why I should not do this? -Original Message- From: Maurice Marrink [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 25, 2008 2:19 PM To: users@wicket.apache.org Subject: Re: Wicket-Security Back Button and Login more than once I checked to be sure :) we check it in the constructor: // prevent double logins if (isUserLoggedIn()) { throw new RestartResponseException(HomePage.class); } ofcourse that way you can not check if it is the same user. So if you really want to do that you have to check it in the onsubmit before you use the logincontext. Our user object does have a password field which is encrypted so we have to encrypt the user input first to match it against the password. However we do not store the user entity in the session but just the id, during a request if the user is needed it is loaded once from the db and then that is used throughout the request. after the request we detach it again. Maurice On Tue, Mar 25, 2008 at 10:03 PM, Warren [EMAIL PROTECTED] wrote: Your checking in your constructor or in an onSubmit() of a form on your Login Page? I'm sorry, I am not quite following you. And are you keeping password info in your User reference or are you looking it up from db or wherever every time? -Original Message- From: Maurice Marrink [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 25, 2008 1:24 PM To: users@wicket.apache.org Subject: Re: Wicket-Security Back Button and Login more than once Well, we do it by also keeping a reference to the user (not the subject that swarm uses) in the session. And we check if the the user is already logged in in the constructor of our login page. The login context is not intended to check if the same user is already logged in. The logincontext does however prevent (if so ordered, which is the case by default) multiple logins. I don't think multiple logins is what you want, but if that is the case you could take a look at the constructors of LoginContext, they let you change the default behavior. Maurice On Tue, Mar 25, 2008 at 7:07 PM, Warren [EMAIL PROTECTED] wrote: Where would you check to see if the same user was trying to log on again, in the LoginContext? I can check in the Session and see if a user is logged on or not, but I can not check to see if it is the same user unless I keep the userid and password in the session. I would like to do it in the LoginContext and throw
Clearing Feedback Messages from the Session
I am displaying feedback messages using a js alert window instead of a feedback panel. Everything works except that I end up displaying the same message twice. Once for the original request and then again for the following request. I am retrieving the messages from the Session when the page's onBeforeRender() is called. I call getFeedbackMessages().messages(null) and then immediately call cleanupFeedbackMessages(). I basically am looking to duplicate what a feedback panel does. What do I need to do to clear all the messages from the Session after I retrieve them? Thanks, Warren Bell - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Clearing Feedback Messages from the Session
That's what I was looking for, Thanks -Original Message- From: Igor Vaynberg [mailto:[EMAIL PROTECTED] Sent: Saturday, March 15, 2008 8:38 PM To: users@wicket.apache.org Subject: Re: Clearing Feedback Messages from the Session message.markrendered() ? -igor On Sat, Mar 15, 2008 at 12:39 PM, Warren [EMAIL PROTECTED] wrote: I am displaying feedback messages using a js alert window instead of a feedback panel. Everything works except that I end up displaying the same message twice. Once for the original request and then again for the following request. I am retrieving the messages from the Session when the page's onBeforeRender() is called. I call getFeedbackMessages().messages(null) and then immediately call cleanupFeedbackMessages(). I basically am looking to duplicate what a feedback panel does. What do I need to do to clear all the messages from the Session after I retrieve them? Thanks, Warren Bell - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Clearing Feedback Messages from the Session
What is cleanupFeedbackMessages() used for ? -Original Message- From: Warren [mailto:[EMAIL PROTECTED] Sent: Saturday, March 15, 2008 9:37 PM To: users@wicket.apache.org Subject: RE: Clearing Feedback Messages from the Session That's what I was looking for, Thanks -Original Message- From: Igor Vaynberg [mailto:[EMAIL PROTECTED] Sent: Saturday, March 15, 2008 8:38 PM To: users@wicket.apache.org Subject: Re: Clearing Feedback Messages from the Session message.markrendered() ? -igor On Sat, Mar 15, 2008 at 12:39 PM, Warren [EMAIL PROTECTED] wrote: I am displaying feedback messages using a js alert window instead of a feedback panel. Everything works except that I end up displaying the same message twice. Once for the original request and then again for the following request. I am retrieving the messages from the Session when the page's onBeforeRender() is called. I call getFeedbackMessages().messages(null) and then immediately call cleanupFeedbackMessages(). I basically am looking to duplicate what a feedback panel does. What do I need to do to clear all the messages from the Session after I retrieve them? Thanks, Warren Bell - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Different content for user
Take a look at Wicket-Security at Wicket Stuff site. http://wicketstuff.org/confluence/display/STUFFWIKI/Wicket-Security I am using it to do the same types of things you are talking about, and it works great. -Original Message- From: Mathias P.W Nilsson [mailto:[EMAIL PROTECTED] Sent: Thursday, March 13, 2008 8:11 AM To: users@wicket.apache.org Subject: Different content for user How can I show different content for logged in users. I have a DataSheet page that allows users to add to cart, edit and so on. Some users should not be able to edit the content or even add to cart. How can I achive this? -- View this message in context: http://www.nabble.com/Different-content-for-user-tp16027844p16027844.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Default Focus Behavior?
WebMarkupContainer bodyTag = new WebMarkupContainer(bodyTag); bodyTag.add(new SimpleAttributeModifier(onload, form.username.focus();)); -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of James Carman Sent: Sunday, March 09, 2008 7:58 AM To: users@wicket.apache.org Subject: Default Focus Behavior? Is there a behavior (or some other way) for having a field receive the focus when the page loads? For instance, in a login form, you'd want the focus to go to the username field or perhaps the password field if you've got remember me turned on. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Default Focus Behavior?
I extended WebMarkupContainer and called it BodyTag. I would then extend TextField and mark it as needing focus. I would add my TextField to BodyTag and have BodyTag look for a component that needed default focus and then add SimpleAttributeModifier(onload, document.getElementById(' + component.getMarkupId() + ').focus();) to BodyTag. Your way looks much cleaner, java-oriented, especially since I have a lot of other things I add to the onload event of the body tag. And the way you have it, it looks like renderHead can get called many times by extending AbstractBehavior. Thanks for the idea, I think I am going to try it your way. I am fairly new to Wicket and am not up to speed on all that it can do and how it does it. I don't know if I answered any of your questions, but you answered a few of mine. Thanks, -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of James Carman Sent: Sunday, March 09, 2008 8:52 AM To: users@wicket.apache.org Subject: Re: Default Focus Behavior? On 3/9/08, James Carman [EMAIL PROTECTED] wrote: On 3/9/08, Warren [EMAIL PROTECTED] wrote: WebMarkupContainer bodyTag = new WebMarkupContainer(bodyTag); bodyTag.add(new SimpleAttributeModifier(onload, form.username.focus();)); Ok, but wouldn't it be cooler/easier/more java-oriented to do: TextField userName = new TextField(userName); userName.addBehavior(new DefaultFocusBehavior()); or Behaviors.defaultFocus(userName); // Assuming Behaviors existed. How about something like: public class DefaultFocusBehavior extends AbstractBehavior { private Component component; public void bind( Component component ) { this.component = component; component.setOutputMarkupId(true); } public void renderHead( IHeaderResponse iHeaderResponse ) { super.renderHead(iHeaderResponse); iHeaderResponse.renderOnLoadJavascript(document.getElementById(' + component.getMarkupId() + ').focus();); } } -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of James Carman Sent: Sunday, March 09, 2008 7:58 AM To: users@wicket.apache.org Subject: Default Focus Behavior? Is there a behavior (or some other way) for having a field receive the focus when the page loads? For instance, in a login form, you'd want the focus to go to the username field or perhaps the password field if you've got remember me turned on. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Default Focus Behavior?
I need to write a function that involves many components. It would be nice to add a behavior to a form, like you have with a TextField, that would construct a function that included all of the relevant components of that form. The function I need to write looks like this: function keyPressed() { if (window.event.keyCode == 49) { document.getElementById('button1').click(); } if (window.event.keyCode == 50) { document.getElementById('button2').click(); } if (window.event.keyCode == 51) { document.getElementById('button3').click(); } ... } body onKeyPress=keyPressed() ... Do you have any suggestions or ideas? On 3/9/08, James Carman [EMAIL PROTECTED] wrote: On 3/9/08, Warren [EMAIL PROTECTED] wrote: WebMarkupContainer bodyTag = new WebMarkupContainer(bodyTag); bodyTag.add(new SimpleAttributeModifier(onload, form.username.focus();)); Ok, but wouldn't it be cooler/easier/more java-oriented to do: TextField userName = new TextField(userName); userName.addBehavior(new DefaultFocusBehavior()); or Behaviors.defaultFocus(userName); // Assuming Behaviors existed. How about something like: public class DefaultFocusBehavior extends AbstractBehavior { private Component component; public void bind( Component component ) { this.component = component; component.setOutputMarkupId(true); } public void renderHead( IHeaderResponse iHeaderResponse ) { super.renderHead(iHeaderResponse); iHeaderResponse.renderOnLoadJavascript(document.getElementById(' + component.getMarkupId() + ').focus();); } } -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of James Carman Sent: Sunday, March 09, 2008 7:58 AM To: users@wicket.apache.org Subject: Default Focus Behavior? Is there a behavior (or some other way) for having a field receive the focus when the page loads? For instance, in a login form, you'd want the focus to go to the username field or perhaps the password field if you've got remember me turned on. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]