public class GridTreeViewer
extends org.eclipse.jface.viewers.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(org.eclipse.swt.widgets.Composite parent)
Creates a grid tree viewer on a newly-created grid control under the given
parent.
|
GridTreeViewer(org.eclipse.swt.widgets.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(org.eclipse.swt.widgets.Control control,
org.eclipse.swt.events.TreeListener listener) |
protected org.eclipse.jface.viewers.ColumnViewerEditor |
createViewerEditor() |
protected int |
doGetColumnCount()
Returns the number of columns of this viewer.
|
protected void |
doUpdateItem(org.eclipse.swt.widgets.Item item,
java.lang.Object element) |
boolean |
getAutoPreferredHeight() |
protected org.eclipse.swt.widgets.Item[] |
getChildren(org.eclipse.swt.widgets.Widget o) |
protected org.eclipse.swt.widgets.Widget |
getColumnViewerOwner(int columnIndex) |
org.eclipse.swt.widgets.Control |
getControl() |
protected boolean |
getExpanded(org.eclipse.swt.widgets.Item item) |
Grid |
getGrid()
Returns the underlying
Grid Control. |
protected org.eclipse.swt.widgets.Item |
getItemAt(org.eclipse.swt.graphics.Point point) |
protected int |
getItemCount(org.eclipse.swt.widgets.Control control) |
protected int |
getItemCount(org.eclipse.swt.widgets.Item item) |
protected org.eclipse.swt.widgets.Item[] |
getItems(org.eclipse.swt.widgets.Item item) |
protected org.eclipse.swt.widgets.Item |
getParentItem(org.eclipse.swt.widgets.Item item) |
protected org.eclipse.swt.widgets.Item[] |
getSelection(org.eclipse.swt.widgets.Control control) |
protected org.eclipse.jface.viewers.ViewerRow |
getViewerRowFromItem(org.eclipse.swt.widgets.Widget item) |
protected org.eclipse.swt.widgets.Item |
newItem(org.eclipse.swt.widgets.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(org.eclipse.swt.widgets.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(org.eclipse.swt.widgets.Item item,
boolean expand) |
void |
setRowHeaderLabelProvider(org.eclipse.jface.viewers.CellLabelProvider rowHeaderLabelProvider)
Label provider used by calculate the row header text
|
protected void |
setSelection(java.util.List items) |
protected void |
showItem(org.eclipse.swt.widgets.Item item) |
add, add, addSelectionListener, addTreeListener, assertContentProviderType, associate, buildLabel, collapseAll, collapseToLevel, createChildren, createTreeItem, disassociate, doFindInputItem, doFindItem, doUpdateItem, expandAll, expandAll, expandToLevel, expandToLevel, expandToLevel, expandToLevel, fireTreeCollapsed, fireTreeExpanded, getAutoExpandLevel, getChild, getChildren, getExpandedElements, getExpandedState, getExpandedTreePaths, getNextItem, getParentElement, getPreviousItem, getRawChildren, getSelection, getSelectionFromWidget, getSortedChildren, getStructuredSelection, getTreePathFromItem, getVisibleExpandedElements, handleDoubleSelect, handleTreeCollapse, handleTreeExpand, hookControl, indexForElement, inputChanged, insert, internalAdd, internalCollapseToLevel, internalExpand, internalExpandToLevel, internalFindItems, internalGetWidgetToSelect, internalInitializeTree, internalIsInputOrEmptyPath, internalRefresh, internalRefresh, internalRefresh, internalRemove, internalRemove, isExpandable, isSameSelection, labelProviderChanged, remove, remove, remove, removeTreeListener, reveal, scrollDown, scrollUp, setAutoExpandLevel, setContentProvider, setExpandedElements, setExpandedState, setExpandedTreePaths, setExpandPreCheckFilters, setSelectionToWidget, setSelectionToWidget, updateChildren, updatePlus
applyEditorValue, cancelEditing, checkBusy, editElement, getCell, getCellEditors, getCellModifier, getColumnProperties, getColumnViewerEditor, getItem, getLabelProvider, getViewerRow, handleDispose, hookEditingSupport, isBusy, isCellEditorActive, refresh, refresh, setBusy, setCellEditors, setCellModifier, setColumnProperties, setColumnViewerEditor, setLabelProvider, triggerEditorActivationEvent, update
addDoubleClickListener, addDragSupport, addDropSupport, addFilter, addOpenListener, addPostSelectionChangedListener, assertElementsNotNull, equals, filter, findItem, findItems, fireDoubleClick, fireOpen, firePostSelectionChanged, getColorAndFontCollector, getComparator, getComparer, getFilteredChildren, getFilters, getRoot, getSorter, handleInvalidSelection, handleLabelProviderChanged, handleOpen, handlePostSelect, handleSelect, hasFilters, internalUpdate, mapElement, needsRefilter, preservingSelection, refresh, refresh, refreshItem, removeDoubleClickListener, removeFilter, removeOpenListener, removePostSelectionChangedListener, resetFilters, setComparator, setComparer, setFilters, setInput, setSelection, setSorter, setUseHashlookup, testFindItem, testFindItems, unmapAllElements, unmapElement, unmapElement, update, updateItem, updateSelection, usingElementMap
getContentProvider, getInput, getLabelProvider
addHelpListener, addSelectionChangedListener, fireHelpRequested, fireSelectionChanged, getData, handleHelpRequest, removeHelpListener, removeSelectionChangedListener, setData, setSelection
public GridTreeViewer(org.eclipse.swt.widgets.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(org.eclipse.swt.widgets.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 org.eclipse.swt.widgets.Item getItemAt(org.eclipse.swt.graphics.Point point)
getItemAt
in class org.eclipse.jface.viewers.AbstractTreeViewer
protected org.eclipse.jface.viewers.ColumnViewerEditor createViewerEditor()
createViewerEditor
in class org.eclipse.jface.viewers.AbstractTreeViewer
protected void addTreeListener(org.eclipse.swt.widgets.Control control, org.eclipse.swt.events.TreeListener listener)
addTreeListener
in class org.eclipse.jface.viewers.AbstractTreeViewer
protected org.eclipse.swt.widgets.Item[] getChildren(org.eclipse.swt.widgets.Widget o)
getChildren
in class org.eclipse.jface.viewers.AbstractTreeViewer
protected boolean getExpanded(org.eclipse.swt.widgets.Item item)
getExpanded
in class org.eclipse.jface.viewers.AbstractTreeViewer
protected int getItemCount(org.eclipse.swt.widgets.Control control)
getItemCount
in class org.eclipse.jface.viewers.AbstractTreeViewer
protected int getItemCount(org.eclipse.swt.widgets.Item item)
getItemCount
in class org.eclipse.jface.viewers.AbstractTreeViewer
protected org.eclipse.swt.widgets.Item[] getItems(org.eclipse.swt.widgets.Item item)
getItems
in class org.eclipse.jface.viewers.AbstractTreeViewer
protected org.eclipse.swt.widgets.Item getParentItem(org.eclipse.swt.widgets.Item item)
getParentItem
in class org.eclipse.jface.viewers.AbstractTreeViewer
protected org.eclipse.swt.widgets.Item[] getSelection(org.eclipse.swt.widgets.Control control)
getSelection
in class org.eclipse.jface.viewers.AbstractTreeViewer
protected org.eclipse.swt.widgets.Item newItem(org.eclipse.swt.widgets.Widget parent, int style, int index)
newItem
in class org.eclipse.jface.viewers.AbstractTreeViewer
protected void removeAll(org.eclipse.swt.widgets.Control control)
removeAll
in class org.eclipse.jface.viewers.AbstractTreeViewer
protected void setExpanded(org.eclipse.swt.widgets.Item item, boolean expand)
setExpanded
in class org.eclipse.jface.viewers.AbstractTreeViewer
protected void setSelection(java.util.List items)
setSelection
in class org.eclipse.jface.viewers.AbstractTreeViewer
protected void showItem(org.eclipse.swt.widgets.Item item)
showItem
in class org.eclipse.jface.viewers.AbstractTreeViewer
public org.eclipse.swt.widgets.Control getControl()
getControl
in class org.eclipse.jface.viewers.Viewer
protected org.eclipse.jface.viewers.ViewerRow getViewerRowFromItem(org.eclipse.swt.widgets.Widget item)
getViewerRowFromItem
in class org.eclipse.jface.viewers.AbstractTreeViewer
protected org.eclipse.swt.widgets.Widget getColumnViewerOwner(int columnIndex)
getColumnViewerOwner
in class org.eclipse.jface.viewers.AbstractTreeViewer
protected int doGetColumnCount()
doGetColumnCount
in class org.eclipse.jface.viewers.AbstractTreeViewer
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(org.eclipse.swt.widgets.Item item, java.lang.Object element)
doUpdateItem
in class org.eclipse.jface.viewers.AbstractTreeViewer
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(org.eclipse.jface.viewers.CellLabelProvider rowHeaderLabelProvider)
rowHeaderLabelProvider
- the provider