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 ComboBoxcombo-
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.JComponentgetDeepEditComponent()JComponentgetEditComponent()return the editing JComponentprotected ObjectgetEditValue()Get current value from editComponent, will be an ArrayListprotected ObjectgetStoreValue(Object defValue)Get value from Store, will be an ArrayList or nullStringgetText()Return the current selected value as a StringbooleanisEditable()can user edit?voidsetEditable(boolean isEditable)Set whether the field is editable, default == enabledprotected voidsetEditValue(Object value)set value of editComponent, must be a Listprotected voidsetStoreValue(Object newValue)Put new value into Store, must be a Collection of StringsvoidsetText(String newValue)Set current selected value of text; send event.voidsetValue(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:
getEditComponentin classField
-
getEditValue
protected Object getEditValue()
Get current value from editComponent, will be an ArrayList- Specified by:
getEditValuein classField
-
getDeepEditComponent
public JComponent getDeepEditComponent()
- Overrides:
getDeepEditComponentin classField
-
setEditValue
protected void setEditValue(Object value)
set value of editComponent, must be a List- Specified by:
setEditValuein classField
-
getStoreValue
protected Object getStoreValue(Object defValue)
Get value from Store, will be an ArrayList or null- Specified by:
getStoreValuein classField
-
setStoreValue
protected void setStoreValue(Object newValue)
Put new value into Store, must be a Collection of Strings- Specified by:
setStoreValuein 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:
isEditablein classField
-
setEditable
public void setEditable(boolean isEditable)
Description copied from class:FieldSet whether the field is editable, default == enabled- Overrides:
setEditablein classField
-
-