|
Java Date Picker v3.2 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
The date model is a convenient way to represent extended information about a
date; it is extremely useful for date editing components.
It wraps a date and allows date field changes. One can also clear a field
to indicate that it is contains no value. Interested parties can register for
notifications about date or date field changes. This model even allows to
specify which date fields are used to build
the date.
As a special feature, it can accept years in a
short form. This means that you could set a
year like 1980 by just using the short form 80.
| Method Summary | |
void |
addDateListener(DateListener listener)
Registers a new date listener to the model. |
void |
clear(int field)
Clears a specified field, meaning that it contains no value. |
int |
get(int field)
Returns the value of a specified field. |
int |
getAutoCenturyYear()
Determines the reference year used to build the long year from a short one. |
java.util.Date |
getDate()
Returns the date wrapped by this model. |
boolean |
isAutoCentury()
Determines whether century is automatically added to the year field if its value is less than 100. |
boolean |
isSet(int field)
Determines whether a specified field is cleared or not. |
boolean |
isUsed(int field)
Determines whether a specified field is part of the date. |
void |
removeDateListener(DateListener listener)
Removes a specified date listener from this model. |
void |
set(int field,
int value)
Modifies the value of a specified date field. |
void |
setAutoCentury(boolean auto)
Specifies whether century is automatically added to the year field if its value is less than 100. |
void |
setAutoCenturyYear(int year)
Specifies the year used to build the long year when short years are used. |
void |
setDate(java.util.Date date)
Specifies a new date to be represented by this model that can later be modified field by field. |
void |
setUsed(int field,
boolean used)
Specifies whether a certain field is used to construct the actual date represented here. |
| Method Detail |
public void setDate(java.util.Date date)
null date will clear all the
basic fields like Calendar.YEAR, Calendar.MONTH,
Calendar.DATE, Calendar.HOUR, Calendar.MINUTE,
Calendar.SECOND and Calendar.MILLISECOND.
date - date wrapped by the modelclear(int)public java.util.Date getDate()
null date is returned.
setDate(Date),
isSet(int)
public void set(int field,
int value)
field - date field that is modified. Possible values are: Calendar.YEAR,
Calendar.MONTH, Calendar.MINUTE, etc.value - the new date field value. Various implementations could handle
this value differently. Some may allow and some may not allow out of range values.public int get(int field)
field - date field that is tested. Possible values are: Calendar.YEAR,
Calendar.MONTH, Calendar.MINUTE, etc.
public void clear(int field)
field - field that is cleared. Possible values are: Calendar.YEAR,
Calendar.MONTH, Calendar.MINUTE, etc.isSet(int)public boolean isSet(int field)
field - field that is tested. Possible values are: Calendar.YEAR,
Calendar.MONTH, Calendar.MINUTE, etc.
true if the field is not cleared; false otherwiseclear(int)
public void setUsed(int field,
boolean used)
Specifies whether a certain field is used to construct the actual date
represented here. When the date is evaluated, all the fields that it
uses (marked with this method as used) must contain a value. Otherwise,
the date is considered incomplete and it is in fact a null date.
This method is mainly intended for use by date editing components that restrict the represented date only to some of its fields.
field - specified field that is marked as used or unusedused - true if the field is part of the date; false otherwiseclear(int),
getDate()public boolean isUsed(int field)
field - field that is tested
true if the field is part of the date; false otherwisesetUsed(int, boolean)public void setAutoCentury(boolean auto)
auto - true if century is automatically added;
false otherwisesetAutoCenturyYear(int)public boolean isAutoCentury()
true if century is automatically added;
false otherwise.setAutoCentury(boolean)public void setAutoCenturyYear(int year)
Specifies the year used to build the long year when short years are used. One can use short years which range from 0..99 when the autoCentury property is enabled. This means that instead of typing 1980 you can just use 80.
The short year is converted into a long year after it is compared with the last two digits of the autoCenturyYear year. Here are some examples that show how this mechanism works:
| short | autoCenturyYear | long |
|---|---|---|
| 30 | 1930 | 1930 |
| 56 | 1930 | 1956 |
| 11 | 1930 | 2011 |
year - reference year used to build the long year from a short onesetAutoCentury(boolean)public int getAutoCenturyYear()
setAutoCenturyYear(int)public void addDateListener(DateListener listener)
listener - listener to be registeredpublic void removeDateListener(DateListener listener)
listener - listener to be removed
|
Java Date Picker v3.2 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Visit www.javadatepicker.com for further information or send us your suggestions.
Copyright © 2003-2004 Stand By Soft Ltd. All Rights Reserved.