public abstract class AbstractDateInput extends ParseAbstractInput<java.util.Date> implements BoundedDateInput, FormatHintInput
Input
s that parse to java Date
objects.
sub-classes may be constrained to generate values that are constrained to day/hour/min boundaries.
This class uses a series of DateFormat
s applied in turn so as to support multiple formats
the first format should be the one compatible with the format defined in the standard for the corresponding Html5 input.
However getHintIndex()
specifies the format that should be suggested to a user when
defaulting to a text inputModifier and Type | Field and Description |
---|---|
static java.util.Date |
DEFAULT_MAX_DATE |
validators
USE_DATE_INPUT
Constructor and Description |
---|
AbstractDateInput() |
AbstractDateInput(long resolution) |
Modifier and Type | Method and Description |
---|---|
java.util.Date |
convert(java.lang.Object v)
Perform any supported type conversions to to generate a value of the
target type
|
java.lang.String |
formatRange(java.util.Date n)
format step/range values as used by the input into compatible to the way they are
presented.
|
protected java.text.DateFormat |
getDateFormat(java.lang.String format) |
java.lang.String |
getFormatHint() |
abstract java.lang.String[] |
getFormats() |
protected int |
getHintIndex()
Which of the available formats in
getFormats()
should be used as the hint text. |
java.util.Date |
getMax()
Maximum valid value
null value implies no maximum
|
java.util.Date |
getMin()
Minimum valid value.
|
java.lang.String |
getString(java.util.Date date)
simple format of a date
|
java.lang.String |
getType()
get the type tag to emit for
the corresponding html5 type.
|
java.util.Date |
parseValue(java.lang.String v)
Parse a String into the correct type for this input.
|
java.util.Date |
setMax(java.util.Date val)
set the maximum value
|
java.util.Date |
setMin(java.util.Date val)
Set the minimum value
|
accept, getBoxWidth, getMaxResultLength, getSingle, setBoxWidth, setMaxResultLength, setSingle
getValue, setKey, setValue
addValidator, getKey, getPrettyString, getString, removeValidator, validate, validateInner
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getInstance, getInstance
getString, parse
accept, addValidator, getKey, getPrettyString, getValue, isEmpty, removeValidator, setKey, setValue, validate
public AbstractDateInput()
public AbstractDateInput(long resolution)
protected java.text.DateFormat getDateFormat(java.lang.String format)
public abstract java.lang.String[] getFormats()
public java.util.Date parseValue(java.lang.String v) throws ParseException
ParseInput
Input.getString(Object)
method.parseValue
in interface ParseInput<java.util.Date>
v
- ParseException
public java.lang.String getString(java.util.Date date)
getString
in interface Input<java.util.Date>
getString
in class BaseInput<java.util.Date>
date
- Date to formatParseInput
protected int getHintIndex()
getFormats()
should be used as the hint text.public java.lang.String getFormatHint()
getFormatHint
in interface FormatHintInput
public java.util.Date convert(java.lang.Object v) throws TypeError
Input
public java.lang.String getType()
HTML5Input
getType
in interface HTML5Input
public java.util.Date getMin()
BoundedInput
getMin
in interface BoundedInput<java.util.Date>
public java.util.Date getMax()
BoundedInput
getMax
in interface BoundedInput<java.util.Date>
public java.util.Date setMin(java.util.Date val)
BoundedInput
setMin
in interface BoundedInput<java.util.Date>
public java.util.Date setMax(java.util.Date val)
BoundedInput
setMax
in interface BoundedInput<java.util.Date>
public java.lang.String formatRange(java.util.Date n)
BoundedInput
formatRange
in interface BoundedInput<java.util.Date>