org.eclipse.swt.widgets
Class TreeItem

java.lang.Object
  |
  +--org.eclipse.swt.widgets.Widget
        |
        +--org.eclipse.swt.widgets.Item
              |
              +--org.eclipse.swt.widgets.TreeItem

public class TreeItem
extends Item

Safe: Instances of this class represent a selectable user interface object that represents a hierarchy of tree items in a tree widget.

Styles:
(none)
Events:
(none)

IMPORTANT: This class is not intended to be subclassed.


Field Summary
(package private)  int background
           
(package private)  int foreground
           
 int handle
          Suppressed: the handle to the OS resource (Warning: This field is platform dependent)
(package private)  Tree parent
           
 
Fields inherited from class org.eclipse.swt.widgets.Item
image, text
 
Fields inherited from class org.eclipse.swt.widgets.Widget
CANVAS, COMCTL32_MAJOR, COMCTL32_MINOR, data, DEFAULT_HEIGHT, DEFAULT_WIDTH, DISABLED, DISPOSED, eventTable, HIDDEN, keys, MAJOR, MINOR, Mnemonic, state, style, values
 
Constructor Summary
TreeItem(Tree parent, int style)
          Enabled: Constructs a new instance of this class given its parent (which must be a Tree or a TreeItem) and a style value describing its behavior and appearance.
TreeItem(Tree parent, int style, int index)
          Enabled: Constructs a new instance of this class given its parent (which must be a Tree or a TreeItem), a style value describing its behavior and appearance, and the index at which to place it in the items maintained by its parent.
TreeItem(TreeItem parentItem, int style)
          Enabled: Constructs a new instance of this class given its parent (which must be a Tree or a TreeItem) and a style value describing its behavior and appearance.
TreeItem(TreeItem parentItem, int style, int index)
          Enabled: Constructs a new instance of this class given its parent (which must be a Tree or a TreeItem), a style value describing its behavior and appearance, and the index at which to place it in the items maintained by its parent.
 
Method Summary
(package private) static TreeItem checkNull(TreeItem item)
           
protected  void checkSubclass()
          Checks that this class can be subclassed.
 Color getBackground()
          Enabled: Returns the receiver's background color.
 Rectangle getBounds()
          Enabled: Returns a rectangle describing the receiver's size and location relative to its parent.
 boolean getChecked()
          Enabled: Returns true if the receiver is checked, and false otherwise.
 Display getDisplay()
          Suppressed:
 boolean getExpanded()
          Suppressed: Returns true if the receiver is expanded, and false otherwise.
 Color getForeground()
          Enabled: Returns the foreground color that the receiver will use to draw.
 boolean getGrayed()
          Enabled: Returns true if the receiver is grayed, and false otherwise.
 int getItemCount()
          Enabled: Returns the number of items contained in the receiver that are direct item children of the receiver.
 TreeItem[] getItems()
          Enabled: Returns an array of TreeItems which are the direct item children of the receiver.
 Tree getParent()
          Suppressed: Returns the receiver's parent, which must be a Tree.
 TreeItem getParentItem()
          Suppressed: Returns the receiver's parent item, which must be a TreeItem or null when the receiver is a root.
(package private)  void redraw()
           
(package private)  void releaseChild()
           
(package private)  void releaseHandle()
           
(package private)  void releaseWidget()
           
 void setBackground(Color color)
          Enabled: 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 setChecked(boolean checked)
          Suppressed: Sets the checked state of the receiver.
 void setExpanded(boolean expanded)
          Enabled: Sets the expanded state of the receiver.
 void setForeground(Color color)
          Enabled: 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 setGrayed(boolean grayed)
          Enabled: Sets the grayed state of the receiver.
 void setImage(Image image)
          Enabled:
 void setText(String string)
          Enabled:
 
Methods inherited from class org.eclipse.swt.widgets.Item
getImage, getNameText, getText
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkBits, checkOrientation, checkParent, checkWidget, destroyWidget, dispose, error, filters, getData, getData, getName, getStyle, hooks, isDisposed, isListening, isValidSubclass, isValidThread, mbcsToWcs, mbcsToWcs, notifyListeners, postEvent, postEvent, releaseResources, removeDisposeListener, removeListener, removeListener, sendEvent, sendEvent, sendEvent, sendEvent, setData, setData, setInputState, setKeyState, toString, wcsToMbcs, wcsToMbcs
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

handle

public int handle
Suppressed: the handle to the OS resource (Warning: This field is platform dependent)


parent

Tree parent

background

int background

foreground

int foreground
Constructor Detail

TreeItem

public TreeItem(Tree parent,
                int style)
Enabled: Constructs a new instance of this class given its parent (which must be a Tree or a TreeItem) and a style value describing its behavior and appearance. The item is added to the end of the items maintained by its parent.

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

Parameters:
parent - a composite control which will be the parent of the new instance (cannot be null)
style - the style of control to construct
See Also:
SWT, Widget.checkSubclass(), Widget.getStyle()

TreeItem

public TreeItem(Tree parent,
                int style,
                int index)
Enabled: Constructs a new instance of this class given its parent (which must be a Tree or a TreeItem), a style value describing its behavior and appearance, and the index at which to place it in the items maintained by its parent.

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

Parameters:
parent - a composite control which will be the parent of the new instance (cannot be null)
style - the style of control to construct
index - the index to store the receiver in its parent
See Also:
SWT, Widget.checkSubclass(), Widget.getStyle()

TreeItem

public TreeItem(TreeItem parentItem,
                int style)
Enabled: Constructs a new instance of this class given its parent (which must be a Tree or a TreeItem) and a style value describing its behavior and appearance. The item is added to the end of the items maintained by its parent.

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

Parameters:
parentItem - a composite control which will be the parent of the new instance (cannot be null)
style - the style of control to construct
See Also:
SWT, Widget.checkSubclass(), Widget.getStyle()

TreeItem

public TreeItem(TreeItem parentItem,
                int style,
                int index)
Enabled: Constructs a new instance of this class given its parent (which must be a Tree or a TreeItem), a style value describing its behavior and appearance, and the index at which to place it in the items maintained by its parent.

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

Parameters:
parentItem - a composite control which will be the parent of the new instance (cannot be null)
style - the style of control to construct
index - the index to store the receiver in its parent
See Also:
SWT, Widget.checkSubclass(), Widget.getStyle()
Method Detail

checkNull

static TreeItem checkNull(TreeItem item)

checkSubclass

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

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

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

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

Overrides:
checkSubclass in class Item

getBackground

public Color getBackground()
Enabled: Returns the receiver's background color.

Returns:
the background color
Since:
2.0

getBounds

public Rectangle getBounds()
Enabled: Returns a rectangle describing the receiver's size and location relative to its parent.

Returns:
the receiver's bounding rectangle

getChecked

public boolean getChecked()
Enabled: Returns true if the receiver is checked, and false otherwise. When the parent does not have the CHECK style, return false.

Returns:
the checked state

getDisplay

public Display getDisplay()
Suppressed:

Specified by:
getDisplay in class Widget
Returns:
the receiver's display

getExpanded

public boolean getExpanded()
Suppressed: Returns true if the receiver is expanded, and false otherwise.

Returns:
the expanded state

getForeground

public Color getForeground()
Enabled: Returns the foreground color that the receiver will use to draw.

Returns:
the receiver's foreground color
Since:
2.0

getGrayed

public boolean getGrayed()
Enabled: Returns true if the receiver is grayed, and false otherwise. When the parent does not have the CHECK style, return false.

Returns:
the grayed state

getItemCount

public int getItemCount()
Enabled: Returns the number of items contained in the receiver that are direct item children of the receiver.

Returns:
the number of items

getItems

public TreeItem[] getItems()
Enabled: Returns an array of TreeItems 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

getParent

public Tree getParent()
Suppressed: Returns the receiver's parent, which must be a Tree.

Returns:
the receiver's parent

getParentItem

public TreeItem getParentItem()
Suppressed: Returns the receiver's parent item, which must be a TreeItem or null when the receiver is a root.

Returns:
the receiver's parent item

redraw

void redraw()

releaseChild

void releaseChild()
Overrides:
releaseChild in class Widget

releaseHandle

void releaseHandle()
Overrides:
releaseHandle in class Widget

releaseWidget

void releaseWidget()
Overrides:
releaseWidget in class Item

setBackground

public void setBackground(Color color)
Enabled: 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:
color - the new color (or null)
Since:
2.0

setChecked

public void setChecked(boolean checked)
Suppressed: Sets the checked state of the receiver.

Parameters:
checked - the new checked state

setExpanded

public void setExpanded(boolean expanded)
Enabled: Sets the expanded state of the receiver.

Parameters:
expanded - the new expanded state

setForeground

public void setForeground(Color color)
Enabled: 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:
color - the new color (or null)
Since:
2.0, 2.0

setGrayed

public void setGrayed(boolean grayed)
Enabled: Sets the grayed state of the receiver.


setImage

public void setImage(Image image)
Enabled:

Overrides:
setImage in class Item
Parameters:
image - the image to display on the receiver (may be null)

setText

public void setText(String string)
Enabled:

Overrides:
setText in class Item
Parameters:
string - the new text


comments?