Package ucar.ui.prefs
Class Field.Text
- java.lang.Object
-
- ucar.ui.prefs.Field
-
- ucar.ui.prefs.Field.Text
-
- Direct Known Subclasses:
Field.Password,Field.TextArea
- Enclosing class:
- Field
public static class Field.Text extends Field
String input field.
-
-
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 JTextComponenttf-
Fields inherited from class ucar.ui.prefs.Field
label, listenerList, name, popupMenu, previousValue, storeData, validValue
-
-
Constructor Summary
Constructors Modifier Constructor Description Text(String name, String label, String defValue, PersistenceManager storeData)Constructor.protectedText(String name, String label, PersistenceManager storeData)Constructor for subclasses.
-
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.JComponentgetEditComponent()Return the editing JComponentprotected ObjectgetEditValue()Get current value from editComponentprotected ObjectgetStoreValue(Object defValue)Get value from Store, if it exists, else return default value.StringgetText()Return the current accepted valuebooleanisEditable()Can the user edit this field.protected Stringnormalize(String s)voidsetEditable(boolean isEditable)Set whether the field is editable, default == enabledprotected voidsetEditValue(Object value)Set current value of editComponentprotected voidsetStoreValue(Object value)Put new value into Store.voidsetText(String newValue)Set value of text; 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 JTextComponent tf
-
-
Constructor Detail
-
Text
protected Text(String name, String label, PersistenceManager storeData)
Constructor for subclasses.- Parameters:
name- of the field; must be unique within the storelabel- to display to the userstoreData- store/fetch data from here, may be null.
-
Text
public Text(String name, String label, String defValue, PersistenceManager storeData)
Constructor.- Parameters:
name- of the field; must be unique within the storelabel- to display to the userdefValue- defau;lt value to start with.storeData- store/fetch data from here, may be null.- See Also:
PrefPanel.addTextField(java.lang.String, java.lang.String, java.lang.String)
-
-
Method Detail
-
getEditComponent
public JComponent getEditComponent()
Description copied from class:FieldReturn the editing JComponent- Specified by:
getEditComponentin classField
-
isEditable
public boolean isEditable()
Can the user edit this field.- Overrides:
isEditablein classField
-
setEditable
public void setEditable(boolean isEditable)
Description copied from class:FieldSet whether the field is editable, default == enabled- Overrides:
setEditablein 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:FieldGet current value from editComponent- Specified by:
getEditValuein classField
-
setEditValue
protected void setEditValue(Object value)
Description copied from class:FieldSet current value of editComponent- Specified by:
setEditValuein classField
-
setStoreValue
protected void setStoreValue(Object value)
Description copied from class:FieldPut new value into Store. Must be immutable or make a copy- Specified by:
setStoreValuein classField
-
getStoreValue
protected Object getStoreValue(Object defValue)
Get value from Store, if it exists, else return default value.- Specified by:
getStoreValuein classField- Parameters:
defValue- default value- Returns:
- stored value, or defValue if no store or value not in store
-
getText
public String getText()
Return the current accepted value
-
setText
public void setText(String newValue)
Set value of text; if different from current value, store in PersistenceManager and send event.
-
-