public class GridItem
extends org.eclipse.swt.widgets.Item
NOTE: 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.
Modifier and Type | Field and Description |
---|---|
org.eclipse.swt.graphics.Color |
headerForeground
Foreground color of the header
|
Constructor and Description |
---|
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.
|
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.
|
Modifier and Type | Method and Description |
---|---|
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 the
ControlListener interface. |
(package private) void |
clear(boolean allChildren)
Clears all properties of this item and resets values to their defaults.
|
(package private) void |
columnAdded(int index) |
(package private) void |
decreaseRow() |
void |
dispose() |
void |
disposeOnly()
this method call only super.dispose, nothing else..
|
void |
fireCheckEvent(int column)
Fires the appropriate events in response to a user checking/unchecking an
item.
|
void |
fireEvent(int eventId)
Fires the given event type on the parent Grid instance.
|
org.eclipse.swt.graphics.Color |
getBackground()
Returns the receiver's background color.
|
org.eclipse.swt.graphics.Color |
getBackground(int index)
Returns the background color at the given column index in the receiver.
|
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.
|
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.
|
protected org.eclipse.swt.graphics.Point |
getCellSize(int columnIndex) |
boolean |
getCheckable(int index)
Returns the checkable state at the given column index in the receiver.
|
boolean |
getChecked()
Returns the checked state at the first column in the receiver.
|
boolean |
getChecked(int index)
Returns the checked state at the given column index in the receiver.
|
int |
getColumnSpan(int index)
Returns the column span for the given column index in the receiver.
|
org.eclipse.swt.graphics.Font |
getFont()
Returns the font that the receiver will use to paint textual information
for this item.
|
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.
|
org.eclipse.swt.graphics.Color |
getForeground()
Returns the foreground color that the receiver will use to draw.
|
org.eclipse.swt.graphics.Color |
getForeground(int index)
Returns the foreground color at the given column index in the receiver.
|
boolean |
getGrayed()
Returns
true if the first column in the receiver is grayed,
and false otherwise. |
boolean |
getGrayed(int index)
Returns
true if the column at the given index in the
receiver is grayed, and false otherwise. |
org.eclipse.swt.graphics.Color |
getHeaderBackground()
Returns the receiver's row header background color
|
org.eclipse.swt.graphics.Font |
getHeaderFont()
Returns the receiver's row header font
|
org.eclipse.swt.graphics.Color |
getHeaderForeground()
Returns the receiver's row header foreground color
|
org.eclipse.swt.graphics.Image |
getHeaderImage()
Returns the receiver's row header image.
|
java.lang.String |
getHeaderText()
Returns the receiver's row header text.
|
int |
getHeight()
Returns the height of this
GridItem . |
org.eclipse.swt.graphics.Image |
getImage() |
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.
|
GridItem |
getItem(int index)
Returns the item at the given, zero-relative index in the receiver.
|
int |
getItemCount()
Returns the number of items contained in the receiver that are direct
item children of the receiver.
|
GridItem[] |
getItems()
Returns a (possibly empty) array of
GridItem s which are the
direct item children of the receiver. |
int |
getLevel()
Returns the level of this item in the tree.
|
Grid |
getParent()
Returns the receiver's parent, which must be a
Grid . |
GridItem |
getParentItem()
Returns the receiver's parent item, which must be a
GridItem
or null when the receiver is a root. |
int |
getRowIndex() |
int |
getRowSpan(int index)
Returns the row span for the given column index in the receiver.
|
java.lang.String |
getText() |
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.
|
java.lang.String |
getToolTipText(int index)
Returns the tooltip for the given cell.
|
boolean |
hasChildren()
Returns true if this item has children.
|
(package private) void |
increaseRow() |
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.
|
(package private) void |
initializeHeight(int height)
Sets the initial item height for this item.
|
boolean |
isExpanded()
Returns
true if the receiver is expanded, and false
otherwise. |
boolean |
isVisible()
Returns true if the item is visible because its parent items are all
expanded.
|
(package private) void |
newItem(GridItem item,
int index)
Creates a new child item in this item at the given index.
|
void |
pack()
Sets this
GridItem to its preferred height. |
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.
|
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.
|
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.
|
void |
setCheckable(int index,
boolean checked)
Sets the checkable state at the given column index in the receiver.
|
void |
setChecked(boolean checked)
Sets the checked state at the first column in the receiver.
|
void |
setChecked(int index,
boolean checked)
Sets the checked state at the given column index in the receiver.
|
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.
|
void |
setExpanded(boolean expanded)
Sets the expanded state of the receiver.
|
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.
|
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.
|
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.
|
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.
|
void |
setGrayed(boolean grayed)
Sets the grayed state of the checkbox for the first column.
|
void |
setGrayed(int index,
boolean grayed)
Sets the grayed state of the checkbox for the given column index.
|
(package private) void |
setHasChildren(boolean hasChildren)
Sets whether this item has children.
|
(package private) void |
setHasSetData(boolean hasSetData) |
void |
setHeaderBackground(org.eclipse.swt.graphics.Color headerBackground)
Set the new header background
|
void |
setHeaderFont(org.eclipse.swt.graphics.Font headerFont)
Set the new header font
|
void |
setHeaderForeground(org.eclipse.swt.graphics.Color headerForeground)
Set the new header foreground
|
void |
setHeaderImage(org.eclipse.swt.graphics.Image image)
Sets the receiver's row header image.
|
void |
setHeaderText(java.lang.String text)
Sets the receiver's row header text.
|
void |
setHeight(int newHeight)
Sets the height of this
GridItem . |
void |
setImage(org.eclipse.swt.graphics.Image image) |
void |
setImage(int index,
org.eclipse.swt.graphics.Image image)
Sets the receiver's image at a column.
|
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.
|
void |
setText(int index,
java.lang.String text)
Sets the receiver's text at a column.
|
void |
setText(java.lang.String string) |
void |
setToolTipText(int index,
java.lang.String tooltip)
Sets the tooltip for the given column index.
|
(package private) void |
setVisible(boolean visible)
Sets the visible state of this item.
|
addDisposeListener, addListener, checkWidget, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString
public org.eclipse.swt.graphics.Color headerForeground
public GridItem(Grid parent, int style)
parent
- parent gridstyle
- item stylejava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public GridItem(Grid parent, int style, int index)
parent
- parent gridstyle
- item styleindex
- index where to insert itemjava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public GridItem(GridItem parent, int style)
parent
- parent itemstyle
- item stylejava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public GridItem(GridItem parent, int style, int index)
parent
- parent itemstyle
- item styleindex
- index to place itemjava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public int getRowIndex()
void increaseRow()
void decreaseRow()
public void dispose()
dispose
in class org.eclipse.swt.widgets.Widget
public void addControlListener(org.eclipse.swt.events.ControlListener listener)
ControlListener
interface.
Clients who wish to override the standard row resize logic should use the
untyped listener mechanisms. The untyped Event
object passed
to an untyped listener will have its detail
field populated
with the new row height. Clients may alter this value to, for example,
enforce minimum or maximum row sizes. Clients may also set the
doit
field to false to prevent the entire resize operation.
listener
- the listener which should be notifiedjava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public void removeControlListener(org.eclipse.swt.events.ControlListener listener)
listener
- the listener which should no longer be notifiedjava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public void fireEvent(int eventId)
eventId
- SWT event constantorg.eclipse.swt.SWTException
- public void fireCheckEvent(int column)
column
- the column where the checkbox residesorg.eclipse.swt.SWTException
- public org.eclipse.swt.graphics.Color getBackground()
org.eclipse.swt.SWTException
- public org.eclipse.swt.graphics.Color getBackground(int index)
index
- the column indexorg.eclipse.swt.SWTException
- public org.eclipse.swt.graphics.Rectangle getBounds(int columnIndex)
columnIndex
- the index that specifies the columnorg.eclipse.swt.SWTException
- public org.eclipse.swt.graphics.Rectangle getBoundsCorrected(int columnIndex)
columnIndex
- the index that specifies the columnorg.eclipse.swt.SWTException
- protected org.eclipse.swt.graphics.Point getCellSize(int columnIndex)
columnIndex
- public boolean getChecked()
org.eclipse.swt.SWTException
- public boolean getChecked(int index)
index
- the column indexorg.eclipse.swt.SWTException
- public int getColumnSpan(int index)
index
- the column indexorg.eclipse.swt.SWTException
- public int getRowSpan(int index)
index
- the row indexorg.eclipse.swt.SWTException
- public org.eclipse.swt.graphics.Font getFont()
org.eclipse.swt.SWTException
- public org.eclipse.swt.graphics.Font getFont(int index)
index
- the column indexorg.eclipse.swt.SWTException
- public org.eclipse.swt.graphics.Color getForeground()
org.eclipse.swt.SWTException
- public org.eclipse.swt.graphics.Color getForeground(int index)
index
- the column indexorg.eclipse.swt.SWTException
- public boolean getGrayed()
true
if the first column in the receiver is grayed,
and false otherwise. When the GridColumn does not have the
CHECK
style, return false.org.eclipse.swt.SWTException
- public boolean getGrayed(int index)
true
if the column at the given index in the
receiver is grayed, and false otherwise. When the GridColumn does not
have the CHECK
style, return false.index
- the column indexorg.eclipse.swt.SWTException
- public int getHeight()
GridItem
.GridItem
public org.eclipse.swt.graphics.Image getImage()
getImage
in class org.eclipse.swt.widgets.Item
public org.eclipse.swt.graphics.Image getImage(int index)
index
- the column indexorg.eclipse.swt.SWTException
- public GridItem getItem(int index)
index
- the index of the item to returnjava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public int getItemCount()
org.eclipse.swt.SWTException
- public int indexOf(GridItem item)
item
- the search itemjava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public GridItem[] getItems()
GridItem
s 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.
org.eclipse.swt.SWTException
- public int getLevel()
org.eclipse.swt.SWTException
- public Grid getParent()
Grid
.org.eclipse.swt.SWTException
- public GridItem getParentItem()
GridItem
or null when the receiver is a root.org.eclipse.swt.SWTException
- public java.lang.String getText()
getText
in class org.eclipse.swt.widgets.Item
public java.lang.String getText(int index)
index
- the column indexorg.eclipse.swt.SWTException
- public boolean hasChildren()
org.eclipse.swt.SWTException
- public boolean isExpanded()
true
if the receiver is expanded, and false
otherwise.
org.eclipse.swt.SWTException
- public void setBackground(org.eclipse.swt.graphics.Color background)
background
- the new color (or null)java.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public void setBackground(int index, org.eclipse.swt.graphics.Color background)
index
- the column indexbackground
- the new color (or null)java.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public void setChecked(boolean checked)
checked
- the new checked stateorg.eclipse.swt.SWTException
- public void setChecked(int index, boolean checked)
index
- the column indexchecked
- the new checked stateorg.eclipse.swt.SWTException
- public void setColumnSpan(int index, int span)
index
- column index that should spanspan
- number of subsequent columns to spanorg.eclipse.swt.SWTException
- public void setRowSpan(int index, int span)
index
- row index that should spanspan
- number of subsequent rows to spanorg.eclipse.swt.SWTException
- public void setExpanded(boolean expanded)
expanded
- the new expanded stateorg.eclipse.swt.SWTException
- public void setFont(org.eclipse.swt.graphics.Font f)
f
- the new font (or null)java.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public void setFont(int index, org.eclipse.swt.graphics.Font font)
index
- the column indexfont
- the new font (or null)java.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public void setForeground(org.eclipse.swt.graphics.Color foreground)
foreground
- the new color (or null)java.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public void setForeground(int index, org.eclipse.swt.graphics.Color foreground)
index
- the column indexforeground
- the new color (or null)java.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public void setGrayed(boolean grayed)
grayed
- the new grayed state of the checkbox;org.eclipse.swt.SWTException
- public void setGrayed(int index, boolean grayed)
index
- the column indexgrayed
- the new grayed state of the checkbox;org.eclipse.swt.SWTException
- public void setHeight(int newHeight)
GridItem
.newHeight
- new height in pixelsorg.eclipse.swt.SWTException
- public void pack()
GridItem
to its preferred height.org.eclipse.swt.SWTException
- public void setImage(org.eclipse.swt.graphics.Image image)
setImage
in class org.eclipse.swt.widgets.Item
public void setImage(int index, org.eclipse.swt.graphics.Image image)
index
- the column indeximage
- the new imagejava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public void setText(int index, java.lang.String text)
index
- the column indextext
- the new textjava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public void setText(java.lang.String string)
setText
in class org.eclipse.swt.widgets.Item
public boolean isVisible()
void newItem(GridItem item, int index)
item
- new child itemindex
- indexvoid setHasChildren(boolean hasChildren)
hasChildren
- true if this item has childrenvoid setVisible(boolean visible)
visible
- The visible to set.public java.lang.String getHeaderText()
null
the row header will display the row number.null
if
the default has to be displayedorg.eclipse.swt.SWTException
- public org.eclipse.swt.graphics.Image getHeaderImage()
null
if none has
to be displayedorg.eclipse.swt.SWTException
- public org.eclipse.swt.graphics.Color getHeaderBackground()
null
if noneorg.eclipse.swt.SWTException
- public org.eclipse.swt.graphics.Color getHeaderForeground()
null
if noneorg.eclipse.swt.SWTException
- public org.eclipse.swt.graphics.Font getHeaderFont()
null
if noneorg.eclipse.swt.SWTException
- public void setHeaderText(java.lang.String text)
null
the
row header will display the row number.text
- the new textjava.lang.IllegalArgumentException
- org.eclipse.swt.SWTException
- public void setHeaderImage(org.eclipse.swt.graphics.Image image)
null
none is shown in the headerimage
- the new imageorg.eclipse.swt.SWTException
- public void setHeaderBackground(org.eclipse.swt.graphics.Color headerBackground)
headerBackground
- the color or null
org.eclipse.swt.SWTException
- public void setHeaderForeground(org.eclipse.swt.graphics.Color headerForeground)
headerForeground
- the color or null
org.eclipse.swt.SWTException
- public void setHeaderFont(org.eclipse.swt.graphics.Font headerFont)
headerFont
- the font or null
org.eclipse.swt.SWTException
- public boolean getCheckable(int index)
index
- the column indexorg.eclipse.swt.SWTException
- public void setCheckable(int index, boolean checked)
index
- the column indexchecked
- the new checked stateorg.eclipse.swt.SWTException
- public java.lang.String getToolTipText(int index)
index
- the column indexorg.eclipse.swt.SWTException
- public void setToolTipText(int index, java.lang.String tooltip)
index
- the column indextooltip
- the tooltip textorg.eclipse.swt.SWTException
- void columnAdded(int index)
void initializeHeight(int height)
height
- initial height.void setHasSetData(boolean hasSetData)
void clear(boolean allChildren)
allChildren
- true
if all child items should be cleared
recursively, and false
otherwisepublic void disposeOnly()