Re: Wicket 1.5 URLs
Hi, I think the cleanest approach is to create your own IRequestMapper and set it as root mapper. See https://cwiki.apache.org/confluence/display/WICKET/Request+mapping#Requestmapping-CryptoMapper and HttpsMapper to understand what root mapper is. Also see https://github.com/apache/wicket/blob/master/wicket-examples/src/main/java/org/apache/wicket/examples/requestmapper/LocaleFirstMapper.java?source=cc to get the idea. You should prepend a segment for all secured pages. On Mon, Jul 22, 2013 at 6:39 PM, Eric Gulatee eric.gula...@gmail.comwrote: Hi fellow Wicketeers, We are in the process of upgrading a 1.4.X application to 1.5.X We had 2 different URL 'contexts' within the same Wicket 1.4 Application. /protected/* All pages annotated with security. [In order to use J2EE security, LTPA, Kerberos etc] /* All unprotected pages Moving to Wicket 1.5 I would like to obtain the following URL schemes based on either an annotation on the class OR extending an interface.. Protected Pages: /protected/wicket/page?1 Unprotected Pages: /wicket/page?1 1- I have explored the mountedmapper but I don't want to specify each every class, nor do I want bookmarkable URLs. 2- I am currentl exploring creating a version of pageinstancemapped prepending /protected which actually generates nice urls. However, I am currently getting a page expired. (I am still trying to dig through the cause etc) My question: Is there a different recommended way to generate these custom URLs in a generic way much like PageInstanceMapper based on either an annotation on a class or interface the class would implement OR am I going down the right path with extending PageInstanceMapper? Cheers, Eric Gulatee
Re: problem with ajax buttons + fields with AjaxFormComponentUpdatingBehavior
HI, Unless you use AjaxChannel.ACTIVE on the AjaxButton you should not experience this behavior. It should work exactly as you expect it. Try to put some debug statements with an AjaxCallListener - print to console in onBefore() and onBeforeSend(). Add this listener to both components - the field and the button. On Tue, Jul 23, 2013 at 5:03 AM, Andrew Geery andrew.ge...@gmail.comwrote: I have a form that is submitted with an AjaxButton. One of the fields in the form uses an AjaxFormComponentUpdatingBehavior to update the server-side state when a value in the field changes (i.e., it fires onchange). If the user changes the field with the AjaxFormComponentUpdatingBehavior associated with it and then clicks the submit button, the behavior updates the field server side, but the ajax button doesn't submit the form. The user has to click the submit button a second time to submit the form. Is there a way to get the two ajax behaviors to fire consecutively, rather than forcing the user to click twice? Thanks Andrew
Ajax file upload broken in IE8 with Wicket 6.9.0
Hey all, After upgrading to Wicket 6.9.0 our ajax file upload started stalling and on some machines even crashing IE8. Downgrading to 6.8.0 immediately fixed the problem. I verified that the issue is not related to the new jQuery version by downgrading to Wicket 6.8.0 but setting the jQuery resource reference to 1.10.1. File upload still works in that case. I browsed the history of wicket-ajax-jquery.js since 6.8.0 but didn't find anything too suspicious. Does anyone have any idea what could cause the problem or is experiencing the same issues? I can try to create some kind of quickstart if that helps. Cheers, Thomas
Re: Ajax file upload broken in IE8 with Wicket 6.9.0
Hi, Just tested wicket-examples 6.0-SNAPSHOT - Ajax - File Upload Example and it works OK on Windows XP / IE 8. I'll upload 6.9.1 to http://www.wicket-library.com/wicket-examples-6.0.x/ajax/upload?1 so you can test there On Tue, Jul 23, 2013 at 2:30 PM, Thomas Heigl tho...@umschalt.com wrote: Hey all, After upgrading to Wicket 6.9.0 our ajax file upload started stalling and on some machines even crashing IE8. Downgrading to 6.8.0 immediately fixed the problem. I verified that the issue is not related to the new jQuery version by downgrading to Wicket 6.8.0 but setting the jQuery resource reference to 1.10.1. File upload still works in that case. I browsed the history of wicket-ajax-jquery.js since 6.8.0 but didn't find anything too suspicious. Does anyone have any idea what could cause the problem or is experiencing the same issues? I can try to create some kind of quickstart if that helps. Cheers, Thomas
RE: Problem with swapping panels using Ajax links
It seems that on the server that works (WAS 6.1.0.29), it can find the wicket-event.js: [7/22/13 13:58:34:585 EDT] 001c SessionContex SessionContext.encodeURL Entry resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js On the servers that don't work (WAS 6.1.0.25), it cannot find that file: [7/18/13 6:55:44:703 EDT] 001f DefaultExtens 3 handleRequest stripping leading slashes pathInfo --- resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js [7/18/13 6:55:44:703 EDT] 001f DefaultExtens 3 file does not exist :/usr/WebSphere/AppServer/profiles/AppSrv01/installedApps/Cell/app.ear/app.war/resources/org.apache.wicket.markup.html.WicketEventReference/wicket-event.js On the servers that don't work, it is looking for the file in the wrong location. -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/Problem-with-swapping-panels-using-Ajax-links-tp4660211p4660418.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Ajax file upload broken in IE8 with Wicket 6.9.0
Hey Martin, The example works fine. I just tried to narrow the problem down and found that the root cause is using AjaxFormSubmitBehavior(onchange) on the input field. The absolute minimal example that crashes my IE8/XP on the first or second upload is: public class TestPage extends WebPage { public TestPage(PageParameters pp) { super(pp); final FormVoid f = new FormVoid(form); f.setMultiPart(true); add(f); final FileUploadField uploadField = new FileUploadField(fileInput, new ListModelFileUpload()); uploadField.add(new AjaxFormSubmitBehavior(onchange) {}); f.add(uploadField); } } html xmlns=http://www.w3.org/1999/xhtml; xmlns:wicket= http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd; body form wicket:id=form input type=file wicket:id=fileInput / /form /body /html Hope that helps to track the problem down. Thomas On Tue, Jul 23, 2013 at 1:42 PM, Martin Grigorov mgrigo...@apache.orgwrote: Hi, Just tested wicket-examples 6.0-SNAPSHOT - Ajax - File Upload Example and it works OK on Windows XP / IE 8. I'll upload 6.9.1 to http://www.wicket-library.com/wicket-examples-6.0.x/ajax/upload?1 so you can test there On Tue, Jul 23, 2013 at 2:30 PM, Thomas Heigl tho...@umschalt.com wrote: Hey all, After upgrading to Wicket 6.9.0 our ajax file upload started stalling and on some machines even crashing IE8. Downgrading to 6.8.0 immediately fixed the problem. I verified that the issue is not related to the new jQuery version by downgrading to Wicket 6.8.0 but setting the jQuery resource reference to 1.10.1. File upload still works in that case. I browsed the history of wicket-ajax-jquery.js since 6.8.0 but didn't find anything too suspicious. Does anyone have any idea what could cause the problem or is experiencing the same issues? I can try to create some kind of quickstart if that helps. Cheers, Thomas
Re: Ajax file upload broken in IE8 with Wicket 6.9.0
Please pack this code in a quickstart and attach it to a ticket. What do you mean by crash exactly ? Does the process end with segfault or what ? On Tue, Jul 23, 2013 at 4:08 PM, Thomas Heigl tho...@umschalt.com wrote: Hey Martin, The example works fine. I just tried to narrow the problem down and found that the root cause is using AjaxFormSubmitBehavior(onchange) on the input field. The absolute minimal example that crashes my IE8/XP on the first or second upload is: public class TestPage extends WebPage { public TestPage(PageParameters pp) { super(pp); final FormVoid f = new FormVoid(form); f.setMultiPart(true); add(f); final FileUploadField uploadField = new FileUploadField(fileInput, new ListModelFileUpload()); uploadField.add(new AjaxFormSubmitBehavior(onchange) {}); f.add(uploadField); } } html xmlns=http://www.w3.org/1999/xhtml; xmlns:wicket= http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd; body form wicket:id=form input type=file wicket:id=fileInput / /form /body /html Hope that helps to track the problem down. Thomas On Tue, Jul 23, 2013 at 1:42 PM, Martin Grigorov mgrigo...@apache.org wrote: Hi, Just tested wicket-examples 6.0-SNAPSHOT - Ajax - File Upload Example and it works OK on Windows XP / IE 8. I'll upload 6.9.1 to http://www.wicket-library.com/wicket-examples-6.0.x/ajax/upload?1 so you can test there On Tue, Jul 23, 2013 at 2:30 PM, Thomas Heigl tho...@umschalt.com wrote: Hey all, After upgrading to Wicket 6.9.0 our ajax file upload started stalling and on some machines even crashing IE8. Downgrading to 6.8.0 immediately fixed the problem. I verified that the issue is not related to the new jQuery version by downgrading to Wicket 6.8.0 but setting the jQuery resource reference to 1.10.1. File upload still works in that case. I browsed the history of wicket-ajax-jquery.js since 6.8.0 but didn't find anything too suspicious. Does anyone have any idea what could cause the problem or is experiencing the same issues? I can try to create some kind of quickstart if that helps. Cheers, Thomas
Re: Ajax file upload broken in IE8 with Wicket 6.9.0
Please pack this code in a quickstart and attach it to a ticket. I'll do that. What do you mean by crash exactly ? Does the process end with segfault or what ? IE has 99% CPU usage and does not respond anymore. On Tue, Jul 23, 2013 at 3:10 PM, Martin Grigorov mgrigo...@apache.orgwrote: Please pack this code in a quickstart and attach it to a ticket. What do you mean by crash exactly ? Does the process end with segfault or what ? On Tue, Jul 23, 2013 at 4:08 PM, Thomas Heigl tho...@umschalt.com wrote: Hey Martin, The example works fine. I just tried to narrow the problem down and found that the root cause is using AjaxFormSubmitBehavior(onchange) on the input field. The absolute minimal example that crashes my IE8/XP on the first or second upload is: public class TestPage extends WebPage { public TestPage(PageParameters pp) { super(pp); final FormVoid f = new FormVoid(form); f.setMultiPart(true); add(f); final FileUploadField uploadField = new FileUploadField(fileInput, new ListModelFileUpload()); uploadField.add(new AjaxFormSubmitBehavior(onchange) {}); f.add(uploadField); } } html xmlns=http://www.w3.org/1999/xhtml; xmlns:wicket= http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd; body form wicket:id=form input type=file wicket:id=fileInput / /form /body /html Hope that helps to track the problem down. Thomas On Tue, Jul 23, 2013 at 1:42 PM, Martin Grigorov mgrigo...@apache.org wrote: Hi, Just tested wicket-examples 6.0-SNAPSHOT - Ajax - File Upload Example and it works OK on Windows XP / IE 8. I'll upload 6.9.1 to http://www.wicket-library.com/wicket-examples-6.0.x/ajax/upload?1 so you can test there On Tue, Jul 23, 2013 at 2:30 PM, Thomas Heigl tho...@umschalt.com wrote: Hey all, After upgrading to Wicket 6.9.0 our ajax file upload started stalling and on some machines even crashing IE8. Downgrading to 6.8.0 immediately fixed the problem. I verified that the issue is not related to the new jQuery version by downgrading to Wicket 6.8.0 but setting the jQuery resource reference to 1.10.1. File upload still works in that case. I browsed the history of wicket-ajax-jquery.js since 6.8.0 but didn't find anything too suspicious. Does anyone have any idea what could cause the problem or is experiencing the same issues? I can try to create some kind of quickstart if that helps. Cheers, Thomas
How to make an own panel work like an e.g. TextField / joining the model hierarchy of page/form
Hi all, I implemented a TextField-Panel. Its kind of FormComponentPanel, but not really... do not have a convertInput() situation. Just additional behaviors and some own l18n stuff... Its already working fine, but what I always have to to is, getting the modelobject manually and forward into my form (model object), where it is used. I would like to implement it in a way, behaving like CompundProperty modeled forms. I read about an IComponentInheritance marker interface, but I do not know, how to use it. Can some one help? kind regards and thanx Patrick - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: How to make an own panel work like an e.g. TextField / joining the model hierarchy of page/form
Hi, On Tue, Jul 23, 2013 at 4:17 PM, Patrick Davids patrick.dav...@nuboit.dewrote: Hi all, I implemented a TextField-Panel. Its kind of FormComponentPanel, but not really... do not have a convertInput() situation. Just additional behaviors and some own l18n stuff... Its already working fine, but what I always have to to is, getting the modelobject manually and forward into my form (model object), where it is used. I would like to implement it in a way, behaving like CompundProperty modeled forms. I read about an IComponentInheritance marker interface, but I do not Do you mean org.apache.wicket.model.IComponentInheritedModel ? It has a demo code in its javadoc. Show us what you tried. know, how to use it. Can some one help? kind regards and thanx Patrick - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Ajax file upload broken in IE8 with Wicket 6.9.0
See https://issues.apache.org/jira/browse/WICKET-5283 On Tue, Jul 23, 2013 at 3:12 PM, Thomas Heigl tho...@umschalt.com wrote: Please pack this code in a quickstart and attach it to a ticket. I'll do that. What do you mean by crash exactly ? Does the process end with segfault or what ? IE has 99% CPU usage and does not respond anymore. On Tue, Jul 23, 2013 at 3:10 PM, Martin Grigorov mgrigo...@apache.orgwrote: Please pack this code in a quickstart and attach it to a ticket. What do you mean by crash exactly ? Does the process end with segfault or what ? On Tue, Jul 23, 2013 at 4:08 PM, Thomas Heigl tho...@umschalt.com wrote: Hey Martin, The example works fine. I just tried to narrow the problem down and found that the root cause is using AjaxFormSubmitBehavior(onchange) on the input field. The absolute minimal example that crashes my IE8/XP on the first or second upload is: public class TestPage extends WebPage { public TestPage(PageParameters pp) { super(pp); final FormVoid f = new FormVoid(form); f.setMultiPart(true); add(f); final FileUploadField uploadField = new FileUploadField(fileInput, new ListModelFileUpload()); uploadField.add(new AjaxFormSubmitBehavior(onchange) {}); f.add(uploadField); } } html xmlns=http://www.w3.org/1999/xhtml; xmlns:wicket= http://wicket.apache.org/dtds.data/wicket-xhtml1.4-strict.dtd; body form wicket:id=form input type=file wicket:id=fileInput / /form /body /html Hope that helps to track the problem down. Thomas On Tue, Jul 23, 2013 at 1:42 PM, Martin Grigorov mgrigo...@apache.org wrote: Hi, Just tested wicket-examples 6.0-SNAPSHOT - Ajax - File Upload Example and it works OK on Windows XP / IE 8. I'll upload 6.9.1 to http://www.wicket-library.com/wicket-examples-6.0.x/ajax/upload?1 so you can test there On Tue, Jul 23, 2013 at 2:30 PM, Thomas Heigl tho...@umschalt.com wrote: Hey all, After upgrading to Wicket 6.9.0 our ajax file upload started stalling and on some machines even crashing IE8. Downgrading to 6.8.0 immediately fixed the problem. I verified that the issue is not related to the new jQuery version by downgrading to Wicket 6.8.0 but setting the jQuery resource reference to 1.10.1. File upload still works in that case. I browsed the history of wicket-ajax-jquery.js since 6.8.0 but didn't find anything too suspicious. Does anyone have any idea what could cause the problem or is experiencing the same issues? I can try to create some kind of quickstart if that helps. Cheers, Thomas
Wicket, Guice and the $Proxy object
Hi, I'm having an issue that I suspect is related to the wicket integration with Guice. Any help is appreciated. I have a Page class that uses field injection to inject a DAO. I then want to cast my DAO to a more specific type (what I inject is the interface). Here's what that looks like public class CnavModify extends ConsoleBasePage { @Inject private CnavUrlDAO cnavUrlDAO; public CnavModify(PageParameters parameters) { super(parameters); if (parameters.get(cnavid).toString() != null) { cnavid = new ObjectId(parameters.get(cnavid).toString()); } if (cnavid != null) { cnavUrlModel = new DetachableCnavUrlModel(((MorphiaCnavUrlDAO)cnavUrlDAO).getCnavById(cnavid)); } } } When I try to cast it I get the following error: Last cause: $Proxy23 cannot be cast to com.hp.honeybadger.persistence.dao.morphia.MorphiaCnavUrlDAO I am able to use the CnavUrlDAO as a CnavUrlDAO, but its type is $Proxy23 and I am unable to cast it to a concrete type. Is this Guice or Wicket related? Any idea how to get around this? Thanks, Daniel
Re: Wicket, Guice and the $Proxy object
Hi, On Tue, Jul 23, 2013 at 6:20 PM, Daniel Watrous dwmaill...@gmail.comwrote: Hi, I'm having an issue that I suspect is related to the wicket integration with Guice. Any help is appreciated. I have a Page class that uses field injection to inject a DAO. I then want to cast my DAO to a more specific type (what I inject is the interface). Here's what that looks like public class CnavModify extends ConsoleBasePage { @Inject private CnavUrlDAO cnavUrlDAO; public CnavModify(PageParameters parameters) { super(parameters); if (parameters.get(cnavid).toString() != null) { cnavid = new ObjectId(parameters.get(cnavid).toString()); } if (cnavid != null) { cnavUrlModel = new DetachableCnavUrlModel(((MorphiaCnavUrlDAO)cnavUrlDAO).getCnavById(cnavid)); } } } When I try to cast it I get the following error: Last cause: $Proxy23 cannot be cast to com.hp.honeybadger.persistence.dao.morphia.MorphiaCnavUrlDAO I am able to use the CnavUrlDAO as a CnavUrlDAO, but its type is $Proxy23 and I am unable to cast it to a concrete type. Is this Guice or Wicket related? Any idea how to get around this? It is an error in your assumption. Wicket injects a proxy that implements CnavUrlDAO but knows nothing about the specific implementation about this interface. Whenever the proxy is used it delegates the call to the bean/service returned by Guice's injector (something like: Injector.getBinding(CnavUrlDAO.class).doSomething()). Thanks, Daniel
Re: Wicket, Guice and the $Proxy object
Here's a little more detail when I debug and attempt to do just the cast: Cannot cast an instance of class $Proxy23 (loaded by instance of org.eclipse.jetty.webapp.WebAppClassLoader(id=3511)) to an instance of class com.hp.honeybadger.persistence.dao.morphia.MorphiaCnavUrlDAO (loaded by instance of sun.misc.Launcher$AppClassLoader(id=2450)) On Tue, Jul 23, 2013 at 9:20 AM, Daniel Watrous dwmaill...@gmail.comwrote: Hi, I'm having an issue that I suspect is related to the wicket integration with Guice. Any help is appreciated. I have a Page class that uses field injection to inject a DAO. I then want to cast my DAO to a more specific type (what I inject is the interface). Here's what that looks like public class CnavModify extends ConsoleBasePage { @Inject private CnavUrlDAO cnavUrlDAO; public CnavModify(PageParameters parameters) { super(parameters); if (parameters.get(cnavid).toString() != null) { cnavid = new ObjectId(parameters.get(cnavid).toString()); } if (cnavid != null) { cnavUrlModel = new DetachableCnavUrlModel(((MorphiaCnavUrlDAO)cnavUrlDAO).getCnavById(cnavid)); } } } When I try to cast it I get the following error: Last cause: $Proxy23 cannot be cast to com.hp.honeybadger.persistence.dao.morphia.MorphiaCnavUrlDAO I am able to use the CnavUrlDAO as a CnavUrlDAO, but its type is $Proxy23 and I am unable to cast it to a concrete type. Is this Guice or Wicket related? Any idea how to get around this? Thanks, Daniel
Re: Wicket, Guice and the $Proxy object
That being the case, is there any way to get an instance that I can cast to a concrete type? On Tue, Jul 23, 2013 at 9:27 AM, Martin Grigorov mgrigo...@apache.orgwrote: Hi, On Tue, Jul 23, 2013 at 6:20 PM, Daniel Watrous dwmaill...@gmail.com wrote: Hi, I'm having an issue that I suspect is related to the wicket integration with Guice. Any help is appreciated. I have a Page class that uses field injection to inject a DAO. I then want to cast my DAO to a more specific type (what I inject is the interface). Here's what that looks like public class CnavModify extends ConsoleBasePage { @Inject private CnavUrlDAO cnavUrlDAO; public CnavModify(PageParameters parameters) { super(parameters); if (parameters.get(cnavid).toString() != null) { cnavid = new ObjectId(parameters.get(cnavid).toString()); } if (cnavid != null) { cnavUrlModel = new DetachableCnavUrlModel(((MorphiaCnavUrlDAO)cnavUrlDAO).getCnavById(cnavid)); } } } When I try to cast it I get the following error: Last cause: $Proxy23 cannot be cast to com.hp.honeybadger.persistence.dao.morphia.MorphiaCnavUrlDAO I am able to use the CnavUrlDAO as a CnavUrlDAO, but its type is $Proxy23 and I am unable to cast it to a concrete type. Is this Guice or Wicket related? Any idea how to get around this? It is an error in your assumption. Wicket injects a proxy that implements CnavUrlDAO but knows nothing about the specific implementation about this interface. Whenever the proxy is used it delegates the call to the bean/service returned by Guice's injector (something like: Injector.getBinding(CnavUrlDAO.class).doSomething()). Thanks, Daniel
Re: problem with ajax buttons + fields with AjaxFormComponentUpdatingBehavior
Just to make sure I'm understanding this correctly, it should be enough to simply override updateAjaxAttributes on AjaxButton and specify a channel that does not have ACTIVE behavior, like this: @Override protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { super.updateAjaxAttributes(attributes); attributes.setChannel(new AjaxChannel(MyChannel, AjaxChannel.Type.DROP)); } Thanks Andrew On Tue, Jul 23, 2013 at 3:46 AM, Martin Grigorov mgrigo...@apache.orgwrote: HI, Unless you use AjaxChannel.ACTIVE on the AjaxButton you should not experience this behavior. It should work exactly as you expect it. Try to put some debug statements with an AjaxCallListener - print to console in onBefore() and onBeforeSend(). Add this listener to both components - the field and the button. On Tue, Jul 23, 2013 at 5:03 AM, Andrew Geery andrew.ge...@gmail.com wrote: I have a form that is submitted with an AjaxButton. One of the fields in the form uses an AjaxFormComponentUpdatingBehavior to update the server-side state when a value in the field changes (i.e., it fires onchange). If the user changes the field with the AjaxFormComponentUpdatingBehavior associated with it and then clicks the submit button, the behavior updates the field server side, but the ajax button doesn't submit the form. The user has to click the submit button a second time to submit the form. Is there a way to get the two ajax behaviors to fire consecutively, rather than forcing the user to click twice? Thanks Andrew
Re: TinyMCE Twitter Bootstrap Toggle
Which version of Wicket/WicketStuff are you using? Andrea, thank you for a good pointer. The thing I am struggling with is adding class=collapse to the xxx_wrapper_component which seems to be created by TinyMCE JavaScript after my Wicket code can add AttributeModifier or even invoke $('# + getAjaxRegionMarkupId() + ').css('class', 'collapse');. It seems like the class gets set by right after that is erased by TinyMCE. Any ideas how I can run my code that sets CSS class of mce wrapper div after tinyMce.init()? Thanks, Alec On Mon, Jul 22, 2013 at 1:30 AM, Andrea Del Bene an.delb...@gmail.comwrote: Hi, you can have a look at InPlaceEditComponent which is used in the example page InlineTinyMCEPage (see code at https://github.com/wicketstuff/core/blob/master/jdk-1.6-parent/tinymce-parent/tinymce-examples/src/main/java/wicket/contrib/examples/tinymce/InlineTinyMCEPage.java ) Hello, I have a bootstrap toggle button which the user can use to open and close TinyMCE editor. When the page is rendered I would like the TinyMCE editor to be closed and when user clicks on the toggle button - open. Note that twitter bootstrap button needs to know TinyMCE#getAjaxRegionMarkupId(area) in order to use it in toggle-target='xxx' attribute to toggle it. Is there a way to configure TinyMceBehavior to render hidden by default? Any other ideas on how I can get this solved? Thanks, Alec - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket, Guice and the $Proxy object
@Inject the implementation, not the interface. @Inject'd implementations have some code smell, but no more than downcasting. On Tue, Jul 23, 2013 at 8:40 AM, Daniel Watrous dwmaill...@gmail.comwrote: That being the case, is there any way to get an instance that I can cast to a concrete type? On Tue, Jul 23, 2013 at 9:27 AM, Martin Grigorov mgrigo...@apache.org wrote: Hi, On Tue, Jul 23, 2013 at 6:20 PM, Daniel Watrous dwmaill...@gmail.com wrote: Hi, I'm having an issue that I suspect is related to the wicket integration with Guice. Any help is appreciated. I have a Page class that uses field injection to inject a DAO. I then want to cast my DAO to a more specific type (what I inject is the interface). Here's what that looks like public class CnavModify extends ConsoleBasePage { @Inject private CnavUrlDAO cnavUrlDAO; public CnavModify(PageParameters parameters) { super(parameters); if (parameters.get(cnavid).toString() != null) { cnavid = new ObjectId(parameters.get(cnavid).toString()); } if (cnavid != null) { cnavUrlModel = new DetachableCnavUrlModel(((MorphiaCnavUrlDAO)cnavUrlDAO).getCnavById(cnavid)); } } } When I try to cast it I get the following error: Last cause: $Proxy23 cannot be cast to com.hp.honeybadger.persistence.dao.morphia.MorphiaCnavUrlDAO I am able to use the CnavUrlDAO as a CnavUrlDAO, but its type is $Proxy23 and I am unable to cast it to a concrete type. Is this Guice or Wicket related? Any idea how to get around this? It is an error in your assumption. Wicket injects a proxy that implements CnavUrlDAO but knows nothing about the specific implementation about this interface. Whenever the proxy is used it delegates the call to the bean/service returned by Guice's injector (something like: Injector.getBinding(CnavUrlDAO.class).doSomething()). Thanks, Daniel
Reading placeholder parameters in mounted resources
Hi, I have a shared resource mounted to a URL pattern /storage/${id} So that the URL look like /storage/12345 and with optional additional parameters /storage/12345?shape=xyz It works fine when I create a new URL - the id parameter is correctly encoded in the URL. But when I process the actual request, I only receive the optional parameters like shape, while id parameter is not present in RequestParameters. Therefore I need to parse the URL string and extract the ID parameters manually. The question is - why Wicket does not decode the parameters back? Is it by design, or is it only a problem with shared resources? Regards, Andrew -- Andrew Schetinin
Re: Reading placeholder parameters in mounted resources
Try this pattern /storage/${id}/#{shape} Optional parameters are denoted by using a # instead of $ François Meillet Formation Wicket - Développement Wicket Le 23 juil. 2013 à 19:14, Andrew Schetinin ascheti...@gmail.com a écrit : Hi, I have a shared resource mounted to a URL pattern /storage/${id} So that the URL look like /storage/12345 and with optional additional parameters /storage/12345?shape=xyz It works fine when I create a new URL - the id parameter is correctly encoded in the URL. But when I process the actual request, I only receive the optional parameters like shape, while id parameter is not present in RequestParameters. Therefore I need to parse the URL string and extract the ID parameters manually. The question is - why Wicket does not decode the parameters back? Is it by design, or is it only a problem with shared resources? Regards, Andrew -- Andrew Schetinin
Re: Inmethod Grid on IE9
Hi Jose, I too had the same issue, and I also dont know how to fix it. Please let us know what you did to get it to work. My work around is to set this for IE 9 only: overflow-y: hidden; overflow-x: scroll; If there is a better solution, please let us know. Thanks, Jesse On 18/07/2013 17:10, Dan Simko wrote: Hi, my IE has the same problem. But unfortunately I do not have any idea how to fix (except to remove horizontal scrollbar). On Thu, Jul 18, 2013 at 5:02 PM, Jose Mauricio Meraz Mercado jmm...@gmail.com wrote: It seems there was something wrong with my IE, now it is working fine Thanks 2013/7/12 Jose Mauricio Meraz Mercado jmm...@gmail.com Hi, Currently on the application we are developing we are using InMethod grids, when those grids have a horizontal scroll bar there is a strange behavior that makes the div that has the contents grow when you select text or when you select a record on the grid. This behavior can be reproduced on http://www.wicket-library.com/inmethod-grid/data-grid/simple (the horizontal scroll bar has to be present, just passing the mouse on the rows will cause the navigation bar to be pushed below). IE8, Firefox and Chrome this works fine We found this on the wicketstuff project with something similar to what we have, but the solution provided doesn't work: https://github.com/wicketstuff/core/issues/44 Has anyone experienced and resolved this? Thanks for any help We are using Wicket 1.4.19 and Inmethod-grid 1.4.9.1 -- El conocimiento es poder - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: problem with ajax buttons + fields with AjaxFormComponentUpdatingBehavior
Looking in the Wicket Debug Window, I do see the name of my channel and I do see that it is set to Queue (MyChannel|s). (function(){Wicket.Ajax.ajax({f:form563,u:./1478314?11-1.IBehaviorListener.2-contactDetailsPanel-contactDetailsTabbedPanel-tabbedPanel-panel-modalForm-modal-content-wizard-form-view-wrapper-form-Save,e:click,c:Save564,sc:modal:content:wizard:form:view:wrapper:form:Save,ch:MyChannel|s,m:POST,i:ajax-loader-mask});})(); I'm currently using Wicket 6.7. Does this not work because either a) it's in a modal window? or b) there is an ajax-loader-mask? Thanks Andrew On Tue, Jul 23, 2013 at 11:44 AM, Andrew Geery andrew.ge...@gmail.comwrote: Just to make sure I'm understanding this correctly, it should be enough to simply override updateAjaxAttributes on AjaxButton and specify a channel that does not have ACTIVE behavior, like this: @Override protected void updateAjaxAttributes(AjaxRequestAttributes attributes) { super.updateAjaxAttributes(attributes); attributes.setChannel(new AjaxChannel(MyChannel, AjaxChannel.Type.DROP)); } Thanks Andrew On Tue, Jul 23, 2013 at 3:46 AM, Martin Grigorov mgrigo...@apache.orgwrote: HI, Unless you use AjaxChannel.ACTIVE on the AjaxButton you should not experience this behavior. It should work exactly as you expect it. Try to put some debug statements with an AjaxCallListener - print to console in onBefore() and onBeforeSend(). Add this listener to both components - the field and the button. On Tue, Jul 23, 2013 at 5:03 AM, Andrew Geery andrew.ge...@gmail.com wrote: I have a form that is submitted with an AjaxButton. One of the fields in the form uses an AjaxFormComponentUpdatingBehavior to update the server-side state when a value in the field changes (i.e., it fires onchange). If the user changes the field with the AjaxFormComponentUpdatingBehavior associated with it and then clicks the submit button, the behavior updates the field server side, but the ajax button doesn't submit the form. The user has to click the submit button a second time to submit the form. Is there a way to get the two ajax behaviors to fire consecutively, rather than forcing the user to click twice? Thanks Andrew
Re: Reading placeholder parameters in mounted resources
Hi, I think this is because you're mixing path parameters with query string one. It could be a bug, could you provide a quickstart with this to help us qualify and fix it if it is a bug. Regards, __ Cedric Gatay (@Cedric_Gatay http://twitter.com/Cedric_Gatay) http://code-troopers.com | http://www.bloggure.info | http://cedric.gatay.fr On Tue, Jul 23, 2013 at 7:31 PM, Francois Meillet francois.meil...@gmail.com wrote: Try this pattern /storage/${id}/#{shape} Optional parameters are denoted by using a # instead of $ François Meillet Formation Wicket - Développement Wicket Le 23 juil. 2013 à 19:14, Andrew Schetinin ascheti...@gmail.com a écrit : Hi, I have a shared resource mounted to a URL pattern /storage/${id} So that the URL look like /storage/12345 and with optional additional parameters /storage/12345?shape=xyz It works fine when I create a new URL - the id parameter is correctly encoded in the URL. But when I process the actual request, I only receive the optional parameters like shape, while id parameter is not present in RequestParameters. Therefore I need to parse the URL string and extract the ID parameters manually. The question is - why Wicket does not decode the parameters back? Is it by design, or is it only a problem with shared resources? Regards, Andrew -- Andrew Schetinin
How properly set locale on application startup
Hi, I try to set locale for my custom session on application newSession method like this: When application start I get my pages localized in EN language, not in XX. What am I doing wrong here? Please help :) -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-properly-set-locale-on-application-startup-tp4660439.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Reading placeholder parameters in mounted resources
Hi Cedric, I'm not sure what you mean by a quick start, but here you may find the piece of code I'm using: This is how the shared resource is initialized with the application: @Override protected void init() { super.init(); mountResource( /storage/${id}, new MediaStorageResourceReference() ); } This is how a URL is constructed: final PageParameters params = new PageParameters(); params.add( id, 12345 ); params.add( thumb, true ); params.add( size, 25 ); final CharSequence ret = component.urlFor( new MediaStorageResourceReference(), params ); // ./storage/12345?thumb=truesize=25 And this is the code of the resource reference (the resource can do anything - it is irrelevant to the story): public class MediaStorageResourceReference extends ResourceReference { private static final Key key = new Key( MediaStorageResourceReference.class.getName(), storage, Locale.ENGLISH, null, null ); public MediaStorageResourceReference() { super( key ); } @Override public IResource getResource() { final Request request = RequestCycle.get().getRequest(); // Wicket uses the same singleton instance also for detecting // if the given resource can be cached by the server - we don't need that, // and the only way to skip that test is to check the URL, // because the check is done by Wicket during forUrl() call, // within the context of a different request. if( !request.getUrl().getPath().startsWith( storage ) ) { logger.debug( Fake resource request ); return null; } final IRequestParameters params = request.getRequestParameters(); Long id = params.getParameterValue( id ).toOptionalLong(); if( id == null ) { // TODO: ask in Wicket forum why the ID is not extracted // request.getUrl().getPath() = storage/72147598477361153 // fallback to extract the ID from path if( request.getUrl().getPath().startsWith( URL_PATH_PREFIX ) ) { final String s = request.getUrl().getPath().substring( URL_PATH_PREFIX.length() ); try { id = new Long( s ); } catch( final NumberFormatException e ) { logger.error( Cannot extract ID from the path: {}, request.getUrl().getPath() ); } } if( id == null ) { throw new AbortWithHttpErrorCodeException( HttpStatus.SC_NOT_FOUND ); } } . return new MyResource(); } Note the workaround for retrieving the ID above - it is required because the list of parameters does not contain any id - only the optional arguments. Regards, Andrew -- Andrew Schetinin On Tue, Jul 23, 2013 at 9:47 PM, Cedric Gatay gata...@gmail.com wrote: Hi, I think this is because you're mixing path parameters with query string one. It could be a bug, could you provide a quickstart with this to help us qualify and fix it if it is a bug. Regards, __ Cedric Gatay (@Cedric_Gatay http://twitter.com/Cedric_Gatay) http://code-troopers.com | http://www.bloggure.info | http://cedric.gatay.fr On Tue, Jul 23, 2013 at 7:31 PM, Francois Meillet francois.meil...@gmail.com wrote: Try this pattern /storage/${id}/#{shape} Optional parameters are denoted by using a # instead of $ François Meillet Formation Wicket - Développement Wicket Le 23 juil. 2013 à 19:14, Andrew Schetinin ascheti...@gmail.com a écrit : Hi, I have a shared resource mounted to a URL pattern /storage/${id} So that the URL look like /storage/12345 and with optional additional parameters /storage/12345?shape=xyz It works fine when I create a new URL - the id parameter is correctly encoded in the URL. But when I process the actual request, I only receive the optional parameters like shape, while id parameter is not present in RequestParameters. Therefore I need to parse the URL string and extract the ID parameters manually. The question is - why Wicket does not decode the parameters back? Is it by design, or is it only a problem with shared resources? Regards, Andrew -- Andrew Schetinin
Re: How properly set locale on application startup
Maybe you don't have the language pack for the locale you set hence Wicket defaults to the english langauge pack? Get yourself familiar with Chapter 12 Internationalization with Wicket of the Wicket Free Guide http://wicket.apache.org/learn/books/freeguide.html - ~ Thank you, p...@bors.ws -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-properly-set-locale-on-application-startup-tp4660439p4660441.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
RE: Reading placeholder parameters in mounted resources
For direction of creating a quick start see: http://wicket.apache.org/start/quickstart.html -Original Message- From: Andrew Schetinin [mailto:ascheti...@gmail.com] Sent: Tuesday, July 23, 2013 3:58 PM To: users@wicket.apache.org Subject: Re: Reading placeholder parameters in mounted resources Hi Cedric, I'm not sure what you mean by a quick start, but here you may find the piece of code I'm using: This is how the shared resource is initialized with the application: @Override protected void init() { super.init(); mountResource( /storage/${id}, new MediaStorageResourceReference() ); } This is how a URL is constructed: final PageParameters params = new PageParameters(); params.add( id, 12345 ); params.add( thumb, true ); params.add( size, 25 ); final CharSequence ret = component.urlFor( new MediaStorageResourceReference(), params ); // ./storage/12345?thumb=truesize=25 And this is the code of the resource reference (the resource can do anything - it is irrelevant to the story): public class MediaStorageResourceReference extends ResourceReference { private static final Key key = new Key( MediaStorageResourceReference.class.getName(), storage, Locale.ENGLISH, null, null ); public MediaStorageResourceReference() { super( key ); } @Override public IResource getResource() { final Request request = RequestCycle.get().getRequest(); // Wicket uses the same singleton instance also for detecting // if the given resource can be cached by the server - we don't need that, // and the only way to skip that test is to check the URL, // because the check is done by Wicket during forUrl() call, // within the context of a different request. if( !request.getUrl().getPath().startsWith( storage ) ) { logger.debug( Fake resource request ); return null; } final IRequestParameters params = request.getRequestParameters(); Long id = params.getParameterValue( id ).toOptionalLong(); if( id == null ) { // TODO: ask in Wicket forum why the ID is not extracted // request.getUrl().getPath() = storage/72147598477361153 // fallback to extract the ID from path if( request.getUrl().getPath().startsWith( URL_PATH_PREFIX ) ) { final String s = request.getUrl().getPath().substring( URL_PATH_PREFIX.length() ); try { id = new Long( s ); } catch( final NumberFormatException e ) { logger.error( Cannot extract ID from the path: {}, request.getUrl().getPath() ); } } if( id == null ) { throw new AbortWithHttpErrorCodeException( HttpStatus.SC_NOT_FOUND ); } } . return new MyResource(); } Note the workaround for retrieving the ID above - it is required because the list of parameters does not contain any id - only the optional arguments. Regards, Andrew -- Andrew Schetinin On Tue, Jul 23, 2013 at 9:47 PM, Cedric Gatay gata...@gmail.com wrote: Hi, I think this is because you're mixing path parameters with query string one. It could be a bug, could you provide a quickstart with this to help us qualify and fix it if it is a bug. Regards, __ Cedric Gatay (@Cedric_Gatay http://twitter.com/Cedric_Gatay) http://code-troopers.com | http://www.bloggure.info | http://cedric.gatay.fr On Tue, Jul 23, 2013 at 7:31 PM, Francois Meillet francois.meil...@gmail.com wrote: Try this pattern /storage/${id}/#{shape} Optional parameters are denoted by using a # instead of $ François Meillet Formation Wicket - Développement Wicket Le 23 juil. 2013 à 19:14, Andrew Schetinin ascheti...@gmail.com a écrit : Hi, I have a shared resource mounted to a URL pattern /storage/${id} So that the URL look like /storage/12345 and with optional additional parameters /storage/12345?shape=xyz It works fine when I create a new URL - the id parameter is correctly encoded in the URL. But when I process the actual request, I only receive the optional parameters like shape, while id parameter is not present in RequestParameters. Therefore I need to parse the URL string and extract the ID parameters manually. The question is - why Wicket does not decode the parameters back? Is it by design, or is it only a problem with shared resources? Regards, Andrew -- Andrew Schetinin - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: TinyMCE Twitter Bootstrap Toggle
I am on Wicket 1.5.9 using WicketStuff 1.5.9.1. I ended up overriding TinyMceBehavior#beforeRender in order to inject class=collapse on the TinyMCE wrapper DIV. Can you think of a cleaner solution? @Override public void beforeRender(Component component) { // see super#beforeRender(Component) component.getResponse().write(String.format(div id=\%s\ class=\collapse\, getAjaxRegionMarkupId(component))); // collapse html editor by default } Thanks, Alec On Tue, Jul 23, 2013 at 9:52 AM, Andrea Del Bene an.delb...@gmail.comwrote: Which version of Wicket/WicketStuff are you using? Andrea, thank you for a good pointer. The thing I am struggling with is adding class=collapse to the xxx_wrapper_component which seems to be created by TinyMCE JavaScript after my Wicket code can add AttributeModifier or even invoke $('# + getAjaxRegionMarkupId() + ').css('class', 'collapse');. It seems like the class gets set by right after that is erased by TinyMCE. Any ideas how I can run my code that sets CSS class of mce wrapper div after tinyMce.init()? Thanks, Alec On Mon, Jul 22, 2013 at 1:30 AM, Andrea Del Bene an.delb...@gmail.com wrote: Hi, you can have a look at InPlaceEditComponent which is used in the example page InlineTinyMCEPage (see code at https://github.com/wicketstuff/core/blob/master/jdk-1.6-parent/tinymce-parent/tinymce-examples/src/main/java/wicket/contrib/examples/tinymce/InlineTinyMCEPage.java ) Hello, I have a bootstrap toggle button which the user can use to open and close TinyMCE editor. When the page is rendered I would like the TinyMCE editor to be closed and when user clicks on the toggle button - open. Note that twitter bootstrap button needs to know TinyMCE#getAjaxRegionMarkupId(area) in order to use it in toggle-target='xxx' attribute to toggle it. Is there a way to configure TinyMceBehavior to render hidden by default? Any other ideas on how I can get this solved? Thanks, Alec - 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: How properly set locale on application startup
Thanks for reply, it was my browser cache :). Thanks anyway. The code I mentioned above works as expected. Issue solved. Thank you -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-properly-set-locale-on-application-startup-tp4660439p4660443.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Wicket, Guice and the $Proxy object
Dan, Good point. After considering I decided to modify my interface to expose the function I need and let the implementation worry about casting where necessary. Thanks, Daniel On Tue, Jul 23, 2013 at 9:58 AM, Dan Retzlaff dretzl...@gmail.com wrote: @Inject the implementation, not the interface. @Inject'd implementations have some code smell, but no more than downcasting. On Tue, Jul 23, 2013 at 8:40 AM, Daniel Watrous dwmaill...@gmail.com wrote: That being the case, is there any way to get an instance that I can cast to a concrete type? On Tue, Jul 23, 2013 at 9:27 AM, Martin Grigorov mgrigo...@apache.org wrote: Hi, On Tue, Jul 23, 2013 at 6:20 PM, Daniel Watrous dwmaill...@gmail.com wrote: Hi, I'm having an issue that I suspect is related to the wicket integration with Guice. Any help is appreciated. I have a Page class that uses field injection to inject a DAO. I then want to cast my DAO to a more specific type (what I inject is the interface). Here's what that looks like public class CnavModify extends ConsoleBasePage { @Inject private CnavUrlDAO cnavUrlDAO; public CnavModify(PageParameters parameters) { super(parameters); if (parameters.get(cnavid).toString() != null) { cnavid = new ObjectId(parameters.get(cnavid).toString()); } if (cnavid != null) { cnavUrlModel = new DetachableCnavUrlModel(((MorphiaCnavUrlDAO)cnavUrlDAO).getCnavById(cnavid)); } } } When I try to cast it I get the following error: Last cause: $Proxy23 cannot be cast to com.hp.honeybadger.persistence.dao.morphia.MorphiaCnavUrlDAO I am able to use the CnavUrlDAO as a CnavUrlDAO, but its type is $Proxy23 and I am unable to cast it to a concrete type. Is this Guice or Wicket related? Any idea how to get around this? It is an error in your assumption. Wicket injects a proxy that implements CnavUrlDAO but knows nothing about the specific implementation about this interface. Whenever the proxy is used it delegates the call to the bean/service returned by Guice's injector (something like: Injector.getBinding(CnavUrlDAO.class).doSomething()). Thanks, Daniel
RE: How properly set locale on application startup
When in doubt... clear your cache :) ~ Thank you, Paul Bors -Original Message- From: meduolis [mailto:meduol...@gmail.com] Sent: Tuesday, July 23, 2013 4:14 PM To: users@wicket.apache.org Subject: Re: How properly set locale on application startup Thanks for reply, it was my browser cache :). Thanks anyway. The code I mentioned above works as expected. Issue solved. Thank you -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/How-properly-set-locale-on-applic ation-startup-tp4660439p4660443.html Sent from the Users forum mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: Form questions
I've had a difficult time following your recommendations. However I think I'm getting closer. Part of the disconnect is that right now, as I show above, the model object I create is in the Form, not the Page. In my Page I create an instance of my Form like this: Form form = new CnavForm(cnavForm); add(form); So, the first step I've taken is to implement a constructor for my Form that receives an IModel and, rather than create my CnavUrl, I get it from the IModel: CnavUrl cnavUrl = (CnavUrl) model.getObject(); setModel(new Model((Serializable) cnavUrl)); Now I create my Form object like this: DetachableCnavUrlModel cnavUrlModel = new DetachableCnavUrlModel(new MorphiaCnavUrl()); Form form = new CnavForm(cnavForm, cnavUrlModel); add(form); I'm now at the page level when I create my Model and I have a DetachableCnavUrlModel, which I also use when displaying them. if (cnavid != null) { cnavUrlModel = new DetachableCnavUrlModel(cnavUrlDAO.getCnavById(cnavid)); } else { cnavUrlModel = new DetachableCnavUrlModel(new MorphiaCnavUrl()); } Form form = new CnavForm(cnavForm, cnavUrlModel); add(form); This way on edit I have a prepopulated form. To answer my other question about the link, I created a PageParameters object and used setResponsePage like this item.add(new Link(editlink) { @Override public void onClick() { PageParameters editParameters = new PageParameters(); editParameters.add(cnavid, ((MorphiaCnavUrl)cnavUrl).getId()); setResponsePage(CnavModify.class, editParameters); } }); I can then use the value in the parameters to set cnavid if (parameters.get(cnavid).toString() != null) { cnavid = new ObjectId(parameters.get(cnavid).toString()); } Thanks for all the help. Daniel On Fri, Jul 19, 2013 at 9:38 AM, Paul Bors p...@bors.ws wrote: For stateless pages it would create a new one each time (add the DebugBar to your pages and see if your page is stateless or not and also see what the model is per component). For when Wicket serializes your page, you don't want a PropertyModel alone, you want a detachable model (see section 9.6 of the Wicket Free Guide or go over chapter 9 again Wicket models and forms). You need to wrap a Detachable model inside a Property model like so: add(new TextField(url, new PropertyModelMorphiaCnavUrl(new LoadableDetachableModelMorphiaCnavUrl(cnavUrl), URL)) .setRequired(true) .add(new UrlValidator())); Is best to use a CompoundPropertyModel for the entire form and get to your POJO that feeds the entire form (or panel) via a detachable model. The LoadableDetachableModel is desined to only serialize the record ID for which you can later retrieve the entire object from your persistence layer. ~ Thank you, Paul Bors -Original Message- From: Daniel Watrous [mailto:dwmaill...@gmail.com] Sent: Friday, July 19, 2013 11:24 AM To: users@wicket.apache.org Subject: Re: Form questions Paul, Thanks. I get that and understand how the Model happens. As you can see, the instance of the model object is created in the constructor. So the first question I had is whether a new instance is created for every request or if there's one instance that's serialized. I suspect it's the second, knowing how Wicket treats sessions. In that case, I need some way on a per request basis to load the model from the database. The other question I had is how to create a link that sends the ID to the page that renders the form. I need to create a link to that page, include an ID value with the request and then access that ID within the form for my query to load that object from the DB. Daniel On Thu, Jul 18, 2013 at 5:14 PM, Paul Bors p...@bors.ws wrote: Okay let's pre-populate this field: add(new TextField(url, new PropertyModel(cnavUrl, URL)) .setRequired(true) .add(new UrlValidator())); Its mode is a new PropertyModel(cnavUrl, URL), which is the CnavUrl cnavUrl = new MorphiaCnavUrl();. So it's the cnavUrl.getUrl() value. What do you get when you call new MorphiaCnavUrl().getUrl()? That's what should appear in the TextField when you first load the page (normally read form the DB). ~ Thank you, Paul Bors -Original Message- From: Daniel Watrous [mailto:dwmaill...@gmail.com] Sent: Thursday, July 18, 2013 6:03 PM To: users@wicket.apache.org Subject: Re: Form questions I've made a lot of progress and been through chapters 9 and 10 of Wicket Free Guide, but I'm still stumped on point #2, pre-populating the form. Here's what I have right now: public class CnavForm extends Form { @Inject private
Re: Wicket, Guice and the $Proxy object
Here's a post that helped me understand this better: http://stackoverflow.com/questions/16047829/proxy-cannot-be-cast-to-class On Tue, Jul 23, 2013 at 2:15 PM, Daniel Watrous dwmaill...@gmail.comwrote: Dan, Good point. After considering I decided to modify my interface to expose the function I need and let the implementation worry about casting where necessary. Thanks, Daniel On Tue, Jul 23, 2013 at 9:58 AM, Dan Retzlaff dretzl...@gmail.com wrote: @Inject the implementation, not the interface. @Inject'd implementations have some code smell, but no more than downcasting. On Tue, Jul 23, 2013 at 8:40 AM, Daniel Watrous dwmaill...@gmail.com wrote: That being the case, is there any way to get an instance that I can cast to a concrete type? On Tue, Jul 23, 2013 at 9:27 AM, Martin Grigorov mgrigo...@apache.org wrote: Hi, On Tue, Jul 23, 2013 at 6:20 PM, Daniel Watrous dwmaill...@gmail.com wrote: Hi, I'm having an issue that I suspect is related to the wicket integration with Guice. Any help is appreciated. I have a Page class that uses field injection to inject a DAO. I then want to cast my DAO to a more specific type (what I inject is the interface). Here's what that looks like public class CnavModify extends ConsoleBasePage { @Inject private CnavUrlDAO cnavUrlDAO; public CnavModify(PageParameters parameters) { super(parameters); if (parameters.get(cnavid).toString() != null) { cnavid = new ObjectId(parameters.get(cnavid).toString()); } if (cnavid != null) { cnavUrlModel = new DetachableCnavUrlModel(((MorphiaCnavUrlDAO)cnavUrlDAO).getCnavById(cnavid)); } } } When I try to cast it I get the following error: Last cause: $Proxy23 cannot be cast to com.hp.honeybadger.persistence.dao.morphia.MorphiaCnavUrlDAO I am able to use the CnavUrlDAO as a CnavUrlDAO, but its type is $Proxy23 and I am unable to cast it to a concrete type. Is this Guice or Wicket related? Any idea how to get around this? It is an error in your assumption. Wicket injects a proxy that implements CnavUrlDAO but knows nothing about the specific implementation about this interface. Whenever the proxy is used it delegates the call to the bean/service returned by Guice's injector (something like: Injector.getBinding(CnavUrlDAO.class).doSomething()). Thanks, Daniel