Eclipse Platform
2.0

org.eclipse.swt.widgets
Class Table

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.swt.widgets.Table
All Implemented Interfaces:
Drawable

public class Table
extends Composite

Instances of this class implement a selectable user interface object that displays a list of images and strings and issue notificiation when selected.

The item children that may be added to instances of this class must be of type TableItem.

Note that although this class is a subclass of Composite, it does not make sense to add Control children to it, or set a layout on it.

Styles:
SINGLE, MULTI, CHECK, FULL_SELECTION, HIDE_SELECTION
Events:
Selection, DefaultSelection

Note: Only one of the styles SINGLE, and MULTI may be specified.

IMPORTANT: This class is not intended to be subclassed.


Field Summary
 
Fields inherited from class org.eclipse.swt.widgets.Control
handle
 
Constructor Summary
Table(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 addSelectionListener(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.
protected  void checkSubclass()
          Checks that this class can be subclassed.
 Point computeSize(int wHint, int hHint, boolean changed)
          Returns the preferred size of the receiver.
 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.
 TableColumn getColumn(int index)
          Returns the column at the given, zero-relative index in the receiver.
 int getColumnCount()
          Returns the number of columns contained in the receiver.
 TableColumn[] getColumns()
          Returns an array of TableColumns which are the columns in the receiver.
 int getGridLineWidth()
          Returns the width in pixels of a grid line.
 int getHeaderHeight()
          Returns the height of the receiver's header
 boolean getHeaderVisible()
          Returns true if the receiver's header is visible, and false otherwise.
 TableItem getItem(int index)
          Returns the item at the given, zero-relative index in the receiver.
 TableItem getItem(Point point)
          Returns the item at the given point in the receiver or null if no such item exists.
 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 receiver's.
 TableItem[] getItems()
          Returns an array of TableItems which are the items in the receiver.
 boolean getLinesVisible()
          Returns true if the receiver's lines are visible, and false otherwise.
 TableItem[] getSelection()
          Returns an array of TableItems 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.
 int indexOf(TableColumn column)
          Searches the receiver's list starting at the first column (index 0) until a column is found that is equal to the argument, and returns the index of that column.
 int indexOf(TableItem item)
          Searches the receiver's list starting at the first item (index 0) 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.
 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's list 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 removeAll()
          Removes all of the items from the receiver.
 void removeSelectionListener(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.
 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 at the given zero-relative indices in the receiver.
 void selectAll()
          Selects all the items in the receiver.
 void setFont(Font font)
          Sets the font that the receiver will use to paint textual information to the font specified by the argument, or to the default font for that kind of control if the argument is null.
 void setHeaderVisible(boolean show)
          Marks the receiver's header as visible if the argument is true, and marks it invisible otherwise.
 void setLinesVisible(boolean show)
          Marks the receiver's lines as visible if the argument is true, and marks it invisible otherwise.
 void setRedraw(boolean redraw)
          If the argument is false, causes subsequent drawing operations in the receiver to be ignored.
 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 at the given zero-relative indices in the receiver.
 void setSelection(TableItem[] 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 showItem(TableItem item)
          Shows the item.
 void showSelection()
          Shows the selection.
 
Methods inherited from class org.eclipse.swt.widgets.Composite
getChildren, getLayout, getTabList, layout, layout, setFocus, setLayout, setTabList
 
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getVerticalBar
 
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addFocusListener, addHelpListener, addKeyListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addPaintListener, addTraverseListener, computeSize, forceFocus, getAccessible, getBackground, getBorderWidth, getBounds, getDisplay, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getParent, getShell, getSize, getToolTipText, getVisible, internal_dispose_GC, internal_new_GC, isDisposed, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, redraw, redraw, removeControlListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removePaintListener, removeTraverseListener, setBackground, setBounds, setBounds, setCapture, setCursor, setEnabled, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setSize, setSize, setToolTipText, setVisible, toControl, toDisplay, traverse, update
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getStyle, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, setData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Table

public Table(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.

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:
IllegalArgumentException -
SWTException -
See Also:
SWT.SINGLE, SWT.MULTI, SWT.CHECK, SWT.FULL_SELECTION, SWT.HIDE_SELECTION, Widget.checkSubclass(), Widget.getStyle()
Method Detail

addSelectionListener

public void addSelectionListener(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.

When widgetSelected is called, the item field of the event object is valid. If the reciever has SWT.CHECK style set and the check selection changes, the event object detail field contains the value SWT.CHECK. widgetDefaultSelected is typically called when an item is double-clicked. The item field of the event object is valid for default selection, but the detail field is not used.

Parameters:
listener - the listener which should be notified
Throws:
IllegalArgumentException -
  • ERROR_NULL_ARGUMENT - if the listener is null
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

checkSubclass

protected void checkSubclass()
Description copied from class: Widget
Checks that this class can be subclassed.

The SWT class library is intended to be subclassed only at specific, controlled points (most notably, Composite and Canvas when implementing new widgets). This method enforces this rule unless it is overridden.

IMPORTANT: By providing an implementation of this method that allows a subclass of a class which does not normally allow subclassing to be created, the implementer agrees to be fully responsible for the fact that any such subclass will likely fail between SWT releases and will be strongly platform specific. No support is provided for user-written classes which are implemented in this fashion.

The ability to subclass outside of the allowed SWT classes is intended purely to enable those not on the SWT development team to implement patches in order to get around specific limitations in advance of when those limitations can be addressed by the team. Subclassing should not be attempted without an intimate and detailed understanding of the hierarchy.

Overrides:
checkSubclass in class Composite

computeSize

public 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 Composite
Parameters:
wHint - the width hint (can be SWT.DEFAULT)
hHint - the height hint (can be SWT.DEFAULT)
changed - true if the control's contents have changed, and false otherwise
Returns:
the preferred size of the control.
See Also:
Layout, Control.getBorderWidth(), Control.getBounds(), Control.getSize(), Control.pack(), "computeTrim, getClientArea for controls that implement them"

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:
IllegalArgumentException -
  • ERROR_NULL_ARGUMENT - if the listener is null
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 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:
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 deselect
end - the end index of the items to deselect
Throws:
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 selected items in the receiver.

Throws:
SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver

getColumn

public TableColumn getColumn(int index)
Returns the column at the given, zero-relative index in the receiver. Throws an exception if the index is out of range. If no TableColumns were created by the programmer, this method will throw ERROR_INVALID_RANGE despite the fact that a single column of data may be visible in the table. This occurs when the programmer uses the table like a list, adding items but never creating a column.

Parameters:
index - the index of the column to return
Returns:
the column at the given index
Throws:
IllegalArgumentException -
  • ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver

getColumnCount

public int getColumnCount()
Returns the number of columns contained in the receiver. If no TableColumns were created by the programmer, this value is zero, despite the fact that visually, one column of items is may be visible. This occurs when the programmer uses the table like a list, adding items but never creating a column.

Returns:
the number of columns
Throws:
SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
SWTError -
  • ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure

getColumns

public TableColumn[] getColumns()
Returns an array of TableColumns which are the columns in the receiver. If no TableColumns were created by the programmer, the array is empty, despite the fact that visually, one column of items may be visible. This occurs when the programmer uses the table like a list, adding items but never creating a column.

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
Throws:
SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver

getGridLineWidth

public int getGridLineWidth()
Returns the width in pixels of a grid line.

Throws:
SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver

getHeaderHeight

public int getHeaderHeight()
Returns the height of the receiver's header

Returns:
the height of the header or zero if the header is not visible
Throws:
SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
Since:
2.0

getHeaderVisible

public boolean getHeaderVisible()
Returns true if the receiver's header is visible, and false otherwise.

If one of the receiver's ancestors is not visible or some other condition makes the receiver not visible, this method may still indicate that it is considered visible even though it may not actually be showing.

Returns:
the receiver's header's visibility state
Throws:
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 TableItem 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:
IllegalArgumentException -
  • ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
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 TableItem getItem(Point point)
Returns the item at the given point in the receiver or null if no such item exists. The point is in the coordinate system of the receiver.

Parameters:
point - the point used to locate the item
Returns:
the item at the given point
Throws:
IllegalArgumentException -
  • ERROR_NULL_ARGUMENT - if the listener is null
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:
SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver

getItemHeight

public int getItemHeight()
Returns the height of the area which would be used to display one of the items in the receiver's.

Returns:
the height of one item
Throws:
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 TableItem[] getItems()
Returns an array of TableItems 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
Throws:
SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver

getLinesVisible

public boolean getLinesVisible()
Returns true if the receiver's lines are visible, and false otherwise.

If one of the receiver's ancestors is not visible or some other condition makes the receiver not visible, this method may still indicate that it is considered visible even though it may not actually be showing.

Returns:
the visibility state of the lines
Throws:
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 TableItem[] getSelection()
Returns an array of TableItems 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:
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:
SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created 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.

Returns:
the index of the selected item
Throws:
SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver

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.

Returns:
the array of indices of the selected items
Throws:
SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created 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.

Returns:
the index of the top item
Throws:
SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver

indexOf

public int indexOf(TableColumn column)
Searches the receiver's list starting at the first column (index 0) until a column is found that is equal to the argument, and returns the index of that column. If no column is found, returns -1.

Parameters:
column - the search column
Returns:
the index of the column
Throws:
IllegalArgumentException -
  • ERROR_NULL_ARGUMENT - if the string is null
SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver

indexOf

public int indexOf(TableItem item)
Searches the receiver's list starting at the first item (index 0) until an item is found that is equal to the argument, and returns the index of that item. If no item is found, returns -1.

Parameters:
item - the search item
Returns:
the index of the item
Throws:
IllegalArgumentException -
  • ERROR_NULL_ARGUMENT - if the string is null
SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver

isSelected

public boolean isSelected(int index)
Returns true if the item is selected, and false otherwise. Indices out of range are ignored.

Parameters:
index - the index of the item
Returns:
the visibility state of the item at the index
Throws:
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's list at the given zero-relative indices.

Parameters:
indices - the array of indices of the items
Throws:
IllegalArgumentException -
  • ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
SWTError -
  • ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure

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:
IllegalArgumentException -
  • ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
SWTError -
  • ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure

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 range
end - the end of the range
Throws:
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)
SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
SWTError -
  • ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure

removeAll

public void removeAll()
Removes all of the items from the receiver.

Throws:
SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver

removeSelectionListener

public void removeSelectionListener(SelectionListener listener)
Removes the listener from the collection of listeners who will be notified when the receiver's selection changes.

Parameters:
listener - the listener which should no longer be notified
Throws:
IllegalArgumentException -
  • ERROR_NULL_ARGUMENT - if the listener is null
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)

select

public void select(int[] indices)
Selects the items at the given zero-relative indices in the receiver. If the item at the given zero-relative index in the receiver is not selected, it is selected. If the item at the index was selected, it remains selected. Indices that are out of range and duplicate indices are ignored.

Parameters:
indices - the array of indices for the items to select
Throws:
IllegalArgumentException -
  • ERROR_NULL_ARGUMENT - if the array of indices is null
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. 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:
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 start,
                   int end)
Selects the items at the given zero-relative indices in the receiver. If the item at the index was already selected, it remains selected. The range of the indices is inclusive. Indices that are out of range are ignored.

Parameters:
start - the start of the range
end - the end of the range
Throws:
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 the items in the receiver.

Throws:
SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver

setFont

public void setFont(Font font)
Description copied from class: Control
Sets the font that the receiver will use to paint textual information to the font specified by the argument, or to the default font for that kind of control if the argument is null.

Overrides:
setFont in class Control
Parameters:
font - the new font (or null)

setHeaderVisible

public void setHeaderVisible(boolean show)
Marks the receiver's header as visible if the argument is true, and marks it invisible otherwise.

If one of the receiver's ancestors is not visible or some other condition makes the receiver not visible, marking it visible may not actually cause it to be displayed.

Throws:
SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver

setLinesVisible

public void setLinesVisible(boolean show)
Marks the receiver's lines as visible if the argument is true, and marks it invisible otherwise.

If one of the receiver's ancestors is not visible or some other condition makes the receiver not visible, marking it visible may not actually cause it to be displayed.

Throws:
SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver

setRedraw

public void setRedraw(boolean redraw)
Description copied from class: Control
If the argument is false, causes subsequent drawing operations in the receiver to be ignored. No drawing of any kind can occur in the receiver until the flag is set to true. Graphics operations that occurred while the flag was false are lost. When the flag is set to true, the entire widget is marked as needing to be redrawn.

Note: This operation is a hint and may not be supported on some platforms or for some widgets.

Overrides:
setRedraw in class Control
Parameters:
redraw - the new redraw state
See Also:
Control.redraw(), Control.update()

setSelection

public void setSelection(int[] indices)
Selects the items at the given zero-relative indices in the receiver. The current selected is first cleared, then the new items are selected.

Parameters:
indices - the indices of the items to select
Throws:
IllegalArgumentException -
  • ERROR_NULL_ARGUMENT - if the array of indices is null
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:
deselectAll(), select(int[])

setSelection

public void setSelection(TableItem[] items)
Sets the receiver's selection to be the given array of items. The current selected is first cleared, then the new items are selected.

Parameters:
items - the array of items
Throws:
IllegalArgumentException -
  • ERROR_NULL_ARGUMENT - if the array of items is null
  • ERROR_INVALID_ARGUMENT - if one of the item has been disposed
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:
deselectAll(), select(int)

setSelection

public void setSelection(int index)
Selects the item at the given zero-relative index in the receiver. The current selected is first cleared, then the new item is selected.

Parameters:
index - the index of the item to select
Throws:
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:
deselectAll(), select(int)

setSelection

public void setSelection(int start,
                         int end)
Selects the items at the given zero-relative indices in the receiver. The current selected if first cleared, then the new items are selected.

Parameters:
start - the start index of the items to select
end - the end index of the items to select
Throws:
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:
deselectAll(), select(int,int)

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.

Parameters:
index - the index of the top item
Throws:
SWTException -
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver

showItem

public void showItem(TableItem item)
Shows the item. If the item is already showing in the receiver, this method simply returns. Otherwise, the items are scrolled until the item is visible.

Parameters:
item - the item to be shown
Throws:
IllegalArgumentException -
  • ERROR_NULL_ARGUMENT - if the item is null
  • ERROR_INVALID_ARGUMENT - if the item has been disposed
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:
showSelection()

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.

Throws:
IllegalArgumentException -
  • ERROR_NULL_ARGUMENT - if the listener is null
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:
showItem(TableItem)

Eclipse Platform
2.0

Copyright (c) IBM Corp. and others 2000, 2002. All Rights Reserved.