Class DualList
- 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.duallist.DualList
-
- All Implemented Interfaces:
org.eclipse.swt.graphics.Drawable
public class DualList extends org.eclipse.swt.widgets.Composite
Instances of this class are controls that allow the user to select multiple elements.- Styles:
- (none)
- Events:
- Selection
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
ARROW_DOWN_IMAGE
private static java.lang.String
ARROW_LEFT_IMAGE
private static java.lang.String
ARROW_RIGHT_IMAGE
private static java.lang.String
ARROW_UP_IMAGE
private static java.lang.String
DOUBLE_DOWN_IMAGE
private static java.lang.String
DOUBLE_LEFT_IMAGE
private static java.lang.String
DOUBLE_RIGHT_IMAGE
private static java.lang.String
DOUBLE_UP_IMAGE
private java.util.List<DLItem>
items
private org.eclipse.swt.widgets.Table
itemsTable
private java.util.List<DLItem>
selection
private java.util.List<SelectionChangeListener>
selectionChangeListeners
private java.util.List<org.eclipse.swt.events.SelectionListener>
selectionListeners
private org.eclipse.swt.widgets.Table
selectionTable
-
Constructor Summary
Constructors Constructor Description DualList(org.eclipse.swt.widgets.Composite parent, int style)
Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(DLItem item)
Adds the argument to the end of the receiver's list.void
add(DLItem item, int index)
Adds the argument to the receiver's list at the given zero-relative index.void
addSelectionChangeListener(SelectionChangeListener listener)
Adds the listener to the collection of listeners who will be notified when the user changes the receiver's selection, by sending it one of the messages defined in theSelectionChangeListener
interface.void
addSelectionListener(org.eclipse.swt.events.SelectionListener listener)
Adds the listener to the collection of listeners who will be notified when the user changes the receiver's selection, by sending it one of the messages defined in theSelectionListener
interface.private void
clean(org.eclipse.swt.widgets.Table table)
Cleans the content of a tableprivate org.eclipse.swt.widgets.Button
createButton(java.lang.String fileName, boolean verticalExpand, int alignment)
Create a buttonprivate void
createButtonDeselect()
private void
createButtonDeselectAll()
private void
createButtonMoveDown()
private void
createButtonMoveFirst()
private void
createButtonMoveLast()
private void
createButtonMoveUp()
private void
createButtonSelect()
private void
createButtonSelectAll()
private void
createItemsTable()
private void
createSelectionTable()
private org.eclipse.swt.widgets.Table
createTable()
void
deselect(int index)
Deselects the item at the given zero-relative index in the receiver.void
deselect(int[] indices)
Deselects the items at the given zero-relative indices in the receiver.private void
deselect(int[] indices, boolean shouldFireEvents)
Deselects the items at the given zero-relative indices in the receiver.private void
deselect(int index, boolean shouldFireEvents)
Deselects the item at the given zero-relative index in the receiver.void
deselect(int start, int end)
Deselects the items at the given zero-relative indices in the receiver.private void
deselect(int start, int end, boolean shouldFireEvents)
void
deselectAll()
Deselects all selected items in the receiver.void
deselectAll(boolean shouldFireEvents)
Deselects all selected items in the receiver.void
deselectAllDoNotFireEvent()
Deselects all selected items in the receiver.void
deselectDoNotFireEvent(int index)
Deselects the item at the given zero-relative index in the receiver.void
deselectDoNotFireEvent(int[] indices)
Deselects the items at the given zero-relative indices in the receiver.void
deselectDoNotFireEvent(int start, int end)
Deselects the items at the given zero-relative indices in the receiver.protected void
deselectItem()
Deselect a given itemprivate void
fillData(org.eclipse.swt.widgets.Table table, java.util.List<DLItem> listOfData)
Fill a table with dataprivate void
fireSelectionChangeEvent(java.util.List<DLItem> items)
private void
fireSelectionEvent(DLItem item)
Call all selection listenersDLItem
getItem(int index)
Returns the item at the given, zero-relative index in the receiver.int
getItemCount()
Returns the number of items contained in the receiver.DLItem[]
getItems()
Returns a (possibly empty) array ofDLItem
s which are the items in the receiver.java.util.List<DLItem>
getItemsAsList()
Returns a (possibly empty) list ofDLItem
s which are the items in the receiver.DLItem[]
getSelection()
Returns an array ofDLItem
s that are currently selected in the receiver.java.util.List<DLItem>
getSelectionAsList()
Returns a list ofDLItem
s that are currently selected in the receiver.int
getSelectionCount()
Returns the number of selected items contained in the receiver.private boolean
itemsContainImage()
protected void
moveDownItem()
Move the selected item downprotected void
moveSelectionToFirstPosition()
Move the selected item to the first positionprotected void
moveSelectionToLastPosition()
Move the selected item to the last positionprotected void
moveUpItem()
Move the selected item upprivate void
redrawTable(org.eclipse.swt.widgets.Table table, boolean isSelected)
Redraw a given tableprivate void
redrawTables()
Redraws all tables that compose this widgetvoid
remove(int index)
Removes the item from the receiver at the given zero-relative index.void
remove(int[] indices)
Removes the items from the receiver at the given zero-relative indices.void
remove(int start, int end)
Removes the items from the receiver which are between the given zero-relative start and end indices (inclusive).void
remove(DLItem item)
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()
Removes all of the items from the receiver.void
removeSelectionChangeListener(SelectionChangeListener listener)
Removes the listener from the collection of listeners who will be notified when the user changes the receiver's selection.void
removeSelectionListener(org.eclipse.swt.events.SelectionListener listener)
Removes the listener from the collection of listeners who will be notified when the user changes the receiver's selection.void
select(int index)
Selects the item at the given zero-relative index in the receiver's list.void
select(int[] indices)
Selects the items at the given zero-relative indices in the receiver.private void
select(int[] indices, boolean shouldFireEvents)
private void
select(int index, boolean shouldFireEvents)
void
select(int start, int end)
Selects the items in the range specified by the given zero-relative indices in the receiver.private void
select(int start, int end, boolean shouldFireEvents)
void
selectAll()
Selects all of the items in the receiver.private void
selectAll(boolean shouldFireEvents)
void
selectAllDoNotFireEvent()
Selects all of the items in the receiver.void
selectDoNotFireEvent(int index)
Selects the item at the given zero-relative index in the receiver's list.void
selectDoNotFireEvent(int[] indices)
Selects the items at the given zero-relative indices in the receiver.void
selectDoNotFireEvent(int start, int end)
Selects the items in the range specified by the given zero-relative indices in the receiver.protected void
selectItem()
Select a given itemvoid
setBounds(int x, int y, int width, int height)
void
setItem(int index, DLItem item)
Sets the item in the receiver's list at the given zero-relative index to the item argument.void
setItems(java.util.List<DLItem> items)
Sets the receiver's items to be the given list of items.void
setItems(DLItem[] items)
Sets the receiver's items to be the given array of items.private void
swap(int first, int second)
Swap 2 items-
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, 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, setCapture, setCursor, setDragDetect, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, 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
-
DOUBLE_DOWN_IMAGE
private static final java.lang.String DOUBLE_DOWN_IMAGE
- See Also:
- Constant Field Values
-
DOUBLE_UP_IMAGE
private static final java.lang.String DOUBLE_UP_IMAGE
- See Also:
- Constant Field Values
-
DOUBLE_LEFT_IMAGE
private static final java.lang.String DOUBLE_LEFT_IMAGE
- See Also:
- Constant Field Values
-
DOUBLE_RIGHT_IMAGE
private static final java.lang.String DOUBLE_RIGHT_IMAGE
- See Also:
- Constant Field Values
-
ARROW_DOWN_IMAGE
private static final java.lang.String ARROW_DOWN_IMAGE
- See Also:
- Constant Field Values
-
ARROW_LEFT_IMAGE
private static final java.lang.String ARROW_LEFT_IMAGE
- See Also:
- Constant Field Values
-
ARROW_UP_IMAGE
private static final java.lang.String ARROW_UP_IMAGE
- See Also:
- Constant Field Values
-
ARROW_RIGHT_IMAGE
private static final java.lang.String ARROW_RIGHT_IMAGE
- See Also:
- Constant Field Values
-
items
private final java.util.List<DLItem> items
-
selection
private final java.util.List<DLItem> selection
-
itemsTable
private org.eclipse.swt.widgets.Table itemsTable
-
selectionTable
private org.eclipse.swt.widgets.Table selectionTable
-
selectionListeners
private java.util.List<org.eclipse.swt.events.SelectionListener> selectionListeners
-
selectionChangeListeners
private java.util.List<SelectionChangeListener> selectionChangeListeners
-
-
Constructor Detail
-
DualList
public DualList(org.eclipse.swt.widgets.Composite parent, int style)
Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.The style value is either one of the style constants defined in class
SWT
which is applicable to instances of this class, or must be built by bitwise OR'ing together (that is, using theint
"|" operator) two or more of thoseSWT
style constants. The class description lists the style constants that are applicable to the class. Style bits are also inherited from superclasses.- Parameters:
parent
- a composite control which will be the parent of the new instance (cannot be null)style
- the style of control to construct- 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
-
createItemsTable
private void createItemsTable()
-
createTable
private org.eclipse.swt.widgets.Table createTable()
- Returns:
- a table that will contain data
-
createButtonSelectAll
private void createButtonSelectAll()
-
createSelectionTable
private void createSelectionTable()
-
createButtonMoveFirst
private void createButtonMoveFirst()
-
createButtonSelect
private void createButtonSelect()
-
createButtonMoveUp
private void createButtonMoveUp()
-
createButtonDeselect
private void createButtonDeselect()
-
createButtonMoveDown
private void createButtonMoveDown()
-
createButtonDeselectAll
private void createButtonDeselectAll()
-
createButtonMoveLast
private void createButtonMoveLast()
-
createButton
private org.eclipse.swt.widgets.Button createButton(java.lang.String fileName, boolean verticalExpand, int alignment)
Create a button- Parameters:
fileName
- file name of the iconverticalExpand
- iftrue
, the button will take all the available space verticallyalignment
- button alignment- Returns:
- a new button
-
add
public void add(DLItem item)
Adds the argument to the end of the receiver's list.- Parameters:
item
- the new item- Throws:
java.lang.IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the item 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
- See Also:
add(DLItem,int)
-
add
public void add(DLItem item, int index)
Adds the argument to the receiver's list at the given zero-relative index.Note: To add an item at the end of the list, use the result of calling
getItemCount()
as the index or useadd(DLItem)
.- Parameters:
item
- the new itemindex
- the index for the item- Throws:
java.lang.IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the item is null
- ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list (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
- See Also:
#add(String)
-
addSelectionListener
public void addSelectionListener(org.eclipse.swt.events.SelectionListener listener)
Adds the listener to the collection of listeners who will be notified when the user changes the receiver's selection, by sending it one of the messages defined in theSelectionListener
interface.- Parameters:
listener
- the listener which should be notified- Throws:
java.lang.IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the listener 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
- See Also:
SelectionListener
,removeSelectionListener(org.eclipse.swt.events.SelectionListener)
,SelectionEvent
-
removeSelectionListener
public void removeSelectionListener(org.eclipse.swt.events.SelectionListener listener)
Removes the listener from the collection of listeners who will be notified when the user changes the receiver's selection.- Parameters:
listener
- the listener which should no longer be notified- Throws:
java.lang.IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the listener 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
- See Also:
SelectionListener
,addSelectionListener(org.eclipse.swt.events.SelectionListener)
-
addSelectionChangeListener
public void addSelectionChangeListener(SelectionChangeListener listener)
Adds the listener to the collection of listeners who will be notified when the user changes the receiver's selection, by sending it one of the messages defined in theSelectionChangeListener
interface.- Parameters:
listener
- the listener which should be notified- Throws:
java.lang.IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the listener 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
- See Also:
SelectionChangeListener
,removeSelectionChangeListener(org.eclipse.nebula.widgets.opal.duallist.SelectionChangeListener)
,SelectionChangeEvent
-
removeSelectionChangeListener
public void removeSelectionChangeListener(SelectionChangeListener listener)
Removes the listener from the collection of listeners who will be notified when the user changes the receiver's selection.- Parameters:
listener
- the listener which should no longer be notified- Throws:
java.lang.IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the listener 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
- See Also:
SelectionChangeListener
,addSelectionChangeListener(org.eclipse.nebula.widgets.opal.duallist.SelectionChangeListener)
-
deselect
public void deselect(int index)
Deselects the item at the given zero-relative index in the receiver. 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:
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
-
deselectDoNotFireEvent
public void deselectDoNotFireEvent(int index)
Deselects the item at the given zero-relative index in the receiver. 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:
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
private void deselect(int index, boolean shouldFireEvents)
Deselects the item at the given zero-relative index in the receiver. 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:
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(int[] indices)
Deselects the items at the given zero-relative indices in the receiver. If the item at the given zero-relative index in the receiver is selected, it is deselected. If the item at the index was not selected, it remains deselected. Indices that are out of range and duplicate indices are ignored.- Parameters:
indices
- the array of indices for the items to deselect- Throws:
java.lang.IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the set of indices 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
-
deselectDoNotFireEvent
public void deselectDoNotFireEvent(int[] indices)
Deselects the items at the given zero-relative indices in the receiver. If the item at the given zero-relative index in the receiver is selected, it is deselected. If the item at the index was not selected, it remains deselected. Indices that are out of range and duplicate indices are ignored.- Parameters:
indices
- the array of indices for the items to deselect- Throws:
java.lang.IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the set of indices 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
-
deselect
private void deselect(int[] indices, boolean shouldFireEvents)
Deselects the items at the given zero-relative indices in the receiver. If the item at the given zero-relative index in the receiver is selected, it is deselected. If the item at the index was not selected, it remains deselected. Indices that are out of range and duplicate indices are ignored.- Parameters:
indices
- the array of indices for the items to deselect- Throws:
java.lang.IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the set of indices 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
-
deselect
public void deselect(int start, int end)
Deselects the items at the given zero-relative indices in the receiver. If the item at the given zero-relative index in the receiver is selected, it is deselected. If the item at the index was not selected, it remains deselected. The range of the indices is inclusive. Indices that are out of range are ignored.- Parameters:
start
- the start index of the items to deselectend
- the end index of the items to deselect- Throws:
java.lang.IllegalArgumentException
-- ERROR_INVALID_RANGE - if start is greater than end
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
-
deselectDoNotFireEvent
public void deselectDoNotFireEvent(int start, int end)
Deselects the items at the given zero-relative indices in the receiver. If the item at the given zero-relative index in the receiver is selected, it is deselected. If the item at the index was not selected, it remains deselected. The range of the indices is inclusive. Indices that are out of range are ignored.- Parameters:
start
- the start index of the items to deselectend
- the end index of the items to deselect- Throws:
java.lang.IllegalArgumentException
-- ERROR_INVALID_RANGE - if start is greater than end
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
private void deselect(int start, int end, boolean shouldFireEvents)
-
deselectAll
public void deselectAll()
Deselects all selected items in 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
-
deselectAllDoNotFireEvent
public void deselectAllDoNotFireEvent()
Deselects all selected items in 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
-
deselectAll
public void deselectAll(boolean shouldFireEvents)
Deselects all selected items in 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
-
getItem
public DLItem getItem(int index)
Returns the item at the given, zero-relative index in the receiver. 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.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.- 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 DLItem[] getItems()
Returns a (possibly empty) array ofDLItem
s which are the items in the receiver.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
-
getItemsAsList
public java.util.List<DLItem> getItemsAsList()
Returns a (possibly empty) list ofDLItem
s which are the items in the receiver.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
-
getSelection
public DLItem[] getSelection()
Returns an array ofDLItem
s that are currently selected in the receiver. 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:
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
-
getSelectionAsList
public java.util.List<DLItem> getSelectionAsList()
Returns a list ofDLItem
s that are currently selected in the receiver. 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:
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
-
getSelectionCount
public int getSelectionCount()
Returns the number of selected items contained in the receiver.- Returns:
- the number of selected 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
-
remove
public void remove(int index)
Removes the item from the receiver at the given zero-relative index.- Parameters:
index
- the index for the item- Throws:
java.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(int[] indices)
Removes the items from the receiver at the given zero-relative indices.- Parameters:
indices
- the array of indices of the items- Throws:
java.lang.IllegalArgumentException
-- ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
- ERROR_NULL_ARGUMENT - if the indices array 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
-
remove
public void remove(int start, int end)
Removes the items from the receiver which are between the given zero-relative start and end indices (inclusive).- Parameters:
start
- the start of the rangeend
- the end of the range- Throws:
java.lang.IllegalArgumentException
-- ERROR_INVALID_RANGE - if either the start or end are not between 0 and the number of elements in the list minus 1 (inclusive) or if start>end
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(DLItem item)
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:
item
- the item to remove- Throws:
java.lang.IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the item is null
- ERROR_INVALID_ARGUMENT - if the item is not found in the list
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()
Removes all of the items from 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
-
select
public void select(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. Indices that are out of range are ignored.- Parameters:
index
- the index of the item to select- 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
-
selectDoNotFireEvent
public void selectDoNotFireEvent(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. Indices that are out of range are ignored.- Parameters:
index
- the index of the item to select- 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
-
select
private void select(int index, boolean shouldFireEvents)
-
select
public void select(int[] indices)
Selects the items at the given zero-relative indices in the receiver. The current selection is not cleared before the new items are selected.If the item at a given index is not selected, it is selected. If the item at a given index was already selected, it remains selected. Indices that are out of range and duplicate indices are ignored. If the receiver is single-select and multiple indices are specified, then all indices are ignored.
- Parameters:
indices
- the array of indices for the items to select- Throws:
java.lang.IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the array of indices 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
-
selectDoNotFireEvent
public void selectDoNotFireEvent(int[] indices)
Selects the items at the given zero-relative indices in the receiver. The current selection is not cleared before the new items are selected.If the item at a given index is not selected, it is selected. If the item at a given index was already selected, it remains selected. Indices that are out of range and duplicate indices are ignored. If the receiver is single-select and multiple indices are specified, then all indices are ignored.
- Parameters:
indices
- the array of indices for the items to select- Throws:
java.lang.IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the array of indices 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
-
select
private void select(int[] indices, boolean shouldFireEvents)
-
select
public void select(int start, int end)
Selects the items in the range specified by the given zero-relative indices in the receiver. The range of indices is inclusive. The current selection is not cleared before the new items are selected.If an item in the given range is not selected, it is selected. If an item in the given range was already selected, it remains selected. Indices that are out of range are ignored and no items will be selected if start is greater than end. If the receiver is single-select and there is more than one item in the given range, then all indices are ignored.
- Parameters:
start
- the start of the rangeend
- the end of the range- 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
- See Also:
List#setSelection(int,int)
-
selectDoNotFireEvent
public void selectDoNotFireEvent(int start, int end)
Selects the items in the range specified by the given zero-relative indices in the receiver. The range of indices is inclusive. The current selection is not cleared before the new items are selected.If an item in the given range is not selected, it is selected. If an item in the given range was already selected, it remains selected. Indices that are out of range are ignored and no items will be selected if start is greater than end. If the receiver is single-select and there is more than one item in the given range, then all indices are ignored.
- Parameters:
start
- the start of the rangeend
- the end of the range- 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
- See Also:
List#setSelection(int,int)
-
select
private void select(int start, int end, boolean shouldFireEvents)
-
selectAll
public void selectAll()
Selects all of the items in the receiver.If the receiver is single-select, do nothing.
- 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
-
selectAllDoNotFireEvent
public void selectAllDoNotFireEvent()
Selects all of the items in the receiver.If the receiver is single-select, do nothing.
- 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
-
selectAll
private void selectAll(boolean shouldFireEvents)
-
setBounds
public void setBounds(int x, int y, int width, int height)
- Overrides:
setBounds
in classorg.eclipse.swt.widgets.Control
- See Also:
Control.setBounds(int, int, int, int)
-
itemsContainImage
private boolean itemsContainImage()
- Returns:
true
if any item contains an image
-
setItem
public void setItem(int index, DLItem item)
Sets the item in the receiver's list at the given zero-relative index to the item argument.- Parameters:
index
- the index for the itemitem
- the new item- Throws:
java.lang.IllegalArgumentException
-- ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
- ERROR_NULL_ARGUMENT - if the item 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
-
setItems
public void setItems(DLItem[] items)
Sets the receiver's items to be the given array of items.- Parameters:
items
- the array of items- Throws:
java.lang.IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the items array is null
- ERROR_INVALID_ARGUMENT - if an item in the items array 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
-
setItems
public void setItems(java.util.List<DLItem> items)
Sets the receiver's items to be the given list of items.- Parameters:
items
- the list of items- Throws:
java.lang.IllegalArgumentException
-- ERROR_NULL_ARGUMENT - if the items list is null
- ERROR_INVALID_ARGUMENT - if an item in the items list 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
-
redrawTables
private void redrawTables()
Redraws all tables that compose this widget
-
redrawTable
private void redrawTable(org.eclipse.swt.widgets.Table table, boolean isSelected)
Redraw a given table- Parameters:
table
- table to be redrawnedisSelected
- iftrue
, fill the table with the selection. Otherwise, fill the table with the unselected items.
-
clean
private void clean(org.eclipse.swt.widgets.Table table)
Cleans the content of a table- Parameters:
table
- table to be emptied
-
fillData
private void fillData(org.eclipse.swt.widgets.Table table, java.util.List<DLItem> listOfData)
Fill a table with data- Parameters:
table
- table to be filledlistOfData
- list of data
-
moveSelectionToFirstPosition
protected void moveSelectionToFirstPosition()
Move the selected item to the first position
-
selectItem
protected void selectItem()
Select a given item
-
moveUpItem
protected void moveUpItem()
Move the selected item up
-
deselectItem
protected void deselectItem()
Deselect a given item
-
moveDownItem
protected void moveDownItem()
Move the selected item down
-
swap
private void swap(int first, int second)
Swap 2 items- Parameters:
first
- position of the first item to swapsecond
- position of the second item to swap
-
moveSelectionToLastPosition
protected void moveSelectionToLastPosition()
Move the selected item to the last position
-
fireSelectionEvent
private void fireSelectionEvent(DLItem item)
Call all selection listeners- Parameters:
item
- selected item
-
fireSelectionChangeEvent
private void fireSelectionChangeEvent(java.util.List<DLItem> items)
-
-