org.csstudio.ui.util.helpers
Class ComboHistoryHelper

java.lang.Object
  extended by org.csstudio.ui.util.helpers.ComboHistoryHelper

public abstract class ComboHistoryHelper
extends java.lang.Object

Decorates a Combo box to maintain the history.

Newly entered items are added to the top of the combo list, dropping last items off the list when reaching a configurable maximum list size. If an item is selected/entered again, it will pop at the beginning of the list (so that continuously used items are not lost).

You must

Author:
Kay Kasemir, Gabriele Carcassi
See Also:
newSelection(String)

Constructor Summary
ComboHistoryHelper(IDialogSettings settings, java.lang.String tag, Combo combo)
          Attach helper to given combo box, using max list length.
ComboHistoryHelper(IDialogSettings settings, java.lang.String tag, Combo combo, int max, boolean saveOnDispose)
          Attach helper to given combo box, using max list length.
 
Method Summary
 void addEntry(java.lang.String newEntry)
          Adds a new entry to the list.
 void changeSelection(java.lang.String entry)
           
 void loadSettings()
          Load persisted list values.
abstract  void newSelection(java.lang.String entry)
          Invoked whenever a new entry was entered or selected.
 void saveSettings()
          Save list values to persistent storage.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComboHistoryHelper

public ComboHistoryHelper(IDialogSettings settings,
                          java.lang.String tag,
                          Combo combo)
Attach helper to given combo box, using max list length.

Parameters:
settings - where to persist the combo box list
tag - tag used for persistence
combo - the combo box

ComboHistoryHelper

public ComboHistoryHelper(IDialogSettings settings,
                          java.lang.String tag,
                          Combo combo,
                          int max,
                          boolean saveOnDispose)
Attach helper to given combo box, using max list length.

Parameters:
settings - where to persist the combo box list
tag - tag used for persistence
combo - the combo box
max - number of elements to keep in history
saveOnDispose - whether current values should be saved at widget disposal
Method Detail

changeSelection

public void changeSelection(java.lang.String entry)

addEntry

public void addEntry(java.lang.String newEntry)
Adds a new entry to the list. If entry already there, do nothing.

Parameters:
newEntry - the new value

newSelection

public abstract void newSelection(java.lang.String entry)
Invoked whenever a new entry was entered or selected.


loadSettings

public void loadSettings()
Load persisted list values.


saveSettings

public void saveSettings()
Save list values to persistent storage.