Author: ehillenius Date: Tue Jun 5 12:09:45 2007 New Revision: 544597 URL: http://svn.apache.org/viewvc?view=rev&rev=544597 Log: changed multiply implementation to reflect better pattern
Modified: incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/forminput/Multiply.java Modified: incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/forminput/Multiply.java URL: http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/forminput/Multiply.java?view=diff&rev=544597&r1=544596&r2=544597 ============================================================================== --- incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/forminput/Multiply.java (original) +++ incubator/wicket/trunk/jdk-1.5/wicket-examples/src/main/java/org/apache/wicket/examples/forminput/Multiply.java Tue Jun 5 12:09:45 2007 @@ -98,13 +98,17 @@ } /** - * @see org.apache.wicket.markup.html.form.FormComponent#updateModel() + * @see org.apache.wicket.markup.html.form.FormComponent#getConvertedInput() */ - public void updateModel() + @Override + public Object getConvertedInput() { - // note that form components are updated in post order form, so lhs and - // rhs are already updated - setModelObject(new Integer(lhs * rhs)); + // note that earlier versions did override updateModel, which looked + // somewhat better, but wasn't useful for when you want to do + // validations with either normal validators or form validators + Integer lhs = (Integer)left.getConvertedInput(); + Integer rhs = (Integer)right.getConvertedInput(); + return lhs * rhs; } private void init()