Class Grid
- java.lang.Object
-
- org.eclipse.swt.widgets.Widget
-
- org.eclipse.swt.widgets.Control
-
- org.eclipse.swt.widgets.Scrollable
-
- org.eclipse.swt.widgets.Composite
-
- org.eclipse.nebula.widgets.grid.Grid
-
public class Grid extends Composite
Instances of this class implement a selectable user interface object that displays a list of images and strings and issue notification when selected.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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddSelectionListener(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 theSelectionListenerinterface.voidaddTreeListener(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 theTreeListenerinterface.voidclear(int[] indices, boolean allChildren)Clears the items at the given zero-relative indices in the receiver.voidclear(int index, boolean allChildren)Clears the item at the given zero-relative index in the receiver.voidclear(int start, int end, boolean allChildren)Clears the items in the receiver which are between the given zero-relative start and end indices (inclusive).voidclearAll(boolean allChildren)Clears all the items in the receiver.PointcomputeSize(int wHint, int hHint, boolean changed)Returns the preferred size of the receiver.voiddeselect(int index)Deselects the item at the given zero-relative index in the receiver.voiddeselect(int[] indices)Deselects the items at the given zero-relative indices in the receiver.voiddeselect(int start, int end)Deselects the items at the given zero-relative indices in the receiver.voiddeselectAll()Deselects all selected items in the receiver.voiddeselectAllCells()Deselects all selected cells in the receiver.voiddeselectCell(Point cell)Deselects the given cell in the receiver.voiddeselectCells(Point[] cells)Deselects the given cells.<T> TgetAdapter(java.lang.Class<T> adapter)Implementation of theAdaptableinterface.PointgetCell(Point point)Returns the cell at the given point in the receiver or null if no such cell exists.Point[]getCellSelection()Returns an array of cells that are currently selected in the receiver.intgetCellSelectionCount()Returns the number of selected cells contained in the receiver.booleangetCellSelectionEnabled()Returns true if the cells are selectable in the reciever.GridColumngetColumn(int index)Returns the column at the given, zero-relative index in the receiver.GridColumngetColumn(Point point)Returns the column at the given point in the receiver or null if no such column exists.intgetColumnCount()Returns the number of columns contained in the receiver.GridColumnGroupgetColumnGroup(int index)Returns the column group at the given, zero-relative index in the receiver.intgetColumnGroupCount()Returns the number of column groups contained in the receiver.GridColumnGroup[]getColumnGroups()Returns an array ofGridColumnGroups which are the column groups in the receiver.int[]getColumnOrder()Returns an array of zero-relative integers that map the creation order of the receiver's items to the order in which they are currently being displayed.GridColumn[]getColumns()Returns an array ofGridColumns which are the columns in the receiver.PointgetFocusCell()Returns the current cell in focus.GridColumngetFocusColumn()Returns the current column in focus.GridItemgetFocusItem()Returns the current item in focus.intgetFooterHeight()Returns the height of the column footers.booleangetFooterVisible()Returnstrueif the receiver's footer is visible, andfalseotherwiseintgetGroupHeaderHeight()Returns the height of the column group headers.intgetHeaderHeight()Returns the height of the column headers.booleangetHeaderVisible()Returnstrueif the receiver's header is visible, andfalseotherwise.protected IScrollBarProxygetHorizontalScrollBarProxy()GridItemgetItem(int index)Returns the item at the given, zero-relative index in the receiver.GridItemgetItem(Point point)Returns the item at the given point in the receiver or null if no such item exists.intgetItemCount()Returns the number of items contained in the receiver.intgetItemHeaderWidth()Returns the row header width or 0 if row headers are not visible.intgetItemHeight()Returns the default height of the items in thisGrid.GridItem[]getItems()Returns a (possibly empty) array ofGridItems which are the items in the receiver.booleangetLinesVisible()Returns true if the lines are visible.GridColumngetNextVisibleColumn(GridColumn column)Returns the next visible column in the table.GridItemgetNextVisibleItem(GridItem item)Returns the next visible item in the table.GridColumngetPreviousVisibleColumn(GridColumn column)Returns the previous visible column in the table.GridItemgetPreviousVisibleItem(GridItem item)Returns the previous visible item in the table.GridItemgetRootItem(int index)TODO: JavaDocintgetRootItemCount()Returns the number of root items contained in the receiver.GridItem[]getRootItems()Returns a (possibly empty) array ofGridItems which are the root items in the receiver.GridItem[]getSelection()Returns a array ofGridItems that are currently selected in the receiver.intgetSelectionCount()Returns the number of selected items contained in the receiver.booleangetSelectionEnabled()Returnstrueif selection is enabled, false otherwise.intgetSelectionIndex()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.intgetTopIndex()Returns the zero-relative index of the item which is currently at the top of the receiver.protected IScrollBarProxygetVerticalScrollBarProxy()intindexOf(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.intindexOf(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.booleanisAutoHeight()Returns the value of the auto-height feature, which resizes row heights and column header heights based on word-wrapped content.booleanisCellSelected(Point cell)Returns true if the given cell is selected.booleanisCellSelectionEnabled()Returns true if the cells are selectable in the reciever.booleanisRowHeaderVisible()Returnstrueif the receiver's row header is visible, andfalseotherwise.booleanisSelected(int index)Returnstrueif the item is selected, andfalseotherwise.booleanisSelected(GridItem item)Returns true if the given item is selected.booleanisWordWrapHeader()Returns the value of the row header word-wrap feature, which word-wraps the content of row headers.voidrecalculateHeader()Recalculate the height of the headervoidremove(int index)Removes the item from the receiver at the given zero-relative index.voidremove(int[] indices)Removes the items from the receiver's list at the given zero-relative indices.voidremove(int start, int end)Removes the items from the receiver which are between the given zero-relative start and end indices (inclusive).voidremoveAll()Removes all of the items from the receiver.voidremoveSelectionListener(SelectionListener listener)Removes the listener from the collection of listeners who will be notified when the receiver's selection changes.voidremoveTreeListener(TreeListener listener)Removes the listener from the collection of listeners who will be notified when the receiver's items changes.voidselect(int index)Selects the item at the given zero-relative index in the receiver.voidselect(int[] indices)Selects the items at the given zero-relative indices in the receiver.voidselect(int start, int end)Selects the items in the range specified by the given zero-relative indices in the receiver.voidselectAll()Selects all of the items in the receiver.voidselectAllCells()Selects all cells in the receiver.voidselectCell(Point cell)Selects the given cell.voidselectCells(Point[] cells)Selects the given cells.voidselectColumn(int col)Selects all cells in the given column in the receiver.voidselectColumnGroup(int colGroup)Selects all cells in the given column group in the receiver.voidselectColumnGroup(GridColumnGroup colGroup)Selects all cells in the given column group in the receiver.voidsetAutoHeight(boolean autoHeight)Sets the value of the auto-height feature.voidsetCellSelection(Point cell)Selects the selection to the given cell.voidsetCellSelection(Point[] cells)Selects the selection to the given set of cell.voidsetCellSelectionEnabled(boolean cellSelection)Sets whether cells are selectable in the receiver.voidsetColumnOrder(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.voidsetData(java.lang.String key, java.lang.Object value)Sets the application defined property of the receiver with the specified name to the given value.voidsetFocusColumn(GridColumn column)Sets the focused column to the given column.voidsetFocusItem(GridItem item)Sets the focused item to the given item.voidsetFont(Font font)Sets the font that the receiver will use to paint textual information to the font specified by the argument, or to the default font for that kind of control if the argument is null.voidsetFooterVisible(boolean show)Marks the receiver's footer as visible if the argument istrue, and marks it invisible otherwise.voidsetHeaderVisible(boolean show)Marks the receiver's header as visible if the argument istrue, and marks it invisible otherwise.voidsetItemCount(int count)Sets the number of items contained in the receiver.voidsetItemHeaderWidth(int width)Sets the row header width to the specified value.voidsetItemHeight(int height)Sets the default height for thisGrid's items.voidsetLinesVisible(boolean linesVisible)Sets the line visibility.voidsetRowHeaderVisible(boolean show)Marks the receiver's row header as visible if the argument istrue, and marks it invisible otherwise.voidsetRowHeaderVisible(boolean show, int minWidth)Marks the receiver's row header as visible if the argument istrue, and marks it invisible otherwise.voidsetSelection(int index)Selects the item at the given zero-relative index in the receiver.voidsetSelection(int[] indices)Selects the items at the given zero-relative indices in the receiver.voidsetSelection(int start, int end)Selects the items in the range specified by the given zero-relative indices in the receiver.voidsetSelection(GridItem[] items)Sets the receiver's selection to be the given array of items.voidsetSelectionEnabled(boolean selectionEnabled)Enables selection highlighting if the argument istrue.voidsetTopIndex(int index)Sets the zero-relative index of the item which is currently at the top of the receiver.voidsetWordWrapHeader(boolean enabled)Sets the value of the word-wrap feature for row headers.voidshowColumn(GridColumn column)Shows the column.voidshowItem(GridItem item)Shows the item.voidshowSelection()Shows the selection.-
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, 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, getVerticalBar
-
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addTouchListener, addTraverseListener, computeSize, forceFocus, getAccessible, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getShell, getSize, getToolTipText, getTouchEnabled, getVisible, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeTouchListener, removeTraverseListener, requestLayout, setBackground, setBackgroundImage, setBounds, setBounds, setCursor, setEnabled, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setSize, setSize, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, update
-
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkSubclass, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, toString
-
-
-
-
Constructor Detail
-
Grid
public Grid(Composite parent, int style)
Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.- 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:
java.lang.IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the parent is null
SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
- See Also:
SWT.SINGLE,SWT.MULTI
-
-
Method Detail
-
computeSize
public Point computeSize(int wHint, int hHint, boolean changed)
Returns the preferred size of the receiver.The preferred size of a control is the size that it would best be displayed at. The width hint and height hint arguments allow the caller to ask a control questions such as "Given a particular width, how high does the control need to be to show all of the contents?" To indicate that the caller does not wish to constrain a particular dimension, the constant
SWT.DEFAULTis passed for the hint.If the changed flag is
true, it indicates that the receiver's contents have changed, therefore any caches that a layout manager containing the control may have been keeping need to be flushed. When the control is resized, the changed flag will befalse, so layout manager caches can be retained.- Overrides:
computeSizein classComposite- Parameters:
wHint- the width hint (can beSWT.DEFAULT)hHint- the height hint (can beSWT.DEFAULT)changed-trueif the control's contents have changed, andfalseotherwise- Returns:
- the preferred size of the control.
- See Also:
Layout,Control.getBorderWidth(),Control.getBounds(),Control.getSize(),Control.pack(boolean), "computeTrim, getClientArea for controls that implement them"
-
addSelectionListener
public void addSelectionListener(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 theSelectionListenerinterface.Cell selection events may have
Event.detail = SWT.DRAGwhen 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
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 receiver's selection changes.- Parameters:
listener- the listener which should no longer be notified- 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:
SelectionListener,addSelectionListener(SelectionListener)
-
addTreeListener
public void addTreeListener(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 theTreeListenerinterface.- Parameters:
listener- the listener which should be notified- Throws:
java.lang.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:
TreeListener,removeTreeListener(org.eclipse.swt.events.TreeListener),TreeEvent
-
removeTreeListener
public void removeTreeListener(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:
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)
-
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
-
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
-
getItems
public GridItem[] getItems()
Returns a (possibly empty) array ofGridItems 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
-
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) *
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(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
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
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:
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 ofGridItems 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:
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: JavaDoc- Parameters:
index-- Returns:
- the root item
-
getNextVisibleItem
public GridItem getNextVisibleItem(GridItem item)
Returns the next visible item in the table.- Parameters:
item- item- Returns:
- next visible item or null
- 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
-
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:
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 noGridColumns 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
-
getColumns
public GridColumn[] getColumns()
Returns an array ofGridColumns which are the columns in the receiver. If noGridColumns 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
-
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 noGridColumns were created by the programmer, this method will throwERROR_INVALID_RANGEdespite 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)
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(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
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
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:
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
-
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
-
getNextVisibleColumn
public GridColumn getNextVisibleColumn(GridColumn column)
Returns the next visible column in the table.- Parameters:
column- column- Returns:
- next visible column or null
- 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
-
getPreviousVisibleColumn
public GridColumn getPreviousVisibleColumn(GridColumn column)
Returns the previous visible column in the table.- Parameters:
column- column- Returns:
- previous visible column or null
- 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
-
getColumnGroupCount
public int getColumnGroupCount()
Returns the number of column groups contained in the receiver.- Returns:
- the number of column groups
- 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
-
getColumnGroups
public GridColumnGroup[] getColumnGroups()
Returns an array ofGridColumnGroups 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:
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)
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
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 theSWT.VIRTUALstyle, these attributes are requested again as needed.- Parameters:
index- the index of the item to clearallChildren-trueif all child items of the indexed item should be cleared recursively, andfalseotherwise- 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)
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 theSWT.VIRTUALstyle, these attributes are requested again as needed.- Parameters:
start- the start index of the item to clearend- the end index of the item to clearallChildren-trueif all child items of the range of items should be cleared recursively, andfalseotherwise- 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)
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 theSWT.VIRTUALstyle, these attributes are requested again as needed.- Parameters:
indices- the array of indices of the itemsallChildren-trueif all child items of the indexed items should be cleared recursively, andfalseotherwise- 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
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 theSWT.VIRTUALstyle, these attributes are requested again as needed.- Parameters:
allChildren-trueif all child items of each item should be cleared recursively, andfalseotherwise- 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:
SWT.VIRTUAL,SWT.SetData
-
setSelectionEnabled
public void setSelectionEnabled(boolean selectionEnabled)
Enables selection highlighting if the argument istrue.- Parameters:
selectionEnabled- the selection enabled 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
-
getSelectionEnabled
public boolean getSelectionEnabled()
Returnstrueif selection is enabled, false otherwise.- Returns:
- the selection enabled 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
-
getCellSelectionEnabled
public boolean getCellSelectionEnabled()
Returns true if the cells are selectable in the reciever.- Returns:
- cell selection enablement status.
- 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.13
-
setCellSelectionEnabled
public void setCellSelectionEnabled(boolean cellSelection)
Sets whether cells are selectable in the receiver.Note: Using markup in the cell text will require data-cell-index attribute to be added to the HTML element that points to the cell column index. Row header column (visible or not) always has index 0.
- Parameters:
cellSelection- the cellSelection to set- 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.13
-
isCellSelectionEnabled
public boolean isCellSelectionEnabled()
Returns true if the cells are selectable in the reciever.- Returns:
- cell selection enablement status.
- Since:
- 3.13
-
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:
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 rangeend- 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:
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
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:
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(Point cell)
Selects the given cell. Invalid cells are ignored.- Parameters:
cell- point whose x value is a column index and y value is an item index- Throws:
java.lang.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
- Since:
- 3.13
-
selectCells
public void selectCells(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
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.13
-
selectAllCells
public void selectAllCells()
Selects all cells 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
- Since:
- 3.13
-
selectColumn
public void selectColumn(int col)
Selects all cells in the given column in the receiver.- Parameters:
col-- 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.13
-
selectColumnGroup
public void selectColumnGroup(int colGroup)
Selects all cells in the given column group in the receiver.- Parameters:
colGroup- the column group- 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.13
-
selectColumnGroup
public void selectColumnGroup(GridColumnGroup colGroup)
Selects all cells in the given column group in the receiver.- Parameters:
colGroup- the column group- 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.13
-
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:
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 deselectend- 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.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
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:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
deselectCell
public void deselectCell(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
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.13
-
deselectCells
public void deselectCells(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
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.13
-
deselectAllCells
public void deselectAllCells()
Deselects all selected cells 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
- Since:
- 3.13
-
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:
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 selectend- 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:
deselectAll(),select(int,int)
-
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
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
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[])
-
getSelection
public GridItem[] getSelection()
Returns a array ofGridItems 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:
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:
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:
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.13
-
setCellSelection
public void setCellSelection(Point cell)
Selects the selection to the given cell. The existing selection is cleared before selecting the given cell.- Parameters:
cell- point whose x value 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
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.13
-
setCellSelection
public void setCellSelection(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
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.13
-
getCellSelection
public 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:
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.13
-
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:
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:
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)
Returnstrueif the item is selected, andfalseotherwise. 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:
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
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(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
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.13
-
getCell
public Point getCell(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 cell- Returns:
- the cell at the given point
- Throws:
java.lang.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
- Since:
- 3.13
-
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)
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 rangeend- 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)
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
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
-
setHeaderVisible
public void setHeaderVisible(boolean show)
Marks the receiver's header as visible if the argument istrue, and marks it invisible otherwise.- 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
-
getHeaderVisible
public boolean getHeaderVisible()
Returnstrueif the receiver's header is visible, andfalseotherwise.- 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
-
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:
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 istrue, and marks it invisible otherwise.- 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
-
getFooterVisible
public boolean getFooterVisible()
Returnstrueif the receiver's footer is visible, andfalseotherwise- Returns:
- the receiver's footer'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
-
getFooterHeight
public int getFooterHeight()
Returns the height of the column footers.- Returns:
- height of the column footer row
- 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
-
getGroupHeaderHeight
public int getGroupHeaderHeight()
Returns the height of the column group headers.- Returns:
- height of column group headers
- 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
-
setLinesVisible
public void setLinesVisible(boolean linesVisible)
Sets the line visibility.- Parameters:
linesVisible- The linesVisible to set.- 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 lines are visible.- Returns:
- Returns the linesVisible.
- 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
-
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
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getFocusItem
public GridItem getFocusItem()
Returns the current item in focus.- Returns:
- item in focus or
null. - 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
-
setFocusColumn
public void setFocusColumn(GridColumn column)
Sets the focused column 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
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.13
-
getFocusColumn
public GridColumn getFocusColumn()
Returns the current column in focus. Column focus is only applicable when cell selection is enabled.- Returns:
- column in focus or
null. - 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.13
-
getFocusCell
public 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:
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.13
-
setItemHeight
public void setItemHeight(int height)
Sets the default height for thisGrid'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
Gridis used as a default for all items (and is returned bygetItemHeight()).- Parameters:
height- default height in pixels- Throws:
java.lang.IllegalArgumentException-- ERROR_INVALID_ARGUMENT - if the height is < 1
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()
-
getItemHeight
public int getItemHeight()
Returns the default height of the items in thisGrid. SeesetItemHeight(int)for details.- Returns:
- default height 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
- See Also:
setItemHeight(int)
-
setFont
public void setFont(Font font)
Description copied from class:ControlSets the font that the receiver will use to paint textual information to the font specified by the argument, or to the default font for that kind of control if the argument is null.
-
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
-
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
-
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:
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
-
showColumn
public void showColumn(GridColumn 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:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created 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:
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 autoHeight)
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:
autoHeight- 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)
-
recalculateHeader
public void recalculateHeader()
Recalculate the height of the header- Since:
- 3.4
-
setRowHeaderVisible
public void setRowHeaderVisible(boolean show)
Marks the receiver's row header as visible if the argument istrue, and marks it invisible otherwise.- 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
- Since:
- 3.14
-
setRowHeaderVisible
public void setRowHeaderVisible(boolean show, int minWidth)Marks the receiver's row header as visible if the argument istrue, and marks it invisible otherwise.- Parameters:
show- the new visibility stateminWidth- the minimun width of the row column- 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.14
-
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- Since:
- 3.14
- See Also:
getItemHeaderWidth()
-
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:
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.14
-
isRowHeaderVisible
public boolean isRowHeaderVisible()
Returnstrueif the receiver's row header is visible, andfalseotherwise.- Returns:
- the receiver's row 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
- Since:
- 3.14
-
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.- Since:
- 3.14
- See Also:
isWordWrapHeader()
-
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.
- Since:
- 3.14
- See Also:
setWordWrapHeader(boolean)
-
getAdapter
public <T> T getAdapter(java.lang.Class<T> adapter)
Description copied from class:WidgetImplementation of theAdaptableinterface.IMPORTANT: This method is not part of the RWT public API. It is marked public only so that it can be shared within the packages provided by RWT. It should never be accessed from application code.
- Specified by:
getAdapterin interfaceAdaptable- Overrides:
getAdapterin classComposite- Parameters:
adapter- the lookup class- Returns:
- an object that can be cast to the given class or
nullif there is no adapter associated with the given class.
-
setData
public void setData(java.lang.String key, java.lang.Object value)Description copied from class:WidgetSets the application defined property of the receiver with the specified name to the given value.Applications may associate arbitrary objects with the receiver in this fashion. If the objects stored in the properties need to be notified when the widget is disposed of, it is the application's responsibility to hook the Dispose event on the widget and do so.
- Overrides:
setDatain classControl- Parameters:
key- the name of the propertyvalue- the new value for the property- See Also:
Widget.getData(String)
-
getHorizontalScrollBarProxy
protected IScrollBarProxy getHorizontalScrollBarProxy()
-
getVerticalScrollBarProxy
protected IScrollBarProxy getVerticalScrollBarProxy()
-
-