incubator-adffaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From awi...@apache.org
Subject svn commit: r428238 - in /incubator/adffaces/trunk/trinidad: trinidad-demo/src/main/webapp/convertValidate/ trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/ trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderk...
Date Thu, 03 Aug 2006 05:01:11 GMT
Author: awiner
Date: Wed Aug  2 22:01:10 2006
New Revision: 428238

URL: http://svn.apache.org/viewvc?rev=428238&view=rev
Log:
Commit ADFFACES-107 patch: client side validation: remove default error array

Modified:
    incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/convertValidate/clientConvert.jspx
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/ByteConverter.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/ColorConverter.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/ConverterUtils.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/DateTimeConverter.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/DoubleConverter.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/FloatConverter.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/IntegerConverter.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/InternalClientConverter.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/LongConverter.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/ShortConverter.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FormData.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FormRenderer.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/ByteLengthValidator.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/InternalClientValidator.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/LongRangeValidator.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/RegExpValidator.java
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/ColorField.js
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/ColorFieldFormat.js
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/ColorFormat.js
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/CoreFormat.js
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/DateField.js
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/DateFieldFormat.js
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/DateFormat.js

Modified: incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/convertValidate/clientConvert.jspx
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/convertValidate/clientConvert.jspx?rev=428238&r1=428237&r2=428238&view=diff
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/convertValidate/clientConvert.jspx (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/convertValidate/clientConvert.jspx Wed Aug  2 22:01:10 2006
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
+<?xml version="1.0" encoding="iso-8859-1" standalone="yes" ?>
 <!--
   Copyright 2006 The Apache Software Foundation.
 
@@ -14,130 +14,130 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
-          xmlns:f="http://java.sun.com/jsf/core"
-          xmlns:tr="http://myfaces.apache.org/trinidad"
-          xmlns:trdemo="http://myfaces.apache.org/trinidaddemo">
-  <jsp:directive.page contentType="text/html;charset=utf-8"/>
-  <f:view>
-    <tr:document title="Client-side Converters and Validators">
-        <tr:form usesUpload="true">
-          <tr:panelPage>
-            <tr:messages/>
-            <f:facet name="navigationGlobal">
-              <tr:menuButtons>
-                <tr:commandNavigationItem text="Converters and Validators"
-                                    action="convertValidateDemos"
-                                    immediate="true"/>
-              </tr:menuButtons>
-            </f:facet>
-           <tr:panelHeader text="Client-side Converters and Validators">
-            <tr:outputText styleClass="AFInstructionText"
-                           value="In the following examples, converters and validators run on the client, avoiding a round trip."/>
-            <tr:spacer height="10"/>
-            <tr:panelHeader text="Client Converters"/>
-            <tr:panelFormLayout>
-              <tr:inputText value="#{clientValidation.integer}"
-                            label="integer converter">
-                <f:facet name="help">
-                  <tr:outputText value="examples of unconvertable values: 'a' or '11111111111'"/>
-                </f:facet>
-              </tr:inputText>
-              <tr:inputText value="#{clientValidation.longValue}"
-                            label="long converter">
-                <f:facet name="help">
-                  <tr:outputText value="examples of unconvertable values: 'a' or '11111111111111111111'"/>
-                </f:facet>
-              </tr:inputText>
-              <tr:inputText value="#{clientValidation.short}"
-                            label="short converter">
-                <f:facet name="help">
-                  <tr:outputText value="examples of unconvertable values: 'a' or '111111'"/>
-                </f:facet>
-              </tr:inputText>
-              <tr:inputText value="#{clientValidation.byte}"
-                            label="byte converter">
-                <f:facet name="help">
-                  <tr:outputText value="examples of unconvertable values: 'a' or '1111'"/>
-                </f:facet>
-              </tr:inputText>
-              <tr:inputText value="#{clientValidation.float}"
-                            label="float converter">
-                <f:facet name="help">
-                  <tr:outputText value="examples of unconvertable values: 'a' or 'cat'"/>
-                </f:facet>
-              </tr:inputText>
-              <tr:inputText value="#{clientValidation.double}"
-                            label="double converter">
-                <f:facet name="help">
-                  <tr:outputText value="examples of unconvertable values: 'a' or 'cat'"/>
-                </f:facet>
-              </tr:inputText>
-              <tr:inputColor label="color converter">
-                <f:facet name="help">
-                  <tr:outputText value="examples of unconvertable values: '9/05' or 'cat'"/>
-                </f:facet>
-              </tr:inputColor>
-              <tr:inputDate label="date converter">
-                <f:facet name="help">
-                  <tr:outputText value="examples of unconvertable values: '#FFFF' or 'cat'"/>
-                </f:facet>
-              </tr:inputDate>
-            </tr:panelFormLayout>
-            <tr:panelHeader text="Client Validators"/>
-            <tr:spacer height="10"/>
-            <tr:panelFormLayout>
-              <tr:inputText value="#{clientValidation.long}"
-                            label="long range validator">
-                <f:facet name="help">
-                  <tr:outputText value="examples of values that will fail validation: '4' or '7'"/>
-                </f:facet>
-                <f:validateLongRange minimum="5" maximum="6"/>
-              </tr:inputText>
-              <tr:inputText value="#{clientValidation.regExpValue}"
-                            label="reg exp validator">
-                <f:facet name="help">
-                  <tr:outputText value="examples of values that will fail validation: 1','2','4' all values other than '9'"/>
-                </f:facet>
-                <tr:validateRegExp pattern="[9]"/>
-              </tr:inputText>
-              <tr:inputText value="#{clientValidation.byteLengthValue}"
-                            label="byte length validator">
-                <f:facet name="help">
-                  <tr:outputText value="examples of values that will fail validation: 'Four4' or 'Seven"/>
-                </f:facet>
-                <tr:validateByteLength encoding="ISO-8859-1" maximum="4"/>
-              </tr:inputText>
-            </tr:panelFormLayout>
-            <tr:panelHeader text="Required"/>
-            <tr:spacer height="10"/>
-            <tr:panelFormLayout>
-              <tr:inputText required="true" label="required field"/>
-            </tr:panelFormLayout>
-            <tr:panelHeader text="Example of 3rd party Converter and Validator"/>
-            <tr:spacer height="10"/>
-            <tr:panelFormLayout>
-              <tr:inputText value="#{clientValidation.ssn}"
-                            label="ssn converter">
-                <f:facet name="help">
-                  <tr:outputText value="examples of unconvertable values: 'a' or 'cat'"/>
-                </f:facet>
-                <trdemo:convertSSN/>
-              </tr:inputText>
-              <tr:inputText required="true" secret="true"
-                            label="password validator">
-                <f:facet name="help">
-                  <tr:outputText value="examples of unconvertable values: 'a' or 'cat'"/>
-                </f:facet>
-                <trdemo:validatePassword/>
-              </tr:inputText>
-            </tr:panelFormLayout>
-           </tr:panelHeader>
-            <tr:panelButtonBar>
-              <tr:commandButton text="Submit"/>
-            </tr:panelButtonBar>
-          </tr:panelPage>
-        </tr:form>
-    </tr:document>
-  </f:view>
-</jsp:root>
+<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
+          xmlns:f="http://java.sun.com/jsf/core"
+          xmlns:tr="http://myfaces.apache.org/trinidad"
+          xmlns:trdemo="http://myfaces.apache.org/trinidaddemo">
+  <jsp:directive.page contentType="text/html;charset=utf-8"/>
+  <f:view>
+    <tr:document title="Client-side Converters and Validators">
+        <tr:form usesUpload="true">
+          <tr:panelPage>
+            <tr:messages/>
+            <f:facet name="navigationGlobal">
+              <tr:menuButtons>
+                <tr:commandNavigationItem text="Converters and Validators"
+                                    action="convertValidateDemos"
+                                    immediate="true"/>
+              </tr:menuButtons>
+            </f:facet>
+           <tr:panelHeader text="Client-side Converters and Validators">
+            <tr:outputText styleClass="AFInstructionText"
+                           value="In the following examples, converters and validators run on the client, avoiding a round trip."/>
+            <tr:spacer height="10"/>
+            <tr:panelHeader text="Client Converters"/>
+            <tr:panelFormLayout>
+              <tr:inputText value="#{clientValidation.integer}"
+                            label="integer converter">
+                <f:facet name="help">
+                  <tr:outputText value="examples of unconvertable values: 'a' or '11111111111'"/>
+                </f:facet>
+              </tr:inputText>
+              <tr:inputText value="#{clientValidation.longValue}"
+                            label="long converter">
+                <f:facet name="help">
+                  <tr:outputText value="examples of unconvertable values: 'a' or '11111111111111111111'"/>
+                </f:facet>
+              </tr:inputText>
+              <tr:inputText value="#{clientValidation.short}"
+                            label="short converter">
+                <f:facet name="help">
+                  <tr:outputText value="examples of unconvertable values: 'a' or '111111'"/>
+                </f:facet>
+              </tr:inputText>
+              <tr:inputText value="#{clientValidation.byte}"
+                            label="byte converter">
+                <f:facet name="help">
+                  <tr:outputText value="examples of unconvertable values: 'a' or '1111'"/>
+                </f:facet>
+              </tr:inputText>
+              <tr:inputText value="#{clientValidation.float}"
+                            label="float converter">
+                <f:facet name="help">
+                  <tr:outputText value="examples of unconvertable values: 'a' or 'cat'"/>
+                </f:facet>
+              </tr:inputText>
+              <tr:inputText value="#{clientValidation.double}"
+                            label="double converter">
+                <f:facet name="help">
+                  <tr:outputText value="examples of unconvertable values: 'a' or 'cat'"/>
+                </f:facet>
+              </tr:inputText>
+              <tr:inputColor label="color converter">
+                <f:facet name="help">
+                  <tr:outputText value="examples of unconvertable values: '9/05' or 'cat'"/>
+                </f:facet>
+              </tr:inputColor>
+              <tr:inputDate label="date converter">
+                <f:facet name="help">
+                  <tr:outputText value="examples of unconvertable values: '#FFFF' or 'cat'"/>
+                </f:facet>
+              </tr:inputDate>
+            </tr:panelFormLayout>
+            <tr:panelHeader text="Client Validators"/>
+            <tr:spacer height="10"/>
+            <tr:panelFormLayout>
+              <tr:inputText value="#{clientValidation.long}"
+                            label="long range validator">
+                <f:facet name="help">
+                  <tr:outputText value="examples of values that will fail validation: '4' or '7'"/>
+                </f:facet>
+                <f:validateLongRange minimum="5" maximum="6"/>
+              </tr:inputText>
+              <tr:inputText value="#{clientValidation.regExpValue}"
+                            label="reg exp validator">
+                <f:facet name="help">
+                  <tr:outputText value="examples of values that will fail validation: 1','2','4' all values other than '9'"/>
+                </f:facet>
+                <tr:validateRegExp pattern="[9]"/>
+              </tr:inputText>
+              <tr:inputText value="#{clientValidation.byteLengthValue}"
+                            label="byte length validator">
+                <f:facet name="help">
+                  <tr:outputText value="examples of values that will fail validation: 'Four4' or 'Seven"/>
+                </f:facet>
+                <tr:validateByteLength encoding="ISO-8859-1" maximum="4"/>
+              </tr:inputText>
+            </tr:panelFormLayout>
+            <tr:panelHeader text="Required"/>
+            <tr:spacer height="10"/>
+            <tr:panelFormLayout>
+              <tr:inputText required="true" label="required field"/>
+            </tr:panelFormLayout>
+            <tr:panelHeader text="Example of 3rd party Converter and Validator"/>
+            <tr:spacer height="10"/>
+            <tr:panelFormLayout>
+              <tr:inputText value="#{clientValidation.ssn}"
+                            label="ssn converter">
+                <f:facet name="help">
+                  <tr:outputText value="examples of unconvertable values: 'a' or 'cat'"/>
+                </f:facet>
+                <trdemo:convertSSN/>
+              </tr:inputText>
+              <tr:inputText required="true" secret="true"
+                            label="password validator">
+                <f:facet name="help">
+                  <tr:outputText value="examples of unconvertable values: 'a' or 'cat'"/>
+                </f:facet>
+                <trdemo:validatePassword/>
+              </tr:inputText>
+            </tr:panelFormLayout>
+           </tr:panelHeader>
+            <tr:panelButtonBar>
+              <tr:commandButton text="Submit"/>
+            </tr:panelButtonBar>
+          </tr:panelPage>
+        </tr:form>
+    </tr:document>
+  </f:view>
+</jsp:root>

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/ByteConverter.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/ByteConverter.java?rev=428238&r1=428237&r2=428238&view=diff
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/ByteConverter.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/ByteConverter.java Wed Aug  2 22:01:10 2006
@@ -108,16 +108,10 @@
     return ConverterUtils.getClientConversion(context, component,
                                               MAXIMUM_MESSAGE_ID,
                                               MINIMUM_MESSAGE_ID,
+                                              CONVERT_MESSAGE_ID,
                                               _BYTE_MAX, _BYTE_MIN);
   }
 
-  public String getClientConversionFormat(
-   FacesContext context,
-   UIComponent component)
-  {
-    return ConverterUtils.getClientConversionFormat(context, component,
-                                                    CONVERT_MESSAGE_ID);
-  }
 
   private static final String _BYTE_MAX = Byte.toString(Byte.MAX_VALUE);
   private static final String _BYTE_MIN = Byte.toString(Byte.MIN_VALUE);

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/ColorConverter.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/ColorConverter.java?rev=428238&r1=428237&r2=428238&view=diff
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/ColorConverter.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/ColorConverter.java Wed Aug  2 22:01:10 2006
@@ -17,6 +17,7 @@
 
 import java.util.Map;
 
+import javax.faces.application.FacesMessage;
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 
@@ -25,6 +26,7 @@
 
 import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlUtils;
 import org.apache.myfaces.trinidadinternal.share.text.RGBColorFormat;
+import org.apache.myfaces.trinidadinternal.ui.laf.base.xhtml.XhtmlLafUtils;
 import org.apache.myfaces.trinidadinternal.util.MessageUtils;
 
 
@@ -40,12 +42,6 @@
     return "ColorFormat()";
   }
 
-  public String getClientConversionFormat(
-    FacesContext context,
-    UIComponent component)
-  {
-    return _getConvertMessageDetail(context);
-  }
 
   public String getClientScript(FacesContext context, UIComponent component)
   {
@@ -148,14 +144,17 @@
 
     if (isTransparentAllowed())
     {
-      sb.append(",true");
+      sb.append(",true,'");
     }
     else
     {
-      sb.append(",false");
+      sb.append(",false,'");
     }
+    
+    String msg = _getConvertMessageDetail(context);
+    sb.append(XhtmlLafUtils.escapeJS(msg)); 
 
-    sb.append(")");
+    sb.append("')");
 
     return sb.toString();
   }

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/ConverterUtils.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/ConverterUtils.java?rev=428238&r1=428237&r2=428238&view=diff
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/ConverterUtils.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/ConverterUtils.java Wed Aug  2 22:01:10 2006
@@ -177,26 +177,16 @@
     }
   }
 
-  public static String getClientConversionFormat(
-   FacesContext context,
-   UIComponent component,
-   String msgId)
-  {
-    FacesMessage convertMessage = MessageFactory.getMessage(context, msgId);
-    return MessageUtils.createErrorAlertMessage(context,
-                                                component,
-                                                convertMessage.getDetail());
-  }
-
   public static String getClientValidation(
     FacesContext context,
     UIComponent component,
     String maxId,
     String minId,
+    String defaultId,
     String maxVal,
     String minVal)
   {
-    return _getClientConversion(context, component, maxId, minId,
+    return _getClientConversion(context, component, maxId, minId, defaultId,
                                 maxVal, minVal, false);
   }
 
@@ -205,10 +195,11 @@
     UIComponent component,
     String maxId,
     String minId,
+    String defaultId,
     String maxVal,
     String minVal)
   {
-    return _getClientConversion(context, component, maxId, minId,
+    return _getClientConversion(context, component, maxId, minId, defaultId,
                                 maxVal, minVal, true);
   }
 
@@ -217,6 +208,7 @@
     UIComponent component,
     String maxId,
     String minId,
+    String defaultId,
     String maxVal,
     String minVal,
     boolean isConverter)
@@ -233,24 +225,57 @@
       MessageFactory.getMessage(context, maxId,
                                 new Object[]{"{0}", "{1}", maxVal});
 
-    String msg = MessageUtils.createErrorAlertMessage(context, component,
+    String msg = MessageUtils.createErrorAlertMessage(context, "{0}",
                                                       maxMessage.getDetail());
     outBuffer.append(XhtmlLafUtils.escapeJS(msg));
-    outBuffer.append("',");
-    outBuffer.append("MV:'");
+    outBuffer.append("',MV:'");
 
     FacesMessage minMessage =
       MessageFactory.getMessage(context, minId,
                                 new Object[]{"{0}", "{1}", minVal});
 
-    msg = MessageUtils.createErrorAlertMessage(context, component,
+    msg = MessageUtils.createErrorAlertMessage(context, "{0}",
                                                minMessage.getDetail());
     outBuffer.append(XhtmlLafUtils.escapeJS(msg));
+
+    outBuffer.append("',D:'");
+
+    FacesMessage defaultMessage =
+      MessageFactory.getMessage(context, defaultId,
+                                new Object[]{"{0}", "{1}"});
+
+    msg = MessageUtils.createErrorAlertMessage(context, "{0}",
+                                               defaultMessage.getDetail());
+    outBuffer.append(XhtmlLafUtils.escapeJS(msg));    
     outBuffer.append("'},(void 0),0,");
     outBuffer.append(maxVal);
     outBuffer.append(',');
     outBuffer.append(minVal);
     outBuffer.append(")");
+
+    return outBuffer.toString();
+  }
+
+
+  public static String getClientConversion(
+    FacesContext context,
+    UIComponent component,
+    String defaultId)
+  {
+    StringBuffer outBuffer = new StringBuffer(250);
+
+      outBuffer.append("new DecimalFormat(");
+
+    outBuffer.append("{D:'");
+
+    FacesMessage defaultMessage =
+      MessageFactory.getMessage(context, defaultId,
+                                new Object[]{"{0}", "{1}"});
+
+    String msg = MessageUtils.createErrorAlertMessage(context, "{0}",
+                                               defaultMessage.getDetail());
+    outBuffer.append(XhtmlLafUtils.escapeJS(msg));    
+    outBuffer.append("'})");
 
     return outBuffer.toString();
   }

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/DateTimeConverter.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/DateTimeConverter.java?rev=428238&r1=428237&r2=428238&view=diff
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/DateTimeConverter.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/DateTimeConverter.java Wed Aug  2 22:01:10 2006
@@ -37,6 +37,8 @@
 import javax.faces.component.ValueHolder;
 import javax.faces.convert.Converter;
 
+import org.apache.myfaces.trinidadinternal.ui.laf.base.xhtml.XhtmlLafUtils;
+
 /**
  * <p>This class implements client side equivalent of DateTimeConverter.
  * This class pushes all relevant information to the client side so
@@ -205,11 +207,27 @@
 
     if (jsPattern != null)
     {
-      StringBuffer outBuffer = new StringBuffer(22 + jsPattern.length());
+      String pattern = getPattern();
+
+      if (pattern == null)
+        pattern = getSecondaryPattern();
 
+      String label = "{0}"; // will get replaced in javascript
+      Object[] params = new Object[] {label, "{1}", getExample(context)};
+      String msg = getParseErrorMessage(context, component,
+                                        pattern, params).getDetail();
+      String message = XhtmlLafUtils.escapeJS(
+                      MessageUtils.createErrorAlertMessage(context,
+                                                  label,
+                                                  msg));
+                                                  
+      StringBuffer outBuffer = new StringBuffer(30 + jsPattern.length() +
+                                                message.length());
       outBuffer.append("new SimpleDateFormat("); // 21
       outBuffer.append(jsPattern);               // jsPattern.length
-      outBuffer.append(")");                     // 1
+      outBuffer.append(",null,'");               // 7
+      outBuffer.append(message);                 // message.length
+      outBuffer.append("')");                    // 2
 
       return outBuffer.toString();
     }
@@ -225,31 +243,6 @@
     return "SimpleDateFormat()";
   }
 
-  public String getClientConversionFormat(
-    FacesContext context,
-    UIComponent component
-    )
-  {
-    // for now, we are disabling the client-side validation when the
-    // locale is not the page's locale.
-    if (_isDifferentLocale())
-    {
-      return null;
-    }
-
-    String pattern = getPattern();
-
-    if (pattern == null)
-      pattern = getSecondaryPattern();
-
-    String label = "{0}"; // will get replaced in javascript
-    Object[] params = new Object[] {label, "{1}", getExample(context)};
-    String msg = getParseErrorMessage(context, component,
-                                      pattern, params).getDetail();
-    return MessageUtils.createErrorAlertMessage(context,
-                                                label,
-                                                msg);
-  }
 
    /**
    * Returns the number of columns of text a field should

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/DoubleConverter.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/DoubleConverter.java?rev=428238&r1=428237&r2=428238&view=diff
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/DoubleConverter.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/DoubleConverter.java Wed Aug  2 22:01:10 2006
@@ -77,14 +77,7 @@
     FacesContext context,
     UIComponent component)
   {
-    return "new DecimalFormat()";
+    return ConverterUtils.getClientConversion(context,component,CONVERT_MESSAGE_ID);
   }
 
-  public String getClientConversionFormat(
-   FacesContext context,
-   UIComponent component)
-  {
-    return ConverterUtils.getClientConversionFormat(context, component,
-                                                    CONVERT_MESSAGE_ID);
-  }
 }

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/FloatConverter.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/FloatConverter.java?rev=428238&r1=428237&r2=428238&view=diff
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/FloatConverter.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/FloatConverter.java Wed Aug  2 22:01:10 2006
@@ -76,14 +76,6 @@
    FacesContext context,
    UIComponent component)
   {
-    return "new DecimalFormat()";
-  }
-
-  public String getClientConversionFormat(
-   FacesContext context,
-   UIComponent component)
-  {
-    return ConverterUtils.getClientConversionFormat(context, component,
-                                                    CONVERT_MESSAGE_ID);
+    return ConverterUtils.getClientConversion(context,component,CONVERT_MESSAGE_ID);
   }
 }

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/IntegerConverter.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/IntegerConverter.java?rev=428238&r1=428237&r2=428238&view=diff
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/IntegerConverter.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/IntegerConverter.java Wed Aug  2 22:01:10 2006
@@ -116,16 +116,10 @@
     return ConverterUtils.getClientConversion(context, component,
                                               MAXIMUM_MESSAGE_ID,
                                               MINIMUM_MESSAGE_ID,
+                                              CONVERT_MESSAGE_ID,
                                               _INT_MAX, _INT_MIN);
   }
 
-  public String getClientConversionFormat(
-   FacesContext context,
-   UIComponent component)
-  {
-    return ConverterUtils.getClientConversionFormat(context, component,
-                                                    CONVERT_MESSAGE_ID);
-  }
 
   private static final String  _INT_MIN
     = IntegerUtils.getString(Integer.MIN_VALUE);

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/InternalClientConverter.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/InternalClientConverter.java?rev=428238&r1=428237&r2=428238&view=diff
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/InternalClientConverter.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/InternalClientConverter.java Wed Aug  2 22:01:10 2006
@@ -33,12 +33,5 @@
    FacesContext context,
    UIComponent component); 
   
-  /**
-   * Called to retrieve the format to display a conversion error.
-   * This method should not return a value that is Javascript-escaped.
-   */
-  public String getClientConversionFormat(
-   FacesContext context,
-   UIComponent component);
   
 }

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/LongConverter.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/LongConverter.java?rev=428238&r1=428237&r2=428238&view=diff
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/LongConverter.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/LongConverter.java Wed Aug  2 22:01:10 2006
@@ -113,20 +113,10 @@
     return ConverterUtils.getClientConversion(context, component,
                                               MAXIMUM_MESSAGE_ID,
                                               MINIMUM_MESSAGE_ID,
+                                              CONVERT_MESSAGE_ID,
                                               _LONG_MAX, _LONG_MIN);
   }
 
-
-  /**
-  * @todo - translate!!
-  */
-  public String getClientConversionFormat(
-   FacesContext context,
-   UIComponent component)
-  {
-    return ConverterUtils.getClientConversionFormat(context, component,
-                                                    CONVERT_MESSAGE_ID);
-  }
 
   private static final String _LONG_MIN
     = IntegerUtils.getString(Long.MIN_VALUE);

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/ShortConverter.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/ShortConverter.java?rev=428238&r1=428237&r2=428238&view=diff
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/ShortConverter.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/convert/ShortConverter.java Wed Aug  2 22:01:10 2006
@@ -111,16 +111,10 @@
     return ConverterUtils.getClientConversion(context, component,
                                               MAXIMUM_MESSAGE_ID,
                                               MINIMUM_MESSAGE_ID,
+                                              CONVERT_MESSAGE_ID,
                                               _SHORT_MAX, _SHORT_MIN);
   }
 
-  public String getClientConversionFormat(
-   FacesContext context,
-   UIComponent component)
-  {
-    return ConverterUtils.getClientConversionFormat(context, component,
-                                                    CONVERT_MESSAGE_ID);
-  }
 
   private static final String _SHORT_MAX = Short.toString(Short.MAX_VALUE);
   private static final String _SHORT_MIN = Short.toString(Short.MIN_VALUE);

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FormData.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FormData.java?rev=428238&r1=428237&r2=428238&view=diff
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FormData.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FormData.java Wed Aug  2 22:01:10 2006
@@ -389,7 +389,6 @@
    */
   private void _addFormConverterInfo(
     String                    converter,
-    Integer                   formatIndex,
     FormData.ConvertValidate  convertValidate
    )
   {
@@ -404,9 +403,7 @@
 
 
       // add the converter
-      convertValidate.converter[0] = (_addValidation(converter));
-      convertValidate.converter[1] = (formatIndex == null? "(void 0)" :
-                                              formatIndex.toString());
+      convertValidate.converter = (_addValidation(converter));
 
     }
   }
@@ -416,7 +413,6 @@
    */
   private void _addFormValidatorInfo(
     String                    validator,
-    Integer                   formatIndex,
     FormData.ConvertValidate  convertValidate
    )
   {
@@ -427,7 +423,6 @@
 
       // add the validator
       convertValidate.validators.add(_addValidation(validator));
-      convertValidate.validators.add(formatIndex);
     }
   }
 
@@ -452,11 +447,6 @@
 
     }
 
-    // Should we remove getClientConversionFormat altogether???
-    // For validation it may apply, but for conversion will you ever
-    // have 2 different converter constructors?
-    Integer formatIndex = null;
-
     FacesContext fcontext = FacesContext.getCurrentInstance();
     if (submitConverter instanceof InternalClientConverter)
     {
@@ -467,13 +457,6 @@
 
       _writeDependencies(fcontext, clientLibrary);
 
-
-      // register the validation format string on the form
-      String conversionFormat =
-             internalConverter.getClientConversionFormat(fcontext, component);
-
-      // get the format index of this error format in the registered formats
-      formatIndex = _addErrorFormat(conversionFormat);
     }
 
     Object clientDependency = submitConverter.getClientScript(fcontext,
@@ -490,7 +473,7 @@
     if (converter != null)
     {
 
-      _addFormConverterInfo( converter, formatIndex, convertValidate);
+      _addFormConverterInfo( converter, convertValidate);
       _addValidatedInput(clientId);
     }
   }
@@ -510,10 +493,6 @@
   {
     FacesContext fContext = FacesContext.getCurrentInstance();
 
-    // Should we remove getClientValidationFormat altogether???
-    // It would be unusual that it's much of an optimization
-    Integer formatIndex = null;
-
     if (submitValidator instanceof InternalClientValidator)
     {
       InternalClientValidator internalValidator =
@@ -523,16 +502,6 @@
       String clientLibrary = internalValidator.getLibKey(fContext, component);
 
       _writeDependencies(fContext, clientLibrary);
-
-
-
-      // register the validation format string on the form
-      String validatorFormat = internalValidator.getClientValidationFormat(
-                                                  fContext,
-                                                  component);
-
-      // get the format index of this error format in the registered formats
-      formatIndex = _addErrorFormat( validatorFormat);
     }
     else
     {
@@ -551,7 +520,7 @@
 
     if (validator != null)
     {
-      _addFormValidatorInfo(validator, formatIndex, convertValidate);
+      _addFormValidatorInfo(validator, convertValidate);
       _addValidatedInput( clientId);
     }
   }
@@ -791,7 +760,7 @@
     public boolean   required = false;
     public Integer   requiredFormatIndex;
     public ArrayList validators;
-    public Object[]  converter;
+    public Object    converter;
   }
 
 

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FormRenderer.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FormRenderer.java?rev=428238&r1=428237&r2=428238&view=diff
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FormRenderer.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/renderkit/core/xhtml/FormRenderer.java Wed Aug  2 22:01:10 2006
@@ -561,22 +561,18 @@
 
         writer.writeText(",", null);
 
-        Object[] converterInfo = convertValidate.converter;
+        Object converterInfo = convertValidate.converter;
 
         if (converterInfo != null)
         {
-          writer.writeText("[", null);
-          writer.writeText(converterInfo[0], null);
-          writer.writeText(",", null);
-          writer.writeText(converterInfo[1], null);
-          writer.writeText("],", null);
+          writer.writeText(converterInfo, null);
         }
         else
         {
-          writer.writeText("(void 0),", null);
+          writer.writeText("(void 0)", null);
         }
 
-        writer.writeText("[", null);
+        writer.writeText(",[", null);
 
         ArrayList validatorInfo = convertValidate.validators;
 
@@ -600,18 +596,7 @@
             // write the validation string for the validater
             writer.writeText(validatorInfo.get(i).toString(), null);
 
-
-            writer.writeText(",", null);
-
-            // write the index of the format for handling errors
-            Integer formatIndex = (Integer)validatorInfo.get(i + 1);
-            if (formatIndex != null)
-            {
-              writer.writeText(IntegerUtils.getString(formatIndex.intValue()),
-                               null);
-            }
-
-            i = i + 2;
+            i = i + 1;
           }
         }
       }

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/ByteLengthValidator.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/ByteLengthValidator.java?rev=428238&r1=428237&r2=428238&view=diff
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/ByteLengthValidator.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/ByteLengthValidator.java Wed Aug  2 22:01:10 2006
@@ -71,18 +71,6 @@
 
   /**
    * {@inheritDoc}
-   * @todo see if we can get rid of this method
-   */
-  public String getClientValidationFormat(
-    FacesContext context,
-    UIComponent component
-    )
-  {
-    return _getEscapedJsMaximumMessageDetail(context);
-  }
-
-  /**
-   * {@inheritDoc}
    */
   public String getClientScript(
     FacesContext context,

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/InternalClientValidator.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/InternalClientValidator.java?rev=428238&r1=428237&r2=428238&view=diff
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/InternalClientValidator.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/InternalClientValidator.java Wed Aug  2 22:01:10 2006
@@ -32,13 +32,6 @@
   public String getLibKey(
    FacesContext context,
    UIComponent component); 
-  
-  /**
-   * Called to retrieve the format to display a validation error
-   * This method should not return a value that is Javascript-escaped.
-   */
-  public String getClientValidationFormat(
-   FacesContext context,
-   UIComponent component);
+
   
 }

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/LongRangeValidator.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/LongRangeValidator.java?rev=428238&r1=428237&r2=428238&view=diff
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/LongRangeValidator.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/LongRangeValidator.java Wed Aug  2 22:01:10 2006
@@ -116,17 +116,8 @@
     return  ConverterUtils.getClientValidation(context, component,
                                                MAXIMUM_MESSAGE_ID,
                                                MINIMUM_MESSAGE_ID,
+                                               VALIDATOR_ID,
                                                maxStr, minStr);
-  }
-
-  public String getClientValidationFormat(
-   FacesContext context,
-   UIComponent component)
-  {
-    FacesMessage validateMessage = MessageFactory.getMessage(context,
-                                                             VALIDATOR_ID,
-                                                             component);
-    return validateMessage.getDetail();
   }
 
   // not overriding getMaximum because I'll suddenly

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/RegExpValidator.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/RegExpValidator.java?rev=428238&r1=428237&r2=428238&view=diff
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/RegExpValidator.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/java/org/apache/myfaces/trinidadinternal/validator/RegExpValidator.java Wed Aug  2 22:01:10 2006
@@ -66,7 +66,13 @@
    */
   public String getClientValidation(FacesContext context, UIComponent component)
   {
+    String clientId = component.getClientId(context);
 
+    if (clientId != null)
+    {
+      FormRenderer.addPatternMapping( clientId, getPattern());
+    }
+    
     String jsPattern = XhtmlUtils.escapeJS(getPattern());
     String esNoMatchMsgPattern = XhtmlUtils.escapeJS(
                   _getNoMatchMessageDetail(context));
@@ -115,7 +121,7 @@
     FacesContext context,
     UIComponent component
     )
-  {
+  {/*
     String clientId = component.getClientId(context);
 
     if (clientId != null)
@@ -129,7 +135,7 @@
      * @todo Think it's worth to cache it here and then blow that away once
      * this method gets called. The best would be get rid of this method contract
      */
-    return _getNoMatchMessageDetail(context);
+    return null;//_getNoMatchMessageDetail(context);
   }
 
   private String _getNoMatchMessageDetail(

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/ColorField.js
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/ColorField.js?rev=428238&r1=428237&r2=428238&view=diff
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/ColorField.js (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/ColorField.js Wed Aug  2 22:01:10 2006
@@ -42,7 +42,7 @@
       value = cff.getAsObject(colorField.value);
     }
 
-    if (value != (void 0))
+    if (!_instanceof(value, ConverterException))
     {
       if (value.alpha == 0)
       {
@@ -282,7 +282,7 @@
     var format = _getColorFieldFormat(colorField);
     var color = format.getAsObject(colorField.value);
 
-    if (color != (void 0))
+    if (!_instanceof(color, ConverterException))
     {
       destination += "&value=";
 

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/ColorFieldFormat.js
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/ColorFieldFormat.js?rev=428238&r1=428237&r2=428238&view=diff
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/ColorFieldFormat.js (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/ColorFieldFormat.js Wed Aug  2 22:01:10 2006
@@ -37,7 +37,7 @@
   {
     var value = format.getAsObject(colorField.value);
 
-    if (value != (void 0))
+    if (!_instanceof(value, ConverterException))
       colorField.value = format.getAsString(value);
   }
 }

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/ColorFormat.js
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/ColorFormat.js?rev=428238&r1=428237&r2=428238&view=diff
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/ColorFormat.js (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/ColorFormat.js Wed Aug  2 22:01:10 2006
@@ -62,7 +62,8 @@
   if (typeof pattern == "string")
   {
     return _rgbColorParseImpl(parseString,
-                              pattern);
+                              pattern,
+                              this._msg);
   }
   else
   { 
@@ -70,8 +71,10 @@
     for (i = 0; i < pattern.length; i++)
     {
       var color = _rgbColorParseImpl(parseString,
-                                     pattern[i]);
-      if (color != (void 0))
+                                     pattern[i],
+                                     this._msg);
+                                     
+      if (!(_instanceof(color, ConverterException)) || i == pattern.length-1)
         return color;
     }
   }
@@ -79,13 +82,14 @@
 
 function _rgbColorParseImpl(
   parseString,
-  parsePattern)
+  parsePattern,
+  msg)
 {
   var parseContext = new Object();
   parseContext.currIndex = 0;
   parseContext.parseString = parseString;
-  parseContext.parseException = new ConverterException();
-
+  parseContext.parseException = new ConverterException(msg);
+  
   var parsedColor = new Color(0x00, 0x00, 0x00);
 
   // parse the color
@@ -96,7 +100,7 @@
   {
     if (parseString.length != parseContext.currIndex)
     {
-      return (void 0);
+      return parseContext.parseException;
     }
 
     return parsedColor;
@@ -104,7 +108,7 @@
   else
   {
     // failure
-    return (void 0);
+    return parseContext.parseException;
   }
 }
 
@@ -542,11 +546,13 @@
  */
 function RGBColorFormat(
   pattern,
-  allowsTransparent)
+  allowsTransparent,
+  msg)
 {
   // for debugging
   this._class = "RGBColorFormat";
   this._allowsTransparent = allowsTransparent;
+  this._msg = msg;
   
   if (pattern != (void 0))
   {

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js?rev=428238&r1=428237&r2=428238&view=diff
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/Core.js Wed Aug  2 22:01:10 2006
@@ -2391,7 +2391,7 @@
               !((typeof value == "string") && (value == "")))
           {
             // evaluate the converter
-            var converterConstructor = validations[converterInfo[0]];
+            var converterConstructor = validations[converterInfo];
             var converterResult = void(0);
 
             if (converterConstructor)
@@ -2404,15 +2404,8 @@
               {
                 converterError = converterResult;
               }
-              // the following is old 2.2 behavior that should be removed
-
-              else if (converterResult == (void 0))
-              {
-                converterError = "Conversion failed for value:" + value;
-              }
             }
 
-
             if (converterError)
             {
               // move the focus back to the first failed field
@@ -2427,7 +2420,7 @@
               // get the formatted error string for the current input and
               // formatIndex
               var errorString1 = _getErrorString(currInput,
-                                                converterInfo[1],
+                                                 null,
                                                 converterError);
 
               if (errorString1)
@@ -2449,7 +2442,7 @@
         {
           var validatorInfo = validators[i+4];
 
-          for ( var j = 0; j < validatorInfo.length; j = j + 2)
+          for ( var j = 0; j < validatorInfo.length; j = j + 1)
           {
             // do the validation if this element has a value
             // Don't just compare against "", since the value has
@@ -2471,9 +2464,6 @@
                 validationResult = validator.validate(value);
                 if (_instanceof(validationResult, ValidatorException))
                   validationError = validationResult;
-                // the following is old 2.2 behavior that should be removed
-                else if (validationResult == (void 0))
-                  validationError = "Validation Failed for value:" + currInput;
 
               }
 
@@ -2491,7 +2481,7 @@
                 // get the formatted error string for the current input and
                 // formatIndex
                 var errorString = _getErrorString(currInput,
-                                                  validatorInfo[j + 1],
+                                                  null,
                                                   validationError);
 
                 if (errorString)

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/CoreFormat.js
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/CoreFormat.js?rev=428238&r1=428237&r2=428238&view=diff
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/CoreFormat.js (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/CoreFormat.js Wed Aug  2 22:01:10 2006
@@ -31,7 +31,7 @@
   )
 {
   if (!numberString)
-    return (void 0);
+    return new ConverterException(messages[DecimalFormat.D]);
        
 
   // Get LocaleSymbols (from Locale.js)
@@ -42,7 +42,7 @@
     var grouping = symbols.getGroupingSeparator();
     if ((numberString.indexOf(grouping) == 0) ||
         (numberString.lastIndexOf(grouping) ==  (numberString.length - 1)))
-      return (void 0);
+      return new ConverterException(messages[DecimalFormat.D]);
 
     // Remove the thousands separator - which Javascript doesn't want to see
     var thousands = new RegExp("\\" + grouping, "g");
@@ -114,7 +114,7 @@
           
           if ((messages == (void 0)) ||
               (messages[messageKey] == (void 0)))
-            return (void 0);  // default error format
+            return  new ConverterException("Conversion failed, but no appropriate message found");  // default error format
           else
             return new ConverterException(messages[messageKey]);
         }
@@ -124,7 +124,7 @@
     }
   }
 
-  return (void 0);
+  return new ConverterException(messages[DecimalFormat.D]);
 }
 
 function _decimalGetAsObject(
@@ -163,11 +163,13 @@
 // Less fraction digits
 DecimalFormat.LFD = 'LFD';
 // Less integer digits
-DecimalFormat.LID   = 'LID';
+DecimalFormat.LID = 'LID';
 // Less value
-DecimalFormat.LV        = 'LV';
+DecimalFormat.LV  = 'LV';
 // More value
-DecimalFormat.MV        = 'MV';
+DecimalFormat.MV  = 'MV';
+// default
+DecimalFormat.D   = 'D';
 
 
 function _decimalValidate(

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/DateField.js
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/DateField.js?rev=428238&r1=428237&r2=428238&view=diff
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/DateField.js (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/DateField.js Wed Aug  2 22:01:10 2006
@@ -251,10 +251,16 @@
 
 // _dfgv(): Date Field Get Value function
 // Returns the value of the dateField as a Date object
+// or null if there was an error.
 function _dfgv(dateField)
 {
   if (dateField.value != "")
-    return _getDateFieldFormat(dateField).getAsObject(dateField.value);
+  {
+    var value = _getDateFieldFormat(dateField).getAsObject(dateField.value);
+    
+    if (!_instanceof(value, ConverterException))
+      return value;
+  }
 
   return null;
 }

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/DateFieldFormat.js
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/DateFieldFormat.js?rev=428238&r1=428237&r2=428238&view=diff
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/DateFieldFormat.js (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/DateFieldFormat.js Wed Aug  2 22:01:10 2006
@@ -34,7 +34,7 @@
   {
     var value = format.getAsObject(dateField.value);
 
-    if (value != (void 0))
+    if (!_instanceof(value, ConverterException))
       dateField.value = format.getAsString(value);
   }
 }

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/DateFormat.js
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/DateFormat.js?rev=428238&r1=428237&r2=428238&view=diff
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/DateFormat.js (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/main/javascript/META-INF/adf/jsLibs/DateFormat.js Wed Aug  2 22:01:10 2006
@@ -66,7 +66,8 @@
   {
     return _simpleDateParseImpl(parseString,
                                 pattern,
-                                this._localeSymbols);
+                                this._localeSymbols,
+                                this._msg);
   }
   else
   { 
@@ -75,8 +76,9 @@
     {
       var date = _simpleDateParseImpl(parseString,
                                       pattern[i],
-                                      this._localeSymbols);
-      if (date != (void 0))
+                                      this._localeSymbols,
+                                      this._msg);
+      if ( !_instanceof(date, ConverterException)|| i == pattern.length-1 )
         return date;
     }
   }
@@ -85,7 +87,8 @@
 function _simpleDateParseImpl(
   parseString,
   parsePattern,
-  localeSymbols)
+  localeSymbols,
+  msg)
 {
   var parseContext = new Object();
   parseContext.currIndex = 0;
@@ -99,7 +102,7 @@
   parseContext.parsedFullYear = (void 0);
   parseContext.parsedMonth = (void 0);
   parseContext.parsedDate = (void 0);
-  parseContext.parseException = new ConverterException();
+  parseContext.parseException = new ConverterException(msg);
 
   var parsedTime = new Date(0);
   parsedTime.setDate(1);
@@ -113,7 +116,7 @@
   {
     if (parseString.length != parseContext.currIndex)
     {
-      return (void 0);
+      return parseContext.parseException;
     }
 
     // Set the parsed year, if any;  adjust for AD vs. BC
@@ -172,7 +175,7 @@
     // now we check for strictness
     if (!_isStrict(parseContext, parsedTime))
     {
-      return (void 0);
+      return parseContext.parseException;
     }
 
     return parsedTime;
@@ -180,7 +183,7 @@
   else
   {
     // failure
-    return (void 0);
+    return parseContext.parseException;
   }
 }
 
@@ -1233,12 +1236,14 @@
  * the specified locale.
  */
 function SimpleDateFormat(
-  pattern,
-  locale
+  pattern,  
+  locale,
+  msg
   )
 {
   // for debugging
   this._class = "SimpleDateFormat";
+  this._msg = msg;
   
   // save the Locale elements for the specified locale, or client locale
   // if no locale is specified



Mime
View raw message