|
Eclipse Platform 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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
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.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 |
Constructor Detail |
public TableTreeViewer(TableTree tree)
tree
- the table tree controlpublic TableTreeViewer(Composite parent)
MULTI, H_SCROLL, V_SCROLL, and BORDER
.
The viewer has no input, no content provider, a default label provider,
no sorter, and no filters.
parent
- the parent controlpublic TableTreeViewer(Composite parent, int style)
parent
- the parent controlstyle
- the SWT style bitsMethod Detail |
protected void addTreeListener(Control c, TreeListener listener)
AbstractTreeViewer
addTreeListener
in class AbstractTreeViewer
c
- the SWT controllistener
- the SWT tree listenerpublic void cancelEditing()
protected void doUpdateItem(Item item, Object element)
AbstractTreeViewer
doUpdateItem
in class AbstractTreeViewer
item
- the SWT itemelement
- the elementpublic void editElement(Object element, int column)
element
- the elementcolumn
- the column numberpublic CellEditor[] getCellEditors()
public ICellModifier getCellModifier()
protected Item[] getChildren(Widget o)
AbstractTreeViewer
getChildren
in class AbstractTreeViewer
o
- the widget
public Object[] getColumnProperties()
public Control getControl()
Viewer
getControl
in class Viewer
public Object getElementAt(int index)
null
if the index is out of range.
This method is internal to the framework.
index
- the zero-based index
null
if the
index is out of rangeprotected boolean getExpanded(Item item)
AbstractTreeViewer
getExpanded
in class AbstractTreeViewer
item
- the item
true
if the item is considered expanded
and false
if collapsedprotected Item getItem(int x, int y)
StructuredViewer
null
if there is no item at that location.
The default implementation of this method returns null
.
getItem
in class StructuredViewer
x
- horizontal coordinatey
- vertical coordinate
null
if there is no item at the
given coordinatesprotected int getItemCount(Control widget)
AbstractTreeViewer
getItemCount
in class AbstractTreeViewer
widget
- the control
protected int getItemCount(Item item)
AbstractTreeViewer
getItemCount
in class AbstractTreeViewer
item
- the item
protected Item[] getItems(Item item)
AbstractTreeViewer
getItems
in class AbstractTreeViewer
item
- the item
public IBaseLabelProvider getLabelProvider()
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.
getLabelProvider
in class ContentViewer
protected Item getParentItem(Item item)
AbstractTreeViewer
null
if there is parent item.
getParentItem
in class AbstractTreeViewer
item
- the item
null
if noneprotected Item[] getSelection(Control widget)
AbstractTreeViewer
getSelection
in class AbstractTreeViewer
widget
- the control
public TableTree getTableTree()
protected void hookControl(Control control)
ContentViewer
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.
hookControl
in class AbstractTreeViewer
control
- the controlpublic boolean isCellEditorActive()
true
if there is an active cell editor, and
false
otherwiseprotected Item newItem(Widget parent, int flags, int ix)
AbstractTreeViewer
newItem
in class AbstractTreeViewer
parent
- the parent widgetflags
- SWT style bitsix
- if non-negative, indicates the position to insert the item
into its parent
protected void removeAll(Control widget)
AbstractTreeViewer
removeAll
in class AbstractTreeViewer
widget
- the controlpublic void setCellEditors(CellEditor[] editors)
editors
- the list of cell editorspublic void setCellModifier(ICellModifier modifier)
modifier
- the cell modifierpublic void setColumnProperties(String[] columnProperties)
columnProperties
- the list of column propertiesprotected void setExpanded(Item node, boolean expand)
AbstractTreeViewer
setExpanded
in class AbstractTreeViewer
node
- the itemexpand
- the expand state of the itempublic void setLabelProvider(IBaseLabelProvider labelProvider)
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.
setLabelProvider
in class ContentViewer
labelProvider
- the label provider, or null
if noneprotected void setSelection(List items)
AbstractTreeViewer
setSelection
in class AbstractTreeViewer
items
- list of items (element type: org.eclipse.swt.widgets.Item
)protected void showItem(Item item)
AbstractTreeViewer
showItem
in class AbstractTreeViewer
item
- the item
|
Eclipse Platform 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |