Re: TextFieldInteger
I just whipped up a test, this is working - at least on 1.4.1 FormVoid form = new FormVoid(form); add(form); final TextFieldInteger textInt = new TextFieldInteger(textInt, new ModelInteger()); textInt.setType(Integer.class); form.add(textInt); I did not get any errors casting to Long. I even added a feedback panel and put in alpha characters. It properly came back stated that ...'abc' is not a valid Integer. On Mon, Jul 26, 2010 at 1:21 AM, dferguson doug...@douglasferguson.us wrote: When I supply Integer as the type, i get an error cannot cast Long to Integer D/ On Jul 22, 2010, at 5:01 PM, Josh Glassman wrote: There is also a constructor that will take a Class type as a parameter. On Thu, Jul 22, 2010 at 3:11 PM, T Ames tamesw...@gmail.com wrote: I think you have to use the setType(Integer.class) method on the TextField object. setType public final FormComponent file:///C:/Downloads/Java/wicket/apache-wicket-1.4.1/apidocs/org/apache/wicket/markup/html/form/FormComponent.htmlT file:///C:/Downloads/Java/wicket/apache-wicket-1.4.1/apidocs/org/apache/wicket/markup/html/form/FormComponent.html *setType*(java.lang.Class? type) Sets the type that will be used when updating the model for this component. If no type is specified String type is assumed. *Parameters:*type - *Returns:*this for chaining On Thu, Jul 22, 2010 at 1:50 PM, Douglas Ferguson doug...@douglasferguson.us wrote: Has anybody succesfully used TextFieldInteger? I get an runtime exception trying to cast String to Integer. If supply (Integer.class) to the constructor then it is trying to case Long to Integer. D/ - 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: TextFieldInteger
If I take out the setType method, still no cast error, but the Integer checking is not done - feedback panel does not receive an error. On Mon, Jul 26, 2010 at 9:23 AM, T Ames tamesw...@gmail.com wrote: I just whipped up a test, this is working - at least on 1.4.1 FormVoid form = new FormVoid(form); add(form); final TextFieldInteger textInt = new TextFieldInteger(textInt, new ModelInteger()); textInt.setType(Integer.class); form.add(textInt); I did not get any errors casting to Long. I even added a feedback panel and put in alpha characters. It properly came back stated that ...'abc' is not a valid Integer. On Mon, Jul 26, 2010 at 1:21 AM, dferguson doug...@douglasferguson.us wrote: When I supply Integer as the type, i get an error cannot cast Long to Integer D/ On Jul 22, 2010, at 5:01 PM, Josh Glassman wrote: There is also a constructor that will take a Class type as a parameter. On Thu, Jul 22, 2010 at 3:11 PM, T Ames tamesw...@gmail.com wrote: I think you have to use the setType(Integer.class) method on the TextField object. setType public final FormComponent file:///C:/Downloads/Java/wicket/apache-wicket-1.4.1/apidocs/org/apache/wicket/markup/html/form/FormComponent.htmlT file:///C:/Downloads/Java/wicket/apache-wicket-1.4.1/apidocs/org/apache/wicket/markup/html/form/FormComponent.html *setType*(java.lang.Class? type) Sets the type that will be used when updating the model for this component. If no type is specified String type is assumed. *Parameters:*type - *Returns:*this for chaining On Thu, Jul 22, 2010 at 1:50 PM, Douglas Ferguson doug...@douglasferguson.us wrote: Has anybody succesfully used TextFieldInteger? I get an runtime exception trying to cast String to Integer. If supply (Integer.class) to the constructor then it is trying to case Long to Integer. D/ - 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: TextFieldInteger
When I supply Integer as the type, i get an error cannot cast Long to Integer D/ On Jul 22, 2010, at 5:01 PM, Josh Glassman wrote: There is also a constructor that will take a Class type as a parameter. On Thu, Jul 22, 2010 at 3:11 PM, T Ames tamesw...@gmail.com wrote: I think you have to use the setType(Integer.class) method on the TextField object. setType public final FormComponent file:///C:/Downloads/Java/wicket/apache-wicket-1.4.1/apidocs/org/apache/wicket/markup/html/form/FormComponent.htmlT file:///C:/Downloads/Java/wicket/apache-wicket-1.4.1/apidocs/org/apache/wicket/markup/html/form/FormComponent.html *setType*(java.lang.Class? type) Sets the type that will be used when updating the model for this component. If no type is specified String type is assumed. *Parameters:*type - *Returns:*this for chaining On Thu, Jul 22, 2010 at 1:50 PM, Douglas Ferguson doug...@douglasferguson.us wrote: Has anybody succesfully used TextFieldInteger? I get an runtime exception trying to cast String to Integer. If supply (Integer.class) to the constructor then it is trying to case Long to Integer. D/ - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
Re: TextFieldInteger
impossible there is so such thing as ParameterizedType for the example you give.. if you do: TextFieldInteger field = new TextFieldInteger(); then at runtime that information isnt there anymore. Its gone. welcome to type erasure.. I think stuff like that is only there if you do: class MyTextField extends TextFieldInteger { } but then you can already do that just fine in the constructor yourself.. (calling setType)) johan On Fri, Jul 23, 2010 at 00:17, avrahamr avrah...@gmail.com wrote: I've encontered the same problem and it took me a while to figure it out why. So maybe it's a good idea to make it automatic on the framework, On all TextFieldE constructors without the type parameter we should call setType() like this: setType((Class?) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0]); Too complicated?? On Fri, Jul 23, 2010 at 1:02 AM, Josh Glassman [via Apache Wicket] ml-node+2299461-894925024-293...@n4.nabble.comml-node%2b2299461-894925024-293...@n4.nabble.com wrote: There is also a constructor that will take a Class type as a parameter. On Thu, Jul 22, 2010 at 3:11 PM, T Ames [hidden email]http://user/SendEmail.jtp?type=nodenode=2299461i=0 wrote: I think you have to use the setType(Integer.class) method on the TextField object. setType public final FormComponent file:///C:/Downloads/Java/wicket/apache-wicket-1.4.1/apidocs/org/apache/wicket/markup/html/form/FormComponent.htmlT file:///C:/Downloads/Java/wicket/apache-wicket-1.4.1/apidocs/org/apache/wicket/markup/html/form/FormComponent.html *setType*(java.lang.Class? type) Sets the type that will be used when updating the model for this component. If no type is specified String type is assumed. *Parameters:*type - *Returns:*this for chaining On Thu, Jul 22, 2010 at 1:50 PM, Douglas Ferguson [hidden email] http://user/SendEmail.jtp?type=nodenode=2299461i=1 wrote: Has anybody succesfully used TextFieldInteger? I get an runtime exception trying to cast String to Integer. If supply (Integer.class) to the constructor then it is trying to case Long to Integer. D/ -- View message @ http://apache-wicket.1842946.n4.nabble.com/TextField-Integer-tp2299053p2299461.html To start a new topic under Wicket - User, email ml-node+1842947-1647783149-293...@n4.nabble.comml-node%2b1842947-1647783149-293...@n4.nabble.com To unsubscribe from Wicket - User, click herehttp://apache-wicket.1842946.n4.nabble.com/subscriptions/Unsubscribe.jtp?code=YXZyYWhhbXJAZ21haWwuY29tfDE4NDI5NDd8LTEwNzY0NzQ1ODc=. -- []'s Avraham Rosenzweig avrah...@gmail.com -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/TextField-Integer-tp2299053p2299478.html Sent from the Wicket - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org For additional commands, e-mail: users-h...@wicket.apache.org
TextFieldInteger
Has anybody succesfully used TextFieldInteger? I get an runtime exception trying to cast String to Integer. If supply (Integer.class) to the constructor then it is trying to case Long to Integer. D/
Re: TextFieldInteger
I think you have to use the setType(Integer.class) method on the TextField object. setType public final FormComponent file:///C:/Downloads/Java/wicket/apache-wicket-1.4.1/apidocs/org/apache/wicket/markup/html/form/FormComponent.htmlT file:///C:/Downloads/Java/wicket/apache-wicket-1.4.1/apidocs/org/apache/wicket/markup/html/form/FormComponent.html *setType*(java.lang.Class? type) Sets the type that will be used when updating the model for this component. If no type is specified String type is assumed. *Parameters:*type - *Returns:*this for chaining On Thu, Jul 22, 2010 at 1:50 PM, Douglas Ferguson doug...@douglasferguson.us wrote: Has anybody succesfully used TextFieldInteger? I get an runtime exception trying to cast String to Integer. If supply (Integer.class) to the constructor then it is trying to case Long to Integer. D/
Re: TextFieldInteger
There is also a constructor that will take a Class type as a parameter. On Thu, Jul 22, 2010 at 3:11 PM, T Ames tamesw...@gmail.com wrote: I think you have to use the setType(Integer.class) method on the TextField object. setType public final FormComponent file:///C:/Downloads/Java/wicket/apache-wicket-1.4.1/apidocs/org/apache/wicket/markup/html/form/FormComponent.htmlT file:///C:/Downloads/Java/wicket/apache-wicket-1.4.1/apidocs/org/apache/wicket/markup/html/form/FormComponent.html *setType*(java.lang.Class? type) Sets the type that will be used when updating the model for this component. If no type is specified String type is assumed. *Parameters:*type - *Returns:*this for chaining On Thu, Jul 22, 2010 at 1:50 PM, Douglas Ferguson doug...@douglasferguson.us wrote: Has anybody succesfully used TextFieldInteger? I get an runtime exception trying to cast String to Integer. If supply (Integer.class) to the constructor then it is trying to case Long to Integer. D/
Re: TextFieldInteger
I've encontered the same problem and it took me a while to figure it out why. So maybe it's a good idea to make it automatic on the framework, On all TextFieldE constructors without the type parameter we should call setType() like this: setType((Class?) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0]); Too complicated?? On Fri, Jul 23, 2010 at 1:02 AM, Josh Glassman [via Apache Wicket] ml-node+2299461-894925024-293...@n4.nabble.comml-node%2b2299461-894925024-293...@n4.nabble.com wrote: There is also a constructor that will take a Class type as a parameter. On Thu, Jul 22, 2010 at 3:11 PM, T Ames [hidden email]http://user/SendEmail.jtp?type=nodenode=2299461i=0 wrote: I think you have to use the setType(Integer.class) method on the TextField object. setType public final FormComponent file:///C:/Downloads/Java/wicket/apache-wicket-1.4.1/apidocs/org/apache/wicket/markup/html/form/FormComponent.htmlT file:///C:/Downloads/Java/wicket/apache-wicket-1.4.1/apidocs/org/apache/wicket/markup/html/form/FormComponent.html *setType*(java.lang.Class? type) Sets the type that will be used when updating the model for this component. If no type is specified String type is assumed. *Parameters:*type - *Returns:*this for chaining On Thu, Jul 22, 2010 at 1:50 PM, Douglas Ferguson [hidden email] http://user/SendEmail.jtp?type=nodenode=2299461i=1 wrote: Has anybody succesfully used TextFieldInteger? I get an runtime exception trying to cast String to Integer. If supply (Integer.class) to the constructor then it is trying to case Long to Integer. D/ -- View message @ http://apache-wicket.1842946.n4.nabble.com/TextField-Integer-tp2299053p2299461.html To start a new topic under Wicket - User, email ml-node+1842947-1647783149-293...@n4.nabble.comml-node%2b1842947-1647783149-293...@n4.nabble.com To unsubscribe from Wicket - User, click herehttp://apache-wicket.1842946.n4.nabble.com/subscriptions/Unsubscribe.jtp?code=YXZyYWhhbXJAZ21haWwuY29tfDE4NDI5NDd8LTEwNzY0NzQ1ODc=. -- []'s Avraham Rosenzweig avrah...@gmail.com -- View this message in context: http://apache-wicket.1842946.n4.nabble.com/TextField-Integer-tp2299053p2299478.html Sent from the Wicket - User mailing list archive at Nabble.com.