Java Doc for Date.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 Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.opensymphony.webwork.components.Component
      com.opensymphony.webwork.components.Date

Date
public class Date extends Component (Code)
Format Date object in different ways.

The date tag will allow you to format a Date in a quick and easy way. You can specify a custom format (eg. "dd/MM/yyyy hh:mm"), you can generate easy readable notations (like "in 2 hours, 14 minutes"), or you can just fall back on a predefined format with key 'webwork.date.format' in your properties file. If that key is not defined, it will finally fall back to the default DateFormat.MEDIUM formatting. Note: If the requested Date object isn't found on the stack, a blank will be returned.

Configurable attributes are :-
  • name
  • nice
  • format

Following how the date component will work, depending on the value of nice attribute (which by default is false) and the format attribute.

Condition 1: With nice attribute as true
i18n key default
webwork.date.format.past {0} ago
webwork.date.format.future in {0}
webwork.date.format.seconds an instant
webwork.date.format.minutes {0,choice,1#one minute|1<{0} minutes}
webwork.date.format.hours {0,choice,1#one hour|1<{0} hours}{1,choice,0#|1#, one minute|1<, {1} minutes}
webwork.date.format.days {0,choice,1#one day|1<{0} days}{1,choice,0#|1#, one hour|1<, {1} hours}
webwork.date.format.years {0,choice,1#one year|1<{0} years}{1,choice,0#|1#, one day|1<, {1} days}

Condition 2: With nice attribute as false and format attribute is specified eg. dd/MM/yyyyy

In this case the format attribute will be used.

Condition 3: With nice attribute as false and no format attribute is specified
i18n key default
webwork.date.format if one is not found DateFormat.MEDIUM format will be used

Examples

 
 <ww:date name="person.birthday" format="dd/MM/yyyy" />
 <ww:date name="person.birthday" format="%{getText('some.i18n.key')}" />
 <ww:date name="person.birthday" nice="true" />
 <ww:date name="person.birthday" />
 
 
Date
author:
   Philip Luppens
author:
   Rainer Hermanns
version:
   $Id: Date.java 2513 2006-03-21 17:26:19Z rainerh $


Field Summary
final public static  StringDATETAG_PROPERTY
    
final public static  StringDATETAG_PROPERTY_DAYS
    
final public static  StringDATETAG_PROPERTY_FUTURE
    
final public static  StringDATETAG_PROPERTY_HOURS
    
final public static  StringDATETAG_PROPERTY_MINUTES
    
final public static  StringDATETAG_PROPERTY_PAST
    
final public static  StringDATETAG_PROPERTY_SECONDS
    
final public static  StringDATETAG_PROPERTY_YEARS
    

Constructor Summary
public  Date(OgnlValueStack stack)
    

Method Summary
public  booleanend(Writer writer, String body)
    
public  StringformatTime(TextProvider tp, java.util.Date date)
     Calculates the difference in time from now to the given date, and outputs it nicely.
public  StringgetFormat()
    
public  StringgetName()
    
public  booleanisNice()
    
public  voidsetFormat(String format)
    
public  voidsetName(String name)
    
public  voidsetNice(boolean nice)
    

Field Detail
DATETAG_PROPERTY
final public static String DATETAG_PROPERTY(Code)
Property name to fall back when no format is specified



DATETAG_PROPERTY_DAYS
final public static String DATETAG_PROPERTY_DAYS(Code)
Property name that defines the days notation (default: {0,choice,1#one day|1<{0} days}{1,choice,0#|1#, one hour|1<, {1} hours})



DATETAG_PROPERTY_FUTURE
final public static String DATETAG_PROPERTY_FUTURE(Code)
Property name that defines the future notation (default: in {0})



DATETAG_PROPERTY_HOURS
final public static String DATETAG_PROPERTY_HOURS(Code)
Property name that defines the hours notation (default: {0,choice,1#one hour|1<{0} hours}{1,choice,0#|1#, one minute|1<, {1} minutes})



DATETAG_PROPERTY_MINUTES
final public static String DATETAG_PROPERTY_MINUTES(Code)
Property name that defines the minutes notation (default: {0,choice,1#one minute|1<{0} minutes})



DATETAG_PROPERTY_PAST
final public static String DATETAG_PROPERTY_PAST(Code)
Property name that defines the past notation (default: {0} ago)



DATETAG_PROPERTY_SECONDS
final public static String DATETAG_PROPERTY_SECONDS(Code)
Property name that defines the seconds notation (default: in instant)



DATETAG_PROPERTY_YEARS
final public static String DATETAG_PROPERTY_YEARS(Code)
Property name that defines the years notation (default: {0,choice,1#one year|1<{0} years}{1,choice,0#|1#, one day|1<, {1} days})




Constructor Detail
Date
public Date(OgnlValueStack stack)(Code)




Method Detail
end
public boolean end(Writer writer, String body)(Code)



formatTime
public String formatTime(TextProvider tp, java.util.Date date)(Code)
Calculates the difference in time from now to the given date, and outputs it nicely.

An example:
Now = 2006/03/12 13:38:00, date = 2006/03/12 15:50:00 will output "in 1 hour, 12 minutes".
Parameters:
  tp - text provider
Parameters:
  date - the date the date nicely




getFormat
public String getFormat()(Code)
Returns the format.



getName
public String getName()(Code)
Returns the name.



isNice
public boolean isNice()(Code)
Returns the nice.



setFormat
public void setFormat(String format)(Code)
Date or DateTime format pattern



setName
public void setName(String name)(Code)
The date value to format



setNice
public void setNice(boolean nice)(Code)
Whether to print out the date nicely



Fields inherited from com.opensymphony.webwork.components.Component
final public static String COMPONENT_STACK(Code)(Java Doc)
protected String id(Code)(Java Doc)
protected Map parameters(Code)(Java Doc)
protected OgnlValueStack stack(Code)(Java Doc)

Methods inherited from com.opensymphony.webwork.components.Component
public void addAllParameters(Map params)(Code)(Java Doc)
public void addParameter(String key, Object value)(Code)(Java Doc)
public boolean altSyntax()(Code)(Java Doc)
public void copyParams(Map params)(Code)(Java Doc)
protected String determineActionURL(String action, String namespace, String method, HttpServletRequest req, HttpServletResponse res, Map parameters, String scheme, boolean includeContext, boolean encodeResult, boolean escapeXml)(Code)(Java Doc)
protected String determineNamespace(String namespace, OgnlValueStack stack, HttpServletRequest req)(Code)(Java Doc)
public boolean end(Writer writer, String body)(Code)(Java Doc)
protected boolean end(Writer writer, String body, boolean popComponentStack)(Code)(Java Doc)
protected WebWorkException fieldError(String field, String errorMsg, Exception e)(Code)(Java Doc)
protected Component findAncestor(Class clazz)(Code)(Java Doc)
protected String findString(String expr)(Code)(Java Doc)
protected String findString(String expr, String field, String errorMsg)(Code)(Java Doc)
protected Object findValue(String expr)(Code)(Java Doc)
protected Object findValue(String expr, String field, String errorMsg)(Code)(Java Doc)
protected Object findValue(String expr, Class toType)(Code)(Java Doc)
public Stack getComponentStack()(Code)(Java Doc)
public String getId()(Code)(Java Doc)
public Map getParameters()(Code)(Java Doc)
public OgnlValueStack getStack()(Code)(Java Doc)
protected void popComponentStack()(Code)(Java Doc)
public void setId(String id)(Code)(Java Doc)
public boolean start(Writer writer)(Code)(Java Doc)
protected String toString(Throwable t)(Code)(Java Doc)
public boolean usesBody()(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.