Package org.eclipse.nebula.widgets.grid
Class GridItem
- java.lang.Object
-
- org.eclipse.swt.widgets.Widget
-
- org.eclipse.swt.widgets.Item
-
- org.eclipse.nebula.widgets.grid.GridItem
-
public class GridItem extends org.eclipse.swt.widgets.ItemNOTE: THIS WIDGET AND ITS API ARE STILL UNDER DEVELOPMENT. THIS IS A PRE-RELEASE ALPHA VERSION. USERS SHOULD EXPECT API CHANGES IN FUTURE VERSIONS.
Instances of this class represent a selectable user interface object that represents an item in a grid.- Styles:
- (none)
- Events:
- (none)
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<GridItem>childrenList of children.private org.eclipse.swt.graphics.ColordefaultBackgroundDeprecated.private org.eclipse.swt.graphics.FontdefaultFontDeprecated.private org.eclipse.swt.graphics.ColordefaultForegroundDeprecated.private booleanexpandedIs expanded?private booleanhasChildrenTrue if has children.private booleanhasSetData(SWT.VIRTUAL only) Flag that specifies whether the client has already been sent a SWT.SetData event.private org.eclipse.swt.graphics.ColorheaderBackgroundBackground color of the headerprivate org.eclipse.swt.graphics.FontheaderFontFont of the headerorg.eclipse.swt.graphics.ColorheaderForegroundForeground color of the headerprivate org.eclipse.swt.graphics.ImageheaderImageRow header imageprivate java.lang.StringheaderTextRow header text.private intheightThe height of thisGridItem.private intlevelLevel of item in a tree.private static intNO_ROWprivate GridparentParent grid instance.private GridItemparentItemParent item (if a child item).private introwprivate java.lang.ObjectROW_LOCKprivate booleanvisibleIs visible?
-
Constructor Summary
Constructors Constructor Description GridItem(GridItem parent, int style)Creates a new instance of this class as a child node of the given GridItem and places the item at the end of the parents items.GridItem(GridItem parent, int style, int index)Creates a new instance of this class as a child node of the given Grid and places the item at the given index in the parent items list.GridItem(Grid parent, int style)Creates a new instance of this class and places the item at the end of the grid.GridItem(Grid parent, int style, int index)Creates a new instance of this class and places the item in the grid at the given index.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddControlListener(org.eclipse.swt.events.ControlListener listener)Adds the listener to the collection of listeners who will be notified when the row is resized, by sending it one of the messages defined in theControlListenerinterface.(package private) voidclear(boolean allChildren)Clears all properties of this item and resets values to their defaults.(package private) voidcolumnAdded(int index)(package private) voiddecreaseRow()private booleandeselectCells(GridItem item)private booleandeselectChildren(GridItem item)Deselects the given item's children recursively.voiddispose()voiddisposeOnly()this method call only super.dispose, nothing else..private booleandoUnselect(boolean expanded)voidfireCheckEvent(int column)Fires the appropriate events in response to a user checking/unchecking an item.voidfireEvent(int eventId)Fires the given event type on the parent Grid instance.org.eclipse.swt.graphics.ColorgetBackground()Returns the receiver's background color.org.eclipse.swt.graphics.ColorgetBackground(int index)Returns the background color at the given column index in the receiver.org.eclipse.swt.graphics.RectanglegetBounds(int columnIndex)Returns a rectangle describing the receiver's size and location relative to its parent at a column in the table.org.eclipse.swt.graphics.RectanglegetBoundsCorrected(int columnIndex)Returns a rectangle describing the receiver's size and location relative to its parent at a column in the table.protected org.eclipse.swt.graphics.PointgetCellSize(int columnIndex)booleangetCheckable(int index)Returns the checkable state at the given column index in the receiver.booleangetChecked()Returns the checked state at the first column in the receiver.booleangetChecked(int index)Returns the checked state at the given column index in the receiver.intgetColumnSpan(int index)Returns the column span for the given column index in the receiver.org.eclipse.swt.graphics.FontgetFont()Returns the font that the receiver will use to paint textual information for this item.org.eclipse.swt.graphics.FontgetFont(int index)Returns the font that the receiver will use to paint textual information for the specified cell in this item.org.eclipse.swt.graphics.ColorgetForeground()Returns the foreground color that the receiver will use to draw.org.eclipse.swt.graphics.ColorgetForeground(int index)Returns the foreground color at the given column index in the receiver.booleangetGrayed()Returnstrueif the first column in the receiver is grayed, and false otherwise.booleangetGrayed(int index)Returnstrueif the column at the given index in the receiver is grayed, and false otherwise.org.eclipse.swt.graphics.ColorgetHeaderBackground()Returns the receiver's row header background colororg.eclipse.swt.graphics.FontgetHeaderFont()Returns the receiver's row header fontorg.eclipse.swt.graphics.ColorgetHeaderForeground()Returns the receiver's row header foreground colororg.eclipse.swt.graphics.ImagegetHeaderImage()Returns the receiver's row header image.java.lang.StringgetHeaderText()Returns the receiver's row header text.intgetHeight()Returns the height of thisGridItem.org.eclipse.swt.graphics.ImagegetImage()org.eclipse.swt.graphics.ImagegetImage(int index)Returns the image stored at the given column index in the receiver, or null if the image has not been set or if the column does not exist.GridItemgetItem(int index)Returns the item at the given, zero-relative index in the receiver.intgetItemCount()Returns the number of items contained in the receiver that are direct item children of the receiver.GridItem[]getItems()Returns a (possibly empty) array ofGridItems which are the direct item children of the receiver.intgetLevel()Returns the level of this item in the tree.GridgetParent()Returns the receiver's parent, which must be aGrid.GridItemgetParentItem()Returns the receiver's parent item, which must be aGridItemor null when the receiver is a root.intgetRowIndex()intgetRowSpan(int index)Returns the row span for the given column index in the receiver.java.lang.StringgetText()java.lang.StringgetText(int index)Returns the text stored at the given column index in the receiver, or empty string if the text has not been set.java.lang.StringgetToolTipText(int index)Returns the tooltip for the given cell.private voidhandleVirtual()booleanhasChildren()Returns true if this item has children.(package private) voidincreaseRow()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.(package private) voidinitializeHeight(int height)Sets the initial item height for this item.booleanisExpanded()Returnstrueif the receiver is expanded, and false otherwise.booleanisVisible()Returns true if the item is visible because its parent items are all expanded.(package private) voidnewItem(GridItem item, int index)Creates a new child item in this item at the given index.private voidnoRow()voidpack()Sets thisGridItemto its preferred height.private voidremove(GridItem child)Removes the given child item from the list of children.voidremoveControlListener(org.eclipse.swt.events.ControlListener listener)Removes the listener from the collection of listeners who will be notified when the row is resized.voidsetBackground(int index, org.eclipse.swt.graphics.Color background)Sets the background color at the given column index in the receiver to the color specified by the argument, or to the default system color for the item if the argument is null.voidsetBackground(org.eclipse.swt.graphics.Color background)Sets the receiver's background color to the color specified by the argument, or to the default system color for the item if the argument is null.voidsetCheckable(int index, boolean checked)Sets the checkable state at the given column index in the receiver.voidsetChecked(boolean checked)Sets the checked state at the first column in the receiver.voidsetChecked(int index, boolean checked)Sets the checked state at the given column index in the receiver.voidsetColumnSpan(int index, int span)Sets the column spanning for the column at the given index to span the given number of subsequent columns.voidsetExpanded(boolean expanded)Sets the expanded state of the receiver.voidsetFont(int index, org.eclipse.swt.graphics.Font font)Sets the font that the receiver will use to paint textual information for the specified cell in this item to the font specified by the argument, or to the default font for that kind of control if the argument is null.voidsetFont(org.eclipse.swt.graphics.Font f)Sets the font that the receiver will use to paint textual information for this item to the font specified by the argument, or to the default font for that kind of control if the argument is null.voidsetForeground(int index, org.eclipse.swt.graphics.Color foreground)Sets the foreground color at the given column index in the receiver to the color specified by the argument, or to the default system color for the item if the argument is null.voidsetForeground(org.eclipse.swt.graphics.Color foreground)Sets the receiver's foreground color to the color specified by the argument, or to the default system color for the item if the argument is null.voidsetGrayed(boolean grayed)Sets the grayed state of the checkbox for the first column.voidsetGrayed(int index, boolean grayed)Sets the grayed state of the checkbox for the given column index.(package private) voidsetHasChildren(boolean hasChildren)Sets whether this item has children.(package private) voidsetHasSetData(boolean hasSetData)voidsetHeaderBackground(org.eclipse.swt.graphics.Color headerBackground)Set the new header backgroundvoidsetHeaderFont(org.eclipse.swt.graphics.Font headerFont)Set the new header fontvoidsetHeaderForeground(org.eclipse.swt.graphics.Color headerForeground)Set the new header foregroundvoidsetHeaderImage(org.eclipse.swt.graphics.Image image)Sets the receiver's row header image.voidsetHeaderText(java.lang.String text)Sets the receiver's row header text.voidsetHeight(int newHeight)Sets the height of thisGridItem.voidsetImage(int index, org.eclipse.swt.graphics.Image image)Sets the receiver's image at a column.voidsetImage(org.eclipse.swt.graphics.Image image)voidsetRowSpan(int index, int span)Sets the row spanning for the row at the given index to span the given number of subsequent rows.voidsetText(int index, java.lang.String text)Sets the receiver's text at a column.voidsetText(java.lang.String string)voidsetToolTipText(int index, java.lang.String tooltip)Sets the tooltip for the given column index.(package private) voidsetVisible(boolean visible)Sets the visible state of this item.-
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkWidget, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString
-
-
-
-
Field Detail
-
NO_ROW
private static final int NO_ROW
- See Also:
- Constant Field Values
-
children
private java.util.List<GridItem> children
List of children.
-
defaultBackground
@Deprecated private org.eclipse.swt.graphics.Color defaultBackground
Deprecated.Default background color.
-
defaultFont
@Deprecated private org.eclipse.swt.graphics.Font defaultFont
Deprecated.Default font.
-
defaultForeground
@Deprecated private org.eclipse.swt.graphics.Color defaultForeground
Deprecated.Default foreground color.
-
height
private int height
The height of thisGridItem.
-
expanded
private boolean expanded
Is expanded?
-
hasChildren
private boolean hasChildren
True if has children.
-
level
private int level
Level of item in a tree.
-
parent
private final Grid parent
Parent grid instance.
-
parentItem
private GridItem parentItem
Parent item (if a child item).
-
visible
private boolean visible
Is visible?
-
headerText
private java.lang.String headerText
Row header text.
-
headerImage
private org.eclipse.swt.graphics.Image headerImage
Row header image
-
headerBackground
private org.eclipse.swt.graphics.Color headerBackground
Background color of the header
-
headerForeground
public org.eclipse.swt.graphics.Color headerForeground
Foreground color of the header
-
headerFont
private org.eclipse.swt.graphics.Font headerFont
Font of the header
-
hasSetData
private boolean hasSetData
(SWT.VIRTUAL only) Flag that specifies whether the client has already been sent a SWT.SetData event.
-
row
private int row
-
ROW_LOCK
private final java.lang.Object ROW_LOCK
-
-
Constructor Detail
-
GridItem
public GridItem(Grid parent, int style)
Creates a new instance of this class and places the item at the end of the grid.- Parameters:
parent- parent gridstyle- item style- Throws:
java.lang.IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the parent is null
org.eclipse.swt.SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
- ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
-
GridItem
public GridItem(Grid parent, int style, int index)
Creates a new instance of this class and places the item in the grid at the given index.- Parameters:
parent- parent gridstyle- item styleindex- index where to insert item- Throws:
java.lang.IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the parent is null
org.eclipse.swt.SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
- ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
-
GridItem
public GridItem(GridItem parent, int style)
Creates a new instance of this class as a child node of the given GridItem and places the item at the end of the parents items.- Parameters:
parent- parent itemstyle- item style- Throws:
java.lang.IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the parent is null
org.eclipse.swt.SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
- ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
-
GridItem
public GridItem(GridItem parent, int style, int index)
Creates a new instance of this class as a child node of the given Grid and places the item at the given index in the parent items list.- Parameters:
parent- parent itemstyle- item styleindex- index to place item- Throws:
java.lang.IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the parent is null
org.eclipse.swt.SWTException-- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
- ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass
-
-
Method Detail
-
getRowIndex
public int getRowIndex()
- Returns:
- grid row index
-
increaseRow
void increaseRow()
-
decreaseRow
void decreaseRow()
-
dispose
public void dispose()
- Overrides:
disposein classorg.eclipse.swt.widgets.Widget
-
addControlListener
public void addControlListener(org.eclipse.swt.events.ControlListener listener)
Adds the listener to the collection of listeners who will be notified when the row is resized, by sending it one of the messages defined in theControlListenerinterface.Clients who wish to override the standard row resize logic should use the untyped listener mechanisms. The untyped
Eventobject passed to an untyped listener will have itsdetailfield populated with the new row height. Clients may alter this value to, for example, enforce minimum or maximum row sizes. Clients may also set thedoitfield to false to prevent the entire resize operation.- Parameters:
listener- the listener which should be notified- Throws:
java.lang.IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the listener is null
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
removeControlListener
public void removeControlListener(org.eclipse.swt.events.ControlListener listener)
Removes the listener from the collection of listeners who will be notified when the row is resized.- Parameters:
listener- the listener which should no longer be notified- Throws:
java.lang.IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the listener is null
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
fireEvent
public void fireEvent(int eventId)
Fires the given event type on the parent Grid instance. This method should only be called from within a cell renderer. Any other use is not intended.- Parameters:
eventId- SWT event constant- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
fireCheckEvent
public void fireCheckEvent(int column)
Fires the appropriate events in response to a user checking/unchecking an item. Checking an item fires both a selection event (with event.detail of SWT.CHECK) if the checkbox is in the first column and the seperate check listener (all columns). This method manages that behavior. This method should only be called from within a cell renderer. Any other use is not intended.- Parameters:
column- the column where the checkbox resides- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getBackground
public org.eclipse.swt.graphics.Color getBackground()
Returns the receiver's background color.- Returns:
- the background color
- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getBackground
public org.eclipse.swt.graphics.Color getBackground(int index)
Returns the background color at the given column index in the receiver.- Parameters:
index- the column index- Returns:
- the background color
- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getBounds
public org.eclipse.swt.graphics.Rectangle getBounds(int columnIndex)
Returns a rectangle describing the receiver's size and location relative to its parent at a column in the table.- Parameters:
columnIndex- the index that specifies the column- Returns:
- the receiver's bounding column rectangle
- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getBoundsCorrected
public org.eclipse.swt.graphics.Rectangle getBoundsCorrected(int columnIndex)
Returns a rectangle describing the receiver's size and location relative to its parent at a column in the table. Handle not visible items.- Parameters:
columnIndex- the index that specifies the column- Returns:
- the receiver's bounding column rectangle
- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getCellSize
protected org.eclipse.swt.graphics.Point getCellSize(int columnIndex)
- Parameters:
columnIndex-- Returns:
- width and height
-
getChecked
public boolean getChecked()
Returns the checked state at the first column in the receiver.- Returns:
- the checked state
- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getChecked
public boolean getChecked(int index)
Returns the checked state at the given column index in the receiver.- Parameters:
index- the column index- Returns:
- the checked state
- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getColumnSpan
public int getColumnSpan(int index)
Returns the column span for the given column index in the receiver.- Parameters:
index- the column index- Returns:
- the number of columns spanned (0 equals no columns spanned)
- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getRowSpan
public int getRowSpan(int index)
Returns the row span for the given column index in the receiver.- Parameters:
index- the row index- Returns:
- the number of row spanned (0 equals no row spanned)
- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getFont
public org.eclipse.swt.graphics.Font getFont()
Returns the font that the receiver will use to paint textual information for this item.- Returns:
- the receiver's font
- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getFont
public org.eclipse.swt.graphics.Font getFont(int index)
Returns the font that the receiver will use to paint textual information for the specified cell in this item.- Parameters:
index- the column index- Returns:
- the receiver's font
- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getForeground
public org.eclipse.swt.graphics.Color getForeground()
Returns the foreground color that the receiver will use to draw.- Returns:
- the receiver's foreground color
- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getForeground
public org.eclipse.swt.graphics.Color getForeground(int index)
Returns the foreground color at the given column index in the receiver.- Parameters:
index- the column index- Returns:
- the foreground color
- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getGrayed
public boolean getGrayed()
Returnstrueif the first column in the receiver is grayed, and false otherwise. When the GridColumn does not have theCHECKstyle, return false.- Returns:
- the grayed state of the checkbox
- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getGrayed
public boolean getGrayed(int index)
Returnstrueif the column at the given index in the receiver is grayed, and false otherwise. When the GridColumn does not have theCHECKstyle, return false.- Parameters:
index- the column index- Returns:
- the grayed state of the checkbox
- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getHeight
public int getHeight()
Returns the height of thisGridItem.- Returns:
- height of this
GridItem
-
getImage
public org.eclipse.swt.graphics.Image getImage()
- Overrides:
getImagein classorg.eclipse.swt.widgets.Item
-
getImage
public org.eclipse.swt.graphics.Image getImage(int index)
Returns the image stored at the given column index in the receiver, or null if the image has not been set or if the column does not exist.- Parameters:
index- the column index- Returns:
- the image stored at the given column index in the receiver
- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getItem
public GridItem getItem(int index)
Returns the item at the given, zero-relative index in the receiver. Throws an exception if the index is out of range.- Parameters:
index- the index of the item to return- Returns:
- the item at the given index
- Throws:
java.lang.IllegalArgumentException-- ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getItemCount
public int getItemCount()
Returns the number of items contained in the receiver that are direct item children of the receiver.- Returns:
- the number of items
- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
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
- ERROR_INVALID_ARGUMENT - if the item has been disposed
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getItems
public GridItem[] getItems()
Returns a (possibly empty) array ofGridItems which are the direct item children of 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 receiver's items
- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getLevel
public int getLevel()
Returns the level of this item in the tree.- Returns:
- the level of the item in the tree
- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getParent
public Grid getParent()
Returns the receiver's parent, which must be aGrid.- Returns:
- the receiver's parent
- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getParentItem
public GridItem getParentItem()
Returns the receiver's parent item, which must be aGridItemor null when the receiver is a root.- Returns:
- the receiver's parent item
- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getText
public java.lang.String getText()
- Overrides:
getTextin classorg.eclipse.swt.widgets.Item
-
getText
public java.lang.String getText(int index)
Returns the text stored at the given column index in the receiver, or empty string if the text has not been set.- Parameters:
index- the column index- Returns:
- the text stored at the given column index in the receiver
- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
hasChildren
public boolean hasChildren()
Returns true if this item has children.- Returns:
- true if this item has children
- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
isExpanded
public boolean isExpanded()
Returnstrueif the receiver is expanded, and false otherwise.- Returns:
- the expanded state
- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setBackground
public void setBackground(org.eclipse.swt.graphics.Color background)
Sets the receiver's background color to the color specified by the argument, or to the default system color for the item if the argument is null.- Parameters:
background- the new color (or null)- Throws:
java.lang.IllegalArgumentException-- ERROR_INVALID_ARGUMENT - if the argument has been disposed
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setBackground
public void setBackground(int index, org.eclipse.swt.graphics.Color background)Sets the background color at the given column index in the receiver to the color specified by the argument, or to the default system color for the item if the argument is null.- Parameters:
index- the column indexbackground- the new color (or null)- Throws:
java.lang.IllegalArgumentException-- ERROR_INVALID_ARGUMENT - if the argument has been disposed
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setChecked
public void setChecked(boolean checked)
Sets the checked state at the first column in the receiver.- Parameters:
checked- the new checked state- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setChecked
public void setChecked(int index, boolean checked)Sets the checked state at the given column index in the receiver.- Parameters:
index- the column indexchecked- the new checked state- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setColumnSpan
public void setColumnSpan(int index, int span)Sets the column spanning for the column at the given index to span the given number of subsequent columns.- Parameters:
index- column index that should spanspan- number of subsequent columns to span- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setRowSpan
public void setRowSpan(int index, int span)Sets the row spanning for the row at the given index to span the given number of subsequent rows.- Parameters:
index- row index that should spanspan- number of subsequent rows to span- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setExpanded
public void setExpanded(boolean expanded)
Sets the expanded state of the receiver.- Parameters:
expanded- the new expanded state- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
doUnselect
private boolean doUnselect(boolean expanded)
-
deselectCells
private boolean deselectCells(GridItem item)
-
deselectChildren
private boolean deselectChildren(GridItem item)
Deselects the given item's children recursively.- Parameters:
item- item to deselect children.- Returns:
- true if an item was deselected
-
setFont
public void setFont(org.eclipse.swt.graphics.Font f)
Sets the font that the receiver will use to paint textual information for this item to the font specified by the argument, or to the default font for that kind of control if the argument is null.- Parameters:
f- the new font (or null)- Throws:
java.lang.IllegalArgumentException-- ERROR_INVALID_ARGUMENT - if the argument has been disposed
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setFont
public void setFont(int index, org.eclipse.swt.graphics.Font font)Sets the font that the receiver will use to paint textual information for the specified cell in this item to the font specified by the argument, or to the default font for that kind of control if the argument is null.- Parameters:
index- the column indexfont- the new font (or null)- Throws:
java.lang.IllegalArgumentException-- ERROR_INVALID_ARGUMENT - if the argument has been disposed
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setForeground
public void setForeground(org.eclipse.swt.graphics.Color foreground)
Sets the receiver's foreground color to the color specified by the argument, or to the default system color for the item if the argument is null.- Parameters:
foreground- the new color (or null)- Throws:
java.lang.IllegalArgumentException-- ERROR_INVALID_ARGUMENT - if the argument has been disposed
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setForeground
public void setForeground(int index, org.eclipse.swt.graphics.Color foreground)Sets the foreground color at the given column index in the receiver to the color specified by the argument, or to the default system color for the item if the argument is null.- Parameters:
index- the column indexforeground- the new color (or null)- Throws:
java.lang.IllegalArgumentException-- ERROR_INVALID_ARGUMENT - if the argument has been disposed
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setGrayed
public void setGrayed(boolean grayed)
Sets the grayed state of the checkbox for the first column. This state change only applies if the GridColumn was created with the SWT.CHECK style.- Parameters:
grayed- the new grayed state of the checkbox;- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setGrayed
public void setGrayed(int index, boolean grayed)Sets the grayed state of the checkbox for the given column index. This state change only applies if the GridColumn was created with the SWT.CHECK style.- Parameters:
index- the column indexgrayed- the new grayed state of the checkbox;- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setHeight
public void setHeight(int newHeight)
Sets the height of thisGridItem.- Parameters:
newHeight- new height in pixels- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
pack
public void pack()
Sets thisGridItemto its preferred height.- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setImage
public void setImage(org.eclipse.swt.graphics.Image image)
- Overrides:
setImagein classorg.eclipse.swt.widgets.Item
-
setImage
public void setImage(int index, org.eclipse.swt.graphics.Image image)Sets the receiver's image at a column.- Parameters:
index- the column indeximage- the new image- Throws:
java.lang.IllegalArgumentException-- ERROR_INVALID_ARGUMENT - if the image has been disposed
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setText
public void setText(int index, java.lang.String text)Sets the receiver's text at a column.- Parameters:
index- the column indextext- the new text- Throws:
java.lang.IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the text is null
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setText
public void setText(java.lang.String string)
- Overrides:
setTextin classorg.eclipse.swt.widgets.Item
-
remove
private void remove(GridItem child)
Removes the given child item from the list of children.- Parameters:
child- child to remove
-
isVisible
public boolean isVisible()
Returns true if the item is visible because its parent items are all expanded. This method does not determine if the item is in the currently visible range.- Returns:
- Returns the visible.
-
newItem
void newItem(GridItem item, int index)
Creates a new child item in this item at the given index.- Parameters:
item- new child itemindex- index
-
setHasChildren
void setHasChildren(boolean hasChildren)
Sets whether this item has children.- Parameters:
hasChildren- true if this item has children
-
setVisible
void setVisible(boolean visible)
Sets the visible state of this item. The visible state is determined by the expansion state of all of its parent items. If all parent items are expanded it is visible.- Parameters:
visible- The visible to set.
-
getHeaderText
public java.lang.String getHeaderText()
Returns the receiver's row header text. If the text isnullthe row header will display the row number.- Returns:
- the text stored for the row header or code
nullif the default has to be displayed - Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getHeaderImage
public org.eclipse.swt.graphics.Image getHeaderImage()
Returns the receiver's row header image.- Returns:
- the image stored for the header or
nullif none has to be displayed - Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getHeaderBackground
public org.eclipse.swt.graphics.Color getHeaderBackground()
Returns the receiver's row header background color- Returns:
- the color or
nullif none - Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getHeaderForeground
public org.eclipse.swt.graphics.Color getHeaderForeground()
Returns the receiver's row header foreground color- Returns:
- the color or
nullif none - Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getHeaderFont
public org.eclipse.swt.graphics.Font getHeaderFont()
Returns the receiver's row header font- Returns:
- the font or
nullif none - Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setHeaderText
public void setHeaderText(java.lang.String text)
Sets the receiver's row header text. If the text isnullthe row header will display the row number.- Parameters:
text- the new text- Throws:
java.lang.IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the text is null
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setHeaderImage
public void setHeaderImage(org.eclipse.swt.graphics.Image image)
Sets the receiver's row header image. If the image isnullnone is shown in the header- Parameters:
image- the new image- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setHeaderBackground
public void setHeaderBackground(org.eclipse.swt.graphics.Color headerBackground)
Set the new header background- Parameters:
headerBackground- the color ornull- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setHeaderForeground
public void setHeaderForeground(org.eclipse.swt.graphics.Color headerForeground)
Set the new header foreground- Parameters:
headerForeground- the color ornull- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setHeaderFont
public void setHeaderFont(org.eclipse.swt.graphics.Font headerFont)
Set the new header font- Parameters:
headerFont- the font ornull- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getCheckable
public boolean getCheckable(int index)
Returns the checkable state at the given column index in the receiver. If the column at the given index is not checkable then this will return false regardless of the individual cell's checkable state.- Parameters:
index- the column index- Returns:
- the checked state
- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setCheckable
public void setCheckable(int index, boolean checked)Sets the checkable state at the given column index in the receiver. A checkbox which is uncheckable will not be modifiable by the user but still make be modified programmatically. If the column at the given index is not checkable then individual cell will not be checkable regardless.- Parameters:
index- the column indexchecked- the new checked state- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getToolTipText
public java.lang.String getToolTipText(int index)
Returns the tooltip for the given cell.- Parameters:
index- the column index- Returns:
- the tooltip
- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setToolTipText
public void setToolTipText(int index, java.lang.String tooltip)Sets the tooltip for the given column index.- Parameters:
index- the column indextooltip- the tooltip text- Throws:
org.eclipse.swt.SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
columnAdded
void columnAdded(int index)
-
handleVirtual
private void handleVirtual()
-
initializeHeight
void initializeHeight(int height)
Sets the initial item height for this item.- Parameters:
height- initial height.
-
setHasSetData
void setHasSetData(boolean hasSetData)
-
clear
void clear(boolean allChildren)
Clears all properties of this item and resets values to their defaults.- Parameters:
allChildren-trueif all child items should be cleared recursively, andfalseotherwise
-
disposeOnly
public void disposeOnly()
this method call only super.dispose, nothing else..
-
noRow
private void noRow()
-
-