Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.eclipse.jface.viewers
Class TableTreeViewer

    java.lang.Object
      org.eclipse.jface.viewers.Viewer
          org.eclipse.jface.viewers.ContentViewer
              org.eclipse.jface.viewers.StructuredViewer
                  org.eclipse.jface.viewers.AbstractTreeViewer
                      org.eclipse.jface.viewers.TableTreeViewer

All Implemented Interfaces:
  IInputProvider, IInputSelectionProvider, IPostSelectionProvider, ISelectionProvider

public class TableTreeViewer
extends AbstractTreeViewer

A concrete viewer based on a SWT `TableTree` control.

This class is not intended to be subclassed outside the viewer framework. It is designed to be instantiated with a pre-existing SWT table tree control and configured with a domain-specific content provider, label provider, element filter (optional), and element sorter (optional).

Content providers for table tree viewers must implement the `ITreeContentProvider` interface.

Label providers for table tree viewers must implement either the `ITableLabelProvider` or the `ILabelProvider` interface (see `TableTreeViewer.setLabelProvider` for more details).

Field Summary

Fields inherited from class org.eclipse.jface.viewers.AbstractTreeViewer
`ALL_LEVELS`

Fields inherited from class org.eclipse.jface.viewers.Viewer
`WIDGET_DATA_KEY`

Constructor Summary
`TableTreeViewer(Composite parent)` Creates a table tree viewer on a newly-created table tree control under the given parent.
`TableTreeViewer(Composite parent, int style)` Creates a table tree viewer on a newly-created table tree control under the given parent.
`TableTreeViewer(TableTree tree)` Creates a table tree viewer on the given table tree control.

Method Summary
`protected void` | `addTreeListener(Control c, TreeListener listener)` Adds the given SWT tree listener to the given SWT control.
`void` | `cancelEditing()` Cancels a currently active cell editor.
`protected void` | `doUpdateItem(Item item, Object element)` Copies the attributes of the given element into the given SWT item.
`void` | `editElement(Object element, int column)` Starts editing the given element.
`CellEditor[]` | `getCellEditors()` Returns the cell editors of this viewer.
`ICellModifier` | `getCellModifier()` Returns the cell modifier of this viewer.
`protected Item[]` | `getChildren(Widget o)` Returns the SWT child items for the given SWT widget.
`Object[]` | `getColumnProperties()` Returns the column properties of this viewer.
`Control` | `getControl()` Returns the primary control associated with this viewer.
`Object` | `getElementAt(int index)` Returns the element with the given index from this viewer.
`protected boolean` | `getExpanded(Item item)` Returns whether the given SWT item is expanded or collapsed.
`protected Item` | `getItem(int x, int y)` Returns the item at the given display-relative coordinates, or `null` if there is no item at that location.
`protected int` | `getItemCount(Control widget)` Returns the number of child items of the given SWT control.
`protected int` | `getItemCount(Item item)` Returns the number of child items of the given SWT item.
`protected Item[]` | `getItems(Item item)` Returns the child items of the given SWT item.
`IBaseLabelProvider` | `getLabelProvider()` The table tree viewer implementation of this `Viewer` framework method returns the label provider, which in the case of table tree viewers will be an instance of either `ITableLabelProvider` or `ILabelProvider`.
`protected Item` | `getParentItem(Item item)` Returns the parent item of the given item in the tree, or `null` if there is parent item.
`protected Item[]` | `getSelection(Control widget)` Returns all selected items for the given SWT control.
`TableTree` | `getTableTree()` Returns this table tree viewer's table tree control.
`protected void` | `hookControl(Control control)` Adds event listener hooks to the given control.
`boolean` | `isCellEditorActive()` Returns whether there is an active cell editor.
`protected Item` | `newItem(Widget parent, int flags, int ix)` Creates a new item.
`protected void` | `removeAll(Control widget)` Removes all items from the given control.
`void` | `setCellEditors(CellEditor[] editors)` Sets the cell editors of this table viewer.
`void` | `setCellModifier(ICellModifier modifier)` Sets the cell modifier of this table viewer.
`void` | `setColumnProperties(String[] columnProperties)` Sets the column properties of this table viewer.
`protected void` | `setExpanded(Item node, boolean expand)` Sets the expand state of the given item.
`void` | `setLabelProvider(IBaseLabelProvider labelProvider)` The table tree viewer implementation of this `Viewer` framework method ensures that the given label provider is an instance of either `ITableLabelProvider` or `ILabelProvider`.
`protected void` | `setSelection(List items)` Sets the selection to the given list of items.
`protected void` | `showItem(Item item)` Shows the given item.

Methods inherited from class org.eclipse.jface.viewers.AbstractTreeViewer
`add, add, addSelectionListener, addTreeListener, associate, collapseAll, collapseToLevel, createChildren, createTreeItem, disassociate, doFindInputItem, doFindItem, doUpdateItem, expandAll, expandToLevel, expandToLevel, fireTreeCollapsed, fireTreeExpanded, getAutoExpandLevel, getExpandedElements, getExpandedState, getNextItem, getPreviousItem, getRawChildren, getSelectionFromWidget, getVisibleExpandedElements, handleTreeCollapse, handleTreeExpand, indexForElement, inputChanged, internalCollapseToLevel, internalExpand, internalExpandToLevel, internalRefresh, internalRefresh, isExpandable, labelProviderChanged, remove, remove, removeTreeListener, reveal, scrollDown, scrollUp, setAutoExpandLevel, setContentProvider, setExpandedElements, setExpandedState, setSelectionToWidget, updateChildren, updatePlus`

Methods inherited from class org.eclipse.jface.viewers.StructuredViewer
`addDoubleClickListener, addDragSupport, addDropSupport, addFilter, addOpenListener, addPostSelectionChangedListener, assertElementsNotNull, equals, filter, findItem, fireDoubleClick, fireOpen, firePostSelectionChanged, getComparer, getFilteredChildren, getFilters, getRoot, getSelection, getSortedChildren, getSorter, handleDoubleSelect, handleInvalidSelection, handleLabelProviderChanged, handleOpen, handlePostSelect, handleSelect, hasFilters, mapElement, needsRefilter, preservingSelection, refresh, refresh, refresh, refresh, refreshItem, removeDoubleClickListener, removeFilter, removeOpenListener, removePostSelectionChangedListener, resetFilters, setComparer, setInput, setSelection, setSelectionToWidget, setSorter, setUseHashlookup, testFindItem, unmapAllElements, unmapElement, unmapElement, update, update, updateItem, updateSelection, usingElementMap`

Methods inherited from class org.eclipse.jface.viewers.ContentViewer
`getContentProvider, getInput, handleDispose`

Methods inherited from class org.eclipse.jface.viewers.Viewer
`addHelpListener, addSelectionChangedListener, fireHelpRequested, fireSelectionChanged, getData, handleHelpRequest, removeHelpListener, removeSelectionChangedListener, setData, setSelection`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.eclipse.jface.viewers.ISelectionProvider
`addSelectionChangedListener, removeSelectionChangedListener, setSelection`

Constructor Detail

### TableTreeViewer

    public TableTreeViewer(TableTree tree)

  Creates a table tree viewer on the given table tree control. The viewer has no input, no content provider, a default label provider, no sorter, and no filters.

Parameters:
  `tree` - the table tree control

### TableTreeViewer

    public TableTreeViewer(Composite parent)

  Creates a table tree viewer on a newly-created table tree control under the given parent. The table tree control is created using the SWT style bits `MULTI, H_SCROLL, V_SCROLL, and BORDER`. The viewer has no input, no content provider, a default label provider, no sorter, and no filters.

Parameters:
  `parent` - the parent control

### TableTreeViewer

    public TableTreeViewer(Composite parent,
                           int style)

  Creates a table tree viewer on a newly-created table tree control under the given parent. The table tree control is created using the given SWT style bits. The viewer has no input, no content provider, a default label provider, no sorter, and no filters.

Parameters:
  `parent` - the parent control
  `style` - the SWT style bits

Method Detail

### addTreeListener

    protected void addTreeListener(Control c,
                                   TreeListener listener)

  Description copied from class: `AbstractTreeViewer`
  Adds the given SWT tree listener to the given SWT control.

  Specified by:
    `addTreeListener` in class `AbstractTreeViewer`
  Parameters:
    `c` - the SWT control
    `listener` - the SWT tree listener

### cancelEditing

    public void cancelEditing()

  Cancels a currently active cell editor. All changes already done in the cell editor are lost.

### doUpdateItem

    protected void doUpdateItem(Item item,
                                Object element)

  Description copied from class: `AbstractTreeViewer`
  Copies the attributes of the given element into the given SWT item.

  Specified by:
    `doUpdateItem` in class `AbstractTreeViewer`
  Parameters:
    `item` - the SWT item
    `element` - the element

### editElement

    public void editElement(Object element,
                            int column)

  Starts editing the given element.

  Parameters:
    `element` - the element
    `column` - the column number

### getCellEditors

    public CellEditor[] getCellEditors()

  Returns the cell editors of this viewer.

  Returns:
    the list of cell editors

### getCellModifier

    public ICellModifier getCellModifier()

  Returns the cell modifier of this viewer.

  Returns:
    the cell modifier

### getChildren

    protected Item[] getChildren(Widget o)

  Description copied from class: `AbstractTreeViewer`
  Returns the SWT child items for the given SWT widget.

  Specified by:
    `getChildren` in class `AbstractTreeViewer`
  Parameters:
    `o` - the widget
  Returns:
    the child items

### getColumnProperties

    public Object[] getColumnProperties()

  Returns the column properties of this viewer. The properties must correspond with the columns of the table control. They are used to identify the column in a cell modifier.

  Returns:
    the list of column properties

### getControl

    public Control getControl()

  Description copied from class: `Viewer`
  Returns the primary control associated with this viewer.

  Specified by:
    `getControl` in class `Viewer`
  Returns:
    the SWT control which displays this viewer's content

### getElementAt

    public Object getElementAt(int index)

  Returns the element with the given index from this viewer. Returns `null` if the index is out of range.

  This method is internal to the framework.

  Parameters:
    `index` - the zero-based index
  Returns:
    the element at the given index, or `null` if the index is out of range

### getExpanded

    protected boolean getExpanded(Item item)

  Description copied from class: `AbstractTreeViewer`
  Returns whether the given SWT item is expanded or collapsed.

  Specified by:
    `getExpanded` in class `AbstractTreeViewer`
  Parameters:
    `item` - the item
  Returns:
    `true` if the item is considered expanded and `false` if collapsed

### getItem

    protected Item getItem(int x,
                           int y)

  Description copied from class: `StructuredViewer`
  Returns the item at the given display-relative coordinates, or `null` if there is no item at that location.

  The default implementation of this method returns `null`.

  Overrides:
    `getItem` in class `StructuredViewer`
  Parameters:
    `x` - horizontal coordinate
    `y` - vertical coordinate
  Returns:
    the item, or `null` if there is no item at the given coordinates

### getItemCount

    protected int getItemCount(Control widget)

  Description copied from class: `AbstractTreeViewer`
  Returns the number of child items of the given SWT control.

  Specified by:
    `getItemCount` in class `AbstractTreeViewer`
  Parameters:
    `widget` - the control
  Returns:
    the number of children

### getItemCount

    protected int getItemCount(Item item)

  Description copied from class: `AbstractTreeViewer`
  Returns the number of child items of the given SWT item.

  Specified by:
    `getItemCount` in class `AbstractTreeViewer`
  Parameters:
    `item` - the item
  Returns:
    the number of children

### getItems

    protected Item[] getItems(Item item)

  Description copied from class: `AbstractTreeViewer`
  Returns the child items of the given SWT item.

  Specified by:
    `getItems` in class `AbstractTreeViewer`
  Parameters:
    `item` - the item
  Returns:
    the child items

### getLabelProvider

    public IBaseLabelProvider getLabelProvider()

  The table tree viewer implementation of this `Viewer` framework method returns the label provider, which in the case of table tree viewers will be an instance of either `ITableLabelProvider` or `ILabelProvider`. If it is an `ITableLabelProvider`, then it provides a separate label text and image for each column. If it is an `ILabelProvider`, then it provides only the label text and image for the first column, and any remaining columns are blank.

  Overrides:
    `getLabelProvider` in class `ContentViewer`
  Returns:
    a label provider

### getParentItem

    protected Item getParentItem(Item item)

  Description copied from class: `AbstractTreeViewer`
  Returns the parent item of the given item in the tree, or `null` if there is parent item.

  Specified by:
    `getParentItem` in class `AbstractTreeViewer`
  Parameters:
    `item` - the item
  Returns:
    the parent item, or `null` if none

### getSelection

    protected Item[] getSelection(Control widget)

  Description copied from class: `AbstractTreeViewer`
  Returns all selected items for the given SWT control.

  Specified by:
    `getSelection` in class `AbstractTreeViewer`
  Parameters:
    `widget` - the control
  Returns:
    the list of selected items

### getTableTree

    public TableTree getTableTree()

  Returns this table tree viewer's table tree control.

  Returns:
    the table tree control

### hookControl

    protected void hookControl(Control control)

  Description copied from class: `ContentViewer`
  Adds event listener hooks to the given control.

  All subclasses must call this method when their control is first established.

  The `ContentViewer` implementation of this method hooks dispose events for the given control. Subclasses may override if they need to add other control hooks; however, `super.hookControl` must be invoked.

  Overrides:
    `hookControl` in class `AbstractTreeViewer`

### isCellEditorActive

    public boolean isCellEditorActive()

  Returns whether there is an active cell editor.

  Returns:
    `true` if there is an active cell editor, and `false` otherwise

### newItem

    protected Item newItem(Widget parent,
                           int flags,
                           int ix)

  Description copied from class: `AbstractTreeViewer`
  Creates a new item.

  Specified by:
    `newItem` in class `AbstractTreeViewer`
  Parameters:
    `parent` - the parent widget
    `flags` - SWT style bits
    `ix` - if non-negative, indicates the position to insert the item into its parent
  Returns:
    the newly-created item

### removeAll

    protected void removeAll(Control widget)

  Description copied from class: `AbstractTreeViewer`
  Removes all items from the given control.

  Specified by:
    `removeAll` in class `AbstractTreeViewer`
  Parameters:
    `widget` - the control

### setCellEditors

    public void setCellEditors(CellEditor[] editors)

  Sets the cell editors of this table viewer.

  Parameters:
    `editors` - the list of cell editors

### setCellModifier

    public void setCellModifier(ICellModifier modifier)

  Sets the cell modifier of this table viewer.

  Parameters:
    `modifier` - the cell modifier

### setColumnProperties

    public void setColumnProperties(String[] columnProperties)

  Sets the column properties of this table viewer. The properties must correspond with the columns of the table control. They are used to identify the column in a cell modifier.

  Parameters:
    `columnProperties` - the list of column properties

### setExpanded

    protected void setExpanded(Item node,
                               boolean expand)

  Description copied from class: `AbstractTreeViewer`
  Sets the expand state of the given item.

  Specified by:
    `setExpanded` in class `AbstractTreeViewer`
  Parameters:
    `node` - the item
    `expand` - the expand state of the item

### setLabelProvider

    public void setLabelProvider(IBaseLabelProvider labelProvider)

  The table tree viewer implementation of this `Viewer` framework method ensures that the given label provider is an instance of either `ITableLabelProvider` or `ILabelProvider`. If it is an `ITableLabelProvider`, then it provides a separate label text and image for each column. If it is an `ILabelProvider`, then it provides only the label text and image for the first column, and any remaining columns are blank.

  Overrides:
    `setLabelProvider` in class `ContentViewer`
  Parameters:
    `labelProvider` - the label provider, or `null` if none

### setSelection

    protected void setSelection(List items)

  Description copied from class: `AbstractTreeViewer`
  Sets the selection to the given list of items.

  Specified by:
    `setSelection` in class `AbstractTreeViewer`
  Parameters:
    `items` - list of items (element type: `org.eclipse.swt.widgets.Item`)

### showItem

    protected void showItem(Item item)

  Description copied from class: `AbstractTreeViewer`
  Shows the given item.

  Specified by:
    `showItem` in class `AbstractTreeViewer`
  Parameters:
    `item` - the item

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Eclipse Platform Release 3.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.