Package ucar.ui.prefs
Class Field.TextCombo
- java.lang.Object
-
- ucar.ui.prefs.Field
-
- ucar.ui.prefs.Field.TextCombo
-
- Enclosing class:
- Field
public static class Field.TextCombo extends Field
A text input field which keeps track of recent choices in a combobox. The order they appear in the combobox choices reflects how recently they were chosen. NOTE: to use this, you must use a PreferencesExt.The actual stored object type is an ArrayList of Strings. The current choice is the first one in the list, use getText() to obtain it.
- See Also:
ComboBox
-
-
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 ComboBox
combo
-
Fields inherited from class ucar.ui.prefs.Field
label, listenerList, name, popupMenu, previousValue, storeData, validValue
-
-
Constructor Summary
Constructors Constructor Description TextCombo(String fldName, String label, Collection defValues, int n, 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.JComponent
getDeepEditComponent()
JComponent
getEditComponent()
return the editing JComponentprotected Object
getEditValue()
Get current value from editComponent, will be an ArrayListprotected Object
getStoreValue(Object defValue)
Get value from Store, will be an ArrayList or nullString
getText()
Return the current selected value as a Stringboolean
isEditable()
can user edit?void
setEditable(boolean isEditable)
Set whether the field is editable, default == enabledprotected void
setEditValue(Object value)
set value of editComponent, must be a Listprotected void
setStoreValue(Object newValue)
Put new value into Store, must be a Collection of Stringsvoid
setText(String newValue)
Set current selected value of text; send event.void
setValue(Object value)
Set edit value as an Object.-
Methods inherited from class ucar.ui.prefs.Field
accept, acceptIfDifferent, addPopupMenuAction, addPropertyChangeListener, addStandardPopups, addValidator, dfrac, finish, getLabel, getName, getPersistenceManager, getToolTipText, getValue, isEnabled, next, removePropertyChangeListener, restoreValue, sendEvent, setEnabled, setNewValueFromStore, setToolTipText, validate
-
-
-
-
Field Detail
-
combo
protected ComboBox combo
-
-
Constructor Detail
-
TextCombo
public TextCombo(String fldName, String label, Collection defValues, int n, PersistenceManager storeData)
Constructor.- Parameters:
fldName
- name of the field, must be unique within the store.label
- to display to the userdefValues
- list of default values to include in the comboBox. May be null. These are added to the combobox (at the end) no matter how many there are.n
- number of most recently used values to keepstoreData
- store/fetch data from here, may be null.- See Also:
PrefPanel.addTextComboField(java.lang.String, java.lang.String, java.util.Collection, int, boolean)
-
-
Method Detail
-
_validate
protected boolean _validate(StringBuffer buff)
See if edit value is valid, put error message in buff.
-
getEditComponent
public JComponent getEditComponent()
return the editing JComponent- Specified by:
getEditComponent
in classField
-
getEditValue
protected Object getEditValue()
Get current value from editComponent, will be an ArrayList- Specified by:
getEditValue
in classField
-
getDeepEditComponent
public JComponent getDeepEditComponent()
- Overrides:
getDeepEditComponent
in classField
-
setEditValue
protected void setEditValue(Object value)
set value of editComponent, must be a List- Specified by:
setEditValue
in classField
-
getStoreValue
protected Object getStoreValue(Object defValue)
Get value from Store, will be an ArrayList or null- Specified by:
getStoreValue
in classField
-
setStoreValue
protected void setStoreValue(Object newValue)
Put new value into Store, must be a Collection of Strings- Specified by:
setStoreValue
in classField
-
getText
public String getText()
Return the current selected value as a String
-
setText
public void setText(String newValue)
Set current selected value of text; send event.
-
setValue
public void setValue(Object value)
Set edit value as an Object.
-
isEditable
public boolean isEditable()
can user edit?- 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
-
-