|
|||||||||
| Home >> All >> org >> apache >> turbine >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.turbine.util
Class TimeSelector

java.lang.Objectorg.apache.turbine.util.TimeSelector
- public class TimeSelector
- extends java.lang.Object
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();
- Version:
- $Id: TimeSelector.java 264148 2005-08-29 14:21:04Z henning $
| Field Summary | |
static java.lang.String |
AMPM_SUFFIX
Suffix for am/pm parameter. |
private static int |
DEFAULT_MINUTE_INTERVAL
|
static java.lang.String |
DEFAULT_PREFIX
Prefix for time names. |
private static int |
DEFAULT_SECOND_INTERVAL
|
private static int |
DEFAULT_TIME_FORMAT
|
static java.lang.String |
HOUR_SUFFIX
Suffix for hour parameter. |
static java.lang.String |
MINUTE_SUFFIX
Suffix for minute parameter. |
private int |
minuteInterval
|
private static java.text.NumberFormat |
nbrFmt
TODO: Add ability to specify Locale. |
private java.lang.String |
onChange
|
private boolean |
onChangeSet
|
static java.lang.String |
SECOND_SUFFIX
Suffix for second parameter. |
private int |
secondInterval
|
private java.lang.String |
selName
|
private int |
setSeconds
|
private boolean |
showSeconds
|
private int |
timeFormat
|
static int |
TWELVE_HOUR
Constant for 12hr format |
static int |
TWENTY_FOUR_HOUR
Constant for 24hr format |
private java.util.Calendar |
useDate
|
| Constructor Summary | |
TimeSelector()
Constructor defaults to current date/time and uses the default prefix: |
|
TimeSelector(java.lang.String selName)
Constructor defaults to current date/time. |
|
TimeSelector(java.lang.String selName,
java.util.Calendar useDate)
Constructor, uses the date/time set in the calendar passed in (with the date/time set correctly). |
|
| Method Summary | |
org.apache.ecs.ElementContainer |
ecsOutput()
Return an ECS container with the select objects inside. |
static org.apache.ecs.html.Select |
getAMPMSelector(java.lang.String name)
Return an am/pm selector. |
static org.apache.ecs.html.Select |
getAMPMSelector(java.lang.String name,
java.util.Calendar now)
Return an am/pm selector. |
static org.apache.ecs.html.Select |
getHourSelector(java.lang.String name)
Return an 12 hour selector. |
static org.apache.ecs.html.Select |
getHourSelector(java.lang.String name,
java.util.Calendar now)
Return an 12 hour selector. |
static org.apache.ecs.html.Select |
getHourSelector(java.lang.String name,
java.util.Calendar now,
int format)
Return an hour selector (either 12hr or 24hr depending on format. |
static org.apache.ecs.html.Select |
getMinuteSelector(java.lang.String name)
Return a minute selector. |
static org.apache.ecs.html.Select |
getMinuteSelector(java.lang.String name,
java.util.Calendar now)
Return a minute selector. |
static org.apache.ecs.html.Select |
getMinuteSelector(java.lang.String name,
java.util.Calendar now,
int interval)
Return a minute selector. |
static org.apache.ecs.html.Select |
getSecondSelector(java.lang.String name)
Return a second selector. |
static org.apache.ecs.html.Select |
getSecondSelector(java.lang.String name,
java.util.Calendar now)
Return a second selector. |
static org.apache.ecs.html.Select |
getSecondSelector(java.lang.String name,
java.util.Calendar now,
int interval)
Return a second selector. |
java.lang.String |
getSelName()
Get the selector name prefix. |
java.lang.String |
output()
Used to build the popupmenu in HTML. |
TimeSelector |
setMinuteInterval(int minutes)
Set the interval between options in the minute select box. |
TimeSelector |
setOnChange(java.lang.String onChange)
Adds the onChange to all of <SELECT> tags. |
TimeSelector |
setSecondInterval(int seconds)
Set the interval between options in the second select box. |
TimeSelector |
setSeconds(int seconds)
Select the second to be selected if the showSeconds(false) behavior is used. |
void |
setSelName(java.lang.String selName)
Set the selector name prefix. |
TimeSelector |
setShowSeconds(boolean show)
Whether or not to show the seconds as a popup menu. |
TimeSelector |
setTimeFormat(int format)
Set the time format to 12 or 24 hour. |
java.lang.String |
toString()
Used to build the popupmenu in HTML. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
DEFAULT_PREFIX
public static final java.lang.String DEFAULT_PREFIX
- Prefix for time names.
- See Also:
- Constant Field Values
HOUR_SUFFIX
public static final java.lang.String HOUR_SUFFIX
- Suffix for hour parameter.
- See Also:
- Constant Field Values
MINUTE_SUFFIX
public static final java.lang.String MINUTE_SUFFIX
- Suffix for minute parameter.
- See Also:
- Constant Field Values
SECOND_SUFFIX
public static final java.lang.String SECOND_SUFFIX
- Suffix for second parameter.
- See Also:
- Constant Field Values
AMPM_SUFFIX
public static final java.lang.String AMPM_SUFFIX
- Suffix for am/pm parameter.
- See Also:
- Constant Field Values
TWELVE_HOUR
public static final int TWELVE_HOUR
- Constant for 12hr format
- See Also:
- Constant Field Values
TWENTY_FOUR_HOUR
public static final int TWENTY_FOUR_HOUR
- Constant for 24hr format
- See Also:
- Constant Field Values
nbrFmt
private static final java.text.NumberFormat nbrFmt
- TODO: Add ability to specify Locale.
DEFAULT_MINUTE_INTERVAL
private static final int DEFAULT_MINUTE_INTERVAL
- See Also:
- Constant Field Values
DEFAULT_SECOND_INTERVAL
private static final int DEFAULT_SECOND_INTERVAL
- See Also:
- Constant Field Values
DEFAULT_TIME_FORMAT
private static final int DEFAULT_TIME_FORMAT
- See Also:
- Constant Field Values
timeFormat
private int timeFormat
minuteInterval
private int minuteInterval
secondInterval
private int secondInterval
useDate
private java.util.Calendar useDate
selName
private java.lang.String selName
onChange
private java.lang.String onChange
onChangeSet
private boolean onChangeSet
showSeconds
private boolean showSeconds
setSeconds
private int setSeconds
| Constructor Detail |
TimeSelector
public TimeSelector()
- Constructor defaults to current date/time and uses the default
prefix:
TimeSelector.DEFAULT
TimeSelector
public TimeSelector(java.lang.String selName, java.util.Calendar useDate)
- Constructor, uses the date/time set in the calendar
passed in (with the date/time set correctly).
TimeSelector
public TimeSelector(java.lang.String selName)
- Constructor defaults to current date/time.
| Method Detail |
setOnChange
public TimeSelector setOnChange(java.lang.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. Individual getHour, getMinute, getSecond, getAMPM static methods will not use this setting.
setSeconds
public TimeSelector setSeconds(int seconds)
- 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.
setMinuteInterval
public TimeSelector setMinuteInterval(int minutes)
- Set the interval between options in the minute select box.
Individual getHour, getMinute, getSecond, getAMPM static methods
will not use this setting.
setSecondInterval
public TimeSelector setSecondInterval(int seconds)
- Set the interval between options in the second select box.
Individual getHour, getMinute, getSecond, getAMPM static methods
will not use this setting.
setTimeFormat
public TimeSelector setTimeFormat(int format)
- Set the time format to 12 or 24 hour. Individual getHour,
getMinute, getSecond, getAMPM static methods
will not use this setting.
setShowSeconds
public TimeSelector setShowSeconds(boolean show)
- 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.
setSelName
public void setSelName(java.lang.String selName)
- Set the selector name prefix. Individual getHour, getMinute,
getSeconds, getAMPM static methods will not use this setting.
getSelName
public java.lang.String getSelName()
- Get the selector name prefix.
getSecondSelector
public static org.apache.ecs.html.Select getSecondSelector(java.lang.String name)
- Return a second selector.
getSecondSelector
public static org.apache.ecs.html.Select getSecondSelector(java.lang.String name, java.util.Calendar now)
- Return a second selector.
getSecondSelector
public static org.apache.ecs.html.Select getSecondSelector(java.lang.String name, java.util.Calendar now, int interval)
- Return a second selector.
getMinuteSelector
public static org.apache.ecs.html.Select getMinuteSelector(java.lang.String name)
- Return a minute selector.
getMinuteSelector
public static org.apache.ecs.html.Select getMinuteSelector(java.lang.String name, java.util.Calendar now)
- Return a minute selector.
getMinuteSelector
public static org.apache.ecs.html.Select getMinuteSelector(java.lang.String name, java.util.Calendar now, int interval)
- Return a minute selector.
getHourSelector
public static org.apache.ecs.html.Select getHourSelector(java.lang.String name)
- Return an 12 hour selector.
getHourSelector
public static org.apache.ecs.html.Select getHourSelector(java.lang.String name, java.util.Calendar now)
- Return an 12 hour selector.
getHourSelector
public static org.apache.ecs.html.Select getHourSelector(java.lang.String name, java.util.Calendar now, int format)
- Return an hour selector (either 12hr or 24hr depending on
format.
getAMPMSelector
public static org.apache.ecs.html.Select getAMPMSelector(java.lang.String name)
- Return an am/pm selector.
getAMPMSelector
public static org.apache.ecs.html.Select getAMPMSelector(java.lang.String name, java.util.Calendar now)
- Return an am/pm selector.
output
public java.lang.String output()
- 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"
toString
public java.lang.String toString()
- 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"
ecsOutput
public org.apache.ecs.ElementContainer ecsOutput()
- Return an ECS container with the select objects inside.
|
|||||||||
| Home >> All >> org >> apache >> turbine >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.apache.turbine.util.TimeSelector