You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by aw...@apache.org on 2007/05/22 22:47:58 UTC
svn commit: r540746 - in /myfaces/trinidad/trunk/trinidad:
trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/
trinidad-api/src/main/xrts/org/apache/myfaces/trinidad/resource/
trinidad-build/src/main/resources/META-INF/maven-faces-plugin/...
Author: awiner
Date: Tue May 22 13:47:57 2007
New Revision: 540746
URL: http://svn.apache.org/viewvc?view=rev&rev=540746
Log:
TRINIDAD-30: tr:validateLength does not send range message to client
TRINIDAD-31: Custom messages on tr:validateLength are not used
TRINIDAD-32: tr:validateLength messages are poor: don't refer to length
TRINIDAD-33: tr:lengthValidator: provide better error message when min==max
- Add an EXACT message to LengthValidator to compliment NOT_IN_RANGE when min==max, and
add corresponding tag attribute to customize this per instance
- Improve the .js validator to support showing the range message (and the new EXACT
message)
- Improve the code that sends down the .js string to not send down Integer.MAX_VALUE
(send null instead), and to not send down any messages that are irrelevant given
the min and max choice set on the validator
- Improve the Javadoc and tagdoc for validateLength to refer to length instead of value
- Fix the logic in LengthValidator for when to show the range message
- Overhaul the "preferred" metadata for validator properties
- Overhaul the messages for LengthValidator to make sense for string length (as opposed to
integer values)
- Fix capitalization of "Too" in summary messages
- Fix awkward message for long range/double range NOT_IN_RANGE ("on or between" doesn't
make sense for integers)
- Improve general Map marshalling to JS to not send null values
Modified:
myfaces/trinidad/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/LengthValidator.java
myfaces/trinidad/trunk/trinidad/trinidad-api/src/main/xrts/org/apache/myfaces/trinidad/resource/MessageBundle.xrts
myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/validators/trinidad/ByteLength.xml
myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/validators/trinidad/DateRestriction.xml
myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/validators/trinidad/DateTimeRange.xml
myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/validators/trinidad/DoubleRange.xml
myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/validators/trinidad/Length.xml
myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/validators/trinidad/LongRange.xml
myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/validators/trinidad/RegExp.xml
myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/jsLibs/XhtmlScriptletFactory.java
myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/JsonUtils.java
myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/LengthValidator.java
myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/CoreFormat.js
Modified: myfaces/trinidad/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/LengthValidator.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/LengthValidator.java?view=diff&rev=540746&r1=540745&r2=540746
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/LengthValidator.java (original)
+++ myfaces/trinidad/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/LengthValidator.java Tue May 22 13:47:57 2007
@@ -33,7 +33,7 @@
import org.apache.myfaces.trinidad.util.MessageFactory;
/**
- * <p>Implementation for <code>java.lang.Integer</code> values.</p>
+ * <p>Implementation for length of <code>java.lang.String</code> values.</p>
*
*/
public class LengthValidator extends javax.faces.validator.LengthValidator
@@ -43,21 +43,21 @@
/**
* <p>The message identifier of the {@link javax.faces.application.FacesMessage}
- * to be created if the maximum value check fails. The message format
+ * to be created if the maximum length check fails. The message format
* string for this message may optionally include <code>{0}</code>,
* <code>{1}</code> and <code>{3}</code> placeholders,
* which will be replaced by user input, component label and configured
- * maximum value.</p>
+ * maximum length.</p>
*/
public static final String MAXIMUM_MESSAGE_ID =
"org.apache.myfaces.trinidad.validator.LengthValidator.MAXIMUM";
/**
* <p>The message identifier of the {@link javax.faces.application.FacesMessage}
- * to be created if the minimum value check fails. The message format
+ * to be created if the minimum length check fails. The message format
* string for this message may optionally include <code>{0}</code>,
* <code>{1}</code> and <code>{2}</code> placeholders, which will be replaced
- * by user input, component label and configured minimum value.</p>
+ * by user input, component label and configured minimum length.</p>
*/
public static final String MINIMUM_MESSAGE_ID =
"org.apache.myfaces.trinidad.validator.LengthValidator.MINIMUM";
@@ -65,16 +65,29 @@
/**
* <p>The message identifier of the {@link javax.faces.application.FacesMessage}
- * to be created if the maximum or minimum value check fails, and both
- * the maximum and minimum values for this validator have been set.
+ * to be created if the maximum or minimum length check fails, and both
+ * the maximum and minimum lengths for this validator have been set.
* The message format string for this message may optionally include
* <code>{0}</code>, <code>{1}</code>, <code>{2}</code> and <code>{3}</code>
* placeholders, which will be replaced by user input, component label,
- * configured minimum value and configured maximum value.</p>
+ * configured minimum length and configured maximum length.</p>
*/
public static final String NOT_IN_RANGE_MESSAGE_ID =
"org.apache.myfaces.trinidad.validator.LengthValidator.NOT_IN_RANGE";
+ /**
+ * <p>The message identifier of the {@link javax.faces.application.FacesMessage}
+ * to be created if the maximum and minimum lengths are the same,
+ * and the length check fails, and both
+ * the maximum and minimum values for this validator have been set.
+ * The message format string for this message may optionally include
+ * <code>{0}</code>, <code>{1}</code>, <code>{2}</code>
+ * placeholders, which will be replaced by user input, component label,
+ * configured minimum/maximum length.</p>
+ */
+ public static final String EXACT_MESSAGE_ID =
+ "org.apache.myfaces.trinidad.validator.LengthValidator.EXACT";
+
/**
* Construct a {@link Validator} with no preconfigured limits.
@@ -88,7 +101,7 @@
* Construct a {@link Validator} with the specified preconfigured
* limit.
*
- * @param maximum Maximum value to allow
+ * @param maximum Maximum length to allow
*/
public LengthValidator(int maximum)
{
@@ -99,8 +112,8 @@
* Construct a {@link Validator} with the specified preconfigured
* limits.
*
- * @param maximum Maximum value to allow
- * @param minimum Minimum value to allow
+ * @param maximum Maximum length to allow
+ * @param minimum Minimum length to allow
*
*/
public LengthValidator(int maximum, int minimum)
@@ -109,7 +122,7 @@
}
/**
- * Return the maximum value to be enforced by this {@link
+ * Return the maximum length to be enforced by this {@link
* Validator} or null if it has not been
* set.
*/
@@ -117,15 +130,15 @@
public int getMaximum()
{
Object maxInt = _facesBean.getProperty(_MAXIMUM_KEY);
- if(maxInt == null)
- maxInt = Integer.MAX_VALUE;
+ if (maxInt == null)
+ maxInt = _MAXIMUM_KEY.getDefault();
return ComponentUtils.resolveInteger(maxInt);
}
/**
- * Set the maximum value to be enforced by this {@link Validator}.
+ * Set the maximum length to be enforced by this {@link Validator}.
*
- * @param maximum The new maximum value
+ * @param maximum The new maximum length
*
*/
@Override
@@ -137,7 +150,7 @@
/**
- * Return the minimum value to be enforced by this {@link
+ * Return the minimum length to be enforced by this {@link
* Validator}, or null if it has not been
* set.
*/
@@ -145,13 +158,15 @@
public int getMinimum()
{
Object minInt = _facesBean.getProperty(_MINIMUM_KEY);
+ if (minInt == null)
+ minInt = _MINIMUM_KEY.getDefault();
return ComponentUtils.resolveInteger(minInt);
}
/**
- * Set the minimum value to be enforced by this {@link Validator}.
+ * Set the minimum length to be enforced by this {@link Validator}.
*
- * @param minimum The new minimum value
+ * @param minimum The new minimum length
*
*/
@Override
@@ -163,7 +178,7 @@
/**
* <p>Custom error message to be used, for creating detail part of the
- * {@link FacesMessage}, when input value exceeds the maximum value set.</p>
+ * {@link FacesMessage}, when input length exceeds the maximum length set.</p>
* Overrides detail message identified by message id {@link #MAXIMUM_MESSAGE_ID}
* @param maximumMessageDetail Custom error message.
*/
@@ -174,7 +189,7 @@
/**
* <p>Return custom detail error message that was set for creating {@link FacesMessage},
- * for cases where input value exceeds the <code>maximum</code> value set.</p>
+ * for cases where input length exceeds the <code>maximum</code> length set.</p>
* @return Custom error message.
* @see #setMessageDetailMaximum(String)
*/
@@ -186,8 +201,8 @@
/**
* <p>Custom error message to be used, for creating detail part of the
- * {@link FacesMessage}, when input value is less the set
- * <code>minimum</code> value.</p>
+ * {@link FacesMessage}, when input length is less the set
+ * <code>minimum</code> length.</p>
* Overrides detail message identified by message id {@link #MINIMUM_MESSAGE_ID}
* @param minimumMessageDetail Custom error message.
*/
@@ -198,7 +213,7 @@
/**
* <p>Return custom detail error message that was set for creating {@link FacesMessage},
- * for cases where, input value is less than the <code>minimum</code> value set.</p>
+ * for cases where, input length is less than the <code>minimum</code> length set.</p>
* @return Custom error message.
* @see #setMessageDetailMinimum(String)
*/
@@ -210,7 +225,7 @@
/**
* <p>Custom error message to be used, for creating detail part of the
- * {@link FacesMessage}, when input value is not with in the range,
+ * {@link FacesMessage}, when input length is not with in the range,
* when <code>minimum</code> and <code>maximum</code> is set.</p>
* Overrides detail message identified by message id {@link #NOT_IN_RANGE_MESSAGE_ID}
* @param notInRangeMessageDetail Custom error message.
@@ -222,8 +237,8 @@
/**
* <p>Return custom detail error message that was set for creating {@link FacesMessage},
- * for cases where, input value exceeds the <code>maximum</code> value and is
- * less than the <code>minimum</code> value set.</p>
+ * for cases where, input length exceeds the <code>maximum</code> length and is
+ * less than the <code>minimum</code> length set.</p>
* @return Custom error message.
* @see #setMessageDetailNotInRange(String)
*/
@@ -232,6 +247,34 @@
Object notInRngMsg = _facesBean.getProperty(_NOT_IN_RANGE_MESSAGE_DETAIL_KEY);
return ComponentUtils.resolveString(notInRngMsg);
}
+
+
+ /**
+ * <p>Custom error message to be used, for creating detail part of the
+ * {@link FacesMessage},
+ * for cases where the maximum and minimum lengths are the same, and
+ * the input length does not match.
+ * Overrides detail message identified by message id {@link #EXACT_MESSAGE_ID}
+ * @param exactMessageDetail Custom error message.
+ */
+ public void setMessageDetailExact(String exactMessageDetail)
+ {
+ _facesBean.setProperty(_EXACT_MESSAGE_DETAIL_KEY, exactMessageDetail);
+ }
+
+ /**
+ * <p>Return custom detail error message that was set for creating {@link FacesMessage},
+ * for cases where the maximum and minimum lengths are the same, and
+ * the input length does not match.</p>
+ * @return Custom error message.
+ * @see #setMessageDetailExact(String)
+ */
+ public String getMessageDetailExact()
+ {
+ Object msg = _facesBean.getProperty(_EXACT_MESSAGE_DETAIL_KEY);
+ return ComponentUtils.resolveString(msg);
+ }
+
/**
* <p>Custom hint maximum message.</p>
@@ -295,6 +338,28 @@
Object obj = _facesBean.getProperty(_HINT_NOT_IN_RANGE);
return ComponentUtils.resolveString(obj);
}
+
+
+ /**
+ * <p>Custom hint exact message.</p>
+ * Overrides default hint message
+ * @param hintExact Custom hint message.
+ */
+ public void setHintExact(String hintExact)
+ {
+ _facesBean.setProperty(_HINT_EXACT, hintExact);
+ }
+
+ /**
+ * <p>Return custom hint exact message.</p>
+ * @return Custom hint message.
+ * @see #setHintExact
+ */
+ public String getHintExact()
+ {
+ Object obj = _facesBean.getProperty(_HINT_EXACT);
+ return ComponentUtils.resolveString(obj);
+ }
@Override
public void validate(
@@ -309,45 +374,31 @@
}
catch (ValidatorException ve)
{
-
- if (value != null && value instanceof Number)
+ // We don't really care about the value. It
+ // failed validation in the superclass, so we just
+ // care about what sort of message to show
+ int min = getMinimum();
+ int max = getMaximum();
+
+ // FIXME: the default of max should be zero, not MAX_VALUE,
+ // at least according to the superclass
+ if (max != Integer.MAX_VALUE)
{
- int intValue = ((Number)value).intValue();
-
- long min = getMinimum();
- long max = getMaximum();
-
- if (intValue > max)
+ if (min > 0)
{
- if (min == Integer.MIN_VALUE)//the default...
- {
- throw new ValidatorException
- (_getNotInRangeMessage(context, component, value, IntegerUtils.getString(min), IntegerUtils.getString(max)));
- }
- else
- {
- throw new ValidatorException
- (_getMaximumMessage(context, component, value, IntegerUtils.getString(max)));
- }
+ throw new ValidatorException(
+ _getNotInRangeMessage(context, component, value, min, max));
}
-
- if (intValue < min)
+ else
{
- if (max == Integer.MAX_VALUE)//the default...
- {
- throw new ValidatorException
- (_getNotInRangeMessage(context, component, value, IntegerUtils.getString(min), IntegerUtils.getString(max)));
- }
- else
- {
- FacesMessage msg = _getMinimumMessage(context, component, value, IntegerUtils.getString(min));
- throw new ValidatorException(msg);
- }
+ throw new ValidatorException(
+ _getMaximumMessage(context, component, value, max));
}
}
else
{
- throw ve;
+ throw new ValidatorException(
+ _getMinimumMessage(context, component, value, min));
}
}
}
@@ -414,81 +465,113 @@
_transientValue = transientValue;
}
+
private FacesMessage _getNotInRangeMessage(
FacesContext context,
UIComponent component,
Object value,
Object min,
Object max)
- {
- Object msg = _getRawNotInRangeMessageDetail();
- Object label = ValidatorUtils.getComponentLabel(component);
-
- Object[] params = {label, value, min, max};
-
- return MessageFactory.getMessage(context, NOT_IN_RANGE_MESSAGE_ID,
- msg, params, component);
- }
-
+ {
+ if (min.equals(max))
+ return _getExactMessage(context, component, value, min);
+ Object msg = _getRawNotInRangeMessageDetail();
+ Object label = ValidatorUtils.getComponentLabel(component);
- private Object _getRawNotInRangeMessageDetail()
- {
- return _facesBean.getRawProperty(_NOT_IN_RANGE_MESSAGE_DETAIL_KEY);
- }
-
-
- private FacesMessage _getMaximumMessage(
- FacesContext context,
- UIComponent component,
- Object value,
- Object max)
- {
-
- Object msg = _getRawMaximumMessageDetail();
- Object label = ValidatorUtils.getComponentLabel(component);
-
- Object[] params = {label, value, max};
+ Object[] params = {label, value, min, max};
+
+ return MessageFactory.getMessage(context, NOT_IN_RANGE_MESSAGE_ID,
+ msg, params, component);
+ }
- return MessageFactory.getMessage(context,
- MAXIMUM_MESSAGE_ID,
- msg,
- params,
- component);
- }
+
+ private Object _getRawNotInRangeMessageDetail()
+ {
+ return _facesBean.getRawProperty(_NOT_IN_RANGE_MESSAGE_DETAIL_KEY);
+ }
- private Object _getRawMaximumMessageDetail()
- {
- return _facesBean.getRawProperty(_MAXIMUM_MESSAGE_DETAIL_KEY);
- }
- private FacesMessage _getMinimumMessage(
+ private FacesMessage _getExactMessage(
FacesContext context,
UIComponent component,
Object value,
- Object min)
- {
- Object msg = _getRawMinimumMessageDetail();
- Object label = ValidatorUtils.getComponentLabel(component);
-
- Object[] params = {label, value, min};
-
- return MessageFactory.getMessage(context, MINIMUM_MESSAGE_ID,
- msg, params, component);
- }
-
- private Object _getRawMinimumMessageDetail()
- {
- return _facesBean.getRawProperty(_MINIMUM_MESSAGE_DETAIL_KEY);
- }
+ Object minMax)
+ {
+ Object msg = _getRawExactMessageDetail();
+ Object label = ValidatorUtils.getComponentLabel(component);
+
+ Object[] params = {label, value, minMax};
+
+ return MessageFactory.getMessage(context, EXACT_MESSAGE_ID,
+ msg, params, component);
+ }
+
+ private Object _getRawExactMessageDetail()
+ {
+ return _facesBean.getRawProperty(_EXACT_MESSAGE_DETAIL_KEY);
+ }
+
+
+ private FacesMessage _getMaximumMessage(
+ FacesContext context,
+ UIComponent component,
+ Object value,
+ Object max)
+ {
+
+ Object msg = _getRawMaximumMessageDetail();
+ Object label = ValidatorUtils.getComponentLabel(component);
+
+ Object[] params = {label, value, max};
+
+ return MessageFactory.getMessage(context,
+ MAXIMUM_MESSAGE_ID,
+ msg,
+ params,
+ component);
+ }
+
+ private Object _getRawMaximumMessageDetail()
+ {
+ return _facesBean.getRawProperty(_MAXIMUM_MESSAGE_DETAIL_KEY);
+ }
+
+ private FacesMessage _getMinimumMessage(
+ FacesContext context,
+ UIComponent component,
+ Object value,
+ Object min)
+ {
+ Object msg = _getRawMinimumMessageDetail();
+ Object label = ValidatorUtils.getComponentLabel(component);
+
+ Object[] params = {label, value, min};
+
+ return MessageFactory.getMessage(context, MINIMUM_MESSAGE_ID,
+ msg, params, component);
+ }
+
+ private Object _getRawMinimumMessageDetail()
+ {
+ return _facesBean.getRawProperty(_MINIMUM_MESSAGE_DETAIL_KEY);
+ }
+
private static final FacesBean.Type _TYPE = new FacesBean.Type();
-
+
+ // Default is zero, not MIN_VALUE
private static final PropertyKey _MINIMUM_KEY =
- _TYPE.registerKey("minimum", Integer.class);
+ _TYPE.registerKey("minimum",
+ Integer.class,
+ // Don't rely on autoboxing: there's a method overload
+ Integer.valueOf(0));
+ // FIXME: the default of the superclass is 0, not MAX_VALUE
private static final PropertyKey _MAXIMUM_KEY =
- _TYPE.registerKey("maximum", Integer.class);
+ _TYPE.registerKey("maximum", Integer.class,
+ // Don't rely on autoboxing: there's a method overload
+ Integer.valueOf(Integer.MAX_VALUE));
private static final PropertyKey _MAXIMUM_MESSAGE_DETAIL_KEY =
_TYPE.registerKey("messageDetailMaximum", String.class);
@@ -499,6 +582,9 @@
private static final PropertyKey _NOT_IN_RANGE_MESSAGE_DETAIL_KEY =
_TYPE.registerKey("messageDetailNotInRange", String.class);
+ private static final PropertyKey _EXACT_MESSAGE_DETAIL_KEY =
+ _TYPE.registerKey("messageDetailExact", String.class);
+
private static final PropertyKey _HINT_MAXIMUM_KEY =
_TYPE.registerKey("hintMaximum", String.class);
@@ -507,6 +593,9 @@
private static final PropertyKey _HINT_NOT_IN_RANGE =
_TYPE.registerKey("hintNotInRange", String.class);
+
+ private static final PropertyKey _HINT_EXACT =
+ _TYPE.registerKey("hintExact", String.class);
private FacesBean _facesBean = ValidatorUtils.getFacesBean(_TYPE);
Modified: myfaces/trinidad/trunk/trinidad/trinidad-api/src/main/xrts/org/apache/myfaces/trinidad/resource/MessageBundle.xrts
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-api/src/main/xrts/org/apache/myfaces/trinidad/resource/MessageBundle.xrts?view=diff&rev=540746&r1=540745&r2=540746
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-api/src/main/xrts/org/apache/myfaces/trinidad/resource/MessageBundle.xrts (original)
+++ myfaces/trinidad/trunk/trinidad/trinidad-api/src/main/xrts/org/apache/myfaces/trinidad/resource/MessageBundle.xrts Tue May 22 13:47:57 2007
@@ -74,9 +74,10 @@
<resource key="org.apache.myfaces.trinidad.validator.RangeValidator.MAXIMUM_HINT">Enter a value less than or equal to {0}.</resource>
<resource key="org.apache.myfaces.trinidad.validator.RangeValidator.MINIMUM_HINT">Enter a value greater than or equal to {0}.</resource>
<resource key="org.apache.myfaces.trinidad.validator.RangeValidator.RANGE_HINT">Enter a value between {0} and {1}.</resource>
- <resource key="org.apache.myfaces.trinidad.validator.LengthValidator.MAXIMUM_HINT">Enter a value less than or equal to {0}.</resource>
- <resource key="org.apache.myfaces.trinidad.validator.LengthValidator.MINIMUM_HINT">Enter a value greater than or equal to {0}.</resource>
- <resource key="org.apache.myfaces.trinidad.validator.LengthValidator.RANGE_HINT">Enter a value between {0} and {1}.</resource>
+ <resource key="org.apache.myfaces.trinidad.validator.LengthValidator.MAXIMUM_HINT">Enter a value of {0} or fewer characters.</resource>
+ <resource key="org.apache.myfaces.trinidad.validator.LengthValidator.MINIMUM_HINT">Enter a value of {0} or more characters.</resource>
+ <resource key="org.apache.myfaces.trinidad.validator.LengthValidator.EXACT_HINT">Enter a value of {0} characters.</resource>
+ <resource key="org.apache.myfaces.trinidad.validator.LengthValidator.RANGE_HINT">Enter a value of {0} to {1} characters.</resource>
<resource key="org.apache.myfaces.trinidad.validator.DateTimeRangeValidator.MAXIMUM_HINT">Enter a date before or on {0}.</resource>
<resource key="org.apache.myfaces.trinidad.validator.DateTimeRangeValidator.MINIMUM_HINT">Enter a date after or on {0}.</resource>
<resource key="org.apache.myfaces.trinidad.validator.DateTimeRangeValidator.RANGE_HINT">Enter a date between {0} and {1}.</resource>
@@ -93,13 +94,13 @@
<!-- {0} the label that identifies the component -->
<!-- {1} value entered by the user -->
<!-- {2} the minimum number allowed -->
- <resource key="javax.faces.validator.LongRangeValidator.MINIMUM">Value too Small</resource>
+ <resource key="javax.faces.validator.LongRangeValidator.MINIMUM">Value Too Small</resource>
<resource key="javax.faces.validator.LongRangeValidator.MINIMUM_detail">Enter a value greater than or equal to {2}.</resource>
<!-- {0} the label that identifies the component -->
<!-- {1} value entered by the user -->
<!-- {2} the maximum number allowed -->
- <resource key="javax.faces.validator.LongRangeValidator.MAXIMUM">Value too Large</resource>
+ <resource key="javax.faces.validator.LongRangeValidator.MAXIMUM">Value Too Large</resource>
<resource key="javax.faces.validator.LongRangeValidator.MAXIMUM_detail">Enter a value less than or equal to {2}.</resource>
<!-- {0} the label that identifies the component -->
@@ -117,7 +118,7 @@
<!-- {0} the label that identifies the component -->
<!-- {1} value entered by the user -->
<!-- {2} the maximum length -->
- <resource key="org.apache.myfaces.trinidad.validator.ByteLengthValidator.MAXIMUM">Value too long</resource>
+ <resource key="org.apache.myfaces.trinidad.validator.ByteLengthValidator.MAXIMUM">Value Too long</resource>
<resource
key="org.apache.myfaces.trinidad.validator.ByteLengthValidator.MAXIMUM_detail">The length of the value entered, "{1}", exceeds the maximum allowed byte length of {2}.</resource>
@@ -179,7 +180,7 @@
<!-- {1} value entered by the user -->
<!-- {2} represents the maximum allowed number -->
<resource
- key="org.apache.myfaces.trinidad.validator.DoubleRangeValidator.MAXIMUM">Value too Large</resource>
+ key="org.apache.myfaces.trinidad.validator.DoubleRangeValidator.MAXIMUM">Value Too Large</resource>
<resource
key="org.apache.myfaces.trinidad.validator.DoubleRangeValidator.MAXIMUM_detail">Enter a value less than or equal to {2}.</resource>
@@ -189,7 +190,7 @@
<!-- {1} represent Number which the user has set -->
<!-- {2} represents the minimum allowed number -->
<resource
- key="org.apache.myfaces.trinidad.validator.DoubleRangeValidator.MINIMUM">Value too Small</resource>
+ key="org.apache.myfaces.trinidad.validator.DoubleRangeValidator.MINIMUM">Value Too Small</resource>
<resource
key="org.apache.myfaces.trinidad.validator.DoubleRangeValidator.MINIMUM_detail">Enter a value greater than or equal to {2}.</resource>
@@ -200,42 +201,51 @@
<!-- {3} represents the maximum allowed number -->
<resource key="org.apache.myfaces.trinidad.validator.DoubleRangeValidator.NOT_IN_RANGE"> Value Outside Valid Range</resource>
- <resource key="org.apache.myfaces.trinidad.validator.DoubleRangeValidator.NOT_IN_RANGE_detail">Enter a value on or between {2} and {3}.</resource>
+ <resource key="org.apache.myfaces.trinidad.validator.DoubleRangeValidator.NOT_IN_RANGE_detail">Enter a value between {2} and {3}.</resource>
- <!-- Number exceeds number range error -->
+ <!-- Strign too long error -->
<!-- {0} the label that identifies the component -->
<!-- {1} value entered by the user -->
- <!-- {2} represents the maximum allowed number -->
+ <!-- {2} represents the maximum allowed length -->
<resource
- key="org.apache.myfaces.trinidad.validator.LengthValidator.MAXIMUM">Value too Large</resource>
+ key="org.apache.myfaces.trinidad.validator.LengthValidator.MAXIMUM">Value Too Long</resource>
<resource
- key="org.apache.myfaces.trinidad.validator.LengthValidator.MAXIMUM_detail"> Enter a value less than or equal to {2}.</resource>
+ key="org.apache.myfaces.trinidad.validator.LengthValidator.MAXIMUM_detail"> Enter a value of {2} or fewer characters.</resource>
- <!-- Number exceeds number range error -->
+ <!-- String too short error -->
<!-- {0} the label that identifies the component -->
- <!-- {1} represent Number which the user has set -->
- <!-- {2} represents the minimum allowed number -->
+ <!-- {1} value entered by the user -->
+ <!-- {2} represents the minimum allowed length -->
<resource
- key="org.apache.myfaces.trinidad.validator.LengthValidator.MINIMUM">Value too Small</resource>
+ key="org.apache.myfaces.trinidad.validator.LengthValidator.MINIMUM">Value Too Short</resource>
<resource
- key="org.apache.myfaces.trinidad.validator.LengthValidator.MINIMUM_detail"> Enter a value greater than or equal to {2}.</resource>
+ key="org.apache.myfaces.trinidad.validator.LengthValidator.MINIMUM_detail"> Enter a value of {2} or more characters.</resource>
- <!-- Number outside number range error -->
+ <!-- String outside length range error -->
<!-- {0} the label that identifies the component -->
<!-- {1} value entered by the user -->
- <!-- {2} represents the minimum allowed number -->
- <!-- {3} represents the maximum allowed number -->
- <resource key="org.apache.myfaces.trinidad.validator.LengthValidator.NOT_IN_RANGE"> Value Outside Valid Range</resource>
+ <!-- {2} represents the minimum allowed length -->
+ <!-- {3} represents the maximum allowed length -->
+ <resource key="org.apache.myfaces.trinidad.validator.LengthValidator.NOT_IN_RANGE">Value of Invalid Length</resource>
- <resource key="org.apache.myfaces.trinidad.validator.LengthValidator.NOT_IN_RANGE_detail">Enter a value on or between {2} and {3}.</resource>
+ <resource key="org.apache.myfaces.trinidad.validator.LengthValidator.NOT_IN_RANGE_detail">Enter a value of {2} to {3} characters.</resource>
+
+ <!-- String not of correct length error -->
+ <!-- {0} the label that identifies the component -->
+ <!-- {1} value entered by the user -->
+ <!-- {2} represents the required length -->
+ <resource
+ key="org.apache.myfaces.trinidad.validator.LengthValidator.EXACT">Value of Invalid Length</resource>
+ <resource
+ key="org.apache.myfaces.trinidad.validator.LengthValidator.EXACT_detail"> Enter a value of {2} characters.</resource>
<!-- Number exceeds number range error -->
<!-- {0} the label that identifies the component -->
<!-- {1} value entered by the user -->
<!-- {2} represents the maximum allowed number -->
<resource
- key="org.apache.myfaces.trinidad.validator.LongRangeValidator.MAXIMUM">Value too Large</resource>
+ key="org.apache.myfaces.trinidad.validator.LongRangeValidator.MAXIMUM">Value Too Large</resource>
<resource
key="org.apache.myfaces.trinidad.validator.LongRangeValidator.MAXIMUM_detail"> Enter a value less than or equal to {2}.</resource>
@@ -245,7 +255,7 @@
<!-- {1} represent Number which the user has set -->
<!-- {2} represents the minimum allowed number -->
<resource
- key="org.apache.myfaces.trinidad.validator.LongRangeValidator.MINIMUM">Value too Small</resource>
+ key="org.apache.myfaces.trinidad.validator.LongRangeValidator.MINIMUM">Value Too Small</resource>
<resource
key="org.apache.myfaces.trinidad.validator.LongRangeValidator.MINIMUM_detail"> Enter a value greater than or equal to {2}.</resource>
@@ -256,7 +266,7 @@
<!-- {3} represents the maximum allowed number -->
<resource key="org.apache.myfaces.trinidad.validator.LongRangeValidator.NOT_IN_RANGE"> Value Outside Valid Range</resource>
- <resource key="org.apache.myfaces.trinidad.validator.LongRangeValidator.NOT_IN_RANGE_detail">Enter a value on or between {2} and {3}.</resource>
+ <resource key="org.apache.myfaces.trinidad.validator.LongRangeValidator.NOT_IN_RANGE_detail">Enter a value between {2} and {3}.</resource>
<!-- Input does not match regular expression error -->
<!-- {0} the label that identifies the component -->
@@ -332,13 +342,13 @@
<!-- {0} the label that identifies the component -->
<!-- {1} value entered by the user -->
<!-- {2} the minimum number allowed -->
- <resource key="org.apache.myfaces.trinidad.convert.IntegerConverter.MINIMUM">Value too Small</resource>
+ <resource key="org.apache.myfaces.trinidad.convert.IntegerConverter.MINIMUM">Value Too Small</resource>
<resource key="org.apache.myfaces.trinidad.convert.IntegerConverter.MINIMUM_detail"> Enter a value greater than or equal to {2}.</resource>
<!-- {0} the label that identifies the component -->
<!-- {1} value entered by the user -->
<!-- {2} the maximum number allowed -->
- <resource key="org.apache.myfaces.trinidad.convert.IntegerConverter.MAXIMUM">Value too Large</resource>
+ <resource key="org.apache.myfaces.trinidad.convert.IntegerConverter.MAXIMUM">Value Too Large</resource>
<resource key="org.apache.myfaces.trinidad.convert.IntegerConverter.MAXIMUM_detail"> Enter a value less than or equal to {2}.</resource>
<!-- {0} the label that identifies the component -->
@@ -349,13 +359,13 @@
<!-- {0} the label that identifies the component -->
<!-- {1} value entered by the user -->
<!-- {2} the minimum number allowed -->
- <resource key="org.apache.myfaces.trinidad.convert.LongConverter.MINIMUM">Value too Small</resource>
+ <resource key="org.apache.myfaces.trinidad.convert.LongConverter.MINIMUM">Value Too Small</resource>
<resource key="org.apache.myfaces.trinidad.convert.LongConverter.MINIMUM_detail">Enter a value greater than or equal to {2}.</resource>
<!-- {0} the label that identifies the component -->
<!-- {1} value entered by the user -->
<!-- {2} the maximum number allowed -->
- <resource key="org.apache.myfaces.trinidad.convert.LongConverter.MAXIMUM">Value too Large</resource>
+ <resource key="org.apache.myfaces.trinidad.convert.LongConverter.MAXIMUM">Value Too Large</resource>
<resource key="org.apache.myfaces.trinidad.convert.LongConverter.MAXIMUM_detail">Enter a value less than or equal to {2}.</resource>
<!-- {0} the label that identifies the component -->
@@ -387,13 +397,13 @@
<!-- {0} the label that identifies the component -->
<!-- {1} value entered by the user -->
<!-- {2} the minimum number allowed -->
- <resource key="org.apache.myfaces.trinidad.convert.ShortConverter.MINIMUM">Value too Small</resource>
+ <resource key="org.apache.myfaces.trinidad.convert.ShortConverter.MINIMUM">Value Too Small</resource>
<resource key="org.apache.myfaces.trinidad.convert.ShortConverter.MINIMUM_detail">Enter a value greater than or equal to {2}.</resource>
<!-- {0} the label that identifies the component -->
<!-- {1} value entered by the user -->
<!-- {2} the maximum number allowed -->
- <resource key="org.apache.myfaces.trinidad.convert.ShortConverter.MAXIMUM">Value too Large</resource>
+ <resource key="org.apache.myfaces.trinidad.convert.ShortConverter.MAXIMUM">Value Too Large</resource>
<resource key="org.apache.myfaces.trinidad.convert.ShortConverter.MAXIMUM_detail">Enter a value less than or equal to {2}.</resource>
<!-- {0} the label that identifies the component -->
@@ -404,13 +414,13 @@
<!-- {0} the label that identifies the component -->
<!-- {1} value entered by the user -->
<!-- {2} the minimum number allowed -->
- <resource key="org.apache.myfaces.trinidad.convert.ByteConverter.MINIMUM">Value too Small</resource>
+ <resource key="org.apache.myfaces.trinidad.convert.ByteConverter.MINIMUM">Value Too Small</resource>
<resource key="org.apache.myfaces.trinidad.convert.ByteConverter.MINIMUM_detail">Enter a value greater than or equal to {2}.</resource>
<!-- {0} the label that identifies the component -->
<!-- {1} value entered by the user -->
<!-- {2} the maximum number allowed -->
- <resource key="org.apache.myfaces.trinidad.convert.ByteConverter.MAXIMUM">Value too Large</resource>
+ <resource key="org.apache.myfaces.trinidad.convert.ByteConverter.MAXIMUM">Value Too Large</resource>
<resource key="org.apache.myfaces.trinidad.convert.ByteConverter.MAXIMUM_detail">Enter a value less than or equal to {2}.</resource>
<!-- {0} the label that identifies the component -->
Modified: myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/validators/trinidad/ByteLength.xml
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/validators/trinidad/ByteLength.xml?view=diff&rev=540746&r1=540745&r2=540746
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/validators/trinidad/ByteLength.xml (original)
+++ myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/validators/trinidad/ByteLength.xml Tue May 22 13:47:57 2007
@@ -801,7 +801,6 @@
<mfp:validator-metadata>
<mfp:favorite-property>maximum</mfp:favorite-property>
</mfp:validator-metadata>
- <mfp:uix2-local-name>validateByteLength</mfp:uix2-local-name>
</validator-extension>
</validator>
</faces-config>
Modified: myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/validators/trinidad/DateRestriction.xml
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/validators/trinidad/DateRestriction.xml?view=diff&rev=540746&r1=540745&r2=540746
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/validators/trinidad/DateRestriction.xml (original)
+++ myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/validators/trinidad/DateRestriction.xml Tue May 22 13:47:57 2007
@@ -33,7 +33,11 @@
</description>
<property-name>invalidMonths</property-name>
<property-class>java.lang.String[]</property-class>
- <property-extension/>
+ <property-extension>
+ <mfp:property-metadata>
+ <mfp:preferred>true</mfp:preferred>
+ </mfp:property-metadata>
+ </property-extension>
</property>
<property>
@@ -43,7 +47,11 @@
</description>
<property-name>invalidDaysOfWeek</property-name>
<property-class>java.lang.String[]</property-class>
- <property-extension/>
+ <property-extension>
+ <mfp:property-metadata>
+ <mfp:preferred>true</mfp:preferred>
+ </mfp:property-metadata>
+ </property-extension>
</property>
<property>
@@ -84,11 +92,6 @@
</description>
<property-name>messageDetailInvalidMonths</property-name>
<property-class>java.lang.String</property-class>
- <property-extension>
- <mfp:property-metadata>
- <mfp:preferred>true</mfp:preferred>
- </mfp:property-metadata>
- </property-extension>
</property>
<property>
@@ -116,11 +119,6 @@
</description>
<property-name>messageDetailInvalidDaysOfWeek</property-name>
<property-class>java.lang.String</property-class>
- <property-extension>
- <mfp:property-metadata>
- <mfp:preferred>true</mfp:preferred>
- </mfp:property-metadata>
- </property-extension>
</property>
<property>
@@ -148,11 +146,6 @@
</description>
<property-name>messageDetailInvalidDays</property-name>
<property-class>java.lang.String</property-class>
- <property-extension>
- <mfp:property-metadata>
- <mfp:preferred>true</mfp:preferred>
- </mfp:property-metadata>
- </property-extension>
</property>
<validator-extension>
@@ -184,7 +177,6 @@
</mfp:source-code>
</mfp:example>
<mfp:author>Matthias Wessendorf</mfp:author>
- <mfp:uix2-local-name>validateDateTimeRange</mfp:uix2-local-name>
</validator-extension>
</validator>
-</faces-config>
\ No newline at end of file
+</faces-config>
Modified: myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/validators/trinidad/DateTimeRange.xml
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/validators/trinidad/DateTimeRange.xml?view=diff&rev=540746&r1=540745&r2=540746
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/validators/trinidad/DateTimeRange.xml (original)
+++ myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/validators/trinidad/DateTimeRange.xml Tue May 22 13:47:57 2007
@@ -1,179 +1,167 @@
-<?xml version="1.0" ?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
---><faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:tr="http://myfaces.apache.org/trinidad"
- xmlns:mfp="http://myfaces.apache.org/maven-faces-plugin">
- <validator>
- <description><![CDATA[Validate that the date entered is within a given range.]]></description>
- <display-name>validateDateTimeRange</display-name>
- <validator-id>org.apache.myfaces.trinidad.DateTimeRange</validator-id>
- <validator-class>org.apache.myfaces.trinidadinternal.validator.DateTimeRangeValidator</validator-class>
- <property>
- <description><![CDATA[the maximum java.util.Date.
- ISO 8601 date strings, of the form 'yyyy-MM-dd'
- (for example 2004-06-22) is also allowed.
- This will be parsed to date.]]>
- </description>
- <property-name>maximum</property-name>
- <property-class>java.util.Date</property-class>
- <property-extension/>
- </property>
- <property>
- <description><![CDATA[The minimum java.util.Date.
- ISO 8601 date strings, of the form 'yyyy-MM-dd'
- (for example 2004-06-22) are also allowed.
- This will be parsed to date.]]>
- </description>
- <property-name>minimum</property-name>
- <property-class>java.util.Date</property-class>
- <property-extension>
- <mfp:property-metadata>
- <mfp:preferred>true</mfp:preferred>
- </mfp:property-metadata>
- </property-extension>
- </property>
- <property>
- <description><![CDATA[<p>
- The detail error message to be used for constructing faces messages,
- when input value exceeds the <code>maximum</code> value
- set.
- </p>
- <p>
- <strong>
- Parameters:
- </strong>
- <ul>
- <li>
- {0} the label that identifies the component
- </li>
- <li>
- {1} value entered by the user
- </li>
- <li>
- {2} the maximum allowed date
- </li>
- </ul>
- </p>]]>
- </description>
- <property-name>messageDetailMaximum</property-name>
- <property-class>java.lang.String</property-class>
- <property-extension>
- <mfp:property-metadata>
- <mfp:preferred>true</mfp:preferred>
- </mfp:property-metadata>
- </property-extension>
- </property>
- <property>
- <description><![CDATA[<p>
- The detail error message to be used for constructing faces messages,
- when input value is less than the set <code>minimum</code>
- value.
- </p>
- <p>
- <strong>
- Parameters:
- </strong>
- <ul>
- <li>
- {0} the label that identifies the component
- </li>
- <li>
- {1} value entered by the user
- </li>
- <li>
- {2} the minimum allowed date
- </li>
- </ul>
- </p>]]>
- </description>
- <property-name>messageDetailMinimum</property-name>
- <property-class>java.lang.String</property-class>
- <property-extension>
- <mfp:property-metadata>
- <mfp:preferred>true</mfp:preferred>
- </mfp:property-metadata>
- </property-extension>
- </property>
- <property>
- <description><![CDATA[<p>
- The detail error message to be used for constructing faces messages,
- if input value is not with in the range, when
- <code>minimum</code> and <code>maximum</code> is
- set.
- </p>
- <p>
- <strong>
- Parameters:
- </strong>
- <ul>
- <li>
- {0} the label that identifies the component
- </li>
- <li>
- {1} value entered by the user
- </li>
- <li>
- {2} the minimum allowed date
- </li>
- <li>
- {3} the maximum allowed date
- </li>
- </ul>
- </p>]]>
- </description>
- <property-name>messageDetailNotInRange</property-name>
- <property-class>java.lang.String</property-class>
- <property-extension>
- <mfp:property-metadata>
- <mfp:preferred>true</mfp:preferred>
- </mfp:property-metadata>
- </property-extension>
- </property>
- <validator-extension>
- <mfp:tag-name>tr:validateDateTimeRange</mfp:tag-name>
- <mfp:tag-class>org.apache.myfaces.trinidadinternal.taglib.validator.ValidateDateTimeRangeTag</mfp:tag-class>
- <mfp:long-description><![CDATA[<html:p>
-
- Validate that the date entered is within a given range.
-</html:p>]]></mfp:long-description>
- <mfp:example>
- <mfp:source-code><![CDATA[<tr:inputDate id="mdf3" value="#{date.date3}"
- label="max validator">
- <tr:validateDateTimeRange maximum="#{date.maxDate}"/>
-</tr:inputDate>
-
-<tr:inputDate id="mdf3" value="2004-11-25"
- tip="min=2004-11-16 max=2004-12-16"
- label="Submission period">
- <tr:convertDateTime pattern="yyyy-MM-dd"/>
-
- <!-- Supports ISO date format strings of the form "yyyy-MM-dd" -->
- <tr:validateDateTimeRange
- minimum="2004-11-16"
- maximum="2004-12-16"
- messageDetailNotInRange="Date "{1}" does not fall within the range {2} : {3}"/>
-</tr:inputDate>]]>
- </mfp:source-code>
- </mfp:example>
- <mfp:author>Gabrielle Crawford</mfp:author>
- <mfp:uix2-local-name>validateDateTimeRange</mfp:uix2-local-name>
- </validator-extension>
- </validator>
+<?xml version="1.0" ?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+--><faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:tr="http://myfaces.apache.org/trinidad"
+ xmlns:mfp="http://myfaces.apache.org/maven-faces-plugin">
+ <validator>
+ <description><![CDATA[Validate that the date entered is within a given range.]]></description>
+ <display-name>validateDateTimeRange</display-name>
+ <validator-id>org.apache.myfaces.trinidad.DateTimeRange</validator-id>
+ <validator-class>org.apache.myfaces.trinidadinternal.validator.DateTimeRangeValidator</validator-class>
+ <property>
+ <description><![CDATA[the maximum java.util.Date.
+ ISO 8601 date strings, of the form 'yyyy-MM-dd'
+ (for example 2004-06-22) is also allowed.
+ This will be parsed to date.]]>
+ </description>
+ <property-name>maximum</property-name>
+ <property-class>java.util.Date</property-class>
+ <property-extension>
+ <mfp:property-metadata>
+ <mfp:preferred>true</mfp:preferred>
+ </mfp:property-metadata>
+ </property-extension>
+ </property>
+ <property>
+ <description><![CDATA[The minimum java.util.Date.
+ ISO 8601 date strings, of the form 'yyyy-MM-dd'
+ (for example 2004-06-22) are also allowed.
+ This will be parsed to date.]]>
+ </description>
+ <property-name>minimum</property-name>
+ <property-class>java.util.Date</property-class>
+ <property-extension>
+ <mfp:property-metadata>
+ <mfp:preferred>true</mfp:preferred>
+ </mfp:property-metadata>
+ </property-extension>
+ </property>
+ <property>
+ <description><![CDATA[<p>
+ The detail error message to be used for constructing faces messages,
+ when input value exceeds the <code>maximum</code> value
+ set.
+ </p>
+ <p>
+ <strong>
+ Parameters:
+ </strong>
+ <ul>
+ <li>
+ {0} the label that identifies the component
+ </li>
+ <li>
+ {1} value entered by the user
+ </li>
+ <li>
+ {2} the maximum allowed date
+ </li>
+ </ul>
+ </p>]]>
+ </description>
+ <property-name>messageDetailMaximum</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description><![CDATA[<p>
+ The detail error message to be used for constructing faces messages,
+ when input value is less than the set <code>minimum</code>
+ value.
+ </p>
+ <p>
+ <strong>
+ Parameters:
+ </strong>
+ <ul>
+ <li>
+ {0} the label that identifies the component
+ </li>
+ <li>
+ {1} value entered by the user
+ </li>
+ <li>
+ {2} the minimum allowed date
+ </li>
+ </ul>
+ </p>]]>
+ </description>
+ <property-name>messageDetailMinimum</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <property>
+ <description><![CDATA[<p>
+ The detail error message to be used for constructing faces messages,
+ if input value is not with in the range, when
+ <code>minimum</code> and <code>maximum</code> is
+ set.
+ </p>
+ <p>
+ <strong>
+ Parameters:
+ </strong>
+ <ul>
+ <li>
+ {0} the label that identifies the component
+ </li>
+ <li>
+ {1} value entered by the user
+ </li>
+ <li>
+ {2} the minimum allowed date
+ </li>
+ <li>
+ {3} the maximum allowed date
+ </li>
+ </ul>
+ </p>]]>
+ </description>
+ <property-name>messageDetailNotInRange</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <validator-extension>
+ <mfp:tag-name>tr:validateDateTimeRange</mfp:tag-name>
+ <mfp:tag-class>org.apache.myfaces.trinidadinternal.taglib.validator.ValidateDateTimeRangeTag</mfp:tag-class>
+ <mfp:long-description><![CDATA[<html:p>
+
+ Validate that the date entered is within a given range.
+</html:p>]]></mfp:long-description>
+ <mfp:example>
+ <mfp:source-code><![CDATA[<tr:inputDate id="mdf3" value="#{date.date3}"
+ label="max validator">
+ <tr:validateDateTimeRange maximum="#{date.maxDate}"/>
+</tr:inputDate>
+
+<tr:inputDate id="mdf3" value="2004-11-25"
+ tip="min=2004-11-16 max=2004-12-16"
+ label="Submission period">
+ <tr:convertDateTime pattern="yyyy-MM-dd"/>
+
+ <!-- Supports ISO date format strings of the form "yyyy-MM-dd" -->
+ <tr:validateDateTimeRange
+ minimum="2004-11-16"
+ maximum="2004-12-16"
+ messageDetailNotInRange="Date "{1}" does not fall within the range {2} : {3}"/>
+</tr:inputDate>]]>
+ </mfp:source-code>
+ </mfp:example>
+ <mfp:author>Gabrielle Crawford</mfp:author>
+ </validator-extension>
+ </validator>
</faces-config>
Modified: myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/validators/trinidad/DoubleRange.xml
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/validators/trinidad/DoubleRange.xml?view=diff&rev=540746&r1=540745&r2=540746
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/validators/trinidad/DoubleRange.xml (original)
+++ myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/validators/trinidad/DoubleRange.xml Tue May 22 13:47:57 2007
@@ -30,7 +30,11 @@
</description>
<property-name>maximum</property-name>
<property-class>double</property-class>
- <property-extension/>
+ <property-extension>
+ <mfp:property-metadata>
+ <mfp:preferred>true</mfp:preferred>
+ </mfp:property-metadata>
+ </property-extension>
</property>
<property>
<description><![CDATA[The minimum double value of the entered value..]]>
@@ -68,11 +72,6 @@
</description>
<property-name>messageDetailMaximum</property-name>
<property-class>java.lang.String</property-class>
- <property-extension>
- <mfp:property-metadata>
- <mfp:preferred>true</mfp:preferred>
- </mfp:property-metadata>
- </property-extension>
</property>
<property>
<description><![CDATA[<p>
@@ -99,11 +98,6 @@
</description>
<property-name>messageDetailMinimum</property-name>
<property-class>java.lang.String</property-class>
- <property-extension>
- <mfp:property-metadata>
- <mfp:preferred>true</mfp:preferred>
- </mfp:property-metadata>
- </property-extension>
</property>
<property>
<description><![CDATA[<p>
@@ -134,11 +128,6 @@
</description>
<property-name>messageDetailNotInRange</property-name>
<property-class>java.lang.String</property-class>
- <property-extension>
- <mfp:property-metadata>
- <mfp:preferred>true</mfp:preferred>
- </mfp:property-metadata>
- </property-extension>
</property>
<validator-extension>
<mfp:tag-name>tr:validateDoubleRange</mfp:tag-name>
@@ -158,4 +147,4 @@
<mfp:uix2-local-name>validateDoubleRange</mfp:uix2-local-name>
</validator-extension>
</validator>
-</faces-config>
\ No newline at end of file
+</faces-config>
Modified: myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/validators/trinidad/Length.xml
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/validators/trinidad/Length.xml?view=diff&rev=540746&r1=540745&r2=540746
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/validators/trinidad/Length.xml (original)
+++ myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/validators/trinidad/Length.xml Tue May 22 13:47:57 2007
@@ -21,19 +21,23 @@
xmlns:tr="http://myfaces.apache.org/trinidad"
xmlns:mfp="http://myfaces.apache.org/maven-faces-plugin">
<validator>
- <description><![CDATA[Validate that the date entered is within a given range.]]></description>
+ <description><![CDATA[Validate that the string entered is of a given length.]]></description>
<display-name>validateLength</display-name>
<validator-id>org.apache.myfaces.trinidad.Length</validator-id>
<validator-class>org.apache.myfaces.trinidadinternal.validator.LengthValidator</validator-class>
<property>
- <description><![CDATA[The maximum length value of the entered value.]]>
+ <description><![CDATA[the maximum length of the entered value.]]>
</description>
<property-name>maximum</property-name>
<property-class>int</property-class>
- <property-extension/>
+ <property-extension>
+ <mfp:property-metadata>
+ <mfp:preferred>true</mfp:preferred>
+ </mfp:property-metadata>
+ </property-extension>
</property>
<property>
- <description><![CDATA[The minimum length value of the entered value.]]>
+ <description><![CDATA[the minimum length of the entered value.]]>
</description>
<property-name>minimum</property-name>
<property-class>int</property-class>
@@ -46,7 +50,7 @@
<property>
<description><![CDATA[<p>
The detail error message to be used for constructing faces messages,
- when input value exceeds the <code>maximum</code> value
+ when input value exceeds the <code>maximum</code> length
set.
</p>
<p>
@@ -61,24 +65,19 @@
{1} value entered by the user
</li>
<li>
- {2} the maximum allowed value
+ {2} the maximum allowed length
</li>
</ul>
</p>]]>
</description>
<property-name>messageDetailMaximum</property-name>
<property-class>java.lang.String</property-class>
- <property-extension>
- <mfp:property-metadata>
- <mfp:preferred>true</mfp:preferred>
- </mfp:property-metadata>
- </property-extension>
</property>
<property>
<description><![CDATA[<p>
The detail error message to be used for constructing faces messages,
when input value is less than the set <code>minimum</code>
- value.
+ length.
</p>
<p>
<strong>
@@ -92,24 +91,19 @@
{1} value entered by the user
</li>
<li>
- {2} the minimum allowed value
+ {2} the minimum allowed length
</li>
</ul>
</p>]]>
</description>
<property-name>messageDetailMinimum</property-name>
<property-class>java.lang.String</property-class>
- <property-extension>
- <mfp:property-metadata>
- <mfp:preferred>true</mfp:preferred>
- </mfp:property-metadata>
- </property-extension>
</property>
<property>
<description><![CDATA[<p>
The detail error message to be used for constructing faces messages,
- if input value is not with in the range, when
- <code>minimum</code> and <code>maximum</code> is
+ if input value is not of an acceptable length, when both
+ <code>minimum</code> and <code>maximum</code> are
set.
</p>
<p>
@@ -124,21 +118,43 @@
{1} value entered by the user
</li>
<li>
- {2} the minimum allowed value
+ {2} the minimum allowed length
</li>
<li>
- {3} the maximum allowed value
+ {3} the maximum allowed length
</li>
</ul>
</p>]]>
</description>
<property-name>messageDetailNotInRange</property-name>
<property-class>java.lang.String</property-class>
- <property-extension>
- <mfp:property-metadata>
- <mfp:preferred>true</mfp:preferred>
- </mfp:property-metadata>
- </property-extension>
+ </property>
+ <property>
+ <description><![CDATA[<p>
+ The detail error message to be used for constructing faces messages,
+ if input value is not of an acceptable length, when both
+ <code>minimum</code> and <code>maximum</code> are
+ set to the same value.
+ </p>
+ <p>
+ <strong>
+ Parameters:
+ </strong>
+ <ul>
+ <li>
+ {0} the label that identifies the component
+ </li>
+ <li>
+ {1} value entered by the user
+ </li>
+ <li>
+ {2} the allowed length
+ </li>
+ </ul>
+ </p>]]>
+ </description>
+ <property-name>messageDetailExact</property-name>
+ <property-class>java.lang.String</property-class>
</property>
<validator-extension>
<mfp:tag-name>tr:validateLength</mfp:tag-name>
@@ -155,7 +171,7 @@
</mfp:source-code>
</mfp:example>
<mfp:author>Matthias Wessendorf</mfp:author>
- <mfp:uix2-local-name>validateLength</mfp:uix2-local-name>
+ <mfp:author>Adam Winer</mfp:author>
</validator-extension>
</validator>
-</faces-config>
\ No newline at end of file
+</faces-config>
Modified: myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/validators/trinidad/LongRange.xml
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/validators/trinidad/LongRange.xml?view=diff&rev=540746&r1=540745&r2=540746
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/validators/trinidad/LongRange.xml (original)
+++ myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/validators/trinidad/LongRange.xml Tue May 22 13:47:57 2007
@@ -30,7 +30,11 @@
</description>
<property-name>maximum</property-name>
<property-class>long</property-class>
- <property-extension/>
+ <property-extension>
+ <mfp:property-metadata>
+ <mfp:preferred>true</mfp:preferred>
+ </mfp:property-metadata>
+ </property-extension>
</property>
<property>
<description><![CDATA[The minimum long value of the entered value..]]>
@@ -68,11 +72,6 @@
</description>
<property-name>messageDetailMaximum</property-name>
<property-class>java.lang.String</property-class>
- <property-extension>
- <mfp:property-metadata>
- <mfp:preferred>true</mfp:preferred>
- </mfp:property-metadata>
- </property-extension>
</property>
<property>
<description><![CDATA[<p>
@@ -99,11 +98,6 @@
</description>
<property-name>messageDetailMinimum</property-name>
<property-class>java.lang.String</property-class>
- <property-extension>
- <mfp:property-metadata>
- <mfp:preferred>true</mfp:preferred>
- </mfp:property-metadata>
- </property-extension>
</property>
<property>
<description><![CDATA[<p>
@@ -134,11 +128,6 @@
</description>
<property-name>messageDetailNotInRange</property-name>
<property-class>java.lang.String</property-class>
- <property-extension>
- <mfp:property-metadata>
- <mfp:preferred>true</mfp:preferred>
- </mfp:property-metadata>
- </property-extension>
</property>
<validator-extension>
<mfp:tag-name>tr:validateLongRange</mfp:tag-name>
@@ -158,4 +147,4 @@
<mfp:uix2-local-name>validateLongRange</mfp:uix2-local-name>
</validator-extension>
</validator>
-</faces-config>
\ No newline at end of file
+</faces-config>
Modified: myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/validators/trinidad/RegExp.xml
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/validators/trinidad/RegExp.xml?view=diff&rev=540746&r1=540745&r2=540746
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/validators/trinidad/RegExp.xml (original)
+++ myfaces/trinidad/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/validators/trinidad/RegExp.xml Tue May 22 13:47:57 2007
@@ -1,87 +1,81 @@
-<?xml version="1.0" ?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
-
+<?xml version="1.0" ?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
-->
-<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
- xmlns:tr="http://myfaces.apache.org/trinidad"
- xmlns:mfp="http://myfaces.apache.org/maven-faces-plugin">
- <validator>
- <description><![CDATA[Validate expression using java regular expression syntax.]]></description>
- <display-name>validateRegularExpression</display-name>
- <validator-id>org.apache.myfaces.trinidad.RegExp</validator-id>
- <validator-class>org.apache.myfaces.trinidadinternal.validator.RegExpValidator</validator-class>
- <property>
- <description><![CDATA[pattern to be matched in the input value.]]></description>
- <property-name>pattern</property-name>
- <property-class>java.lang.String</property-class>
- <property-extension>
- <mfp:property-metadata>
- <mfp:preferred>true</mfp:preferred>
- </mfp:property-metadata>
- </property-extension>
- </property>
- <property>
- <description><![CDATA[<p>
- Custom error message to be used, for creating detail part of
- faces message, when users input does not match the specified
- pattern.
- </p>
- <p>
- <strong>
- Parameters:
- </strong>
- <ul>
- <li>
- {0} the label that identifies the component
- </li>
- <li>
- {1} value entered by the user
- </li>
- <li>
- {2} represents the 'pattern' expected in the input
- </li>
- </ul>
- </p>]]>
- </description>
- <property-name>messageDetailNoMatch</property-name>
- <property-class>java.lang.String</property-class>
- <property-extension>
- <mfp:property-metadata>
- <mfp:preferred>true</mfp:preferred>
- </mfp:property-metadata>
- </property-extension>
- </property>
- <validator-extension>
- <mfp:tag-name>tr:validateRegExp</mfp:tag-name>
- <mfp:tag-class>org.apache.myfaces.trinidadinternal.taglib.validator.ValidateRegExpTag</mfp:tag-class>
- <mfp:long-description><![CDATA[Validate expression using java regular expression syntax.]]></mfp:long-description>
- <mfp:example>
- <mfp:source-code><![CDATA[<tr:inputText value="9999" label="RegExp validation">
- <tr:validateRegExp pattern="[9]*"/>
-</tr:inputText>]]>
- </mfp:source-code>
- </mfp:example>
- <mfp:author>Blake Sullivan</mfp:author>
- <mfp:validator-metadata>
- <mfp:favorite-property>pattern</mfp:favorite-property>
- </mfp:validator-metadata>
- <mfp:uix2-local-name>validateRegExp</mfp:uix2-local-name>
- </validator-extension>
- </validator>
+<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:tr="http://myfaces.apache.org/trinidad"
+ xmlns:mfp="http://myfaces.apache.org/maven-faces-plugin">
+ <validator>
+ <description><![CDATA[Validate expression using Java regular expression syntax.]]></description>
+ <display-name>validateRegularExpression</display-name>
+ <validator-id>org.apache.myfaces.trinidad.RegExp</validator-id>
+ <validator-class>org.apache.myfaces.trinidadinternal.validator.RegExpValidator</validator-class>
+ <property>
+ <description><![CDATA[pattern to be matched in the input value.]]></description>
+ <property-name>pattern</property-name>
+ <property-class>java.lang.String</property-class>
+ <property-extension>
+ <mfp:property-metadata>
+ <mfp:preferred>true</mfp:preferred>
+ </mfp:property-metadata>
+ </property-extension>
+ </property>
+ <property>
+ <description><![CDATA[<p>
+ Custom error message to be used, for creating detail part of
+ faces message, when users input does not match the specified
+ pattern.
+ </p>
+ <p>
+ <strong>
+ Parameters:
+ </strong>
+ <ul>
+ <li>
+ {0} the label that identifies the component
+ </li>
+ <li>
+ {1} value entered by the user
+ </li>
+ <li>
+ {2} represents the 'pattern' expected in the input
+ </li>
+ </ul>
+ </p>]]>
+ </description>
+ <property-name>messageDetailNoMatch</property-name>
+ <property-class>java.lang.String</property-class>
+ </property>
+ <validator-extension>
+ <mfp:tag-name>tr:validateRegExp</mfp:tag-name>
+ <mfp:tag-class>org.apache.myfaces.trinidadinternal.taglib.validator.ValidateRegExpTag</mfp:tag-class>
+ <mfp:long-description><![CDATA[Validate expression using java regular expression syntax.]]></mfp:long-description>
+ <mfp:example>
+ <mfp:source-code><![CDATA[<tr:inputText value="9999" label="RegExp validation">
+ <tr:validateRegExp pattern="[9]*"/>
+</tr:inputText>]]>
+ </mfp:source-code>
+ </mfp:example>
+ <mfp:author>Blake Sullivan</mfp:author>
+ <mfp:validator-metadata>
+ <mfp:favorite-property>pattern</mfp:favorite-property>
+ </mfp:validator-metadata>
+ </validator-extension>
+ </validator>
</faces-config>
Modified: myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/jsLibs/XhtmlScriptletFactory.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/jsLibs/XhtmlScriptletFactory.java?view=diff&rev=540746&r1=540745&r2=540746
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/jsLibs/XhtmlScriptletFactory.java (original)
+++ myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/jsLibs/XhtmlScriptletFactory.java Tue May 22 13:47:57 2007
@@ -170,6 +170,7 @@
new String[]
{
"TrNumberConverter()",
+ "TrLengthValidator()",
"TrRegExpValidator()",
},
new String[]
Modified: myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/JsonUtils.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/JsonUtils.java?view=diff&rev=540746&r1=540745&r2=540746
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/JsonUtils.java (original)
+++ myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/util/JsonUtils.java Tue May 22 13:47:57 2007
@@ -364,6 +364,7 @@
{
out.append('{');
+ boolean needComma = false;
for (Iterator<?> iter = map.entrySet().iterator(); iter.hasNext();)
{
Map.Entry<?, ?> entry = (Map.Entry<?, ?>)iter.next();
@@ -372,11 +373,16 @@
throw new IllegalArgumentException("Javascript does not support null keys");
String key = rawKey.toString();
Object value = entry.getValue();
+ if (value == null)
+ continue;
+ if (needComma)
+ out.append(',');
+ else
+ needComma = true;
+
writeString(out, key, escapeXML);
out.append(':');
writeObject(out, value, escapeXML);
- if (iter.hasNext())
- out.append(',');
}
out.append('}');
}
Modified: myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/LengthValidator.java
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/LengthValidator.java?view=diff&rev=540746&r1=540745&r2=540746
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/LengthValidator.java (original)
+++ myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/LengthValidator.java Tue May 22 13:47:57 2007
@@ -32,7 +32,7 @@
import org.apache.myfaces.trinidadinternal.util.JsonUtils;
/**
- * <p>Implementation for <code>java.lang.Long</code> values.</p>
+ * <p>Implementation for length of <code>java.lang.String</code> values.</p>
*
*/
public class LengthValidator extends org.apache.myfaces.trinidad.validator.LengthValidator
@@ -53,32 +53,65 @@
/**
- * @todo this should have not_in_range messages, not just max and min!
* @todo Format these numbers properly.
*/
public String getClientValidation(
FacesContext context,
UIComponent component)
{
- String maxStr = IntegerUtils.getString(getMaximum());
- String minStr = IntegerUtils.getString(getMinimum());
- String messageDetailMax = this.getMessageDetailMaximum();
- String messageDetailMin = this.getMessageDetailMinimum();
- String hintMax = this.getHintMaximum();
- String hintMin = this.getHintMinimum();
- String hintRange = this.getHintNotInRange();
+ int max = getMaximum();
+ int min = getMinimum();
+
+ // Only pass down the messages that are relevant to this
+ // validator instance, based on the min and max
+ String detailKey = null;
+ String hintKey = null;
+ String detail = null;
+ String hint = null;
+ if (min > 0)
+ {
+ if (max != Integer.MAX_VALUE)
+ {
+ detailKey = "range";
+ hintKey = "hintRange";
+ if (min == max)
+ {
+ detail = getMessageDetailExact();
+ hint = getHintExact();
+ }
+ else
+ {
+ detail = getMessageDetailNotInRange();
+ hint = getHintNotInRange();
+ }
+ }
+ else
+ {
+ detailKey = "min";
+ hintKey = "hintMin";
+ detail = getMessageDetailMinimum();
+ hint = getHintMinimum();
+ }
+ }
+ else
+ {
+ detailKey = "max";
+ hintKey = "hintMax";
+ detail = getMessageDetailMaximum();
+ hint = getHintMaximum();
+ }
Map<String, String> cMessages = null;
- if(messageDetailMax != null || messageDetailMin != null || hintMax != null || hintMin != null || hintRange != null)
+ if ((detail != null) || (hint != null))
{
cMessages = new HashMap<String, String>();
- cMessages.put("max", messageDetailMax);
- cMessages.put("min", messageDetailMin);
- cMessages.put("hintMax", hintMax);
- cMessages.put("hintMin", hintMin);
- cMessages.put("hintRange", hintRange);
+ if (detail != null)
+ cMessages.put(detailKey, detail);
+ if (hint != null)
+ cMessages.put(hintKey, hint);
}
- return _getTrLengthValidator(context, component, maxStr, minStr, cMessages);
+
+ return _getTrLengthValidator(context, component, max, min, cMessages);
}
@@ -89,17 +122,20 @@
}
private static String _getTrLengthValidator(
- FacesContext context,
- UIComponent component,
- String max,
- String min,
- Map<String, String> messages)
+ FacesContext context,
+ UIComponent component,
+ int max,
+ int min,
+ Map<String, String> messages)
{
StringBuilder outBuffer = new StringBuilder();
outBuffer.append("new TrLengthValidator(");
- outBuffer.append(max);
+ if (max == Integer.MAX_VALUE)
+ outBuffer.append("null");
+ else
+ outBuffer.append(IntegerUtils.getString(max));
outBuffer.append(',');
- outBuffer.append(min);
+ outBuffer.append(IntegerUtils.getString(min));
outBuffer.append(',');
if(messages == null)
{
@@ -121,6 +157,6 @@
return outBuffer.toString();
}
- private static final Collection<String> _IMPORT_NAMES = Collections.singletonList( "TrNumberConverter()" );
+ private static final Collection<String> _IMPORT_NAMES = Collections.singletonList( "TrLengthValidator()" );
}
Modified: myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/CoreFormat.js
URL: http://svn.apache.org/viewvc/myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/CoreFormat.js?view=diff&rev=540746&r1=540745&r2=540746
==============================================================================
--- myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/CoreFormat.js (original)
+++ myfaces/trinidad/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/CoreFormat.js Tue May 22 13:47:57 2007
@@ -552,9 +552,12 @@
this._minValue,
"org.apache.myfaces.trinidad.validator.LengthValidator.MAXIMUM_HINT",
"org.apache.myfaces.trinidad.validator.LengthValidator.MINIMUM_HINT",
- "org.apache.myfaces.trinidad.validator.LengthValidator.RANGE_HINT",
+ (this._minValue == this._maxValue)
+ ? "org.apache.myfaces.trinidad.validator.LengthValidator.EXACT_HINT"
+ : "org.apache.myfaces.trinidad.validator.LengthValidator.RANGE_HINT",
"hintMax",
"hintMin",
+ // The server always sends down "hintRange" for exact or non-exact
"hintRange"
);
}
@@ -568,13 +571,43 @@
var string = "" + value;
var length = string.length;
- if(length >= this._minValue && length <= this._maxValue)
+ // If validation succeeds, return
+ if (length >= this._minValue &&
+ ((this._maxValue == null) || (length <= this._maxValue)))
{
return string;
}
else
{
- if(length < this._minValue) //to short
+ if ((this._minValue > 0) && (this._maxValue != null))
+ {
+ var exact = (this._minValue == this._maxValue);
+ var key = exact
+ ? "org.apache.myfaces.trinidad.validator.LengthValidator.EXACT"
+ : "org.apache.myfaces.trinidad.validator.LengthValidator.NOT_IN_RANGE";
+ var facesMessage;
+ var customKey = "range";
+
+ if(this._messages && this._messages[customKey])
+ {
+ facesMessage = _createCustomFacesMessage(TrMessageFactory.getSummaryString(key),
+ this._messages[customKey],
+ label,
+ string,
+ ""+this._minValue,
+ ""+this._maxValue);
+ }
+ else
+ {
+ facesMessage = _createFacesMessage(key,
+ label,
+ string,
+ ""+this._minValue,
+ ""+this._maxValue);
+ }
+ throw new TrConverterException(facesMessage);
+ }
+ else if (length < this._minValue) //too short
{
var key = "org.apache.myfaces.trinidad.validator.LengthValidator.MINIMUM";
var facesMessage;
@@ -595,7 +628,7 @@
}
throw new TrConverterException(facesMessage);
}
- if(length > this._maxValue) //to long
+ else // too long
{
var key = "org.apache.myfaces.trinidad.validator.LengthValidator.MAXIMUM";
var facesMessage;