|
|||||||||
| Home >> All >> org >> eclipse >> swt >> [ widgets overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.eclipse.swt.widgets
Class Tree

java.lang.Objectorg.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Control
org.eclipse.swt.widgets.Scrollable
org.eclipse.swt.widgets.Composite
org.eclipse.swt.widgets.Tree
- All Implemented Interfaces:
- org.eclipse.swt.graphics.Drawable
- public class Tree
- extends Composite
Instances of this class provide a selectable user interface object that displays a hierarchy of items and issue notificiation when an item in the hierarchy is selected.
The item children that may be added to instances of this class
must be of type TreeItem.
Note that although this class is a subclass of Composite,
it does not make sense to add Control children to it,
or set a layout on it.
- Styles:
- SINGLE, MULTI, CHECK
- Events:
- Selection, DefaultSelection, Collapse, Expand
Note: Only one of the styles SINGLE and MULTI may be specified.
IMPORTANT: This class is not intended to be subclassed.
| Field Summary | |
(package private) static int |
BACKGROUND_COLUMN
|
(package private) static int |
CHECKED_COLUMN
|
(package private) long |
checkRenderer
|
(package private) long |
columnHandle
|
(package private) static int |
FONT_COLUMN
|
(package private) static int |
FOREGROUND_COLUMN
|
(package private) static int |
GRAYED_COLUMN
|
(package private) static int |
ID_COLUMN
|
(package private) ImageList |
imageList
|
(package private) TreeItem[] |
items
|
(package private) long |
modelHandle
|
(package private) static int |
PIXBUF_COLUMN
|
(package private) long |
pixbufRenderer
|
(package private) static int |
TEXT_COLUMN
|
(package private) long |
textRenderer
|
| Fields inherited from class org.eclipse.swt.widgets.Composite |
embeddedHandle, imHandle, layout, socketHandle, tabList |
| Fields inherited from class org.eclipse.swt.widgets.Scrollable |
horizontalBar, scrolledHandle, verticalBar |
| Fields inherited from class org.eclipse.swt.widgets.Control |
accessible, cursor, drawCount, enableWindow, fixedHandle, font, layoutData, menu, parent, redrawWindow, toolTipText |
| Fields inherited from class org.eclipse.swt.widgets.Widget |
ACTIVATE, BUTTON_PRESS_EVENT, BUTTON_RELEASE_EVENT, CANVAS, CHANGED, CLICKED, COMMIT, CONFIGURE_EVENT, data, DEFAULT_HEIGHT, DEFAULT_WIDTH, DELETE_EVENT, DELETE_RANGE, DELETE_TEXT, DISABLED, display, DISPOSED, ENTER_NOTIFY_EVENT, EVENT, EVENT_AFTER, eventTable, EXPOSE_EVENT, FOCUS, FOCUS_IN_EVENT, FOCUS_OUT_EVENT, handle, HANDLE, HIDE, INSERT_TEXT, KEY_PRESS_EVENT, KEY_RELEASE_EVENT, KEYED_DATA, LEAVE_NOTIFY_EVENT, MAP_EVENT, MENU, MNEMONIC_ACTIVATE, MOTION_NOTIFY_EVENT, OBSCURED, POPUP_MENU, PREEDIT_CHANGED, REALIZE, ROW_ACTIVATED, SCROLL_CHILD, SELECT, SHOW, SHOW_HELP, SIZE_ALLOCATE, state, style, STYLE_SET, SWITCH_PAGE, TEST_COLLAPSE_ROW, TEST_EXPAND_ROW, TOGGLED, UNMAP_EVENT, UNREALIZE, VALUE_CHANGED, VISIBILITY_NOTIFY_EVENT, WINDOW_STATE_EVENT |
| Constructor Summary | |
Tree(Composite parent,
int style)
Constructs a new instance of this class given its parent and a style value describing its behavior and appearance. |
|
| Method Summary | |
void |
addSelectionListener(org.eclipse.swt.events.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 the SelectionListener
interface. |
void |
addTreeListener(org.eclipse.swt.events.TreeListener listener)
Adds the listener to the collection of listeners who will be notified when an item in the receiver is expanded or collapsed by sending it one of the messages defined in the TreeListener
interface. |
(package private) static int |
checkStyle(int style)
|
org.eclipse.swt.graphics.Point |
computeSize(int wHint,
int hHint,
boolean changed)
Returns the preferred size of the receiver. |
(package private) void |
createHandle(int index)
|
(package private) void |
createItem(TreeItem item,
long iter,
int index)
|
(package private) void |
createWidget(int index)
|
(package private) org.eclipse.swt.internal.gtk.GdkColor |
defaultBackground()
|
(package private) org.eclipse.swt.internal.gtk.GdkColor |
defaultForeground()
|
(package private) void |
deregister()
|
void |
deselectAll()
Deselects all selected items in the receiver. |
(package private) void |
destroyItem(TreeItem item)
|
(package private) void |
destroyWidget()
|
(package private) org.eclipse.swt.internal.gtk.GdkColor |
getBackgroundColor()
|
(package private) TreeItem |
getFocusItem()
|
(package private) org.eclipse.swt.internal.gtk.GdkColor |
getForegroundColor()
|
TreeItem |
getItem(org.eclipse.swt.graphics.Point point)
Returns the item at the given point in the receiver or null if no such item exists. |
int |
getItemCount()
Returns the number of items contained in the receiver that are direct item children of the receiver. |
int |
getItemHeight()
Returns the height of the area which would be used to display one of the items in the tree. |
TreeItem[] |
getItems()
Returns the items contained in the receiver that are direct item children of the receiver. |
(package private) TreeItem[] |
getItems(long parent)
|
TreeItem |
getParentItem()
Returns the receiver's parent item, which must be a TreeItem or null when the receiver is a
root. |
TreeItem[] |
getSelection()
Returns an array of TreeItems that are currently
selected in the receiver. |
int |
getSelectionCount()
Returns the number of selected items contained in the receiver. |
TreeItem |
getTopItem()
Returns the item which is currently at the top of the receiver. |
(package private) long |
gtk_button_press_event(long widget,
long event)
|
(package private) long |
gtk_changed(long widget)
|
(package private) long |
gtk_key_press_event(long widget,
long eventPtr)
|
(package private) long |
gtk_row_activated(long tree,
long path,
long column)
|
(package private) long |
gtk_test_collapse_row(long tree,
long iter,
long path)
|
(package private) long |
gtk_test_expand_row(long tree,
long iter,
long path)
|
(package private) long |
gtk_toggled(long renderer,
long pathStr)
|
(package private) void |
hookEvents()
|
(package private) long |
paintWindow()
|
(package private) void |
register()
|
(package private) boolean |
releaseItem(TreeItem item,
int[] index)
|
(package private) void |
releaseItems(TreeItem[] nodes,
int[] index)
|
(package private) void |
releaseWidget()
|
void |
removeAll()
Removes all of the items from the receiver. |
(package private) void |
removeColumn()
|
void |
removeSelectionListener(org.eclipse.swt.events.SelectionListener listener)
Removes the listener from the collection of listeners who will be notified when the receiver's selection changes. |
void |
removeTreeListener(org.eclipse.swt.events.TreeListener listener)
Removes the listener from the collection of listeners who will be notified when items in the receiver are expanded or collapsed.. |
void |
selectAll()
Selects all of the items in the receiver. |
(package private) void |
setBackgroundColor(org.eclipse.swt.internal.gtk.GdkColor color)
|
(package private) boolean |
setBounds(int x,
int y,
int width,
int height,
boolean move,
boolean resize)
|
(package private) void |
setForegroundColor(org.eclipse.swt.internal.gtk.GdkColor color)
|
void |
setInsertMark(TreeItem item,
boolean before)
Display a mark indicating the point at which an item will be inserted. |
void |
setSelection(TreeItem[] items)
Sets the receiver's selection to be the given array of items. |
void |
setTopItem(TreeItem item)
Sets the item which is currently at the top of the receiver. |
(package private) void |
showItem(long path,
boolean scroll)
|
void |
showItem(TreeItem item)
Shows the item. |
void |
showSelection()
Shows the selection. |
(package private) long |
treeSelectionProc(long model,
long path,
long iter,
int[] selection,
int length)
|
| Methods inherited from class org.eclipse.swt.widgets.Composite |
_getChildren, _getTabList, checkSubclass, computeTabList, createHandle, enableWidget, findMenus, fixChildren, fixTabList, focusHandle, forceFocus, getChildren, getChildrenCount, getLayout, getTabList, gtk_expose_event, gtk_focus_in_event, gtk_focus_out_event, gtk_focus, gtk_realize, gtk_scroll_child, gtk_style_set, hasBorder, hooksKeys, imHandle, isTabGroup, layout, layout, minimumSize, moveAbove, moveBelow, parentingHandle, releaseChildren, removeControl, resizeHandle, setFocus, setLayout, setTabGroupFocus, setTabItemFocus, setTabList, translateMnemonic, translateTraversal, traversalCode |
| Methods inherited from class org.eclipse.swt.widgets.Scrollable |
clientHandle, computeTrim, createScrollBar, getBorderWidth, getClientArea, getHorizontalBar, getVerticalBar, hScrollBarWidth, releaseHandle, setOrientation, topHandle, vScrollBarWidth |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
modelHandle
long modelHandle
columnHandle
long columnHandle
checkRenderer
long checkRenderer
pixbufRenderer
long pixbufRenderer
textRenderer
long textRenderer
items
TreeItem[] items
imageList
ImageList imageList
TEXT_COLUMN
static final int TEXT_COLUMN
- See Also:
- Constant Field Values
PIXBUF_COLUMN
static final int PIXBUF_COLUMN
- See Also:
- Constant Field Values
FOREGROUND_COLUMN
static final int FOREGROUND_COLUMN
- See Also:
- Constant Field Values
BACKGROUND_COLUMN
static final int BACKGROUND_COLUMN
- See Also:
- Constant Field Values
FONT_COLUMN
static final int FONT_COLUMN
- See Also:
- Constant Field Values
ID_COLUMN
static final int ID_COLUMN
- See Also:
- Constant Field Values
CHECKED_COLUMN
static final int CHECKED_COLUMN
- See Also:
- Constant Field Values
GRAYED_COLUMN
static final int GRAYED_COLUMN
- See Also:
- Constant Field Values
| Constructor Detail |
Tree
public Tree(Composite parent, int style)
- Constructs a new instance of this class given its parent
and a style value describing its behavior and appearance.
The style value is either one of the style constants defined in class
SWTwhich is applicable to instances of this class, or must be built by bitwise OR'ing together (that is, using theint"|" operator) two or more of thoseSWTstyle constants. The class description lists the style constants that are applicable to the class. Style bits are also inherited from superclasses.
| Method Detail |
checkStyle
static int checkStyle(int style)
addSelectionListener
public void addSelectionListener(org.eclipse.swt.events.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 the
SelectionListenerinterface.When
widgetSelectedis called, the item field of the event object is valid. If the reciever hasSWT.CHECKstyle set and the check selection changes, the event object detail field contains the valueSWT.CHECK.widgetDefaultSelectedis typically called when an item is double-clicked. The item field of the event object is valid for default selection, but the detail field is not used.
addTreeListener
public void addTreeListener(org.eclipse.swt.events.TreeListener listener)
- Adds the listener to the collection of listeners who will
be notified when an item in the receiver is expanded or collapsed
by sending it one of the messages defined in the
TreeListenerinterface.
computeSize
public org.eclipse.swt.graphics.Point computeSize(int wHint, int hHint, boolean changed)
- Description copied from class:
Control - Returns the preferred size of the receiver.
The preferred size of a control is the size that it would best be displayed at. The width hint and height hint arguments allow the caller to ask a control questions such as "Given a particular width, how high does the control need to be to show all of the contents?" To indicate that the caller does not wish to constrain a particular dimension, the constant
SWT.DEFAULTis passed for the hint.If the changed flag is
true, it indicates that the receiver's contents have changed, therefore any caches that a layout manager containing the control may have been keeping need to be flushed. When the control is resized, the changed flag will befalse, so layout manager caches can be retained.- Overrides:
computeSizein classComposite
createHandle
void createHandle(int index)
- Overrides:
createHandlein classComposite
createItem
void createItem(TreeItem item, long iter, int index)
createWidget
void createWidget(int index)
- Overrides:
createWidgetin classScrollable
defaultBackground
org.eclipse.swt.internal.gtk.GdkColor defaultBackground()
defaultForeground
org.eclipse.swt.internal.gtk.GdkColor defaultForeground()
deregister
void deregister()
- Overrides:
deregisterin classComposite
deselectAll
public void deselectAll()
- Deselects all selected items in the receiver.
destroyItem
void destroyItem(TreeItem item)
destroyWidget
void destroyWidget()
- Overrides:
destroyWidgetin classWidget
getBackgroundColor
org.eclipse.swt.internal.gtk.GdkColor getBackgroundColor()
- Overrides:
getBackgroundColorin classControl
getFocusItem
TreeItem getFocusItem()
getForegroundColor
org.eclipse.swt.internal.gtk.GdkColor getForegroundColor()
- Overrides:
getForegroundColorin classControl
getItem
public TreeItem getItem(org.eclipse.swt.graphics.Point point)
- Returns the item at the given point in the receiver
or null if no such item exists. The point is in the
coordinate system of the receiver.
getItemCount
public int getItemCount()
- Returns the number of items contained in the receiver
that are direct item children of the receiver. The
number that is returned is the number of roots in the
tree.
getItemHeight
public int getItemHeight()
- Returns the height of the area which would be used to
display one of the items in the tree.
getItems
public TreeItem[] getItems()
- Returns the items contained in the receiver
that are direct item children of the receiver. These
are the roots of the tree.
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.
getItems
TreeItem[] getItems(long parent)
getParentItem
public TreeItem getParentItem()
- Returns the receiver's parent item, which must be a
TreeItemor null when the receiver is a root.
getSelection
public TreeItem[] getSelection()
- Returns an array of
TreeItems that are currently selected in the receiver. 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.
getSelectionCount
public int getSelectionCount()
- Returns the number of selected items contained in the receiver.
getTopItem
public TreeItem getTopItem()
- Returns the item which is currently at the top of the receiver.
This item can change when items are expanded, collapsed, scrolled
or new items are added or removed.
- Since:
- 2.1
gtk_changed
long gtk_changed(long widget)
- Overrides:
gtk_changedin classWidget
gtk_key_press_event
long gtk_key_press_event(long widget,
long eventPtr)
- Overrides:
gtk_key_press_eventin classComposite
gtk_row_activated
long gtk_row_activated(long tree,
long path,
long column)
- Overrides:
gtk_row_activatedin classWidget
gtk_test_collapse_row
long gtk_test_collapse_row(long tree,
long iter,
long path)
- Overrides:
gtk_test_collapse_rowin classWidget
gtk_test_expand_row
long gtk_test_expand_row(long tree,
long iter,
long path)
- Overrides:
gtk_test_expand_rowin classWidget
gtk_toggled
long gtk_toggled(long renderer,
long pathStr)
- Overrides:
gtk_toggledin classWidget
gtk_button_press_event
long gtk_button_press_event(long widget,
long event)
- Overrides:
gtk_button_press_eventin classComposite
hookEvents
void hookEvents()
- Overrides:
hookEventsin classComposite
paintWindow
long paintWindow()
- Overrides:
paintWindowin classControl
register
void register()
releaseItem
boolean releaseItem(TreeItem item, int[] index)
releaseItems
void releaseItems(TreeItem[] nodes, int[] index)
releaseWidget
void releaseWidget()
- Overrides:
releaseWidgetin classComposite
removeAll
public void removeAll()
- Removes all of the items from the receiver.
removeColumn
void removeColumn()
removeSelectionListener
public void removeSelectionListener(org.eclipse.swt.events.SelectionListener listener)
- Removes the listener from the collection of listeners who will
be notified when the receiver's selection changes.
removeTreeListener
public void removeTreeListener(org.eclipse.swt.events.TreeListener listener)
- Removes the listener from the collection of listeners who will
be notified when items in the receiver are expanded or collapsed..
setInsertMark
public void setInsertMark(TreeItem item, boolean before)
- Display a mark indicating the point at which an item will be inserted.
The drop insert item has a visual hint to show where a dragged item
will be inserted when dropped on the tree.
selectAll
public void selectAll()
- Selects all of the items in the receiver.
If the receiver is single-select, do nothing.
setBackgroundColor
void setBackgroundColor(org.eclipse.swt.internal.gtk.GdkColor color)
- Overrides:
setBackgroundColorin classControl
setBounds
boolean setBounds(int x,
int y,
int width,
int height,
boolean move,
boolean resize)
setForegroundColor
void setForegroundColor(org.eclipse.swt.internal.gtk.GdkColor color)
- Overrides:
setForegroundColorin classControl
setSelection
public void setSelection(TreeItem[] items)
- Sets the receiver's selection to be the given array of items.
The current selection is cleared before the new items are selected.
Items that are not in the receiver are ignored. If the receiver is single-select and multiple items are specified, then all items are ignored.
setTopItem
public void setTopItem(TreeItem item)
- Sets the item which is currently at the top of the receiver.
This item can change when items are expanded, collapsed, scrolled
or new items are added or removed.
- Since:
- 2.1
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.
showItem
void showItem(long path,
boolean scroll)
showItem
public void showItem(TreeItem item)
- Shows the item. If the item is already showing in the receiver,
this method simply returns. Otherwise, the items are scrolled
and expanded until the item is visible.
treeSelectionProc
long treeSelectionProc(long model,
long path,
long iter,
int[] selection,
int length)
- Overrides:
treeSelectionProcin classWidget
|
|||||||||
| Home >> All >> org >> eclipse >> swt >> [ widgets overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC