public class GridTableViewer
extends AbstractTableViewer
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 table viewers must not implement the ITreeContentProvider
interface. Instead a GridTreeViewer
should be used.
Constructor and Description |
---|
GridTableViewer(Composite parent)
Creates a grid viewer on a newly-created grid control under the given parent.
|
GridTableViewer(Composite parent,
int style)
Creates a grid viewer on a newly-created grid control under the given parent.
|
GridTableViewer(Grid grid)
Creates a grid viewer on the given grid control.
|
Modifier and Type | Method and Description |
---|---|
protected ColumnViewerEditor |
createViewerEditor() |
protected void |
doClear(int index) |
protected void |
doClearAll() |
protected void |
doDeselectAll() |
protected Widget |
doGetColumn(int index) |
protected int |
doGetColumnCount() |
protected Item |
doGetItem(int index) |
protected int |
doGetItemCount() |
protected Item[] |
doGetItems() |
protected Item[] |
doGetSelection() |
protected int[] |
doGetSelectionIndices() |
protected int |
doIndexOf(Item item) |
protected void |
doRemove(int[] indices) |
protected void |
doRemove(int start,
int end) |
protected void |
doRemoveAll() |
protected void |
doResetItem(Item item) |
protected void |
doSelect(int[] indices) |
protected void |
doSetItemCount(int count) |
protected void |
doSetSelection(int[] indices) |
protected void |
doSetSelection(Item[] items) |
protected void |
doShowItem(Item item) |
protected void |
doShowSelection() |
protected void |
doUpdateItem(Widget widget,
java.lang.Object element,
boolean fullMap) |
void |
editElement(java.lang.Object element,
int column) |
boolean |
getAutoPreferredHeight() |
Control |
getControl() |
Grid |
getGrid()
Returns the underlying Grid Control.
|
protected Item |
getItemAt(Point point) |
ISelection |
getSelection() |
protected ViewerRow |
getViewerRowFromItem(Widget item) |
protected void |
handleDispose(DisposeEvent event)
(non-Javadoc)
|
protected ViewerRow |
internalCreateNewRowPart(int style,
int rowIndex) |
void |
refresh() |
void |
refreshRowHeaders(java.lang.Object element)
Refresh row headers only
|
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.
|
void |
setRowHeaderLabelProvider(CellLabelProvider rowHeaderLabelProvider)
Label provider used by calculate the row header text
|
protected void |
setSelectionToWidget(ISelection selection,
boolean reveal) |
public GridTableViewer(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 GridTableViewer(Composite parent, int style)
parent
- the parent controlstyle
- the SWT style bits used to create the grid.public GridTableViewer(Grid grid)
grid
- the grid controlpublic Grid getGrid()
protected ViewerRow internalCreateNewRowPart(int style, int rowIndex)
protected ColumnViewerEditor createViewerEditor()
protected void doClear(int index)
protected void doClearAll()
public void refresh()
org.eclipse.jface.viewers.StructuredViewer#refresh()
protected void doSetItemCount(int count)
protected void doDeselectAll()
protected Widget doGetColumn(int index)
protected int doGetColumnCount()
protected Item doGetItem(int index)
protected int doGetItemCount()
protected Item[] doGetItems()
protected Item[] doGetSelection()
protected int[] doGetSelectionIndices()
protected int doIndexOf(Item item)
protected void doRemove(int[] indices)
protected void doRemove(int start, int end)
protected void doRemoveAll()
protected void handleDispose(DisposeEvent event)
fix crossed reference for GC
protected void doSetSelection(Item[] items)
protected void doSetSelection(int[] indices)
protected void doShowItem(Item item)
protected void doShowSelection()
public Control getControl()
protected ViewerRow getViewerRowFromItem(Widget item)
protected void doResetItem(Item item)
protected void doSelect(int[] indices)
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).
autoPreferredHeight
- public boolean getAutoPreferredHeight()
setAutoPreferredHeight(boolean)
protected void doUpdateItem(Widget widget, java.lang.Object element, boolean fullMap)
public void setRowHeaderLabelProvider(CellLabelProvider rowHeaderLabelProvider)
rowHeaderLabelProvider
- the providerpublic void refreshRowHeaders(java.lang.Object element)
element
- the element to start or null
if all rows should be refreshedpublic void editElement(java.lang.Object element, int column)
protected void setSelectionToWidget(ISelection selection, boolean reveal)
public ISelection getSelection()
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