Author: tv Date: Sun Apr 8 07:53:23 2007 New Revision: 526566 URL: http://svn.apache.org/viewvc?view=rev&rev=526566 Log: Merged some cleanups from Turbine 2.3
Modified: jakarta/turbine/fulcrum/trunk/intake/src/dtd/intake.dtd jakarta/turbine/fulcrum/trunk/intake/src/java/org/apache/fulcrum/intake/model/DoubleField.java jakarta/turbine/fulcrum/trunk/intake/src/java/org/apache/fulcrum/intake/model/Field.java jakarta/turbine/fulcrum/trunk/intake/src/java/org/apache/fulcrum/intake/model/FloatField.java jakarta/turbine/fulcrum/trunk/intake/src/java/org/apache/fulcrum/intake/validator/DefaultValidator.java Modified: jakarta/turbine/fulcrum/trunk/intake/src/dtd/intake.dtd URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/intake/src/dtd/intake.dtd?view=diff&rev=526566&r1=526565&r2=526566 ============================================================================== Binary files - no diff available. Modified: jakarta/turbine/fulcrum/trunk/intake/src/java/org/apache/fulcrum/intake/model/DoubleField.java URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/intake/src/java/org/apache/fulcrum/intake/model/DoubleField.java?view=diff&rev=526566&r1=526565&r2=526566 ============================================================================== --- jakarta/turbine/fulcrum/trunk/intake/src/java/org/apache/fulcrum/intake/model/DoubleField.java (original) +++ jakarta/turbine/fulcrum/trunk/intake/src/java/org/apache/fulcrum/intake/model/DoubleField.java Sun Apr 8 07:53:23 2007 @@ -83,10 +83,10 @@ /** * Provides access to emptyValue such that the value returned will be * acceptable as an argument parameter to Method.invoke. Subclasses - * that deal with primitive types should ensure that they return an - * appropriate value wrapped in the object wrapper class for the + * that deal with primitive types should ensure that they return an + * appropriate value wrapped in the object wrapper class for the * primitive type. - * + * * @return the value to use when the field is empty or an Object that * wraps the empty value for primitive types. */ @@ -98,7 +98,7 @@ } else { - return (null == getEmptyValue()) + return (null == getEmptyValue()) ? new Double(0.0) : getEmptyValue(); } } @@ -138,4 +138,5 @@ : (Double) getEmptyValue()); } } + } Modified: jakarta/turbine/fulcrum/trunk/intake/src/java/org/apache/fulcrum/intake/model/Field.java URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/intake/src/java/org/apache/fulcrum/intake/model/Field.java?view=diff&rev=526566&r1=526565&r2=526566 ============================================================================== --- jakarta/turbine/fulcrum/trunk/intake/src/java/org/apache/fulcrum/intake/model/Field.java (original) +++ jakarta/turbine/fulcrum/trunk/intake/src/java/org/apache/fulcrum/intake/model/Field.java Sun Apr 8 07:53:23 2007 @@ -250,7 +250,7 @@ Rule reqRule = (Rule) field.getRuleMap().get("required"); if (reqRule != null) { - alwaysRequired = new Boolean(reqRule.getValue()).booleanValue(); + alwaysRequired = Boolean.valueOf(reqRule.getValue()).booleanValue(); ifRequiredMessage = reqRule.getMessage(); } @@ -811,6 +811,20 @@ } /** + * Calls toString() on the object returned by getValue(), + * unless null; and then it returns "", the empty String. + * Escapes " characters to be able to display these + * in HTML form fields. + * + * @return a <code>String</code> value + */ + public String getHTMLString() + { + String res = toString(); + return StringUtils.replace(res, "\"", """); + } + + /** * Loads the valid value from a bean * * @throws IntakeException indicates a problem during the execution of the @@ -1021,7 +1035,7 @@ */ public String getStringValue() { - return this.toString(); + return this.toString(); } } Modified: jakarta/turbine/fulcrum/trunk/intake/src/java/org/apache/fulcrum/intake/model/FloatField.java URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/intake/src/java/org/apache/fulcrum/intake/model/FloatField.java?view=diff&rev=526566&r1=526565&r2=526566 ============================================================================== --- jakarta/turbine/fulcrum/trunk/intake/src/java/org/apache/fulcrum/intake/model/FloatField.java (original) +++ jakarta/turbine/fulcrum/trunk/intake/src/java/org/apache/fulcrum/intake/model/FloatField.java Sun Apr 8 07:53:23 2007 @@ -81,12 +81,12 @@ } /** - * Provides access to emptyValue such that the value returned will be + * Provides access to emptyValue such that the value returned will be * acceptable as an argument parameter to Method.invoke. Subclasses - * that deal with primitive types should ensure that they return an - * appropriate value wrapped in the object wrapper class for the + * that deal with primitive types should ensure that they return an + * appropriate value wrapped in the object wrapper class for the * primitive type. - * + * * @return the value to use when the field is empty or an Object that * wraps the empty value for primitive types. */ @@ -98,7 +98,7 @@ } else { - return (null == getEmptyValue()) + return (null == getEmptyValue()) ? new Float(0.0) : getEmptyValue(); } } @@ -138,5 +138,5 @@ : getEmptyValue()); } } - + } Modified: jakarta/turbine/fulcrum/trunk/intake/src/java/org/apache/fulcrum/intake/validator/DefaultValidator.java URL: http://svn.apache.org/viewvc/jakarta/turbine/fulcrum/trunk/intake/src/java/org/apache/fulcrum/intake/validator/DefaultValidator.java?view=diff&rev=526566&r1=526565&r2=526566 ============================================================================== --- jakarta/turbine/fulcrum/trunk/intake/src/java/org/apache/fulcrum/intake/validator/DefaultValidator.java (original) +++ jakarta/turbine/fulcrum/trunk/intake/src/java/org/apache/fulcrum/intake/validator/DefaultValidator.java Sun Apr 8 07:53:23 2007 @@ -106,7 +106,7 @@ if (constraint != null) { String param = constraint.getValue(); - required = new Boolean(param).booleanValue(); + required = Boolean.valueOf(param).booleanValue(); requiredMessage = constraint.getMessage(); } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]