Re: Russian localization
On Thu, Mar 6, 2008 at 3:16 PM, Juha Alatalo [EMAIL PROTECTED] wrote: Hi, Russian language supports seems to be broken. Calling getString() causes class cast exception (stack trace in the end of the mail). Removing file org\apache\wicket\Application_ru.xml seems to be fixing the provlem. Should I create a jire issue for that? Yes please. I don't think the solution is to remove the file but instead fix the problem itself. :-) Frank
Re: bug or feature in FormTester while setting a value on a form?
Please create a jira issue for it. We are planning to redo the testing part of wicket to make it consistent and up-to-date for 1.4/2.0. Frank On Thu, Mar 6, 2008 at 2:29 PM, Wojciech Biela [EMAIL PROTECTED] wrote: Hey It looks like a bug but it's so obvious I suspect it's a feature not a bug, a feature I yet have learn to appreciate. When I assert a value on a component and the path is invalid (either the component is not there or I misspelled the path) the assertion fails. This is fine. When I try to set a value of a component and the path is invalid the method returns without any complaints. So now I have to double every set with an assert to be sure I'm setting a value to an existing component. Why the extra work? regards -- Wojtek Biela - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Junit required for WicketTester?
In 1.3 WicketTester is the Junit implementation of BaseWicketTester. Frank On Fri, Mar 7, 2008 at 3:33 PM, reikje [EMAIL PROTECTED] wrote: Do you have to have junit.jar in the classpath if you want to use WicketTester? We are using TestNG here and in a regular TestNG test case (where the class is annotated with @Test), I get java.lang.NoClassDefFoundError: junit/framework/AssertionFailedError. -- View this message in context: http://www.nabble.com/Junit-required-for-WicketTester--tp15892202p15892202.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]
Re: append a converter or coversion function
Override the getConverter() method. First call super and with that result call the special one (camel casing?) On 3/9/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello: I wonder how to append a converter or java method to a component so that I would affect what is already defined. For example, I want camelize a TextField(or some customized subclass) so that after the converter already defined completes the conversion (regardless what has been done in the chain) , I could use the added converted/method to make the final conversion to my need. The example I am seeing appears to overide and only one can be defined for a component, unlike validators, that I could add a chain of them. Let me know if I am wrong about this. Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DropDownChoice getting value into the model
This has to work yes, the only thing is do build up the new Model(states) as States so the same type of object as vendor.state returns. On 3/7/08, Kai Mutz [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: It is nice to know I'm not the only one struggling with DropDownChoices. I'm new to Wicket and I'm pretty far with rebuilding an application we are using internally. Has anybody proposed an alternative or a wrapper to DropDownChoices? Have you tried something like: Vendor vendor = (Vendor) vendorModel.getObject(); DropDownChoice stateFC = new DropDownChoice(state, new PropertyModel(vendor, state), new Model(states), choiceRenderer); This should work. Kai - 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: DropDownChoice getting value into the model
No it works also good, exactly the same if you where using the swing combobox. The problem that you have is that when you have an id (integer) in your object model that needs to be set but thagt id is the id of a Person then i think your object model is just plain wrong. Its not an object model at all its just direct sql/resultset mapping instead of a real pojo model. On 3/7/08, Vitaly Tsaplin [EMAIL PROTECTED] wrote: The DropDownBox component is in fact well designed in theory. But I think the way it works is a bit inconvenient in practice. Normally the main purpose of this component in to supply some value or an index for a model but a label is needed only for to be presented to a user. Unfortunately we are supposed to use either the same value (a string representation) for both pupposes or to use some kind of a wrapper and to pollute the model by some strange SelectOption object even though that the model would normally accept an integer. Vitaly - 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: append a converter or coversion function
Thanks. I will give a try, although I wish there would be something like component.add(IPostConverteToObject or IPostConverttoString) that would not require subclass and also allow easy reuse of what is available. A related question, after conversion is done, Can I do something like below class MyTextField extend TextField{ @Override setModel(model){ MySpeicalProcessing(model) // after this model object is changed to what I want super.setModel(model) } } The javadoc said it WARNING: DO NOT OVERRIDE THIS METHOD UNLESS YOU HAVE A VERY GOOD REASON FOR IT. OVERRIDING THIS MIGHT OPEN UP SECURITY LEAKS AND BREAK BACK-BUTTON SUPPORT. Also, would wicket gurantee that after the conversion, it would only call setModel(model) instead of being able to use other means to update the model value such as setModelObject. If allowed, then the above method could fail mysteriously. Thanks Override the getConverter() method. First call super and with that result call the special one (camel casing?) On 3/9/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello: I wonder how to append a converter or java method to a component so that I would affect what is already defined. For example, I want camelize a TextField(or some customized subclass) so that after the converter already defined completes the conversion (regardless what has been done in the chain) , I could use the added converted/method to make the final conversion to my need. The example I am seeing appears to overide and only one can be defined for a component, unlike validators, that I could add a chain of them. Let me know if I am wrong about this. Thanks - 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: append a converter or coversion function
Such a method would waste memory space. The current way is fine to chain converters you could do this globally if you want SetModel is only called by you when you construct it. Not when the dat is set from the browser the setModelObject is called or getModel().setObject() On 3/9/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Thanks. I will give a try, although I wish there would be something like component.add(IPostConverteToObject or IPostConverttoString) that would not require subclass and also allow easy reuse of what is available. A related question, after conversion is done, Can I do something like below class MyTextField extend TextField{ @Override setModel(model){ MySpeicalProcessing(model) // after this model object is changed to what I want super.setModel(model) } } The javadoc said it WARNING: DO NOT OVERRIDE THIS METHOD UNLESS YOU HAVE A VERY GOOD REASON FOR IT. OVERRIDING THIS MIGHT OPEN UP SECURITY LEAKS AND BREAK BACK-BUTTON SUPPORT. Also, would wicket gurantee that after the conversion, it would only call setModel(model) instead of being able to use other means to update the model value such as setModelObject. If allowed, then the above method could fail mysteriously. Thanks Override the getConverter() method. First call super and with that result call the special one (camel casing?) On 3/9/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello: I wonder how to append a converter or java method to a component so that I would affect what is already defined. For example, I want camelize a TextField(or some customized subclass) so that after the converter already defined completes the conversion (regardless what has been done in the chain) , I could use the added converted/method to make the final conversion to my need. The example I am seeing appears to overide and only one can be defined for a component, unlike validators, that I could add a chain of them. Let me know if I am wrong about this. Thanks - 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: Junit required for WicketTester?
On 3/9/08, Frank Bille [EMAIL PROTECTED] wrote: In 1.3 WicketTester is the Junit implementation of BaseWicketTester. I don't think that will pose any problems. TestNG (and Maven Surefire) is supposed to be able to run JUnit-based tests (using JUnit asserts) just fine. As long as your test classes have the @Test annotations, you should be ok. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: append a converter or coversion function
Below is a custom component with overrding the getConverter for testing purpose. As you could see, it is plain simple one with simple output debugging. But it is not working. the getConverter is called (output here) but the convertToObject never called (no there) I basically cut and paste the WicketinAction example. What I am doing wrong here? public class RequiredUppperCaseTextField extends TextField { public RequiredUppperCaseTextField(String id) { super(id); setRequired(true); } @Override public final IConverter getConverter(Class arg000){ System.out.println(here+ arg0); IConverter icAppend = new IConverter(){ public Object convertToObject(String arg0, Locale arg1) { System.out.println(there+ arg0); String s = sss; return s; } public String convertToString(Object arg0, Locale arg1) { return (String)arg0; } }; return icAppend; } } Override the getConverter() method. First call super and with that result call the special one (camel casing?) On 3/9/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello: I wonder how to append a converter or java method to a component so that I would affect what is already defined. For example, I want camelize a TextField(or some customized subclass) so that after the converter already defined completes the conversion (regardless what has been done in the chain) , I could use the added converted/method to make the final conversion to my need. The example I am seeing appears to overide and only one can be defined for a component, unlike validators, that I could add a chain of them. Let me know if I am wrong about this. Thanks - 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: append a converter or coversion function
call setTYpe(String.class) on the textfield or use that constructor with the type param does that help? On Sun, Mar 9, 2008 at 1:35 PM, [EMAIL PROTECTED] wrote: Below is a custom component with overrding the getConverter for testing purpose. As you could see, it is plain simple one with simple output debugging. But it is not working. the getConverter is called (output here) but the convertToObject never called (no there) I basically cut and paste the WicketinAction example. What I am doing wrong here? public class RequiredUppperCaseTextField extends TextField { public RequiredUppperCaseTextField(String id) { super(id); setRequired(true); } @Override public final IConverter getConverter(Class arg000){ System.out.println(here+ arg0); IConverter icAppend = new IConverter(){ public Object convertToObject(String arg0, Locale arg1) { System.out.println(there+ arg0); String s = sss; return s; } public String convertToString(Object arg0, Locale arg1) { return (String)arg0; } }; return icAppend; } } Override the getConverter() method. First call super and with that result call the special one (camel casing?) On 3/9/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello: I wonder how to append a converter or java method to a component so that I would affect what is already defined. For example, I want camelize a TextField(or some customized subclass) so that after the converter already defined completes the conversion (regardless what has been done in the chain) , I could use the added converted/method to make the final conversion to my need. The example I am seeing appears to overide and only one can be defined for a component, unlike validators, that I could add a chain of them. Let me know if I am wrong about this. Thanks - 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]
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]
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?
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. -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]
wicketstuff-scriptaculous TypeError: Effect has no properties
hi I am using wicket 1.3 with latest dev build of wicketstuff-scriptaculous. I am trying to use highlight effect on table row when user clicks a link. It doesn't work and ajax debug shows *ERROR: *Exception evaluating javascript: TypeError: Effect has no properties. And sometimes it starts to work if I simply redeploy EAR file. It's very strange. Maris *INFO: * ?xml version=1.0 encoding=UTF-8?ajax-responsecomponent id=resultDetailsPanel11 ![CDATA[div id=resultDetailsPanel11 class=contentDiv h1Detaļas/h1 table border=0 id=detailsTable ... /table /div]]/componentevaluate![CDATA[new Effect.Highlight('id524', {} ); ]]/evaluate/ajax-response *INFO: *Response parsed. Now invoking steps... *ERROR: *Exception evaluating javascript: TypeError: Effect has no properties /** * * */ public class ColumnLinkPanel extends Panel { public ColumnLinkPanel(String id, final IModel model) { super(id); Image icon = new Image(detailsIcon,new ResourceReference(ColumnLinkPanel.class,doc.png)); AjaxLink ajaxLink = new AjaxLink(detailsLink) { @Override public void onClick(AjaxRequestTarget target) { ResultDetailsPanel newPanel = new ResultDetailsPanel(resultDetailsPanel,model); findParent(MainPage.class).get(resultDetailsPanel).replaceWith(newPanel.setOutputMarkupId(true)); target.addComponent(newPanel); *target.appendJavascript(new Effect.Highlight(findParent(OddEvenItem.class)).toJavascript()); * } }; add(ajaxLink.add(icon)); } } public class MainPage extends BasePage { public MainPage() { add(new FeedbackPanel(feedbackPanel).setOutputMarkupId(true)); * add(ScriptaculousAjaxBehavior.newJavascriptBindingBehavior());* } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
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]
Re: append a converter or coversion function
i thought we agreed converters were type converters...so they shouldnt be invoked if you are doing string-string :| -igor On Sun, Mar 9, 2008 at 5:47 AM, Johan Compagner [EMAIL PROTECTED] wrote: call setTYpe(String.class) on the textfield or use that constructor with the type param does that help? On Sun, Mar 9, 2008 at 1:35 PM, [EMAIL PROTECTED] wrote: Below is a custom component with overrding the getConverter for testing purpose. As you could see, it is plain simple one with simple output debugging. But it is not working. the getConverter is called (output here) but the convertToObject never called (no there) I basically cut and paste the WicketinAction example. What I am doing wrong here? public class RequiredUppperCaseTextField extends TextField { public RequiredUppperCaseTextField(String id) { super(id); setRequired(true); } @Override public final IConverter getConverter(Class arg000){ System.out.println(here+ arg0); IConverter icAppend = new IConverter(){ public Object convertToObject(String arg0, Locale arg1) { System.out.println(there+ arg0); String s = sss; return s; } public String convertToString(Object arg0, Locale arg1) { return (String)arg0; } }; return icAppend; } } Override the getConverter() method. First call super and with that result call the special one (camel casing?) On 3/9/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello: I wonder how to append a converter or java method to a component so that I would affect what is already defined. For example, I want camelize a TextField(or some customized subclass) so that after the converter already defined completes the conversion (regardless what has been done in the chain) , I could use the added converted/method to make the final conversion to my need. The example I am seeing appears to overide and only one can be defined for a component, unlike validators, that I could add a chain of them. Let me know if I am wrong about this. Thanks - 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?
true..! You could add it to wicket input events , if it fits.. regards Nino James Carman 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. -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] -- -Wicket for love -Jme for fun 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]
Re: Default Focus Behavior?
What about a chaining component? EG you enter something in form.field a, and when thats filled then it jumps to form field b..? Etc... regards Nino James Carman 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. -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] -- -Wicket for love -Jme for fun 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]
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: append a converter or coversion function
if you set the type yourself by hand then getConverter() will be called and you can do what ever you want We dont do that automatic yes (resolveType doesn't set it to the String.class) johan On Sun, Mar 9, 2008 at 5:45 PM, Igor Vaynberg [EMAIL PROTECTED] wrote: i thought we agreed converters were type converters...so they shouldnt be invoked if you are doing string-string :| -igor On Sun, Mar 9, 2008 at 5:47 AM, Johan Compagner [EMAIL PROTECTED] wrote: call setTYpe(String.class) on the textfield or use that constructor with the type param does that help? On Sun, Mar 9, 2008 at 1:35 PM, [EMAIL PROTECTED] wrote: Below is a custom component with overrding the getConverter for testing purpose. As you could see, it is plain simple one with simple output debugging. But it is not working. the getConverter is called (output here) but the convertToObject never called (no there) I basically cut and paste the WicketinAction example. What I am doing wrong here? public class RequiredUppperCaseTextField extends TextField { public RequiredUppperCaseTextField(String id) { super(id); setRequired(true); } @Override public final IConverter getConverter(Class arg000){ System.out.println(here+ arg0); IConverter icAppend = new IConverter(){ public Object convertToObject(String arg0, Locale arg1) { System.out.println(there+ arg0); String s = sss; return s; } public String convertToString(Object arg0, Locale arg1) { return (String)arg0; } }; return icAppend; } } Override the getConverter() method. First call super and with that result call the special one (camel casing?) On 3/9/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello: I wonder how to append a converter or java method to a component so that I would affect what is already defined. For example, I want camelize a TextField(or some customized subclass) so that after the converter already defined completes the conversion (regardless what has been done in the chain) , I could use the added converted/method to make the final conversion to my need. The example I am seeing appears to overide and only one can be defined for a component, unlike validators, that I could add a chain of them. Let me know if I am wrong about this. Thanks - 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?
jwcarman wrote: 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();); } } This simply looks great ! I think this should make it into the core Wicket behaviors as the componenet focus is quite useful. Cheers. -- View this message in context: http://www.nabble.com/Default-Focus-Behavior--tp15934889p15945036.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]
Re: Default Focus Behavior?
-1 for letting components handle focus. There's only _one_ focus that can set on a page at a time. What if several components demand focus? Who will be the winner? Also, not every WebComponent can receive focus (Label, Image, ...) but only FormComponents (input, select, button, ...) I vote for a method like: WebPage#setFocus(FormComponent component) class WebPage { private FormComponent focus; public final void setFocus(FormComponent component) { focus = component; focus.setOutputMarkupId(true); } public void renderHead(IHeaderResponse response) { if (focus != null) { final String item = String.format(document.getElementById('%s'), focus.getMarkupId()); final String js = String.format(%s.focus(); try { %s.select() } catch( /* ignore */ ), item); response.renderOnDomReadyJavascript(js); } } } Regards Peter Am 09.03.2008 um 20:04 schrieb djo.mos: jwcarman wrote: 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();); } } This simply looks great ! I think this should make it into the core Wicket behaviors as the componenet focus is quite useful. Cheers. -- View this message in context: http://www.nabble.com/Default-Focus-Behavior--tp15934889p15945036.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: DropDownChoice getting value into the model
Hi Vitaly, That is correct. For primitive model values you need something like a map. I think the DropDownBox was more designed for complex data where the data to display is embedded in the model value itself. Anyway, how would the addition of an index argument to the display method help? Regards, Erik. Vitaly Tsaplin schreef: Hi everyone, Hi Erik, I am sorry for so late post. But am going to go back to our DropDownChoice discussion. If you suggest me to create a list of integers and use a special renderer implementation to retrieve a displayable value you should take into account that in case if we have a list of indices we can easily look up in an array or a list using an index. But if we have a list of unordered integers for example to do such a lookup we need to create a map and search this map every time we render a single option. That comes from the fact that a relationship between a value and its displayable equivalent is not obvious for a renderer. So I would ask to add an index of an options being rendered to the getDisplayValue method. Vitaly - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DropDownChoice getting value into the model
An index is a kind of a link between a value and its displayable representation. Having an index in getDisplayValue method we would do something like: ListInteger lang_choices = Arrays.asList (new Object [] { 1, 2, 4, 8 }); Object [] lang_labels = new Object [] { php, perl, java, c++ }; public Object getDisplayValue (Object object, int index) { return lang_labels [index]; } public String getValueId (Object object, int index) { return String.valueOf (object); } It should be more efficient then to do a map lookup for every option especially in case of a long option list. Personally I think that things could be more simple and logical with less faceless model. I mean having a model which is based on an interface (not a simple single object container) like in swing or tapestry would help. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Default Focus Behavior?
On 3/9/08, Peter Ertl [EMAIL PROTECTED] wrote: -1 for letting components handle focus. There's only _one_ focus that can set on a page at a time. What if several components demand focus? Who will be the winner? Well, the last one that requests it will win because it will be the last javascript statement executed. The components themselves aren't requesting focus. The person who puts the page/form together is requesting that the component be the one focused. If they're dumb enough to try to set focus on more than one form component, then that's what they'll get. This isn't for every situation, obviously, but it could be helpful for many. Also, not every WebComponent can receive focus (Label, Image, ...) but only FormComponents (input, select, button, ...) True, I might add some logic into the bind() method to throw an exception if you pass in a component that can't be focused (a non FormComponent maybe?). I vote for a method like: WebPage#setFocus(FormComponent component) class WebPage { private FormComponent focus; public final void setFocus(FormComponent component) { focus = component; focus.setOutputMarkupId(true); } public void renderHead(IHeaderResponse response) { if (focus != null) { final String item = String.format(document.getElementById('%s'), focus.getMarkupId()); final String js = String.format(%s.focus(); try { %s.select() } catch( /* ignore */ ), item); response.renderOnDomReadyJavascript(js); } } } I still like my way better. ;-) - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Default Focus Behavior?
I don't think I understand what you mean here. Do you mean something like setting the tab order like in Swing? On 3/9/08, Nino Saturnino Martinez Vazquez Wael [EMAIL PROTECTED] wrote: What about a chaining component? EG you enter something in form.field a, and when thats filled then it jumps to form field b..? Etc... regards Nino James Carman 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. -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] -- -Wicket for love -Jme for fun 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Default Focus Behavior?
On 3/9/08, djo.mos [EMAIL PROTECTED] wrote: This simply looks great ! I think this should make it into the core Wicket behaviors as the componenet focus is quite useful. Me too! That's why I submitted: https://issues.apache.org/jira/browse/WICKET-1404 I was pretty surprised something didn't exist for this already. I don't mean any offense by that at all. It's just that it seems like every time I think to myself there should be a way to do x with Wicket, there's already something for that! This Wicket stuff is pretty cool! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Default Focus Behavior?
I think he means that, suppose you have a username and password field; then if the username is already filled in (e.g. from a cookie), then focus should go to the next field (password field). It probably should be the same as the tab order (first empty field in tab order gets focus) from a ui perspective... Regards, Sebastiaan James Carman wrote: I don't think I understand what you mean here. Do you mean something like setting the tab order like in Swing? On 3/9/08, Nino Saturnino Martinez Vazquez Wael [EMAIL PROTECTED] wrote: What about a chaining component? EG you enter something in form.field a, and when thats filled then it jumps to form field b..? Etc... regards Nino James Carman 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. -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] -- -Wicket for love -Jme for fun 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] smime.p7s Description: S/MIME Cryptographic Signature
Re: Default Focus Behavior?
On 3/9/08, Sebastiaan van Erk [EMAIL PROTECTED] wrote: I think he means that, suppose you have a username and password field; then if the username is already filled in (e.g. from a cookie), then focus should go to the next field (password field). Well, since you set up the behavior in your Java code, couldn't you decide which item gets the focus there? I realize that could be tedious for a large form, but I'm sure a nice helper method could get the job done pretty easily. - 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]
AjaxBehaviour how to question
How can i write an ajax behaviour which does not have its own callback, but just appends javascript to an existing AjaxRequestTarget. I want this so that i can write a fading feed back panel, which will be added to AjaxRequestTarget of an ajax form submission. What I want is something like this:: *the behaviour---* public class AjaxFadeBehaviour extends AbstractAjaxBehavior{ private IModel fadingNeededIModel; public AjaxFadeBehaviour() { super(); } /** * Use a boolean value wrapped in an IModel to know if fading effect is needed. * This can be useful in situations for example when info messages need to fade away while error messages need not. * @param fadingNeededIModel */ public AjaxFadeBehaviour(IModel fadingNeededIModel) { super(); this.fadingNeededIModel = fadingNeededIModel; } public void onRequest() { System.out.println(on request called); if(fadingNeededIModel!=null){ if(Strings.isTrue((String) fadingNeededIModel.getObject())) ((AjaxRequestTarget)RequestCycle.get().getRequestTarget()).appendJavascript(new Effect.Fade($(' + getComponent().getMarkupId() + '));); } } } *the feedback component --- *public class AjaxFadingFeedbackPanel extends FeedbackPanel{ public AjaxFadingFeedbackPanel(String id, IFeedbackMessageFilter filter) { super(id, filter); setOutputMarkupId(true); final AbstractReadOnlyModel fadingNeededModel=new AbstractReadOnlyModel(){ @Override public Object getObject() { return anyMessage(FeedbackMessage.INFO); } }; add(new AjaxFadeBehaviour(fadingNeededModel)); } public AjaxFadingFeedbackPanel(String id) { this(id,null); } } I am not able to achieve this because onRequest() does not get called for AjaxFadeBehaviour. I am confused about which class I should extend to achieve this??
Re: Intention of PropertyModel in 1.3
Just to follow up on this... You're right, it does still work. The thing is that during the algorithm when the properties of the bean are being tested the entire exception stack is being printed out. This is a bit confusing because it can lead the developer to think that an error occurred. I propose to log information instead of printing out the entire exception stack. If you agree to this, I don't mind submitting a patch. dml On Wed, 2008-02-13 at 09:38 -0800, Igor Vaynberg wrote: hmm, this should still work. mind filing a jira bug with a quickstart? -igor On Feb 13, 2008 12:00 AM, David Leangen [EMAIL PROTECTED] wrote: Hello! I'm (finally!) migrating to 1.3, so have a few wrinkles to iron out. Is somebody able to tell me the intention of the PropertyModel? I'm wondering if something has changed, or if I just wasn't using it correctly before... In one of my panels, I use this type of property: PropertyModel languageModel = new PropertyModel( this, language ); And in the same class, I have a getter like this: public String getLanguage() { return getSession().getLocale().getLanguage(); } There is no setter and no language property. This used to work in 1.2.6, but now 1.3.1 complains that there is no setter for this class. Now, I don't even _want_ a setter, but just to see what happens, I add in a dummy setter, but wicket still complains that it can't find a language property. Am I not using the PropertyModel correctly (i.e. according to what PropertyModel is intended for)? (If so, this means that I've been using it incorrectly for many months without noticing, since it used to work.) Or, should I be using some other type of model for this? Thanx! Dave - 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: append a converter or coversion function
I used the trick it worked great. Thanks very much. Should it be considered a bug? What is interesting before using setType is that getConverter is actually called (from my simple tracing), but after that its methods were not called (I guess somewhere it learned the modelobject was a String so it simply call the built-in converter. I'd think if the getConverter is overriden, its methods should be called regardless of what type was it. Besides, UppercaseString is a special Type so it does not conflict with the rules. (Any custom converter could be considered to target a special type even though it could be just uppercasing or prepend a * to the string) Built-in converter might follow the default rules but if custom converter is provided, wicket should totally depend on the custom converter to do whatever it does. Anyway, thanks again. if you set the type yourself by hand then getConverter() will be called and you can do what ever you want We dont do that automatic yes (resolveType doesn't set it to the String.class) johan On Sun, Mar 9, 2008 at 5:45 PM, Igor Vaynberg [EMAIL PROTECTED] wrote: i thought we agreed converters were type converters...so they shouldnt be invoked if you are doing string-string :| -igor On Sun, Mar 9, 2008 at 5:47 AM, Johan Compagner [EMAIL PROTECTED] wrote: call setTYpe(String.class) on the textfield or use that constructor with the type param does that help? On Sun, Mar 9, 2008 at 1:35 PM, [EMAIL PROTECTED] wrote: Below is a custom component with overrding the getConverter for testing purpose. As you could see, it is plain simple one with simple output debugging. But it is not working. the getConverter is called (output here) but the convertToObject never called (no there) I basically cut and paste the WicketinAction example. What I am doing wrong here? public class RequiredUppperCaseTextField extends TextField { public RequiredUppperCaseTextField(String id) { super(id); setRequired(true); } @Override public final IConverter getConverter(Class arg000){ System.out.println(here+ arg0); IConverter icAppend = new IConverter(){ public Object convertToObject(String arg0, Locale arg1) { System.out.println(there+ arg0); String s = sss; return s; } public String convertToString(Object arg0, Locale arg1) { return (String)arg0; } }; return icAppend; } } Override the getConverter() method. First call super and with that result call the special one (camel casing?) On 3/9/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello: I wonder how to append a converter or java method to a component so that I would affect what is already defined. For example, I want camelize a TextField(or some customized subclass) so that after the converter already defined completes the conversion (regardless what has been done in the chain) , I could use the added converted/method to make the final conversion to my need. The example I am seeing appears to overide and only one can be defined for a component, unlike validators, that I could add a chain of them. Let me know if I am wrong about this. Thanks - 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]