public class Tree extends Composite
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
TreeItem
s 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: This class is not intended to be subclassed.
Modifier and Type | Field and Description |
---|---|
(package private) int |
columnCount |
(package private) TreeColumn[] |
columns |
(package private) boolean |
createdAsRTL |
(package private) TreeItem |
currentItem |
(package private) boolean |
customDraw |
(package private) static int |
DRAG_IMAGE_SIZE |
(package private) boolean |
dragStarted |
(package private) static boolean |
ENABLE_TVS_EX_FADEINOUTEXPANDOS |
(package private) static int |
EXPLORER_EXTRA |
(package private) static boolean |
EXPLORER_THEME |
(package private) boolean |
explorerTheme |
(package private) RECT |
focusRect |
(package private) boolean |
gestureCompleted |
(package private) static int |
GRID_WIDTH |
(package private) int |
hAnchor |
(package private) static int |
HEADER_EXTRA |
(package private) static int |
HEADER_MARGIN |
(package private) static TCHAR |
HeaderClass |
(package private) ImageList |
headerImageList |
(package private) static int |
HeaderProc |
(package private) int |
headerToolTipHandle |
(package private) int |
hFirstIndexOf |
(package private) int |
hInsert |
(package private) int |
hLastIndexOf |
(package private) int |
hSelect |
(package private) int |
hwndHeader |
(package private) int |
hwndParent |
(package private) boolean |
ignoreColumnMove |
(package private) boolean |
ignoreCustomDraw |
(package private) boolean |
ignoreDeselect |
(package private) boolean |
ignoreDrawBackground |
(package private) boolean |
ignoreDrawFocus |
(package private) boolean |
ignoreDrawForeground |
(package private) boolean |
ignoreDrawHot |
(package private) boolean |
ignoreDrawSelection |
(package private) boolean |
ignoreExpand |
(package private) boolean |
ignoreFullSelection |
(package private) boolean |
ignoreItemHeight |
(package private) boolean |
ignoreResize |
(package private) boolean |
ignoreSelect |
(package private) boolean |
ignoreShrink |
(package private) ImageList |
imageList |
(package private) static int |
INCREMENT |
(package private) boolean |
insertAfter |
(package private) static int |
INSET |
(package private) int |
itemCount |
(package private) TreeItem[] |
items |
(package private) int |
itemToolTipHandle |
(package private) int |
lastID |
(package private) int |
lastIndexOf |
(package private) int |
lastTimerCount |
(package private) int |
lastTimerID |
(package private) boolean |
linesVisible |
(package private) boolean |
lockSelection |
(package private) boolean |
newSelected |
(package private) boolean |
oldSelected |
(package private) boolean |
painted |
(package private) boolean |
printClient |
(package private) int |
scrollWidth |
(package private) int |
selectionForeground |
(package private) boolean |
shrink |
(package private) static int |
SORT_WIDTH |
(package private) TreeColumn |
sortColumn |
(package private) int |
sortDirection |
(package private) static int |
TIMER_MAX_COUNT |
(package private) static TCHAR |
TreeClass |
(package private) static int |
TreeProc |
backgroundMode, layout, layoutCount, lpwp, tabList
horizontalBar, verticalBar
accessible, background, backgroundImage, cursor, drawCount, font, foreground, handle, layoutData, menu, parent, region, toolTipText
CANVAS, data, DEFAULT_HEIGHT, DEFAULT_WIDTH, DISABLED, display, DISPOSE_SENT, DISPOSED, DRAG_DETECT, DRAW_BACKGROUND, eventTable, FOREIGN_HANDLE, HIDDEN, IGNORE_WM_CHANGEUISTATE, KEYED_DATA, LAYOUT_CHANGED, LAYOUT_CHILD, LAYOUT_NEEDED, MAJOR, MINOR, MOVE_DEFERRED, MOVE_OCCURRED, PARENT_BACKGROUND, RELEASED, RESIZE_DEFERRED, RESIZE_OCCURRED, SKIN_NEEDED, state, style, THEME_BACKGROUND, TRACK_MOUSE
Constructor and Description |
---|
Tree(Composite parent,
int style)
Constructs a new instance of this class given its parent
and a style value describing its behavior and appearance.
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
_addListener(int eventType,
Listener listener) |
(package private) TreeItem |
_getItem(int hItem) |
(package private) TreeItem |
_getItem(int hItem,
int id) |
(package private) void |
_setBackgroundPixel(int newPixel) |
void |
addSelectionListener(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 the
SelectionListener
interface. |
void |
addTreeListener(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) int |
borderHandle() |
(package private) int |
callWindowProc(int hwnd,
int msg,
int wParam,
int lParam) |
(package private) LRESULT |
CDDS_ITEMPOSTPAINT(NMTVCUSTOMDRAW nmcd,
int wParam,
int lParam) |
(package private) LRESULT |
CDDS_ITEMPREPAINT(NMTVCUSTOMDRAW nmcd,
int wParam,
int lParam) |
(package private) LRESULT |
CDDS_POSTPAINT(NMTVCUSTOMDRAW nmcd,
int wParam,
int lParam) |
(package private) LRESULT |
CDDS_PREPAINT(NMTVCUSTOMDRAW nmcd,
int wParam,
int lParam) |
(package private) void |
checkBuffered() |
(package private) boolean |
checkData(TreeItem item,
boolean redraw) |
(package private) boolean |
checkData(TreeItem item,
int index,
boolean redraw) |
(package private) boolean |
checkHandle(int hwnd) |
(package private) boolean |
checkScroll(int hItem) |
(package private) static int |
checkStyle(int style) |
protected void |
checkSubclass()
Checks that this class can be subclassed.
|
void |
clear(int index,
boolean all)
Clears the item at the given zero-relative index in the receiver.
|
(package private) void |
clear(int hItem,
TVITEM tvItem) |
void |
clearAll(boolean all)
Clears all the items in the receiver.
|
(package private) void |
clearAll(int hItem,
TVITEM tvItem,
boolean all) |
(package private) int |
CompareFunc(int lParam1,
int lParam2,
int lParamSort) |
Point |
computeSize(int wHint,
int hHint,
boolean changed)
Returns the preferred size of the receiver.
|
(package private) void |
createHandle() |
(package private) void |
createHeaderToolTips() |
(package private) void |
createItem(TreeColumn column,
int index) |
(package private) void |
createItem(TreeItem item,
int hParent,
int hInsertAfter,
int hItem) |
(package private) void |
createItemToolTips() |
(package private) void |
createParent() |
(package private) void |
createWidget() |
(package private) int |
defaultBackground() |
(package private) void |
deregister() |
(package private) void |
deselect(int hItem,
TVITEM tvItem,
int hIgnoreItem) |
void |
deselect(TreeItem item)
Deselects an item in the receiver.
|
void |
deselectAll()
Deselects all selected items in the receiver.
|
(package private) void |
destroyItem(TreeColumn column) |
(package private) void |
destroyItem(TreeItem item,
int hItem) |
(package private) void |
destroyScrollBar(int type) |
(package private) void |
enableDrag(boolean enabled) |
(package private) void |
enableWidget(boolean enabled) |
(package private) boolean |
findCell(int x,
int y,
TreeItem[] item,
int[] index,
RECT[] cellRect,
RECT[] itemRect) |
(package private) int |
findIndex(int hFirstItem,
int hItem) |
(package private) Widget |
findItem(int hItem) |
(package private) int |
findItem(int hFirstItem,
int index) |
(package private) int |
getBottomItem() |
TreeColumn |
getColumn(int index)
Returns the column at the given, zero-relative index in the
receiver.
|
int |
getColumnCount()
Returns the number of columns contained in the receiver.
|
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.
|
TreeColumn[] |
getColumns()
Returns an array of
TreeColumn s which are the
columns in the receiver. |
(package private) TreeItem |
getFocusItem() |
int |
getGridLineWidth()
Returns the width in pixels of a grid line.
|
int |
getHeaderHeight()
Returns the height of the receiver's header
|
boolean |
getHeaderVisible()
Returns
true if the receiver's header is visible,
and false otherwise. |
(package private) Point |
getImageSize() |
TreeItem |
getItem(int index)
Returns the item at the given, zero-relative index in the
receiver.
|
(package private) TreeItem |
getItem(NMTVCUSTOMDRAW nmcd) |
TreeItem |
getItem(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.
|
(package private) int |
getItemCount(int hItem) |
int |
getItemHeight()
Returns 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(int hTreeItem) |
boolean |
getLinesVisible()
Returns
true if the receiver's lines are visible,
and false otherwise. |
(package private) int |
getNextSelection(int hItem,
TVITEM tvItem) |
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
TreeItem s that are currently
selected in the receiver. |
(package private) int |
getSelection(int hItem,
TVITEM tvItem,
TreeItem[] selection,
int index,
int count,
boolean bigSelection,
boolean all) |
int |
getSelectionCount()
Returns the number of selected items contained in the receiver.
|
TreeColumn |
getSortColumn()
Returns the column which shows the sort indicator for
the receiver.
|
(package private) int |
getSortColumnPixel() |
int |
getSortDirection()
Returns the direction of the sort indicator for the receiver.
|
TreeItem |
getTopItem()
Returns the item which is currently at the top of the receiver.
|
(package private) boolean |
hitTestSelection(int hItem,
int x,
int y) |
(package private) int |
imageIndex(Image image,
int index) |
(package private) int |
imageIndexHeader(Image image) |
int |
indexOf(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.
|
int |
indexOf(TreeItem item)
Searches the receiver's list starting at the first item
(index 0) until an item is found that is equal to the
argument, and returns the index of that item.
|
(package private) boolean |
isCustomToolTip() |
(package private) boolean |
isItemSelected(NMTVCUSTOMDRAW nmcd) |
(package private) void |
redrawSelection() |
(package private) void |
register() |
(package private) void |
releaseChildren(boolean destroy) |
(package private) void |
releaseHandle() |
(package private) void |
releaseItem(int hItem,
TVITEM tvItem,
boolean release) |
(package private) void |
releaseItems(int hItem,
TVITEM tvItem) |
(package private) void |
releaseWidget() |
void |
removeAll()
Removes all of the items from the receiver.
|
void |
removeSelectionListener(SelectionListener listener)
Removes the listener from the collection of listeners who will
be notified when the user changes the receiver's selection.
|
void |
removeTreeListener(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) void |
reskinChildren(int flags) |
(package private) int |
scrolledHandle() |
(package private) void |
select(int hItem,
TVITEM tvItem) |
void |
select(TreeItem item)
Selects an item in the receiver.
|
void |
selectAll()
Selects all of the items in the receiver.
|
(package private) Event |
sendEraseItemEvent(TreeItem item,
NMTTCUSTOMDRAW nmcd,
int column,
RECT cellRect) |
(package private) Event |
sendMeasureItemEvent(TreeItem item,
int index,
int hDC,
int detail) |
(package private) Event |
sendPaintItemEvent(TreeItem item,
NMTTCUSTOMDRAW nmcd,
int column,
RECT itemRect) |
(package private) void |
setBackgroundImage(int hBitmap) |
(package private) void |
setBackgroundPixel(int pixel) |
(package private) void |
setCheckboxImageList() |
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.
|
(package private) void |
setCursor() |
void |
setFont(Font font)
Sets the font that the receiver will use to paint textual information
to the font specified by the argument, or to the default font for that
kind of control if the argument is null.
|
(package private) void |
setForegroundPixel(int pixel) |
void |
setHeaderVisible(boolean show)
Marks the receiver's header as visible if the argument is
true ,
and marks it invisible otherwise. |
void |
setInsertMark(TreeItem item,
boolean before)
Display a mark indicating the point at which an item will be inserted.
|
void |
setItemCount(int count)
Sets the number of root-level items contained in the receiver.
|
(package private) void |
setItemCount(int count,
int hParent,
int hItem) |
(package private) void |
setItemHeight(int itemHeight)
Sets the height of the area which would be used to
display one of the items in the tree.
|
void |
setLinesVisible(boolean show)
Marks the receiver's lines as visible if the argument is
true ,
and marks it invisible otherwise. |
void |
setRedraw(boolean redraw)
If the argument is
false , causes subsequent drawing
operations in the receiver to be ignored. |
(package private) void |
setScrollWidth() |
(package private) void |
setScrollWidth(int width) |
(package private) void |
setSelection(int hItem,
TVITEM tvItem,
TreeItem[] selection) |
void |
setSelection(TreeItem item)
Sets the receiver's selection to the given item.
|
void |
setSelection(TreeItem[] items)
Sets the receiver's selection to be the given array of items.
|
void |
setSortColumn(TreeColumn column)
Sets the column used by the sort indicator for the receiver.
|
void |
setSortDirection(int direction)
Sets the direction of the sort indicator for the receiver.
|
void |
setTopItem(TreeItem item)
Sets the item which is currently at the top of the receiver.
|
void |
showColumn(TreeColumn column)
Shows the column.
|
(package private) void |
showItem(int hItem) |
void |
showItem(TreeItem item)
Shows the item.
|
void |
showSelection()
Shows the selection.
|
(package private) void |
sort() |
(package private) void |
sort(int hParent,
boolean all) |
(package private) void |
subclass() |
(package private) RECT |
toolTipInset(RECT rect) |
(package private) RECT |
toolTipRect(RECT rect) |
(package private) java.lang.String |
toolTipText(NMTTDISPINFO hdr) |
(package private) int |
topHandle() |
(package private) void |
unsubclass() |
(package private) void |
updateFullSelection() |
(package private) void |
updateHeaderToolTips() |
(package private) void |
updateImageList() |
(package private) void |
updateImages() |
(package private) void |
updateMenuLocation(Event event) |
(package private) void |
updateOrientation() |
(package private) void |
updateScrollBar() |
(package private) int |
widgetStyle() |
(package private) TCHAR |
windowClass() |
(package private) int |
windowProc() |
(package private) int |
windowProc(int hwnd,
int msg,
int wParam,
int lParam) |
(package private) LRESULT |
WM_CHAR(int wParam,
int lParam) |
(package private) LRESULT |
WM_ERASEBKGND(int wParam,
int lParam) |
(package private) LRESULT |
WM_GETOBJECT(int wParam,
int lParam) |
(package private) LRESULT |
WM_HSCROLL(int wParam,
int lParam) |
(package private) LRESULT |
WM_KEYDOWN(int wParam,
int lParam) |
(package private) LRESULT |
WM_KILLFOCUS(int wParam,
int lParam) |
(package private) LRESULT |
WM_LBUTTONDBLCLK(int wParam,
int lParam) |
(package private) LRESULT |
WM_LBUTTONDOWN(int wParam,
int lParam) |
(package private) LRESULT |
WM_MOUSEMOVE(int wParam,
int lParam) |
(package private) LRESULT |
WM_MOUSEWHEEL(int wParam,
int lParam) |
(package private) LRESULT |
WM_MOVE(int wParam,
int lParam) |
(package private) LRESULT |
WM_PAINT(int wParam,
int lParam) |
(package private) LRESULT |
WM_PRINTCLIENT(int wParam,
int lParam) |
(package private) LRESULT |
WM_RBUTTONDOWN(int wParam,
int lParam) |
(package private) LRESULT |
WM_SETCURSOR(int wParam,
int lParam) |
(package private) LRESULT |
WM_SETFOCUS(int wParam,
int lParam) |
(package private) LRESULT |
WM_SETFONT(int wParam,
int lParam) |
(package private) LRESULT |
WM_SETREDRAW(int wParam,
int lParam) |
(package private) LRESULT |
WM_SIZE(int wParam,
int lParam) |
(package private) LRESULT |
WM_SYSCOLORCHANGE(int wParam,
int lParam) |
(package private) LRESULT |
WM_TIMER(int wParam,
int lParam) |
(package private) LRESULT |
WM_VSCROLL(int wParam,
int lParam) |
(package private) LRESULT |
wmColorChild(int wParam,
int lParam) |
(package private) LRESULT |
wmNotify(NMHDR hdr,
int wParam,
int lParam) |
(package private) LRESULT |
wmNotifyChild(NMHDR hdr,
int wParam,
int lParam) |
(package private) LRESULT |
wmNotifyHeader(NMHDR hdr,
int wParam,
int lParam) |
(package private) LRESULT |
wmNotifyToolTip(NMHDR hdr,
int wParam,
int lParam) |
(package private) LRESULT |
wmNotifyToolTip(NMTTCUSTOMDRAW nmcd,
int lParam) |
_getChildren, _getTabList, changed, checkComposited, computeTabList, copyArea, drawBackground, findDeferredControl, findMenus, fixChildren, fixTabList, getBackgroundMode, getChildren, getChildrenCount, getLayout, getLayoutDeferred, getTabList, hooksKeys, isLayoutDeferred, layout, layout, layout, layout, layout, markLayout, minimumSize, redrawChildren, releaseParent, removeControl, resizeChildren, resizeChildren, resizeEmbeddedHandle, sendResize, setBackgroundMode, setBounds, setFocus, setLayout, setLayoutDeferred, setResizeChildren, setTabGroupFocus, setTabList, translateMnemonic, translateTraversal, updateBackgroundColor, updateBackgroundImage, updateBackgroundMode, updateFont, updateLayout, updateLayout, updateUIState, WM_GETDLGCODE, WM_GETFONT, WM_NCHITTEST, WM_PARENTNOTIFY, WM_SYSCOMMAND, WM_UPDATEUISTATE, wmNCPaint
computeTrim, createScrollBar, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar, widgetExtStyle, wmScroll, wmScrollWheel
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, binarySearch, checkBackground, checkBorder, checkGesture, checkMirrored, computeSize, computeTabGroup, computeTabRoot, defaultFont, defaultForeground, destroyWidget, dragDetect, dragDetect, dragDetect, drawBackground, drawBackground, drawBackground, drawImageBackground, drawThemeBackground, fillBackground, fillImageBackground, fillThemeBackground, findBackgroundControl, findBrush, findCursor, findImageControl, findMnemonic, findThemeControl, fixFocus, forceFocus, forceResize, getAccessible, getBackground, getBackgroundImage, getBackgroundPixel, getBorderWidth, getBounds, getClipboardText, getCodePage, getCursor, getDragDetect, getDrawing, getEnabled, getFont, getForeground, getForegroundPixel, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getPath, getRegion, getShell, getSize, getToolTipText, getTouchEnabled, getVisible, hasCursor, hasFocus, internal_dispose_GC, internal_new_GC, isActive, isEnabled, isFocusAncestor, isFocusControl, isReparentable, isShowing, isTabGroup, isTabItem, isVisible, mapEvent, menuShell, mnemonicHit, mnemonicMatch, moveAbove, moveBelow, new_Accessible, new_GC, pack, pack, print, printWidget, redraw, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, sendFocusEvent, sendGestureEvent, sendMove, sendTouchEvent, setBackground, setBackground, setBackgroundImage, setBounds, setBounds, setBounds, setCapture, setCursor, setDefaultFont, setDragDetect, setEnabled, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRadioFocus, setRadioSelection, setRegion, setSavedFocus, setSize, setSize, setTabItemFocus, setToolTipText, setToolTipText, setTouchEnabled, setVisible, showWidget, sort, toControl, toControl, toDisplay, toDisplay, translateAccelerator, translateMnemonic, traverse, traverse, traverse, traverse, traverse, traverseEscape, traverseGroup, traverseItem, traverseMnemonic, traversePage, traverseReturn, update, update, widgetCreateStruct, widgetParent, WM_ACTIVATE, WM_CAPTURECHANGED, WM_CHANGEUISTATE, WM_CLEAR, WM_CLOSE, WM_COMMAND, WM_CONTEXTMENU, WM_CTLCOLOR, WM_CUT, WM_DESTROY, WM_DRAWITEM, WM_ENDSESSION, WM_ENTERIDLE, WM_GESTURE, WM_GETMINMAXINFO, WM_HELP, WM_HOTKEY, WM_IME_CHAR, WM_IME_COMPOSITION_START, WM_IME_COMPOSITION, WM_IME_ENDCOMPOSITION, WM_INITMENUPOPUP, WM_INPUTLANGCHANGE, WM_KEYUP, WM_LBUTTONUP, WM_MBUTTONDBLCLK, WM_MBUTTONDOWN, WM_MBUTTONUP, WM_MEASUREITEM, WM_MENUCHAR, WM_MENUSELECT, WM_MOUSEACTIVATE, WM_MOUSEHOVER, WM_MOUSEHWHEEL, WM_MOUSELEAVE, WM_NCACTIVATE, WM_NCCALCSIZE, WM_NCLBUTTONDOWN, WM_NCPAINT, WM_NOTIFY, WM_PALETTECHANGED, WM_PASTE, WM_PRINT, WM_QUERYENDSESSION, WM_QUERYNEWPALETTE, WM_QUERYOPEN, WM_RBUTTONDBLCLK, WM_RBUTTONUP, WM_SETTINGCHANGE, WM_SHOWWINDOW, WM_SYSCHAR, WM_SYSKEYDOWN, WM_SYSKEYUP, WM_TABLET_FLICK, WM_TOUCH, WM_UNDO, WM_UNINITMENUPOPUP, WM_WINDOWPOSCHANGED, WM_WINDOWPOSCHANGING, WM_XBUTTONDBLCLK, WM_XBUTTONDOWN, WM_XBUTTONUP, wmCommandChild, wmDrawChild, wmMeasureChild, wmScrollChild
addDisposeListener, addListener, checkBits, checkOpened, checkOrientation, checkParent, checkWidget, DeferWindowPos, dispose, dragDetect, error, filters, fixMnemonic, fixMnemonic, getData, getData, getDisplay, getListeners, getName, getNameText, getStyle, hooks, isDisposed, isListening, isValidSubclass, isValidThread, notifyListeners, postEvent, postEvent, release, removeDisposeListener, removeListener, removeListener, reskin, reskinWidget, sendDragEvent, sendDragEvent, sendEvent, sendEvent, sendEvent, sendEvent, sendKeyEvent, sendKeyEvent, sendMouseEvent, sendMouseEvent, sendMouseWheelEvent, sendSelectionEvent, sendSelectionEvent, setData, setData, setInputState, setKeyState, setLocationMask, SetWindowPos, showMenu, showMenu, toString, wmCaptureChanged, wmChar, wmContextMenu, wmIMEChar, wmKeyDown, wmKeyUp, wmKillFocus, wmLButtonDblClk, wmLButtonDown, wmLButtonUp, wmMButtonDblClk, wmMButtonDown, wmMButtonUp, wmMouseHover, wmMouseHWheel, wmMouseLeave, wmMouseMove, wmMouseWheel, wmPaint, wmPrint, wmRButtonDblClk, wmRButtonDown, wmRButtonUp, wmSetFocus, wmSysChar, wmSysKeyDown, wmSysKeyUp, wmXButtonDblClk, wmXButtonDown, wmXButtonUp
TreeItem[] items
TreeColumn[] columns
int columnCount
ImageList imageList
ImageList headerImageList
TreeItem currentItem
TreeColumn sortColumn
RECT focusRect
int hwndParent
int hwndHeader
int hAnchor
int hInsert
int hSelect
int lastID
int hFirstIndexOf
int hLastIndexOf
int lastIndexOf
int itemCount
int sortDirection
boolean dragStarted
boolean gestureCompleted
boolean insertAfter
boolean shrink
boolean ignoreShrink
boolean ignoreSelect
boolean ignoreExpand
boolean ignoreDeselect
boolean ignoreResize
boolean lockSelection
boolean oldSelected
boolean newSelected
boolean ignoreColumnMove
boolean linesVisible
boolean customDraw
boolean printClient
boolean painted
boolean ignoreItemHeight
boolean ignoreCustomDraw
boolean ignoreDrawForeground
boolean ignoreDrawBackground
boolean ignoreDrawFocus
boolean ignoreDrawSelection
boolean ignoreDrawHot
boolean ignoreFullSelection
boolean explorerTheme
boolean createdAsRTL
int scrollWidth
int selectionForeground
int headerToolTipHandle
int itemToolTipHandle
int lastTimerID
int lastTimerCount
static final boolean ENABLE_TVS_EX_FADEINOUTEXPANDOS
static final int TIMER_MAX_COUNT
static final int INSET
static final int GRID_WIDTH
static final int SORT_WIDTH
static final int HEADER_MARGIN
static final int HEADER_EXTRA
static final int INCREMENT
static final int EXPLORER_EXTRA
static final int DRAG_IMAGE_SIZE
static final boolean EXPLORER_THEME
static final int TreeProc
static final TCHAR TreeClass
static final int HeaderProc
static final TCHAR HeaderClass
public Tree(Composite parent, int style)
The style value is either one of the style constants defined in
class SWT
which is applicable to instances of this
class, or must be built by bitwise OR'ing together
(that is, using the int
"|" operator) two or more
of those SWT
style constants. The class description
lists the style constants that are applicable to the class.
Style bits are also inherited from superclasses.
parent
- a composite control which will be the parent of the new instance (cannot be null)style
- the style of control to constructjava.lang.IllegalArgumentException
- SWTException
- SWT.SINGLE
,
SWT.MULTI
,
SWT.CHECK
,
SWT.FULL_SELECTION
,
SWT.VIRTUAL
,
SWT.NO_SCROLL
,
Widget.checkSubclass()
,
Widget.getStyle()
static int checkStyle(int style)
void _addListener(int eventType, Listener listener)
_addListener
in class Widget
TreeItem _getItem(int hItem)
TreeItem _getItem(int hItem, int id)
void _setBackgroundPixel(int newPixel)
public void addSelectionListener(SelectionListener listener)
SelectionListener
interface.
When widgetSelected
is called, the item field of the event object is valid.
If the receiver has the SWT.CHECK
style and the check selection changes,
the event object detail field contains the value SWT.CHECK
.
widgetDefaultSelected
is 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.
listener
- the listener which should be notified when the user changes the receiver's selectionjava.lang.IllegalArgumentException
- SWTException
- SelectionListener
,
removeSelectionListener(org.eclipse.swt.events.SelectionListener)
,
SelectionEvent
public void addTreeListener(TreeListener listener)
TreeListener
interface.listener
- the listener which should be notifiedjava.lang.IllegalArgumentException
- SWTException
- TreeListener
,
removeTreeListener(org.eclipse.swt.events.TreeListener)
int borderHandle()
borderHandle
in class Control
LRESULT CDDS_ITEMPOSTPAINT(NMTVCUSTOMDRAW nmcd, int wParam, int lParam)
LRESULT CDDS_ITEMPREPAINT(NMTVCUSTOMDRAW nmcd, int wParam, int lParam)
LRESULT CDDS_POSTPAINT(NMTVCUSTOMDRAW nmcd, int wParam, int lParam)
LRESULT CDDS_PREPAINT(NMTVCUSTOMDRAW nmcd, int wParam, int lParam)
int callWindowProc(int hwnd, int msg, int wParam, int lParam)
callWindowProc
in class Scrollable
void checkBuffered()
checkBuffered
in class Composite
boolean checkData(TreeItem item, boolean redraw)
boolean checkData(TreeItem item, int index, boolean redraw)
boolean checkHandle(int hwnd)
checkHandle
in class Control
boolean checkScroll(int hItem)
protected void checkSubclass()
Widget
The SWT class library is intended to be subclassed
only at specific, controlled points (most notably,
Composite
and Canvas
when
implementing new widgets). This method enforces this
rule unless it is overridden.
IMPORTANT: By providing an implementation of this method that allows a subclass of a class which does not normally allow subclassing to be created, the implementer agrees to be fully responsible for the fact that any such subclass will likely fail between SWT releases and will be strongly platform specific. No support is provided for user-written classes which are implemented in this fashion.
The ability to subclass outside of the allowed SWT classes is intended purely to enable those not on the SWT development team to implement patches in order to get around specific limitations in advance of when those limitations can be addressed by the team. Subclassing should not be attempted without an intimate and detailed understanding of the hierarchy.
checkSubclass
in class Composite
public void clear(int index, boolean all)
SWT.VIRTUAL
style,
these attributes are requested again as needed.index
- the index of the item to clearall
- true
if all child items of the indexed item should be
cleared recursively, and false
otherwisejava.lang.IllegalArgumentException
- SWTException
- SWT.VIRTUAL
,
SWT.SetData
void clear(int hItem, TVITEM tvItem)
public void clearAll(boolean all)
SWT.VIRTUAL
style, these
attributes are requested again as needed.all
- true
if all child items should be cleared
recursively, and false
otherwiseSWTException
- SWT.VIRTUAL
,
SWT.SetData
void clearAll(int hItem, TVITEM tvItem, boolean all)
int CompareFunc(int lParam1, int lParam2, int lParamSort)
public Point computeSize(int wHint, int hHint, boolean changed)
Control
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.DEFAULT
is 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 be false
, so layout
manager caches can be retained.
computeSize
in class Composite
wHint
- the width hint (can be SWT.DEFAULT
)hHint
- the height hint (can be SWT.DEFAULT
)changed
- true
if the control's contents have changed, and false
otherwiseLayout
,
Control.getBorderWidth()
,
Control.getBounds()
,
Control.getSize()
,
Control.pack(boolean)
,
"computeTrim, getClientArea for controls that implement them"void createHandle()
createHandle
in class Composite
void createHeaderToolTips()
void createItem(TreeColumn column, int index)
void createItem(TreeItem item, int hParent, int hInsertAfter, int hItem)
void createItemToolTips()
void createParent()
void createWidget()
createWidget
in class Scrollable
int defaultBackground()
defaultBackground
in class Control
void deregister()
deregister
in class Control
void deselect(int hItem, TVITEM tvItem, int hIgnoreItem)
public void deselect(TreeItem item)
item
- the item to be deselectedjava.lang.IllegalArgumentException
- SWTException
- public void deselectAll()
SWTException
- void destroyItem(TreeColumn column)
void destroyItem(TreeItem item, int hItem)
void destroyScrollBar(int type)
destroyScrollBar
in class Scrollable
void enableDrag(boolean enabled)
enableDrag
in class Control
void enableWidget(boolean enabled)
enableWidget
in class Control
boolean findCell(int x, int y, TreeItem[] item, int[] index, RECT[] cellRect, RECT[] itemRect)
int findIndex(int hFirstItem, int hItem)
int findItem(int hFirstItem, int index)
TreeItem getFocusItem()
public int getGridLineWidth()
SWTException
- public int getHeaderHeight()
SWTException
- public boolean getHeaderVisible()
true
if the receiver's header is visible,
and false
otherwise.
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.
SWTException
- Point getImageSize()
int getBottomItem()
public TreeColumn getColumn(int index)
TreeColumn
s were created by the programmer,
this method will throw ERROR_INVALID_RANGE
despite
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.index
- the index of the column to returnjava.lang.IllegalArgumentException
- SWTException
- getColumnOrder()
,
setColumnOrder(int[])
,
TreeColumn.getMoveable()
,
TreeColumn.setMoveable(boolean)
,
SWT.Move
public int getColumnCount()
TreeColumn
s 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.SWTException
- public int[] getColumnOrder()
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.
SWTException
- setColumnOrder(int[])
,
TreeColumn.getMoveable()
,
TreeColumn.setMoveable(boolean)
,
SWT.Move
public TreeColumn[] getColumns()
TreeColumn
s which are the
columns in the receiver. Columns are returned in the order
that they were created. If no TreeColumn
s 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.
SWTException
- getColumnOrder()
,
setColumnOrder(int[])
,
TreeColumn.getMoveable()
,
TreeColumn.setMoveable(boolean)
,
SWT.Move
public TreeItem getItem(int index)
index
- the index of the item to returnjava.lang.IllegalArgumentException
- SWTException
- TreeItem getItem(NMTVCUSTOMDRAW nmcd)
public TreeItem getItem(Point point)
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.
point
- the point used to locate the itemjava.lang.IllegalArgumentException
- SWTException
- public int getItemCount()
SWTException
- int getItemCount(int hItem)
public int getItemHeight()
SWTException
- public TreeItem[] getItems()
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.
SWTException
- TreeItem[] getItems(int hTreeItem)
public boolean getLinesVisible()
true
if the receiver's lines are visible,
and false
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, this method may still indicate that it is considered visible even though it may not actually be showing.
SWTException
- int getNextSelection(int hItem, TVITEM tvItem)
public TreeItem getParentItem()
TreeItem
or null when the receiver is a
root.SWTException
- int getSelection(int hItem, TVITEM tvItem, TreeItem[] selection, int index, int count, boolean bigSelection, boolean all)
public TreeItem[] getSelection()
TreeItem
s 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.
SWTException
- public int getSelectionCount()
SWTException
- public TreeColumn getSortColumn()
SWTException
- setSortColumn(TreeColumn)
int getSortColumnPixel()
public int getSortDirection()
UP
, DOWN
or NONE
.SWTException
- setSortDirection(int)
public TreeItem getTopItem()
SWTException
- boolean hitTestSelection(int hItem, int x, int y)
int imageIndex(Image image, int index)
int imageIndexHeader(Image image)
public int indexOf(TreeColumn column)
column
- the search columnjava.lang.IllegalArgumentException
- SWTException
- public int indexOf(TreeItem item)
item
- the search itemjava.lang.IllegalArgumentException
- SWTException
- boolean isCustomToolTip()
boolean isItemSelected(NMTVCUSTOMDRAW nmcd)
void redrawSelection()
void releaseItem(int hItem, TVITEM tvItem, boolean release)
void releaseItems(int hItem, TVITEM tvItem)
void releaseHandle()
releaseHandle
in class Control
void releaseChildren(boolean destroy)
releaseChildren
in class Composite
void releaseWidget()
releaseWidget
in class Composite
public void removeAll()
SWTException
- public void removeSelectionListener(SelectionListener listener)
listener
- the listener which should no longer be notifiedjava.lang.IllegalArgumentException
- SWTException
- SelectionListener
,
addSelectionListener(org.eclipse.swt.events.SelectionListener)
public void removeTreeListener(TreeListener listener)
listener
- the listener which should no longer be notifiedjava.lang.IllegalArgumentException
- SWTException
- TreeListener
,
addTreeListener(org.eclipse.swt.events.TreeListener)
void reskinChildren(int flags)
reskinChildren
in class Composite
public void setInsertMark(TreeItem item, boolean before)
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'.java.lang.IllegalArgumentException
- SWTException
- public void setItemCount(int count)
count
- the number of itemsSWTException
- void setItemCount(int count, int hParent, int hItem)
void setItemHeight(int itemHeight)
itemHeight
- the height of one itemSWTException
- public void setLinesVisible(boolean show)
true
,
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.
show
- the new visibility stateSWTException
- int scrolledHandle()
scrolledHandle
in class Scrollable
void select(int hItem, TVITEM tvItem)
public void select(TreeItem item)
item
- the item to be selectedjava.lang.IllegalArgumentException
- SWTException
- public void selectAll()
If the receiver is single-select, do nothing.
SWTException
- Event sendEraseItemEvent(TreeItem item, NMTTCUSTOMDRAW nmcd, int column, RECT cellRect)
Event sendPaintItemEvent(TreeItem item, NMTTCUSTOMDRAW nmcd, int column, RECT itemRect)
void setBackgroundImage(int hBitmap)
setBackgroundImage
in class Control
void setBackgroundPixel(int pixel)
setBackgroundPixel
in class Control
public void setColumnOrder(int[] order)
order
- the new order to display the itemsSWTException
- java.lang.IllegalArgumentException
- getColumnOrder()
,
TreeColumn.getMoveable()
,
TreeColumn.setMoveable(boolean)
,
SWT.Move
void setCheckboxImageList()
public void setFont(Font font)
Control
void setForegroundPixel(int pixel)
setForegroundPixel
in class Control
public void setHeaderVisible(boolean show)
true
,
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.
show
- the new visibility stateSWTException
- public void setRedraw(boolean redraw)
Control
false
, causes subsequent drawing
operations in the receiver to be ignored. No drawing of any kind
can occur in the receiver until the flag is set to true.
Graphics operations that occurred while the flag was
false
are lost. When the flag is set to true
,
the entire widget is marked as needing to be redrawn. Nested calls
to this method are stacked.
Note: This operation is a hint and may not be supported on some platforms or for some widgets.
setRedraw
in class Control
redraw
- the new redraw stateControl.redraw(int, int, int, int, boolean)
,
Control.update()
void setScrollWidth()
void setScrollWidth(int width)
public void setSelection(TreeItem item)
If the item is not in the receiver, then it is ignored.
item
- the item to selectjava.lang.IllegalArgumentException
- SWTException
- public void setSelection(TreeItem[] items)
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.
items
- the array of itemsjava.lang.IllegalArgumentException
- SWTException
- deselectAll()
public void setSortColumn(TreeColumn column)
column
- the column used by the sort indicator or null
java.lang.IllegalArgumentException
- SWTException
- public void setSortDirection(int direction)
UP
, DOWN
or NONE
.direction
- the direction of the sort indicatorSWTException
- public void setTopItem(TreeItem item)
item
- the item to be shownjava.lang.IllegalArgumentException
- SWTException
- getTopItem()
void showItem(int hItem)
public void showColumn(TreeColumn column)
column
- the column to be shownjava.lang.IllegalArgumentException
- SWTException
- public void showItem(TreeItem item)
item
- the item to be shownjava.lang.IllegalArgumentException
- SWTException
- showSelection()
public void showSelection()
SWTException
- showItem(TreeItem)
void sort()
void sort(int hParent, boolean all)
java.lang.String toolTipText(NMTTDISPINFO hdr)
toolTipText
in class Composite
void updateFullSelection()
void updateHeaderToolTips()
void updateImageList()
void updateImages()
updateImages
in class Control
void updateMenuLocation(Event event)
updateMenuLocation
in class Widget
void updateOrientation()
updateOrientation
in class Composite
void updateScrollBar()
void unsubclass()
unsubclass
in class Control
int widgetStyle()
widgetStyle
in class Composite
TCHAR windowClass()
windowClass
in class Scrollable
int windowProc()
windowProc
in class Scrollable
int windowProc(int hwnd, int msg, int wParam, int lParam)
windowProc
in class Control
LRESULT WM_ERASEBKGND(int wParam, int lParam)
WM_ERASEBKGND
in class Composite
LRESULT WM_GETOBJECT(int wParam, int lParam)
WM_GETOBJECT
in class Control
LRESULT WM_HSCROLL(int wParam, int lParam)
WM_HSCROLL
in class Scrollable
LRESULT WM_KEYDOWN(int wParam, int lParam)
WM_KEYDOWN
in class Control
LRESULT WM_KILLFOCUS(int wParam, int lParam)
WM_KILLFOCUS
in class Control
LRESULT WM_LBUTTONDBLCLK(int wParam, int lParam)
WM_LBUTTONDBLCLK
in class Control
LRESULT WM_LBUTTONDOWN(int wParam, int lParam)
WM_LBUTTONDOWN
in class Composite
LRESULT WM_MOUSEMOVE(int wParam, int lParam)
WM_MOUSEMOVE
in class Control
LRESULT WM_MOUSEWHEEL(int wParam, int lParam)
WM_MOUSEWHEEL
in class Scrollable
LRESULT WM_RBUTTONDOWN(int wParam, int lParam)
WM_RBUTTONDOWN
in class Control
LRESULT WM_PRINTCLIENT(int wParam, int lParam)
WM_PRINTCLIENT
in class Composite
LRESULT WM_SETCURSOR(int wParam, int lParam)
WM_SETCURSOR
in class Control
LRESULT WM_SETFOCUS(int wParam, int lParam)
WM_SETFOCUS
in class Control
LRESULT WM_SETFONT(int wParam, int lParam)
WM_SETFONT
in class Composite
LRESULT WM_SETREDRAW(int wParam, int lParam)
WM_SETREDRAW
in class Control
LRESULT WM_SYSCOLORCHANGE(int wParam, int lParam)
WM_SYSCOLORCHANGE
in class Composite
LRESULT WM_VSCROLL(int wParam, int lParam)
WM_VSCROLL
in class Scrollable
LRESULT wmColorChild(int wParam, int lParam)
wmColorChild
in class Control
LRESULT wmNotifyChild(NMHDR hdr, int wParam, int lParam)
wmNotifyChild
in class Control
LRESULT wmNotifyToolTip(NMTTCUSTOMDRAW nmcd, int lParam)