public class TableCursor extends Canvas
For a detailed example of using a TableCursor 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/Snippet96.java .
Modifier and Type | Field and Description |
---|---|
(package private) Color |
background |
(package private) static int |
BACKGROUND |
(package private) TableColumn |
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) TableItem |
row |
(package private) Table |
table |
(package private) Listener |
tableListener |
Constructor and Description |
---|
TableCursor(Table parent,
int style)
Constructs a new instance of this class given its parent
table 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 user changes the receiver's selection, 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 TableCursor is positioned.
|
Color |
getForeground()
Returns the foreground color that the receiver will use to draw.
|
TableItem |
getRow()
Returns the row over which the TableCursor 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 user changes the receiver's selection.
|
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(TableItem row,
TableColumn column,
boolean notify) |
void |
setSelection(int row,
int column)
Positions the TableCursor over the cell at the given row and column in the parent table.
|
void |
setSelection(TableItem row,
int column)
Positions the TableCursor over the cell at the given row and column in the parent table.
|
void |
setVisible(boolean visible)
Marks the receiver as visible if the argument is
true ,
and marks it invisible otherwise. |
(package private) void |
tableFocusIn(Event event) |
(package private) void |
tableMouseDown(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
Table table
TableItem row
TableColumn column
Listener listener
Listener tableListener
Listener resizeListener
Listener disposeItemListener
Listener disposeColumnListener
Color background
Color foreground
static final int BACKGROUND
static final int FOREGROUND
public TableCursor(Table 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 Table 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 notified when the user changes the receiver's selectionjava.lang.IllegalArgumentException
- SWTException
- SelectionListener
,
SelectionEvent
,
removeSelectionListener(SelectionListener)
void onDispose(Event event)
void keyDown(Event event)
void paint(Event event)
void tableFocusIn(Event event)
void tableMouseDown(Event event)
void setRowColumn(int row, int column, boolean notify)
void setRowColumn(TableItem row, TableColumn column, boolean notify)
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 statepublic void removeSelectionListener(SelectionListener listener)
listener
- the listener which should no longer be notifiedjava.lang.IllegalArgumentException
- SWTException
- SelectionListener
,
addSelectionListener(SelectionListener)
void _resize()
public int getColumn()
SWTException
- public Color getBackground()
getBackground
in class Control
public Color getForeground()
getForeground
in class Control
public TableItem getRow()
null
if noneSWTException
- 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
- public void setSelection(int row, int column)
row
- the index of the row for the cell to selectcolumn
- the index of column for the cell to selectSWTException
- public void setSelection(TableItem row, int column)
row
- the TableItem of the row for the cell to selectcolumn
- the index of column for the cell to selectSWTException
- void unhookRowColumnListeners()