|
|||||||||
| Home >> All >> org >> eclipse >> swt >> [ widgets overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.eclipse.swt.widgets
Class List

java.lang.Objectorg.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Control
org.eclipse.swt.widgets.Scrollable
org.eclipse.swt.widgets.List
- All Implemented Interfaces:
- org.eclipse.swt.graphics.Drawable
- public class List
- extends Scrollable
Instances of this class represent a selectable user interface object that displays a list of strings and issues notificiation when a string selected. A list may be single or multi select.
- Styles:
- SINGLE, MULTI
- Events:
- Selection, DefaultSelection
Note: Only one of SINGLE and MULTI may be specified.
IMPORTANT: This class is not intended to be subclassed.
| Field Summary | |
(package private) long |
modelHandle
|
(package private) static int |
TEXT_COLUMN
|
| Fields inherited from class org.eclipse.swt.widgets.Scrollable |
horizontalBar, scrolledHandle, verticalBar |
| Fields inherited from class org.eclipse.swt.widgets.Control |
accessible, cursor, drawCount, enableWindow, fixedHandle, font, layoutData, menu, parent, redrawWindow, toolTipText |
| Fields inherited from class org.eclipse.swt.widgets.Widget |
ACTIVATE, BUTTON_PRESS_EVENT, BUTTON_RELEASE_EVENT, CANVAS, CHANGED, CLICKED, COMMIT, CONFIGURE_EVENT, data, DEFAULT_HEIGHT, DEFAULT_WIDTH, DELETE_EVENT, DELETE_RANGE, DELETE_TEXT, DISABLED, display, DISPOSED, ENTER_NOTIFY_EVENT, EVENT, EVENT_AFTER, eventTable, EXPOSE_EVENT, FOCUS, FOCUS_IN_EVENT, FOCUS_OUT_EVENT, handle, HANDLE, HIDE, INSERT_TEXT, KEY_PRESS_EVENT, KEY_RELEASE_EVENT, KEYED_DATA, LEAVE_NOTIFY_EVENT, MAP_EVENT, MENU, MNEMONIC_ACTIVATE, MOTION_NOTIFY_EVENT, OBSCURED, POPUP_MENU, PREEDIT_CHANGED, REALIZE, ROW_ACTIVATED, SCROLL_CHILD, SELECT, SHOW, SHOW_HELP, SIZE_ALLOCATE, state, style, STYLE_SET, SWITCH_PAGE, TEST_COLLAPSE_ROW, TEST_EXPAND_ROW, TOGGLED, UNMAP_EVENT, UNREALIZE, VALUE_CHANGED, VISIBILITY_NOTIFY_EVENT, WINDOW_STATE_EVENT |
| Constructor Summary | |
List(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 | |
void |
add(java.lang.String string)
Adds the argument to the end of the receiver's list. |
void |
add(java.lang.String string,
int index)
Adds the argument to the receiver's list at the given zero-relative index. |
void |
addSelectionListener(org.eclipse.swt.events.SelectionListener listener)
Adds the listener to the collection of listeners who will be notified when the receiver's selection changes, by sending it one of the messages defined in the SelectionListener
interface. |
(package private) static int |
checkStyle(int style)
|
org.eclipse.swt.graphics.Point |
computeSize(int wHint,
int hHint,
boolean changed)
Returns the preferred size of the receiver. |
(package private) void |
createHandle(int index)
|
(package private) void |
deregister()
|
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. |
void |
deselect(int start,
int end)
Deselects the items at the given zero-relative indices in the receiver. |
void |
deselectAll()
Deselects all selected items in the receiver. |
(package private) org.eclipse.swt.internal.gtk.GdkColor |
getBackgroundColor()
|
int |
getFocusIndex()
Returns the zero-relative index of the item which currently has the focus in the receiver, or -1 if no item has focus. |
(package private) org.eclipse.swt.internal.gtk.GdkColor |
getForegroundColor()
|
java.lang.String |
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. |
int |
getItemHeight()
Returns the height of the area which would be used to display one of the items in the tree. |
java.lang.String[] |
getItems()
Returns an array of Strings which are the items
in the receiver. |
java.lang.String[] |
getSelection()
Returns an array of Strings that are currently
selected in the receiver. |
int |
getSelectionCount()
Returns the number of selected items contained in the receiver. |
int |
getSelectionIndex()
Returns the zero-relative index of the item which is currently selected in the receiver, or -1 if no item is selected. |
int[] |
getSelectionIndices()
Returns the zero-relative indices of the items which are currently selected in the receiver. |
int |
getTopIndex()
Returns the zero-relative index of the item which is currently at the top of the receiver. |
(package private) long |
gtk_button_press_event(long widget,
long event)
|
(package private) long |
gtk_changed(long widget)
|
(package private) long |
gtk_key_press_event(long widget,
long event)
|
(package private) long |
gtk_row_activated(long tree,
long path,
long column)
|
(package private) void |
hookEvents()
|
int |
indexOf(java.lang.String string)
Gets the index of an item. |
int |
indexOf(java.lang.String string,
int start)
Searches the receiver's list starting at the given, zero-relative index until an item is found that is equal to the argument, and returns the index of that item. |
boolean |
isSelected(int index)
Returns true if the item is selected,
and false otherwise. |
(package private) long |
paintWindow()
|
(package private) void |
register()
|
(package private) void |
releaseWidget()
|
void |
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(java.lang.String string)
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 |
removeSelectionListener(org.eclipse.swt.events.SelectionListener listener)
Removes the listener from the collection of listeners who will be notified when the receiver's selection changes. |
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. |
void |
select(int start,
int end)
Selects the items in the range specified by the given zero-relative indices in the receiver. |
void |
selectAll()
Selects all of the items in the receiver. |
(package private) void |
selectFocusIndex(int index)
|
(package private) void |
setBackgroundColor(org.eclipse.swt.internal.gtk.GdkColor color)
|
(package private) boolean |
setBounds(int x,
int y,
int width,
int height,
boolean move,
boolean resize)
|
(package private) void |
setForegroundColor(org.eclipse.swt.internal.gtk.GdkColor color)
|
void |
setItem(int index,
java.lang.String string)
Sets the text of the item in the receiver's list at the given zero-relative index to the string argument. |
void |
setItems(java.lang.String[] items)
Sets the receiver's items to be the given array of items. |
void |
setSelection(int index)
Selects the item at the given zero-relative index in the receiver. |
void |
setSelection(int[] indices)
Selects the items at the given zero-relative indices in the receiver. |
void |
setSelection(int start,
int end)
Selects the items in the range specified by the given zero-relative indices in the receiver. |
void |
setSelection(java.lang.String[] items)
Sets the receiver's selection to be the given array of items. |
void |
setTopIndex(int index)
Sets the zero-relative index of the item which is currently at the top of the receiver. |
void |
showSelection()
Shows the selection. |
(package private) long |
treeSelectionProc(long model,
long path,
long iter,
int[] selection,
int length)
|
| Methods inherited from class org.eclipse.swt.widgets.Scrollable |
clientHandle, computeTrim, createScrollBar, createWidget, getBorderWidth, getClientArea, getHorizontalBar, getVerticalBar, hScrollBarWidth, releaseHandle, resizeHandle, setOrientation, topHandle, vScrollBarWidth |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
modelHandle
long modelHandle
TEXT_COLUMN
static final int TEXT_COLUMN
- See Also:
- Constant Field Values
| Constructor Detail |
List
public List(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
SWTwhich 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 thoseSWTstyle constants. The class description lists the style constants that are applicable to the class. Style bits are also inherited from superclasses.
| Method Detail |
add
public void add(java.lang.String string)
- Adds the argument to the end of the receiver's list.
add
public void add(java.lang.String string, 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(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 receiver's selection changes, by sending
it one of the messages defined in the
SelectionListenerinterface.widgetSelectedis called when the selection changes.widgetDefaultSelectedis typically called when an item is double-clicked.
checkStyle
static int checkStyle(int style)
createHandle
void createHandle(int index)
- Overrides:
createHandlein classWidget
computeSize
public org.eclipse.swt.graphics.Point computeSize(int wHint, int hHint, boolean changed)
- Description copied from class:
Control - Returns the preferred size of the receiver.
The preferred size of a control is the size that it would best be displayed at. The width hint and height hint arguments allow the caller to ask a control questions such as "Given a particular width, how high does the control need to be to show all of the contents?" To indicate that the caller does not wish to constrain a particular dimension, the constant
SWT.DEFAULTis passed for the hint.If the changed flag is
true, it indicates that the receiver's contents have changed, therefore any caches that a layout manager containing the control may have been keeping need to be flushed. When the control is resized, the changed flag will befalse, so layout manager caches can be retained.- Overrides:
computeSizein classControl
deregister
void deregister()
- Overrides:
deregisterin classScrollable
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.
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.
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.
deselectAll
public void deselectAll()
- Deselects all selected items in the receiver.
getBackgroundColor
org.eclipse.swt.internal.gtk.GdkColor getBackgroundColor()
- Overrides:
getBackgroundColorin classControl
getFocusIndex
public int getFocusIndex()
- Returns the zero-relative index of the item which currently
has the focus in the receiver, or -1 if no item has focus.
getForegroundColor
org.eclipse.swt.internal.gtk.GdkColor getForegroundColor()
- Overrides:
getForegroundColorin classControl
getItem
public java.lang.String 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.
getItemCount
public int getItemCount()
- Returns the number of items contained in the receiver.
getItemHeight
public int getItemHeight()
- Returns the height of the area which would be used to
display one of the items in the tree.
getItems
public java.lang.String[] getItems()
- Returns an array of
Strings 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.
getSelection
public java.lang.String[] getSelection()
- Returns an array of
Strings 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.
getSelectionCount
public int getSelectionCount()
- Returns the number of selected items contained in the receiver.
getSelectionIndex
public int getSelectionIndex()
- Returns the zero-relative index of the item which is currently
selected in the receiver, or -1 if no item is selected.
getSelectionIndices
public int[] getSelectionIndices()
- Returns the zero-relative indices of the items which are currently
selected in the receiver. 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.
getTopIndex
public int getTopIndex()
- Returns the zero-relative index of the item which is currently
at the top of the receiver. This index can change when items are
scrolled or new items are added or removed.
gtk_changed
long gtk_changed(long widget)
- Overrides:
gtk_changedin classWidget
gtk_button_press_event
long gtk_button_press_event(long widget,
long event)
- Overrides:
gtk_button_press_eventin classControl
gtk_key_press_event
long gtk_key_press_event(long widget,
long event)
- Overrides:
gtk_key_press_eventin classControl
gtk_row_activated
long gtk_row_activated(long tree,
long path,
long column)
- Overrides:
gtk_row_activatedin classWidget
hookEvents
void hookEvents()
- Overrides:
hookEventsin classControl
indexOf
public int indexOf(java.lang.String string)
- Gets the index of an item.
The list is searched starting at 0 until an item is found that is equal to the search item. If no item is found, -1 is returned. Indexing is zero based.
indexOf
public int indexOf(java.lang.String string, int start)
- Searches the receiver's list starting at the given,
zero-relative index until an item is found that is equal
to the argument, and returns the index of that item. If
no item is found or the starting index is out of range,
returns -1.
isSelected
public boolean isSelected(int index)
- Returns
trueif the item is selected, andfalseotherwise. Indices out of range are ignored.
paintWindow
long paintWindow()
- Overrides:
paintWindowin classControl
register
void register()
- Overrides:
registerin classScrollable
releaseWidget
void releaseWidget()
- Overrides:
releaseWidgetin classScrollable
remove
public void remove(int index)
- Removes the item from the receiver at the given
zero-relative index.
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).
remove
public void remove(java.lang.String string)
- 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.
remove
public void remove(int[] indices)
- Removes the items from the receiver at the given
zero-relative indices.
removeAll
public void removeAll()
- Removes all of the items from the receiver.
removeSelectionListener
public void removeSelectionListener(org.eclipse.swt.events.SelectionListener listener)
- Removes the listener from the collection of listeners who will
be notified when the receiver's selection changes.
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.
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.
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.
selectAll
public void selectAll()
- Selects all of the items in the receiver.
If the receiver is single-select, do nothing.
selectFocusIndex
void selectFocusIndex(int index)
setBackgroundColor
void setBackgroundColor(org.eclipse.swt.internal.gtk.GdkColor color)
- Overrides:
setBackgroundColorin classControl
setBounds
boolean setBounds(int x,
int y,
int width,
int height,
boolean move,
boolean resize)
setForegroundColor
void setForegroundColor(org.eclipse.swt.internal.gtk.GdkColor color)
- Overrides:
setForegroundColorin classControl
setItem
public void setItem(int index,
java.lang.String string)
- Sets the text of the item in the receiver's list at the given
zero-relative index to the string argument. This is equivalent
to
remove'ing the old item at the index, and thenadd'ing the new item at that index.
setItems
public void setItems(java.lang.String[] items)
- Sets the receiver's items to be the given array of items.
setSelection
public void setSelection(int index)
- Selects the item at the given zero-relative index in the receiver.
If the item at the index was already selected, it remains selected.
The current selected is first cleared, then the new items are selected.
Indices that are out of range are ignored.
setSelection
public void setSelection(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 cleared before the new items are 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.
setSelection
public void setSelection(int[] indices)
- Selects the items at the given zero-relative indices in the receiver.
The current selection is cleared before the new items are 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.
setSelection
public void setSelection(java.lang.String[] items)
- Sets the receiver's selection to be the given array of items.
The current selection is cleared before the new items are selected.
Items that are not in the receiver are ignored. If the receiver is single-select and multiple items are specified, then all items are ignored.
setTopIndex
public void setTopIndex(int index)
- Sets the zero-relative index of the item which is currently
at the top of the receiver. This index can change when items
are scrolled or new items are added and removed.
showSelection
public void showSelection()
- Shows the selection. If the selection is already showing in the receiver,
this method simply returns. Otherwise, the items are scrolled until
the selection is visible.
treeSelectionProc
long treeSelectionProc(long model,
long path,
long iter,
int[] selection,
int length)
- Overrides:
treeSelectionProcin classWidget
|
|||||||||
| Home >> All >> org >> eclipse >> swt >> [ widgets overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC