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.custom.convertDateTime;
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 = "s:convertDateTime"
33 * tagClass = "org.apache.myfaces.custom.convertDateTime.ConvertDateTimeTag"
34 * tagSuperclass = "javax.faces.webapp.ConverterTag"
35 *
36 * User: treeder
37 * Date: Oct 28, 2005
38 * Time: 7:19:01 PM
39 */
40 public class DateTimeConverter extends javax.faces.convert.DateTimeConverter
41 {
42 public static final String CONVERTER_ID = "org.apache.myfaces.custom.convertDateTime.DateTimeConverter";
43
44 public DateTimeConverter()
45 {
46 setTimeZone(TimeZone.getDefault());
47 }
48
49 /**
50 * longDesc = "default|short|medium|long|full"
51 *
52 * @JSFProperty
53 * inheritedTag = "false"
54 */
55 public String getDateStyle()
56 {
57 return super.getDateStyle();
58 }
59
60 /**
61 * longDesc = "locale"
62 *
63 * @JSFProperty name = "locale"
64 * inheritedTag = "false"
65 */
66 public Locale getLocale()
67 {
68 return super.getLocale();
69 }
70
71 /**
72 * Custom formatting pattern
73 *
74 * @JSFProperty
75 * inheritedTag = "false"
76 */
77 public String getPattern()
78 {
79 return super.getPattern();
80 }
81
82 /**
83 * default|short|medium|long|full
84 *
85 * @JSFProperty
86 * inheritedTag = "false"
87 */
88 public String getTimeStyle()
89 {
90 return super.getTimeStyle();
91 }
92
93 /**
94 * timeZome
95 *
96 * @JSFProperty
97 * inheritedTag = "false"
98 */
99 public TimeZone getTimeZone()
100 {
101 return super.getTimeZone();
102 }
103
104 /**
105 * date|time|both
106 *
107 * @JSFProperty
108 * inheritedTag = "false"
109 */
110 public String getType()
111 {
112 return super.getType();
113 }
114 }