Class Grid
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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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 theSelectionListener
interface.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 theTreeListener
interface.void
clear
(int[] indices, boolean allChildren) Clears the items at the given zero-relative indices in the receiver.void
clear
(int index, boolean allChildren) Clears the item at the given zero-relative index in the receiver.void
clear
(int start, int end, boolean allChildren) Clears the items in the receiver which are between the given zero-relative start and end indices (inclusive).void
clearAll
(boolean allChildren) Clears all the items in the receiver.computeSize
(int wHint, int hHint, boolean changed) Returns the preferred size of the receiver.void
deselect
(int index) Deselects the item at the given zero-relative index in the receiver.void
deselect
(int[] indices) Deselects the items at the given zero-relative indices in the receiver.void
deselect
(int start, int end) Deselects the items at the given zero-relative indices in the receiver.void
Deselects all selected items in the receiver.void
Deselects all selected cells in the receiver.void
deselectCell
(Point cell) Deselects the given cell in the receiver.void
deselectCells
(Point[] cells) Deselects the given cells.<T> T
getAdapter
(Class<T> adapter) Implementation of theAdaptable
interface.Returns the cell at the given point in the receiver or null if no such cell exists.Point[]
Returns an array of cells that are currently selected in the receiver.int
Returns the number of selected cells contained in the receiver.boolean
Returns true if the cells are selectable in the reciever.getColumn
(int index) Returns the column at the given, zero-relative index in the receiver.Returns the column at the given point in the receiver or null if no such column exists.int
Returns the number of columns contained in the receiver.getColumnGroup
(int index) Returns the column group at the given, zero-relative index in the receiver.int
Returns the number of column groups contained in the receiver.Returns an array ofGridColumnGroup
s which are the column groups in the receiver.int[]
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.Returns an array ofGridColumn
s which are the columns in the receiver.Returns the current cell in focus.Returns the current column in focus.Returns the current item in focus.int
Returns the height of the column footers.boolean
Returnstrue
if the receiver's footer is visible, andfalse
otherwiseint
Returns the height of the column group headers.int
Returns the height of the column headers.boolean
Returnstrue
if the receiver's header is visible, andfalse
otherwise.protected IScrollBarProxy
getItem
(int index) Returns the item at the given, zero-relative index in the receiver.Returns the item at the given point in the receiver or null if no such item exists.int
Returns the number of items contained in the receiver.int
Returns the row header width or 0 if row headers are not visible.int
Returns the default height of the items in thisGrid
.GridItem[]
getItems()
Returns a (possibly empty) array ofGridItem
s which are the items in the receiver.boolean
Returns true if the lines are visible.getNextVisibleColumn
(GridColumn column) Returns the next visible column in the table.getNextVisibleItem
(GridItem item) Returns the next visible item in the table.getPreviousVisibleColumn
(GridColumn column) Returns the previous visible column in the table.Returns the previous visible item in the table.getRootItem
(int index) TODO: JavaDocint
Returns the number of root items contained in the receiver.GridItem[]
Returns a (possibly empty) array ofGridItem
s which are the root items in the receiver.GridItem[]
Returns a array ofGridItem
s that are currently selected in the receiver.int
Returns the number of selected items contained in the receiver.boolean
Returnstrue
if selection is enabled, false otherwise.int
Returns the zero-relative index of the item which is currently selected in the receiver, or -1 if no item is selected.int[]
Returns the zero-relative indices of the items which are currently selected in the receiver.int
Returns the zero-relative index of the item which is currently at the top of the receiver.protected IScrollBarProxy
int
indexOf
(GridColumn column) Searches the receiver's list starting at the first column (index 0) until a column is found that is equal to the argument, and returns the index of that column.int
Searches the receiver's list starting at the first item (index 0) until an item is found that is equal to the argument, and returns the index of that item.boolean
Returns the value of the auto-height feature, which resizes row heights and column header heights based on word-wrapped content.boolean
isCellSelected
(Point cell) Returns true if the given cell is selected.boolean
Returns true if the cells are selectable in the reciever.boolean
Returnstrue
if the receiver's row header is visible, andfalse
otherwise.boolean
isSelected
(int index) Returnstrue
if the item is selected, andfalse
otherwise.boolean
isSelected
(GridItem item) Returns true if the given item is selected.boolean
Returns the value of the row header word-wrap feature, which word-wraps the content of row headers.void
Recalculate the height of the headervoid
remove
(int index) Removes the item from the receiver at the given zero-relative index.void
remove
(int[] indices) Removes the items from the receiver's list at the given zero-relative indices.void
remove
(int start, int end) Removes the items from the receiver which are between the given zero-relative start and end indices (inclusive).void
Removes all of the items from the receiver.void
removeSelectionListener
(SelectionListener listener) Removes the listener from the collection of listeners who will be notified when the receiver's selection changes.void
removeTreeListener
(TreeListener listener) Removes the listener from the collection of listeners who will be notified when the receiver's items changes.void
select
(int index) Selects the item at the given zero-relative index in the receiver.void
select
(int[] indices) Selects the items at the given zero-relative indices in the receiver.void
select
(int start, int end) Selects the items in the range specified by the given zero-relative indices in the receiver.void
Selects all of the items in the receiver.void
Selects all cells in the receiver.void
selectCell
(Point cell) Selects the given cell.void
selectCells
(Point[] cells) Selects the given cells.void
selectColumn
(int col) Selects all cells in the given column in the receiver.void
selectColumnGroup
(int colGroup) Selects all cells in the given column group in the receiver.void
selectColumnGroup
(GridColumnGroup colGroup) Selects all cells in the given column group in the receiver.void
setAutoHeight
(boolean autoHeight) Sets the value of the auto-height feature.void
setCellSelection
(Point cell) Selects the selection to the given cell.void
setCellSelection
(Point[] cells) Selects the selection to the given set of cell.void
setCellSelectionEnabled
(boolean cellSelection) Sets whether cells are selectable in the receiver.void
setColumnOrder
(int[] order) Sets the order that the items in the receiver should be displayed in to the given argument which is described in terms of the zero-relative ordering of when the items were added.void
Sets the application defined property of the receiver with the specified name to the given value.void
setFocusColumn
(GridColumn column) Sets the focused column to the given column.void
setFocusItem
(GridItem item) Sets the focused item to the given item.void
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.void
setFooterVisible
(boolean show) Marks the receiver's footer as visible if the argument istrue
, and marks it invisible otherwise.void
setHeaderVisible
(boolean show) Marks the receiver's header as visible if the argument istrue
, and marks it invisible otherwise.void
setItemCount
(int count) Sets the number of items contained in the receiver.void
setItemHeaderWidth
(int width) Sets the row header width to the specified value.void
setItemHeight
(int height) Sets the default height for thisGrid
's items.void
setLinesVisible
(boolean linesVisible) Sets the line visibility.void
setRowHeaderVisible
(boolean show) Marks the receiver's row header as visible if the argument istrue
, and marks it invisible otherwise.void
setRowHeaderVisible
(boolean show, int minWidth) Marks the receiver's row header as visible if the argument istrue
, and marks it invisible otherwise.void
setSelection
(int index) Selects the item at the given zero-relative index in the receiver.void
setSelection
(int[] indices) Selects the items at the given zero-relative indices in the receiver.void
setSelection
(int start, int end) Selects the items in the range specified by the given zero-relative indices in the receiver.void
setSelection
(GridItem[] items) Sets the receiver's selection to be the given array of items.void
setSelectionEnabled
(boolean selectionEnabled) Enables selection highlighting if the argument istrue
.void
setTopIndex
(int index) Sets the zero-relative index of the item which is currently at the top of the receiver.void
setWordWrapHeader
(boolean enabled) Sets the value of the word-wrap feature for row headers.void
showColumn
(GridColumn column) Shows the column.void
Shows the item.void
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 Details
-
Grid
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:
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:
-
-
Method Details
-
computeSize
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.DEFAULT
is 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:
computeSize
in classComposite
- Parameters:
wHint
- the width hint (can beSWT.DEFAULT
)hHint
- the height hint (can beSWT.DEFAULT
)changed
-true
if the control's contents have changed, andfalse
otherwise- 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
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 theSelectionListener
interface.Cell selection events may have
Event.detail = SWT.DRAG
when the user is drag selecting multiple cells. A follow up selection event will be generated when the drag is complete.- Parameters:
listener
- the listener which should be notified- Throws:
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
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:
-
addTreeListener
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 theTreeListener
interface.- Parameters:
listener
- the listener which should 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:
-
removeTreeListener
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:
-
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
Returns a (possibly empty) array ofGridItem
s 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
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
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:
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
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
-
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
Returns a (possibly empty) array ofGridItem
s 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
TODO: JavaDoc- Parameters:
index
-- Returns:
- the root item
-
getNextVisibleItem
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
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 noGridColumn
s 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
Returns an array ofGridColumn
s which are the columns in the receiver. If noGridColumn
s 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
Returns the column at the given, zero-relative index in the receiver. Throws an exception if the index is out of range. If noGridColumn
s were created by the programmer, this method will throwERROR_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
-
getColumn
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:
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
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
-
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 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
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
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
Returns an array ofGridColumnGroup
s 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
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:
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.VIRTUAL
style, these attributes are requested again as needed.- Parameters:
index
- the index of the item to clearallChildren
-true
if all child items of the indexed item should be cleared recursively, andfalse
otherwise- 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:
-
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.VIRTUAL
style, 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
-true
if all child items of the range of items should be cleared recursively, andfalse
otherwise- 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
- See Also:
-
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.VIRTUAL
style, these attributes are requested again as needed.- Parameters:
indices
- the array of indices of the itemsallChildren
-true
if all child items of the indexed items should be cleared recursively, andfalse
otherwise- 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
- See Also:
-
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.VIRTUAL
style, these attributes are requested again as needed.- Parameters:
allChildren
-true
if all child items of each item should be cleared recursively, andfalse
otherwise- 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:
-
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()Returnstrue
if 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:
-
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:
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. 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
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:
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
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:
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
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:
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
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:
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
Deselects the given cells. Invalid cells are ignored.- Parameters:
cells
- the cells to deselect.- Throws:
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:
-
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:
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
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:
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:
-
getSelection
Returns a array ofGridItem
s 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
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:
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
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:
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
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) Returnstrue
if the item is selected, andfalse
otherwise. Indices out of range are ignored. If cell selection is enabled, returns true if the item at the given index contains at least one selected cell.- Parameters:
index
- the index of the item- Returns:
- the visibility state of the item at the index
- Throws:
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
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:
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
Returns true if the given cell is selected.- Parameters:
cell
- cell- Returns:
- true if the cell is selected.
- Throws:
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
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:
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:
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:
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
-
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()Returnstrue
if the receiver's header is visible, andfalse
otherwise.- 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
-
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
Sets the focused item to the given item.- Parameters:
item
- item to focus.- Throws:
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
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
Sets the focused column to the given column. Column focus is only applicable when cell selection is enabled.- Parameters:
column
- column to focus.- Throws:
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
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
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
Grid
is used as a default for all items (and is returned bygetItemHeight()
).- Parameters:
height
- default height in pixels- Throws:
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:
-
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:
-
setFont
Description copied from class:Control
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. -
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
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
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:
-
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
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()Returnstrue
if the receiver's row header is visible, andfalse
otherwise.- 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
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:
-
getAdapter
Description copied from class:Widget
Implementation of theAdaptable
interface.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:
getAdapter
in interfaceAdaptable
- Overrides:
getAdapter
in classComposite
- Parameters:
adapter
- the lookup class- Returns:
- an object that can be cast to the given class or
null
if there is no adapter associated with the given class.
-
setData
Description copied from class:Widget
Sets 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.
-
getHorizontalScrollBarProxy
protected IScrollBarProxy getHorizontalScrollBarProxy() -
getVerticalScrollBarProxy
protected IScrollBarProxy getVerticalScrollBarProxy()
-