org.eclipse.swt.custom

## Class TableTree

- 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.custom.TableTree

All Implemented Interfaces:
  Drawable

Deprecated.
As of 3.1 use Tree, TreeItem and TreeColumn

    @Deprecated
    public class TableTree
    extends Composite

A TableTree is a selectable user interface object that displays a hierarchy of items, and issues notification when an item is selected. A TableTree may be single or multi select.

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

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
Events:
  Selection, DefaultSelection, Collapse, Expand

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

Restriction:
  This API will be deleted in a future release. See bug 475833 for details.
Restriction:
  This API will be deleted in a future release. See bug 475833 for details.

### Field Summary

### Fields inherited from class org.eclipse.swt.widgets.Control

`handle`

### Constructor Summary

Constructors
Constructor and Description
`TableTree(Composite parent, int style)` Deprecated. 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 Deprecated Methods
`void` `addSelectionListener(SelectionListener listener)` Deprecated. 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 the `SelectionListener` interface.
`void` `addTreeListener(TreeListener listener)` Deprecated. Adds the listener to the collection of listeners who will be notified when an item in the receiver is expanded or collapsed by sending it one of the messages defined in the `TreeListener` interface.
`Point` `computeSize(int wHint, int hHint, boolean changed)` Deprecated. Returns the preferred size (in points) of the receiver.
`Rectangle` `computeTrim(int x, int y, int width, int height)` Deprecated. Given a desired client area for the receiver (as described by the arguments), returns the bounding rectangle which would be required to produce that client area.
`void` `deselectAll()` Deprecated. Deselects all items.
`Color` `getBackground()` Deprecated. Returns the receiver's background color.
`Rectangle` `getClientArea()` Deprecated. Returns a rectangle which describes the area of the receiver which is capable of displaying data (that is, not covered by the "trimmings").
`Font` `getFont()` Deprecated. Returns the font that the receiver will use to paint textual information.
`Color` `getForeground()` Deprecated. Returns the foreground color that the receiver will use to draw.
`TableTreeItem` `getItem(int index)` Deprecated. Returns the item at the given, zero-relative index in the receiver.
`TableTreeItem` `getItem(Point point)` Deprecated. Returns the item at the given point in the receiver or null if no such item exists.
`int` `getItemCount()` Deprecated. Gets the number of items.
`int` `getItemHeight()` Deprecated. Gets the height of one item.
`TableTreeItem[]` `getItems()` Deprecated. Gets the items.
`TableTreeItem[]` `getSelection()` Deprecated. Gets the selected items.
`int` `getSelectionCount()` Deprecated. Gets the number of selected items.
`int` `getStyle()` Deprecated. Returns the receiver's style information.
`Table` `getTable()` Deprecated. Returns the underlying Table control.
`int` `indexOf(TableTreeItem item)` Deprecated. Gets the index of an item.
`void` `removeAll()` Deprecated. Removes all items.
`void` `removeSelectionListener(SelectionListener listener)` Deprecated. Removes the listener from the collection of listeners who will be notified when the user changes the receiver's selection.
`void` `removeTreeListener(TreeListener listener)` Deprecated. Removes the listener from the collection of listeners who will be notified when items in the receiver are expanded or collapsed.
`void` `selectAll()` Deprecated. Selects all of the items in the receiver.
`void` `setBackground(Color color)` Deprecated. Sets the receiver's background color to the color specified by the argument, or to the default system color for the control if the argument is null.
`void` `setEnabled(boolean enabled)` Deprecated. Enables the receiver if the argument is `true`, and disables it otherwise.
`void` `setFont(Font font)` Deprecated. 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` `setForeground(Color color)` Deprecated. Sets the receiver's foreground color to the color specified by the argument, or to the default system color for the control if the argument is null.
`void` `setMenu(Menu menu)` Deprecated. Sets the receiver's pop up menu to the argument.
`void` `setSelection(TableTreeItem[] items)` Deprecated. Sets the receiver's selection to be the given array of items.
`void` `setToolTipText(String string)` Deprecated. Sets the receiver's tool tip text to the argument, which may be null indicating that the default tool tip for the control will be shown.
`void` `showItem(TableTreeItem item)` Deprecated. Shows the item.
`void` `showSelection()` Deprecated. Shows the selection.

### 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

`getHorizontalBar, getScrollbarsMode, getVerticalBar`

### Methods inherited from class org.eclipse.swt.widgets.Control

`addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setLayoutData, setLocation, setLocation, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update`

### Methods inherited from class org.eclipse.swt.widgets.Widget

`addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface org.eclipse.swt.graphics.Drawable

`isAutoScalable`

### Constructor Detail

#### TableTree

    public TableTree(Composite parent,
                     int style)

Deprecated.
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 widget which will be the parent of the new instance (cannot be null)
  `style` - the style of widget to construct
Throws:
  `IllegalArgumentException` -
  - ERROR_NULL_ARGUMENT - if the parent is null
  `SWTException` -
  - ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
See Also:
  `SWT.SINGLE`, `SWT.MULTI`, `SWT.CHECK`, `SWT.FULL_SELECTION`, `getStyle()`

### Method Detail

#### addSelectionListener

    public void addSelectionListener(SelectionListener listener)

Deprecated.
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 the `SelectionListener` interface.

When `widgetSelected` is called, the item field of the event object is valid. If the receiver 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 when the user changes the receiver's selection
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`

#### addTreeListener

    public void addTreeListener(TreeListener listener)

Deprecated.
Adds the listener to the collection of listeners who will be notified when an item in the receiver is expanded or collapsed by sending it one of the messages defined in the `TreeListener` interface.

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:
  `TreeListener`, `removeTreeListener(org.eclipse.swt.events.TreeListener)`

#### computeSize

    public Point computeSize(int wHint,
                             int hHint,
                             boolean changed)

Deprecated.
Description copied from class: `Control`
Returns the preferred size (in points) 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`
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(boolean)`, "computeTrim, getClientArea for controls that implement them"

#### computeTrim

    public Rectangle computeTrim(int x,
                                 int y,
                                 int width,
                                 int height)

Deprecated.
Description copied from class: `Scrollable`
Given a desired client area for the receiver (as described by the arguments), returns the bounding rectangle which would be required to produce that client area.

In other words, it returns a rectangle such that, if the receiver's bounds were set to that rectangle, the area of the receiver which is capable of displaying data (that is, not covered by the "trimmings") would be the rectangle described by the arguments (relative to the receiver's parent).

Overrides:
  `computeTrim` in class `Scrollable`
Parameters:
  `x` - the desired x coordinate of the client area
  `y` - the desired y coordinate of the client area
  `width` - the desired width of the client area
  `height` - the desired height of the client area
Returns:
  the required bounds to produce the given client area
See Also:
  `Scrollable.getClientArea()`

#### deselectAll

    public void deselectAll()

Deprecated.
Deselects all items.

If an item is selected, it is deselected. If an item is not selected, it remains unselected.

Throws:
  `SWTException` -
  - ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
  - ERROR_WIDGET_DISPOSED when the widget has been disposed

#### getBackground

    public Color getBackground()

Deprecated.
Description copied from class: `Control`
Returns the receiver's background color.

Note: This operation is a hint and may be overridden by the platform. For example, on some versions of Windows the background of a TabFolder, is a gradient rather than a solid color.

Overrides:
  `getBackground` in class `Control`
Returns:
  the background color

#### getClientArea

    public Rectangle getClientArea()

Deprecated.
Description copied from class: `Scrollable`
Returns a rectangle which describes the area of the receiver which is capable of displaying data (that is, not covered by the "trimmings").

Overrides:
  `getClientArea` in class `Scrollable`
Returns:
  the client area
See Also:
  `Scrollable.computeTrim(int, int, int, int)`

#### getForeground

    public Color getForeground()

Deprecated.
Description copied from class: `Control`
Returns the foreground color that the receiver will use to draw.

Overrides:
  `getForeground` in class `Control`
Returns:
  the receiver's foreground color

#### getFont

    public Font getFont()

Deprecated.
Description copied from class: `Control`
Returns the font that the receiver will use to paint textual information.

Overrides:
  `getFont` in class `Control`
Returns:
  the receiver's font

#### getItemCount

    public int getItemCount()

Deprecated.
Gets the number of items.

Returns:
  the number of items in the widget

#### getItemHeight

    public int getItemHeight()

Deprecated.
Gets the height of one item.

This operation will fail if the height of one item could not be queried from the OS.

Returns:
  the height of one item in the widget
Throws:
  `SWTException` -
  - ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
  - ERROR_WIDGET_DISPOSED when the widget has been disposed

#### getItems

    public TableTreeItem[] getItems()

Deprecated.
Gets the items.

Returns:
  the items in the widget

#### getSelection

    public TableTreeItem[] getSelection()

Deprecated.
Gets the selected items.

This operation will fail if the selected items cannot be queried from the OS.

Returns:
  the selected items in the widget
Throws:
  `SWTException` -
  - ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
  - ERROR_WIDGET_DISPOSED when the widget has been disposed

#### getSelectionCount

    public int getSelectionCount()

Deprecated.
Gets the number of selected items.

This operation will fail if the number of selected items cannot be queried from the OS.

Returns:
  the number of selected items in the widget
Throws:
  `SWTException` -
  - ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
  - ERROR_WIDGET_DISPOSED when the widget has been disposed

#### getStyle

    public int getStyle()

Deprecated.
Description copied from class: `Widget`
Returns the receiver's style information.

Note that the value which is returned by this method may not match the value which was provided to the constructor when the receiver was created. This can occur when the underlying operating system does not support a particular combination of requested styles. For example, if the platform widget used to implement a particular SWT widget always has scroll bars, the result of calling this method would always have the `SWT.H_SCROLL` and `SWT.V_SCROLL` bits set.

Overrides:
  `getStyle` in class `Widget`
Returns:
  the style bits

#### getTable

    public Table getTable()

Deprecated.
Returns the underlying Table control.

Returns:
  the underlying Table control

#### indexOf

    public int indexOf(TableTreeItem item)

Deprecated.
Gets the index of an item.

The widget 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. This index is relative to the parent only.

Parameters:
  `item` - the search item
Returns:
  the index of the item or -1

#### getItem

    public TableTreeItem getItem(int index)

Deprecated.
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
Since:
  3.1

#### getItem

    public TableTreeItem getItem(Point point)

Deprecated.
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 point 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

#### removeAll

    public void removeAll()

Deprecated.
Removes all items.

This operation will fail when an item could not be removed in the OS.

Throws:
  `SWTException` -
  - ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
  - ERROR_WIDGET_DISPOSED when the widget has been disposed

#### removeSelectionListener

    public void removeSelectionListener(SelectionListener listener)

Deprecated.
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:
  `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)`

#### removeTreeListener

    public void removeTreeListener(TreeListener listener)

Deprecated.
Removes the listener from the collection of listeners who will be notified when items in the receiver are expanded or collapsed.

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:
  `TreeListener`, `addTreeListener(org.eclipse.swt.events.TreeListener)`

#### selectAll

    public void selectAll()

Deprecated.
Selects all of the items in the receiver.

If the receiver is single-select, do nothing.

Throws:
  `SWTException` -
  - ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
  - ERROR_WIDGET_DISPOSED when the widget has been disposed

#### setBackground

    public void setBackground(Color color)

Deprecated.
Description copied from class: `Control`
Sets the receiver's background color to the color specified by the argument, or to the default system color for the control if the argument is null.

Note: This operation is a hint and may be overridden by the platform. For example, on MAC the background of a Button cannot be changed.

Overrides:
  `setBackground` in class `Control`
Parameters:
  `color` - the new color (or null)

#### setEnabled

    public void setEnabled(boolean enabled)

Deprecated.
Description copied from class: `Control`
Enables the receiver if the argument is `true`, and disables it otherwise. A disabled control is typically not selectable from the user interface and draws with an inactive or "grayed" look.

Overrides:
  `setEnabled` in class `Control`
Parameters:
  `enabled` - the new enabled state

#### setFont

    public void setFont(Font font)

Deprecated.
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)

#### setForeground

    public void setForeground(Color color)

Deprecated.
Description copied from class: `Control`
Sets the receiver's foreground color to the color specified by the argument, or to the default system color for the control if the argument is null.

Note: This operation is a hint and may be overridden by the platform.

Overrides:
  `setForeground` in class `Control`
Parameters:
  `color` - the new color (or null)

#### setMenu

    public void setMenu(Menu menu)

Deprecated.
Description copied from class: `Control`
Sets the receiver's pop up menu to the argument. All controls may optionally have a pop up menu that is displayed when the user requests one for the control. The sequence of key strokes, button presses and/or button releases that are used to request a pop up menu is platform specific.

Note: Disposing of a control that has a pop up menu will dispose of the menu. To avoid this behavior, set the menu to null before the control is disposed.

Overrides:
  `setMenu` in class `Control`
Parameters:
  `menu` - the new pop up menu

#### setSelection

    public void setSelection(TableTreeItem[] items)

Deprecated.
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.

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()`

#### setToolTipText

    public void setToolTipText(String string)

Deprecated.
Description copied from class: `Control`
Sets the receiver's tool tip text to the argument, which may be null indicating that the default tool tip for the control will be shown. For a control that has a default tool tip, such as the Tree control on Windows, setting the tool tip text to an empty string replaces the default, causing no tool tip text to be shown.

The mnemonic indicator (character '&') is not displayed in a tool tip. To display a single '&' in the tool tip, the character '&' can be escaped by doubling it in the string.

Overrides:
  `setToolTipText` in class `Control`
Parameters:
  `string` - the new tool tip text (or null)

#### showItem

    public void showItem(TableTreeItem item)

Deprecated.
Shows the item. If the item is already showing in the receiver, this method simply returns. Otherwise, the items are scrolled and expanded 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()

Deprecated.
Shows the selection.

If there is no selection or the selection is already visible, this method does nothing. If the selection is scrolled out of view, the top index of the widget is changed such that selection becomes visible.

Throws:
  `SWTException` -
  - ERROR_THREAD_INVALID_ACCESS when called from the wrong thread
  - ERROR_WIDGET_DISPOSED when the widget has been disposed