The item children that may be added to instances of this class
must be of type TreeItem.
Style VIRTUAL is used to create a Tree whose
TreeItems are to be populated by the client on an on-demand basis
instead of up-front. This can provide significant performance improvements for
trees that are very large or for which TreeItem population is
expensive (for example, retrieving values from an external source).
Here is an example of using a Tree with style VIRTUAL:
final Tree tree = new Tree(parent, SWT.VIRTUAL | SWT.BORDER);
tree.setItemCount(20);
tree.addListener(SWT.SetData, new Listener() {
public void handleEvent(Event event) {
TreeItem item = (TreeItem)event.item;
TreeItem parentItem = item.getParentItem();
String text = null;
if (parentItem == null) {
text = "node " + tree.indexOf(item);
} else {
text = parentItem.getText() + " - " + parentItem.indexOf(item);
}
item.setText(text);
System.out.println(text);
item.setItemCount(10);
}
});
Note that although this class is a subclass of Composite,
it does not normally make sense to add Control children to
it, or set a layout on it, unless implementing something like a cell
editor.
Note
Only one of the styles SINGLE and MULTI may be specified.
Important Note
This class is not intended to be subclassed.
| Modifier and Type | Field and Description |
|---|---|
| pack-priv GdkRGBA | |
| pack-priv static final int | |
| pack-priv boolean | |
| pack-priv double | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv long | |
| pack-priv int | |
| pack-priv TreeColumn[] | |
| pack-priv double | |
| pack-priv TreeItem | |
| pack-priv int | |
| pack-priv GdkRGBA | |
| pack-priv int | |
| pack-priv boolean | |
| pack-priv static final int | |
| pack-priv boolean | firstCompute
True iff computeSize has never been called on this Tree |
| pack-priv boolean | |
| pack-priv static final int | |
| pack-priv GdkRGBA | |
| pack-priv static final int | |
| pack-priv static final int | |
| pack-priv boolean | |
| pack-priv Color | |
| private long | |
| pack-priv Color | |
| pack-priv int | |
| pack-priv ImageList | |
| pack-priv boolean | |
| pack-priv static final int | |
| pack-priv long | |
| pack-priv boolean | |
| pack-priv ImageList | |
| pack-priv boolean | isOwnerDrawn
The owner of the widget is responsible for drawing |
| pack-priv TreeItem[] | |
| pack-priv boolean | |
| pack-priv long | |
| pack-priv int | |
| pack-priv int | |
| pack-priv boolean | |
| pack-priv int | |
| pack-priv boolean | |
| pack-priv int | |
| pack-priv int | |
| pack-priv TreeColumn | |
| pack-priv int | |
| pack-priv TreeItem | |
| pack-priv boolean |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| pack-priv void | _addListener(int eventType, Listener listener)
Overrides org. |
| pack-priv TreeItem | |
| pack-priv TreeItem | |
| pack-priv TreeItem | |
| public void | addSelectionListener(SelectionListener
the listener which should be notified when the user changes the receiver's selection listener)Adds the listener to the collection of listeners who will
be notified when the user changes the receiver's selection, by sending
it one of the messages defined in the |
| public void | addTreeListener(TreeListener
the listener which should be notified 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 |
| pack-priv int | |
| pack-priv void | bindArrowKeyBindings()
Binds the left and right arrow keys to allow for expanding and collapsing of the tree nodes. |
| pack-priv int | |
| pack-priv long | cellDataProc(long tree_column, long cell, long tree_model, long iter, long data)
Overrides org. |
| pack-priv boolean | |
| pack-priv void | checkSetDataInProcessBeforeRemoval()
Check the tree for items that are in process of
sending |
| pack-priv static int | |
| protected void | checkSubclass()
Checks that this class can be subclassed.
|
| public void | clear(int
the index of the item to clear index, boolean true if all child items of the indexed item should be
cleared recursively, and false otherwiseClears the item at the given zero-relative index in the receiver. |
| pack-priv void | |
| public void | clearAll(boolean
true if all child items should be cleared
recursively, and false otherwiseClears all the items in the receiver. |
| pack-priv void | |
| pack-priv Point | computeSizeInPixels(int wHint, int hHint, boolean changed)
Overrides org. |
| pack-priv void | copyModel(long oldModel, int oldStart, long newModel, int newStart, long oldParent, long newParent, int modelLength)
|
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | createItem(TreeItem item, long parentIter, int index)
The fastest way to insert many items is documented in |
| pack-priv void | |
| pack-priv void | |
| pack-priv GdkRGBA | |
| pack-priv void | |
| public void | |
| public void | |
| pack-priv void | |
| pack-priv void | |
| public void | dispose()
Overrides org. |
| pack-priv boolean | dragDetect(int x, int y, boolean filter, boolean dragOnTimeout, boolean[] consume)
Overrides org. |
| pack-priv void | |
| pack-priv long | |
| pack-priv int | |
| pack-priv Rectangle | |
| pack-priv int | |
| public TreeColumn | Returns: the column at the given indexthe index of the column to return index)Returns the column at the given, zero-relative index in the receiver. |
| public int | Returns: the number of columnsReturns the number of columns contained in the receiver. |
| public int[] | Returns: the current visual order of the receiver's itemsReturns an array of zero-relative integers that map the creation order of the receiver's items to the order in which they are currently being displayed. |
| public TreeColumn[] | Returns: the items in the receiverReturns an array of |
| pack-priv long[] | |
| pack-priv GdkRGBA | |
| pack-priv GdkRGBA | |
| pack-priv TreeItem | |
| private GC | |
| public int | Returns: the width of a grid line in pointsReturns the width in points of a grid line. |
| pack-priv int | |
| public Color | Returns: the receiver's header background color.Returns the header background color. |
| public Color | Returns: the receiver's header foreground color.Returns the header foreground color. |
| public int | Returns: the height of the header or zero if the header is not visibleReturns the height of the receiver's header |
| pack-priv int | |
| public boolean | Returns: the receiver's header's visibility stateReturns |
| pack-priv int | |
| public TreeItem | Returns: the item at the given indexthe index of the item to return index)Returns the item at the given, zero-relative index in the receiver. |
| public TreeItem | |
| public int | Returns: the number of itemsReturns the number of items contained in the receiver that are direct item children of the receiver. |
| public int | Returns: the height of one itemReturns the height of the area which would be used to display one of the items in the tree. |
| pack-priv int | |
| pack-priv TreeItem | |
| public TreeItem[] | Returns: the itemsReturns a (possibly empty) array of items contained in the receiver that are direct item children of the receiver. |
| pack-priv TreeItem[] | |
| public boolean | Returns: the visibility state of the linesReturns |
| public TreeItem | Returns: the receiver's parent itemReturns the receiver's parent item, which must be a
|
| pack-priv long | |
| public TreeItem[] | Returns: an array representing the selectionReturns an array of |
| public int | Returns: the number of selected itemsReturns the number of selected items contained in the receiver. |
| public TreeColumn | Returns: the sort indicatorReturns the column which shows the sort indicator for the receiver. |
| public int | Returns: the sort directionReturns the direction of the sort indicator for the receiver. |
| pack-priv long | |
| public TreeItem | Returns: the item at the top of the receiverReturns the item which is currently at the top of the receiver. |
| pack-priv long | gtk_button_press_event(long widget, long event)
Overrides org. |
| pack-priv long | gtk_button_release_event(long widget, long event)
Overrides org. |
| pack-priv long | |
| pack-priv long | |
| pack-priv long | gtk_expand_collapse_cursor_row(long widget, long logical, long expand, long open_all)
Overrides org. |
| pack-priv void | gtk_gesture_press_event(long
the corresponding controller responsible for capturing the event gesture, int how many touch/button presses happened with this one n_press, double the x coordinate, in widget allocation coordinates x, double the y coordinate, in widget allocation coordinates y, long the GdkEvent captured event)Overrides org. |
| pack-priv long | gtk_key_press_event(long widget, long event)
Overrides org. |
| pack-priv long | gtk_motion_notify_event(long widget, long event)
Overrides org. |
| pack-priv long | gtk_row_activated(long tree, long path, long column)
|
| pack-priv long | gtk_row_has_child_toggled(long model, long path, long iter)
Overrides org. |
| pack-priv long | gtk_scroll_event(long widget, long eventPtr)
Overrides org. |
| pack-priv long | gtk_start_interactive_search(long widget)
Overrides org. |
| pack-priv long | gtk_test_collapse_row(long tree, long iter, long path)
Overrides org. |
| pack-priv long | gtk_test_expand_row(long tree, long iter, long path)
Overrides org. |
| pack-priv long | |
| pack-priv void | gtk_widget_get_preferred_size(long widget, GtkRequisition requisition)
Overrides org. |
| pack-priv void | |
| pack-priv void | |
| public int | Returns: the index of the columnthe search column column)Searches the receiver's list starting at the first column (index 0) until a column is found that is equal to the argument, and returns the index of that column. |
| public int | |
| pack-priv boolean | |
| pack-priv boolean | |
| pack-priv long | |
| pack-priv void | propagateDraw(long
the parent container, i.e. fixedHandle container, long the cairo context provided by GTK cairo)Overrides org. Propagates draw events from a parent container to its children using gtk_container_propagate_draw(). |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| public void | |
| public void | removeSelectionListener(SelectionListener
the listener which should no longer be notified listener)Removes the listener from the collection of listeners who will be notified when the user changes the receiver's selection. |
| public void | removeTreeListener(TreeListener
the listener which should no longer be notified listener)Removes the listener from the collection of listeners who will be notified when items in the receiver are expanded or collapsed. |
| pack-priv long | rendererGetPreferredWidthProc(long cell, long handle, long minimun_size, long natural_size)
Overrides org. |
| pack-priv void | rendererRender(long cell, long cr, long snapshot, long widget, long background_area, long cell_area, long expose_area, long flags)
|
| pack-priv long | rendererRenderProc(long cell, long cr, long widget, long background_area, long cell_area, long flags)
Overrides org. |
| pack-priv long | rendererSnapshotProc(long cell, long snapshot, long widget, long background_area, long cell_area, long flags)
Overrides org. |
| pack-priv void | |
| pack-priv Point | resizeCalculationsGTK3(long widget, int width, int height)
Overrides org. |
| pack-priv void | |
| pack-priv boolean | |
| public void | |
| public void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | setBackgroundGdkRGBA(long context, long handle, GdkRGBA rgba)
Overrides org. |
| pack-priv void | |
| pack-priv int | setBounds(int x, int y, int width, int height, boolean move, boolean resize)
Overrides org. |
| public void | setColumnOrder(int[]
the new order to display the items order)Sets the order that the items in the receiver should be displayed in to the given argument which is described in terms of the zero-relative ordering of when the items were added. |
| pack-priv void | |
| pack-priv void | |
| public void | setHeaderBackground(Color
the new color (or null) color)Sets the header background color to the color specified by the argument, or to the default system color if the argument is null. |
| public void | setHeaderForeground(Color
the new color (or null) color)Sets the header foreground color to the color specified by the argument, or to the default system color if the argument is null. |
| public void | setHeaderVisible(boolean
the new visibility state show)Marks the receiver's header as visible if the argument is |
| public void | setInsertMark(TreeItem
the insert item. Null will clear the insertion mark. item, boolean true places the insert mark above 'item'. false places
the insert mark below 'item'. before)Display a mark indicating the point at which an item will be inserted. |
| pack-priv void | |
| public void | setItemCount(int
the number of items count)Sets the number of root-level items contained in the receiver. |
| public void | setLinesVisible(boolean
the new visibility state show)Marks the receiver's lines as visible if the argument is |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv void | |
| public void | |
| public void | setSelection(TreeItem[]
the array of items items)Sets the receiver's selection to be the given array of items. |
| public void | setSortColumn(TreeColumn
the column used by the sort indicator or column)nullSets the column used by the sort indicator for the receiver. |
| public void | setSortDirection(int
the direction of the sort indicator direction)Sets the direction of the sort indicator for the receiver. |
| public void | setTopItem(TreeItem
the item to be shown item)Sets the item which is currently at the top of the receiver. |
| public void | |
| pack-priv boolean | |
| pack-priv void | |
| public void | |
| public void | |
| private void | |
| pack-priv void | |
| pack-priv void | |
| pack-priv long | windowProc(long handle, long arg0, long user_data)
Overrides org. |