public class DateSelector extends Object
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().
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
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).
|
Modifier and Type | Method and Description |
---|---|
org.apache.ecs.ElementContainer |
ecsOutput()
Return an ECS container with the month, day, and year select
objects inside.
|
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)
Set a year range to be displayed
|
String |
toString()
Used to build the popupmenu in HTML.
|
public static final String DEFAULT_PREFIX
public static final String DAY_SUFFIX
public static final String MONTH_SUFFIX
public static final String YEAR_SUFFIX
public DateSelector()
DateSelector.DEFAULT
public DateSelector(String selName)
selName
- A String with the selector name.public DateSelector(String selName, Calendar useDate)
selName
- A String with the selector name.useDate
- A Calendar with a date.public DateSelector setOnChange(String onChange)
onChange
- 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)
firstYear
- start of year rangelastYear
- end of year rangeselectedYear
- entry to selectpublic String output()
public String toString()
public org.apache.ecs.ElementContainer ecsOutput()
Copyright © 2000–2018 The Apache Software Foundation. All rights reserved.