incubator-adffaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mat...@apache.org
Subject svn commit: r468185 - in /incubator/adffaces/trunk/trinidad: trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/IntegerUtils.java trinidad-build/src/main/resources/META-INF/maven-faces-plugin/validators/trinidad/LongRange.xml
Date Thu, 26 Oct 2006 23:18:56 GMT
Author: matzew
Date: Thu Oct 26 16:18:55 2006
New Revision: 468185

URL: http://svn.apache.org/viewvc?view=rev&rev=468185
Log:
added missing files for last commit

Added:
    incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/IntegerUtils.java
    incubator/adffaces/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/validators/trinidad/LongRange.xml

Added: incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/IntegerUtils.java
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/IntegerUtils.java?view=auto&rev=468185
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/IntegerUtils.java
(added)
+++ incubator/adffaces/trunk/trinidad/trinidad-api/src/main/java/org/apache/myfaces/trinidad/util/IntegerUtils.java
Thu Oct 26 16:18:55 2006
@@ -0,0 +1,99 @@
+/*
+ * Copyright  1998-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.
+ */
+package org.apache.myfaces.trinidad.util;
+
+/**
+ * This class has been moved from bali share.
+ * Class containing various integer utilities. It caches commonly
+ * used Integer objects and String representations of Integers to avoid
+ * expensive object creations.
+ * <p>
+ * IntegerUtils is used throughout most Bali projects, and clients are also
+ * encouraged to use it for increased performance.
+ * <p>
+ * @since Inspector 0.2
+ * @version $Name:  $ ($Revision: adfrt/faces/adf-faces-impl/src/main/java/oracle/adfinternal/view/faces/util/IntegerUtils.java#0
$) $Date: 10-nov-2005.18:49:09 $
+ * @author The Oracle ADF Faces Team
+ */
+public final class IntegerUtils
+{
+  private IntegerUtils()
+  {
+  }
+
+  /**
+   * @return a String value corresponding to the specified integer, possibly
+   * creating a new String object if a cached one does not exist.
+   */
+  public static String getString(
+    int intValue
+    )
+  {
+    int cacheIndex = intValue - _START_INTEGER;
+
+    if ((cacheIndex >= _NUM_CACHED) || (cacheIndex < 0))
+    {
+      return String.valueOf(intValue);
+    }
+    else
+    {
+      String cachedValue = _sCachedStrings[cacheIndex];
+
+      if (cachedValue == null)
+      {
+        cachedValue = String.valueOf(intValue);
+
+        _sCachedStrings[cacheIndex] = cachedValue;
+      }
+
+      return cachedValue;
+    }
+  }
+
+  /**
+   * @return a String value corresponding to the specified long, possibly
+   * creating a new String object if a cached one does not exist.
+   */
+  public static String getString(long longValue)
+  {
+    if ((longValue >= _START_INTEGER) && (longValue <= _NUM_CACHED))
+      return getString((int) longValue);
+    return String.valueOf(longValue);
+  }
+
+  /**
+   * @return a String value corresponding to the specified Integer, possibly
+   * creating a new String object if a cached one does not exist.
+   */
+  public static String getString(
+    Integer intObject
+    )
+  {
+    return getString(intObject.intValue());
+  }
+
+  // index of first cached value
+  private static final int _START_INTEGER = -10;
+
+  // number of cached values
+  private static final int _NUM_CACHED = 266;
+
+  // cache of Integer Objects
+  private static Integer[] _sCachedIntegers = new Integer[_NUM_CACHED];
+
+  // cache of int Strings
+  private static String[] _sCachedStrings = new String[_NUM_CACHED];
+}
\ No newline at end of file

Added: incubator/adffaces/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/validators/trinidad/LongRange.xml
URL: http://svn.apache.org/viewvc/incubator/adffaces/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/validators/trinidad/LongRange.xml?view=auto&rev=468185
==============================================================================
--- incubator/adffaces/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/validators/trinidad/LongRange.xml
(added)
+++ incubator/adffaces/trunk/trinidad/trinidad-build/src/main/resources/META-INF/maven-faces-plugin/validators/trinidad/LongRange.xml
Thu Oct 26 16:18:55 2006
@@ -0,0 +1,170 @@
+<?xml version="1.0" ?>
+<!--
+  Copyright 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.
+-->
+<faces-config version="1.2" xmlns="http://java.sun.com/xml/ns/javaee"
+              xmlns:tr="http://myfaces.apache.org/trinidad"
+              xmlns:mfp="http://myfaces.apache.org/maven-faces-plugin">
+  <validator>
+    <description><![CDATA[Validate that the date entered is within a given range.]]></description>
+    <display-name>validateLongRange</display-name>
+    <validator-id>org.apache.myfaces.trinidad.LongRange</validator-id>
+    <validator-class>org.apache.myfaces.trinidadinternal.validator.LongRangeValidator</validator-class>
+    <property>
+      <description><![CDATA[the maximum .]]>
+      </description>
+      <property-name>maximum</property-name>
+      <property-class>long</property-class>
+      <property-extension/>
+    </property>
+    <property>
+      <description><![CDATA[The minimum .]]>
+      </description>
+      <property-name>minimum</property-name>
+      <property-class>long</property-class>
+      <property-extension>
+        <mfp:property-metadata>
+          <mfp:preferred>true</mfp:preferred>
+        </mfp:property-metadata>
+      </property-extension>
+    </property>
+    <property>
+      <description><![CDATA[<p>
+           The detail error message to be used for constructing faces messages,
+           when input value exceeds the <code>maximum</code> value
+           set.
+          </p>
+          <p>
+           <strong>
+            Parameters:
+           </strong>
+           <ul>
+            <li>
+             {0} the label that identifies the component
+            </li>
+            <li>
+             {1} value entered by the user
+            </li>
+            <li>
+             {2} the maximum allowed date
+            </li>
+           </ul>
+          </p>]]>
+      </description>
+      <property-name>messageDetailMaximum</property-name>
+      <property-class>java.lang.String</property-class>
+      <property-extension>
+        <mfp:property-metadata>
+          <mfp:preferred>true</mfp:preferred>
+        </mfp:property-metadata>
+      </property-extension>
+    </property>
+    <property>
+      <description><![CDATA[<p>
+           The detail error message to be used for constructing faces messages,
+           when input value is less than the set <code>minimum</code>
+           value.
+          </p>
+          <p>
+           <strong>
+            Parameters:
+           </strong>
+           <ul>
+            <li>
+             {0} the label that identifies the component
+            </li>
+            <li>
+             {1} value entered by the user
+            </li>
+            <li>
+             {2} the minimum allowed date
+            </li>
+           </ul>
+          </p>]]>
+      </description>
+      <property-name>messageDetailMinimum</property-name>
+      <property-class>java.lang.String</property-class>
+      <property-extension>
+        <mfp:property-metadata>
+          <mfp:preferred>true</mfp:preferred>
+        </mfp:property-metadata>
+      </property-extension>
+    </property>
+        <property>
+      <description><![CDATA[<p>
+           The detail error message to be used for constructing faces messages,
+           if input value is not with in the range, when
+           <code>minimum</code> and <code>maximum</code> is
+           set.
+          </p>
+          <p>
+           <strong>
+            Parameters:
+           </strong>
+           <ul>
+            <li>
+             {0} the label that identifies the component
+            </li>
+            <li>
+             {1} value entered by the user
+            </li>
+            <li>
+             {2} the minimum allowed date
+            </li>
+            <li>
+             {3} the maximum allowed date
+            </li>
+           </ul>
+          </p>]]>
+      </description>
+      <property-name>messageDetailNotInRange</property-name>
+      <property-class>java.lang.String</property-class>
+      <property-extension>
+        <mfp:property-metadata>
+          <mfp:preferred>true</mfp:preferred>
+        </mfp:property-metadata>
+      </property-extension>
+    </property>
+    <validator-extension>
+      <mfp:tag-name>tr:validateLongRange</mfp:tag-name>
+      <mfp:tag-class>org.apache.myfaces.trinidadinternal.taglib.validator.ValidateLongRangeTag</mfp:tag-class>
+      <mfp:long-description><![CDATA[<html:p>
+
+        Validate that the date entered is within a given range.
+</html:p>]]></mfp:long-description>
+      <mfp:example>
+        <mfp:source-code><![CDATA[<tr:inputDate id="mdf3" value="#{date.date3}"
+                               label="max validator">
+  <tr:validateLongRange maximum="#{date.maxDate}"/>
+</tr:inputDate>
+
+<tr:inputDate id="mdf3" value="2004-11-25"
+                                tip="min=2004-11-16  max=2004-12-16"
+                                label="Submission period">
+  <tr:convertDateTime pattern="yyyy-MM-dd"/>
+
+  <!-- Supports ISO date format strings of the form "yyyy-MM-dd" -->
+  <tr:validateLongRange
+       minimum="2004-11-16"
+       maximum="2004-12-16"
+       notInRangeMessageDetail="Date &quot;{1}&quot; does not fall within the range
{2} : {3}"/>
+</tr:inputDate>]]>
+        </mfp:source-code>
+      </mfp:example>
+      <mfp:author>Matthias Wessendorf</mfp:author>
+      <mfp:uix2-local-name>validateLongRange</mfp:uix2-local-name>
+    </validator-extension>
+  </validator>
+</faces-config>
\ No newline at end of file



Mime
View raw message