Class Tree
- All Implemented Interfaces:
Drawable
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.
- Styles:
- SINGLE, MULTI, CHECK, FULL_SELECTION, VIRTUAL, NO_SCROLL, NO_SEARCH
- Events:
- Selection, DefaultSelection, Collapse, Expand, SetData, MeasureItem, EraseItem, PaintItem, EmptinessChanged
Note: Only one of the styles SINGLE and MULTI may be specified.
IMPORTANT: This class is not intended to be subclassed.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) GdkRGBA(package private) static final int(package private) boolean(package private) double(package private) static final int(package private) static final int(package private) static final int(package private) static final int(package private) static final int(package private) static final int(package private) static final int(package private) static final int(package private) long(package private) int(package private) TreeColumn[](package private) double(package private) TreeItem(package private) int(package private) GdkRGBA(package private) int(package private) boolean(package private) static final int(package private) booleanTrue iff computeSize has never been called on this Tree(package private) boolean(package private) static final int(package private) GdkRGBA(package private) static final int(package private) static final int(package private) boolean(package private) Colorprivate long(package private) Color(package private) int(package private) ImageList(package private) boolean(package private) static final int(package private) long(package private) boolean(package private) ImageList(package private) booleanThe owner of the widget is responsible for drawing(package private) TreeItem[](package private) boolean(package private) long(package private) int(package private) int(package private) boolean(package private) int(package private) boolean(package private) int(package private) int(package private) TreeColumn(package private) int(package private) TreeItem(package private) booleanFields inherited from class Composite
backgroundMode, childrenLowered, embeddedHandle, fixClipHandle, fixClipMap, imHandle, layout, layoutCount, NO_INPUT_METHOD, noChildDrawing, popupChild, socketHandle, tabListFields inherited from class Scrollable
horizontalBar, RESIZE_ON_GETCLIENTAREA, scrolledHandle, verticalBarFields inherited from class Control
accessible, autoScale, backgroundAlpha, backgroundImage, cachedNoBackground, checkScaleFactor, cssBackground, cssForeground, cursor, DISABLE_EMOJI, dragDetectionQueue, dragGesture, drawCount, drawRegion, enableWindow, eventRegion, firstFixedHandle, fixedHandle, font, gestureBegin, gestureEnd, gestureRotation, gestureSwipe, gestureZoom, keyController, labelRelation, lastInput, layoutData, menu, mouseDown, panGesture, parent, provider, redrawWindow, region, regionHandle, rotateGesture, toolTipText, zoomGestureFields inherited from class Widget
ACTIVATE, ACTIVATE_INVERSE, AUTO_TEXT_DIRECTION, BACKGROUND, BACKSPACE, BACKSPACE_INVERSE, BUTTON_PRESS_EVENT, BUTTON_PRESS_EVENT_INVERSE, BUTTON_RELEASE_EVENT, BUTTON_RELEASE_EVENT_INVERSE, CANVAS, CHANGE_VALUE, CHANGED, CHECK_SUBWINDOW, CLICKED, CLOSE_REQUEST, COMMIT, COMPUTE_SIZE, CONFIGURE_EVENT, COPY_CLIPBOARD, COPY_CLIPBOARD_INVERSE, CREATE_MENU_PROXY, CUT_CLIPBOARD, CUT_CLIPBOARD_INVERSE, data, DAY_SELECTED, DAY_SELECTED_DOUBLE_CLICK, DECELERATE, DEFAULT_HEIGHT, DEFAULT_WIDTH, DELETE_EVENT, DELETE_FROM_CURSOR, DELETE_FROM_CURSOR_INVERSE, DELETE_RANGE, DELETE_TEXT, DIRECTION_CHANGED, DISABLED, display, DISPOSE_SENT, DISPOSED, DPI_CHANGED, DRAG_DETECT, DRAW, ENTER, ENTER_NOTIFY_EVENT, EVENT, EVENT_AFTER, eventTable, EXPAND_COLLAPSE_CURSOR_ROW, EXPOSE_EVENT, EXPOSE_EVENT_INVERSE, FOCUS, FOCUS_IN, FOCUS_IN_EVENT, FOCUS_OUT, FOCUS_OUT_EVENT, FONT, FOREGROUND, FOREIGN_HANDLE, gdkSeatGrabPrepareFunc, GESTURE_PRESSED, GESTURE_RELEASED, GRAB_FOCUS, handle, HANDLE, HAS_AUTO_DIRECTION, HIDDEN, HIDE, ICON_RELEASE, IM_UPDATE, INPUT, INSERT_TEXT, IS_ACTIVE, KEY_CHECK_SUBWINDOW, KEY_GTK_CSS, KEY_PRESS_EVENT, KEY_PRESSED, KEY_RELEASE_EVENT, KEY_RELEASED, KEYED_DATA, LAST_SIGNAL, LAYOUT_CHANGED, LAYOUT_CHILD, LAYOUT_NEEDED, LEAVE, LEAVE_NOTIFY_EVENT, MAP, MAP_EVENT, MENU, MNEMONIC_ACTIVATE, MONTH_CHANGED, MOTION, MOTION_INVERSE, MOTION_NOTIFY_EVENT, MOTION_NOTIFY_EVENT_INVERSE, MOVE_CURSOR, MOVE_CURSOR_INVERSE, MOVE_FOCUS, MOVED, NOTIFY_DEFAULT_HEIGHT, NOTIFY_DEFAULT_WIDTH, NOTIFY_MAXIMIZED, NOTIFY_STATE, OBSCURED, OUTPUT, PARENT_BACKGROUND, PASTE_CLIPBOARD, PASTE_CLIPBOARD_INVERSE, POPPED_UP, POPULATE_POPUP, POPUP_MENU, PREEDIT_CHANGED, REALIZE, RELEASED, RESIZED, ROW_ACTIVATED, ROW_DELETED, ROW_HAS_CHILD_TOGGLED, ROW_INSERTED, SCROLL, SCROLL_BEGIN, SCROLL_CHILD, SCROLL_END, SCROLL_EVENT, SELECT, SELECTION_DONE, SHOW, SHOW_HELP, SIZE_ALLOCATE, SIZE_ALLOCATE_GTK4, SKIN_NEEDED, START_INTERACTIVE_SEARCH, state, STATUS_ICON_POPUP_MENU, style, STYLE_UPDATED, SWITCH_PAGE, TEST_COLLAPSE_ROW, TEST_EXPAND_ROW, TEXT_BUFFER_INSERT_TEXT, THEME_BACKGROUND, TOGGLED, UNMAP, UNMAP_EVENT, UNREALIZE, VALUE_CHANGED, WINDOW_STATE_EVENT, ZERO_HEIGHT, ZERO_WIDTH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) void_addListener(int eventType, Listener listener) (package private) TreeItem(package private) TreeItem_getItem(long iter) (package private) TreeItem_getItem(long parentIter, long iter, int index) voidaddSelectionListener(SelectionListener 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 theSelectionListenerinterface.voidaddTreeListener(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 theTreeListenerinterface.(package private) int(package private) voidBinds the left and right arrow keys to allow for expanding and collapsing of the tree nodes.(package private) intcalculateWidth(long column, long iter, boolean recurse) (package private) longcellDataProc(long tree_column, long cell, long tree_model, long iter, long data) (package private) boolean(package private) voidCheck the tree for items that are in process of sendingSWT#SetDataevent.(package private) static intcheckStyle(int style) protected voidChecks that this class can be subclassed.voidclear(int index, boolean all) Clears the item at the given zero-relative index in the receiver.(package private) voidclear(long parentIter, int index, boolean all) voidclearAll(boolean all) Clears all the items in the receiver.(package private) voidclearAll(boolean all, long parentIter) (package private) PointcomputeSizeInPixels(int wHint, int hHint, boolean changed) (package private) voidcopyModel(long oldModel, int oldStart, long newModel, int newStart, long oldParent, long newParent, int modelLength) (package private) voidcreateColumn(TreeColumn column, int index) (package private) voidcreateHandle(int index) (package private) voidcreateItem(TreeColumn column, int index) (package private) voidcreateItem(TreeItem item, long parentIter, int index) The fastest way to insert many items is documented inTreeItem(org.eclipse.swt.widgets.Tree,int,int)andTreeItem.setItemCount(int)(package private) voidcreateRenderers(long columnHandle, int modelIndex, boolean check, int columnStyle) (package private) voidcreateWidget(int index) (package private) GdkRGBA(package private) voidvoidDeselects an item in the receiver.voidDeselects all selected items in the receiver.(package private) voiddestroyItem(TreeColumn column) (package private) voiddestroyItem(TreeItem item) voiddispose()Disposes of the operating system resources associated with the receiver and all its descendants.(package private) booleandragDetect(int x, int y, boolean filter, boolean dragOnTimeout, boolean[] consume) (package private) voiddrawInheritedBackground(long cairo) (package private) long(package private) int(package private) Rectangle(package private) intgetColumn(int index) Returns the column at the given, zero-relative index in the receiver.intReturns the number of columns contained in the receiver.int[]Returns 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.Returns an array ofTreeColumns which are the columns in the receiver.(package private) long[]getColumnTypes(int columnCount) (package private) GdkRGBA(package private) GdkRGBA(package private) TreeItemprivate GCgetGC(long cr) intReturns the width in points of a grid line.Returns the header background color.Returns the header foreground color.intReturns the height of the receiver's headerbooleanReturnstrueif the receiver's header is visible, andfalseotherwise.(package private) intgetId(long iter, boolean queryModel) getItem(int index) Returns the item at the given, zero-relative index in the receiver.Returns the item at the given point in the receiver or null if no such item exists.intReturns the number of items contained in the receiver that are direct item children of the receiver.intReturns the height of the area which would be used to display one of the items in the tree.TreeItem[]getItems()Returns a (possibly empty) array of items contained in the receiver that are direct item children of the receiver.(package private) TreeItem[]getItems(long parent) booleanReturnstrueif the receiver's lines are visible, andfalseotherwise.Returns the receiver's parent item, which must be aTreeItemor null when the receiver is a root.(package private) longgetPixbufRenderer(long column) TreeItem[]Returns an array ofTreeItems that are currently selected in the receiver.intReturns the number of selected items contained in the receiver.Returns the column which shows the sort indicator for the receiver.intReturns the direction of the sort indicator for the receiver.(package private) longgetTextRenderer(long column) Returns the item which is currently at the top of the receiver.(package private) longgtk_button_press_event(long widget, long event) (package private) longgtk_button_release_event(long widget, long event) (package private) longgtk_changed(long widget) (package private) longgtk_draw(long widget, long cairo) (package private) longgtk_expand_collapse_cursor_row(long widget, long logical, long expand, long open_all) (package private) intgtk_gesture_press_event(long gesture, int n_press, double x, double y, long event) Handling multi-press event on GTK4(package private) longgtk_motion_notify_event(long widget, long event) (package private) longgtk_row_activated(long tree, long path, long column) (package private) longgtk_row_has_child_toggled(long model, long path, long iter) (package private) longgtk_scroll_event(long widget, long eventPtr) (package private) longgtk_start_interactive_search(long widget) (package private) longgtk_test_collapse_row(long tree, long iter, long path) (package private) longgtk_test_expand_row(long tree, long iter, long path) (package private) longgtk_toggled(long renderer, long pathStr) (package private) voidgtk_widget_get_preferred_size(long widget, GtkRequisition requisition) (package private) longgtk3_key_press_event(long widget, long event) (package private) void(package private) voidintindexOf(TreeColumn 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.intSearches 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) booleanmnemonicHit(char key) (package private) booleanmnemonicMatch(char key) (package private) long(package private) voidpropagateDraw(long container, long cairo) Propagates draw events from a parent container to its children using gtk_container_propagate_draw().(package private) voidreallocateIds(int newSize) (package private) void(package private) void(package private) voidregister()(package private) voidreleaseChildren(boolean destroy) (package private) voidreleaseItem(TreeItem item, boolean release) (package private) voidreleaseItems(long parentIter) (package private) void(package private) voidremove(long parentIter, int start, int end) voidRemoves all of the items from the receiver.voidremoveSelectionListener(SelectionListener listener) Removes the listener from the collection of listeners who will be notified when the user changes the receiver's selection.voidremoveTreeListener(TreeListener listener) Removes the listener from the collection of listeners who will be notified when items in the receiver are expanded or collapsed.(package private) longrendererGetPreferredWidthProc(long cell, long handle, long minimun_size, long natural_size) (package private) voidrendererRender(long cell, long cr, long snapshot, long widget, long background_area, long cell_area, long expose_area, long flags) (package private) longrendererRenderProc(long cell, long cr, long widget, long background_area, long cell_area, long flags) (package private) longrendererSnapshotProc(long cell, long snapshot, long widget, long background_area, long cell_area, long flags) (package private) void(package private) PointresizeCalculationsGTK3(long widget, int width, int height) (package private) voidreskinChildren(int flags) (package private) booleanvoidSelects an item in the receiver.voidSelects all of the items in the receiver.(package private) voidsendMeasureEvent(long cell, long width, long height) (package private) voidUsed to emulate DefaultSelection event.(package private) voidsetBackgroundGdkRGBA(long context, long handle, GdkRGBA rgba) (package private) voidsetBackgroundSurface(Image image) (package private) intsetBounds(int x, int y, int width, int height, boolean move, boolean resize) voidsetColumnOrder(int[] 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.(package private) voidsetFontDescription(long font) (package private) voidsetForegroundGdkRGBA(GdkRGBA rgba) voidsetHeaderBackground(Color color) Sets the header background color to the color specified by the argument, or to the default system color if the argument is null.voidsetHeaderForeground(Color color) Sets the header foreground color to the color specified by the argument, or to the default system color if the argument is null.voidsetHeaderVisible(boolean show) Marks the receiver's header as visible if the argument istrue, and marks it invisible otherwise.voidsetInsertMark(TreeItem item, boolean before) Display a mark indicating the point at which an item will be inserted.voidsetItemCount(int count) Sets the number of root-level items contained in the receiver.(package private) voidsetItemCount(long parentIter, int count) voidsetLinesVisible(boolean show) Marks the receiver's lines as visible if the argument istrue, and marks it invisible otherwise.(package private) voidsetModel(long newModel) (package private) voidsetOrientation(boolean create) (package private) void(package private) voidsetParentGdkResource(Control child) (package private) voidsetScrollWidth(long column, TreeItem item) voidsetSelection(TreeItem item) Sets the receiver's selection to the given item.voidsetSelection(TreeItem[] items) Sets the receiver's selection to be the given array of items.voidsetSortColumn(TreeColumn column) Sets the column used by the sort indicator for the receiver.voidsetSortDirection(int direction) Sets the direction of the sort indicator for the receiver.voidsetTopItem(TreeItem item) Sets the item which is currently at the top of the receiver.voidshowColumn(TreeColumn column) Shows the column.(package private) boolean(package private) voidshowItem(long path, boolean scroll) voidShows the item.voidShows the selection.private voidthrowCannotRemoveItem(int i) (package private) void(package private) void(package private) longwindowProc(long handle, long arg0, long user_data) Methods inherited from class Composite
_getChildren, _getTabList, adjustChildClipping, changed, checkBuffered, checkSubwindow, computeTabList, connectFixedHandleDraw, createHandle, drawBackground, enableWidget, findDeferredControl, findMenus, fixChildren, fixClippings, fixModal, fixParentGdkResource, fixStyle, fixTabList, fixZOrder, focusHandle, forceFocus, getBackgroundMode, getChildren, getChildrenCount, getLayout, getLayoutDeferred, getTabList, gtk_focus, gtk_focus_in_event, gtk_focus_out_event, gtk_map, gtk_realize, gtk_scroll_child, gtk_style_updated, gtk4_key_press_event, hasBorder, hooksKeys, imHandle, isLayoutDeferred, isTabGroup, layout, layout, layout, layout, layout, markLayout, minimumSize, moveAbove, moveBelow, moveChildren, mustBeVisibleOnInitBounds, parentingHandle, printWidget, redrawChildren, releaseHandle, removeControl, resizeHandle, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setScrollBarVisible, setTabGroupFocus, setTabItemFocus, setTabList, showWidget, toString, translateMnemonic, translateTraversal, traversalCode, updateBackgroundMode, updateLayoutMethods inherited from class Scrollable
clientHandle, computeTrim, computeTrimInPixels, createScrollBar, destroyScrollBar, getBorderWidthInPixels, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar, hScrollBarWidth, redrawWidget, sendLeaveNotify, setScrollbarsMode, topHandle, vScrollBarWidthMethods inherited from class Control
_getAccessible, _getShell, addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addRelation, addTouchListener, addTraverseListener, cairoClipRegion, cairoCopyRegion, cairoDisposeRegion, checkBackground, checkBorder, checkMirrored, cleanupEnableWindow, computeNativeSize, computeSize, computeSize, computeSizeInPixels, computeTabGroup, computeTabRoot, containedInRegion, defaultFont, destroyWidget, dragDetect, dragDetect, dragDetect, drawBackground, drawGripper, drawWidget, enterExitHandle, eventHandle, eventSurface, filterKey, findBackgroundControl, fixFocus, fixGdkEventTypeValues, fixStyle, flushQueueOnDnd, fontHandle, forceFocus, forceResize, gestureBeginProc, gestureEndProc, gestureHandle, getAccessible, getBackground, getBackgroundGdkRGBA, getBackgroundImage, getBaseGdkRGBA, getBgGdkRGBA, getBorderWidth, getBounds, getBoundsInPixels, getControl, getControlOrigin, getCursor, getDragDetect, getEnabled, getFont, getFontDescription, getForeground, getForegroundGdkRGBA, getIMCaretPos, getLayoutData, getLocation, getLocationInPixels, getMenu, getMonitor, getOrientation, getParent, getPath, getRegion, getShell, getSize, getSizeInPixels, getSurfaceOrigin, getTextDirection, getThickness, getToolTipText, getTouchEnabled, getVisible, getWindowOrigin, gtk_button_press_event, gtk_commit, gtk_css_provider_load_from_css, gtk_enter_notify_event, gtk_gesture_release_event, gtk_label_set_align, gtk_leave_notify_event, gtk_mnemonic_activate, gtk_preedit_changed, gtk_style_context_get_border, gtk_style_context_get_padding, gtk_unrealize, gtk_widget_reparent, gtk_widget_set_align, gtk3_event_after, gtk3_key_release_event, gtk3_popup_menu, gtk3_show_help, gtk4_draw, gtk4_enter_event, gtk4_focus_enter_event, gtk4_focus_leave_event, gtk4_focus_window_event, gtk4_key_release_event, gtk4_leave_event, gtk4_motion_event, gtk4_scroll_event, hasFocus, hooksPaint, hoverProc, internal_dispose_GC, internal_new_GC, isActive, isAutoScalable, isDescribedByLabel, isEnabled, isFocusAncestor, isFocusControl, isFocusHandle, isReparentable, isShowing, isTabItem, isVisible, magnifyProc, menuShell, moveAbove, moveBelow, moveHandle, pack, pack, paintHandle, paintSurface, print, printWindow, redraw, redraw, redraw, release, releaseParent, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeRelation, removeTouchListener, removeTraverseListener, requestLayout, restackWindow, rotateProc, sendDragEvent, sendFocusEvent, sendGestureEvent, sendGestureEvent, sendGestureEvent, sendHelpEvent, sendMouseEvent, sendMouseEvent, setBackground, setBackground, setBackgroundGdkRGBA, setBackgroundGdkRGBA, setBackgroundImage, setBounds, setBounds, setBoundsInPixels, setBoundsInPixels, setCapture, setCursor, setCursor, setDragDetect, setEnabled, setFont, setForeground, setForegroundGdkRGBA, setInitialBounds, setLayoutData, setLocation, setLocation, setLocationInPixels, setLocationInPixels, setMenu, setOrientation, setParent, setRadioSelection, setRedraw, setRegion, setRelations, setSize, setSize, setSizeInPixels, setSizeInPixels, setTextDirection, setToolTipText, setToolTipText, setTouchEnabled, setVisible, setWidgetBackground, setZOrder, setZOrder, showMenu, showMenu, sort, swipeProc, toControl, toControl, toDisplay, toDisplay, toDisplayInPixels, translateMnemonic, traverse, traverse, traverse, traverse, traverse, traverseEscape, traverseGroup, traverseItem, traverseMnemonic, traversePage, traverseReturn, update, update, wantDragDropDetectionMethods inherited from class Widget
addDisposeListener, addListener, addTypedListener, checkBits, checkOpen, checkOrientation, checkParent, checkWidget, convertPangoFontDescriptionToCss, cssHandle, dpiChanged, enterMotionProc, error, filterProc, filters, fixMnemonic, fixMnemonic, fixMnemonic, focusProc, fontHeight, gdk_event_free, gdk_event_get_state, gdk_event_get_surface_or_window, gdk_pointer_grab, gdk_pointer_ungrab, gdk_surface_get_size, gdk_window_get_size, GdkSeatGrabPrepareFunc, gesturePressReleaseProc, getData, getData, getDisplay, getListeners, getName, getNameText, getStyle, getTypedListeners, gtk_activate, gtk_adjustment_get, gtk_box_new, gtk_box_pack_end, gtk_box_set_child_packing, gtk_cell_renderer_get_preferred_size, gtk_change_value, gtk_clicked, gtk_close_request, gtk_configure_event, gtk_container_get_border_width_or_margin, gtk_container_set_border_width, gtk_create_menu_proxy, gtk_day_selected, gtk_day_selected_double_click, gtk_delete_event, gtk_delete_range, gtk_delete_text, gtk_grab_focus, gtk_hide, gtk_icon_release, gtk_input, gtk_insert_text, gtk_map_event, gtk_menu_popped_up, gtk_month_changed, gtk_move_focus, gtk_output, gtk_populate_popup, gtk_select, gtk_selection_done, gtk_show, gtk_size_allocate, gtk_status_icon_popup_menu, gtk_switch_page, gtk_text_buffer_insert_text, gtk_timer, gtk_tree_view_column_cell_get_position, gtk_unmap, gtk_unmap_event, gtk_value_changed, gtk_widget_get_surface, gtk_widget_get_window, gtk_widget_hide, gtk_widget_show, gtk_widget_size_allocate, gtk_window_state_event, hooks, isAutoDirection, isDisposed, isListening, isValidSubclass, isValidThread, keyPressReleaseProc, leaveProc, mnemonicHit, mnemonicMatch, notifyCreationTracker, notifyDisposalTracker, notifyListeners, notifyProc, notifyState, postEvent, postEvent, removeDisposeListener, removeListener, removeListener, removeListener, removeTypedListener, reskin, reskinWidget, scrollProc, sendEvent, sendEvent, sendEvent, sendEvent, sendIMKeyEvent, sendKeyEvent, sendSelectionEvent, sendSelectionEvent, setButtonState, setData, setData, setFontDescription, setInputState, setKeyState, setLocationState, setToolTipText, shellMapProc, sizeAllocateProc, sizeRequestProc, snapshotToDraw, timerProc, translateTraversal, windowActiveProc, windowProc, windowProc, windowProc, windowProc
-
Field Details
-
modelHandle
long modelHandle -
checkRenderer
long checkRenderer -
columnCount
int columnCount -
sortDirection
int sortDirection -
selectionCountOnPress
int selectionCountOnPress -
selectionCountOnRelease
int selectionCountOnRelease -
ignoreCell
long ignoreCell -
items
TreeItem[] items -
nextId
int nextId -
columns
TreeColumn[] columns -
sortColumn
TreeColumn sortColumn -
currentItem
TreeItem currentItem -
imageList
ImageList imageList -
headerImageList
ImageList headerImageList -
firstCustomDraw
boolean firstCustomDraw -
firstCompute
boolean firstComputeTrue iff computeSize has never been called on this Tree -
modelChanged
boolean modelChanged -
expandAll
boolean expandAll -
drawState
int drawState -
drawFlags
int drawFlags -
background
GdkRGBA background -
foreground
GdkRGBA foreground -
drawForegroundRGBA
GdkRGBA drawForegroundRGBA -
isOwnerDrawn
boolean isOwnerDrawnThe owner of the widget is responsible for drawing -
ignoreSize
boolean ignoreSize -
pixbufSizeSet
boolean pixbufSizeSet -
hasChildren
boolean hasChildren -
pixbufHeight
int pixbufHeight -
pixbufWidth
int pixbufWidth -
headerHeight
int headerHeight -
headerVisible
boolean headerVisible -
topItem
TreeItem topItem -
cachedAdjustment
double cachedAdjustment -
currentAdjustment
double currentAdjustment -
headerBackground
Color headerBackground -
headerForeground
Color headerForeground -
boundsChangedSinceLastDraw
boolean boundsChangedSinceLastDraw -
wasScrolled
boolean wasScrolled -
rowActivated
boolean rowActivated -
headerCSSProvider
private long headerCSSProvider -
ID_COLUMN
static final int ID_COLUMN- See Also:
-
CHECKED_COLUMN
static final int CHECKED_COLUMN- See Also:
-
GRAYED_COLUMN
static final int GRAYED_COLUMN- See Also:
-
FOREGROUND_COLUMN
static final int FOREGROUND_COLUMN- See Also:
-
BACKGROUND_COLUMN
static final int BACKGROUND_COLUMN- See Also:
-
FONT_COLUMN
static final int FONT_COLUMN- See Also:
-
FIRST_COLUMN
static final int FIRST_COLUMN- See Also:
-
CELL_PIXBUF
static final int CELL_PIXBUF- See Also:
-
CELL_TEXT
static final int CELL_TEXT- See Also:
-
CELL_FOREGROUND
static final int CELL_FOREGROUND- See Also:
-
CELL_BACKGROUND
static final int CELL_BACKGROUND- See Also:
-
CELL_FONT
static final int CELL_FONT- See Also:
-
CELL_SURFACE
static final int CELL_SURFACE- See Also:
-
CELL_TYPES
static final int CELL_TYPES- See Also:
-
-
Constructor Details
-
Tree
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.- Parameters:
parent- a composite control which will be the parent of the new instance (cannot be null)style- the style of control to construct- Throws:
IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the parent is null
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
- See Also:
-
-
Method Details
-
_addListener
- Overrides:
_addListenerin classWidget
-
_getItem
-
_getItem
-
reallocateIds
void reallocateIds(int newSize) -
findAvailableId
int findAvailableId() -
getId
int getId(long iter, boolean queryModel) -
checkStyle
static int checkStyle(int style) -
cellDataProc
long cellDataProc(long tree_column, long cell, long tree_model, long iter, long data) - Overrides:
cellDataProcin classWidget
-
checkData
-
checkSubclass
protected void checkSubclass()Description copied from class:WidgetChecks that this class can be subclassed.The SWT class library is intended to be subclassed only at specific, controlled points (most notably,
CompositeandCanvaswhen 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:
checkSubclassin classComposite
-
addSelectionListener
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 theSelectionListenerinterface.When
widgetSelectedis called, the item field of the event object is valid. If the receiver has theSWT.CHECKstyle 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.- Parameters:
listener- the listener which should be notified when the user changes the receiver's selection- Throws:
IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the listener is null
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- See Also:
-
addTreeListener
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 theTreeListenerinterface.- Parameters:
listener- the listener which should be notified- Throws:
IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the listener is null
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- See Also:
-
calculateWidth
int calculateWidth(long column, long iter, boolean recurse) -
clear
public void clear(int index, boolean all) Clears the item at the given zero-relative index in the receiver. The text, icon and other attributes of the item are set to the default value. If the tree was created with theSWT.VIRTUALstyle, these attributes are requested again as needed.- Parameters:
index- the index of the item to clearall-trueif all child items of the indexed item should be cleared recursively, andfalseotherwise- Throws:
IllegalArgumentException-- ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.2
- See Also:
-
clear
void clear(long parentIter, int index, boolean all) -
clearAll
public void clearAll(boolean all) Clears all the items in the receiver. The text, icon and other attributes of the items are set to their default values. If the tree was created with theSWT.VIRTUALstyle, these attributes are requested again as needed.- Parameters:
all-trueif all child items should be cleared recursively, andfalseotherwise- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.2
- See Also:
-
clearAll
void clearAll(boolean all, long parentIter) -
computeSizeInPixels
- Overrides:
computeSizeInPixelsin classComposite
-
copyModel
void copyModel(long oldModel, int oldStart, long newModel, int newStart, long oldParent, long newParent, int modelLength) -
createColumn
-
createHandle
void createHandle(int index) - Overrides:
createHandlein classComposite
-
bindArrowKeyBindings
void bindArrowKeyBindings()Binds the left and right arrow keys to allow for expanding and collapsing of the tree nodes. Note: This function is to only be called in GTK4. Binding of the arrow keys are also done in GTK3, however it is done through GtkBindingSets in CSS. See Device.init() for more information, specifically, swt_functional_gtk_3_20.css -
applyThemeBackground
int applyThemeBackground()- Overrides:
applyThemeBackgroundin classComposite- Returns:
- 0 to remove THEME_BACKGROUND
- 1 to apply THEME_BACKGROUND
- otherwise don't change THEME_BACKGROUND state
-
createItem
-
createItem
The fastest way to insert many items is documented inTreeItem(org.eclipse.swt.widgets.Tree,int,int)andTreeItem.setItemCount(int) -
createRenderers
void createRenderers(long columnHandle, int modelIndex, boolean check, int columnStyle) -
createWidget
void createWidget(int index) - Overrides:
createWidgetin classScrollable
-
defaultBackground
GdkRGBA defaultBackground()- Overrides:
defaultBackgroundin classControl
-
deregister
void deregister()- Overrides:
deregisterin classComposite
-
deselect
Deselects an item in the receiver. If the item was already deselected, it remains deselected.- Parameters:
item- the item to be deselected- Throws:
IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the item is null
- ERROR_INVALID_ARGUMENT - if the item has been disposed
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.4
-
deselectAll
public void deselectAll()Deselects all selected items in the receiver.- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
destroyItem
-
destroyItem
-
dragDetect
boolean dragDetect(int x, int y, boolean filter, boolean dragOnTimeout, boolean[] consume) - Overrides:
dragDetectin classControl
-
eventWindow
long eventWindow()- Overrides:
eventWindowin classControl
-
getClientAreaInPixels
Rectangle getClientAreaInPixels()- Overrides:
getClientAreaInPixelsin classComposite
-
getClientWidth
int getClientWidth()- Overrides:
getClientWidthin classControl
-
getColumn
Returns the column at the given, zero-relative index in the receiver. Throws an exception if the index is out of range. Columns are returned in the order that they were created. If noTreeColumns were created by the programmer, this method will throwERROR_INVALID_RANGEdespite the fact that a single column of data may be visible in the tree. This occurs when the programmer uses the tree like a list, adding items but never creating a column.- Parameters:
index- the index of the column to return- Returns:
- the column at the given index
- Throws:
IllegalArgumentException-- ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.1
- See Also:
-
getColumnCount
public int getColumnCount()Returns the number of columns contained in the receiver. If noTreeColumns were created by the programmer, this value is zero, despite the fact that visually, one column of items may be visible. This occurs when the programmer uses the tree like a list, adding items but never creating a column.- Returns:
- the number of columns
- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.1
-
getColumnOrder
public int[] getColumnOrder()Returns 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.Specifically, the indices of the returned array represent the current visual order of the items, and the contents of the array represent the creation order of the items.
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 current visual order of the receiver's items
- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.2
- See Also:
-
getColumnTypes
long[] getColumnTypes(int columnCount) -
getColumns
Returns an array ofTreeColumns which are the columns in the receiver. Columns are returned in the order that they were created. If noTreeColumns were created by the programmer, the array is empty, despite the fact that visually, one column of items may be visible. This occurs when the programmer uses the tree like a list, adding items but never creating a column.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 items in the receiver
- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.1
- See Also:
-
getContextBackgroundGdkRGBA
GdkRGBA getContextBackgroundGdkRGBA()- Overrides:
getContextBackgroundGdkRGBAin classControl
-
getContextColorGdkRGBA
GdkRGBA getContextColorGdkRGBA()- Overrides:
getContextColorGdkRGBAin classControl
-
getFocusItem
TreeItem getFocusItem() -
getGridLineWidth
public int getGridLineWidth()Returns the width in points of a grid line.- Returns:
- the width of a grid line in points
- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.1
-
getHeaderBackground
Returns the header background color.- Returns:
- the receiver's header background color.
- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.106
-
getHeaderForeground
Returns the header foreground color.- Returns:
- the receiver's header foreground color.
- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.106
-
getHeaderHeight
public int getHeaderHeight()Returns the height of the receiver's header- Returns:
- the height of the header or zero if the header is not visible
- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.1
-
getHeaderVisible
public boolean getHeaderVisible()Returnstrueif the receiver's header is visible, andfalseotherwise.If one of the receiver's ancestors is not visible or some other condition makes the receiver not visible, this method may still indicate that it is considered visible even though it may not actually be showing.
- Returns:
- the receiver's header's visibility state
- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.1
-
getItem
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:
IllegalArgumentException-- ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.1
-
getItem
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.The item that is returned represents an item that could be selected by the user. For example, if selection only occurs in items in the first column, then null is returned if the point is outside of the item. Note that the SWT.FULL_SELECTION style hint, which specifies the selection policy, determines the extent of the selection.
- Parameters:
point- the point used to locate the item- Returns:
- the item at the given point, or null if the point is not in a selectable item
- Throws:
IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the point is null
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. The number that is returned is the number of roots in the tree.- Returns:
- the number of items
- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getItemHeight
public int getItemHeight()Returns the height of the area which would be used to display one of the items in the tree.- Returns:
- the height of one item
- Throws:
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
Returns a (possibly empty) array of 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.
- Returns:
- the items
- Throws:
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
-
getLinesVisible
public boolean getLinesVisible()Returnstrueif the receiver's lines are visible, andfalseotherwise. Note that some platforms draw grid lines while others may draw alternating row colors.If one of the receiver's ancestors is not visible or some other condition makes the receiver not visible, this method may still indicate that it is considered visible even though it may not actually be showing.
- Returns:
- the visibility state of the lines
- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.1
-
getParentItem
Returns the receiver's parent item, which must be aTreeItemor null when the receiver is a root.- Returns:
- the receiver's parent item
- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getPixbufRenderer
long getPixbufRenderer(long column) -
getSelection
Returns an array ofTreeItems that are currently selected in the receiver. The order of the items is unspecified. 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.
- Returns:
- an array representing the selection
- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getSelectionCount
public int getSelectionCount()Returns the number of selected items contained in the receiver.- Returns:
- the number of selected items
- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
getSortColumn
Returns the column which shows the sort indicator for the receiver. The value may be null if no column shows the sort indicator.- Returns:
- the sort indicator
- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.2
- See Also:
-
getSortDirection
public int getSortDirection()Returns the direction of the sort indicator for the receiver. The value will be one ofUP,DOWNorNONE.- Returns:
- the sort direction
- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.2
- See Also:
-
getTextRenderer
long getTextRenderer(long column) -
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.- Returns:
- the item at the top of the receiver
- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 2.1
-
_getCachedTopItem
TreeItem _getCachedTopItem() -
gtk_button_press_event
long gtk_button_press_event(long widget, long event) - Overrides:
gtk_button_press_eventin classComposite
-
gtk_gesture_press_event
int gtk_gesture_press_event(long gesture, int n_press, double x, double y, long event) Description copied from class:ControlHandling multi-press event on GTK4- Overrides:
gtk_gesture_press_eventin classControl- Parameters:
gesture- the corresponding controller responsible for capturing the eventn_press- how many touch/button presses happened with this onex- the x coordinate, in widget allocation coordinatesy- the y coordinate, in widget allocation coordinatesevent- the GdkEvent captured
-
gtk_row_activated
long gtk_row_activated(long tree, long path, long column) - Overrides:
gtk_row_activatedin classWidget
-
gtk3_key_press_event
long gtk3_key_press_event(long widget, long event) - Overrides:
gtk3_key_press_eventin classComposite
-
sendTreeDefaultSelection
void sendTreeDefaultSelection()Used to emulate DefaultSelection event. See Bug 312568. Feature in GTK. 'row-activation' event comes before DoubleClick event. This is causing the editor not to get focus after double-click. The solution is to manually send the DefaultSelection event after a double-click, and to emulate it for Space/Return. -
gtk_button_release_event
long gtk_button_release_event(long widget, long event) - Overrides:
gtk_button_release_eventin classControl
-
gtk_changed
long gtk_changed(long widget) - Overrides:
gtk_changedin classWidget
-
gtk_expand_collapse_cursor_row
long gtk_expand_collapse_cursor_row(long widget, long logical, long expand, long open_all) - Overrides:
gtk_expand_collapse_cursor_rowin classWidget
-
drawInheritedBackground
void drawInheritedBackground(long cairo) -
gtk_draw
-
gtk_motion_notify_event
long gtk_motion_notify_event(long widget, long event) - Overrides:
gtk_motion_notify_eventin classControl
-
gtk_row_has_child_toggled
long gtk_row_has_child_toggled(long model, long path, long iter) - Overrides:
gtk_row_has_child_toggledin classWidget
-
gtk_scroll_event
long gtk_scroll_event(long widget, long eventPtr) - Overrides:
gtk_scroll_eventin classScrollable
-
gtk_start_interactive_search
long gtk_start_interactive_search(long widget) - Overrides:
gtk_start_interactive_searchin 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_widget_get_preferred_size
- Overrides:
gtk_widget_get_preferred_sizein classWidget
-
hideFirstColumn
void hideFirstColumn() -
hookEvents
void hookEvents()- Overrides:
hookEventsin classComposite
-
indexOf
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. If no column is found, returns -1.- Parameters:
column- the search column- Returns:
- the index of the column
- Throws:
IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the column is null
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.1
-
indexOf
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:
IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the item is null
- ERROR_INVALID_ARGUMENT - if the item has been disposed
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.1
-
mnemonicHit
boolean mnemonicHit(char key) - Overrides:
mnemonicHitin classControl
-
mnemonicMatch
boolean mnemonicMatch(char key) - Overrides:
mnemonicMatchin classControl
-
paintWindow
long paintWindow()- Overrides:
paintWindowin classControl
-
propagateDraw
void propagateDraw(long container, long cairo) Description copied from class:CompositePropagates draw events from a parent container to its children using gtk_container_propagate_draw(). This method only works if the fixedHandle has been connected to the "draw" signal, and only propagates draw events to other siblings of handle (i.e. other children of fixedHandle, but not handle itself).
It's useful to propagate draw events to other child widgets for things like Table/Tree editors, or other scenarios where a widget is a child of a non-standard container widget (i.e., not a direct child of a Composite).
- Overrides:
propagateDrawin classComposite- Parameters:
container- the parent container, i.e. fixedHandlecairo- the cairo context provided by GTK
-
recreateRenderers
void recreateRenderers() -
redrawBackgroundImage
void redrawBackgroundImage()- Overrides:
redrawBackgroundImagein classScrollable
-
register
-
releaseItem
-
releaseItems
void releaseItems(long parentIter) -
releaseChildren
void releaseChildren(boolean destroy) - Overrides:
releaseChildrenin classComposite
-
releaseWidget
void releaseWidget()- Overrides:
releaseWidgetin classComposite
-
remove
void remove(long parentIter, int start, int end) -
removeAll
public void removeAll()Removes all of the items from the receiver.- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
removeSelectionListener
Removes the listener from the collection of listeners who will be notified when the user changes the receiver's selection.- Parameters:
listener- the listener which should no longer be notified- Throws:
IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the listener is null
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- See Also:
-
removeTreeListener
Removes the listener from the collection of listeners who will be notified when items in the receiver are expanded or collapsed.- Parameters:
listener- the listener which should no longer be notified- Throws:
IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the listener is null
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- See Also:
-
sendMeasureEvent
void sendMeasureEvent(long cell, long width, long height) -
rendererGetPreferredWidthProc
long rendererGetPreferredWidthProc(long cell, long handle, long minimun_size, long natural_size) - Overrides:
rendererGetPreferredWidthProcin classWidget
-
rendererSnapshotProc
long rendererSnapshotProc(long cell, long snapshot, long widget, long background_area, long cell_area, long flags) - Overrides:
rendererSnapshotProcin classWidget
-
rendererRenderProc
long rendererRenderProc(long cell, long cr, long widget, long background_area, long cell_area, long flags) - Overrides:
rendererRenderProcin classWidget
-
rendererRender
void rendererRender(long cell, long cr, long snapshot, long widget, long background_area, long cell_area, long expose_area, long flags) -
getGC
-
resetCustomDraw
void resetCustomDraw() -
reskinChildren
void reskinChildren(int flags) - Overrides:
reskinChildrenin classComposite
-
searchEnabled
boolean searchEnabled() -
setInsertMark
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.- Parameters:
item- the insert item. Null will clear the insertion mark.before- true places the insert mark above 'item'. false places the insert mark below 'item'.- Throws:
IllegalArgumentException-- ERROR_INVALID_ARGUMENT - if the item has been disposed
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setItemCount
void setItemCount(long parentIter, int count) -
setItemCount
public void setItemCount(int count) Sets the number of root-level items contained in the receiver.The fastest way to insert many items is documented in
TreeItem(Tree,int,int)andTreeItem.setItemCount(int)- Parameters:
count- the number of items- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.2
-
select
Selects an item in the receiver. If the item was already selected, it remains selected.- Parameters:
item- the item to be selected- Throws:
IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the item is null
- ERROR_INVALID_ARGUMENT - if the item has been disposed
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.4
-
selectAll
public void selectAll()Selects all of the items in the receiver.If the receiver is single-select, do nothing.
- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
-
setBackgroundGdkRGBA
- Overrides:
setBackgroundGdkRGBAin classControl
-
setBackgroundSurface
- Overrides:
setBackgroundSurfacein classControl
-
setBounds
-
setColumnOrder
public void setColumnOrder(int[] 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.- Parameters:
order- the new order to display the items- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the item order is null
- ERROR_INVALID_ARGUMENT - if the item order is not the same length as the number of items
- Since:
- 3.2
- See Also:
-
setFontDescription
void setFontDescription(long font) - Overrides:
setFontDescriptionin classControl
-
setForegroundGdkRGBA
- Overrides:
setForegroundGdkRGBAin classControl
-
setHeaderBackground
Sets the header background color to the color specified by the argument, or to the default system color if the argument is null.Note: This operation is a HINT and is not supported on all platforms. If the native header has a 3D look and feel (e.g. Windows 7), this method will cause the header to look FLAT irrespective of the state of the tree style.
- Parameters:
color- the new color (or null)- Throws:
IllegalArgumentException-- ERROR_INVALID_ARGUMENT - if the argument has been disposed
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.106
-
updateHeaderCSS
void updateHeaderCSS() -
setHeaderForeground
Sets the header foreground color to the color specified by the argument, or to the default system color if the argument is null.Note: This operation is a HINT and is not supported on all platforms. If the native header has a 3D look and feel (e.g. Windows 7), this method will cause the header to look FLAT irrespective of the state of the tree style.
- Parameters:
color- the new color (or null)- Throws:
IllegalArgumentException-- ERROR_INVALID_ARGUMENT - if the argument has been disposed
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.106
-
setHeaderVisible
public void setHeaderVisible(boolean show) Marks the receiver's header as visible if the argument istrue, and marks it invisible otherwise.If one of the receiver's ancestors is not visible or some other condition makes the receiver not visible, marking it visible may not actually cause it to be displayed.
- Parameters:
show- the new visibility state- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.1
-
setLinesVisible
public void setLinesVisible(boolean show) Marks the receiver's lines as visible if the argument istrue, and marks it invisible otherwise. Note that some platforms draw grid lines while others may draw alternating row colors.If one of the receiver's ancestors is not visible or some other condition makes the receiver not visible, marking it visible may not actually cause it to be displayed.
- Parameters:
show- the new visibility state- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.1
-
setModel
void setModel(long newModel) -
setOrientation
void setOrientation(boolean create) - Overrides:
setOrientationin classComposite
-
setParentBackground
void setParentBackground()- Overrides:
setParentBackgroundin classControl
-
setParentGdkResource
- Overrides:
setParentGdkResourcein classControl
-
setScrollWidth
-
setSelection
Sets the receiver's selection to the given item. The current selection is cleared before the new item is selected, and if necessary the receiver is scrolled to make the new selection visible.If the item is not in the receiver, then it is ignored.
- Parameters:
item- the item to select- Throws:
IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the item is null
- ERROR_INVALID_ARGUMENT - if the item has been disposed
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.2
-
setSelection
Sets the receiver's selection to be the given array of items. The current selection is cleared before the new items are selected, and if necessary the receiver is scrolled to make the new selection visible.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.
- Parameters:
items- the array of items- Throws:
IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the array of items is null
- ERROR_INVALID_ARGUMENT - if one of the items has been disposed
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- See Also:
-
setSortColumn
Sets the column used by the sort indicator for the receiver. A null value will clear the sort indicator. The current sort column is cleared before the new column is set.- Parameters:
column- the column used by the sort indicator ornull- Throws:
IllegalArgumentException-- ERROR_INVALID_ARGUMENT - if the column is disposed
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.2
-
setSortDirection
public void setSortDirection(int direction) Sets the direction of the sort indicator for the receiver. The value can be one ofUP,DOWNorNONE.- Parameters:
direction- the direction of the sort indicator- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.2
-
setTopItem
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.- Parameters:
item- the item to be shown- Throws:
IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the item is null
- ERROR_INVALID_ARGUMENT - if the item has been disposed
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 2.1
- See Also:
-
showColumn
Shows the column. If the column is already showing in the receiver, this method simply returns. Otherwise, the columns are scrolled until the column is visible.- Parameters:
column- the column to be shown- Throws:
IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the item is null
- ERROR_INVALID_ARGUMENT - if the item has been disposed
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- Since:
- 3.1
-
showFirstColumn
boolean showFirstColumn() -
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.- Throws:
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- See Also:
-
showItem
void showItem(long path, boolean scroll) -
showItem
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.- Parameters:
item- the item to be shown- Throws:
IllegalArgumentException-- ERROR_NULL_ARGUMENT - if the item is null
- ERROR_INVALID_ARGUMENT - if the item has been disposed
SWTException-- ERROR_WIDGET_DISPOSED - if the receiver has been disposed
- ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
- See Also:
-
updateScrollBarValue
- Overrides:
updateScrollBarValuein classScrollable
-
windowProc
long windowProc(long handle, long arg0, long user_data) - Overrides:
windowProcin classControl
-
resizeCalculationsGTK3
- Overrides:
resizeCalculationsGTK3in classControl
-
checkSetDataInProcessBeforeRemoval
void checkSetDataInProcessBeforeRemoval()Check the tree for items that are in process of sendingSWT#SetDataevent. If such items exist, throw an exception. Does nothing if the given range contains no indices, or if we are below GTK 3.22.0 or are using GTK 4. -
throwCannotRemoveItem
private void throwCannotRemoveItem(int i) -
dispose
public void dispose()Description copied from class:WidgetDisposes of the operating system resources associated with the receiver and all its descendants. After this method has been invoked, the receiver and all descendants will answertruewhen sent the messageisDisposed(). Any internal connections between the widgets in the tree will have been removed to facilitate garbage collection. This method does nothing if the widget is already disposed.NOTE: This method is not called recursively on the descendants of the receiver. This means that, widget implementers can not detect when a widget is being disposed of by re-implementing this method, but should instead listen for the
Disposeevent.
-