Class Table

All Implemented Interfaces:
Drawable

public class Table extends Composite
Instances of this class implement a selectable user interface object that displays a list of images and strings and issues notification when selected.

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

Style VIRTUAL is used to create a Table whose TableItems are to be populated by the client on an on-demand basis instead of up-front. This can provide significant performance improvements for tables that are very large or for which TableItem population is expensive (for example, retrieving values from an external source).

Here is an example of using a Table with style VIRTUAL:

 final Table table = new Table (parent, SWT.VIRTUAL | SWT.BORDER);
 table.setItemCount (1000000);
 table.addListener (SWT.SetData, new Listener () {
     public void handleEvent (Event event) {
         TableItem item = (TableItem) event.item;
         int index = table.indexOf (item);
         item.setText ("Item " + index);
         System.out.println (item.getText ());
     }
 });

Note that although this class is a subclass of Composite, it does not normally make sense to add Control children to it, or set a layout on it, unless implementing something like a cell editor.

Styles:
SINGLE, MULTI, CHECK, FULL_SELECTION, HIDE_SELECTION, VIRTUAL, NO_SCROLL, NO_SEARCH
Events:
Selection, DefaultSelection, SetData, MeasureItem, EraseItem, PaintItem

Note: Only one of the styles SINGLE, and MULTI may be specified.

IMPORTANT: This class is not intended to be subclassed.

See Also:
  • Field Details

    • modelHandle

      long modelHandle
    • checkRenderer

      long checkRenderer
    • itemCount

      int itemCount
    • columnCount

      int columnCount
    • lastIndexOf

      int lastIndexOf
    • sortDirection

      int sortDirection
    • selectionCountOnPress

      int selectionCountOnPress
    • selectionCountOnRelease

      int selectionCountOnRelease
    • ignoreCell

      long ignoreCell
    • items

      TableItem[] items
    • columns

      TableColumn[] columns
    • currentItem

      TableItem currentItem
    • sortColumn

      TableColumn sortColumn
    • imageList

      ImageList imageList
    • headerImageList

      ImageList headerImageList
    • firstCustomDraw

      boolean firstCustomDraw
    • firstCompute

      boolean firstCompute
      True iff computeSize has never been called on this Table
    • drawState

      int drawState
    • drawFlags

      int drawFlags
    • background

      GdkRGBA background
    • foreground

      GdkRGBA foreground
    • drawForegroundRGBA

      GdkRGBA drawForegroundRGBA
    • headerBackground

      Color headerBackground
    • headerForeground

      Color headerForeground
    • ownerDraw

      boolean ownerDraw
    • ignoreSize

      boolean ignoreSize
    • pixbufSizeSet

      boolean pixbufSizeSet
    • hasChildren

      boolean hasChildren
    • maxWidth

      int maxWidth
    • topIndex

      int topIndex
    • cachedAdjustment

      double cachedAdjustment
    • currentAdjustment

      double currentAdjustment
    • pixbufHeight

      int pixbufHeight
    • pixbufWidth

      int pixbufWidth
    • headerHeight

      int headerHeight
    • boundsChangedSinceLastDraw

      boolean boundsChangedSinceLastDraw
    • headerVisible

      boolean headerVisible
    • wasScrolled

      boolean wasScrolled
    • rowActivated

      boolean rowActivated
    • headerCSSProvider

      private long headerCSSProvider
    • CHECKED_COLUMN

      static final int CHECKED_COLUMN
      See Also:
    • GRAYED_COLUMN

      static final int GRAYED_COLUMN
      See Also:
    • FOREGROUND_COLUMN

      static final int FOREGROUND_COLUMN
      See Also:
    • BACKGROUND_COLUMN

      static final int BACKGROUND_COLUMN
      See Also:
    • FONT_COLUMN

      static final int FONT_COLUMN
      See Also:
    • FIRST_COLUMN

      static final int FIRST_COLUMN
      See Also:
    • CELL_PIXBUF

      static final int CELL_PIXBUF
      See Also:
    • CELL_TEXT

      static final int CELL_TEXT
      See Also:
    • CELL_FOREGROUND

      static final int CELL_FOREGROUND
      See Also:
    • CELL_BACKGROUND

      static final int CELL_BACKGROUND
      See Also:
    • CELL_FONT

      static final int CELL_FONT
      See Also:
    • CELL_SURFACE

      static final int CELL_SURFACE
      See Also:
    • CELL_TYPES

      static final int CELL_TYPES
      See Also:
  • Constructor Details

    • Table

      public Table(Composite parent, int style)
      Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.

      The style value is either one of the style constants defined in class SWT which is applicable to instances of this class, or must be built by bitwise OR'ing together (that is, using the int "|" operator) two or more of those SWT style constants. The class description lists the style constants that are applicable to the class. Style bits are also inherited from superclasses.

      Parameters:
      parent - a composite control which will be the parent of the new instance (cannot be null)
      style - the style of control to construct
      Throws:
      IllegalArgumentException -
      • ERROR_NULL_ARGUMENT - if the parent is null
      SWTException -
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
      • ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
      See Also:
  • Method Details

    • _addListener

      void _addListener(int eventType, Listener listener)
      Overrides:
      _addListener in class Widget
    • _getItem

      TableItem _getItem(int index)
    • checkStyle

      static int checkStyle(int style)
    • cellDataProc

      long cellDataProc(long tree_column, long cell, long tree_model, long iter, long data)
      Overrides:
      cellDataProc in class Widget
    • checkData

      boolean checkData(TableItem item)
    • checkSubclass

      protected void checkSubclass()
      Description copied from class: Widget
      Checks that this class can be subclassed.

      The SWT class library is intended to be subclassed only at specific, controlled points (most notably, Composite and Canvas when implementing new widgets). This method enforces this rule unless it is overridden.

      IMPORTANT: By providing an implementation of this method that allows a subclass of a class which does not normally allow subclassing to be created, the implementer agrees to be fully responsible for the fact that any such subclass will likely fail between SWT releases and will be strongly platform specific. No support is provided for user-written classes which are implemented in this fashion.

      The ability to subclass outside of the allowed SWT classes is intended purely to enable those not on the SWT development team to implement patches in order to get around specific limitations in advance of when those limitations can be addressed by the team. Subclassing should not be attempted without an intimate and detailed understanding of the hierarchy.

      Overrides:
      checkSubclass in class Composite
    • addSelectionListener

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

      When widgetSelected is called, the item field of the event object is valid. If the receiver has the SWT.CHECK style and the check selection changes, the event object detail field contains the value SWT.CHECK. widgetDefaultSelected is typically called when an item is double-clicked. The item field of the event object is valid for default selection, but the detail field is not used.

      Parameters:
      listener - the listener which should be notified when the user changes the receiver's selection
      Throws:
      IllegalArgumentException -
      • ERROR_NULL_ARGUMENT - if the listener is null
      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:
    • calculateWidth

      int calculateWidth(long column, long iter)
    • clear

      public void clear(int index)
      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
      Throws:
      IllegalArgumentException -
      • ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
      SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      Since:
      3.0
      See Also:
    • clear

      public void clear(int start, int end)
      Removes the items from 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
      Throws:
      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)
      SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      Since:
      3.0
      See Also:
    • clear

      public void clear(int[] indices)
      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
      Throws:
      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
      SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      Since:
      3.0
      See Also:
    • clearAll

      public void clearAll()
      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.
      Throws:
      SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      Since:
      3.0
      See Also:
    • computeSizeInPixels

      Point computeSizeInPixels(int wHint, int hHint, boolean changed)
      Overrides:
      computeSizeInPixels in class Composite
    • copyModel

      void copyModel(long oldModel, int oldStart, long newModel, int newStart, int modelLength)
    • createColumn

      void createColumn(TableColumn column, int index)
    • createHandle

      void createHandle(int index)
      Overrides:
      createHandle in class Composite
    • createItem

      void createItem(TableColumn column, int index)
    • createItem

      void createItem(TableItem item, int index)
    • createRenderers

      void createRenderers(long columnHandle, int modelIndex, boolean check, int columnStyle)
    • createWidget

      void createWidget(int index)
      Overrides:
      createWidget in class Scrollable
    • applyThemeBackground

      int applyThemeBackground()
      Overrides:
      applyThemeBackground in class Composite
      Returns:
    • 0 to remove THEME_BACKGROUND
    • 1 to apply THEME_BACKGROUND
    • otherwise don't change THEME_BACKGROUND state
    • defaultBackground

      GdkRGBA defaultBackground()
      Overrides:
      defaultBackground in class Control
    • deregister

      void deregister()
      Overrides:
      deregister in class Composite
    • 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.
      Parameters:
      index - the index of the item to deselect
      Throws:
      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.
      Parameters:
      start - the start index of the items to deselect
      end - the end index of the items to deselect
      Throws:
      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.
      Parameters:
      indices - the array of indices for the items to deselect
      Throws:
      IllegalArgumentException -
      • ERROR_NULL_ARGUMENT - if the set of indices is null
      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.
      Throws:
      SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • destroyItem

      void destroyItem(TableColumn column)
    • destroyItem

      void destroyItem(TableItem item)
    • dragDetect

      boolean dragDetect(int x, int y, boolean filter, boolean dragOnTimeout, boolean[] consume)
      Overrides:
      dragDetect in class Control
    • eventWindow

      long eventWindow()
      Overrides:
      eventWindow in class Control
    • eventSurface

      long eventSurface()
      Overrides:
      eventSurface in class Control
    • getClientAreaInPixels

      Rectangle getClientAreaInPixels()
      Overrides:
      getClientAreaInPixels in class Composite
    • getClientWidth

      int getClientWidth()
      Overrides:
      getClientWidth in class Control
    • getColumn

      public TableColumn 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. Columns are returned in the order that they were created. If no TableColumns 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:
      IllegalArgumentException -
      • ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
      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:
    • getColumnCount

      public int getColumnCount()
      Returns the number of columns contained in the receiver. If no TableColumns 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:
      SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getColumnTypes

      long[] getColumnTypes(int columnCount)
    • 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:
      SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      Since:
      3.1
      See Also:
    • getColumns

      public TableColumn[] getColumns()
      Returns an array of TableColumns which are the columns in the receiver. Columns are returned in the order that they were created. If no TableColumns 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:
      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:
    • getContextBackgroundGdkRGBA

      GdkRGBA getContextBackgroundGdkRGBA()
      Overrides:
      getContextBackgroundGdkRGBA in class Control
    • getContextColorGdkRGBA

      GdkRGBA getContextColorGdkRGBA()
      Overrides:
      getContextColorGdkRGBA in class Control
    • getFocusItem

      TableItem getFocusItem()
    • getGridLineWidth

      public int getGridLineWidth()
      Returns the width in points of a grid line.
      Returns:
      the width of a grid line in points
      Throws:
      SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getHeaderBackground

      public Color getHeaderBackground()
      Returns the header background color.
      Returns:
      the receiver's header background color.
      Throws:
      SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      Since:
      3.106
    • getHeaderForeground

      public Color getHeaderForeground()
      Returns the header foreground color.
      Returns:
      the receiver's header foreground color.
      Throws:
      SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      Since:
      3.106
    • getHeaderHeight

      public int getHeaderHeight()
      Returns the height of the receiver's header
      Returns:
      the height of the header or zero if the header is not visible
      Throws:
      SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      Since:
      2.0
    • getHeaderVisible

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

      If one of the receiver's ancestors is not visible or some other condition makes the receiver not visible, this method may still indicate that it is considered visible even though it may not actually be showing.

      Returns:
      the receiver's header's visibility state
      Throws:
      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 TableItem 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:
      IllegalArgumentException -
      • ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
      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 TableItem getItem(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.

      The item that is returned represents an item that could be selected by the user. For example, if selection only occurs in items in the first column, then null is returned if the point is outside of the item. Note that the SWT.FULL_SELECTION style hint, which specifies the selection policy, determines the extent of the selection.

      Parameters:
      point - the point used to locate the item
      Returns:
      the item at the given point, or null if the point is not in a selectable item
      Throws:
      IllegalArgumentException -
      • ERROR_NULL_ARGUMENT - if the point is null
      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:
      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 height of the area which would be used to display one of the items in the receiver.
      Returns:
      the height of one item
      Throws:
      SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getItems

      public TableItem[] getItems()
      Returns a (possibly empty) array of TableItems 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:
      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 receiver's lines are visible, and false otherwise. Note that some platforms draw grid lines while others may draw alternating row colors.

      If one of the receiver's ancestors is not visible or some other condition makes the receiver not visible, this method may still indicate that it is considered visible even though it may not actually be showing.

      Returns:
      the visibility state of the lines
      Throws:
      SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • getPixbufRenderer

      long getPixbufRenderer(long column)
    • getSelection

      public TableItem[] getSelection()
      Returns an array of TableItems 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 selection
      Throws:
      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.
      Returns:
      the number of selected items
      Throws:
      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.
      Returns:
      the index of the selected item
      Throws:
      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.

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

      public TableColumn getSortColumn()
      Returns the column which shows the sort indicator for the receiver. The value may be null if no column shows the sort indicator.
      Returns:
      the sort indicator
      Throws:
      SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      Since:
      3.2
      See Also:
    • getSortDirection

      public int getSortDirection()
      Returns the direction of the sort indicator for the receiver. The value will be one of UP, DOWN or NONE.
      Returns:
      the sort direction
      Throws:
      SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      Since:
      3.2
      See Also:
    • getTextRenderer

      long getTextRenderer(long column)
    • 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:
      SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • gtk_button_press_event

      long gtk_button_press_event(long widget, long event)
      Overrides:
      gtk_button_press_event in class Composite
    • gtk_gesture_press_event

      int gtk_gesture_press_event(long gesture, int n_press, double x, double y, long event)
      Description copied from class: Control
      Handling multi-press event on GTK4
      Overrides:
      gtk_gesture_press_event in class Control
      Parameters:
      gesture - the corresponding controller responsible for capturing the event
      n_press - how many touch/button presses happened with this one
      x - the x coordinate, in widget allocation coordinates
      y - the y coordinate, in widget allocation coordinates
      event - the GdkEvent captured
    • gtk_row_activated

      long gtk_row_activated(long tree, long path, long column)
      Overrides:
      gtk_row_activated in class Widget
    • gtk3_key_press_event

      long gtk3_key_press_event(long widget, long event)
      Overrides:
      gtk3_key_press_event in class Composite
    • toggleItemAndSendEvent

      private void toggleItemAndSendEvent(TableItem item)
    • sendTreeDefaultSelection

      void sendTreeDefaultSelection()
      Used to emulate DefaultSelection event. See Bug 312568. Feature in GTK. 'row-activation' event comes before DoubleClick event. This is causing the editor not to get focus after double-click. The solution is to manually send the DefaultSelection event after a double-click, and to emulate it for Space/Return.
    • gtk_button_release_event

      long gtk_button_release_event(long widget, long event)
      Overrides:
      gtk_button_release_event in class Control
    • gtk_changed

      long gtk_changed(long widget)
      Overrides:
      gtk_changed in class Widget
    • drawInheritedBackground

      void drawInheritedBackground(long cairo)
    • gtk_draw

      long gtk_draw(long widget, long cairo)
      Overrides:
      gtk_draw in class Composite
    • gtk_motion_notify_event

      long gtk_motion_notify_event(long widget, long event)
      Overrides:
      gtk_motion_notify_event in class Control
    • gtk_scroll_event

      long gtk_scroll_event(long widget, long eventPtr)
      Overrides:
      gtk_scroll_event in class Scrollable
    • gtk_start_interactive_search

      long gtk_start_interactive_search(long widget)
      Overrides:
      gtk_start_interactive_search in class Widget
    • gtk_toggled

      long gtk_toggled(long renderer, long pathStr)
      Overrides:
      gtk_toggled in class Widget
    • gtk_widget_get_preferred_size

      void gtk_widget_get_preferred_size(long widget, GtkRequisition requisition)
      Overrides:
      gtk_widget_get_preferred_size in class Widget
    • hideFirstColumn

      void hideFirstColumn()
    • hookEvents

      void hookEvents()
      Overrides:
      hookEvents in class Composite
    • indexOf

      public int indexOf(TableColumn 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:
      IllegalArgumentException -
      • ERROR_NULL_ARGUMENT - if the column is null
      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(TableItem 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:
      IllegalArgumentException -
      • ERROR_NULL_ARGUMENT - if the item is null
      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.
      Parameters:
      index - the index of the item
      Returns:
      the selection state of the item at the index
      Throws:
      SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • mnemonicHit

      boolean mnemonicHit(char key)
      Overrides:
      mnemonicHit in class Control
    • mnemonicMatch

      boolean mnemonicMatch(char key)
      Overrides:
      mnemonicMatch in class Control
    • paintWindow

      long paintWindow()
      Overrides:
      paintWindow in class Control
    • propagateDraw

      void propagateDraw(long container, long cairo)
      Description copied from class: Composite

      Propagates draw events from a parent container to its children using gtk_container_propagate_draw(). This method only works if the fixedHandle has been connected to the "draw" signal, and only propagates draw events to other siblings of handle (i.e. other children of fixedHandle, but not handle itself).

      It's useful to propagate draw events to other child widgets for things like Table/Tree editors, or other scenarios where a widget is a child of a non-standard container widget (i.e., not a direct child of a Composite).

      Overrides:
      propagateDraw in class Composite
      Parameters:
      container - the parent container, i.e. fixedHandle
      cairo - the cairo context provided by GTK
    • recreateRenderers

      void recreateRenderers()
    • redrawBackgroundImage

      void redrawBackgroundImage()
      Overrides:
      redrawBackgroundImage in class Scrollable
    • register

      void register()
      Overrides:
      register in class Composite
    • releaseChildren

      void releaseChildren(boolean destroy)
      Overrides:
      releaseChildren in class Composite
    • releaseWidget

      void releaseWidget()
      Overrides:
      releaseWidget in class Composite
    • 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:
      IllegalArgumentException -
      • ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
      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:
      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)
      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:
      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
      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

      public void removeAll()
      Removes all of the items from the receiver.
      Throws:
      SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • removeSelectionListener

      public void removeSelectionListener(SelectionListener listener)
      Removes the listener from the collection of listeners who will be notified when the user changes the receiver's selection.
      Parameters:
      listener - the listener which should no longer be notified
      Throws:
      IllegalArgumentException -
      • ERROR_NULL_ARGUMENT - if the listener is null
      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:
    • sendMeasureEvent

      void sendMeasureEvent(long cell, long width, long height)
    • rendererGetPreferredWidthProc

      long rendererGetPreferredWidthProc(long cell, long handle, long minimun_size, long natural_size)
      Overrides:
      rendererGetPreferredWidthProc in class Widget
    • rendererSnapshotProc

      long rendererSnapshotProc(long cell, long snapshot, long widget, long background_area, long cell_area, long flags)
      Overrides:
      rendererSnapshotProc in class Widget
    • rendererRenderProc

      long rendererRenderProc(long cell, long cr, long widget, long background_area, long cell_area, long flags)
      Overrides:
      rendererRenderProc in class Widget
    • rendererRender

      void rendererRender(long cell, long cr, long snapshot, long widget, long background_area, long cell_area, long expose_area, long flags)
    • getGC

      private GC getGC(long cr)
    • resetCustomDraw

      void resetCustomDraw()
    • reskinChildren

      void reskinChildren(int flags)
      Overrides:
      reskinChildren in class Composite
    • searchEnabled

      boolean searchEnabled()
    • 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.
      Parameters:
      index - the index of the item to select
      Throws:
      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.

      Parameters:
      start - the start of the range
      end - the end of the range
      Throws:
      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:
    • 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.

      Parameters:
      indices - the array of indices for the items to select
      Throws:
      IllegalArgumentException -
      • ERROR_NULL_ARGUMENT - if the array of indices is null
      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:
    • selectAll

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

      If the receiver is single-select, do nothing.

      Throws:
      SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • selectFocusIndex

      void selectFocusIndex(int index)
    • setBackgroundGdkRGBA

      void setBackgroundGdkRGBA(long context, long handle, GdkRGBA rgba)
      Overrides:
      setBackgroundGdkRGBA in class Control
    • setBackgroundSurface

      void setBackgroundSurface(Image image)
      Overrides:
      setBackgroundSurface in class Control
    • setBounds

      int setBounds(int x, int y, int width, int height, boolean move, boolean resize)
      Overrides:
      setBounds in class Composite
    • 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:
      SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      IllegalArgumentException -
      • ERROR_NULL_ARGUMENT - if the item order is null
      • ERROR_INVALID_ARGUMENT - if the item order is not the same length as the number of items
      Since:
      3.1
      See Also:
    • setFontDescription

      void setFontDescription(long font)
      Overrides:
      setFontDescription in class Control
    • setForegroundGdkRGBA

      void setForegroundGdkRGBA(GdkRGBA rgba)
      Overrides:
      setForegroundGdkRGBA in class Control
    • setHeaderBackground

      public void setHeaderBackground(Color color)
      Sets the header background color to the color specified by the argument, or to the default system color if the argument is null.

      Note: This operation is a HINT and is not supported on all platforms. If the native header has a 3D look and feel (e.g. Windows 7), this method will cause the header to look FLAT irrespective of the state of the table style.

      Parameters:
      color - the new color (or null)
      Throws:
      IllegalArgumentException -
      • ERROR_INVALID_ARGUMENT - if the argument has been disposed
      SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      Since:
      3.106
    • updateHeaderCSS

      void updateHeaderCSS()
    • setHeaderForeground

      public void setHeaderForeground(Color color)
      Sets the header foreground color to the color specified by the argument, or to the default system color if the argument is null.

      Note: This operation is a HINT and is not supported on all platforms. If the native header has a 3D look and feel (e.g. Windows 7), this method will cause the header to look FLAT irrespective of the state of the table style.

      Parameters:
      color - the new color (or null)
      Throws:
      IllegalArgumentException -
      • ERROR_INVALID_ARGUMENT - if the argument has been disposed
      SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      Since:
      3.106
    • setHeaderVisible

      public void setHeaderVisible(boolean show)
      Marks the receiver's header as visible if the argument is true, and marks it invisible otherwise.

      If one of the receiver's ancestors is not visible or some other condition makes the receiver not visible, marking it visible may not actually cause it to be displayed.

      Parameters:
      show - the new visibility state
      Throws:
      SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setItemCount

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

      public void setLinesVisible(boolean show)
      Marks the receiver's lines as visible if the argument is true, and marks it invisible otherwise. Note that some platforms draw grid lines while others may draw alternating row colors.

      If one of the receiver's ancestors is not visible or some other condition makes the receiver not visible, marking it visible may not actually cause it to be displayed.

      Parameters:
      show - the new visibility state
      Throws:
      SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • setModel

      void setModel(long newModel)
    • setOrientation

      void setOrientation(boolean create)
      Overrides:
      setOrientation in class Composite
    • setParentBackground

      void setParentBackground()
      Overrides:
      setParentBackground in class Control
    • setParentGdkResource

      void setParentGdkResource(Control child)
      Overrides:
      setParentGdkResource in class Control
    • setRedraw

      public void setRedraw(boolean redraw)
      Description copied from class: Control
      If the argument is false, causes subsequent drawing operations in the receiver to be ignored. No drawing of any kind can occur in the receiver until the flag is set to true. Graphics operations that occurred while the flag was false are lost. When the flag is set to true, the entire widget is marked as needing to be redrawn. Nested calls to this method are stacked.

      Note: This operation is a hint and may not be supported on some platforms or for some widgets.

      Overrides:
      setRedraw in class Control
      Parameters:
      redraw - the new redraw state
      See Also:
    • setScrollWidth

      void setScrollWidth(long column, TableItem item)
    • setSortColumn

      public void setSortColumn(TableColumn column)
      Sets the column used by the sort indicator for the receiver. A null value will clear the sort indicator. The current sort column is cleared before the new column is set.
      Parameters:
      column - the column used by the sort indicator or null
      Throws:
      IllegalArgumentException -
      • ERROR_INVALID_ARGUMENT - if the column is disposed
      SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      Since:
      3.2
    • setSortDirection

      public void setSortDirection(int direction)
      Sets the direction of the sort indicator for the receiver. The value can be one of UP, DOWN or NONE.
      Parameters:
      direction - the direction of the sort indicator
      Throws:
      SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      Since:
      3.2
    • 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, and if necessary the receiver is scrolled to make the new selection visible.
      Parameters:
      index - the index of the item to select
      Throws:
      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

      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, and if necessary the receiver is scrolled to make the new selection visible.

      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.

      Parameters:
      start - the start index of the items to select
      end - the end index of the items to select
      Throws:
      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

      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, and if necessary the receiver is scrolled to make the new selection visible.

      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.

      Parameters:
      indices - the indices of the items to select
      Throws:
      IllegalArgumentException -
      • ERROR_NULL_ARGUMENT - if the array of indices is null
      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

      public void setSelection(TableItem item)
      Sets the receiver's selection to the given item. The current selection is cleared before the new item is selected, and if necessary the receiver is scrolled to make the new selection visible.

      If the item is not in the receiver, then it is ignored.

      Parameters:
      item - the item to select
      Throws:
      IllegalArgumentException -
      • ERROR_NULL_ARGUMENT - if the item is null
      • ERROR_INVALID_ARGUMENT - if the item has been disposed
      SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      Since:
      3.2
    • setSelection

      public void setSelection(TableItem[] items)
      Sets the receiver's selection to be the given array of items. The current selection is cleared before the new items are selected, and if necessary the receiver is scrolled to make the new selection visible.

      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.

      Parameters:
      items - the array of items
      Throws:
      IllegalArgumentException -
      • ERROR_NULL_ARGUMENT - if the array of items is null
      • ERROR_INVALID_ARGUMENT - if one of the items has been disposed
      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:
    • 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:
      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(TableColumn column)
      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:
      column - the column to be shown
      Throws:
      IllegalArgumentException -
      • ERROR_NULL_ARGUMENT - if the column is null
      • ERROR_INVALID_ARGUMENT - if the column has been disposed
      SWTException -
      • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
      • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
      Since:
      3.0
    • showFirstColumn

      boolean showFirstColumn()
    • showItem

      public void showItem(TableItem 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:
      IllegalArgumentException -
      • ERROR_NULL_ARGUMENT - if the item is null
      • ERROR_INVALID_ARGUMENT - if the item has been disposed
      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:
    • showItem

      void showItem(long iter)
    • 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:
      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:
    • updateScrollBarValue

      void updateScrollBarValue(ScrollBar bar)
      Overrides:
      updateScrollBarValue in class Scrollable
    • windowProc

      long windowProc(long handle, long arg0, long user_data)
      Overrides:
      windowProc in class Control
    • resizeCalculationsGTK3

      Point resizeCalculationsGTK3(long widget, int width, int height)
      Overrides:
      resizeCalculationsGTK3 in class Control
    • checkSetDataInProcessBeforeRemoval

      void checkSetDataInProcessBeforeRemoval(int start, int end)
      Check the table item range [start, end) for items that are in process of sending SWT#SetData event. If such items exist, throw an exception. Does nothing if the given range contains no indices.
      Parameters:
      start - index of first item to check
      end - index after the last item to check
    • dispose

      public void dispose()
      Description copied from class: Widget
      Disposes of the operating system resources associated with the receiver and all its descendants. After this method has been invoked, the receiver and all descendants will answer true when sent the message isDisposed(). Any internal connections between the widgets in the tree will have been removed to facilitate garbage collection. This method does nothing if the widget is already disposed.

      NOTE: This method is not called recursively on the descendants of the receiver. This means that, widget implementers can not detect when a widget is being disposed of by re-implementing this method, but should instead listen for the Dispose event.

      Overrides:
      dispose in class Widget
      See Also: