View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  
20  package org.apache.myfaces.commons.converter;
21  
22  import java.util.Locale;
23  import java.util.TimeZone;
24  
25  /**
26   * Simple convert that overrides the spec DateTimeConverter and uses TimeZone.getDefault() as the 
27   * base timezone, rather than GMT.
28   *
29   * Convert date time using normal system timezone like it should
30   *
31   * @JSFConverter
32   *   name = "mcc:convertDateTime"
33   *   tagClass = "org.apache.myfaces.commons.converter.ConvertDateTimeTag"
34   *   tagSuperclass = "org.apache.myfaces.commons.converter.ConverterTag"
35   *   serialuidtag = "1542071733367150635L" 
36   * 
37   * User: treeder
38   * Date: Oct 28, 2005
39   * Time: 7:19:01 PM
40   */
41  public class DateTimeConverter extends javax.faces.convert.DateTimeConverter
42  {
43      public static final String CONVERTER_ID = "org.apache.myfaces.custom.convertDateTime.DateTimeConverter";
44  
45      public DateTimeConverter()
46      {
47          setTimeZone(TimeZone.getDefault());
48      }
49  
50      /**
51       * longDesc = "default|short|medium|long|full"
52       * 
53       * @JSFProperty
54       *   inheritedTag = "false"
55       */
56      public String getDateStyle()
57      {
58          return super.getDateStyle();
59      }
60  
61      /**
62       * longDesc = "locale"
63       * 
64       * @JSFProperty name = "locale"
65       *   inheritedTag = "false" 
66       */    
67      public Locale getLocale()
68      {
69          return super.getLocale();
70      }
71  
72      /**
73       * Custom formatting pattern
74       * 
75       * @JSFProperty
76       *   inheritedTag = "false"
77       */
78      public String getPattern()
79      {
80          return super.getPattern();
81      }
82  
83      /**
84       * default|short|medium|long|full
85       * 
86       * @JSFProperty
87       *   inheritedTag = "false"
88       */
89      public String getTimeStyle()
90      {
91          return super.getTimeStyle();
92      }
93  
94      /**
95       * timeZome
96       *  
97       * @JSFProperty
98       *   inheritedTag = "false"
99       */
100     public TimeZone getTimeZone()
101     {
102         return super.getTimeZone();
103     }
104 
105     /**
106      * date|time|both
107      * 
108      * @JSFProperty 
109      *   inheritedTag = "false"
110      */
111     public String getType()
112     {
113         return super.getType();
114     }
115 }