|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.vaadin.ui.AbstractComponent
com.vaadin.ui.AbstractField
com.vaadin.ui.DateField
public class DateField
A date editor component that can be bound to any Property that is
compatible with java.util.Date.
Since DateField extends AbstractField it implements
the Bufferedinterface.
A DateField is in write-through mode by default, so
AbstractField.setWriteThrough(boolean)must be called to
enable buffering.
| Nested Class Summary | |
|---|---|
static class |
DateField.UnparsableDateString
|
| Nested classes/interfaces inherited from class com.vaadin.ui.AbstractField |
|---|
AbstractField.FocusShortcut, AbstractField.ReadOnlyStatusChangeEvent |
| Nested classes/interfaces inherited from class com.vaadin.ui.AbstractComponent |
|---|
AbstractComponent.ComponentErrorEvent, AbstractComponent.ComponentErrorHandler |
| Nested classes/interfaces inherited from interface com.vaadin.ui.Field |
|---|
Field.ValueChangeEvent |
| Nested classes/interfaces inherited from interface com.vaadin.data.Buffered |
|---|
Buffered.SourceException |
| Nested classes/interfaces inherited from interface com.vaadin.data.Property |
|---|
Property.ConversionException, Property.Editor, Property.ReadOnlyException, Property.ReadOnlyStatusChangeListener, Property.ReadOnlyStatusChangeNotifier, Property.ValueChangeListener, Property.ValueChangeNotifier, Property.Viewer |
| Field Summary | |
|---|---|
static int |
RESOLUTION_DAY
Resolution identifier: days. |
static int |
RESOLUTION_HOUR
Resolution identifier: hours. |
static int |
RESOLUTION_MIN
Resolution identifier: minutes. |
static int |
RESOLUTION_MONTH
Resolution identifier: months. |
static int |
RESOLUTION_MSEC
Resolution identifier: milliseconds. |
static int |
RESOLUTION_SEC
Resolution identifier: seconds. |
static int |
RESOLUTION_YEAR
Resolution identifier: years. |
| Constructor Summary | |
|---|---|
DateField()
Constructs an empty DateField with no caption. |
|
DateField(Property dataSource)
Constructs a new DateField that's bound to the specified
Property and has no caption. |
|
DateField(String caption)
Constructs an empty DateField with caption. |
|
DateField(String caption,
Date value)
Constructs a new DateField with the given caption and
initial text contents. |
|
DateField(String caption,
Property dataSource)
Constructs a new DateField that's bound to the specified
Property and has the given caption String. |
|
| Method Summary | |
|---|---|
void |
addListener(FieldEvents.BlurListener listener)
Adds a BlurListener to the Component which gets fired
when a Field loses keyboard focus. |
void |
addListener(FieldEvents.FocusListener listener)
Adds a FocusListener to the Component which gets fired
when a Field receives keyboard focus. |
void |
changeVariables(Object source,
Map<String,Object> variables)
Called when one or more variables handled by the implementing class are changed. |
String |
getDateFormat()
Returns a format string used to format date value on client side or null if default formatting from Component.getLocale() is used. |
String |
getParseErrorMessage()
Return the error message that is shown if the user inputted value can't be parsed into a Date object. |
int |
getResolution()
Gets the resolution. |
TimeZone |
getTimeZone()
Gets the time zone used by this field. |
Class<?> |
getType()
Returns the type of the Property. |
protected Date |
handleUnparsableDateString(String dateString)
This method is called to handle a non-empty date string from the client if the client could not parse it as a Date. |
boolean |
isLenient()
Returns whether date/time interpretation is to be lenient. |
boolean |
isShowISOWeekNumbers()
Checks whether ISO 8601 week numbers are shown in the date selector. |
boolean |
isValid()
Tests the current value against registered validators if the field is not empty. |
void |
paintContent(PaintTarget target)
Paints any needed component-specific things to the given UIDL stream. |
void |
removeListener(FieldEvents.BlurListener listener)
Removes a BlurListener from the Component. |
void |
removeListener(FieldEvents.FocusListener listener)
Removes a FocusListener from the Component. |
void |
setDateFormat(String dateFormat)
Sets formatting used by some component implementations. |
protected void |
setInternalValue(Object newValue)
Sets the internal field value. |
void |
setLenient(boolean lenient)
Specifies whether or not date/time interpretation in component is to be lenient. |
void |
setParseErrorMessage(String parsingErrorMessage)
Sets the default error message used if the DateField cannot parse the text input by user to a Date field. |
void |
setPropertyDataSource(Property newDataSource)
Sets the DateField datasource. |
void |
setResolution(int resolution)
Sets the resolution of the DateField. |
void |
setShowISOWeekNumbers(boolean showWeekNumbers)
Sets the visibility of ISO 8601 week numbers in the date selector. |
void |
setTimeZone(TimeZone timeZone)
Sets the time zone used by this date field. |
protected void |
setValue(Object newValue,
boolean repaintIsNotNeeded)
Sets the value of the field. |
protected boolean |
shouldHideErrors()
Returns true if the error indicator be hidden when painting the component even when there are errors. |
void |
validate()
Checks the validity of the Validatable by validating the field with all attached validators except when the field is empty. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.vaadin.ui.Field |
|---|
getDescription, setCaption, setDescription |
| Field Detail |
|---|
public static final int RESOLUTION_MSEC
public static final int RESOLUTION_SEC
public static final int RESOLUTION_MIN
public static final int RESOLUTION_HOUR
public static final int RESOLUTION_DAY
public static final int RESOLUTION_MONTH
public static final int RESOLUTION_YEAR
| Constructor Detail |
|---|
public DateField()
DateField with no caption.
public DateField(String caption)
DateField with caption.
caption - the caption of the datefield.
public DateField(String caption,
Property dataSource)
DateField that's bound to the specified
Property and has the given caption String.
caption - the caption String for the editor.dataSource - the Property to be edited with this editor.
public DateField(Property dataSource)
throws IllegalArgumentException
DateField that's bound to the specified
Property and has no caption.
dataSource - the Property to be edited with this editor.
IllegalArgumentException
public DateField(String caption,
Date value)
DateField with the given caption and
initial text contents. The editor constructed this way will not be bound
to a Property unless
Property.Viewer.setPropertyDataSource(Property)
is called to bind it.
caption - the caption String for the editor.value - the Date value.| Method Detail |
|---|
public void paintContent(PaintTarget target)
throws PaintException
AbstractComponentAbstractComponent.paint(PaintTarget) method handles all general
attributes common to all components, and it calls this method to paint
any component-specific attributes to the UIDL stream.
paintContent in class AbstractFieldtarget - the target UIDL stream where the component should paint itself
to
PaintException - if the paint operation failed.protected boolean shouldHideErrors()
AbstractField
shouldHideErrors in class AbstractField
public void changeVariables(Object source,
Map<String,Object> variables)
VariableOwner
changeVariables in interface VariableOwnerchangeVariables in class AbstractFieldsource - the Source of the variable change. This is the origin of the
event. For example in Web Adapter this is the request.variables - the Mapping from variable names to new variable values.
protected Date handleUnparsableDateString(String dateString)
throws Property.ConversionException
dateString -
Property.ConversionException - to keep the old value and indicate an errorpublic Class<?> getType()
PropertygetValue and
setValue must be compatible with this type: one must be able
to safely cast the value returned from getValue to the given
type and pass any variable assignable to this type as an argument to
setValue.
getType in interface PropertygetType in class AbstractField
protected void setValue(Object newValue,
boolean repaintIsNotNeeded)
throws Property.ReadOnlyException,
Property.ConversionException
AbstractField
setValue in class AbstractFieldnewValue - the New value of the field.repaintIsNotNeeded - True iff caller is sure that repaint is not needed.
Property.ReadOnlyException
Property.ConversionExceptionpublic void setPropertyDataSource(Property newDataSource)
setPropertyDataSource in interface Property.ViewersetPropertyDataSource in class AbstractFieldnewDataSource - the new data source Property.Property.Viewer.setPropertyDataSource(Property)protected void setInternalValue(Object newValue)
AbstractField
setInternalValue in class AbstractFieldnewValue - the new value to be set.public int getResolution()
public void setResolution(int resolution)
resolution - the resolution to set.public void setDateFormat(String dateFormat)
SimpleDateFormat for format details.
By default it is encouraged to used default formatting defined by Locale,
but due some JVM bugs it is sometimes necessary to use this method to
override formatting. See Vaadin issue #2200.
dateFormat - the dateFormat to setcom.vaadin.ui.AbstractComponent#setLocale(Locale))public String getDateFormat()
Component.getLocale() is used.
public void setLenient(boolean lenient)
lenient - true if the lenient mode is to be turned on; false if it is to
be turned off.Calendar.setLenient(boolean),
isLenient()public boolean isLenient()
setLenient(boolean)public void addListener(FieldEvents.FocusListener listener)
FieldEvents.FocusNotifierFocusListener to the Component which gets fired
when a Field receives keyboard focus.
addListener in interface FieldEvents.FocusNotifierFieldEvents.FocusListenerpublic void removeListener(FieldEvents.FocusListener listener)
FieldEvents.FocusNotifierFocusListener from the Component.
removeListener in interface FieldEvents.FocusNotifierFieldEvents.FocusListenerpublic void addListener(FieldEvents.BlurListener listener)
FieldEvents.BlurNotifierBlurListener to the Component which gets fired
when a Field loses keyboard focus.
addListener in interface FieldEvents.BlurNotifierFieldEvents.BlurListenerpublic void removeListener(FieldEvents.BlurListener listener)
FieldEvents.BlurNotifierBlurListener from the Component.
removeListener in interface FieldEvents.BlurNotifierFieldEvents.BlurListenerpublic boolean isShowISOWeekNumbers()
public void setShowISOWeekNumbers(boolean showWeekNumbers)
showWeekNumbers - true if week numbers should be shown, false otherwise.public boolean isValid()
isValid in interface ValidatableisValid in class AbstractFieldtrue if all registered validators claim that the
current value is valid or if the field is empty and not required,
false otherwise.AbstractField.isValid()
public void validate()
throws Validator.InvalidValueException
AbstractField
validate in interface Validatablevalidate in class AbstractFieldValidator.InvalidValueException - if the value is not validValidatable.validate()public String getParseErrorMessage()
handleUnparsableDateString(String) is overridden and it throws a
custom exception, the message returned by
Throwable.getLocalizedMessage() will be used instead of the value
returned by this method.
setParseErrorMessage(String)public void setParseErrorMessage(String parsingErrorMessage)
handleUnparsableDateString(String) method is overridden, the
localized message from its exception is used.
parsingErrorMessage - getParseErrorMessage(),
handleUnparsableDateString(String)public void setTimeZone(TimeZone timeZone)
TimeZone.getDefault() is used.
timeZone - the time zone to use for time calculations.getTimeZone()public TimeZone getTimeZone()
null is returned, the current default time zone returned by
TimeZone.getDefault() is used.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||