All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.maven-faces-plugin.converters.trinidad.DateTime.xml Maven / Gradle / Ivy

<?xml version="1.0" ?>
<!--
    Licensed to the Apache Software Foundation (ASF) under one
    or more contributor license agreements.  See the NOTICE file
    distributed with this work for additional information
    regarding copyright ownership.  The ASF licenses this file
    to you under the Apache License, Version 2.0 (the
    "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing,
    software distributed under the License is distributed on an
    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
    KIND, either express or implied.  See the License for the
    specific language governing permissions and limitations
    under the License.
     
-->
<faces-config version="2.0" xmlns="http://java.sun.com/xml/ns/javaee"
              xmlns:tr="http://myfaces.apache.org/trinidad"
              xmlns:mfp="http://myfaces.apache.org/maven-faces-plugin"
              xmlns:fmd="http://java.sun.com/xml/ns/javaee/faces/design-time-metadata">
  <converter>
    <description><![CDATA[Converts string into java.util.Date and vice versa based on the pattern
          and style set.]]>
    </description>
    <display-name>Date Time Converter</display-name>
    <converter-id>org.apache.myfaces.trinidad.DateTime</converter-id>
    <converter-class>org.apache.myfaces.trinidadinternal.convert.DateTimeConverter</converter-class>
    <property>
      <description><![CDATA[Whether the converter should be disabled, default to false.]]>
      </description>
      <property-name>disabled</property-name>
      <property-class>boolean</property-class>
      <default-value>false</default-value>
    </property>
    <property>
      <description><![CDATA[<html><p>
              Custom error message to be used, for creating detail part of
              faces message, for values that cannot be converted to date when
              the pattern / secondary pattern is set or when
              <code>type</code> is set to
              <code>'date'</code> and <code>pattern</code>
              is not set or is null.
             </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} an example of the format the converter is expecting
               </li>
              </ul>
             </p></html>]]>
      </description>
      <property-name>messageDetailConvertDate</property-name>
      <property-class>java.lang.String</property-class>
      <property-extension>
        <mfp:property-metadata>
          <mfp:translatable>true</mfp:translatable>
        </mfp:property-metadata>
      </property-extension>
    </property>
    <property>
      <description><![CDATA[<html><p>
              Custom error message to be used, for creating detail part of
              faces message, for time based value that cannot be converted
              to date when <code>type</code> is set to
              <code>'time'</code>, <code>pattern</code> is
              not set or is null
             </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} an example of the format the converter is expecting
               </li>
              </ul>
             </p></html>]]>
      </description>
      <property-name>messageDetailConvertTime</property-name>
      <property-class>java.lang.String</property-class>
      <property-extension>
        <mfp:property-metadata>
          <mfp:translatable>true</mfp:translatable>
        </mfp:property-metadata>
      </property-extension>
    </property>
    <property>
      <description><![CDATA[<html><p>
              Custom error message to be used, for creating detail part of
              faces message, for date-time based value that cannot be converted
              to date when <code>type</code> is set to
              <code>'both'</code> and <code>pattern</code>
              is not set or is null.
             </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} an example of the format the converter is expecting
               </li>
              </ul>
             </p></html>]]>
      </description>
      <property-name>messageDetailConvertBoth</property-name>
      <property-class>java.lang.String</property-class>
      <property-extension>
        <mfp:property-metadata>
          <mfp:translatable>true</mfp:translatable>
        </mfp:property-metadata>
      </property-extension>
    </property>
    <property>
      <description><![CDATA[Predefined formatting style which determines how the date component
               of a date string is to be formatted and parsed. Applied only if type
               is "date" or "both". Valid values are "shortish", "short", "default",
               "medium", "long", and "full". Default value is "shortish".]]>
      </description>
      <property-name>dateStyle</property-name>
      <property-class>java.lang.String</property-class>
      <default-value>shortish</default-value>
      <property-extension>
        <mfp:property-metadata/>
        <fmd:property-metadata>
          <fmd:preferred>true</fmd:preferred>
        </fmd:property-metadata>
      </property-extension>
    </property>
    <property>
      <description><![CDATA[Locale whose predefined styles for dates and times are used during
               formatting or parsing. If not specified or if null, the Locale returned by
               FacesContext.getViewRoot().getLocale() will be used.]]>
      </description>
      <property-name>locale</property-name>
      <property-class>java.util.Locale</property-class>
    </property>
    <property>
      <description><![CDATA[Custom formatting pattern which determines how the date/time string
              should be formatted and parsed.]]>
      </description>
      <property-name>pattern</property-name>
      <property-class>java.lang.String</property-class>
      <property-extension>
        <mfp:property-metadata/>
        <fmd:property-metadata>
          <fmd:preferred>true</fmd:preferred>
        </fmd:property-metadata>
      </property-extension>
    </property>
    <property>
      <description><![CDATA[Second pattern, which will be used as a second attempt to parse a
               string if the primary pattern or styles fail, but is never used for
               formatting strings.]]>
      </description>
      <property-name>secondaryPattern</property-name>
      <property-class>java.lang.String</property-class>
    </property>
    <property>
      <description><![CDATA[Predefined formatting style which determines how the time component of
               a date string is to be formatted and parsed. Applied only if type is
               "time" or "both". Valid values are "default", "short", "medium",
               "long", and "full". Default value is "short".]]>
      </description>
      <property-name>timeStyle</property-name>
      <property-class>java.lang.String</property-class>
      <default-value>short</default-value>
      <property-extension>
        <mfp:property-metadata/>
        <fmd:property-metadata>
          <fmd:preferred>true</fmd:preferred>
        </fmd:property-metadata>
      </property-extension>
    </property>
    <property>
      <description><![CDATA[Time zone in which to interpret any time information in the date
               string. If not set here, picks this value from
               trinidad-config.xml configuration file. If not defined there, then
               it is defaulted to the value returned by TimeZone.getDefault() which is usually the server JVM timezone.]]>
      </description>
      <property-name>timeZone</property-name>
      <property-class>java.util.TimeZone</property-class>
      <property-extension>
        <mfp:property-metadata/>
        <fmd:property-metadata>
          <fmd:preferred>true</fmd:preferred>
        </fmd:property-metadata>
      </property-extension>
    </property>
    <property>
      <description><![CDATA[Specifies what contents the string value will be formatted to
               include, or parsed. Valid values are "date", "time", and "both".
               Default value is "date".]]>
      </description>
      <property-name>type</property-name>
      <property-class>java.lang.String</property-class>
      <default-value>date</default-value>
      <property-extension>
        <mfp:property-metadata/>
        <fmd:property-metadata>
          <fmd:preferred>true</fmd:preferred>
        </fmd:property-metadata>
      </property-extension>
    </property>

    <converter-extension>
      <mfp:tag-name>tr:convertDateTime</mfp:tag-name>
      <mfp:tag-class>org.apache.myfaces.trinidadinternal.taglib.convert.ConvertDateTimeTag</mfp:tag-class>
      <mfp:long-description><![CDATA[Converts string into java.util.Date and vice versa based on the pattern
          and style set.
          <html:p>
            The default dateStyle is <html:code>shortish</html:code>.
            Shortish is identical to <html:code>short</html:code> but forces the year to be
            a full four digits. <code>dateStyle</code> defaults to <html:code>shortish</html:code>
            if it was not set.
          </html:p>

          <html:p>Timezone can be set per web-app in trinidad-config.xml configuration file.
          If <code>timeZone</code> is not set on the converter, then timezone will be defaulted to the
          value set in trinidad-config.xml configuration file. If it is not set in the
          configuration file, then it will be defaulted to GMT.</html:p>

          <html:p>
             The converter always allows a level of <code>leniency</code> while converting
             user input value to date to the following extent.
            <html:ul>
              <html:li>
                A converter with associated pattern 'MMM' for month, when attached to any
                value holder, will accept values with month specified in the form 'MM' or 'M'
                as valid.
              </html:li>
              <html:li>
                Allows use of separators '-' or '.' or '/' irrespective of the separator
                specified in the associated pattern.
              </html:li>
              <html:li>
                The leniency is applicable to both 'pattern' and 'secondaryPattern'.
              </html:li>
            </html:ul>
          </html:p>
          <html:p>
            For example:<html:br/>
            When pattern on the converter is set to &quot;MMM/d/yyyy&quot; the following inputs
            are tolerated as valid by the converter.<html:br/>
            <html:dl>
              <html:dt>Jan/4/2004</html:dt>
              <html:dt>Jan-4-2004</html:dt>
              <html:dt>Jan.4.2004</html:dt>
              <html:dt>01/4/2004</html:dt>
              <html:dt>01-4-2004</html:dt>
              <html:dt>01.4.2004</html:dt>
              <html:dt>1/4/2004</html:dt>
              <html:dt>1-4-2004</html:dt>
              <html:dt>1.4.2004</html:dt>
            </html:dl>
          </html:p>

          <html:p>This converter is automatically registered under the standard
            converter ID, and therefore will be used when the
          <html:code>&lt;f:convertDateTime&gt;</html:code> tag is used.</html:p>]]>
      </mfp:long-description>
      <mfp:example>
        <mfp:source-code><![CDATA[<tr:inputText id="mdf5" value="2004/09/06"
                        label="Date">
  <tr:convertDateTime pattern="yyyy/M/d"  secondaryPattern="d/M/yyyy" />
</tr:inputText>]]>
        </mfp:source-code>
      </mfp:example>
      <mfp:author>Vijay Venkataraman</mfp:author>
      <mfp:converter-metadata>
        <mfp:favorite-property>type</mfp:favorite-property>
      </mfp:converter-metadata>
    </converter-extension>
  </converter>
</faces-config>




© 2015 - 2024 Weber Informatics LLC | Privacy Policy