Class 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
      private static class  Grid.RowRange
      A range of rows in a Grid.
    • 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

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      private void addCellstThatDoNotAlreadyExist​(java.util.List<org.eclipse.swt.graphics.Point> sourceList, java.util.List<org.eclipse.swt.graphics.Point> itemsToBeAdded)
      Adds Point objects from the itemsToBeAdded list that do not currently exist in the sourceList.
      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.
      private void addToCellSelection​(org.eclipse.swt.graphics.Point newCell)  
      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.
      private int blend​(int v1, int v2, int ratio)  
      private org.eclipse.swt.graphics.RGB blend​(org.eclipse.swt.graphics.RGB c1, org.eclipse.swt.graphics.RGB c2, int ratio)  
      private static int checkStyle​(int style)
      Filters out unnecessary styles, adds mandatory styles and generally manages the style to pass to the super class.
      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.
      private void clearDisplayOrderedCache()
      This method is used for clearing columns displayed ordering cache
      void clearItems()
      Clear simply all GridItems
      private void computeFooterHeight​(org.eclipse.swt.graphics.GC gc)  
      private void computeHeaderHeight()  
      private void computeHeaderHeight​(org.eclipse.swt.graphics.GC gc)
      Computes and sets the height of the header row.
      private int computeItemHeight​(GridItem item)  
      private int computeItemHeight​(GridItem item, org.eclipse.swt.graphics.GC gc)
      Returns the computed default item height.
      private void computeRowHeaderWidth​(int minWidth)  
      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
      private void estimate​(java.util.function.Consumer<org.eclipse.swt.graphics.GC> consumer)  
      private int estimateWithResult​(java.util.function.ToIntFunction<org.eclipse.swt.graphics.GC> function)  
      (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.
      private void getCells​(GridColumnGroup colGroup, java.util.Vector<org.eclipse.swt.graphics.Point> cells)  
      private void getCells​(GridColumn col, java.util.Vector<org.eclipse.swt.graphics.Point> cells)  
      private org.eclipse.swt.graphics.Point[] getCells​(GridItem item)  
      private void getCells​(GridItem item, java.util.Vector<org.eclipse.swt.graphics.Point> cells)  
      private void getCells​(GridItem fromItem, GridItem toItem, java.util.Vector<org.eclipse.swt.graphics.Point> cells)  
      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.
      private GridColumn getColumn​(GridItem item, org.eclipse.swt.graphics.Point point)
      Returns the column at the given point and a known item in the receiver or null if no such column exists.
      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.
      private int getColumnHeaderXPosition​(GridColumn column)
      Returns the x position of the given column.
      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.
      private int getHScrollSelectionInPixels()
      Returns the hscroll selection in pixels.
      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.
      private Grid.RowRange getRowRange​(int startIndex, int endIndex)
      Returns a Grid.RowRange ranging from the grid item at startIndex to that at endIndex.
      private Grid.RowRange getRowRange​(int startIndex, int availableHeight, boolean forceEndCompletelyInside, boolean inverse)
      This method can be used to build a range of grid rows that is allowed to span a certain height in pixels.
      private org.eclipse.swt.graphics.Point getRowSelectionRange​(GridItem item, GridColumn fromColumn, GridColumn toColumn)
      Returns a point whose x and y value are the to and from column indexes of the new selection range inclusive of all spanned columns.
      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.
      private org.eclipse.swt.graphics.Point getSelectionRange​(GridItem fromItem, GridColumn fromColumn, GridItem toItem, GridColumn toColumn)
      Returns a point whose x and y values are the to and from column indexes of the new selection range inclusive of all spanned columns.
      private GridColumn getSpanningColumn​(GridItem item, GridColumn column)
      Returns the column which is spanning the given column for the given item or null if it is not being spanned.
      (package private) int getStartColumnIndex()  
      private org.eclipse.swt.graphics.Point getTableSize()
      Returns the size of the preferred size of the inner table.
      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.
      (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
      private boolean handleCellClick​(GridItem item, int x, int y)
      Determines (which cell/if a cell) has been clicked (mouse down really) and notifies the appropriate renderer.
      private boolean handleCellHover​(int x, int y)
      Sets the hovering variables (hoverItem,hoveringColumn) as well as hoverDetail by talking to the cell renderers.
      private boolean handleColumnDragging​(int x)
      Manages the header column dragging and calculates the drop point, triggers a redraw.
      private void handleColumnDrop()
      Handles the moving of columns after a column is dropped.
      private boolean handleColumnFooterPush​(int x, int y)  
      private boolean handleColumnGroupHeaderClick​(int x, int y)
      Determines if a column group header has been clicked and forwards the event to the header renderer.
      private boolean handleColumnHeaderHoverWhilePushing​(int x, int y)
      Determines if the mouse is pushing the header but has since move out of the header bounds and therefore should be drawn unpushed.
      private boolean handleColumnHeaderPush​(int x, int y)
      Determines if a column header has been clicked, updates the renderer state and triggers a redraw if necesary.
      private void handleColumnResizerDragging​(int x)
      Sets the new width of the column being resized and fires the appropriate listeners.
      private void handleHovering​(int x, int y)
      Handles the assignment of the correct values to the hover* field variables that let the painting code now what to paint as hovered.
      private boolean handleHoverOnColumnResizer​(int x, int y)
      Determines if the mouse is hovering on a column resizer and changes the pointer and sets field appropriately.
      private boolean handleHoverOnRowResizer​(int x, int y)
      Determines if the mouse is hovering on a row resizer and changes the pointer and sets field appropriately.
      private boolean handleHoverOnSelectionDragArea​(int x, int y)
      Determines if the mouse is hovering on the selection drag area and changes the pointer and sets field appropriately.
      (package private) void handlePacked​(GridColumn column)  
      private void handleRowResizerDragging​(int y)
      Sets the new height of the item of the row being resized and fires the appropriate listeners.
      private void handleSpaceBarDown​(org.eclipse.swt.widgets.Event event)  
      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.
      private void initAccessible()
      Initialize accessibility.
      private void initListeners()
      Initialize all listeners.
      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)
      private boolean isMod1Home​(org.eclipse.swt.widgets.Event e)  
      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.
      private boolean isValidCell​(org.eclipse.swt.graphics.Point cell)
      Returns true if the given cell's x and y values are valid column and item indexes respectively.
      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)  
      private void onDispose​(org.eclipse.swt.widgets.Event event)  
      private void onFocusIn()  
      protected void onKeyDown​(org.eclipse.swt.widgets.Event e)
      Key down event handler.
      private void onMouseDoubleClick​(org.eclipse.swt.widgets.Event e)
      Mouse double click event handler.
      private void onMouseDown​(org.eclipse.swt.widgets.Event e)
      Mouse down event handler.
      private void onMouseExit​(org.eclipse.swt.events.MouseEvent e)
      Mouse exit event handler.
      private void onMouseMove​(org.eclipse.swt.events.MouseEvent e)
      Mouse move event handler.
      private void onMouseUp​(org.eclipse.swt.widgets.Event e)
      Mouse up handler.
      private void onMouseWheel​(org.eclipse.swt.widgets.Event e)
      Mouse wheel event handler.
      private void onPaint​(org.eclipse.swt.events.PaintEvent e)
      Paints.
      private void onResize()
      Resize event handler.
      private void onScrollSelection()
      Scrollbar selection event handler.
      private GridColumn overColumnFooter​(int x, int y)
      Returns a column reference if the x,y coordinates are over a column header (header only).
      private GridColumnGroup overColumnGroupHeader​(int x, int y)
      Returns a column group reference if the x,y coordinates are over a column group header (header only).
      private GridColumn overColumnHeader​(int x, int y)
      Returns a column reference if the x,y coordinates are over a column header (header only).
      private void paintFooter​(org.eclipse.swt.graphics.GC gc)  
      private void paintHeader​(org.eclipse.swt.graphics.GC gc)
      Paints the header.
      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.
      private org.eclipse.swt.widgets.Event selectAllCellsInternal()
      Selects all cells in the receiver.
      private org.eclipse.swt.widgets.Event selectAllRowsInternal()
      Selects rows 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.
      private org.eclipse.swt.widgets.Event updateCellSelection​(java.util.Vector<org.eclipse.swt.graphics.Point> newCells, int stateMask, boolean dragging, boolean reverseDuplicateSelections)
      Updates cell selection.
      private org.eclipse.swt.widgets.Event updateCellSelection​(org.eclipse.swt.graphics.Point newCell, int stateMask, boolean dragging, boolean reverseDuplicateSelections)
      Updates cell selection.
      (package private) void updateColumnFocus()  
      (package private) void updateColumnSelection()  
      private void updatePrimaryCheckColumn()
      Manages the setting of the checkbox column when the SWT.CHECK style was given to the table.
      private void updateScrollbars()
      Manages the state of the scrollbars when new items are added or the bounds are changed.
      private org.eclipse.swt.widgets.Event updateSelection​(GridItem item, int stateMask)
      Adds/removes items from the selected items list based on the selection/deselection of the given item.
      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
      • 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, isAutoScalable, 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, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • defaultFont

        private org.eclipse.swt.graphics.Font defaultFont
        Cached default font of Control.getFont.
      • ACC_COLUMN_DEFAULT_ACTION

        private static final java.lang.String ACC_COLUMN_DEFAULT_ACTION
        Accessibility default action for column headers and column group headers.
        See Also:
        Constant Field Values
      • ACC_ITEM_DEFAULT_ACTION

        private static final java.lang.String ACC_ITEM_DEFAULT_ACTION
        Accessibility default action for items.
        See Also:
        Constant Field Values
      • ACC_ITEM_ACTION_EXPAND

        private static final java.lang.String ACC_ITEM_ACTION_EXPAND
        Accessibility expand action for tree items.
        See Also:
        Constant Field Values
      • ACC_ITEM_ACTION_COLLAPSE

        private static final java.lang.String ACC_ITEM_ACTION_COLLAPSE
        Accessibility collapse action for tree items.
        See Also:
        Constant Field Values
      • ACC_TOGGLE_BUTTON_NAME

        private static final java.lang.String ACC_TOGGLE_BUTTON_NAME
        Accessibility name for the column group header toggle button.
        See Also:
        Constant Field Values
      • COLUMN_DRAG_ALPHA

        private static final int COLUMN_DRAG_ALPHA
        Alpha blending value used when drawing the dragged column header.
        See Also:
        Constant Field Values
      • DROP_POINT_LOWER_OFFSET

        private static final int DROP_POINT_LOWER_OFFSET
        Number of pixels below the header to draw the drop point.
        See Also:
        Constant Field Values
      • HORZ_SCROLL_INCREMENT

        private static final int HORZ_SCROLL_INCREMENT
        Horizontal scrolling increment, in pixels.
        See Also:
        Constant Field Values
      • COLUMN_RESIZER_THRESHOLD

        private static final int COLUMN_RESIZER_THRESHOLD
        The area to the left and right of the column boundary/resizer that is still considered the resizer area. This prevents a user from having to be *exactly* over the resizer.
        See Also:
        Constant Field Values
      • MIN_COLUMN_HEADER_WIDTH

        private static final int MIN_COLUMN_HEADER_WIDTH
        The minimum width of a column header.
        See Also:
        Constant Field Values
      • MIN_ROW_HEADER_HEIGHT

        private static final int MIN_ROW_HEADER_HEIGHT
        The minimum height of a row header.
        See Also:
        Constant Field Values
      • scrollValuesObsolete

        private boolean scrollValuesObsolete
        Tracks whether the scroll values are correct. If not they will be recomputed in onPaint. This allows us to get a free ride on top of the OS's paint event merging to assure that we don't perform this expensive operation when unnecessary.
      • visibleLinesBasedColumnPack

        private boolean visibleLinesBasedColumnPack
        When this variable is true, the pack is based only on the visible lines on the screen.
      • items

        private final java.util.List<GridItem> items
        All items in the table, not just root items.
      • rootItems

        private final java.util.List<GridItem> rootItems
        All root items.
      • selectedItems

        private final java.util.List<GridItem> selectedItems
        List of selected items.
      • focusItem

        private GridItem focusItem
        Reference to the item in focus.
      • cellSelectionEnabled

        private boolean cellSelectionEnabled
      • cellDragSelectionEnabled

        private boolean cellDragSelectionEnabled
      • selectedCells

        private final java.util.List<org.eclipse.swt.graphics.Point> selectedCells
      • selectedCellsBeforeRangeSelect

        private final java.util.List<org.eclipse.swt.graphics.Point> selectedCellsBeforeRangeSelect
      • cellDragSelectionOccuring

        private boolean cellDragSelectionOccuring
      • cellRowDragSelectionOccuring

        private boolean cellRowDragSelectionOccuring
      • cellColumnDragSelectionOccuring

        private boolean cellColumnDragSelectionOccuring
      • cellDragCTRL

        private boolean cellDragCTRL
      • followupCellSelectionEventOwed

        private boolean followupCellSelectionEventOwed
      • cellSelectedOnLastMouseDown

        private boolean cellSelectedOnLastMouseDown
      • cellRowSelectedOnLastMouseDown

        private boolean cellRowSelectedOnLastMouseDown
      • cellColumnSelectedOnLastMouseDown

        private boolean cellColumnSelectedOnLastMouseDown
      • shiftSelectionAnchorColumn

        private GridColumn shiftSelectionAnchorColumn
      • selectedColumns

        private final java.util.List<GridColumn> selectedColumns
      • intendedFocusColumn

        private GridColumn intendedFocusColumn
        This is the column that the user last navigated to, but may not be the focusColumn because that column may be spanned in the current row. This is only used in situations where the user has used the keyboard to navigate up or down in the table and the focusColumn has switched to a new column because the intended column (was maintained in this var) was spanned. The table will attempt to set focus back to the intended column during subsequent up/down navigations.
      • columns

        private final java.util.List<GridColumn> columns
        List of table columns in creation/index order.
      • displayOrderedColumns

        private final java.util.List<GridColumn> displayOrderedColumns
        List of the table columns in the order they are displayed.
      • topLeftRenderer

        private IRenderer topLeftRenderer
        Renderer to paint the top left area when both column and row headers are shown.
      • bottomLeftRenderer

        private IRenderer bottomLeftRenderer
        Renderer to paint the bottom left area when row headers and column footers are shown
      • rowHeaderRenderer

        private IRenderer rowHeaderRenderer
        Renderer used to paint row headers.
      • emptyColumnHeaderRenderer

        private IRenderer emptyColumnHeaderRenderer
        Renderer used to paint empty column headers, used when the columns don't fill the horz space.
      • emptyColumnFooterRenderer

        private IRenderer emptyColumnFooterRenderer
        Renderer used to paint empty column footers, used when the columns don't fill the horz space.
      • emptyCellRenderer

        private GridCellRenderer emptyCellRenderer
        Renderer used to paint empty cells to fill horz and vert space.
      • emptyRowHeaderRenderer

        private IRenderer emptyRowHeaderRenderer
        Renderer used to paint empty row headers when the rows don't fill the vertical space.
      • dropPointRenderer

        private final IRenderer dropPointRenderer
        Renderers the UI affordance identifying where the dragged column will be dropped.
      • focusRenderer

        private IRenderer focusRenderer
        Renderer used to paint on top of an already painted row to denote focus.
      • rowHeaderVisible

        private boolean rowHeaderVisible
        Are row headers visible?
      • columnHeadersVisible

        private boolean columnHeadersVisible
        Are column headers visible?
      • columnFootersVisible

        private boolean columnFootersVisible
        Are column footers visible?
      • selectionType

        private GridSelectionType selectionType
        Type of selection behavior. Valid values are SWT.SINGLE and SWT.MULTI.
      • selectionEnabled

        private boolean selectionEnabled
        True if selection highlighting is enabled.
      • itemHeight

        private int itemHeight
        Default height of items. This value is used for GridItems with a height of -1.
      • userModifiedItemHeight

        private boolean userModifiedItemHeight
      • rowHeaderWidth

        private int rowHeaderWidth
        Width of each row header.
      • headerHeight

        private int headerHeight
        Height of each column header.
      • footerHeight

        private int footerHeight
        Height of each column footer
      • hoveringOnColumnResizer

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

        private GridColumn columnBeingResized
        Reference to the column being resized.
      • rowsResizeable

        private boolean rowsResizeable
        Are this Grid's rows resizeable?
      • resizingColumn

        private boolean resizingColumn
        Is the user currently resizing a column?
      • resizingStartX

        private int resizingStartX
        The mouse X position when the user starts the resize.
      • resizingColumnStartWidth

        private int resizingColumnStartWidth
        The width of the column when the user starts the resize. This, together with the resizingStartX determines the current width during resize.
      • hoveringOnRowResizer

        private boolean hoveringOnRowResizer
      • rowBeingResized

        private GridItem rowBeingResized
      • resizingRow

        private boolean resizingRow
      • resizingStartY

        private int resizingStartY
      • resizingRowStartHeight

        private int resizingRowStartHeight
      • columnBeingPushed

        private GridColumn columnBeingPushed
        Reference to the column whose header is currently in a pushed state.
      • pushingColumn

        private boolean pushingColumn
        Is the user currently pushing a column header?
      • pushingAndHovering

        private boolean pushingAndHovering
        Is the user currently pushing a column header and hovering over that same header?
      • startHeaderPushX

        private int startHeaderPushX
        X position of the mouse when the user first pushes a column header.
      • startHeaderDragX

        private int startHeaderDragX
        X position of the mouse when the user has initiated a drag. This is different than startHeaderPushX because the mouse is allowed some 'wiggle-room' until the header is put into drag mode.
      • currentHeaderDragX

        private int currentHeaderDragX
        The current X position of the mouse during a header drag.
      • draggingColumn

        private boolean draggingColumn
        Are we currently dragging a column header?
      • dragDropBeforeColumn

        private GridColumn dragDropBeforeColumn
      • dragDropAfterColumn

        private GridColumn dragDropAfterColumn
      • dragDropPointValid

        private boolean dragDropPointValid
        True if the current dragDropPoint is a valid drop point for the dragged column. This is false if the column groups are involved and a column is being dropped into or out of its column group.
      • hoveringItem

        private GridItem hoveringItem
        Reference to the currently item that the mouse is currently hovering over.
      • hoveringColumn

        private GridColumn hoveringColumn
        Reference to the column that the mouse is currently hovering over. Includes the header and all cells (all rows) in this column.
      • hoveringColumnHeader

        private GridColumn hoveringColumnHeader
      • hoveringDetail

        private java.lang.String hoveringDetail
        String-based detail of what is being hovered over in a cell. This allows a renderer to differentiate between hovering over different parts of the cell. For example, hovering over a checkbox in the cell or hovering over a tree node in the cell. The table does nothing with this string except to set it back in the renderer when its painted. The renderer sets this during its notify method (InternalWidget.HOVER) and the table pulls it back and maintains it so it can be set back when the cell is painted. The renderer determines what the hover detail means and how it affects painting.
      • hoveringOverText

        private boolean hoveringOverText
        True if the mouse is hovering of a cell's text.
      • linesVisible

        private boolean linesVisible
        Are the grid lines visible?
      • treeLinesVisible

        private boolean treeLinesVisible
        Are tree lines visible?
      • lineColor

        private org.eclipse.swt.graphics.Color lineColor
        Grid line color.
      • vScroll

        private IScrollBarProxy vScroll
        Vertical scrollbar proxy.

        Note:

        • getTopIndex() is the only method allowed to call vScroll.getSelection() (except #updateScrollbars() of course)
        • setTopIndex(int) is the only method allowed to call vScroll.setSelection(int)
      • currentVisibleItems

        private int currentVisibleItems
        The number of GridItems whose visible = true. Maintained for performance reasons (rather than iterating over all items).
      • shiftSelectionAnchorItem

        private GridItem shiftSelectionAnchorItem
        Item selected when a multiple selection using shift+click first occurs. This item anchors all further shift+click selections.
      • columnScrolling

        private boolean columnScrolling
      • groupHeaderHeight

        private int groupHeaderHeight
      • cellHeaderSelectionBackground

        private org.eclipse.swt.graphics.Color cellHeaderSelectionBackground
      • disposeListener

        private org.eclipse.swt.widgets.Listener disposeListener
        Dispose listener. This listener is removed during the dispose event to allow re-firing of the event.
      • inplaceToolTip

        private GridToolTip inplaceToolTip
        The inplace tooltip.
      • backgroundColor

        private org.eclipse.swt.graphics.Color backgroundColor
      • disposing

        private boolean disposing
        True if the widget is being disposed. When true, events are not fired.
      • isTree

        private boolean isTree
        True if there is at least one tree node. This is used by accessibility and various places for optimization.
      • 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.
      • hasSpanning

        private boolean hasSpanning
        True if three is at least one cell spanning columns. This is used in various places for optimizatoin.
      • 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.
      • bottomIndexShownCompletely

        private boolean bottomIndexShownCompletely
        True if the last visible item is completely visible. The value must never be read directly. It is cached and updated when appropriate. #isShown() should be called for every client (even internal callers).
        See Also:
        bottomIndex
      • toolTipText

        private java.lang.String toolTipText
        Tooltip text - overriden because we have cell specific tooltips
      • firstImageSet

        private boolean firstImageSet
        Flag that is set to true as soon as one image is set on any one item. This is used to mimic Table behavior that resizes the rows on the first image added. See imageSetOnItem.
      • inplaceTooltipCapture

        private boolean inplaceTooltipCapture
        Mouse capture flag. Used for inplace tooltips. This flag must be used to ensure that we don't setCapture(false) in situations where we didn't do setCapture(true). The OS (SWT?) will automatically capture the mouse for us during a drag operation.
      • displayedToolTipText

        private java.lang.String displayedToolTipText
        This is the tooltip text currently used. This could be the tooltip text for the currently hovered cell, or the general grid tooltip. See handleCellHover.
      • DRAG_SCROLL_AREA_HEIGHT

        private static final int DRAG_SCROLL_AREA_HEIGHT
        The height of the area at the top and bottom of the visible grid area in which scrolling is initiated while dragging over this Grid.
        See Also:
        Constant Field Values
      • SELECTION_DRAG_BORDER_THRESHOLD

        private static final int SELECTION_DRAG_BORDER_THRESHOLD
        Threshold for the selection border used for drag n drop in mode (!#dragOnFullSelection}.
        See Also:
        Constant Field Values
      • hoveringOnSelectionDragArea

        private boolean hoveringOnSelectionDragArea
      • insertMarkItem

        private GridItem insertMarkItem
      • insertMarkColumn

        private GridColumn insertMarkColumn
      • insertMarkBefore

        private boolean insertMarkBefore
      • insertMarkRenderer

        private final IRenderer insertMarkRenderer
      • sizeOnEveryItemImageChange

        private boolean sizeOnEveryItemImageChange
      • autoHeight

        private boolean autoHeight
      • autoWidth

        private boolean autoWidth
      • wordWrapRowHeader

        private boolean wordWrapRowHeader
      • defaultKeyListener

        private org.eclipse.swt.widgets.Listener defaultKeyListener
      • defaultKeyListenerEnabled

        private boolean defaultKeyListenerEnabled
      • columnOrders

        private int[] columnOrders
        caching column orders improves grid rendering
      • moveOnTab

        private boolean moveOnTab
        If true, when user types TAB the selection moved to the next line, and SHIFT-TAB move to the previous line
    • Constructor Detail

      • 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 Detail

      • clearItems

        public void clearItems()
        Clear simply all GridItems
      • checkStyle

        private static int checkStyle​(int style)
        Filters out unnecessary styles, adds mandatory styles and generally manages the style to pass to the super class.
        Parameters:
        style - user specified style.
        Returns:
        style to pass to the super class.
      • 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
      • getColumn

        private GridColumn getColumn​(GridItem item,
                                     org.eclipse.swt.graphics.Point point)
        Returns the column at the given point and a known item in the receiver or null if no such column exists. The point is in the coordinate system of the receiver.
        Parameters:
        item - a known GridItem
        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
      • clearDisplayOrderedCache

        private void clearDisplayOrderedCache()
        This method is used for clearing columns displayed ordering cache
      • 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
      • getRowRange

        private Grid.RowRange getRowRange​(int startIndex,
                                          int endIndex)
        Returns a Grid.RowRange ranging from the grid item at startIndex to that at endIndex.

        This is primarily used to measure the height in pixel of such a range and to count the number of visible grid items within the range.

        Parameters:
        startIndex - index of the first item in the range or -1 to the first visible item in this grid
        endIndex - index of the last item in the range or -1 to use the last visible item in this grid
        Returns:
      • getRowRange

        private Grid.RowRange getRowRange​(int startIndex,
                                          int availableHeight,
                                          boolean forceEndCompletelyInside,
                                          boolean inverse)
        This method can be used to build a range of grid rows that is allowed to span a certain height in pixels.

        It returns a Grid.RowRange that contains information about the range, especially the index of the last element in the range (or if inverse == true, then the index of the first element).

        Note: Even if 'forceEndCompletelyInside' is set to true, the last item will not lie completely within the availableHeight, if (height of item at startIndex < availableHeight).

        Parameters:
        startIndex - index of the first (if inverse==false) or last (if inverse==true) item in the range
        availableHeight - height in pixels
        forceEndCompletelyInside - if true, the last item in the range will lie completely within the availableHeight, otherwise it may lie partly outside this range
        inverse - if true, then the first item in the range will be searched, not the last
        Returns:
        range of grid rows
        See Also:
        Grid.RowRange
      • 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
      • computeHeaderHeight

        private void computeHeaderHeight​(org.eclipse.swt.graphics.GC gc)
        Computes and sets the height of the header row. This method will ask for the preferred size of all the column headers and use the max.
        Parameters:
        gc - GC for font metrics, etc.
      • computeHeaderHeight

        private void computeHeaderHeight()
      • computeFooterHeight

        private void computeFooterHeight​(org.eclipse.swt.graphics.GC gc)
      • computeItemHeight

        private int computeItemHeight​(GridItem item,
                                      org.eclipse.swt.graphics.GC gc)
        Returns the computed default item height. Currently this method just gets the preferred size of all the cells in the given row and returns that (it is then used as the height of all rows with items having a height of -1).
        Parameters:
        item - item to use for sizing
        gc - GC used to perform font metrics,etc.
        Returns:
        the row height
      • computeItemHeight

        private int computeItemHeight​(GridItem item)
      • getColumnHeaderXPosition

        private int getColumnHeaderXPosition​(GridColumn column)
        Returns the x position of the given column. Takes into account scroll position.
        Parameters:
        column - given column
        Returns:
        x position
      • getHScrollSelectionInPixels

        private int getHScrollSelectionInPixels()
        Returns the hscroll selection in pixels. This method abstracts away the differences between column by column scrolling and pixel based scrolling.
        Returns:
        the horizontal scroll selection in pixels
      • getTableSize

        private org.eclipse.swt.graphics.Point getTableSize()
        Returns the size of the preferred size of the inner table.
        Returns:
        the preferred size of the table.
      • handleColumnDragging

        private boolean handleColumnDragging​(int x)
        Manages the header column dragging and calculates the drop point, triggers a redraw.
        Parameters:
        x - mouse x
        Returns:
        true if this event has been consumed.
      • handleColumnDrop

        private void handleColumnDrop()
        Handles the moving of columns after a column is dropped.
      • handleColumnHeaderHoverWhilePushing

        private boolean handleColumnHeaderHoverWhilePushing​(int x,
                                                            int y)
        Determines if the mouse is pushing the header but has since move out of the header bounds and therefore should be drawn unpushed. Also initiates a column header drag when appropriate.
        Parameters:
        x - mouse x
        y - mouse y
        Returns:
        true if this event has been consumed.
      • handleColumnGroupHeaderClick

        private boolean handleColumnGroupHeaderClick​(int x,
                                                     int y)
        Determines if a column group header has been clicked and forwards the event to the header renderer.
        Parameters:
        x - mouse x
        y - mouse y
        Returns:
        true if this event has been consumed.
      • handleColumnHeaderPush

        private boolean handleColumnHeaderPush​(int x,
                                               int y)
        Determines if a column header has been clicked, updates the renderer state and triggers a redraw if necesary.
        Parameters:
        x - mouse x
        y - mouse y
        Returns:
        true if this event has been consumed.
      • handleColumnFooterPush

        private boolean handleColumnFooterPush​(int x,
                                               int y)
      • handleColumnResizerDragging

        private void handleColumnResizerDragging​(int x)
        Sets the new width of the column being resized and fires the appropriate listeners.
        Parameters:
        x - mouse x
      • fireColumnsMoved

        void fireColumnsMoved()
      • handlePacked

        void handlePacked​(GridColumn column)
      • handleRowResizerDragging

        private void handleRowResizerDragging​(int y)
        Sets the new height of the item of the row being resized and fires the appropriate listeners.
        Parameters:
        x - mouse x
      • handleHoverOnColumnResizer

        private boolean handleHoverOnColumnResizer​(int x,
                                                   int y)
        Determines if the mouse is hovering on a column resizer and changes the pointer and sets field appropriately.
        Parameters:
        x - mouse x
        y - mouse y
        Returns:
        true if this event has been consumed.
      • handleHoverOnRowResizer

        private boolean handleHoverOnRowResizer​(int x,
                                                int y)
        Determines if the mouse is hovering on a row resizer and changes the pointer and sets field appropriately.
        Parameters:
        x - mouse x
        y - mouse y
        Returns:
        true if this event has been consumed.
      • 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
      • onPaint

        private void onPaint​(org.eclipse.swt.events.PaintEvent e)
        Paints.
        Parameters:
        e - paint event
      • overColumnHeader

        private GridColumn overColumnHeader​(int x,
                                            int y)
        Returns a column reference if the x,y coordinates are over a column header (header only).
        Parameters:
        x - mouse x
        y - mouse y
        Returns:
        column reference which mouse is over, or null.
      • overColumnFooter

        private GridColumn overColumnFooter​(int x,
                                            int y)
        Returns a column reference if the x,y coordinates are over a column header (header only).
        Parameters:
        x - mouse x
        y - mouse y
        Returns:
        column reference which mouse is over, or null.
      • overColumnGroupHeader

        private GridColumnGroup overColumnGroupHeader​(int x,
                                                      int y)
        Returns a column group reference if the x,y coordinates are over a column group header (header only).
        Parameters:
        x - mouse x
        y - mouse y
        Returns:
        column group reference which mouse is over, or null.
      • paintHeader

        private void paintHeader​(org.eclipse.swt.graphics.GC gc)
        Paints the header.
        Parameters:
        gc - gc from paint event
      • paintFooter

        private void paintFooter​(org.eclipse.swt.graphics.GC gc)
      • updateScrollbars

        private void updateScrollbars()
        Manages the state of the scrollbars when new items are added or the bounds are changed.
      • updateSelection

        private org.eclipse.swt.widgets.Event updateSelection​(GridItem item,
                                                              int stateMask)
        Adds/removes items from the selected items list based on the selection/deselection of the given item.
        Parameters:
        item - item being selected/unselected
        stateMask - key state during selection
        Returns:
        selection event that needs to be fired or null
      • updateCellSelection

        private org.eclipse.swt.widgets.Event updateCellSelection​(org.eclipse.swt.graphics.Point newCell,
                                                                  int stateMask,
                                                                  boolean dragging,
                                                                  boolean reverseDuplicateSelections)
        Updates cell selection.
        Parameters:
        newCell - newly clicked, navigated to cell.
        stateMask - statemask during preceeding mouse or key event.
        dragging - true if the user is dragging.
        reverseDuplicateSelections - true if the user is reversing selection rather than adding to.
        Returns:
        selection event that will need to be fired or null.
      • updateCellSelection

        private org.eclipse.swt.widgets.Event updateCellSelection​(java.util.Vector<org.eclipse.swt.graphics.Point> newCells,
                                                                  int stateMask,
                                                                  boolean dragging,
                                                                  boolean reverseDuplicateSelections)
        Updates cell selection.
        Parameters:
        newCell - newly clicked, navigated to cells.
        stateMask - statemask during preceeding mouse or key event.
        dragging - true if the user is dragging.
        reverseDuplicateSelections - true if the user is reversing selection rather than adding to.
        Returns:
        selection event that will need to be fired or null.
      • addCellstThatDoNotAlreadyExist

        private void addCellstThatDoNotAlreadyExist​(java.util.List<org.eclipse.swt.graphics.Point> sourceList,
                                                    java.util.List<org.eclipse.swt.graphics.Point> itemsToBeAdded)
        Adds Point objects from the itemsToBeAdded list that do not currently exist in the sourceList.
        Parameters:
        sourceList -
        itemsToBeAdded -
      • addToCellSelection

        private void addToCellSelection​(org.eclipse.swt.graphics.Point newCell)
      • updateColumnSelection

        void updateColumnSelection()
      • initListeners

        private void initListeners()
        Initialize all listeners.
      • disableDefaultKeyListener

        public void disableDefaultKeyListener()
        Disable default key listener
      • enableDefaultKeyListener

        public void enableDefaultKeyListener()
        Enable default key listener
      • onFocusIn

        private void onFocusIn()
      • onDispose

        private void onDispose​(org.eclipse.swt.widgets.Event event)
      • onMouseWheel

        private void onMouseWheel​(org.eclipse.swt.widgets.Event e)
        Mouse wheel event handler.
        Parameters:
        e - event
      • onMouseDown

        private void onMouseDown​(org.eclipse.swt.widgets.Event e)
        Mouse down event handler.
        Parameters:
        e - event
      • onMouseDoubleClick

        private void onMouseDoubleClick​(org.eclipse.swt.widgets.Event e)
        Mouse double click event handler.
        Parameters:
        e - event
      • onMouseUp

        private void onMouseUp​(org.eclipse.swt.widgets.Event e)
        Mouse up handler.
        Parameters:
        e - event
      • onMouseMove

        private void onMouseMove​(org.eclipse.swt.events.MouseEvent e)
        Mouse move event handler.
        Parameters:
        e - event
      • handleHovering

        private void handleHovering​(int x,
                                    int y)
        Handles the assignment of the correct values to the hover* field variables that let the painting code now what to paint as hovered.
        Parameters:
        x - mouse x coordinate
        y - mouse y coordinate
      • 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.
      • onMouseExit

        private void onMouseExit​(org.eclipse.swt.events.MouseEvent e)
        Mouse exit event handler.
        Parameters:
        e - event
      • onKeyDown

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

        private boolean isMod1Home​(org.eclipse.swt.widgets.Event e)
      • handleSpaceBarDown

        private void handleSpaceBarDown​(org.eclipse.swt.widgets.Event event)
      • onResize

        private void onResize()
        Resize event handler.
      • onScrollSelection

        private void onScrollSelection()
        Scrollbar selection event handler.
      • 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
      • handleCellClick

        private boolean handleCellClick​(GridItem item,
                                        int x,
                                        int y)
        Determines (which cell/if a cell) has been clicked (mouse down really) and notifies the appropriate renderer. Returns true when a cell has responded to this event in some way and prevents the event from triggering an action further down the chain (like a selection).
        Parameters:
        item - item clicked
        x - mouse x
        y - mouse y
        Returns:
        true if this event has been consumed.
      • handleCellHover

        private boolean handleCellHover​(int x,
                                        int y)
        Sets the hovering variables (hoverItem,hoveringColumn) as well as hoverDetail by talking to the cell renderers. Triggers a redraw if necessary.
        Parameters:
        x - mouse x
        y - mouse y
        Returns:
        true if a new section of the table is now being hovered
      • 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
      • updatePrimaryCheckColumn

        private void updatePrimaryCheckColumn()
        Manages the setting of the checkbox column when the SWT.CHECK style was given to the table. This method will ensure that the first column of the table always has a checkbox when SWT.CHECK is given to the table.
      • 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
      • selectAllCellsInternal

        private org.eclipse.swt.widgets.Event selectAllCellsInternal()
        Selects all cells in the receiver.
        Returns:
        An Event object
        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
      • selectAllRowsInternal

        private org.eclipse.swt.widgets.Event selectAllRowsInternal()
        Selects rows in the receiver.
        Returns:
        An Event object
        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
      • updateColumnFocus

        void updateColumnFocus()
      • getCells

        private void getCells​(GridColumn col,
                              java.util.Vector<org.eclipse.swt.graphics.Point> cells)
      • getCells

        private void getCells​(GridColumnGroup colGroup,
                              java.util.Vector<org.eclipse.swt.graphics.Point> cells)
      • getCells

        private void getCells​(GridItem item,
                              java.util.Vector<org.eclipse.swt.graphics.Point> cells)
      • getCells

        private org.eclipse.swt.graphics.Point[] getCells​(GridItem item)
      • getCells

        private void getCells​(GridItem fromItem,
                              GridItem toItem,
                              java.util.Vector<org.eclipse.swt.graphics.Point> cells)
      • blend

        private int blend​(int v1,
                          int v2,
                          int ratio)
      • blend

        private org.eclipse.swt.graphics.RGB blend​(org.eclipse.swt.graphics.RGB c1,
                                                   org.eclipse.swt.graphics.RGB c2,
                                                   int ratio)
      • getSelectionRange

        private org.eclipse.swt.graphics.Point getSelectionRange​(GridItem fromItem,
                                                                 GridColumn fromColumn,
                                                                 GridItem toItem,
                                                                 GridColumn toColumn)
        Returns a point whose x and y values are the to and from column indexes of the new selection range inclusive of all spanned columns.
        Parameters:
        fromItem -
        fromColumn -
        toItem -
        toColumn -
        Returns:
      • getRowSelectionRange

        private org.eclipse.swt.graphics.Point getRowSelectionRange​(GridItem item,
                                                                    GridColumn fromColumn,
                                                                    GridColumn toColumn)
        Returns a point whose x and y value are the to and from column indexes of the new selection range inclusive of all spanned columns.
        Parameters:
        item -
        fromColumn -
        toColumn -
        Returns:
      • getSpanningColumn

        private GridColumn getSpanningColumn​(GridItem item,
                                             GridColumn column)
        Returns the column which is spanning the given column for the given item or null if it is not being spanned.
        Parameters:
        item -
        column -
        Returns:
      • isValidCell

        private boolean isValidCell​(org.eclipse.swt.graphics.Point cell)
        Returns true if the given cell's x and y values are valid column and item indexes respectively.
        Parameters:
        cell -
        Returns:
      • 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
      • initAccessible

        private void initAccessible()
        Initialize accessibility.
      • 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.
      • handleHoverOnSelectionDragArea

        private boolean handleHoverOnSelectionDragArea​(int x,
                                                       int y)
        Determines if the mouse is hovering on the selection drag area and changes the pointer and sets field appropriately.

        Note: The 'selection drag area' is that part of the selection, on which a drag event can be initiated. This is either the border of the selection (i.e. a cell border between a slected and a non-selected cell) or the complete selection (i.e. anywhere on a selected cell). What area serves as drag area is determined by #setDragOnFullSelection(boolean).

        Parameters:
        x -
        y -
        Returns:
        See Also:
        #setDragOnFullSelection(boolean)
      • 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.
      • computeRowHeaderWidth

        private void computeRowHeaderWidth​(int minWidth)
      • estimateWithResult

        private int estimateWithResult​(java.util.function.ToIntFunction<org.eclipse.swt.graphics.GC> function)
      • estimate

        private void estimate​(java.util.function.Consumer<org.eclipse.swt.graphics.GC> consumer)
      • 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)