Source Code Cross Referenced for DatePicker.java in  » J2EE » webwork-2.2.6 » com » opensymphony » webwork » components » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » webwork 2.2.6 » com.opensymphony.webwork.components 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.opensymphony.webwork.components;
002:
003:        import com.opensymphony.xwork.ActionContext;
004:        import com.opensymphony.xwork.util.OgnlValueStack;
005:
006:        import javax.servlet.http.HttpServletRequest;
007:        import javax.servlet.http.HttpServletResponse;
008:        import java.util.Locale;
009:
010:        /**
011:         * <!-- START SNIPPET: javadoc -->
012:         *
013:         * Renders datepicker element.</p>
014:         *
015:         * Implementation was changed in WebWork 2.2 to use <a href="http://www.dynarch.com/projects/calendar/">jscalendar</a>
016:         * instead of non locale aware tigracalendar. Check locale and format settings if you used the old widget in your
017:         * applications. Be sure to include proper stylesheet as described below if you don't want the calender widget to look
018:         * transparent.</p>
019:         *
020:         * <b>Important:</b> Be sure to set the id attributs if not used within a &lt;ww:form /&gt; tag, as it takes care of
021:         * setting the id for you, being required to copy selected date to text input element.</p>
022:         *
023:         * Following a reference for the format parameter (copied from jscalendar documentation):
024:         * <table border=0><tr><td valign=top ></td></tr>
025:         * <tr><td valign=top ><tt>%a</tt> </td><td valign=top >abbreviated weekday name </td></tr>
026:         * <tr><td valign=top ><tt>%A</tt> </td><td valign=top >full weekday name </td></tr>
027:         * <tr><td valign=top ><tt>%b</tt> </td><td valign=top >abbreviated month name </td></tr>
028:         * <tr><td valign=top ><tt>%B</tt> </td><td valign=top >full month name </td></tr>
029:         * <tr><td valign=top ><tt>%C</tt> </td><td valign=top >century number </td></tr>
030:         * <tr><td valign=top ><tt>%d</tt> </td><td valign=top >the day of the month ( 00 .. 31 ) </td></tr>
031:         * <tr><td valign=top ><tt>%e</tt> </td><td valign=top >the day of the month ( 0 .. 31 ) </td></tr>
032:         * <tr><td valign=top ><tt>%H</tt> </td><td valign=top >hour ( 00 .. 23 ) </td></tr>
033:         * <tr><td valign=top ><tt>%I</tt> </td><td valign=top >hour ( 01 .. 12 ) </td></tr>
034:         * <tr><td valign=top ><tt>%j</tt> </td><td valign=top >day of the year ( 000 .. 366 ) </td></tr>
035:         * <tr><td valign=top ><tt>%k</tt> </td><td valign=top >hour ( 0 .. 23 ) </td></tr>
036:         * <tr><td valign=top ><tt>%l</tt> </td><td valign=top >hour ( 1 .. 12 ) </td></tr>
037:         * <tr><td valign=top ><tt>%m</tt> </td><td valign=top >month ( 01 .. 12 ) </td></tr>
038:         * <tr><td valign=top ><tt>%M</tt> </td><td valign=top >minute ( 00 .. 59 ) </td></tr>
039:         * <tr><td valign=top ><tt>%n</tt> </td><td valign=top >a newline character </td></tr>
040:         * <tr><td valign=top ><tt>%p</tt> </td><td valign=top >``PM'' or ``AM'' </td></tr>
041:         * <tr><td valign=top ><tt>%P</tt> </td><td valign=top >``pm'' or ``am'' </td></tr>
042:         * <tr><td valign=top ><tt>%S</tt> </td><td valign=top >second ( 00 .. 59 ) </td></tr>
043:         * <tr><td valign=top ><tt>%s</tt> </td><td valign=top >number of seconds since Epoch (since Jan 01 1970 00:00:00 UTC) </td></tr>
044:         * <tr><td valign=top ><tt>%t</tt> </td><td valign=top >a tab character </td></tr>
045:         * <tr><td valign=top ><tt>%U, %W, %V</tt> </td><td valign=top >the week number</td></tr>
046:         * <tr><td valign=top ><tt>%u</tt> </td><td valign=top >the day of the week ( 1 .. 7, 1 = MON )</td></tr>
047:         * <tr><td valign=top ><tt>%w</tt> </td><td valign=top >the day of the week ( 0 .. 6, 0 = SUN )</td></tr>
048:         * <tr><td valign=top ><tt>%y</tt> </td><td valign=top >year without the century ( 00 .. 99 )</td></tr>
049:         * <tr><td valign=top ><tt>%Y</tt> </td><td valign=top >year including the century ( ex. 1979 )</td></tr>
050:         * <tr><td valign=top ><tt>%%</tt> </td><td valign=top >a literal <tt>%</tt> character
051:         * </td></tr></table><p>
052:         *
053:         * <!-- END SNIPPET: javadoc -->
054:         *
055:         * <p/> <b>Examples</b>
056:         *
057:         * <pre>
058:         * <!-- START SNIPPET: expl1 -->
059:         * Date in application's locale format:
060:         *     &lt;ww:datepicker name="order.date" id="order.date" /&gt;
061:         * Date in german locale, with german texts:
062:         *     &lt;ww:datepicker name="delivery.date" id="delivery.date" template="datepicker_js.ftl" language="de" /&gt;
063:         * Date in german locale, with german texts and custom date format, including time:
064:         *     &lt;ww:datepicker name="invoice.date" id="invoice.date" template="datepicker_js.ftl" language="de" format="%d. %b &Y %H:%M" showstime="true" /&gt;
065:         * <!-- END SNIPPET: expl1 -->
066:         * </pre>
067:         * <p/>
068:         *
069:         * <!-- START SNIPPET: expldesc2 -->
070:         *
071:         * If you use this jscalendar based datepicker widget, you might want to use one of the standard stylesheets provided
072:         * with jscalendar (all distribution stylesheets are included in webwork jar). The easiest way to do so is to place the
073:         * &lt;ww:head/&gt; tag in the head of your html page, as it takes care of including calendar css.
074:         * Otherwise, to manually activate the calendar-blue style, include the following in your stylesheet definition:
075:         *
076:         * <!-- END SNIPPET: expldesc2 -->
077:         * <pre>
078:         * <!-- START SNIPPET: expl2 -->
079:         * &lt;link href="&lt;ww:url value="/webwork/jscalendar/calendar-blue.css" /&gt;" rel="stylesheet" type="text/css" media="all"/&gt;
080:         * <!-- END SNIPPET: expl2 -->
081:         * </pre>
082:         *
083:         * @author Patrick Lightbody
084:         * @author Rene Gielen
085:         * @version $Revision: 2541 $
086:         * @ww.tag name="datepicker" tld-body-content="JSP" tld-tag-class="com.opensymphony.webwork.views.jsp.ui.DatePickerTag"
087:         * description="Render datepicker"
088:         * @since 2.2
089:         */
090:        public class DatePicker extends TextField {
091:
092:            final public static String TEMPLATE = "datepicker";
093:
094:            protected String language;
095:            protected String format;
096:            protected String showstime;
097:            protected String singleclick;
098:
099:            public DatePicker(OgnlValueStack stack, HttpServletRequest request,
100:                    HttpServletResponse response) {
101:                super (stack, request, response);
102:            }
103:
104:            protected String getDefaultTemplate() {
105:                return TEMPLATE;
106:            }
107:
108:            public void evaluateParams() {
109:                super .evaluateParams();
110:
111:                if (language != null) {
112:                    addParameter("language", findString(language));
113:                } else {
114:                    final Locale locale = (Locale) getStack().getContext().get(
115:                            ActionContext.LOCALE);
116:                    if (locale != null) {
117:                        addParameter("language", locale.getLanguage());
118:                    } else {
119:                        addParameter("language", Locale.getDefault()
120:                                .getLanguage());
121:                    }
122:
123:                }
124:
125:                if (format != null) {
126:                    addParameter("format", findString(format));
127:                }
128:
129:                if (showstime != null) {
130:                    addParameter("showstime", findString(showstime));
131:                }
132:
133:                if (singleclick != null) {
134:                    addParameter("singleclick", findString(singleclick));
135:                }
136:
137:            }
138:
139:            /**
140:             * The language to use for the widget texts and localization presets.
141:             * @ww.tagattribute required="false" type="String" default="The language of the current Locale"
142:             */
143:            public void setLanguage(String language) {
144:                this .language = language;
145:            }
146:
147:            /**
148:             * The format to use for date field.
149:             * @ww.tagattribute required="false" type="String" default="Dateformat specified by language preset (%Y/%m/%d for en)"
150:             */
151:            public void setFormat(String format) {
152:                this .format = format;
153:            }
154:
155:            /**
156:             * Whether time selector is to be shown. Valid values are &quot;true&quot;, &quot;false&quot;, &quot;24&quot; and &quot;12&quot;.
157:             * @ww.tagattribute required="false" type="String" default="false"
158:             */
159:            public void setShowstime(String showstime) {
160:                this .showstime = showstime;
161:            }
162:
163:            /**
164:             * Whether to use selected value after single or double click.
165:             * @ww.tagattribute required="false" type="Boolean" default="true"
166:             */
167:            public void setSingleclick(String singleclick) {
168:                this.singleclick = singleclick;
169:            }
170:
171:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.