Package adams.gui.core
Class DateTextField.DateCheckModel
- java.lang.Object
-
- adams.gui.core.CheckedTextField.AbstractCheckModel
-
- adams.gui.core.DateTextField.DateCheckModel
-
- All Implemented Interfaces:
Serializable
- Enclosing class:
- DateTextField
public static class DateTextField.DateCheckModel extends CheckedTextField.AbstractCheckModel
A model for checking dates. It allows a custom date format.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected DateFormat
m_DateFormat
the formatter object.protected String
m_Format
the format in use.-
Fields inherited from class adams.gui.core.CheckedTextField.AbstractCheckModel
m_DefaultValue
-
-
Constructor Summary
Constructors Constructor Description DateCheckModel()
Initializes the check model with the current date/time as default date and with default date format.DateCheckModel(String format)
Initializes the check model with the current date/time as default date.DateCheckModel(String format, Date defValue)
Initializes the check model with the current date/time as default date.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected DateFormat
getDateFormat()
Returns the DateFormat object to use, creates it if necessary.String
getFormat()
Returns the underlying format.boolean
isValid(String text)
Checks whether the content is valid.String
toString()
Returns a short string representation.-
Methods inherited from class adams.gui.core.CheckedTextField.AbstractCheckModel
getDefaultValue, setDefaultValue
-
-
-
-
Field Detail
-
m_Format
protected String m_Format
the format in use.
-
m_DateFormat
protected transient DateFormat m_DateFormat
the formatter object.
-
-
Constructor Detail
-
DateCheckModel
public DateCheckModel()
Initializes the check model with the current date/time as default date and with default date format.- See Also:
DateFormat.DEFAULT_FORMAT
-
DateCheckModel
public DateCheckModel(String format)
Initializes the check model with the current date/time as default date.- Parameters:
format
- the format to use
-
-
Method Detail
-
getDateFormat
protected DateFormat getDateFormat()
Returns the DateFormat object to use, creates it if necessary.- Returns:
- the date formatter
-
isValid
public boolean isValid(String text)
Checks whether the content is valid.- Specified by:
isValid
in classCheckedTextField.AbstractCheckModel
- Parameters:
text
- the string to check- Returns:
- true if valid
-
getFormat
public String getFormat()
Returns the underlying format.- Returns:
- format
-
toString
public String toString()
Returns a short string representation.- Overrides:
toString
in classCheckedTextField.AbstractCheckModel
- Returns:
- the string representation
-
-