Class GridTreeViewer
- java.lang.Object
-
- AbstractTreeViewer
-
- org.eclipse.nebula.jface.gridviewer.GridTreeViewer
-
public class GridTreeViewer extends AbstractTreeViewerA concrete viewer based on an Grid control.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
ITreeContentProviderinterface.The current implementation does not support lazy content providers.
-
-
Constructor Summary
Constructors Constructor Description GridTreeViewer(Grid grid)Creates a grid tree viewer on the given grid control.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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddTreeListener(Control control, TreeListener listener)protected ColumnViewerEditorcreateViewerEditor()protected intdoGetColumnCount()Returns the number of columns of this viewer.protected voiddoUpdateItem(Item item, java.lang.Object element)booleangetAutoPreferredHeight()protected Item[]getChildren(Widget o)protected WidgetgetColumnViewerOwner(int columnIndex)ControlgetControl()protected booleangetExpanded(Item item)GridgetGrid()Returns the underlyingGridControl.protected ItemgetItemAt(Point point)protected intgetItemCount(Control control)protected intgetItemCount(Item item)protected Item[]getItems(Item item)protected ItemgetParentItem(Item item)protected Item[]getSelection(Control control)protected ViewerRowgetViewerRowFromItem(Widget item)protected ItemnewItem(Widget parent, int style, int index)voidremove(java.lang.Object parentOrTreePath, int index)Removes the element at the specified index of the parent.protected voidremoveAll(Control control)voidsetAutoPreferredHeight(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 voidsetExpanded(Item item, boolean expand)voidsetRowHeaderLabelProvider(CellLabelProvider rowHeaderLabelProvider)Label provider used by calculate the row header textprotected voidsetSelection(java.util.List items)protected voidshowItem(Item item)
-
-
-
Constructor Detail
-
GridTreeViewer
public GridTreeViewer(Composite parent)
Creates a grid tree viewer on a newly-created grid control under the given parent. The grid control is created using the SWT style bitsMULTI, H_SCROLL, V_SCROLL,andBORDER. The viewer has no input, no content provider, a default label provider, no sorter, and no filters.- Parameters:
parent- the parent control
-
GridTreeViewer
public GridTreeViewer(Composite parent, int style)
Creates a grid tree viewer on a newly-created grid control under the given parent. The grid 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 controlstyle- the SWT style bits used to create the grid.
-
GridTreeViewer
public GridTreeViewer(Grid grid)
Creates a grid tree viewer on the given grid control. The viewer has no input, no content provider, a default label provider, no sorter, and no filters.- Parameters:
grid- the grid control
-
-
Method Detail
-
createViewerEditor
protected ColumnViewerEditor createViewerEditor()
-
addTreeListener
protected void addTreeListener(Control control, TreeListener listener)
-
getExpanded
protected boolean getExpanded(Item item)
-
getItemCount
protected int getItemCount(Control control)
-
getItemCount
protected int getItemCount(Item item)
-
removeAll
protected void removeAll(Control control)
-
setExpanded
protected void setExpanded(Item item, boolean expand)
-
setSelection
protected void setSelection(java.util.List items)
-
showItem
protected void showItem(Item item)
-
getControl
public Control getControl()
-
getViewerRowFromItem
protected ViewerRow getViewerRowFromItem(Widget item)
-
getColumnViewerOwner
protected Widget getColumnViewerOwner(int columnIndex)
-
doGetColumnCount
protected int doGetColumnCount()
Returns the number of columns of this viewer.- Returns:
- the number of columns
-
setAutoPreferredHeight
public 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. The default is false.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
GridViewerColumnto 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).
-
getAutoPreferredHeight
public boolean getAutoPreferredHeight()
- Returns:
- true if this grid viewer sizes its rows to their preferred height
- See Also:
setAutoPreferredHeight(boolean)
-
doUpdateItem
protected void doUpdateItem(Item item, java.lang.Object element)
-
remove
public void remove(java.lang.Object parentOrTreePath, int index)Removes the element at the specified index of the parent. The selection is updated if required.- Parameters:
parentOrTreePath- the parent element, the input element, or a tree path to the parent elementindex- child index- Since:
- 3.3
-
setRowHeaderLabelProvider
public void setRowHeaderLabelProvider(CellLabelProvider rowHeaderLabelProvider)
Label provider used by calculate the row header text- Parameters:
rowHeaderLabelProvider- the provider
-
-