You are viewing a plain text version of this content. The canonical link for it is here.
Posted to adffaces-commits@incubator.apache.org by aw...@apache.org on 2006/08/16 05:56:40 UTC

svn commit: r431837 - in /incubator/adffaces/trunk/trinidad: src/site/xdoc/devguide/ trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/ trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/ trinidad-demo/src/main/java/org/apach...

Author: awiner
Date: Tue Aug 15 22:56:39 2006
New Revision: 431837

URL: http://svn.apache.org/viewvc?rev=431837&view=rev
Log:
Check in patch for ADFFACES-117:  ClientConverter, ClientValidator: add api's to load custom js libs and built in trinidad js.

Added:
    incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/jsLibs/
    incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/jsLibs/passwordValidator.js
    incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/jsLibs/ssnConverter.js
Removed:
    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/validator/InternalClientValidator.java
Modified:
    incubator/adffaces/trunk/trinidad/src/site/xdoc/devguide/clientValidation.xml
    incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/ClientConverter.java
    incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/ClientValidator.java
    incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/convertValidate/PasswordValidator.java
    incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/convertValidate/SSNConverter.java
    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/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/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/validator/ByteLengthValidator.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/Core.js
    incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/validator/ByteLengthValidatorTest.java

Modified: incubator/adffaces/trunk/trinidad/src/site/xdoc/devguide/clientValidation.xml
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/src/site/xdoc/devguide/clientValidation.xml?rev=431837&r1=431836&r2=431837&view=diff
==============================================================================
--- incubator/adffaces/trunk/trinidad/src/site/xdoc/devguide/clientValidation.xml (original)
+++ incubator/adffaces/trunk/trinidad/src/site/xdoc/devguide/clientValidation.xml Tue Aug 15 22:56:39 2006
@@ -130,18 +130,19 @@
       <p>
       And here's an example of a javascript constructor to get an instance of the javascript converter defined above:
       <source>
-      new SSNConverter({S:\'Value "{0}" in "{1}" is too short.\',
-                        L:\'Value "{0}" in "{1}" is too long.\',
-                        N:\'Value "{0}" in "{1}" is not a social security number.\'})
+       new SSNConverter({S:\'Value "{1}" is too short.\',
+                         L:\'Value "{1}" is too long.\',
+                         N:\'Value "{1}" is not a valid social security number.\'})
+            );
       </source>
       </p>
       <p>
-      In the current implementation if there is a ConverterException Apache Trinidad gets the detail string out of the exception and displays it replacing '{0}' with the value entered by the user and '{1}' with the label of the field.
+       If there is a ConverterException Apache Trinidad gets the detail string out of the exception and replaces '{0}' with the label of the field and '{1}' with the  value entered by the user. It is not necessary to use the label in the detail though because the detail is passed to another string before it is displayed. The value of the translation af_messages.GLOBAL_MESSAGE_FORMAT is also sent to the client. An example of this string is "{0} - {1}", where {0} will be replaced with the label and {1} will be replaced with the detail provided by the converterException. So if the label was 'ssn number' and the value the user entered was '1111', the message shown would look like 'ssn number - Value "1111" is too short'.
       </p>
       <p>
-      At this point we have the javascript to use on the client, but we need a way to provide it from our Java Converter object. This is achieved by implementing the interface <code>org.apache.myfaces.trinidad.converter.ClientConverter</code>, which has two methods. The first method is <code>getClientScript()</code>, which is expected to return an implementation of the javascript Converter object. The second method is <code>getClientConversion()</code>, which is expected to return a  javascript constructor which will be used to instantiate an instance of the converter. </p>
+       At this point we have the javascript to use on the client, but we need a way to provide it from our Java Converter object. This is achieved by implementing the interface <code>org.apache.myfaces.trinidad.converter.ClientConverter</code>, which has four methods. The first method is <code>getClientLibrarySource()</code>, which is expected to return a library that includes an implementation of the javascript Converter object. The second method is <code>getClientConversion()</code>, which is expected to return a  javascript constructor which will be used to instantiate an instance of the converter. Also provided are <code>getClientScript()</code> which can be used to write out inline javascript, and <code>getClientImportNames()</code> which is used to import the built-in scripts provided by Apache Trinidad.</p>
       <p>
-      Continuing with our social security number converter example, here's our social security number converter Java class (the details of the Java code has been removed from the getAsObject() and getAsString() methods) which implements ClientConverter:
+       Continuing with our social security number converter example, here's our social security number converter Java class(the details of the Java code has been removed from the getAsObject() and getAsString() methods) which implements ClientConverter. Assume the javascript implementation above is in a javascript library named ssnConverter.js, :
       <source>
     package org.apache.myfaces.trinidaddemo.convertValidate;
     
@@ -179,76 +180,37 @@
           // some Java code ...
         }
      
-    
-      public String getClientConversion(
-        FacesContext context,
-       UIComponent component)
-      {    
-        // in a real app the messages would be translated
-        return "new SSNConverter({" + 
-                   "S:'Value \"{0}\" in \"{1}\" is too short.'," + 
-                   "L:'Value \"{0}\" in \"{1}\" is too long.'," + 
-                   "N:'Value \"{0}\" in \"{1}\" " + 
-                               "is not a social security number.'})";
-      }
-    
-      
-      public String getClientScript(
-       FacesContext context,
-       UIComponent component)
-      {      
-        // check if the script has already been returned this request
-        Object scriptReturned = 
-                    context.getExternalContext().getRequestMap().get(CONVERTER_ID);
-                    
-        // if scriptReturned is null the script hasn't been returned yet  
-        if ( scriptReturned == null)
-        {
-          context.getExternalContext().getRequestMap().put(CONVERTER_ID, 
-                                                           Boolean.TRUE);  
-          return  _sSSNjs;
-        }
-        // if scriptReturned is not null, then script has already been returned,
-        // so don't return it again.
-        else
-          return null;
-    
-       }
-      private static final String _sSSNjs =
-        "function ssnGetAsString(value)"+
-        "{return value.substring(0,3) + '-' " + 
-              "+ value.substring(3,5) + '-' + value.substring(5);}" +
-        "function ssnGetAsObject(value)" +
-          "{if (!value)return (void 0);" + 
-          "var len=value.length;"+
-          "var messageKey = SSNConverter.NOT;" +
-          "if (len &lt; 9 )"+
-            "messageKey = SSNConverter.SHORT;" +
-          "else if (len &gt; 11)"+
-            "messageKey = SSNConverter.LONG;" +
-          "else if (len == 9)" +
-          "{ if (!isNaN(value))" +
-              "return value;" +
-          "}" +        
-          "else if (len == 11 &amp;&amp; value.charAt(3) == '-' &amp;&amp; " +
-                    "value.charAt(6) == '-')" +
-          "{" +
-            "var result = value.substring(0,3) + value.substring(4,6) + " + 
-                        "value.substring(7);"+
-            "if (!isNaN(result))"+
-              "return result;" +
-          "}" +
-         "if (messageKey!=void(0) &amp;&amp; this._messages!=void(0))" +
-           "return new ConverterException(this._messages[messageKey]);" +
-         "return void(0);}" +
-        "function SSNConverter(messages)" +
-          "{this._messages = messages;}" +
-        "SSNConverter.prototype = new Converter();" +
-        "SSNConverter.prototype.getAsString = ssnGetAsString;" +
-        "SSNConverter.prototype.getAsObject = ssnGetAsObject;" +
-        "SSNConverter.SHORT = 'S';" +
-        "SSNConverter.LONG  = 'L';" +
-        "SSNConverter.NOT   = 'N';";
+         public Collection&lt;String&gt; getClientImportNames()
+         {
+           return null;
+         }
+ 
+         public String getClientLibrarySource(
+          FacesContext context)
+         {
+           return context.getExternalContext().getRequestContextPath() + 
+                   "/jsLibs/ssnConverter.js";    
+         }
+ 
+         public String getClientConversion(
+           FacesContext context,
+           UIComponent component)
+         {
+ 
+           // in a real app the messages would be translated
+           return ("new SSNConverter({"
+                   + "S:'Value \"{1}\" is too short.',"
+                   + "L:'Value \"{1}\" is too long.',"
+                   + "N:'Value \"{1}\" is not a valid social security number.'})"
+                   );
+         }
+ 
+         public String getClientScript(
+          FacesContext context,
+          UIComponent component)
+         {
+           return null;
+         }
           
     }
 

Modified: incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/ClientConverter.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/ClientConverter.java?rev=431837&r1=431836&r2=431837&view=diff
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/ClientConverter.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/convert/ClientConverter.java Tue Aug 15 22:56:39 2006
@@ -1,12 +1,12 @@
 /*
  * Copyright  2000-2006 The Apache Software Foundation.
- * 
+ *
  * Licensed 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.
@@ -15,13 +15,12 @@
  */
 package org.apache.myfaces.trinidad.convert;
 
+import java.util.Collection;
+
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 
 /**
- * <b>Please be aware that the api's for this interface are under review and
- * may change. It's likely there may be minor changes to the client-side
- * contract in the future.</b>
  * <p>
  * Interface implemented by Objects that wish to perform client-side
  * conversion in addition to server-side conversion.  Client side conversion
@@ -30,10 +29,10 @@
  * </p>
  *
  * <P>
- *     One of the benefits of ADF Faces is that it supports client-side versions of converters and validators. This means that errors can be caught on the client and a round trip avoided. This class can be used to add client-side conversion to a converter.
+ *     One of the benefits of Apache Trinidad is that it supports client-side versions of converters and validators. This means that errors can be caught on the client and a round trip avoided. This interface can be used to add client-side conversion to a converter.
  *     </P>
  *     <p>
- *     The basic idea of ADF Faces client-side conversion is that it works on the client in a very similar way to how it works on the server, except the language on the client is javascript instead of java. ADF Faces supports javascript Converter objects that support the methods getAsString() and getAsObject(). A Converter can throw a ConverterException.
+ *     The basic idea of Apache Trinidad client-side conversion is that it works on the client in a very similar way to how it works on the server, except the language on the client is javascript instead of java. Apache Trinidad supports javascript Converter objects that support the methods getAsString() and getAsObject(). A Converter can throw a ConverterException.
  *     </p>      Let's say you've written a javax.faces.convert.Converter implementation and now you want to add client-side conversion. The first thing to do is write a version of the converter in javascript. Here is the javascript code for the converter "interface".
  *     </p>
  *       <p>
@@ -71,7 +70,15 @@
  *   </ul>
  * </li>
  * </ul>
- * The javascript converter is attached using this interface, ClientConverter. The method <code>getClientScript()</code> is expected to return an implementation of the javascript Converter object. The method <code>getClientConversion()</code> is expected to return a  javascript constructor which will be used to instantiate an instance of the converter.
+ * The method
+ * <ul>
+ *   <li><code>getClientLibrarySource()</code> is expected to return a library
+ * that has an implementation of the javascript Converter object.</li>
+ *   <li><code>getClientConversion()</code> is expected to return a
+ * javascript constructor which will be used to instantiate an instance of the converter.</li>
+ *   <li><code>getClientScript()</code> can be used to write out inline js.</li>
+ *   <li><code>getClientImportNames()</code> is used to import the built-in scripts provided by Apache Trinidad.</li>
+ *  </ul>
  * </p>
  * <p>
  * @see javax.faces.convert.Converter
@@ -79,11 +86,31 @@
  */
 public interface ClientConverter
 {
+
+  /**
+   * Gets the URI specifying the location of the js lib resource.
+   * Only the first reference to a library will result in its being imported.
+   */
+  public String getClientLibrarySource(
+   FacesContext context);
+
+  /**
+   * Supports importing the built-in scripts provided by Apache Trinidad.
+   * It can be used to ensure that a Javascript function is available
+   * before using it in a Javascript handler.
+   * Only the first reference to a script will result in its being imported.
+   * <p>If this function returns null "Converter()" will be used.
+   * @return a collection of function names
+   */
+  public Collection<String> getClientImportNames();
+
+
   /**
    * Opportunity for the ClientConverter to return script content.
    * For HTML, this will be javascript that will be embedded in a
    * script tag. For HTML this method is expected to return an
    * implementation of the javascript Converter object.
+   * <p>Do not rely on this content being ppr updated.
    * <p>This method will be called once per converter instance.
    * Content that should only be written once per request
    * should only be returned once.

Modified: incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/ClientValidator.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/ClientValidator.java?rev=431837&r1=431836&r2=431837&view=diff
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/ClientValidator.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/validator/ClientValidator.java Tue Aug 15 22:56:39 2006
@@ -1,12 +1,12 @@
 /*
  * Copyright  2000-2006 The Apache Software Foundation.
- * 
+ *
  * Licensed 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.
@@ -15,25 +15,24 @@
  */
 package org.apache.myfaces.trinidad.validator;
 
+import java.util.Collection;
+
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 
-/** 
- * <b>Please be aware that the api's for this interface are under review and
- * may change. It's likely there may be minor changes to the client-side
- * contract in the future.</b>
+/**
  * <p>
  * Interface implemented by Objects that wish to perform client-side
  * validation in addition to server-side validation.  Client side validation
  * should always be the same or or more lenient than the server-side
  * validation.
  * </p>
- * 
+ *
  * <P>
- *     One of the benefits of ADF Faces is that it supports client-side versions of converters and validators. This means that errors can be caught on the client and a round trip avoided. This class can be used to add client-side validation to a validator.
+ *     One of the benefits of Apache Trinidad is that it supports client-side versions of converters and validators. This means that errors can be caught on the client and a round trip avoided. This interface can be used to add client-side validation to a validator.
  *     </P>
  *     <p>
- *     The basic idea of ADF Faces client-side validation is that it works on the client in a very similar way to how it works on the server, except the language on the client is javascript instead of java. ADF Faces supports javascript Validator objects that support the method validate(). A Validator can throw a ValidatorException.  
+ *     The basic idea of Apache Trinidad's client-side validation is that it works on the client in a very similar way to how it works on the server, except the language on the client is javascript instead of java. Apache Trinidad supports javascript Validator objects that support the method validate(). A Validator can throw a ValidatorException.
  *     </p>      Let's say you've written a javax.faces.validator.Validator implementation and now you want to add client-side validation. The first thing to do is write a version of the validator in javascript. Here is the javascript code for the validator "interface".
  *     </p>
  *       <p>
@@ -41,38 +40,65 @@
  * /**
  *  * Validator "interface" similar to javax.faces.validator.Validator,
  *  * except that all relevant information must be passed to the constructor
- *  * as the context and component are not passed to the validate method 
+ *  * as the context and component are not passed to the validate method
  *  * /
  * function Validator(){}
- * 
+ *
  * /**
- * * Perform the correctness checks implemented by this Validator. 
+ * * Perform the correctness checks implemented by this Validator.
  * * If any violations are found, a ValidatorException will be thrown.
  * * /
  * Validator.prototype.validate = function(value){}
- * 
+ *
  * </code></pre>
  * Validators can throw a ValidatorException, here is the signature:
  * <ul>
- * <li>ValidatorException(detail) 
+ * <li>ValidatorException(detail)
  *  <ul>
  *    <li>detail - Localized detail message text </li>
- *   </ul> 
+ *   </ul>
  * </li>
  * </ul>
- * The javascript validator is attached using this interface, ClientValidator. The method <code>getClientScript()</code> is expected to return an implementation of the javascript Validator object. The method <code>getClientValidation()</code> is expected to return a  javascript constructor which will be used to instantiate an instance of the validator. 
- * 
+ * The method
+ * <ul>
+ *   <li><code>getClientLibrarySource()</code> is expected to return a library
+ * that has an implementation of the javascript Validator object.</li>
+ *   <li><code>getClientValidation()</code> is expected to return a
+ * javascript constructor which will be used to instantiate an instance of the validator.</li>
+ *   <li><code>getClientScript()</code> can be used to write out inline js.</li>
+ *   <li><code>getClientImportNames()</code> is used to import the built-in scripts provided by Apache Trinidad.</li>
+ *  </ul>
  * <p>
  * @see javax.faces.validator.Validator
  */
 public interface ClientValidator
 {
+
+  /**
+   * Gets the URI specifying the location of the js lib resource.
+   * Only the first reference to a library will result in its being imported.
+   */
+  public String getClientLibrarySource(
+   FacesContext context);
+
+  /**
+   * Supports importing the built-in scripts provided by Apache Trinidad.
+   * It can be used to ensure that a Javascript function is available
+   * before using it in a Javascript handler.
+   * Only the first reference to a script will result in its being imported.
+   * <p>If this function returns null "Validator()" will be used.
+   * @return a collection of function names
+   */
+  public Collection<String> getClientImportNames();
+
+
  /**
    * Opportunity for the ClientValidator to return script content.
-   * For HTML, this will be javascript that will be embedded in a 
-   * script tag. For HTML this method is expected to return an 
+   * For HTML, this will be javascript that will be embedded in a
+   * script tag. For HTML this method is expected to return an
    * implementation of the javascript Validator object.
-   * <p>This method will be called once per validator instance. 
+   * <p>Do not rely on this content being ppr updated.
+   * <p>This method will be called once per validator instance.
    * Content that should only be written once per request
    * should only be returned once.
    */
@@ -82,15 +108,15 @@
 
   /**
    * Called to retrieve the appropriate client
-   * validation code for the node and context.  
-   * For HTML, this will be javascript that will be embedded in a 
-   * script tag. For HTML this method is expected to return a 
-   * constructor of the javascript Validator object 
+   * validation code for the node and context.
+   * For HTML, this will be javascript that will be embedded in a
+   * script tag. For HTML this method is expected to return a
+   * constructor of the javascript Validator object
    * returned by getClientScript().
    */
   public String getClientValidation(
    FacesContext context,
    UIComponent component);
 
- 
+
 }

Modified: incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/convertValidate/PasswordValidator.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/convertValidate/PasswordValidator.java?rev=431837&r1=431836&r2=431837&view=diff
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/convertValidate/PasswordValidator.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/convertValidate/PasswordValidator.java Tue Aug 15 22:56:39 2006
@@ -17,6 +17,8 @@
 package org.apache.myfaces.trinidaddemo.convertValidate;
 
 
+import java.util.Collection;
+
 import javax.faces.application.FacesMessage;
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
@@ -74,27 +76,25 @@
   }
 
 
+  public Collection<String> getClientImportNames()
+  {
+    return null;
+  }
+
+  public String getClientLibrarySource(
+   FacesContext context)
+  {
+    return context.getExternalContext().getRequestContextPath() + 
+            "/jsLibs/passwordValidator.js";    
+  }
+
+
   @SuppressWarnings("unchecked")
   public String getClientScript(
    FacesContext context,
    UIComponent component)
   {
-    // check if the script has already been returned this request
-    Object scriptReturned =
-                context.getExternalContext().getRequestMap().get(VALIDATOR_ID);
-
-    // if scriptReturned is null the script hasn't been returned yet
-    if ( scriptReturned == null)
-    {
-      context.getExternalContext().getRequestMap().put(VALIDATOR_ID,
-                                                       Boolean.TRUE);
-      return  _sPasswordValidatorJS;
-    }
-    // if scriptReturned is not null, then script has already been returned,
-    // so don't return it again.
-    else
       return null;
-
    }
 
   private static Object _getLabel(UIComponent component)
@@ -113,23 +113,7 @@
   // The fourth field marker gets the field label
   private static final String _VALIDATOR_INSTANCE_STRING =
     "new PasswordValidator({"
-    + "N:'{0} - The password value must contain at least one number.'})";
+    + "N:'The password value must contain at least one number.'})";
+
 
-  private static final String _sPasswordValidatorJS =
-    "function passwordValidate(value)" +
-       "{if (!value)return void (0);" +
-        "if (value == '******')return void (0);" +
-        "var messageKey = PasswordValidator.NUMBER;" +
-        "for (var i = 0; i < value.length; i++)" +
-        "{var subValue = value.substring(i, i+1);" +
-         "if (!isNaN(parseInt(subValue))){" +
-            "messageKey = void (0);break;}}" +
-        "if (messageKey != void(0))" +
-          "return new ValidatorException(this._messages[messageKey]);" +
-        "return void(0);}" +
-    "function PasswordValidator(messages)" +
-      "{this._messages = messages;}" +
-    "PasswordValidator.prototype = new Validator();" +
-    "PasswordValidator.prototype.validate = passwordValidate;" +
-    "PasswordValidator.NUMBER = 'N';" ;
 }

Modified: incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/convertValidate/SSNConverter.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/convertValidate/SSNConverter.java?rev=431837&r1=431836&r2=431837&view=diff
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/convertValidate/SSNConverter.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/java/org/apache/myfaces/trinidaddemo/convertValidate/SSNConverter.java Tue Aug 15 22:56:39 2006
@@ -16,6 +16,7 @@
 
 package org.apache.myfaces.trinidaddemo.convertValidate;
 
+import java.util.Collection;
 
 import javax.faces.application.FacesMessage;
 import javax.faces.component.UIComponent;
@@ -100,7 +101,6 @@
         return null;
 
       Integer integerValue = (Integer)value;
-      int intValue = integerValue.intValue();
 
       String valueString = integerValue.toString();
 
@@ -111,6 +111,18 @@
     }
 
 
+  public Collection<String> getClientImportNames()
+  {
+    return null;
+  }
+
+  public String getClientLibrarySource(
+   FacesContext context)
+  {
+    return context.getExternalContext().getRequestContextPath() + 
+            "/jsLibs/ssnConverter.js";    
+  }
+
   public String getClientConversion(
     FacesContext context,
    UIComponent component)
@@ -129,24 +141,9 @@
    FacesContext context,
    UIComponent component)
   {
-    // check if the script has already been returned this request
-    Object scriptReturned =
-                context.getExternalContext().getRequestMap().get(CONVERTER_ID);
-
-    // if scriptReturned is null the script hasn't been returned yet
-    if ( scriptReturned == null)
-    {
-      context.getExternalContext().getRequestMap().put(CONVERTER_ID,
-                                                       Boolean.TRUE);
-      return  _sSSNjs;
-    }
-    // if scriptReturned is not null, then script has already been returned,
-    // so don't return it again.
-    else
-      return null;
-
-   }
-
+    return null;
+  }
+  
   private LabeledFacesMessage _getMessage(
    UIComponent component,
    String text)
@@ -176,41 +173,5 @@
 
   private static final String _INVALID_ERROR_TEXT
     = "The value is not a valid social security number";
-
-  private static final String _sSSNjs =
-    "function ssnGetAsString(value)"+
-    "{return value.substring(0,3) + '-' " +
-          "+ value.substring(3,5) + '-' + value.substring(5);}" +
-    "function ssnGetAsObject(value)" +
-      "{if (!value)return (void 0);" +
-      "var len=value.length;"+
-      "var messageKey = SSNConverter.NOT;" +
-      "if (len < 9 )"+
-        "messageKey = SSNConverter.SHORT;" +
-      "else if (len > 11)"+
-        "messageKey = SSNConverter.LONG;" +
-      "else if (len == 9)" +
-      "{ if (!isNaN(value))" +
-          "return value;" +
-      "}" +
-      "else if (len == 11 && value.charAt(3) == '-' && " +
-                "value.charAt(6) == '-')" +
-      "{" +
-        "var result = value.substring(0,3) + value.substring(4,6) + " +
-                    "value.substring(7);"+
-        "if (!isNaN(result))"+
-          "return result;" +
-      "}" +
-     "if (messageKey!=void(0) && this._messages!=void(0))" +
-       "return new ConverterException(this._messages[messageKey]);" +
-     "return void(0);}" +
-    "function SSNConverter(messages)" +
-      "{this._messages = messages;}" +
-    "SSNConverter.prototype = new Converter();" +
-    "SSNConverter.prototype.getAsString = ssnGetAsString;" +
-    "SSNConverter.prototype.getAsObject = ssnGetAsObject;" +
-    "SSNConverter.SHORT = 'S';" +
-    "SSNConverter.LONG  = 'L';" +
-    "SSNConverter.NOT   = 'N';";
 
 }

Added: incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/jsLibs/passwordValidator.js
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/jsLibs/passwordValidator.js?rev=431837&view=auto
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/jsLibs/passwordValidator.js (added)
+++ incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/jsLibs/passwordValidator.js Tue Aug 15 22:56:39 2006
@@ -0,0 +1,94 @@
+/*
+ * Copyright  2000-2006 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+function passwordValidate(value)
+{
+  if (!value)
+    return null;
+    
+  if (value == '******')
+    return null;
+    
+  var messageKey = PasswordValidator.NUMBER;
+  
+  for (var i = 0; i < value.length; i++)
+  {
+    var subValue = value.substring(i, i+1);
+    
+    if (!isNaN(parseInt(subValue)))
+    {
+      messageKey = null;break;
+    }
+  }
+  
+  if (messageKey != null)
+    return new ValidatorException(this._messages[messageKey]);
+    
+  return null;
+}
+
+function PasswordValidator(messages)
+  {this._messages = messages;}
+PasswordValidator.prototype = new Validator();
+PasswordValidator.prototype.validate = passwordValidate;
+PasswordValidator.NUMBER = 'N'; 
+/*
+ * Copyright  2000-2006 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+function passwordValidate(value)
+{
+  if (!value)
+    return null;
+    
+  if (value == '******')
+    return null;
+    
+  var messageKey = PasswordValidator.NUMBER;
+  
+  for (var i = 0; i < value.length; i++)
+  {
+    var subValue = value.substring(i, i+1);
+    
+    if (!isNaN(parseInt(subValue)))
+    {
+      messageKey = null;break;
+    }
+  }
+  
+  if (messageKey != null)
+    return new ValidatorException(this._messages[messageKey]);
+    
+  return null;
+}
+
+function PasswordValidator(messages)
+  {this._messages = messages;}
+PasswordValidator.prototype = new Validator();
+PasswordValidator.prototype.validate = passwordValidate;
+PasswordValidator.NUMBER = 'N'; 
\ No newline at end of file

Added: incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/jsLibs/ssnConverter.js
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/jsLibs/ssnConverter.js?rev=431837&view=auto
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/jsLibs/ssnConverter.js (added)
+++ incubator/adffaces/trunk/trinidad/trinidad-demo/src/main/webapp/jsLibs/ssnConverter.js Tue Aug 15 22:56:39 2006
@@ -0,0 +1,110 @@
+/*
+ * Copyright  2000-2006 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+function ssnGetAsString(value)
+{
+  return value.substring(0,3) + '-' + value.substring(3,5) + '-' + value.substring(5);
+}
+
+function ssnGetAsObject(value)
+{ 
+  if (!value)return null;
+  var len=value.length;
+  var messageKey = SSNConverter.NOT;
+  if (len < 9 )
+    messageKey = SSNConverter.SHORT;
+  else if (len > 11)
+    messageKey = SSNConverter.LONG;
+  else if (len == 9)
+  { if (!isNaN(value))
+      return value;
+  }
+  else if (len == 11 && value.charAt(3) == '-' && 
+            value.charAt(6) == '-')
+  {
+    var result = value.substring(0,3) + value.substring(4,6) + 
+                value.substring(7);
+    if (!isNaN(result))
+      return result;
+  }
+ if (messageKey!=null && this._messages!=null)
+ {
+   return new ConverterException(this._messages[messageKey]);
+ }
+ return null;}
+function SSNConverter(messages)
+  {this._messages = messages;}
+SSNConverter.prototype = new Converter();
+SSNConverter.prototype.getAsString = ssnGetAsString;
+SSNConverter.prototype.getAsObject = ssnGetAsObject;
+SSNConverter.SHORT = 'S';
+SSNConverter.LONG  = 'L';
+SSNConverter.NOT   = 'N';
+/*
+ * Copyright  2000-2006 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ */
+
+function ssnGetAsString(value)
+{
+  return value.substring(0,3) + '-' + value.substring(3,5) + '-' + value.substring(5);
+}
+
+function ssnGetAsObject(value)
+{ 
+  if (!value)return null;
+  var len=value.length;
+  var messageKey = SSNConverter.NOT;
+  if (len < 9 )
+    messageKey = SSNConverter.SHORT;
+  else if (len > 11)
+    messageKey = SSNConverter.LONG;
+  else if (len == 9)
+  { if (!isNaN(value))
+      return value;
+  }
+  else if (len == 11 && value.charAt(3) == '-' && 
+            value.charAt(6) == '-')
+  {
+    var result = value.substring(0,3) + value.substring(4,6) + 
+                value.substring(7);
+    if (!isNaN(result))
+      return result;
+  }
+ if (messageKey!=null && this._messages!=null)
+ {
+   return new ConverterException(this._messages[messageKey]);
+ }
+ return null;}
+function SSNConverter(messages)
+  {this._messages = messages;}
+SSNConverter.prototype = new Converter();
+SSNConverter.prototype.getAsString = ssnGetAsString;
+SSNConverter.prototype.getAsObject = ssnGetAsObject;
+SSNConverter.SHORT = 'S';
+SSNConverter.LONG  = 'L';
+SSNConverter.NOT   = 'N';
\ No newline at end of file

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=431837&r1=431836&r2=431837&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 Tue Aug 15 22:56:39 2006
@@ -16,10 +16,15 @@
 
 package org.apache.myfaces.trinidadinternal.convert;
 
+import java.util.Collection;
+import java.util.Collections;
+
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 import javax.faces.convert.ConverterException;
 
+import org.apache.myfaces.trinidad.convert.ClientConverter;
+
 /**
  * <p>Implementation for <code>java.lang.Byte</code> values.</p>
  *
@@ -27,7 +32,7 @@
  * @author The Oracle ADF Faces Team
  */
 public class ByteConverter extends javax.faces.convert.ByteConverter
-                              implements InternalClientConverter
+                           implements ClientConverter
 {
 
 
@@ -89,12 +94,11 @@
   {
     return null;
   }
-
-  public String getLibKey(
-   FacesContext context,
-   UIComponent component)
+  
+  public String getClientLibrarySource(
+   FacesContext context)
   {
-    return "DecimalConvert()";
+    return null;
   }
 
   /**
@@ -113,7 +117,13 @@
                                               _BYTE_MAX, _BYTE_MIN);
   }
 
+  public Collection<String> getClientImportNames()
+  {
+    return _IMPORT_NAMES;
+  }
+
 
   private static final String _BYTE_MAX = Byte.toString(Byte.MAX_VALUE);
   private static final String _BYTE_MIN = Byte.toString(Byte.MIN_VALUE);
+  private static final Collection<String> _IMPORT_NAMES = Collections.singletonList( "DecimalConvert()" );
 }

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=431837&r1=431836&r2=431837&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 Tue Aug 15 22:56:39 2006
@@ -15,11 +15,14 @@
  */
 package org.apache.myfaces.trinidadinternal.convert;
 
+import java.util.Collection;
+import java.util.Collections;
 import java.util.Map;
 
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 
+import org.apache.myfaces.trinidad.convert.ClientConverter;
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
 import org.apache.myfaces.trinidad.util.MessageFactory;
 
@@ -32,14 +35,19 @@
  * @author The Oracle ADF Faces Team
  */
 public class ColorConverter extends org.apache.myfaces.trinidad.convert.ColorConverter
-                            implements InternalClientConverter
+                            implements ClientConverter
 {
 
-  public String getLibKey(FacesContext context, UIComponent component)
+  public String getClientLibrarySource(
+   FacesContext context)
   {
-    return "ColorFormat()";
+    return null;
+  }
+  
+  public Collection<String> getClientImportNames()
+  {
+    return _IMPORT_NAMES;
   }
-
 
   @SuppressWarnings("unchecked")
   public String getClientScript(FacesContext context, UIComponent component)
@@ -244,7 +252,8 @@
     return MessageFactory.getMessage(context, CONVERT_MESSAGE_ID,
                                            convMsgDet, params).getDetail();
   }
-
+  
+  private static final Collection<String> _IMPORT_NAMES = Collections.singletonList( "ColorFormat()" );
   private static final TrinidadLogger _LOG = TrinidadLogger.createTrinidadLogger(ColorConverter.class);
   private static final Object _PATTERN_WRITTEN_KEY = new Object();
 }

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=431837&r1=431836&r2=431837&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 Tue Aug 15 22:56:39 2006
@@ -18,6 +18,8 @@
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 
+import java.util.Collection;
+import java.util.Collections;
 import java.util.Date;
 import java.util.Locale;
 import java.util.Map;
@@ -36,6 +38,7 @@
 import javax.faces.component.ValueHolder;
 import javax.faces.convert.Converter;
 
+import org.apache.myfaces.trinidad.convert.ClientConverter;
 import org.apache.myfaces.trinidadinternal.ui.laf.base.xhtml.XhtmlLafUtils;
 
 /**
@@ -47,8 +50,8 @@
  * @author The Oracle ADF Faces Team
  */
 public class DateTimeConverter extends org.apache.myfaces.trinidad.convert.DateTimeConverter
-                                   implements InternalClientConverter
-
+                               implements ClientConverter
+                                   
 {
   public DateTimeConverter()
   {
@@ -238,12 +241,19 @@
     }
   }
 
-  public String getLibKey(FacesContext context, UIComponent component)
+
+  public Collection<String> getClientImportNames()
   {
-    return "SimpleDateFormat()";
+    return _IMPORT_NAMES;
   }
 
 
+  public String getClientLibrarySource(
+   FacesContext context)
+  {
+    return null;
+  }
+
    /**
    * Returns the number of columns of text a field should
    * have to fully display the contents of a valid string.
@@ -510,5 +520,6 @@
   private static final String _GMT_MINUS = "GMT-";
   private static final int _MILLIS_PER_HOUR = 60 * 60 * 1000;
   private static final int _MILLIS_PER_MINUTE = 60 * 1000;
+  private static final Collection<String> _IMPORT_NAMES = Collections.singletonList("SimpleDateFormat()" );
 
 }

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=431837&r1=431836&r2=431837&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 Tue Aug 15 22:56:39 2006
@@ -15,17 +15,22 @@
  */
 package org.apache.myfaces.trinidadinternal.convert;
 
+import java.util.Collection;
+import java.util.Collections;
+
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 import javax.faces.convert.ConverterException;
 
+import org.apache.myfaces.trinidad.convert.ClientConverter;
+
 /**
  * <p>Implementation for <code>java.lang.Double</code> values.</p>
  *
  * @author The Oracle ADF Faces Team
  */
 public class DoubleConverter extends javax.faces.convert.DoubleConverter
-                             implements InternalClientConverter
+                             implements ClientConverter
 {
     /**
      * <p>The message identifier of the FacesMessage to be created if
@@ -62,13 +67,6 @@
     return null;
   }
 
-  public String getLibKey(
-   FacesContext context,
-   UIComponent component)
-  {
-    return "DecimalConvert()";
-  }
-
   /**
    * @todo translations
    * @param context
@@ -80,5 +78,18 @@
   {
     return ConverterUtils.getClientConversion(context,component,CONVERT_MESSAGE_ID);
   }
+
+  public Collection<String> getClientImportNames()
+  {
+    return _IMPORT_NAMES;
+  }
+  
+  public String getClientLibrarySource(
+   FacesContext context)
+  {
+    return null;
+  }
+
+  private static final Collection<String> _IMPORT_NAMES = Collections.singletonList( "DecimalConvert()" );
 
 }

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=431837&r1=431836&r2=431837&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 Tue Aug 15 22:56:39 2006
@@ -15,17 +15,22 @@
  */
 package org.apache.myfaces.trinidadinternal.convert;
 
+import java.util.Collection;
+import java.util.Collections;
+
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 import javax.faces.convert.ConverterException;
 
+import org.apache.myfaces.trinidad.convert.ClientConverter;
+
 /**
  * <p>Implementation for <code>java.lang.Float</code> values.</p>
  *
  * @author The Oracle ADF Faces Team
  */
 public class FloatConverter extends javax.faces.convert.FloatConverter
-                            implements InternalClientConverter
+                            implements ClientConverter
 {
     /**
      * <p>The message identifier of the FacesMessage to be created if
@@ -61,12 +66,6 @@
     return null;
   }
 
-  public String getLibKey(
-   FacesContext context,
-   UIComponent component)
-  {
-    return "DecimalConvert()";
-  }
 
   /**
    * @todo translations
@@ -79,4 +78,17 @@
   {
     return ConverterUtils.getClientConversion(context,component,CONVERT_MESSAGE_ID);
   }
+
+  public Collection<String> getClientImportNames()
+  {
+    return _IMPORT_NAMES;
+  }
+  
+  public String getClientLibrarySource(
+   FacesContext context)
+  {
+    return null;
+  }  
+
+  private static final Collection<String> _IMPORT_NAMES = Collections.singletonList( "DecimalConvert()" );  
 }

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=431837&r1=431836&r2=431837&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 Tue Aug 15 22:56:39 2006
@@ -15,10 +15,15 @@
  */
 
 package org.apache.myfaces.trinidadinternal.convert;
+
+import java.util.Collection;
+import java.util.Collections;
+
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 import javax.faces.convert.ConverterException;
 
+import org.apache.myfaces.trinidad.convert.ClientConverter;
 import org.apache.myfaces.trinidadinternal.util.IntegerUtils;
 
 
@@ -29,7 +34,7 @@
  * @author The Oracle ADF Faces Team
  */
 public class IntegerConverter extends javax.faces.convert.IntegerConverter
-                              implements InternalClientConverter
+                              implements ClientConverter
 {
 
 
@@ -98,15 +103,13 @@
     return null;
   }
 
-  public String getLibKey(
-   FacesContext context,
-   UIComponent component)
+  public String getClientLibrarySource(
+   FacesContext context)
   {
-    return "DecimalConvert()";
+    return null;
   }
 
   /**
-   * @todo translations
    * @param context
    * @return
    */
@@ -122,8 +125,16 @@
   }
 
 
+  public Collection<String> getClientImportNames()
+  {
+    return _IMPORT_NAMES;
+  }
+
+
   private static final String  _INT_MIN
     = IntegerUtils.getString(Integer.MIN_VALUE);
   private static final String  _INT_MAX
     = IntegerUtils.getString(Integer.MAX_VALUE);
+    
+  private static final Collection<String> _IMPORT_NAMES = Collections.singletonList( "DecimalConvert()" );
 }

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=431837&r1=431836&r2=431837&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 Tue Aug 15 22:56:39 2006
@@ -16,10 +16,15 @@
 package org.apache.myfaces.trinidadinternal.convert;
 
 
+import java.util.Collection;
+import java.util.Collections;
+
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 
 import javax.faces.convert.ConverterException;
+
+import org.apache.myfaces.trinidad.convert.ClientConverter;
 import org.apache.myfaces.trinidadinternal.util.IntegerUtils;
 
 
@@ -29,7 +34,7 @@
  * @author The Oracle ADF Faces Team
  */
 public class LongConverter extends javax.faces.convert.LongConverter
-                              implements InternalClientConverter
+                           implements ClientConverter
 {
 
     /**
@@ -93,17 +98,14 @@
   {
     return null;
   }
-
-  public String getLibKey(
-   FacesContext context,
-   UIComponent component)
+  
+  public String getClientLibrarySource(
+   FacesContext context)
   {
-    return "DecimalConvert()";
+    return null;
   }
 
-
  /**
-   * @todo translations
    * @param context
    * @return
    */
@@ -119,8 +121,15 @@
   }
 
 
+  public Collection<String> getClientImportNames()
+  {
+    return _IMPORT_NAMES;
+  }
+
+
   private static final String _LONG_MIN
     = IntegerUtils.getString(Long.MIN_VALUE);
   private static final String _LONG_MAX
     = IntegerUtils.getString(Long.MAX_VALUE);
+  private static final Collection<String> _IMPORT_NAMES = Collections.singletonList( "DecimalConvert()" );
 }

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=431837&r1=431836&r2=431837&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 Tue Aug 15 22:56:39 2006
@@ -16,10 +16,15 @@
 
 package org.apache.myfaces.trinidadinternal.convert;
 
+import java.util.Collection;
+import java.util.Collections;
+
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 import javax.faces.convert.ConverterException;
 
+import org.apache.myfaces.trinidad.convert.ClientConverter;
+
 /**
  * <p>Implementation for <code>java.lang.Short</code> values.</p>
  *
@@ -27,7 +32,7 @@
  * @author The Oracle ADF Faces Team
  */
 public class ShortConverter extends javax.faces.convert.ShortConverter
-                              implements InternalClientConverter
+                            implements ClientConverter
 {
 
 
@@ -93,13 +98,6 @@
     return null;
   }
 
-  public String getLibKey(
-   FacesContext context,
-   UIComponent component)
-  {
-    return "DecimalConvert()";
-  }
-
   /**
    * @todo translations
    * @param context
@@ -115,8 +113,19 @@
                                               CONVERT_MESSAGE_ID,
                                               _SHORT_MAX, _SHORT_MIN);
   }
+  
+  public String getClientLibrarySource(
+   FacesContext context)
+  {
+    return null;
+  }
 
+  public Collection<String> getClientImportNames()
+  {
+    return _IMPORT_NAMES;
+  }
 
   private static final String _SHORT_MAX = Short.toString(Short.MAX_VALUE);
   private static final String _SHORT_MIN = Short.toString(Short.MIN_VALUE);
+  private static final Collection<String> _IMPORT_NAMES = Collections.singletonList( "DecimalConvert()" );
 }

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=431837&r1=431836&r2=431837&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 Tue Aug 15 22:56:39 2006
@@ -17,6 +17,7 @@
 import java.io.IOException;
 
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -36,12 +37,10 @@
 import org.apache.myfaces.trinidad.util.MessageFactory;
 import org.apache.myfaces.trinidad.validator.ClientValidator;
 
-import org.apache.myfaces.trinidadinternal.convert.InternalClientConverter;
 import org.apache.myfaces.trinidadinternal.renderkit.RenderingContext;
 import org.apache.myfaces.trinidadinternal.share.data.ServletRequestParameters;
 import org.apache.myfaces.trinidadinternal.share.util.FastMessageFormat;
 import org.apache.myfaces.trinidadinternal.util.IntegerUtils;
-import org.apache.myfaces.trinidadinternal.validator.InternalClientValidator;
 
 /**
  *@todo - this needs to be moved to the renderkit package
@@ -347,12 +346,17 @@
       _addValidatedInput(clientId);
     }
 
+    FacesContext context = FacesContext.getCurrentInstance();
+    RenderingContext rc = RenderingContext.getCurrentInstance();
+
     if (converter != null && converter instanceof ClientConverter)
     {
       if (convertValidateInfo == null)
         convertValidateInfo = _getNewConvertValidate(clientId);
 
-      _addOnSubmitConverter( component,
+      _addOnSubmitConverter(context,
+                            rc,
+                            component,
                             ((ClientConverter) converter),
                             convertValidateInfo,
                             clientId);
@@ -376,10 +380,12 @@
           if (convertValidateInfo == null)
             convertValidateInfo = _getNewConvertValidate(clientId);
 
-          _addOnSubmitValidator( component,
-                                 ((ClientValidator)validator),
-                                 convertValidateInfo,
-                                 clientId);
+          _addOnSubmitValidator(context,
+                                rc,
+                                component,
+                                ((ClientValidator)validator),
+                                convertValidateInfo,
+                                clientId);
         }
       }
     }
@@ -439,6 +445,8 @@
    * @todo get rid of the colorpicker hack!
    */
   private void _addOnSubmitConverter(
+    FacesContext              context,
+    RenderingContext          rc,
     UIComponent               component,
     ClientConverter           submitConverter,
     FormData.ConvertValidate  convertValidate,
@@ -452,29 +460,15 @@
       component = new org.apache.myfaces.trinidad.component.UIXInput();
       component.setId(clientId);
 
-    }
-
-    FacesContext fcontext = FacesContext.getCurrentInstance();
-    if (submitConverter instanceof InternalClientConverter)
-    {
-      InternalClientConverter internalConverter =
-                                     (InternalClientConverter)submitConverter;
-      // Write the client dependencies for the onSubmitValidator
-      String clientLibrary = internalConverter.getLibKey(fcontext, component);
-
-      _writeDependencies(fcontext, clientLibrary);
-
-    }
-
-    String clientDependency = submitConverter.getClientScript(fcontext,
-                                                              component);
-    if (clientDependency != null)
-    {
-      List<String> clientDependencies = getClientDependencies(true);
-      clientDependencies.add(clientDependency);
-    }
+    }    
+    
+    // write out the lib(s) and script
+    String libURI = submitConverter.getClientLibrarySource(context);  
+    String clientScript = submitConverter.getClientScript(context, component);
+    Collection<String> libRefs = submitConverter.getClientImportNames();  
+    _addClientScripts(context, rc, libURI, clientScript, libRefs, "Converter()");
 
-    String converter = submitConverter.getClientConversion(fcontext,
+    String converter = submitConverter.getClientConversion(context,
                                                            component);
 
     if (converter != null)
@@ -485,6 +479,45 @@
     }
   }
 
+  
+  private void _addClientScripts(
+    FacesContext        context,
+    RenderingContext    rc,
+    String              libURI,
+    String              clientScript,
+    Collection<String>  libRefs,
+    String              defaultLibRef
+  )throws IOException
+  {
+    if (libURI != null)
+    {
+      // check if it's already been written
+      Map props = rc.getProperties();
+      if( props.get(libURI) == null)
+      {        
+        // put the lib name in the property map so it won't be written out again
+        props.put(libURI, Boolean.TRUE);
+        XhtmlUtils.writeLibImport(context, rc, libURI);          
+      } 
+    }
+  
+    if(libRefs != null)
+    {
+      _writeDependencies(context, rc, libRefs);
+    }
+    else
+    {
+      _writeDependencies(context, rc, defaultLibRef);
+    }
+    
+    if ( clientScript != null)
+    {
+      List<String> clientDependencies = getClientDependencies(true);
+      clientDependencies.add(clientScript);
+    }
+  }
+  
+
 
   /**
    * @todo Is there a way to remove the hack we have introduced, if the
@@ -492,36 +525,22 @@
    * @todo =-= bts make package private
    */
   private void _addOnSubmitValidator(
+    FacesContext              context,
+    RenderingContext          rc,
     UIComponent               component,
     ClientValidator           submitValidator,
     FormData.ConvertValidate  convertValidate,
     String                    clientId
     ) throws IOException
   {
-    FacesContext fContext = FacesContext.getCurrentInstance();
-
-    if (submitValidator instanceof InternalClientValidator)
-    {
-      InternalClientValidator internalValidator =
-                                     (InternalClientValidator)submitValidator;
-
-      // Write the client dependencies for the onSubmitValidator
-      String clientLibrary = internalValidator.getLibKey(fContext, component);
-
-      _writeDependencies(fContext, clientLibrary);
-    }
-    else
-    {
-      String clientDependency = submitValidator.getClientScript(fContext,
-                                                                component);
-      if (clientDependency != null)
-      {
-        List<String> clientDependencies = getClientDependencies(true);
-        clientDependencies.add(clientDependency);
-      }
-    }
-
-    String validator = submitValidator.getClientValidation(fContext,
+        
+    // write out the lib(s) and script
+    String libURI = submitValidator.getClientLibrarySource(context);  
+    String clientScript = submitValidator.getClientScript(context, component);
+    Collection<String> libRefs = submitValidator.getClientImportNames();  
+    _addClientScripts(context, rc, libURI, clientScript, libRefs, "Validator()");
+ 
+    String validator = submitValidator.getClientValidation(context,
                                                            component);
 
     if (validator != null)
@@ -700,8 +719,9 @@
    * JavaScript libraries.
    */
   static private void _writeDependencies(
-    FacesContext context,
-    String      libReference
+    FacesContext     context,
+    RenderingContext rc,
+    String           libReference
     ) throws IOException
   {
     String contentType = context.getResponseWriter().getContentType();
@@ -710,10 +730,34 @@
         (null == contentType))
     {
       XhtmlUtils.addLib(context,
-                        RenderingContext.getCurrentInstance(),
+                        rc,
                         libReference);
     }
   }
+  
+  /**
+    * Opportunity for the ClientConverter or Validator to write any of its dependencies
+    * to the output.  For HTML, this will typically be imports of
+    * JavaScript libraries.
+    */
+   static private void _writeDependencies(
+     FacesContext        context,
+     RenderingContext    rc,
+     Collection<String>  libRefs
+     ) throws IOException
+   {
+     String contentType = context.getResponseWriter().getContentType();
+     if ("text/html".equals(contentType) ||
+         "application/xhtml+xml".equals(contentType) ||
+         (null == contentType))
+     {
+       Object[] libRefArray = libRefs.toArray();
+       for (int i = 0; i < libRefArray.length; i++)
+       {
+         XhtmlUtils.addLib(context, rc, libRefArray[i]);    
+       } 
+     }
+   }  
 
   private int _inputTextCount = 0;
   private String _defaultCommandId = null;

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=431837&r1=431836&r2=431837&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 Tue Aug 15 22:56:39 2006
@@ -19,6 +19,8 @@
 import java.nio.charset.Charset;
 import java.nio.charset.IllegalCharsetNameException;
 
+import java.util.Collection;
+import java.util.Collections;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -28,6 +30,7 @@
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
 import org.apache.myfaces.trinidad.util.MessageFactory;
 
+import org.apache.myfaces.trinidad.validator.ClientValidator;
 import org.apache.myfaces.trinidadinternal.ui.laf.base.xhtml.XhtmlLafUtils;
 
 /**
@@ -37,37 +40,21 @@
  */
 public class ByteLengthValidator
               extends org.apache.myfaces.trinidad.validator.ByteLengthValidator
-              implements InternalClientValidator
+              implements ClientValidator
 {
   public ByteLengthValidator()
   {
     super();
   }
 
-  /**
-   * {@inheritDoc}
-   */
-  public String getLibKey(
-    FacesContext context,
-    UIComponent component
-    )
+  
+  public String getClientLibrarySource(
+   FacesContext context)
   {
-
-    switch (_getType(getEncoding()))
-    {
-      case _SINGLE_BYTE_TYPE:
-        return "SBFormat()";
-      case _CJK_TYPE:
-        return "CjkFormat()";
-      case _UTF8_TYPE:
-        return "Utf8Format()";
-
-      case _UNSUPPORTED_TYPE:
-      default:
-        return null;
-    }
+    return null;
   }
 
+
   /**
    * {@inheritDoc}
    */
@@ -135,6 +122,27 @@
     return constr.toString();
   }
 
+  /**
+   * {@inheritDoc}
+   */
+  public Collection<String> getClientImportNames()
+  {
+
+    switch (_getType(getEncoding()))
+    {
+      case _SINGLE_BYTE_TYPE:
+        return _IMPORT_NAMES_SINGLE_BYTE;
+      case _CJK_TYPE:
+        return _IMPORT_NAMES_CJK;
+      case _UTF8_TYPE:
+        return _IMPORT_NAMES_UTF8;
+
+      case _UNSUPPORTED_TYPE:
+      default:
+        return null;
+    }
+  }
+
   static private int _getType(String encoding)
   {
 
@@ -418,7 +426,11 @@
     for (int i = 0; i < singleByteArray.length; i++)
       _singleByteEncodings.add(singleByteArray[i]);
   }
-
+  private static final Collection<String> _IMPORT_NAMES_SINGLE_BYTE = Collections.singletonList("SBFormat()" ); 
+  private static final Collection<String> _IMPORT_NAMES_CJK = Collections.singletonList("CjkFormat()" ); 
+  private static final Collection<String> _IMPORT_NAMES_UTF8 = Collections.singletonList("Utf8Format()" ); 
+  
  private static final TrinidadLogger _LOG =  TrinidadLogger.createTrinidadLogger(ByteLengthValidator.class);
+
 
 }

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=431837&r1=431836&r2=431837&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 Tue Aug 15 22:56:39 2006
@@ -15,6 +15,10 @@
  */
 
 package org.apache.myfaces.trinidadinternal.validator;
+
+import java.util.Collection;
+import java.util.Collections;
+
 import javax.faces.application.FacesMessage;
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
@@ -22,6 +26,7 @@
 import javax.faces.validator.ValidatorException;
 import org.apache.myfaces.trinidad.util.MessageFactory;
 
+import org.apache.myfaces.trinidad.validator.ClientValidator;
 import org.apache.myfaces.trinidadinternal.convert.ConverterUtils;
 import org.apache.myfaces.trinidadinternal.util.IntegerUtils;
 
@@ -34,7 +39,7 @@
  * @author The Oracle ADF Faces Team
  */
 public class LongRangeValidator extends javax.faces.validator.LongRangeValidator
-                                implements InternalClientValidator
+                                implements ClientValidator
 {
   @Override
   public void validate(
@@ -86,11 +91,10 @@
     }     
   }
 
-  public String getLibKey(
-   FacesContext context,
-   UIComponent component)
+  
+  public Collection<String> getClientImportNames()
   {
-    return "DecimalConvert()";
+    return _IMPORT_NAMES;
   }
 
   public String getClientScript(
@@ -117,6 +121,14 @@
                                                VALIDATOR_ID,
                                                maxStr, minStr);
   }
+  
+  
+  public String getClientLibrarySource(
+   FacesContext context)
+  {
+    return null;
+  }
+  
 
   // not overriding getMaximum because I'll suddenly
   // start returning something other than 0...
@@ -191,5 +203,6 @@
 
   private boolean _maximumSet = false;
   private boolean _minimumSet = false;
+  private static final Collection<String> _IMPORT_NAMES = Collections.singletonList( "DecimalConvert()" );
 
 }

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=431837&r1=431836&r2=431837&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 Tue Aug 15 22:56:39 2006
@@ -15,18 +15,22 @@
  */
 package org.apache.myfaces.trinidadinternal.validator;
 
+import java.util.Collection;
+import java.util.Collections;
+
 import javax.faces.component.UIComponent;
 import javax.faces.context.FacesContext;
 
 import org.apache.myfaces.trinidad.logging.TrinidadLogger;
 import org.apache.myfaces.trinidad.util.MessageFactory;
 
+import org.apache.myfaces.trinidad.validator.ClientValidator;
 import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.FormRenderer;
 import org.apache.myfaces.trinidadinternal.renderkit.core.xhtml.XhtmlUtils;
 
 public class RegExpValidator
                        extends org.apache.myfaces.trinidad.validator.RegExpValidator
-                         implements InternalClientValidator
+                         implements ClientValidator
 {
   public RegExpValidator()
   {
@@ -91,20 +95,17 @@
 
     return outBuffer.toString();
   }
-
-  /**
-   * @todo again here we dont check for the component nor the client id.
-   * If it true in getClientScript it should be true here to.
-   */
-  public String getLibKey(
-    FacesContext context,
-    UIComponent component
-    )
+  
+  public Collection<String> getClientImportNames()
   {
-     return "RegExpFormat()";
+    return _IMPORT_NAMES;
+  }
+  
+  public String getClientLibrarySource(
+   FacesContext context)
+  {
+    return null;
   }
-
- 
 
   private String _getNoMatchMessageDetail(
     FacesContext context)
@@ -125,4 +126,7 @@
   @SuppressWarnings("unused")
   private static final TrinidadLogger _LOG  = TrinidadLogger.createTrinidadLogger(
      RegExpValidator.class);
+     
+
+  private static final Collection<String> _IMPORT_NAMES = Collections.singletonList( "RegExpFormat()" );     
 }

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=431837&r1=431836&r2=431837&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 Tue Aug 15 22:56:39 2006
@@ -2434,7 +2434,7 @@
               converter = eval(converterConstructor);
               converterResult = converter.getAsObject(value);
 
-              if (_instanceof(converterResult, ConverterException))
+              if (_instanceof(converterResult,  window["ConverterException"]))
               {
                 converterError = converterResult;
               }
@@ -2500,7 +2500,7 @@
 
                 validator = eval(validatorConstructor);
                 validationResult = validator.validate(value);
-                if (_instanceof(validationResult, ValidatorException))
+                if (_instanceof(validationResult,  window["ValidatorException"]))
                   validationError = validationResult;
 
               }
@@ -2758,6 +2758,9 @@
 )
 {
   if (type == (void 0))
+    return false;
+    
+  if (obj == (void 0))
     return false;
 
   while (typeof(obj) == "object")

Modified: incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/validator/ByteLengthValidatorTest.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/validator/ByteLengthValidatorTest.java?rev=431837&r1=431836&r2=431837&view=diff
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/validator/ByteLengthValidatorTest.java (original)
+++ incubator/adffaces/trunk/trinidad/trinidad-impl/src/test/java/org/apache/myfaces/trinidadinternal/validator/ByteLengthValidatorTest.java Tue Aug 15 22:56:39 2006
@@ -1,12 +1,12 @@
 /*
  * Copyright 2004,2006 The Apache Software Foundation.
- * 
+ *
  * Licensed 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.
@@ -69,7 +69,7 @@
     String expectedConstructorName
     )
   {
-    
+
     Mock mockComponent = buildMockUIComponent();
     UIComponent component = (UIComponent) mockComponent.proxy();
 
@@ -81,7 +81,7 @@
     ByteLengthValidator blv = new ByteLengthValidator();
     blv.setEncoding(encoding);
 
-    String libKey = blv.getLibKey(facesContext, component);
+    String libKey = (String)(blv.getClientImportNames().toArray()[0]);
     String constructorInfo = blv.getClientValidation(facesContext, component);
     String clientScript = blv.getClientScript(facesContext, component);