public class TreeCursor extends Canvas
For a detailed example of using a TreeCursor to navigate to a cell and then edit it see http://git.eclipse.org/c/platform/eclipse.platform.swt.git/tree/examples/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet360.java .
Modifier and Type | Field and Description |
---|---|
(package private) Color |
background |
(package private) static int |
BACKGROUND |
(package private) TreeColumn |
column |
(package private) Listener |
disposeColumnListener |
(package private) Listener |
disposeItemListener |
(package private) Color |
foreground |
(package private) static int |
FOREGROUND |
(package private) Listener |
listener |
(package private) Listener |
resizeListener |
(package private) TreeItem |
row |
(package private) Tree |
tree |
(package private) Listener |
treeListener |
Constructor and Description |
---|
TreeCursor(Tree parent,
int style)
Constructs a new instance of this class given its parent tree and a style value describing
its behavior and appearance.
|
Modifier and Type | Method and Description |
---|---|
(package private) void |
_resize() |
void |
addSelectionListener(SelectionListener listener)
Adds the listener to the collection of listeners who will be notified when the receiver's
selection changes, by sending it one of the messages defined in the
SelectionListener interface. |
(package private) int |
countSubTreePages(TreeItem root) |
(package private) int |
findIndex(TreeItem[] items,
TreeItem treeItem) |
(package private) TreeItem |
findItem(TreeItem[] items,
Point pt) |
Color |
getBackground()
Returns the background color that the receiver will use to draw.
|
int |
getColumn()
Returns the index of the column over which the TreeCursor is positioned.
|
Color |
getForeground()
Returns the foreground color that the receiver will use to draw.
|
(package private) TreeItem |
getLastVisibleItem(TreeItem[] items) |
(package private) TreeItem |
getNextItem(TreeItem item) |
(package private) TreeItem |
getPreviousItem(TreeItem item) |
TreeItem |
getRow()
Returns the row over which the TreeCursor is positioned.
|
(package private) void |
keyDown(Event event) |
(package private) void |
onDispose(Event event) |
(package private) void |
paint(Event event) |
void |
removeSelectionListener(SelectionListener listener)
Removes the listener from the collection of listeners who will be notified when the
receiver's selection changes.
|
void |
setBackground(Color color)
Sets the receiver's background color to the color specified
by the argument, or to the default system color for the control
if the argument is null.
|
void |
setForeground(Color color)
Sets the receiver's foreground color to the color specified
by the argument, or to the default system color for the control
if the argument is null.
|
(package private) void |
setRowColumn(int row,
int column,
boolean notify) |
(package private) void |
setRowColumn(TreeItem row,
TreeColumn column,
boolean notify) |
void |
setSelection(int row,
int column)
Positions the TreeCursor over the root-level cell at the given row and column in the parent tree.
|
void |
setSelection(TreeItem row,
int column)
Positions the TreeCursor over the cell at the given row and column in the parent tree.
|
void |
setVisible(boolean visible)
Marks the receiver as visible if the argument is
true ,
and marks it invisible otherwise. |
(package private) void |
treeCollapse(Event event) |
(package private) void |
treeExpand(Event event) |
(package private) void |
treeFocusIn(Event event) |
(package private) void |
treeMouseDown(Event event) |
(package private) void |
unhookRowColumnListeners() |
drawBackground, getCaret, getIME, scroll, setCaret, setFont, setIME
changed, checkSubclass, computeSize, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setToolTipText, setTouchEnabled, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString
Tree tree
TreeItem row
TreeColumn column
Listener listener
Listener treeListener
Listener resizeListener
Listener disposeItemListener
Listener disposeColumnListener
Color background
Color foreground
static final int BACKGROUND
static final int FOREGROUND
public TreeCursor(Tree 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 Tree control which will be the parent of the new instance (cannot be null)style
- the style of control to constructjava.lang.IllegalArgumentException
- SWTException
- SWT.BORDER
,
Widget.checkSubclass()
,
Widget.getStyle()
public void addSelectionListener(SelectionListener listener)
SelectionListener
interface.
When widgetSelected
is called, the item field of the event object is valid. If
the receiver has SWT.CHECK
style set 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.
listener
- the listener which should be notifiedjava.lang.IllegalArgumentException
- SWTException
- SelectionListener
,
SelectionEvent
,
removeSelectionListener(SelectionListener)
int countSubTreePages(TreeItem root)
public Color getBackground()
getBackground
in class Control
public int getColumn()
SWTException
- public Color getForeground()
getForeground
in class Control
public TreeItem getRow()
null
if noneSWTException
- void keyDown(Event event)
void onDispose(Event event)
void paint(Event event)
public void removeSelectionListener(SelectionListener listener)
listener
- the listener which should no longer be notifiedjava.lang.IllegalArgumentException
- SWTException
- SelectionListener
,
addSelectionListener(SelectionListener)
void _resize()
public void setBackground(Color color)
Note: This operation is a hint and may be overridden by the platform. For example, on Windows the background of a Button cannot be changed.
setBackground
in class Control
color
- the new color (or null)java.lang.IllegalArgumentException
- SWTException
- public void setForeground(Color color)
Note: This operation is a hint and may be overridden by the platform.
setForeground
in class Control
color
- the new color (or null)java.lang.IllegalArgumentException
- SWTException
- void setRowColumn(int row, int column, boolean notify)
void setRowColumn(TreeItem row, TreeColumn column, boolean notify)
public void setSelection(int row, int column)
row
- the index of the root-level row for the cell to selectcolumn
- the index of column for the cell to selectSWTException
- public void setSelection(TreeItem row, int column)
row
- the TreeItem of the row for the cell to selectcolumn
- the index of column for the cell to selectSWTException
- public void setVisible(boolean visible)
Control
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.
setVisible
in class Control
visible
- the new visibility statevoid treeCollapse(Event event)
void treeExpand(Event event)
void treeFocusIn(Event event)
void treeMouseDown(Event event)
void unhookRowColumnListeners()