Package org.csstudio.ui.util.widgets
Class MultipleSelectionCombo<T>
java.lang.Object
org.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Control
org.eclipse.swt.widgets.Scrollable
org.eclipse.swt.widgets.Composite
org.csstudio.ui.util.widgets.MultipleSelectionCombo<T>
- All Implemented Interfaces:
Drawable
Combo-type widget that allows selecting multiple items.
Takes a list of Object
s as input.
The toString()
of each Object is displayed in a drop-down list. Overriding the stringRepresention()
method, the user can define an alternative way to convert T to String.
One or more items can be selected, they're also displayed in the text field.
Items can be entered in the text field, comma-separated. If entered text does not match a valid item, text is highlighted and tool-tip indicates error.
Keyboard support: 'Down' key in text field opens drop-down. Inside drop-down, single item can be selected via cursor key and 'RETURN' closes the drop-down. TODO Auto-completion while typing?
-
Field Summary
Fields inherited from class org.eclipse.swt.widgets.Composite
embeddedHandle
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Register a PropertyChangeListener on this widget. the listener will be notified when the items or the selection is changed.getItems()
Get the list of itemsget the list of items currently selected.void
remove the PropertyChangeListnervoid
setForeground
(Color color) void
Define items to be displayed in the list, and returned as the current selection when selected.void
setSelection
(String selection) set the items to be selected, the selection is specified as a string with values separated by MultipleSelectionCombo.SEPARATORvoid
setSelection
(String[] selections) Set the items to be selectedvoid
setSelection
(List<T> selection) Set items that should be selected.void
setToolTipText
(String tooltip) stringRepresention
(T object) Override this method to define the how the object should be represented as a string.Methods inherited from class org.eclipse.swt.widgets.Composite
changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList, toString
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar, setScrollbarsMode
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isAutoScalable, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackground, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFont, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, addTypedListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, getTypedListeners, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, removeTypedListener, reskin, setData, setData
-
Constructor Details
-
MultipleSelectionCombo
-
-
Method Details
-
setForeground
- Overrides:
setForeground
in classControl
-
setToolTipText
- Overrides:
setToolTipText
in classControl
-
setItems
Define items to be displayed in the list, and returned as the current selection when selected. -
getItems
Get the list of items- Returns:
- list of selectable items
-
setSelection
Set items that should be selected.Selected items must be on the list of items provided via
setItems
-
setSelection
set the items to be selected, the selection is specified as a string with values separated by MultipleSelectionCombo.SEPARATOR- Parameters:
selection
- Items to select in the list as comma-separated string
-
setSelection
Set the items to be selected -
getSelection
get the list of items currently selected. Note: this does not return the list in the order of selection.- Returns:
- the list of selected items
-
addPropertyChangeListener
Register a PropertyChangeListener on this widget. the listener will be notified when the items or the selection is changed.- Parameters:
listener
-
-
removePropertyChangeListener
remove the PropertyChangeListner- Parameters:
listener
-
-
stringRepresention
Override this method to define the how the object should be represented as a string.- Parameters:
object
-- Returns:
- the string representation of the object
-