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 .
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 |
---|---|
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. |
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.
|
TreeItem |
getRow()
Returns the row over which the TreeCursor is positioned.
|
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.
|
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. |
drawBackground, getCaret, getIME, scroll, setCaret, setFont, setIME
changed, checkSubclass, 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, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isAutoScalable, 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, requestLayout, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString
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 constructIllegalArgumentException
- 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 notifiedIllegalArgumentException
- SWTException
- SelectionListener
,
SelectionEvent
,
removeSelectionListener(SelectionListener)
public Color getBackground()
getBackground
in class Control
public int getColumn()
SWTException
- public Color getForeground()
getForeground
in class Control
public TreeItem getRow()
null
if noneSWTException
- public void removeSelectionListener(SelectionListener listener)
listener
- the listener which should no longer be notifiedIllegalArgumentException
- SWTException
- SelectionListener
,
addSelectionListener(SelectionListener)
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)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)IllegalArgumentException
- SWTException
- 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 stateCopyright © 2017. All Rights Reserved.