Java Doc for TimeSelector.java in  » Web-Framework » TURBINE » org » apache » turbine » util » 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 » Web Framework » TURBINE » org.apache.turbine.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.turbine.util.TimeSelector

TimeSelector
public class TimeSelector (Code)
TimeSelector is a utility class to handle the creation of a set of time drop-down menus. The code is broken into a set of static methods for quick and easy access to the individual select objects:
 ElementContainer ec timeSelect = new ElementContainer();
 String myName = "mytime";
 ec.addElement(TimeSelector.getHourSelector(myName));
 ec.addElement(TimeSelector.getMinuteSelector(myName));
 ec.addElement(TimeSelector.getAMPMSelector(myName));
 
There are also methods which will use attributes to build a complete time selector in the default 12hr format (eg HH:MM am/pm):
 TimeSelector ts = new TimeSelector(myName);
 timeSelect = ts.ecsOutput();
 
Minutes/Seconds are by default rounded to the nearest 5 units although this can be easily changed. 24hr TimeSelectors can also be produced. The following example creates a full precision TimeSelector (eg HH:MM:SS):
 TimeSelector ts = new TimeSelector(myName);
 ts.setTimeFormat(TimeSelector.TWENTY_FOUR_HOUR);
 ts.setMinuteInterval(1);
 ts.setSecondInterval(1);
 ts.setShowSeconds(true);
 timeSelect = ts.toString();
 

author:
   Jeffrey D. Brekke
author:
   Rich Aston
version:
   $Id: TimeSelector.java 534527 2007-05-02 16:10:59Z tv $


Field Summary
final public static  StringAMPM_SUFFIX
     Suffix for am/pm parameter.
final public static  StringDEFAULT_PREFIX
     Prefix for time names.
final public static  StringHOUR_SUFFIX
     Suffix for hour parameter.
final public static  StringMINUTE_SUFFIX
     Suffix for minute parameter.
final public static  StringSECOND_SUFFIX
     Suffix for second parameter.
final public static  intTWELVE_HOUR
    
final public static  intTWENTY_FOUR_HOUR
    

Constructor Summary
public  TimeSelector()
    
public  TimeSelector(String selName, Calendar useDate)
     Constructor, uses the date/time set in the calendar passed in (with the date/time set correctly).
public  TimeSelector(String selName)
     Constructor defaults to current date/time.

Method Summary
public  ElementContainerecsOutput()
     Return an ECS container with the select objects inside.
public static  SelectgetAMPMSelector(String name)
     Return an am/pm selector.
Parameters:
  name - The name to use for the selected am/pm.
public static  SelectgetAMPMSelector(String name, Calendar now)
     Return an am/pm selector.
Parameters:
  name - The name to use for the selected am/pm.
Parameters:
  now - Calendar to start with.
public static  SelectgetHourSelector(String name)
     Return an 12 hour selector.
Parameters:
  name - The name to use for the selected hour.
public static  SelectgetHourSelector(String name, Calendar now)
     Return an 12 hour selector.
Parameters:
  name - The name to use for the selected hour.
Parameters:
  now - Calendar to start with.
public static  SelectgetHourSelector(String name, Calendar now, int format)
     Return an hour selector (either 12hr or 24hr depending on format.
Parameters:
  name - The name to use for the selected hour.
Parameters:
  now - Calendar to start with.
Parameters:
  format - Time format.
public static  SelectgetMinuteSelector(String name)
     Return a minute selector.
Parameters:
  name - The name to use for the selected minute.
public static  SelectgetMinuteSelector(String name, Calendar now)
     Return a minute selector.
Parameters:
  name - The name to use for the selected minute.
public static  SelectgetMinuteSelector(String name, Calendar now, int interval)
     Return a minute selector.
Parameters:
  name - The name to use for the selected minute.
Parameters:
  now - Calendar to start with.
Parameters:
  interval - Interval between options.
public static  SelectgetSecondSelector(String name)
     Return a second selector.
Parameters:
  name - The name to use for the selected second.
public static  SelectgetSecondSelector(String name, Calendar now)
     Return a second selector.
Parameters:
  name - The name to use for the selected second.
Parameters:
  now - Calendar to start with.
public static  SelectgetSecondSelector(String name, Calendar now, int interval)
     Return a second selector.
Parameters:
  name - The name to use for the selected second.
Parameters:
  now - Calendar to start with.
Parameters:
  interval - Interval between options.
public  StringgetSelName()
     Get the selector name prefix.
public  Stringoutput()
     Used to build the popupmenu in HTML.
public  TimeSelectorsetMinuteInterval(int minutes)
     Set the interval between options in the minute select box. Individual getHour, getMinute, getSecond, getAMPM static methods will not use this setting.
Parameters:
  minutes - Interval in minutes.
public  TimeSelectorsetOnChange(String onChange)
     Adds the onChange to all of <SELECT> tags. This is limited to one function for all three popups and is only used when the output() methods are used.
public  TimeSelectorsetSecondInterval(int seconds)
     Set the interval between options in the second select box. Individual getHour, getMinute, getSecond, getAMPM static methods will not use this setting.
Parameters:
  seconds - Interval in seconds.
public  TimeSelectorsetSeconds(int seconds)
     Select the second to be selected if the showSeconds(false) behavior is used.
public  voidsetSelName(String selName)
     Set the selector name prefix.
public  TimeSelectorsetShowSeconds(boolean show)
     Whether or not to show the seconds as a popup menu.
public  TimeSelectorsetTimeFormat(int format)
     Set the time format to 12 or 24 hour.
public  StringtoString()
     Used to build the popupmenu in HTML.

Field Detail
AMPM_SUFFIX
final public static String AMPM_SUFFIX(Code)
Suffix for am/pm parameter.



DEFAULT_PREFIX
final public static String DEFAULT_PREFIX(Code)
Prefix for time names.



HOUR_SUFFIX
final public static String HOUR_SUFFIX(Code)
Suffix for hour parameter.



MINUTE_SUFFIX
final public static String MINUTE_SUFFIX(Code)
Suffix for minute parameter.



SECOND_SUFFIX
final public static String SECOND_SUFFIX(Code)
Suffix for second parameter.



TWELVE_HOUR
final public static int TWELVE_HOUR(Code)
Constant for 12hr format



TWENTY_FOUR_HOUR
final public static int TWENTY_FOUR_HOUR(Code)
Constant for 24hr format




Constructor Detail
TimeSelector
public TimeSelector()(Code)
Constructor defaults to current date/time and uses the default prefix:
TimeSelector.DEFAULT



TimeSelector
public TimeSelector(String selName, Calendar useDate)(Code)
Constructor, uses the date/time set in the calendar passed in (with the date/time set correctly).
Parameters:
  selName - A String with the selector name.
Parameters:
  useDate - A Calendar with a date/time.



TimeSelector
public TimeSelector(String selName)(Code)
Constructor defaults to current date/time.
Parameters:
  selName - A String with the selector name.




Method Detail
ecsOutput
public ElementContainer ecsOutput()(Code)
Return an ECS container with the select objects inside. An ECS container.



getAMPMSelector
public static Select getAMPMSelector(String name)(Code)
Return an am/pm selector.
Parameters:
  name - The name to use for the selected am/pm. A select object with am/pm



getAMPMSelector
public static Select getAMPMSelector(String name, Calendar now)(Code)
Return an am/pm selector.
Parameters:
  name - The name to use for the selected am/pm.
Parameters:
  now - Calendar to start with. A select object with am/pm.



getHourSelector
public static Select getHourSelector(String name)(Code)
Return an 12 hour selector.
Parameters:
  name - The name to use for the selected hour. A select object with all the hours.



getHourSelector
public static Select getHourSelector(String name, Calendar now)(Code)
Return an 12 hour selector.
Parameters:
  name - The name to use for the selected hour.
Parameters:
  now - Calendar to start with. A select object with all the hours.



getHourSelector
public static Select getHourSelector(String name, Calendar now, int format)(Code)
Return an hour selector (either 12hr or 24hr depending on format.
Parameters:
  name - The name to use for the selected hour.
Parameters:
  now - Calendar to start with.
Parameters:
  format - Time format. A select object with all the hours.



getMinuteSelector
public static Select getMinuteSelector(String name)(Code)
Return a minute selector.
Parameters:
  name - The name to use for the selected minute. A select object with minute options.



getMinuteSelector
public static Select getMinuteSelector(String name, Calendar now)(Code)
Return a minute selector.
Parameters:
  name - The name to use for the selected minute. A select object with minute options.



getMinuteSelector
public static Select getMinuteSelector(String name, Calendar now, int interval)(Code)
Return a minute selector.
Parameters:
  name - The name to use for the selected minute.
Parameters:
  now - Calendar to start with.
Parameters:
  interval - Interval between options. A select object with minute options.



getSecondSelector
public static Select getSecondSelector(String name)(Code)
Return a second selector.
Parameters:
  name - The name to use for the selected second. A select object with second options.



getSecondSelector
public static Select getSecondSelector(String name, Calendar now)(Code)
Return a second selector.
Parameters:
  name - The name to use for the selected second.
Parameters:
  now - Calendar to start with. A select object with second options.



getSecondSelector
public static Select getSecondSelector(String name, Calendar now, int interval)(Code)
Return a second selector.
Parameters:
  name - The name to use for the selected second.
Parameters:
  now - Calendar to start with.
Parameters:
  interval - Interval between options. A select object with second options.



getSelName
public String getSelName()(Code)
Get the selector name prefix. A String with the select name prefix.



output
public String output()(Code)
Used to build the popupmenu in HTML. The properties set in the object are used to generate the correct HTML. The selName attribute is used to seed the names of the select lists. The names will be generated as follows:
  • selName + "_hour"
  • selName + "_minute"
  • selName + "_ampm"
If onChange was set it is also used in the generation of the output. The output HTML will list the select lists in the following order: hour minute ampm. If setShowSeconds(true) is used then an addition second select box is produced after the minute select box. If setTimeFormat(TimeSelector.TWENTY_FOUR_HOUR) is used then the ampm select box is omitted. A String with the correct HTML for the date selector.



setMinuteInterval
public TimeSelector setMinuteInterval(int minutes)(Code)
Set the interval between options in the minute select box. Individual getHour, getMinute, getSecond, getAMPM static methods will not use this setting.
Parameters:
  minutes - Interval in minutes. A TimeSelector (self).



setOnChange
public TimeSelector setOnChange(String onChange)(Code)
Adds the onChange to all of <SELECT> tags. This is limited to one function for all three popups and is only used when the output() methods are used. Individual getHour, getMinute, getSecond, getAMPM static methods will not use this setting.
Parameters:
  onChange - A String to use for onChange attribute. If null,then nothing will be set. A TimeSelector (self).



setSecondInterval
public TimeSelector setSecondInterval(int seconds)(Code)
Set the interval between options in the second select box. Individual getHour, getMinute, getSecond, getAMPM static methods will not use this setting.
Parameters:
  seconds - Interval in seconds. A TimeSelector (self).



setSeconds
public TimeSelector setSeconds(int seconds)(Code)
Select the second to be selected if the showSeconds(false) behavior is used. Individual getHour, getMinute, getSecond, getAMPM static methods will not use this setting.
Parameters:
  seconds - The second. A TimeSelector (self).



setSelName
public void setSelName(String selName)(Code)
Set the selector name prefix. Individual getHour, getMinute, getSeconds, getAMPM static methods will not use this setting.
Parameters:
  selname - A String with the select name prefix.



setShowSeconds
public TimeSelector setShowSeconds(boolean show)(Code)
Whether or not to show the seconds as a popup menu. The seconds will be a hidden parameter and the value set with setSeconds is used. Individual getHour, getMinute, getSecond, getAMPM static methods will not use this setting.
Parameters:
  show - True if the second should be shown. A TimeSelector (self).



setTimeFormat
public TimeSelector setTimeFormat(int format)(Code)
Set the time format to 12 or 24 hour. Individual getHour, getMinute, getSecond, getAMPM static methods will not use this setting.
Parameters:
  format - Time format. A TimeSelector (self).



toString
public String toString()(Code)
Used to build the popupmenu in HTML. The properties set in the object are used to generate the correct HTML. The selName attribute is used to seed the names of the select lists. The names will be generated as follows:
  • selName + "_hour"
  • selName + "_minute"
  • selName + "_ampm"
If onChange was set it is also used in the generation of the output. The output HTML will list the select lists in the following order: hour minute ampm. If setShowSeconds(true) is used then an addition second select box is produced after the minute select box. If setTimeFormat(TimeSelector.TWENTY_FOUR_HOUR) is used then the ampm select box is omitted. A String with the correct HTML for the date selector.



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.