public class GridTreeViewer
extends AbstractTreeViewer
This class is not intended to be subclassed outside the viewer framework. It is designed to be instantiated with a pre-existing Grid control and configured with a domain-specific content provider, label provider, element filter (optional), and element sorter (optional).
Content providers for grid tree viewers must implement the ITreeContentProvider
interface.
The current implementation does not support lazy content providers.
Constructor and Description |
---|
GridTreeViewer(Composite parent)
Creates a grid tree viewer on a newly-created grid control under the given parent.
|
GridTreeViewer(Composite parent,
int style)
Creates a grid tree viewer on a newly-created grid control under the given parent.
|
GridTreeViewer(Grid grid)
Creates a grid tree viewer on the given grid control.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addTreeListener(Control control,
TreeListener listener) |
protected ColumnViewerEditor |
createViewerEditor() |
protected int |
doGetColumnCount()
Returns the number of columns of this viewer.
|
protected void |
doUpdateItem(Item item,
java.lang.Object element) |
boolean |
getAutoPreferredHeight() |
protected Item[] |
getChildren(Widget o) |
protected Widget |
getColumnViewerOwner(int columnIndex) |
Control |
getControl() |
protected boolean |
getExpanded(Item item) |
Grid |
getGrid()
Returns the underlying
Grid Control. |
protected Item |
getItemAt(Point point) |
protected int |
getItemCount(Control control) |
protected int |
getItemCount(Item item) |
protected Item[] |
getItems(Item item) |
protected Item |
getParentItem(Item item) |
protected Item[] |
getSelection(Control control) |
protected ViewerRow |
getViewerRowFromItem(Widget item) |
protected Item |
newItem(Widget parent,
int style,
int index) |
void |
remove(java.lang.Object parentOrTreePath,
int index)
Removes the element at the specified index of the parent.
|
protected void |
removeAll(Control control) |
void |
setAutoPreferredHeight(boolean autoPreferredHeight)
When set to true, this grid viewer will ensure that each of the grid's items is always
automatically sized to its preferred height.
|
protected void |
setExpanded(Item item,
boolean expand) |
void |
setRowHeaderLabelProvider(CellLabelProvider rowHeaderLabelProvider)
Label provider used by calculate the row header text
|
protected void |
setSelection(java.util.List items) |
protected void |
showItem(Item item) |
public GridTreeViewer(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 GridTreeViewer(Composite parent, int style)
parent
- the parent controlstyle
- the SWT style bits used to create the grid.public GridTreeViewer(Grid grid)
grid
- the grid controlprotected ColumnViewerEditor createViewerEditor()
protected void addTreeListener(Control control, TreeListener listener)
protected boolean getExpanded(Item item)
protected int getItemCount(Control control)
protected int getItemCount(Item item)
protected void removeAll(Control control)
protected void setExpanded(Item item, boolean expand)
protected void setSelection(java.util.List items)
protected void showItem(Item item)
public Control getControl()
protected ViewerRow getViewerRowFromItem(Widget item)
protected Widget getColumnViewerOwner(int columnIndex)
protected int doGetColumnCount()
public void setAutoPreferredHeight(boolean autoPreferredHeight)
Since this mechanism usually leads to a grid with rows of different heights and thus to a grid
with decreased performance, it should only be applied if that is intended. To set the height of
all items to a specific value, use Grid.setItemHeight(int)
instead.
When a column with activated word wrapping is resized by dragging the column resizer, the items
are only auto-resized properly if you use GridViewerColumn
to create the columns.
When this method is called, existing rows are not resized to their preferred height. Therefore it is suggested that this method be called before rows are populated (i.e. before setInput).
public boolean getAutoPreferredHeight()
setAutoPreferredHeight(boolean)
protected void doUpdateItem(Item item, java.lang.Object element)
public void remove(java.lang.Object parentOrTreePath, int index)
parentOrTreePath
- the parent element, the input element, or a tree path to the parent
elementindex
- child indexpublic void setRowHeaderLabelProvider(CellLabelProvider rowHeaderLabelProvider)
rowHeaderLabelProvider
- the provider
Copyright (c) EclipseSource and others 2002, 2020.
All rights reserved. This program and the accompanying materials
are made available under the terms of the
Eclipse Public License v1.0