Class GridTableViewer

java.lang.Object
AbstractTableViewer
org.eclipse.nebula.jface.gridviewer.GridTableViewer

public class GridTableViewer extends AbstractTableViewer
A 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 table viewers must not implement the ITreeContentProvider interface. Instead a GridTreeViewer should be used.

  • Constructor Details

    • GridTableViewer

      public GridTableViewer(Composite parent)
      Creates a grid viewer on a newly-created grid control under the given parent. The grid control is created using the SWT style bits MULTI, H_SCROLL, V_SCROLL, and BORDER. The viewer has no input, no content provider, a default label provider, no sorter, and no filters.
      Parameters:
      parent - the parent control
    • GridTableViewer

      public GridTableViewer(Composite parent, int style)
      Creates a grid 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 control
      style - the SWT style bits used to create the grid.
    • GridTableViewer

      public GridTableViewer(Grid grid)
      Creates a grid 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 Details

    • getGrid

      public Grid getGrid()
      Returns the underlying Grid Control.
      Returns:
      grid control.
    • internalCreateNewRowPart

      protected ViewerRow internalCreateNewRowPart(int style, int rowIndex)
    • createViewerEditor

      protected ColumnViewerEditor createViewerEditor()
    • doClear

      protected void doClear(int index)
    • doClearAll

      protected void doClearAll()
    • refresh

      public void refresh()
      See Also:
      • org.eclipse.jface.viewers.StructuredViewer#refresh()
    • doSetItemCount

      protected void doSetItemCount(int count)
    • doDeselectAll

      protected void doDeselectAll()
    • doGetColumn

      protected Widget doGetColumn(int index)
    • doGetColumnCount

      protected int doGetColumnCount()
    • doGetItem

      protected Item doGetItem(int index)
    • doGetItemCount

      protected int doGetItemCount()
    • doGetItems

      protected Item[] doGetItems()
    • doGetSelection

      protected Item[] doGetSelection()
    • doGetSelectionIndices

      protected int[] doGetSelectionIndices()
    • doIndexOf

      protected int doIndexOf(Item item)
    • doRemove

      protected void doRemove(int[] indices)
    • doRemove

      protected void doRemove(int start, int end)
    • doRemoveAll

      protected void doRemoveAll()
    • handleDispose

      protected void handleDispose(DisposeEvent event)
      (non-Javadoc)
      See Also:
      • fix crossed reference for GC
    • doSetSelection

      protected void doSetSelection(Item[] items)
    • doSetSelection

      protected void doSetSelection(int[] indices)
    • doShowItem

      protected void doShowItem(Item item)
    • doShowSelection

      protected void doShowSelection()
    • getItemAt

      protected Item getItemAt(Point point)
    • getControl

      public Control getControl()
    • getViewerRowFromItem

      protected ViewerRow getViewerRowFromItem(Widget item)
    • doResetItem

      protected void doResetItem(Item item)
    • doSelect

      protected void doSelect(int[] indices)
    • 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 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).

      Parameters:
      autoPreferredHeight -
    • getAutoPreferredHeight

      public boolean getAutoPreferredHeight()
      Returns:
      true if this grid viewer sizes its rows to their preferred height
      See Also:
    • doUpdateItem

      protected void doUpdateItem(Widget widget, Object element, boolean fullMap)
    • setRowHeaderLabelProvider

      public void setRowHeaderLabelProvider(CellLabelProvider rowHeaderLabelProvider)
      Label provider used by calculate the row header text
      Parameters:
      rowHeaderLabelProvider - the provider
    • refreshRowHeaders

      public void refreshRowHeaders(Object element)
      Refresh row headers only
      Parameters:
      element - the element to start or null if all rows should be refreshed
    • editElement

      public void editElement(Object element, int column)
    • setSelectionToWidget

      protected void setSelectionToWidget(ISelection selection, boolean reveal)
    • getSelection

      public ISelection getSelection()