|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.turbine.util.DateSelector
public class DateSelector
DateSelector is a utility class to handle the creation of a set of date popup menus. The code is broken into a set of static methods for quick and easy access to the individual select objects:
ElementContainer ec dateSelect = new ElementContainer(); String myName = "mydate"; ec.addElement(DateSelector.getMonthSelector(myName)); ec.addElement(DateSelector.getDaySelector(myName)); ec.addElement(DateSelector.getYearSelector(myName));There are also methods which will use attributes to build a complete month,day,year selector:
DateSelector ds = new DateSelector(myName); dateSelect = ds.ecsOutput();The above element container would use the onChange setting and may hide the selected day if set via showDays().
Field Summary | |
---|---|
static String |
DAY_SUFFIX
Suffix for day parameter. |
static String |
DEFAULT_PREFIX
Prefix for date names. |
static String |
MONTH_SUFFIX
Suffix for month parameter. |
static String |
YEAR_SUFFIX
Suffix for year parameter. |
Constructor Summary | |
---|---|
DateSelector()
Constructor defaults to current date and uses the default prefix: DateSelector.DEFAULT |
|
DateSelector(String selName)
Constructor defaults to current date. |
|
DateSelector(String selName,
Calendar useDate)
Constructor, uses the date set in a calendar that has been already passed in (with the date set correctly). |
Method Summary | |
---|---|
org.apache.ecs.ElementContainer |
ecsOutput()
|
static org.apache.ecs.html.Select |
getDaySelector(String name)
Return a day selector. |
static org.apache.ecs.html.Select |
getDaySelector(String name,
Calendar now)
Return a day selector. |
static org.apache.ecs.html.Select |
getMonthSelector(String name)
Return a month selector. |
static org.apache.ecs.html.Select |
getMonthSelector(String name,
Calendar now)
Return a month selector. |
String |
getSelName()
Get the selector name prefix. |
static org.apache.ecs.html.Select |
getYearSelector(String name)
Return a year selector. |
static org.apache.ecs.html.Select |
getYearSelector(String name,
Calendar now)
Return a year selector. |
static org.apache.ecs.html.Select |
getYearSelector(String name,
int firstYear,
int lastYear,
int selectedYear)
Return a year selector. |
String |
output()
Used to build the popupmenu in HTML. |
DateSelector |
setDay(int day)
Select the day to be selected if the showDays(false) behavior is used. |
DateSelector |
setOnChange(String onChange)
Adds the onChange to all of <SELECT> tags. |
void |
setSelName(String selName)
Set the selector name prefix. |
DateSelector |
setShowDay(boolean show)
Whether or not to show the days as a popup menu. |
boolean |
setYear(int firstYear,
int lastYear,
int selectedYear)
Select the day to be selected if the showDays(false) behavior is used. |
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 |
---|
public static final String DEFAULT_PREFIX
public static final String DAY_SUFFIX
public static final String MONTH_SUFFIX
public static final String YEAR_SUFFIX
Constructor Detail |
---|
public DateSelector()
DateSelector.DEFAULT
public DateSelector(String selName, Calendar useDate)
selName
- A String with the selector name.useDate
- A Calendar with a date.public DateSelector(String selName)
selName
- A String with the selector name.Method Detail |
---|
public DateSelector setOnChange(String onChange)
string
- A String to use for onChange attribute. If null,
then nothing will be set.
public DateSelector setDay(int day)
day
- The day.
public DateSelector setShowDay(boolean show)
show
- True if the day should be shown.
public void setSelName(String selName)
selname
- A String with the select name prefix.public String getSelName()
public static org.apache.ecs.html.Select getMonthSelector(String name)
name
- The name to use for the selected month.
public static org.apache.ecs.html.Select getMonthSelector(String name, Calendar now)
name
- The name to use for the selected month.now
- Calendar to start with.
public static org.apache.ecs.html.Select getDaySelector(String name)
name
- The name to use for the selected day.
public static org.apache.ecs.html.Select getDaySelector(String name, Calendar now)
name
- The name to use for the selected day.now
- Calendar to start with.
public static org.apache.ecs.html.Select getYearSelector(String name)
name
- The name to use for the selected year.
public static org.apache.ecs.html.Select getYearSelector(String name, Calendar now)
name
- The name to use for the selected year.now
- Calendar to start with.
public static org.apache.ecs.html.Select getYearSelector(String name, int firstYear, int lastYear, int selectedYear)
name
- The name to use for the selected year.firstYear
- the first (earliest) year in the selector.lastYear
- the last (latest) year in the selector.selectedYear
- the year initially selected in the Select html.
public boolean setYear(int firstYear, int lastYear, int selectedYear)
day
- The day.
public String output()
public String toString()
toString
in class Object
public org.apache.ecs.ElementContainer ecsOutput()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |