Class MultiChoice<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.eclipse.nebula.widgets.opal.multichoice.MultiChoice<T>
-
- Type Parameters:
T
- Class of objects represented by this widget
- All Implemented Interfaces:
org.eclipse.swt.graphics.Drawable
public class MultiChoice<T> extends org.eclipse.swt.widgets.Composite
The MultiChoice class represents a selectable user interface object that combines a read-only text-field and a set of checkboxes.Note that although this class is a subclass of
Composite
, it does not make sense to add children to it, or set a layout on it.- Styles:
- NONE
- Events:
- Selection
-
-
Field Summary
Fields Modifier and Type Field Description private org.eclipse.swt.widgets.Button
arrow
private org.eclipse.swt.graphics.Color
background
private java.util.List<org.eclipse.swt.widgets.Button>
checkboxes
private java.util.List<T>
elements
private org.eclipse.swt.widgets.Listener
filter
private org.eclipse.swt.graphics.Font
font
private org.eclipse.swt.graphics.Color
foreground
private boolean
hasFocus
private MultiChoiceLabelProvider
labelProvider
private T
lastModified
private org.eclipse.swt.widgets.Listener
listener
private int
numberOfColumns
private org.eclipse.swt.widgets.Shell
popup
private int
preferredHeightOfPopup
private org.eclipse.swt.custom.ScrolledComposite
scrolledComposite
private java.util.Set<T>
selection
private MultiChoiceSelectionListener<T>
selectionListener
private java.lang.String
separator
private org.eclipse.swt.widgets.Text
text
-
Constructor Summary
Constructors Constructor Description MultiChoice(org.eclipse.swt.widgets.Composite parent, int style)
Constructs a new instance of this class given its parent.MultiChoice(org.eclipse.swt.widgets.Composite parent, int style, java.util.List<T> elements)
Constructs a new instance of this class given its parent.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(T value)
Adds the argument to the end of the receiver's list.void
add(T value, int index)
Adds the argument to the receiver's list at the given zero-relative index.void
addAll(java.util.List<T> values)
Adds the argument to the end of the receiver's list.void
addAll(T[] values)
Adds the argument to the end of the receiver's list.private void
addListeners()
private void
changeVisibilityOfPopupWindow(boolean show)
Display/Hide the popup windowprivate void
checkNullElement()
Check if the elements attributes is not nullprivate void
checkRange(int index)
org.eclipse.swt.graphics.Point
computeSize(int wHint, int hHint, boolean changed)
private T
convertEntry(java.lang.String elementToValidate)
private void
createGlobalListener()
private void
createPopup()
Create the popup that contains all checkboxesvoid
deselect(T value)
Deselects the item in the receiver's list.void
deselectAll()
Deselects all items in the receiver's list.void
deselectAt(int index)
Deselects the item at the given zero-relative index in the receiver's list.org.eclipse.swt.graphics.Color
getBackground()
boolean
getEditable()
Returns the editable state.org.eclipse.swt.graphics.Font
getFont()
org.eclipse.swt.graphics.Color
getForeground()
T
getItem(int index)
Returns the item at the given, zero-relative index in the receiver's list.int
getItemCount()
Returns the number of items contained in the receiver's list.java.util.List<T>
getItems()
Returns the list of items in the receiver's list.(package private) T
getLastModified()
int
getNumberOfColumns()
(package private) org.eclipse.swt.widgets.Shell
getPopup()
int[]
getSelectedIndex()
Returns the zero-relative indices of the items which are currently selected in the receiver.java.util.List<T>
getSelection()
Returns an array ofObject
s that are currently selected in the receiver.org.eclipse.swt.events.SelectionListener
getSelectionListener()
java.lang.String
getSeparator()
java.lang.String
getText()
private void
handleButtonEvent(org.eclipse.swt.widgets.Event event)
Handle a button eventprivate void
handleFocusEvents(int type)
Handle a focus eventprivate void
handleMultiChoiceEvents(org.eclipse.swt.widgets.Event event)
Handle a multichoice eventprivate void
handlePopupEvent(org.eclipse.swt.widgets.Event event)
Handle a popup eventprivate boolean
isDropped()
void
refresh()
Refresh the widget (after the add of a new element for example)void
remove(T object)
Searches the receiver's list starting at the first item until an item is found that is equal to the argument, and removes that item from the list.void
removeAll()
Remove all items of the receivervoid
removeAt(int index)
Removes the item from the receiver's list at the given zero-relative index.void
select(T value)
Selects an item the receiver's list.void
selectAll()
Selects all selected items in the receiver's list.void
selectAt(int index)
Selects the item at the given zero-relative index in the receiver's list.void
setBackground(org.eclipse.swt.graphics.Color background)
void
setEditable(boolean editable)
Sets the editable state.void
setEnabled(boolean enabled)
void
setFont(org.eclipse.swt.graphics.Font font)
void
setForeground(org.eclipse.swt.graphics.Color foreground)
private void
setLabel()
Set the value of the label, based on the selected itemsvoid
setLabelProvider(MultiChoiceLabelProvider labelProvider)
void
setNumberOfColumns(int numberOfColumns)
void
setSelectedIndex(int[] index)
Selects items in the receiver.void
setSelection(java.util.Set<T> selection)
Sets the selection of the receiver.void
setSelectionListener(MultiChoiceSelectionListener<T> selectionListener)
void
setSeparator(java.lang.String separator)
void
setText(java.lang.String textValue)
Fill the text box.void
setToolTipText(java.lang.String txt)
void
updateSelection()
Update the selectionprotected void
validateEntry()
-
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
-
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar
-
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, 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, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, 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, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString
-
-
-
-
Field Detail
-
text
private org.eclipse.swt.widgets.Text text
-
arrow
private org.eclipse.swt.widgets.Button arrow
-
popup
private org.eclipse.swt.widgets.Shell popup
-
scrolledComposite
private org.eclipse.swt.custom.ScrolledComposite scrolledComposite
-
listener
private org.eclipse.swt.widgets.Listener listener
-
filter
private org.eclipse.swt.widgets.Listener filter
-
numberOfColumns
private int numberOfColumns
-
elements
private java.util.List<T> elements
-
selection
private java.util.Set<T> selection
-
checkboxes
private java.util.List<org.eclipse.swt.widgets.Button> checkboxes
-
hasFocus
private boolean hasFocus
-
selectionListener
private MultiChoiceSelectionListener<T> selectionListener
-
lastModified
private T lastModified
-
foreground
private org.eclipse.swt.graphics.Color foreground
-
background
private org.eclipse.swt.graphics.Color background
-
font
private org.eclipse.swt.graphics.Font font
-
separator
private java.lang.String separator
-
labelProvider
private MultiChoiceLabelProvider labelProvider
-
preferredHeightOfPopup
private int preferredHeightOfPopup
-
-
Constructor Detail
-
MultiChoice
public MultiChoice(org.eclipse.swt.widgets.Composite parent, int style)
Constructs a new instance of this class given its parent.- Parameters:
parent
- a widget which will be the parent of the new instance (cannot be null)style
- not used- Throws:
java.lang.IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the parent is null
org.eclipse.swt.SWTException
-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
-
MultiChoice
public MultiChoice(org.eclipse.swt.widgets.Composite parent, int style, java.util.List<T> elements)
Constructs a new instance of this class given its parent.- Parameters:
parent
- a widget which will be the parent of the new instance (cannot be null)style
- not usedelements
- list of elements displayed by this widget- Throws:
java.lang.IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the parent is null
org.eclipse.swt.SWTException
-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
-
-
Method Detail
-
createGlobalListener
private void createGlobalListener()
-
addListeners
private void addListeners()
-
validateEntry
protected void validateEntry()
-
convertEntry
private T convertEntry(java.lang.String elementToValidate)
-
add
public void add(T value)
Adds the argument to the end of the receiver's list.- Parameters:
values
- new item- Throws:
java.lang.IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the string is null
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
add
public void add(T value, int index)
Adds the argument to the receiver's list at the given zero-relative index.- Parameters:
values
- new itemindex
- the index for the item- Throws:
java.lang.IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the string is null
- ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
addAll
public void addAll(java.util.List<T> values)
Adds the argument to the end of the receiver's list.- Parameters:
values
- new items- Throws:
java.lang.IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the string is null
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
addAll
public void addAll(T[] values)
Adds the argument to the end of the receiver's list.- Parameters:
values
- new items- Throws:
java.lang.IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the string is null
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getEditable
public boolean getEditable()
Returns the editable state.- Returns:
- whether or not the receiver is editable
- Throws:
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getItem
public T getItem(int index)
Returns the item at the given, zero-relative index in the receiver's list. Throws an exception if the index is out of range.- Parameters:
index
- the index of the item to return- Returns:
- the item at the given index
- Throws:
java.lang.NullPointerException
- if there is no item in the receiverjava.lang.IllegalArgumentException
-- ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getItemCount
public int getItemCount()
Returns the number of items contained in the receiver's list.- Returns:
- the number of items
- Throws:
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getItems
public java.util.List<T> getItems()
Returns the list of items in the receiver's list.Note: This is not the actual structure used by the receiver to maintain its list of items, so modifying the array will not affect the receiver.
- Returns:
- the items in the receiver's list
- Throws:
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
removeAt
public void removeAt(int index)
Removes the item from the receiver's list at the given zero-relative index.- Parameters:
index
- the index for the item- Throws:
java.lang.NullPointerException
- if there is no item in the receiverjava.lang.IllegalArgumentException
-- ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
remove
public void remove(T object)
Searches the receiver's list starting at the first item until an item is found that is equal to the argument, and removes that item from the list.- Parameters:
object
- the item to remove- Throws:
java.lang.NullPointerException
- if there is no item in the receiverjava.lang.IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the object is null
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
removeAll
public void removeAll()
Remove all items of the receiver- Throws:
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setLabelProvider
public void setLabelProvider(MultiChoiceLabelProvider labelProvider)
- Parameters:
labelProvider
- the Label Provider to set
-
setSelection
public void setSelection(java.util.Set<T> selection)
Sets the selection of the receiver. If the item was already selected, it remains selected.- Parameters:
selection
- the new selection- Throws:
java.lang.NullPointerException
- if there is no item in the receiverjava.lang.IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the selection is null
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
selectAll
public void selectAll()
Selects all selected items in the receiver's list.- Throws:
java.lang.NullPointerException
- if there is no item in the receiverorg.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
selectAt
public void selectAt(int index)
Selects the item at the given zero-relative index in the receiver's list. If the item at the index was already selected, it remains selected.- Parameters:
index
- the index of the item to select- Throws:
java.lang.NullPointerException
- if there is no item in the receiverjava.lang.IllegalArgumentException
-- ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
select
public void select(T value)
Selects an item the receiver's list. If the item was already selected, it remains selected.- Parameters:
index
- the index of the item to select- Throws:
java.lang.NullPointerException
- if there is no item in the receiverjava.lang.IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the selection is null
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setSelectedIndex
public void setSelectedIndex(int[] index)
Selects items in the receiver. If the items were already selected, they remain selected.- Parameters:
index
- the indexes of the items to select- Throws:
java.lang.NullPointerException
- if there is no item in the receiverjava.lang.IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the selection is null
- ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getSelectedIndex
public int[] getSelectedIndex()
Returns the zero-relative indices of the items which are currently selected in the receiver. The order of the indices is unspecified. The array is empty if no items are selected.Note: This is not the actual structure used by the receiver to maintain its selection, so modifying the array will not affect the receiver.
- Returns:
- the array of indices of the selected items
- Throws:
java.lang.NullPointerException
- if there is no item in the receiverorg.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getSelection
public java.util.List<T> getSelection()
Returns an array ofObject
s that are currently selected in the receiver. The order of the items is unspecified. An empty array indicates that no items are selected.Note: This is not the actual structure used by the receiver to maintain its selection, so modifying the array will not affect the receiver.
- Returns:
- an array representing the selection
- Throws:
java.lang.NullPointerException
- if there is no item in the receiverorg.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
deselectAt
public void deselectAt(int index)
Deselects the item at the given zero-relative index in the receiver's list. If the item at the index was already deselected, it remains deselected. Indices that are out of range are ignored.- Parameters:
index
- the index of the item to deselect- Throws:
java.lang.NullPointerException
- if there is no item in the receiverjava.lang.IllegalArgumentException
-- ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
deselect
public void deselect(T value)
Deselects the item in the receiver's list. If the item at the index was already deselected, it remains deselected.- Parameters:
value
- the item to deselect- Throws:
java.lang.NullPointerException
- if there is no item in the receiverjava.lang.IllegalArgumentException
-- ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
deselectAll
public void deselectAll()
Deselects all items in the receiver's list.- Parameters:
value
- the item to deselect- Throws:
java.lang.NullPointerException
- if there is no item in the receiverorg.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getNumberOfColumns
public int getNumberOfColumns()
- Returns:
- the number of columns
-
setNumberOfColumns
public void setNumberOfColumns(int numberOfColumns)
- Parameters:
numberOfColumns
- the number of columns
-
getSeparator
public java.lang.String getSeparator()
- Returns:
- the separator used in the text field. Default value is ","
-
setSeparator
public void setSeparator(java.lang.String separator)
- Parameters:
separator
- the new value of the separator
-
getForeground
public org.eclipse.swt.graphics.Color getForeground()
- Overrides:
getForeground
in classorg.eclipse.swt.widgets.Control
- See Also:
Control.getForeground()
-
setForeground
public void setForeground(org.eclipse.swt.graphics.Color foreground)
- Overrides:
setForeground
in classorg.eclipse.swt.widgets.Control
- See Also:
Control.setForeground(org.eclipse.swt.graphics.Color)
-
getBackground
public org.eclipse.swt.graphics.Color getBackground()
- Overrides:
getBackground
in classorg.eclipse.swt.widgets.Control
- See Also:
Control.getBackground()
-
setBackground
public void setBackground(org.eclipse.swt.graphics.Color background)
- Overrides:
setBackground
in classorg.eclipse.swt.widgets.Control
- See Also:
Control.setBackground(org.eclipse.swt.graphics.Color)
-
getFont
public org.eclipse.swt.graphics.Font getFont()
- Overrides:
getFont
in classorg.eclipse.swt.widgets.Control
- See Also:
Control.getFont()
-
setFont
public void setFont(org.eclipse.swt.graphics.Font font)
- Overrides:
setFont
in classorg.eclipse.swt.widgets.Control
- See Also:
Control.setFont(org.eclipse.swt.graphics.Font)
-
refresh
public void refresh()
Refresh the widget (after the add of a new element for example)
-
computeSize
public org.eclipse.swt.graphics.Point computeSize(int wHint, int hHint, boolean changed)
- Overrides:
computeSize
in classorg.eclipse.swt.widgets.Control
- See Also:
Control.computeSize(int, int, boolean)
-
setEnabled
public void setEnabled(boolean enabled)
- Overrides:
setEnabled
in classorg.eclipse.swt.widgets.Control
- See Also:
Control.setEnabled(boolean)
-
setEditable
public void setEditable(boolean editable)
Sets the editable state.- Parameters:
editable
- the new editable state- Throws:
org.eclipse.swt.SWTException
-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setToolTipText
public void setToolTipText(java.lang.String txt)
- Overrides:
setToolTipText
in classorg.eclipse.swt.widgets.Control
- See Also:
Control.setToolTipText(java.lang.String)
-
getSelectionListener
public org.eclipse.swt.events.SelectionListener getSelectionListener()
- Returns:
- the selection listener
-
setSelectionListener
public void setSelectionListener(MultiChoiceSelectionListener<T> selectionListener)
- Parameters:
selectionListener
- the new selection listener
-
updateSelection
public void updateSelection()
Update the selection
-
getLastModified
T getLastModified()
- Returns:
- the last modified item
-
getPopup
org.eclipse.swt.widgets.Shell getPopup()
- Returns:
- the popup
-
createPopup
private void createPopup()
Create the popup that contains all checkboxes
-
setLabel
private void setLabel()
Set the value of the label, based on the selected items
-
handleFocusEvents
private void handleFocusEvents(int type)
Handle a focus event- Parameters:
type
- type of the event to handle
-
handleMultiChoiceEvents
private void handleMultiChoiceEvents(org.eclipse.swt.widgets.Event event)
Handle a multichoice event- Parameters:
event
- event to handle
-
handleButtonEvent
private void handleButtonEvent(org.eclipse.swt.widgets.Event event)
Handle a button event- Parameters:
event
- event to hangle
-
isDropped
private boolean isDropped()
- Returns:
true
if the popup is visible and not dropped,false
otherwise
-
handlePopupEvent
private void handlePopupEvent(org.eclipse.swt.widgets.Event event)
Handle a popup event- Parameters:
event
- event to handle
-
changeVisibilityOfPopupWindow
private void changeVisibilityOfPopupWindow(boolean show)
Display/Hide the popup window- Parameters:
show
- iftrue
, displays the popup window. Iffalse
, hide the popup window
-
checkNullElement
private void checkNullElement()
Check if the elements attributes is not null- Throws:
java.lang.NullPointerException
- if there is no item in the receiver
-
checkRange
private void checkRange(int index) throws java.lang.NullPointerException
- Parameters:
index
-- Throws:
java.lang.NullPointerException
java.lang.IllegalArgumentException
-
setText
public void setText(java.lang.String textValue)
Fill the text box. Please notice that the setted element MAY not be in the items list.
For instance, your widget contains a list of european countries. If you use setText("USA"), the text will display "USA", butgetSelection()
will return and empty text. To retrieve "USA", you have to use the method getText();- Parameters:
textValue
- new text value
-
getText
public java.lang.String getText()
- Returns:
- the display value as text
-
-