Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.eclipse.swt.widgets
Class List  view List download List.java

java.lang.Object
  extended byorg.eclipse.swt.widgets.Widget
      extended byorg.eclipse.swt.widgets.Control
          extended byorg.eclipse.swt.widgets.Scrollable
              extended byorg.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 org.eclipse.swt.widgets.Control
_getShell, addControlListener, addFocusListener, addHelpListener, addKeyListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addPaintListener, addTraverseListener, computeNativeSize, computeSize, computeTabGroup, computeTabList, computeTabRoot, defaultFont, drawGripper, enableWidget, eventHandle, filterKey, findMenus, fixChildren, fixFocus, focusHandle, fontHandle, forceFocus, forceFocus, getAccessible, getBackground, getBaseColor, getBgColor, getBounds, getEnabled, getFgColor, getFont, getFontDescription, getForeground, getIMCaretPos, getLayoutData, getLocation, getMenu, getMonitor, getParent, getPath, getShell, getSize, getTextColor, getToolTipText, getVisible, gtk_button_release_event, gtk_commit, gtk_enter_notify_event, gtk_event_after, gtk_expose_event, gtk_focus_in_event, gtk_focus_out_event, gtk_focus, gtk_key_release_event, gtk_leave_notify_event, gtk_mnemonic_activate, gtk_motion_notify_event, gtk_popup_menu, gtk_preedit_changed, gtk_realize, gtk_show_help, gtk_unrealize, gtk_visibility_notify_event, hasFocus, hoverProc, imHandle, internal_dispose_GC, internal_new_GC, isEnabled, isFocusAncestor, isFocusControl, isReparentable, isShowing, isTabGroup, isTabItem, isVisible, menuShell, mnemonicHit, mnemonicMatch, moveAbove, moveBelow, moveHandle, pack, pack, paintHandle, redraw, redraw, redrawWidget, releaseChild, removeControlListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removePaintListener, removeTraverseListener, sendFocusEvent, sendHelpEvent, sendIMKeyEvent, sendKeyEvent, sendMouseEvent, setBackground, setBackgroundColor, setBounds, setBounds, setCapture, setCursor, setCursor, setEnabled, setFocus, setFont, setFontDescription, setForeground, setInitialSize, setLayoutData, setLocation, setLocation, setMenu, setParent, setRadioSelection, setRedraw, setSize, setSize, setTabGroupFocus, setTabItemFocus, setToolTipText, setVisible, setZOrder, setZOrder, showMenu, sort, toControl, toControl, toDisplay, toDisplay, translateMnemonic, translateMnemonic, translateTraversal, traversalCode, traverse, traverse, traverseEscape, traverseGroup, traverseItem, traverseMnemonic, traversePage, traverseReturn, update, update
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkBits, checkOrientation, checkParent, checkSubclass, checkWidget, destroyWidget, dispose, error, filterProc, filters, fixMnemonic, fontHeight, getData, getData, getDisplay, getName, getNameText, getStyle, gtk_activate, gtk_clicked, gtk_configure_event, gtk_delete_event, gtk_delete_range, gtk_delete_text, gtk_event, gtk_hide, gtk_insert_text, gtk_map_event, gtk_scroll_child, gtk_select, gtk_show, gtk_size_allocate, gtk_style_set, gtk_switch_page, gtk_test_collapse_row, gtk_test_expand_row, gtk_timer, gtk_toggled, gtk_unmap_event, gtk_value_changed, gtk_window_state_event, hooks, isDisposed, isListening, isValidSubclass, isValidThread, isValidWidget, menuPositionProc, mnemonicHit, mnemonicMatch, notifyListeners, pixbufCellDataProc, postEvent, postEvent, releaseResources, removeDisposeListener, removeListener, removeListener, sendEvent, sendEvent, sendEvent, sendEvent, setData, setData, setInputState, setKeyState, shellMapProc, textCellDataProc, timerProc, toString, translateTraversal, windowProc, windowProc, windowProc, windowProc
 
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 SWT which is applicable to instances of this class, or must be built by bitwise OR'ing together (that is, using the int "|" operator) two or more of those SWT style 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 use 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 receiver's selection changes, by sending it one of the messages defined in the SelectionListener interface.

widgetSelected is called when the selection changes. widgetDefaultSelected is typically called when an item is double-clicked.


checkStyle

static int checkStyle(int style)

createHandle

void createHandle(int index)
Overrides:
createHandle in class Widget

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.DEFAULT is 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 be false, so layout manager caches can be retained.

Overrides:
computeSize in class Control

deregister

void deregister()
Overrides:
deregister in class Scrollable

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:
getBackgroundColor in class Control

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:
getForegroundColor in class Control

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_changed in class Widget

gtk_button_press_event

long gtk_button_press_event(long widget,
                            long event)
Overrides:
gtk_button_press_event in class Control

gtk_key_press_event

long gtk_key_press_event(long widget,
                         long event)
Overrides:
gtk_key_press_event in class Control

gtk_row_activated

long gtk_row_activated(long tree,
                       long path,
                       long column)
Overrides:
gtk_row_activated in class Widget

hookEvents

void hookEvents()
Overrides:
hookEvents in class Control

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 true if the item is selected, and false otherwise. Indices out of range are ignored.


paintWindow

long paintWindow()
Overrides:
paintWindow in class Control

register

void register()
Overrides:
register in class Scrollable

releaseWidget

void releaseWidget()
Overrides:
releaseWidget in class Scrollable

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:
setBackgroundColor in class Control

setBounds

boolean setBounds(int x,
                  int y,
                  int width,
                  int height,
                  boolean move,
                  boolean resize)
Overrides:
setBounds in class Control

setForegroundColor

void setForegroundColor(org.eclipse.swt.internal.gtk.GdkColor color)
Overrides:
setForegroundColor in class Control

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 then add'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:
treeSelectionProc in class Widget