Class Grid

java.lang.Object
org.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Control
org.eclipse.swt.widgets.Scrollable
org.eclipse.swt.widgets.Composite
org.eclipse.swt.widgets.Canvas
org.eclipse.nebula.widgets.grid.Grid
All Implemented Interfaces:
org.eclipse.swt.graphics.Drawable

public class Grid
extends org.eclipse.swt.widgets.Canvas
The Grid widget is a spreadsheet/table component that offers features not currently found in the base SWT Table. Features include cell selection, column grouping, column spanning, row headers, and more.

The item children that may be added to instances of this class must be of type GridItem.

Styles:
SWT.SINGLE, SWT.MULTI, SWT.NO_FOCUS, SWT.CHECK, SWT.VIRTUAL
Events:
Selection, DefaultSelection
  • Nested Class Summary

    Nested Classes 
    Modifier and Type Class Description
    static class  Grid.GridVisibleRange
    Object holding the visible range
  • Field Summary

    Fields 
    Modifier and Type Field Description
    (package private) int bottomIndex
    Index of last visible item.
    (package private) int endColumnIndex
    Index of the the last visible column.
    (package private) boolean hasDifferingHeights
    True if there is at least one GridItem with an individual height.
    (package private) boolean hoveringOnColumnResizer
    True if mouse is hover on a column boundary and can resize the column.
    (package private) int startColumnIndex
    Index of the first visible column.
    (package private) int topIndex
    Index of first visible item.

    Fields inherited from class org.eclipse.swt.widgets.Control

    handle
  • Constructor Summary

    Constructors 
    Constructor Description
    Grid​(DataVisualizer dataVisualizer, org.eclipse.swt.widgets.Composite parent, int style)
    Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.
    Grid​(org.eclipse.swt.widgets.Composite parent, int style)
    Grid with generic DataVisualizer
  • Method Summary

    Modifier and Type Method Description
    void addListener​(int eventType, org.eclipse.swt.widgets.Listener listener)  
    void addMouseListener​(org.eclipse.swt.events.MouseListener sourceListener)  
    void addSelectionListener​(org.eclipse.swt.events.SelectionListener listener)
    Adds the listener to the collection of listeners who will be notified when the receiver's selection changes, by sending it one of the messages defined in the SelectionListener interface.
    void addTreeListener​(org.eclipse.swt.events.TreeListener listener)
    Adds the listener to the collection of listeners who will be notified when the receiver's items changes, by sending it one of the messages defined in the TreeListener interface.
    void clear​(int[] indices, boolean allChildren)
    Clears the items at the given zero-relative indices in the receiver.
    void clear​(int index, boolean allChildren)
    Clears the item at the given zero-relative index in the receiver.
    void clear​(int start, int end, boolean allChildren)
    Clears the items in the receiver which are between the given zero-relative start and end indices (inclusive).
    void clearAll​(boolean allChildren)
    Clears all the items in the receiver.
    void clearItems()
    Clear simply all GridItems
    org.eclipse.swt.graphics.Point computeSize​(int wHint, int hHint, boolean changed)
    void deselect​(int index)
    Deselects the item at the given zero-relative index in the receiver.
    void deselect​(int[] indices)
    Deselects the items at the given zero-relative indices in the receiver.
    void deselect​(int start, int end)
    Deselects the items at the given zero-relative indices in the receiver.
    void deselectAll()
    Deselects all selected items in the receiver.
    void deselectAllCells()
    Deselects all selected cells in the receiver.
    void deselectCell​(org.eclipse.swt.graphics.Point cell)
    Deselects the given cell in the receiver.
    void deselectCells​(org.eclipse.swt.graphics.Point[] cells)
    Deselects the given cells.
    void disableDefaultKeyListener()
    Disable default key listener
    void disposeAllItems()
    All items needs to call the disposeOnly method
    void enableDefaultKeyListener()
    Enable default key listener
    (package private) void fireColumnsMoved()  
    org.eclipse.swt.graphics.Color getBackground()
    (package private) int getBottomIndex()
    Returns the zero-relative index of the item which is currently at the bottom of the receiver.
    IRenderer getBottomLeftRenderer()
    Gets the bottom left renderer.
    org.eclipse.swt.graphics.Point getCell​(org.eclipse.swt.graphics.Point point)
    Returns the cell at the given point in the receiver or null if no such cell exists.
    org.eclipse.swt.graphics.Color getCellHeaderSelectionBackground()
    Returns the background color of column and row headers when a cell in the row or header is selected.
    org.eclipse.swt.graphics.Point[] getCellSelection()
    Returns an array of cells that are currently selected in the receiver.
    int getCellSelectionCount()
    Returns the number of selected cells contained in the receiver.
    boolean getCellSelectionEnabled()
    Returns true if the cells are selectable in the reciever.
    GridColumn getColumn​(int index)
    Returns the column at the given, zero-relative index in the receiver.
    GridColumn getColumn​(org.eclipse.swt.graphics.Point point)
    Returns the column at the given point in the receiver or null if no such column exists.
    int getColumnCount()
    Returns the number of columns contained in the receiver.
    GridColumnGroup getColumnGroup​(int index)
    Returns the column group at the given, zero-relative index in the receiver.
    int getColumnGroupCount()
    Returns the number of column groups contained in the receiver.
    GridColumnGroup[] getColumnGroups()
    Returns an array of GridColumnGroups which are the column groups in the receiver.
    int[] getColumnOrder()
    Returns an array of zero-relative integers that map the creation order of the receiver's items to the order in which they are currently being displayed.
    GridColumn[] getColumns()
    Returns an array of GridColumns which are the columns in the receiver.
    boolean getColumnScrolling()
    Returns true if the table is set to horizontally scroll column-by-column rather than pixel-by-pixel.
    (package private) GridColumn[] getColumnsInOrder()
    Returns an array of the columns in their display order.
    DataVisualizer getDataVisualizer()  
    GridCellRenderer getEmptyCellRenderer()
    Returns the empty cell renderer.
    IRenderer getEmptyColumnFooterRenderer()
    Returns the empty column footer renderer.
    IRenderer getEmptyColumnHeaderRenderer()
    Returns the empty column header renderer.
    IRenderer getEmptyRowHeaderRenderer()
    Returns the empty row header renderer.
    (package private) int getEndColumnIndex()  
    org.eclipse.swt.graphics.Point getFocusCell()
    Returns the current cell in focus.
    (package private) GridColumn getFocusColumn()  
    GridItem getFocusItem()
    Returns the current item in focus.
    IRenderer getFocusRenderer()
    Gets the focus renderer.
    org.eclipse.swt.graphics.Font getFont()
    Cached default font of Control.getFont
    int getFooterHeight()
    Returns the height of the column footers.
    boolean getFooterVisible()
    Returns true if the receiver's footer is visible, and false otherwise
    (package private) int getGridHeight()
    Returns the height of the plain grid in pixels.
    int getGroupHeaderHeight()
    Returns the height of the column group headers.
    int getHeaderHeight()
    Returns the height of the column headers.
    boolean getHeaderVisible()
    Returns true if the receiver's header is visible, and false otherwise.
    protected IScrollBarProxy getHorizontalScrollBarProxy()
    Returns the externally managed horizontal scrollbar.
    int getIndexOfItem​(GridItem item)  
    GridItem getItem​(int index)
    Returns the item at the given, zero-relative index in the receiver.
    GridItem getItem​(org.eclipse.swt.graphics.Point point)
    Returns the item at the given point in the receiver or null if no such item exists.
    int getItemCount()
    Returns the number of items contained in the receiver.
    int getItemHeaderWidth()
    Returns the row header width or 0 if row headers are not visible.
    int getItemHeight()
    Returns the default height of the items in this Grid.
    GridItem[] getItems()
    Returns a (possibly empty) array of GridItems which are the items in the receiver.
    org.eclipse.swt.graphics.Color getLineColor()
    Returns the line color.
    boolean getLinesVisible()
    Returns true if the lines are visible.
    GridColumn getNextVisibleColumn​(GridColumn column)
    Returns the next visible column in the table.
    GridItem getNextVisibleItem​(GridItem item)
    Returns the next visible item in the table.
    (package private) org.eclipse.swt.graphics.Point getOrigin​(GridColumn column, GridItem item)
    Returns the intersection of the given column and given item.
    GridColumn getPreviousVisibleColumn​(GridColumn column)
    Returns the previous visible column in the table.
    GridItem getPreviousVisibleItem​(GridItem item)
    Returns the previous visible item in the table.
    GridItem getRootItem​(int index)
    TODO: asl;fj
    int getRootItemCount()
    Returns the number of root items contained in the receiver.
    GridItem[] getRootItems()
    Returns a (possibly empty) array of GridItems which are the root items in the receiver.
    IRenderer getRowHeaderRenderer()
    Gets the row header renderer.
    int getRowHeaderWidth()
    Returns the width of the row headers.
    boolean getRowsResizeable()
    Returns true if the rows are resizable.
    GridItem[] getSelection()
    Returns a array of GridItems that are currently selected in the receiver.
    int getSelectionCount()
    Returns the number of selected items contained in the receiver.
    boolean getSelectionEnabled()
    Returns true if selection is enabled, false otherwise.
    int getSelectionIndex()
    Returns the zero-relative index of the item which is currently selected in the receiver, or -1 if no item is selected.
    int[] getSelectionIndices()
    Returns the zero-relative indices of the items which are currently selected in the receiver.
    (package private) int getStartColumnIndex()  
    java.lang.String getToolTipText()
    Returns the receiver's tool tip text, or null if it has not been set.
    int getTopIndex()
    Returns the zero-relative index of the item which is currently at the top of the receiver.
    IRenderer getTopLeftRenderer()
    Gets the top left renderer.
    boolean getTreeLinesVisible()
    Returns true if the tree lines are visible.
    protected IScrollBarProxy getVerticalScrollBarProxy()
    Returns the externally managed vertical scrollbar.
    (package private) GridColumn getVisibleColumn_DegradeLeft​(GridItem item, GridColumn col)
    Returns the first visible column that is not spanned by any other column that is either the given column or any of the columns displaying to the left of the given column.
    (package private) GridColumn getVisibleColumn_DegradeRight​(GridItem item, GridColumn col)
    Returns the first visible column that is not spanned by any other column that is either the given column or any of the columns displaying to the right of the given column.
    (package private) int getVisibleGridHeight()
    Returns the height of the on-screen area that is available for showing the grid's rows, i.e. the client area of the scrollable minus the height of the column headers (if shown).
    (package private) int getVisibleGridWidth()
    Returns the height of the screen area that is available for showing the grid columns
    Grid.GridVisibleRange getVisibleRange()
    Query the grid for all currently visible rows and columns
    (package private) void handlePacked​(GridColumn column)  
    protected void hideToolTip()
    Hides the inplace tooltip.
    (package private) void imageSetOnItem​(int column, GridItem item)
    Updates the row height when the first image is set on an item.
    int indexOf​(GridColumn column)
    Searches the receiver's list starting at the first column (index 0) until a column is found that is equal to the argument, and returns the index of that column.
    int indexOf​(GridItem item)
    Searches the receiver's list starting at the first item (index 0) until an item is found that is equal to the argument, and returns the index of that item.
    boolean isAutoHeight()
    Returns the value of the auto-height feature, which resizes row heights and column header heights based on word-wrapped content.
    boolean isAutoWidth()
    Returns the value of the auto-height feature, which resizes row header width based on content.
    boolean isCellDragSelectionEnabled()  
    boolean isCellSelected​(org.eclipse.swt.graphics.Point cell)
    Returns true if the given cell is selected.
    boolean isCellSelectionEnabled()  
    (package private) boolean isDisposing()  
    boolean isFocusOnGrid()  
    (package private) boolean isInDragScrollArea​(org.eclipse.swt.graphics.Point point)
    boolean isMoveOnTab()  
    boolean isRowHeaderVisible()
    Returns true if the receiver's row header is visible, and false otherwise.
    boolean isSelected​(int index)
    Returns true if the item is selected, and false otherwise.
    boolean isSelected​(GridItem item)
    Returns true if the given item is selected.
    (package private) boolean isShown​(GridItem item)
    Returns true if 'item' is currently being completely shown in this Grid's visible on-screen area.
    boolean isVisibleLinesColumnPack()
    If true, column pack is based only with the visible lines (from topIndex to bottomIndex).
    boolean isWordWrapHeader()
    Returns the value of the row header word-wrap feature, which word-wraps the content of row headers.
    (package private) int newColumn​(GridColumn column, int index)
    Inserts a new column into the table.
    (package private) void newColumnGroup​(GridColumnGroup group)
    Creates the given column group at the given index.
    (package private) int newItem​(GridItem item, int index, boolean root)
    Creates the new item at the given index.
    (package private) void newRootItem​(GridItem item, int index)  
    protected void onKeyDown​(org.eclipse.swt.widgets.Event e)
    Key down event handler.
    void recalculateHeader()
    Recalculate the height of the header
    (package private) void recalculateRowHeaderHeight​(GridItem item, int oldHeight, int newHeight)  
    (package private) void recalculateRowHeaderWidth​(GridItem item, int oldWidth, int newWidth)  
    void refreshData()
    Refresh hasData GridItem state if Grid is virtual
    protected void refreshHoverState()
    Refreshes the hover* variables according to the mouse location and current state of the table.
    void remove​(int index)
    Removes the item from the receiver at the given zero-relative index.
    void remove​(int[] indices)
    Removes the items from the receiver's list at the given zero-relative indices.
    void remove​(int start, int end)
    Removes the items from the receiver which are between the given zero-relative start and end indices (inclusive).
    void removeAll()
    Deprecated.
    (package private) void removeColumn​(GridColumn column)
    Removes the given column from the table.
    (package private) void removeColumnGroup​(GridColumnGroup group)
    Removes the given column group from the table.
    (package private) void removeItem​(GridItem item)
    Removes the given item from the table.
    (package private) void removeRootItem​(GridItem item)  
    void removeSelectionListener​(org.eclipse.swt.events.SelectionListener listener)
    Removes the listener from the collection of listeners who will be notified when the receiver's selection changes.
    void removeTreeListener​(org.eclipse.swt.events.TreeListener listener)
    Removes the listener from the collection of listeners who will be notified when the receiver's items changes.
    void select​(int index)
    Selects the item at the given zero-relative index in the receiver.
    void select​(int[] indices)
    Selects the items at the given zero-relative indices in the receiver.
    void select​(int start, int end)
    Selects the items in the range specified by the given zero-relative indices in the receiver.
    void selectAll()
    Selects all of the items in the receiver.
    void selectAllCells()
    Selects all cells in the receiver.
    void selectCell​(org.eclipse.swt.graphics.Point cell)
    Selects the given cell.
    void selectCells​(org.eclipse.swt.graphics.Point[] cells)
    Selects the given cells.
    void selectColumn​(int col)
    Selects all cells in the given column in the receiver.
    void selectColumnGroup​(int colGroup)
    Selects all cells in the given column group in the receiver.
    void selectColumnGroup​(GridColumnGroup colGroup)
    Selects all cells in the given column group in the receiver.
    void setAutoHeight​(boolean enabled)
    Sets the value of the auto-height feature.
    void setAutoWidth​(boolean enabled)
    Sets the value of the auto-width feature.
    void setBackground​(org.eclipse.swt.graphics.Color color)
    void setBottomLeftRenderer​(IRenderer bottomLeftRenderer)
    Sets the bottom left renderer.
    void setCellDragSelectionEnabled​(boolean cellDragSelection)
    Sets whether cells are selectable in the receiver by dragging the mouse cursor.
    void setCellHeaderSelectionBackground​(org.eclipse.swt.graphics.Color cellSelectionBackground)
    Sets the background color of column and row headers displayed when a cell in the row or header is selected.
    void setCellSelection​(org.eclipse.swt.graphics.Point cell)
    Selects the selection to the given cell.
    void setCellSelection​(org.eclipse.swt.graphics.Point[] cells)
    Selects the selection to the given set of cell.
    void setCellSelectionEnabled​(boolean cellSelection)
    Sets whether cells are selectable in the receiver.
    void setColumnOrder​(int[] order)
    Sets the order that the items in the receiver should be displayed in to the given argument which is described in terms of the zero-relative ordering of when the items were added.
    void setColumnScrolling​(boolean columnScrolling)
    Sets the table scrolling method to either scroll column-by-column (true) or pixel-by-pixel (false).
    void setEmptyCellRenderer​(GridCellRenderer emptyCellRenderer)
    Sets the empty cell renderer.
    void setEmptyColumnFooterRenderer​(IRenderer emptyColumnFooterRenderer)
    Sets the empty column footer renderer.
    void setEmptyColumnHeaderRenderer​(IRenderer emptyColumnHeaderRenderer)
    Sets the empty column header renderer.
    void setEmptyRowHeaderRenderer​(IRenderer emptyRowHeaderRenderer)
    Sets the empty row header renderer.
    void setFocusColumn​(GridColumn column)
    Sets the focused item to the given column.
    void setFocusItem​(GridItem item)
    Sets the focused item to the given item.
    void setFocusRenderer​(IRenderer focusRenderer)
    Sets the focus renderer.
    void setFont​(org.eclipse.swt.graphics.Font font)
    void setFooterVisible​(boolean show)
    Marks the receiver's footer as visible if the argument is true, and marks it invisible otherwise.
    void setForeground​(org.eclipse.swt.graphics.Color color)  
    (package private) void setHasSpanning​(boolean hasSpanning)  
    void setHeaderVisible​(boolean show)
    Marks the receiver's header as visible if the argument is true, and marks it invisible otherwise.
    protected void setHorizontalScrollBarProxy​(IScrollBarProxy scroll)
    Sets the external horizontal scrollbar.
    (package private) void setInsertMark​(GridItem item, GridColumn column, boolean before)
    Display a mark indicating the point at which an item will be inserted.
    void setItemCount​(int count)
    Sets the number of items contained in the receiver.
    void setItemHeaderWidth​(int width)
    Sets the row header width to the specified value.
    void setItemHeight​(int height)
    Sets the default height for this Grid's items.
    void setLineColor​(org.eclipse.swt.graphics.Color lineColor)
    Sets the line color.
    void setLinesVisible​(boolean linesVisible)
    Sets the line visibility.
    protected void setlVerticalScrollBarProxy​(IScrollBarProxy scroll)
    Sets the external vertical scrollbar.
    void setMoveOnTab​(boolean moveOnTab)
    This param allows user to change the current selection by pressing TAB and SHIFT-TAB
    void setRowHeaderRenderer​(IRenderer rowHeaderRenderer)
    Sets the row header renderer.
    void setRowHeaderVisible​(boolean show)
    Marks the receiver's row header as visible if the argument is true, and marks it invisible otherwise.
    void setRowHeaderVisible​(boolean show, int minWidth)
    Marks the receiver's row header as visible if the argument is true, and marks it invisible otherwise.
    void setRowsResizeable​(boolean rowsResizeable)
    Sets the rows resizeable state of this Grid.
    protected void setScrollValuesObsolete()
    Marks the scroll values obsolete so they will be recalculated.
    void setSelection​(int index)
    Selects the item at the given zero-relative index in the receiver.
    void setSelection​(int[] indices)
    Selects the items at the given zero-relative indices in the receiver.
    void setSelection​(int start, int end)
    Selects the items in the range specified by the given zero-relative indices in the receiver.
    void setSelection​(GridItem[] _items)
    Sets the receiver's selection to be the given array of items.
    void setSelectionEnabled​(boolean selectionEnabled)
    Enables selection highlighting if the argument is true.
    void setSelectionType​(GridSelectionType selectionType)
    Change selection type (single or multi)
    (package private) void setSizeOnEveryItemImageChange​(boolean sizeOnEveryItemImageChange)  
    void setToolTipText​(java.lang.String string)
    Sets the receiver's tool tip text to the argument, which may be null indicating that no tool tip text should be shown.
    void setTopIndex​(int index)
    Sets the zero-relative index of the item which is currently at the top of the receiver.
    void setTopLeftRenderer​(IRenderer topLeftRenderer)
    Sets the top left renderer.
    void setTreeLinesVisible​(boolean treeLinesVisible)
    Sets the tree line visibility.
    void setVisibleLinesColumnPack​(boolean visibleLinesBasedColumnPack)
    Set optimizedColumnPack to true for column pack based only with the visible lines.
    void setWordWrapHeader​(boolean enabled)
    Sets the value of the word-wrap feature for row headers.
    void showColumn​(GridColumn col)
    Shows the column.
    void showItem​(GridItem item)
    Shows the item.
    void showSelection()
    Shows the selection.
    protected void showToolTip​(GridItem item, GridColumn column, GridColumnGroup group, org.eclipse.swt.graphics.Point location)
    Shows the inplace tooltip for the given item and column.
    (package private) void updateColumnFocus()  
    (package private) void updateColumnSelection()  
    protected void updateToolTipText​(java.lang.String text)
    Sets the tooltip for the whole Grid to the given text.
    (package private) void updateVisibleItems​(int amount)
    Updates the cached number of visible items by the given amount.

    Methods inherited from class org.eclipse.swt.widgets.Canvas

    drawBackground, getCaret, getIME, scroll, setCaret, setIME

    Methods inherited from class org.eclipse.swt.widgets.Composite

    changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList, toString

    Methods inherited from class org.eclipse.swt.widgets.Scrollable

    computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar

    Methods inherited from class org.eclipse.swt.widgets.Control

    addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, requestLayout, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update

    Methods inherited from class org.eclipse.swt.widgets.Widget

    addDisposeListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.eclipse.swt.graphics.Drawable

    isAutoScalable
  • Field Details

    • hoveringOnColumnResizer

      boolean hoveringOnColumnResizer
      True if mouse is hover on a column boundary and can resize the column.
    • hasDifferingHeights

      boolean hasDifferingHeights
      True if there is at least one GridItem with an individual height. This value is only set to true in GridItem#setHeight(int,boolean) and it is never reset to false.
    • topIndex

      int topIndex
      Index of first visible item. The value must never be read directly. It is cached and updated when appropriate. #getTopIndex should be called for every client (even internal callers). A value of -1 indicates that the value is old and will be recomputed.
      See Also:
      bottomIndex
    • bottomIndex

      int bottomIndex
      Index of last visible item. The value must never be read directly. It is cached and updated when appropriate. #getBottomIndex() should be called for every client (even internal callers). A value of -1 indicates that the value is old and will be recomputed.

      Note that the item with this index is often only partly visible; maybe only a single line of pixels is visible. In extreme cases, bottomIndex may be the same as topIndex.

      See Also:
      topIndex
    • startColumnIndex

      int startColumnIndex
      Index of the first visible column. A value of -1 indicates that the value is old and will be recomputed.
    • endColumnIndex

      int endColumnIndex
      Index of the the last visible column. A value of -1 indicates that the value is old and will be recomputed.
  • Constructor Details

    • Grid

      public Grid​(org.eclipse.swt.widgets.Composite parent, int style)
      Grid with generic DataVisualizer
      Parameters:
      parent - component
      style - grid style
    • Grid

      public Grid​(DataVisualizer dataVisualizer, org.eclipse.swt.widgets.Composite parent, int style)
      Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.

      Parameters:
      dataVisualizer - manage all data of grid and its items
      parent - a composite control which will be the parent of the new instance (cannot be null)
      style - the style of control to construct
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_NULL_ARGUMENT - if the parent is null
      org.eclipse.swt.SWTException -
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
      See Also:
      SWT.SINGLE, SWT.MULTI
  • Method Details

    • getDataVisualizer

      public DataVisualizer getDataVisualizer()
      Returns:
      DataVisualizer
    • clearItems

      public void clearItems()
      Clear simply all GridItems
    • getBackground

      public org.eclipse.swt.graphics.Color getBackground()
      Overrides:
      getBackground in class org.eclipse.swt.widgets.Control
    • setBackground

      public void setBackground​(org.eclipse.swt.graphics.Color color)
      Overrides:
      setBackground in class org.eclipse.swt.widgets.Control
    • getCellHeaderSelectionBackground

      public org.eclipse.swt.graphics.Color getCellHeaderSelectionBackground()
      Returns the background color of column and row headers when a cell in the row or header is selected.
      Returns:
      cell header selection background color
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setCellHeaderSelectionBackground

      public void setCellHeaderSelectionBackground​(org.eclipse.swt.graphics.Color cellSelectionBackground)
      Sets the background color of column and row headers displayed when a cell in the row or header is selected.
      Parameters:
      cellSelectionBackground - color to set.
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • addSelectionListener

      public void addSelectionListener​(org.eclipse.swt.events.SelectionListener listener)
      Adds the listener to the collection of listeners who will be notified when the receiver's selection changes, by sending it one of the messages defined in the SelectionListener interface.

      Cell selection events may have Event.detail = SWT.DRAG when the user is drag selecting multiple cells. A follow up selection event will be generated when the drag is complete.

      Parameters:
      listener - the listener which should be notified
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_NULL_ARGUMENT - if the listener is null
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • addTreeListener

      public void addTreeListener​(org.eclipse.swt.events.TreeListener listener)
      Adds the listener to the collection of listeners who will be notified when the receiver's items changes, by sending it one of the messages defined in the TreeListener interface.
      Parameters:
      listener - the listener which should be notified
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_NULL_ARGUMENT - if the listener is null
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      See Also:
      TreeListener, removeTreeListener(org.eclipse.swt.events.TreeListener), TreeEvent
    • computeSize

      public org.eclipse.swt.graphics.Point computeSize​(int wHint, int hHint, boolean changed)
      Overrides:
      computeSize in class org.eclipse.swt.widgets.Control
    • deselect

      public void deselect​(int index)
      Deselects the item at the given zero-relative index in the receiver. If the item at the index was already deselected, it remains deselected. Indices that are out of range are ignored.

      If cell selection is enabled, all cells in the specified item are deselected.

      Parameters:
      index - the index of the item to deselect
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • deselect

      public void deselect​(int start, int end)
      Deselects the items at the given zero-relative indices in the receiver. If the item at the given zero-relative index in the receiver is selected, it is deselected. If the item at the index was not selected, it remains deselected. The range of the indices is inclusive. Indices that are out of range are ignored.

      If cell selection is enabled, all cells in the given range are deselected.

      Parameters:
      start - the start index of the items to deselect
      end - the end index of the items to deselect
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • deselect

      public void deselect​(int[] indices)
      Deselects the items at the given zero-relative indices in the receiver. If the item at the given zero-relative index in the receiver is selected, it is deselected. If the item at the index was not selected, it remains deselected. Indices that are out of range and duplicate indices are ignored.

      If cell selection is enabled, all cells in the given items are deselected.

      Parameters:
      indices - the array of indices for the items to deselect
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_NULL_ARGUMENT - if the set of indices is null
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • deselectAll

      public void deselectAll()
      Deselects all selected items in the receiver. If cell selection is enabled, all cells are deselected.
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getColumn

      public GridColumn getColumn​(int index)
      Returns the column at the given, zero-relative index in the receiver. Throws an exception if the index is out of range. If no GridColumns were created by the programmer, this method will throw ERROR_INVALID_RANGE despite the fact that a single column of data may be visible in the table. This occurs when the programmer uses the table like a list, adding items but never creating a column.
      Parameters:
      index - the index of the column to return
      Returns:
      the column at the given index
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getColumn

      public GridColumn getColumn​(org.eclipse.swt.graphics.Point point)
      Returns the column at the given point in the receiver or null if no such column exists. The point is in the coordinate system of the receiver.
      Parameters:
      point - the point used to locate the column
      Returns:
      the column at the given point
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_NULL_ARGUMENT - if the point is null
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getColumnCount

      public int getColumnCount()
      Returns the number of columns contained in the receiver. If no GridColumns were created by the programmer, this value is zero, despite the fact that visually, one column of items may be visible. This occurs when the programmer uses the table like a list, adding items but never creating a column.
      Returns:
      the number of columns
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getColumnOrder

      public int[] getColumnOrder()
      Returns an array of zero-relative integers that map the creation order of the receiver's items to the order in which they are currently being displayed.

      Specifically, the indices of the returned array represent the current visual order of the items, and the contents of the array represent the creation order of the items.

      Note: This is not the actual structure used by the receiver to maintain its list of items, so modifying the array will not affect the receiver.

      Returns:
      the current visual order of the receiver's items
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getColumnGroupCount

      public int getColumnGroupCount()
      Returns the number of column groups contained in the receiver.
      Returns:
      the number of column groups
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getColumnGroups

      public GridColumnGroup[] getColumnGroups()
      Returns an array of GridColumnGroups which are the column groups in the receiver.

      Note: This is not the actual structure used by the receiver to maintain its list of items, so modifying the array will not affect the receiver.

      Returns:
      the column groups in the receiver
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getColumnGroup

      public GridColumnGroup getColumnGroup​(int index)
      Returns the column group at the given, zero-relative index in the receiver. Throws an exception if the index is out of range.
      Parameters:
      index - the index of the column group to return
      Returns:
      the column group at the given index
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setColumnOrder

      public void setColumnOrder​(int[] order)
      Sets the order that the items in the receiver should be displayed in to the given argument which is described in terms of the zero-relative ordering of when the items were added.
      Parameters:
      order - the new order to display the items
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS -if not called from the thread that created the receiver
      java.lang.IllegalArgumentException -
      • ERROR_NULL_ARGUMENT - if the item order is null
      • ERROR_INVALID_ARGUMENT - if the order is not the same length as the number of items, or if an item is listed twice, or if the order splits a column group
    • getColumns

      public GridColumn[] getColumns()
      Returns an array of GridColumns which are the columns in the receiver. If no GridColumns were created by the programmer, the array is empty, despite the fact that visually, one column of items may be visible. This occurs when the programmer uses the table like a list, adding items but never creating a column.

      Note: This is not the actual structure used by the receiver to maintain its list of items, so modifying the array will not affect the receiver.

      Returns:
      the items in the receiver
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getEmptyCellRenderer

      public GridCellRenderer getEmptyCellRenderer()
      Returns the empty cell renderer.
      Returns:
      Returns the emptyCellRenderer.
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getEmptyColumnHeaderRenderer

      public IRenderer getEmptyColumnHeaderRenderer()
      Returns the empty column header renderer.
      Returns:
      Returns the emptyColumnHeaderRenderer.
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getEmptyColumnFooterRenderer

      public IRenderer getEmptyColumnFooterRenderer()
      Returns the empty column footer renderer.
      Returns:
      Returns the emptyColumnFooterRenderer.
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getEmptyRowHeaderRenderer

      public IRenderer getEmptyRowHeaderRenderer()
      Returns the empty row header renderer.
      Returns:
      Returns the emptyRowHeaderRenderer.
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getHorizontalScrollBarProxy

      protected IScrollBarProxy getHorizontalScrollBarProxy()
      Returns the externally managed horizontal scrollbar.
      Returns:
      the external horizontal scrollbar.
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      See Also:
      setHorizontalScrollBarProxy(IScrollBarProxy)
    • getVerticalScrollBarProxy

      protected IScrollBarProxy getVerticalScrollBarProxy()
      Returns the externally managed vertical scrollbar.
      Returns:
      the external vertical scrollbar.
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      See Also:
      setlVerticalScrollBarProxy(IScrollBarProxy)
    • getFocusRenderer

      public IRenderer getFocusRenderer()
      Gets the focus renderer.
      Returns:
      Returns the focusRenderer.
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getHeaderHeight

      public int getHeaderHeight()
      Returns the height of the column headers. If this table has column groups, the returned value includes the height of group headers.
      Returns:
      height of the column header row
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getFont

      public org.eclipse.swt.graphics.Font getFont()
      Cached default font of Control.getFont
      Overrides:
      getFont in class org.eclipse.swt.widgets.Control
      See Also:
      Control.getFont()
    • getFooterHeight

      public int getFooterHeight()
      Returns the height of the column footers.
      Returns:
      height of the column footer row
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getGroupHeaderHeight

      public int getGroupHeaderHeight()
      Returns the height of the column group headers.
      Returns:
      height of column group headers
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getHeaderVisible

      public boolean getHeaderVisible()
      Returns true if the receiver's header is visible, and false otherwise.
      Returns:
      the receiver's header's visibility state
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getFooterVisible

      public boolean getFooterVisible()
      Returns true if the receiver's footer is visible, and false otherwise
      Returns:
      the receiver's footer's visibility state
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getItem

      public GridItem getItem​(int index)
      Returns the item at the given, zero-relative index in the receiver. Throws an exception if the index is out of range.
      Parameters:
      index - the index of the item to return
      Returns:
      the item at the given index
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
      • *
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getItem

      public GridItem getItem​(org.eclipse.swt.graphics.Point point)
      Returns the item at the given point in the receiver or null if no such item exists. The point is in the coordinate system of the receiver.
      Parameters:
      point - the point used to locate the item
      Returns:
      the item at the given point
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_NULL_ARGUMENT - if the point is null
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getItemCount

      public int getItemCount()
      Returns the number of items contained in the receiver.
      Returns:
      the number of items
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getItemHeight

      public int getItemHeight()
      Returns the default height of the items in this Grid. See setItemHeight(int) for details.

      IMPORTANT: The Grid's items need not all have the height returned by this method, because an item's height may have been changed by calling GridItem.setHeight(int).

      Returns:
      default height of items
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      See Also:
      setItemHeight(int)
    • setItemHeight

      public void setItemHeight​(int height)
      Sets the default height for this Grid's items. When this method is called, all existing items are resized to the specified height and items created afterwards will be initially sized to this height.

      As long as no default height was set by the client through this method, the preferred height of the first item in this Grid is used as a default for all items (and is returned by getItemHeight()).

      Parameters:
      height - default height in pixels
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_INVALID_ARGUMENT - if the height is < 1
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      See Also:
      GridItem.getHeight(), GridItem.setHeight(int)
    • getRowsResizeable

      public boolean getRowsResizeable()
      Returns true if the rows are resizable.
      Returns:
      the row resizeable state
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      See Also:
      setRowsResizeable(boolean)
    • setRowsResizeable

      public void setRowsResizeable​(boolean rowsResizeable)
      Sets the rows resizeable state of this Grid. The default is 'false'.

      If a row in a Grid is resizeable, then the user can interactively change its height by dragging the border of the row header.

      Note that for rows to be resizable the row headers must be visible.

      Parameters:
      rowsResizeable - true if this Grid's rows should be resizable
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      See Also:
      setRowHeaderVisible(boolean)
    • getItems

      public GridItem[] getItems()
      Returns a (possibly empty) array of GridItems which are the items in the receiver.

      Note: This is not the actual structure used by the receiver to maintain its list of items, so modifying the array will not affect the receiver.

      Returns:
      the items in the receiver
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getIndexOfItem

      public int getIndexOfItem​(GridItem item)
      Parameters:
      item -
      Returns:
      t
    • getLineColor

      public org.eclipse.swt.graphics.Color getLineColor()
      Returns the line color.
      Returns:
      Returns the lineColor.
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getLinesVisible

      public boolean getLinesVisible()
      Returns true if the lines are visible.
      Returns:
      Returns the linesVisible.
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getTreeLinesVisible

      public boolean getTreeLinesVisible()
      Returns true if the tree lines are visible.
      Returns:
      Returns the treeLinesVisible.
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getNextVisibleItem

      public GridItem getNextVisibleItem​(GridItem item)
      Returns the next visible item in the table.
      Parameters:
      item - item
      Returns:
      next visible item or null
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getPreviousVisibleItem

      public GridItem getPreviousVisibleItem​(GridItem item)
      Returns the previous visible item in the table. Passing null for the item will return the last visible item in the table.
      Parameters:
      item - item or null
      Returns:
      previous visible item or if item==null last visible item
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getPreviousVisibleColumn

      public GridColumn getPreviousVisibleColumn​(GridColumn column)
      Returns the previous visible column in the table.
      Parameters:
      column - column
      Returns:
      previous visible column or null
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getNextVisibleColumn

      public GridColumn getNextVisibleColumn​(GridColumn column)
      Returns the next visible column in the table.
      Parameters:
      column - column
      Returns:
      next visible column or null
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getRootItemCount

      public int getRootItemCount()
      Returns the number of root items contained in the receiver.
      Returns:
      the number of items
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getRootItems

      public GridItem[] getRootItems()
      Returns a (possibly empty) array of GridItems which are the root items in the receiver.

      Note: This is not the actual structure used by the receiver to maintain its list of items, so modifying the array will not affect the receiver.

      Returns:
      the root items in the receiver
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getRootItem

      public GridItem getRootItem​(int index)
      TODO: asl;fj
      Parameters:
      index -
      Returns:
      asdf
    • getRowHeaderRenderer

      public IRenderer getRowHeaderRenderer()
      Gets the row header renderer.
      Returns:
      Returns the rowHeaderRenderer.
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getSelection

      public GridItem[] getSelection()
      Returns a array of GridItems that are currently selected in the receiver. The order of the items is unspecified. An empty array indicates that no items are selected.

      Note: This is not the actual structure used by the receiver to maintain its selection, so modifying the array will not affect the receiver.

      If cell selection is enabled, any items which contain at least one selected cell are returned.

      Returns:
      an array representing the selection
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getSelectionCount

      public int getSelectionCount()
      Returns the number of selected items contained in the receiver. If cell selection is enabled, the number of items with at least one selected cell are returned.
      Returns:
      the number of selected items
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getCellSelectionCount

      public int getCellSelectionCount()
      Returns the number of selected cells contained in the receiver.
      Returns:
      the number of selected cells
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getSelectionIndex

      public int getSelectionIndex()
      Returns the zero-relative index of the item which is currently selected in the receiver, or -1 if no item is selected. If cell selection is enabled, returns the index of first item that contains at least one selected cell.
      Returns:
      the index of the selected item
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getSelectionIndices

      public int[] getSelectionIndices()
      Returns the zero-relative indices of the items which are currently selected in the receiver. The order of the indices is unspecified. The array is empty if no items are selected.

      Note: This is not the actual structure used by the receiver to maintain its selection, so modifying the array will not affect the receiver.

      If cell selection is enabled, returns the indices of any items which contain at least one selected cell.

      Returns:
      the array of indices of the selected items
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getTopIndex

      public int getTopIndex()
      Returns the zero-relative index of the item which is currently at the top of the receiver. This index can change when items are scrolled or new items are added or removed.
      Returns:
      the index of the top item
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getBottomIndex

      int getBottomIndex()
      Returns the zero-relative index of the item which is currently at the bottom of the receiver. This index can change when items are scrolled, expanded or collapsed or new items are added or removed.

      Note that the item with this index is often only partly visible; maybe only a single line of pixels is visible. Use isShown(GridItem) to find out.

      In extreme cases, getBottomIndex() may return the same value as getTopIndex().

      Returns:
      the index of the bottom item
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getGridHeight

      int getGridHeight()
      Returns the height of the plain grid in pixels.

      This includes all rows for visible items (i.e. items that return true on GridItem.isVisible() ; not only those currently visible on screen) and the 1 pixel separator between rows.

      This does not include the height of the column headers.

      Returns:
      height of plain grid
    • getVisibleGridHeight

      int getVisibleGridHeight()
      Returns the height of the on-screen area that is available for showing the grid's rows, i.e. the client area of the scrollable minus the height of the column headers (if shown).
      Returns:
      height of visible grid in pixels
    • getVisibleGridWidth

      int getVisibleGridWidth()
      Returns the height of the screen area that is available for showing the grid columns
      Returns:
    • getTopLeftRenderer

      public IRenderer getTopLeftRenderer()
      Gets the top left renderer.
      Returns:
      Returns the topLeftRenderer.
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getBottomLeftRenderer

      public IRenderer getBottomLeftRenderer()
      Gets the bottom left renderer.
      Returns:
      Returns the bottomLeftRenderer.
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • indexOf

      public int indexOf​(GridColumn column)
      Searches the receiver's list starting at the first column (index 0) until a column is found that is equal to the argument, and returns the index of that column. If no column is found, returns -1.
      Parameters:
      column - the search column
      Returns:
      the index of the column
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_NULL_ARGUMENT - if the column is null
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • indexOf

      public int indexOf​(GridItem item)
      Searches the receiver's list starting at the first item (index 0) until an item is found that is equal to the argument, and returns the index of that item. If no item is found, returns -1.
      Parameters:
      item - the search item
      Returns:
      the index of the item
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_NULL_ARGUMENT - if the item is null
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • isRowHeaderVisible

      public boolean isRowHeaderVisible()
      Returns true if the receiver's row header is visible, and false otherwise.

      Returns:
      the receiver's row header's visibility state
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • isSelected

      public boolean isSelected​(int index)
      Returns true if the item is selected, and false otherwise. Indices out of range are ignored. If cell selection is enabled, returns true if the item at the given index contains at least one selected cell.
      Parameters:
      index - the index of the item
      Returns:
      the visibility state of the item at the index
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • isSelected

      public boolean isSelected​(GridItem item)
      Returns true if the given item is selected. If cell selection is enabled, returns true if the given item contains at least one selected cell.
      Parameters:
      item - item
      Returns:
      true if the item is selected.
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_NULL_ARGUMENT - if the item is null
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • isCellSelected

      public boolean isCellSelected​(org.eclipse.swt.graphics.Point cell)
      Returns true if the given cell is selected.
      Parameters:
      cell - cell
      Returns:
      true if the cell is selected.
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_NULL_ARGUMENT - if the cell is null
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • remove

      public void remove​(int index)
      Removes the item from the receiver at the given zero-relative index.
      Parameters:
      index - the index for the item
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • remove

      public void remove​(int start, int end)
      Removes the items from the receiver which are between the given zero-relative start and end indices (inclusive).
      Parameters:
      start - the start of the range
      end - the end of the range
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_INVALID_RANGE - if either the start or end are not between 0 and the number of elements in the list minus 1 (inclusive)
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • remove

      public void remove​(int[] indices)
      Removes the items from the receiver's list at the given zero-relative indices.
      Parameters:
      indices - the array of indices of the items
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
      • ERROR_NULL_ARGUMENT - if the indices array is null
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • removeAll

      @Deprecated public void removeAll()
      Deprecated.
      Removes all of the items from the receiver.
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      Call Grid disposeAllItems and clearItems.. Is faster
    • disposeAllItems

      public void disposeAllItems()
      All items needs to call the disposeOnly method
    • removeSelectionListener

      public void removeSelectionListener​(org.eclipse.swt.events.SelectionListener listener)
      Removes the listener from the collection of listeners who will be notified when the receiver's selection changes.
      Parameters:
      listener - the listener which should no longer be notified
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      See Also:
      SelectionListener, addSelectionListener(SelectionListener)
    • removeTreeListener

      public void removeTreeListener​(org.eclipse.swt.events.TreeListener listener)
      Removes the listener from the collection of listeners who will be notified when the receiver's items changes.
      Parameters:
      listener - the listener which should no longer be notified
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      See Also:
      TreeListener, addTreeListener(TreeListener)
    • select

      public void select​(int index)
      Selects the item at the given zero-relative index in the receiver. If the item at the index was already selected, it remains selected. Indices that are out of range are ignored.

      If cell selection is enabled, selects all cells at the given index.

      Parameters:
      index - the index of the item to select
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • select

      public void select​(int start, int end)
      Selects the items in the range specified by the given zero-relative indices in the receiver. The range of indices is inclusive. The current selection is not cleared before the new items are selected.

      If an item in the given range is not selected, it is selected. If an item in the given range was already selected, it remains selected. Indices that are out of range are ignored and no items will be selected if start is greater than end. If the receiver is single-select and there is more than one item in the given range, then all indices are ignored.

      If cell selection is enabled, all cells within the given range are selected.

      Parameters:
      start - the start of the range
      end - the end of the range
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      See Also:
      setSelection(int,int)
    • select

      public void select​(int[] indices)
      Selects the items at the given zero-relative indices in the receiver. The current selection is not cleared before the new items are selected.

      If the item at a given index is not selected, it is selected. If the item at a given index was already selected, it remains selected. Indices that are out of range and duplicate indices are ignored. If the receiver is single-select and multiple indices are specified, then all indices are ignored.

      If cell selection is enabled, all cells within the given indices are selected.

      Parameters:
      indices - the array of indices for the items to select
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_NULL_ARGUMENT - if the array of indices is null
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      See Also:
      setSelection(int[])
    • selectAll

      public void selectAll()
      Selects all of the items in the receiver.

      If the receiver is single-select, do nothing. If cell selection is enabled, all cells are selected.

      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setEmptyCellRenderer

      public void setEmptyCellRenderer​(GridCellRenderer emptyCellRenderer)
      Sets the empty cell renderer.
      Parameters:
      emptyCellRenderer - The emptyCellRenderer to set.
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setEmptyColumnHeaderRenderer

      public void setEmptyColumnHeaderRenderer​(IRenderer emptyColumnHeaderRenderer)
      Sets the empty column header renderer.
      Parameters:
      emptyColumnHeaderRenderer - The emptyColumnHeaderRenderer to set.
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setEmptyColumnFooterRenderer

      public void setEmptyColumnFooterRenderer​(IRenderer emptyColumnFooterRenderer)
      Sets the empty column footer renderer.
      Parameters:
      emptyColumnFooterRenderer - The emptyColumnFooterRenderer to set.
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setEmptyRowHeaderRenderer

      public void setEmptyRowHeaderRenderer​(IRenderer emptyRowHeaderRenderer)
      Sets the empty row header renderer.
      Parameters:
      emptyRowHeaderRenderer - The emptyRowHeaderRenderer to set.
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setHorizontalScrollBarProxy

      protected void setHorizontalScrollBarProxy​(IScrollBarProxy scroll)
      Sets the external horizontal scrollbar. Allows the scrolling to be managed externally from the table. This functionality is only intended when SWT.H_SCROLL is not given.

      Using this feature, a ScrollBar could be instantiated outside the table, wrapped in IScrollBar and thus be 'connected' to the table.

      Parameters:
      scroll - The horizontal scrollbar to set.
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setlVerticalScrollBarProxy

      protected void setlVerticalScrollBarProxy​(IScrollBarProxy scroll)
      Sets the external vertical scrollbar. Allows the scrolling to be managed externally from the table. This functionality is only intended when SWT.V_SCROLL is not given.

      Using this feature, a ScrollBar could be instantiated outside the table, wrapped in IScrollBar and thus be 'connected' to the table.

      Parameters:
      scroll - The vertical scrollbar to set.
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setFocusRenderer

      public void setFocusRenderer​(IRenderer focusRenderer)
      Sets the focus renderer.
      Parameters:
      focusRenderer - The focusRenderer to set.
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setHeaderVisible

      public void setHeaderVisible​(boolean show)
      Marks the receiver's header as visible if the argument is true, and marks it invisible otherwise.
      Parameters:
      show - the new visibility state
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setFooterVisible

      public void setFooterVisible​(boolean show)
      Marks the receiver's footer as visible if the argument is true, and marks it invisible otherwise.
      Parameters:
      show - the new visibility state
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setLineColor

      public void setLineColor​(org.eclipse.swt.graphics.Color lineColor)
      Sets the line color.
      Parameters:
      lineColor - The lineColor to set.
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setLinesVisible

      public void setLinesVisible​(boolean linesVisible)
      Sets the line visibility.
      Parameters:
      linesVisible - Te linesVisible to set.
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setTreeLinesVisible

      public void setTreeLinesVisible​(boolean treeLinesVisible)
      Sets the tree line visibility.
      Parameters:
      treeLinesVisible -
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setRowHeaderRenderer

      public void setRowHeaderRenderer​(IRenderer rowHeaderRenderer)
      Sets the row header renderer.
      Parameters:
      rowHeaderRenderer - The rowHeaderRenderer to set.
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setRowHeaderVisible

      public void setRowHeaderVisible​(boolean show)
      Marks the receiver's row header as visible if the argument is true, and marks it invisible otherwise. When row headers are visible, horizontal scrolling is always done by column rather than by pixel.
      Parameters:
      show - the new visibility state
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setRowHeaderVisible

      public void setRowHeaderVisible​(boolean show, int minWidth)
      Marks the receiver's row header as visible if the argument is true, and marks it invisible otherwise. When row headers are visible, horizontal scrolling is always done by column rather than by pixel.
      Parameters:
      show - the new visibility state
      minWidth - the minimun width of the row column
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setSelection

      public void setSelection​(int index)
      Selects the item at the given zero-relative index in the receiver. The current selection is first cleared, then the new item is selected.

      If cell selection is enabled, all cells within the item at the given index are selected.

      Parameters:
      index - the index of the item to select
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setSelection

      public void setSelection​(int start, int end)
      Selects the items in the range specified by the given zero-relative indices in the receiver. The range of indices is inclusive. The current selection is cleared before the new items are selected.

      Indices that are out of range are ignored and no items will be selected if start is greater than end. If the receiver is single-select and there is more than one item in the given range, then all indices are ignored.

      If cell selection is enabled, all cells within the given range are selected.

      Parameters:
      start - the start index of the items to select
      end - the end index of the items to select
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      See Also:
      deselectAll(), select(int,int)
    • isVisibleLinesColumnPack

      public boolean isVisibleLinesColumnPack()
      If true, column pack is based only with the visible lines (from topIndex to bottomIndex). false pack is in default mode.
      Returns:
      optimizedColumnPack value
    • setVisibleLinesColumnPack

      public void setVisibleLinesColumnPack​(boolean visibleLinesBasedColumnPack)
      Set optimizedColumnPack to true for column pack based only with the visible lines.
      Parameters:
      visibleLinesBasedColumnPack -
    • setSelection

      public void setSelection​(int[] indices)
      Selects the items at the given zero-relative indices in the receiver. The current selection is cleared before the new items are selected.

      Indices that are out of range and duplicate indices are ignored. If the receiver is single-select and multiple indices are specified, then all indices are ignored.

      If cell selection is enabled, all cells within the given indices are selected.

      Parameters:
      indices - the indices of the items to select
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_NULL_ARGUMENT - if the array of indices is null
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      See Also:
      deselectAll(), select(int[])
    • setSelection

      public void setSelection​(GridItem[] _items)
      Sets the receiver's selection to be the given array of items. The current selection is cleared before the new items are selected.

      Items that are not in the receiver are ignored. If the receiver is single-select and multiple items are specified, then all items are ignored. If cell selection is enabled, all cells within the given items are selected.

      Parameters:
      _items - the array of items
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_NULL_ARGUMENT - if the array of items is null
      • ERROR_INVALID_ARGUMENT - if one of the items has been disposed
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      See Also:
      deselectAll(), select(int[]), setSelection(int[])
    • setTopIndex

      public void setTopIndex​(int index)
      Sets the zero-relative index of the item which is currently at the top of the receiver. This index can change when items are scrolled or new items are added and removed.
      Parameters:
      index - the index of the top item
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setTopLeftRenderer

      public void setTopLeftRenderer​(IRenderer topLeftRenderer)
      Sets the top left renderer.
      Parameters:
      topLeftRenderer - The topLeftRenderer to set.
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setBottomLeftRenderer

      public void setBottomLeftRenderer​(IRenderer bottomLeftRenderer)
      Sets the bottom left renderer.
      Parameters:
      bottomLeftRenderer - The topLeftRenderer to set.
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • showColumn

      public void showColumn​(GridColumn col)
      Shows the column. If the column is already showing in the receiver, this method simply returns. Otherwise, the columns are scrolled until the column is visible.
      Parameters:
      col - the column to be shown
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • isShown

      boolean isShown​(GridItem item)
      Returns true if 'item' is currently being completely shown in this Grid's visible on-screen area.

      Here, "completely" only refers to the item's height, not its width. This means this method returns true also if some cells are horizontally scrolled away.

      Parameters:
      item -
      Returns:
      true if 'item' is shown
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      • ERROR_INVALID_ARGUMENT - if 'item' is not contained in the receiver
    • showItem

      public void showItem​(GridItem item)
      Shows the item. If the item is already showing in the receiver, this method simply returns. Otherwise, the items are scrolled until the item is visible.
      Parameters:
      item - the item to be shown
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      • ERROR_INVALID_ARGUMENT - if 'item' is not contained in the receiver
    • showSelection

      public void showSelection()
      Shows the selection. If the selection is already showing in the receiver, this method simply returns. Otherwise, the items are scrolled until the selection is visible.
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setSelectionEnabled

      public void setSelectionEnabled​(boolean selectionEnabled)
      Enables selection highlighting if the argument is true.
      Parameters:
      selectionEnabled - the selection enabled state
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getSelectionEnabled

      public boolean getSelectionEnabled()
      Returns true if selection is enabled, false otherwise.
      Returns:
      the selection enabled state
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • fireColumnsMoved

      void fireColumnsMoved()
    • handlePacked

      void handlePacked​(GridColumn column)
    • getCell

      public org.eclipse.swt.graphics.Point getCell​(org.eclipse.swt.graphics.Point point)
      Returns the cell at the given point in the receiver or null if no such cell exists. The point is in the coordinate system of the receiver.
      Parameters:
      point - the point used to locate the item
      Returns:
      the cell at the given point
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_NULL_ARGUMENT - if the point is null
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • updateColumnSelection

      void updateColumnSelection()
    • disableDefaultKeyListener

      public void disableDefaultKeyListener()
      Disable default key listener
    • enableDefaultKeyListener

      public void enableDefaultKeyListener()
      Enable default key listener
    • refreshHoverState

      protected void refreshHoverState()
      Refreshes the hover* variables according to the mouse location and current state of the table. This is useful is some method call, caused the state of the table to change and therefore the hover effects may have become out of date.
    • onKeyDown

      protected void onKeyDown​(org.eclipse.swt.widgets.Event e)
      Key down event handler.
      Parameters:
      e - event
    • getOrigin

      org.eclipse.swt.graphics.Point getOrigin​(GridColumn column, GridItem item)
      Returns the intersection of the given column and given item.
      Parameters:
      column - column
      item - item
      Returns:
      x,y of top left corner of the cell
    • updateToolTipText

      protected void updateToolTipText​(java.lang.String text)
      Sets the tooltip for the whole Grid to the given text. This method is made available for subclasses to override, when a subclass wants to display a different than the standard SWT/OS tooltip. Generally, those subclasses would override this event and use this tooltip text in their own tooltip or just override this method to prevent the SWT/OS tooltip from displaying.
      Parameters:
      text -
    • setScrollValuesObsolete

      protected void setScrollValuesObsolete()
      Marks the scroll values obsolete so they will be recalculated.
    • newColumn

      int newColumn​(GridColumn column, int index)
      Inserts a new column into the table.
      Parameters:
      column - new column
      index - index to insert new column
      Returns:
      current number of columns
    • removeColumn

      void removeColumn​(GridColumn column)
      Removes the given column from the table.
      Parameters:
      column - column to remove
    • newRootItem

      void newRootItem​(GridItem item, int index)
    • removeRootItem

      void removeRootItem​(GridItem item)
    • newItem

      int newItem​(GridItem item, int index, boolean root)
      Creates the new item at the given index. Only called from GridItem constructor.
      Parameters:
      item - new item
      index - index to insert the item at
      Returns:
      the index where the item was insert
    • removeItem

      void removeItem​(GridItem item)
      Removes the given item from the table. This method is only called from the item's dispose method.
      Parameters:
      item - item to remove
    • newColumnGroup

      void newColumnGroup​(GridColumnGroup group)
      Creates the given column group at the given index. This method is only called from the GridColumnGroup's constructor.
      Parameters:
      group - group to add.
    • removeColumnGroup

      void removeColumnGroup​(GridColumnGroup group)
      Removes the given column group from the table. This method is only called from the GridColumnGroup's dispose method.
      Parameters:
      group - group to remove.
    • updateVisibleItems

      void updateVisibleItems​(int amount)
      Updates the cached number of visible items by the given amount.
      Parameters:
      amount - amount to update cached total
    • getFocusItem

      public GridItem getFocusItem()
      Returns the current item in focus.
      Returns:
      item in focus or null.
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getFocusCell

      public org.eclipse.swt.graphics.Point getFocusCell()
      Returns the current cell in focus. If cell selection is disabled, this method returns null.
      Returns:
      cell in focus or null. x represents the column and y the row the cell is in
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setFocusItem

      public void setFocusItem​(GridItem item)
      Sets the focused item to the given item.
      Parameters:
      item - item to focus.
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_INVALID_ARGUMENT - if item is disposed
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setFocusColumn

      public void setFocusColumn​(GridColumn column)
      Sets the focused item to the given column. Column focus is only applicable when cell selection is enabled.
      Parameters:
      column - column to focus.
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_INVALID_ARGUMENT - if item is disposed
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getColumnsInOrder

      GridColumn[] getColumnsInOrder()
      Returns an array of the columns in their display order.
      Returns:
      columns in display order
    • getColumnScrolling

      public boolean getColumnScrolling()
      Returns true if the table is set to horizontally scroll column-by-column rather than pixel-by-pixel.
      Returns:
      true if the table is scrolled horizontally by column
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setColumnScrolling

      public void setColumnScrolling​(boolean columnScrolling)
      Sets the table scrolling method to either scroll column-by-column (true) or pixel-by-pixel (false).
      Parameters:
      columnScrolling - true to horizontally scroll by column, false to scroll by pixel
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getVisibleColumn_DegradeLeft

      GridColumn getVisibleColumn_DegradeLeft​(GridItem item, GridColumn col)
      Returns the first visible column that is not spanned by any other column that is either the given column or any of the columns displaying to the left of the given column. If the given column and subsequent columns to the right are either not visible or spanned, this method will return null.
      Parameters:
      item -
      col -
      Returns:
    • getVisibleColumn_DegradeRight

      GridColumn getVisibleColumn_DegradeRight​(GridItem item, GridColumn col)
      Returns the first visible column that is not spanned by any other column that is either the given column or any of the columns displaying to the right of the given column. If the given column and subsequent columns to the right are either not visible or spanned, this method will return null.
      Parameters:
      item -
      col -
      Returns:
    • getCellSelectionEnabled

      public boolean getCellSelectionEnabled()
      Returns true if the cells are selectable in the reciever.
      Returns:
      cell selection enablement status.
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setCellSelectionEnabled

      public void setCellSelectionEnabled​(boolean cellSelection)
      Sets whether cells are selectable in the receiver.
      Parameters:
      cellSelection - the cellSelection to set
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • isCellSelectionEnabled

      public boolean isCellSelectionEnabled()
      Returns:
      true if cell selection is enabled
    • setCellDragSelectionEnabled

      public void setCellDragSelectionEnabled​(boolean cellDragSelection)
      Sets whether cells are selectable in the receiver by dragging the mouse cursor.
      Parameters:
      cellDragSelection - the cellDragSelection to set
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • isCellDragSelectionEnabled

      public boolean isCellDragSelectionEnabled()
      Returns:
      true if cell drag selection is enabled
    • deselectCell

      public void deselectCell​(org.eclipse.swt.graphics.Point cell)
      Deselects the given cell in the receiver. If the given cell is already deselected it remains deselected. Invalid cells are ignored.
      Parameters:
      cell - cell to deselect.
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_NULL_ARGUMENT - if the cell is null
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • deselectCells

      public void deselectCells​(org.eclipse.swt.graphics.Point[] cells)
      Deselects the given cells. Invalid cells are ignored.
      Parameters:
      cells - the cells to deselect.
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_NULL_ARGUMENT - if the set of cells or any cell is null
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • deselectAllCells

      public void deselectAllCells()
      Deselects all selected cells in the receiver.
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • selectCell

      public void selectCell​(org.eclipse.swt.graphics.Point cell)
      Selects the given cell. Invalid cells are ignored.
      Parameters:
      cell - point whose x values is a column index and y value is an item index
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_NULL_ARGUMENT - if the item is null
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • selectCells

      public void selectCells​(org.eclipse.swt.graphics.Point[] cells)
      Selects the given cells. Invalid cells are ignored.
      Parameters:
      cells - an arry of points whose x value is a column index and y value is an item index
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_NULL_ARGUMENT - if the set of cells or an individual cell is null
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • selectAllCells

      public void selectAllCells()
      Selects all cells in the receiver.
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • selectColumn

      public void selectColumn​(int col)
      Selects all cells in the given column in the receiver.
      Parameters:
      col -
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • selectColumnGroup

      public void selectColumnGroup​(int colGroup)
      Selects all cells in the given column group in the receiver.
      Parameters:
      colGroup - the column group
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • selectColumnGroup

      public void selectColumnGroup​(GridColumnGroup colGroup)
      Selects all cells in the given column group in the receiver.
      Parameters:
      colGroup - the column group
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setCellSelection

      public void setCellSelection​(org.eclipse.swt.graphics.Point cell)
      Selects the selection to the given cell. The existing selection is cleared before selecting the given cell.
      Parameters:
      cell - point whose x values is a column index and y value is an item index
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_NULL_ARGUMENT - if the item is null
      • ERROR_INVALID_ARGUMENT - if the cell is invalid
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setCellSelection

      public void setCellSelection​(org.eclipse.swt.graphics.Point[] cells)
      Selects the selection to the given set of cell. The existing selection is cleared before selecting the given cells.
      Parameters:
      cells - point array whose x values is a column index and y value is an item index
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_NULL_ARGUMENT - if the cell array or an individual cell is null
      • ERROR_INVALID_ARGUMENT - if the a cell is invalid
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getCellSelection

      public org.eclipse.swt.graphics.Point[] getCellSelection()
      Returns an array of cells that are currently selected in the receiver. The order of the items is unspecified. An empty array indicates that no items are selected.

      Note: This is not the actual structure used by the receiver to maintain its selection, so modifying the array will not affect the receiver.

      Returns:
      an array representing the cell selection
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getFocusColumn

      GridColumn getFocusColumn()
    • updateColumnFocus

      void updateColumnFocus()
    • showToolTip

      protected void showToolTip​(GridItem item, GridColumn column, GridColumnGroup group, org.eclipse.swt.graphics.Point location)
      Shows the inplace tooltip for the given item and column. The location is the x and y origin of the text in the cell.

      This method may be overriden to provide their own custom tooltips.

      Parameters:
      item - the item currently hovered over or null.
      column - the column currently hovered over or null.
      group - the group currently hovered over or null.
      location - the x,y origin of the text in the hovered object.
    • hideToolTip

      protected void hideToolTip()
      Hides the inplace tooltip.

      This method must be overriden when showToolTip is overriden. Subclasses must call super when overriding this method.

    • recalculateRowHeaderHeight

      void recalculateRowHeaderHeight​(GridItem item, int oldHeight, int newHeight)
    • recalculateRowHeaderWidth

      void recalculateRowHeaderWidth​(GridItem item, int oldWidth, int newWidth)
    • setFont

      public void setFont​(org.eclipse.swt.graphics.Font font)
      Overrides:
      setFont in class org.eclipse.swt.widgets.Canvas
    • getItemHeaderWidth

      public int getItemHeaderWidth()
      Returns the row header width or 0 if row headers are not visible.
      Returns:
      the width of the row headers
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setItemHeaderWidth

      public void setItemHeaderWidth​(int width)
      Sets the row header width to the specified value. This automatically disables the auto width feature of the grid.
      Parameters:
      width - the width of the row header
      See Also:
      getItemHeaderWidth(), setAutoWidth(boolean)
    • setItemCount

      public void setItemCount​(int count)
      Sets the number of items contained in the receiver.
      Parameters:
      count - the number of items
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • isDisposing

      boolean isDisposing()
      Returns:
      the disposing
    • setHasSpanning

      void setHasSpanning​(boolean hasSpanning)
      Parameters:
      hasSpanning - the hasSpanning to set
    • getToolTipText

      public java.lang.String getToolTipText()
      Returns the receiver's tool tip text, or null if it has not been set.
      Overrides:
      getToolTipText in class org.eclipse.swt.widgets.Control
      Returns:
      the receiver's tool tip text
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setToolTipText

      public void setToolTipText​(java.lang.String string)
      Sets the receiver's tool tip text to the argument, which may be null indicating that no tool tip text should be shown.
      Overrides:
      setToolTipText in class org.eclipse.swt.widgets.Control
      Parameters:
      string - the new tool tip text (or null)
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • imageSetOnItem

      void imageSetOnItem​(int column, GridItem item)
      Updates the row height when the first image is set on an item.
      Parameters:
      column - the column the image is change
      item - item which images has just been set on.
    • setInsertMark

      void setInsertMark​(GridItem item, GridColumn column, boolean before)
      Display a mark indicating the point at which an item will be inserted. This is used as a visual hint to show where a dragged item will be inserted when dropped on the grid. This method should not be called directly, instead DND.FEEDBACK_INSERT_BEFORE or DND.FEEDBACK_INSERT_AFTER should be set in DropTargetEvent.feedback from within a DropTargetListener.
      Parameters:
      item - the insert item. Null will clear the insertion mark.
      column - the column of the cell. Null will make the insertion mark span all columns.
      before - true places the insert mark above 'item'. false places the insert mark below 'item'.
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_INVALID_ARGUMENT - if the item or column has been disposed
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • isInDragScrollArea

      boolean isInDragScrollArea​(org.eclipse.swt.graphics.Point point)
      Parameters:
      point -
      Returns:
      true if point is near the top or bottom border of the visible grid area
    • clear

      public void clear​(int index, boolean allChildren)
      Clears the item at the given zero-relative index in the receiver. The text, icon and other attributes of the item are set to the default value. If the table was created with the SWT.VIRTUAL style, these attributes are requested again as needed.
      Parameters:
      index - the index of the item to clear
      allChildren - true if all child items of the indexed item should be cleared recursively, and false otherwise
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      See Also:
      SWT.VIRTUAL, SWT.SetData
    • clear

      public void clear​(int start, int end, boolean allChildren)
      Clears the items in the receiver which are between the given zero-relative start and end indices (inclusive). The text, icon and other attributes of the items are set to their default values. If the table was created with the SWT.VIRTUAL style, these attributes are requested again as needed.
      Parameters:
      start - the start index of the item to clear
      end - the end index of the item to clear
      allChildren - true if all child items of the range of items should be cleared recursively, and false otherwise
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_INVALID_RANGE - if either the start or end are not between 0 and the number of elements in the list minus 1 (inclusive)
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      See Also:
      SWT.VIRTUAL, SWT.SetData
    • clear

      public void clear​(int[] indices, boolean allChildren)
      Clears the items at the given zero-relative indices in the receiver. The text, icon and other attributes of the items are set to their default values. If the table was created with the SWT.VIRTUAL style, these attributes are requested again as needed.
      Parameters:
      indices - the array of indices of the items
      allChildren - true if all child items of the indexed items should be cleared recursively, and false otherwise
      Throws:
      java.lang.IllegalArgumentException -
      • ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
      • ERROR_NULL_ARGUMENT - if the indices array is null
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      See Also:
      SWT.VIRTUAL, SWT.SetData
    • clearAll

      public void clearAll​(boolean allChildren)
      Clears all the items in the receiver. The text, icon and other attributes of the items are set to their default values. If the table was created with the SWT.VIRTUAL style, these attributes are requested again as needed.
      Parameters:
      allChildren - true if all child items of each item should be cleared recursively, and false otherwise
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      See Also:
      SWT.VIRTUAL, SWT.SetData
    • recalculateHeader

      public void recalculateHeader()
      Recalculate the height of the header
    • getVisibleRange

      public Grid.GridVisibleRange getVisibleRange()
      Query the grid for all currently visible rows and columns

      This support is provisional and may change

      Returns:
      all currently visible rows and columns
    • getStartColumnIndex

      int getStartColumnIndex()
    • getEndColumnIndex

      int getEndColumnIndex()
    • setSizeOnEveryItemImageChange

      void setSizeOnEveryItemImageChange​(boolean sizeOnEveryItemImageChange)
    • getRowHeaderWidth

      public int getRowHeaderWidth()
      Returns the width of the row headers.
      Returns:
      width of the column header row
      Throws:
      org.eclipse.swt.SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setAutoHeight

      public void setAutoHeight​(boolean enabled)
      Sets the value of the auto-height feature. When enabled, this feature resizes the height of rows to reflect the content of cells with word-wrapping enabled. Cell word-wrapping is enabled via the GridColumn.setWordWrap(boolean) method. If column headers have word-wrapping enabled, this feature will also resize the height of the column headers as necessary.
      Parameters:
      enabled - Set to true to enable this feature, false (default) otherwise.
    • isAutoHeight

      public boolean isAutoHeight()
      Returns the value of the auto-height feature, which resizes row heights and column header heights based on word-wrapped content.
      Returns:
      Returns whether or not the auto-height feature is enabled.
      See Also:
      setAutoHeight(boolean)
    • setAutoWidth

      public void setAutoWidth​(boolean enabled)
      Sets the value of the auto-width feature. When enabled, this feature resizes the width of the row headers to reflect the content of row headers.
      Parameters:
      enabled - Set to true to enable this feature, false (default) otherwise.
      See Also:
      isAutoWidth()
    • isAutoWidth

      public boolean isAutoWidth()
      Returns the value of the auto-height feature, which resizes row header width based on content.
      Returns:
      Returns whether or not the auto-width feature is enabled.
      See Also:
      setAutoWidth(boolean)
    • setWordWrapHeader

      public void setWordWrapHeader​(boolean enabled)
      Sets the value of the word-wrap feature for row headers. When enabled, this feature will word-wrap the contents of row headers.
      Parameters:
      enabled - Set to true to enable this feature, false (default) otherwise.
      See Also:
      isWordWrapHeader()
    • setForeground

      public void setForeground​(org.eclipse.swt.graphics.Color color)
      Overrides:
      setForeground in class org.eclipse.swt.widgets.Control
      See Also:
      Control.setForeground(org.eclipse.swt.graphics.Color)
    • isWordWrapHeader

      public boolean isWordWrapHeader()
      Returns the value of the row header word-wrap feature, which word-wraps the content of row headers.
      Returns:
      Returns whether or not the row header word-wrap feature is enabled.
      See Also:
      setWordWrapHeader(boolean)
    • refreshData

      public void refreshData()
      Refresh hasData GridItem state if Grid is virtual
    • isMoveOnTab

      public boolean isMoveOnTab()
      Returns:
      true if the mouse navigation is enabled on tab/shift tab
    • setMoveOnTab

      public void setMoveOnTab​(boolean moveOnTab)
      This param allows user to change the current selection by pressing TAB and SHIFT-TAB
      Parameters:
      moveOnTab - if true, navigation with tab key is enabled.
    • isFocusOnGrid

      public boolean isFocusOnGrid()
      Returns:
      true if the grid has focus
    • setSelectionType

      public void setSelectionType​(GridSelectionType selectionType)
      Change selection type (single or multi)
      Parameters:
      selectionType - the new selection type
    • addMouseListener

      public void addMouseListener​(org.eclipse.swt.events.MouseListener sourceListener)
      Overrides:
      addMouseListener in class org.eclipse.swt.widgets.Control
      See Also:
      Control.addMouseListener(org.eclipse.swt.events.MouseListener)
    • addListener

      public void addListener​(int eventType, org.eclipse.swt.widgets.Listener listener)
      Overrides:
      addListener in class org.eclipse.swt.widgets.Widget
      See Also:
      Widget.addListener(int, org.eclipse.swt.widgets.Listener)