Package ucar.ui.prefs
Class Field.Date
- java.lang.Object
-
- ucar.ui.prefs.Field
-
- ucar.ui.prefs.Field.Date
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ucar.ui.prefs.Field
Field.BeanTableField, Field.CheckBox, Field.Date, Field.Double, Field.EnumCombo, Field.Int, Field.Password, Field.Text, Field.TextArea, Field.TextCombo
-
-
Field Summary
Fields Modifier and Type Field Description protected JFormattedTextField
tf
-
Fields inherited from class ucar.ui.prefs.Field
label, listenerList, name, popupMenu, previousValue, storeData, validValue
-
-
Constructor Summary
Constructors Constructor Description Date(String name, String label, Date defValue, PersistenceManager storeData)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
_validate(StringBuffer buff)
See if edit value is valid, put error message in buff.Date
getDate()
Return the current valueJComponent
getEditComponent()
return the editing JComponentprotected Object
getEditValue()
Get current value from editComponentprotected Object
getStoreValue(Object defValue)
Get value from Store.boolean
isEditable()
Can user edit.void
setDate(Date newValue)
Set value; if different from current value, store in PersistenceManager and send event.void
setEditable(boolean isEditable)
Set whether the field is editable, default == enabledprotected void
setEditValue(Object value)
Set current value of editComponentprotected void
setStoreValue(Object value)
Set value; if different from current value, store in PersistenceManager and send event.-
Methods inherited from class ucar.ui.prefs.Field
accept, acceptIfDifferent, addPopupMenuAction, addPropertyChangeListener, addStandardPopups, addValidator, dfrac, finish, getDeepEditComponent, getLabel, getName, getPersistenceManager, getToolTipText, getValue, isEnabled, next, removePropertyChangeListener, restoreValue, sendEvent, setEnabled, setNewValueFromStore, setToolTipText, setValue, validate
-
-
-
-
Field Detail
-
tf
protected JFormattedTextField tf
-
-
Constructor Detail
-
Date
public Date(String name, String label, Date defValue, PersistenceManager storeData)
Constructor.- Parameters:
name
- of the field; must be unique within the storelabel
- to display to the userdefValue
- default value to start with.storeData
- store/fetch data from here, may be null.- See Also:
PrefPanel.addDateField(java.lang.String, java.lang.String, java.util.Date)
-
-
Method Detail
-
getEditComponent
public JComponent getEditComponent()
return the editing JComponent- Specified by:
getEditComponent
in classField
-
_validate
protected boolean _validate(StringBuffer buff)
See if edit value is valid, put error message in buff.
-
getEditValue
protected Object getEditValue()
Description copied from class:Field
Get current value from editComponent- Specified by:
getEditValue
in classField
-
setEditValue
protected void setEditValue(Object value)
Description copied from class:Field
Set current value of editComponent- Specified by:
setEditValue
in classField
-
isEditable
public boolean isEditable()
Can user edit. Default is true.- Overrides:
isEditable
in classField
-
setEditable
public void setEditable(boolean isEditable)
Description copied from class:Field
Set whether the field is editable, default == enabled- Overrides:
setEditable
in classField
-
setStoreValue
protected void setStoreValue(Object value)
Set value; if different from current value, store in PersistenceManager and send event. public void setValue(Object newValue) { if (acceptIfDifferent(newValue)) { setEditValue(newValue); setStoreValue(newValue); sendEvent(); } }- Specified by:
setStoreValue
in classField
-
getStoreValue
protected Object getStoreValue(Object defValue)
Description copied from class:Field
Get value from Store. Must be immutable or return a copy- Specified by:
getStoreValue
in classField
-
getDate
public Date getDate()
Return the current value
-
setDate
public void setDate(Date newValue)
Set value; if different from current value, store in PersistenceManager and send event.
-
-