|
Eclipse Platform 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.eclipse.swt.widgets.Widget | +--org.eclipse.swt.widgets.Control | +--org.eclipse.swt.widgets.Scrollable | +--org.eclipse.swt.widgets.Composite | +--org.eclipse.swt.custom.TableTree
A TableTree is a selectable user interface object that displays a hierarchy of items, and issues notification when an item is selected. A TableTree may be single or multi select.
The item children that may be added to instances of this class
must be of type TableTreeItem
.
Note that although this class is a subclass of Composite
,
it does not make sense to add Control
children to it,
or set a layout on it.
Note: Only one of the styles SINGLE, and MULTI may be specified.
Field Summary |
Fields inherited from class org.eclipse.swt.widgets.Control |
handle |
Constructor Summary | |
TableTree(Composite parent,
int style)
Constructs a new instance of this class given its parent and a style value describing its behavior and appearance. |
Method Summary | |
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. |
void |
addTreeListener(TreeListener listener)
Adds the listener to receive tree events. |
Point |
computeSize(int wHint,
int hHint)
Returns the preferred size of the receiver. |
Rectangle |
computeTrim(int x,
int y,
int width,
int height)
Given a desired client area for the receiver (as described by the arguments), returns the bounding rectangle which would be required to produce that client area. |
void |
deselectAll()
Deselects all items. |
Color |
getBackground()
Returns the receiver's background color. |
Font |
getFont()
Returns the font that the receiver will use to paint textual information. |
Color |
getForeground()
Returns the foreground color that the receiver will use to draw. |
TableTreeItem |
getItem(Point point)
Returns the item at the given point in the receiver or null if no such item exists. |
int |
getItemCount()
Gets the number of items. |
int |
getItemHeight()
Gets the height of one item. |
TableTreeItem[] |
getItems()
Gets the items. |
TableTreeItem[] |
getSelection()
Gets the selected items. |
int |
getSelectionCount()
Gets the number of selected items. |
Table |
getTable()
Returns the underlying Table control. |
int |
indexOf(TableTreeItem item)
Gets the index of an item. |
void |
removeAll()
Removes all items. |
void |
removeSelectionListener(SelectionListener listener)
Removes the listener. |
void |
removeTreeListener(TreeListener listener)
Removes the listener. |
void |
selectAll()
Selects all items. |
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 |
setEnabled(boolean enabled)
Enables the receiver if the argument is true ,
and disables it otherwise. |
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. |
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 |
setMenu(Menu menu)
Sets the receiver's pop up menu to the argument. |
void |
setSelection(TableTreeItem[] items)
Sets the selection. |
void |
setToolTipText(String string)
Sets the receiver's tool tip text to the argument, which may be null indicating that no tool tip text should be shown. |
void |
showItem(TableTreeItem item)
Shows the item. |
void |
showSelection()
Shows the selection. |
Methods inherited from class org.eclipse.swt.widgets.Composite |
checkSubclass, computeSize, getChildren, getLayout, getTabList, layout, layout, setFocus, setLayout, setTabList |
Methods inherited from class org.eclipse.swt.widgets.Scrollable |
getClientArea, getHorizontalBar, getVerticalBar |
Methods inherited from class org.eclipse.swt.widgets.Widget |
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getStyle, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, setData, setData, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public TableTree(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 widget which will be the parent of the new instance (cannot be null)style
- the style of widget to construct
IllegalArgumentException
- SWTException
- SWT.SINGLE
,
SWT.MULTI
,
SWT.CHECK
,
SWT.FULL_SELECTION
,
Widget.getStyle()
Method Detail |
public void addSelectionListener(SelectionListener listener)
SelectionListener
interface.
When widgetSelected
is called, the item field of the event object is valid.
If the reciever 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.
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
IllegalArgumentException
- SWTException
- SelectionListener
,
removeSelectionListener(org.eclipse.swt.events.SelectionListener)
,
SelectionEvent
public void addTreeListener(TreeListener listener)
listener
- the tree listener
SWTError
- public Point computeSize(int wHint, int hHint)
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.
computeSize
in class Control
wHint
- the width hint (can be SWT.DEFAULT
)hHint
- the height hint (can be SWT.DEFAULT
)
Layout
,
Control.getBorderWidth()
,
Control.getBounds()
,
Control.getSize()
,
Control.pack()
,
"computeTrim, getClientArea for controls that implement them"public Rectangle computeTrim(int x, int y, int width, int height)
Scrollable
In other words, it returns a rectangle such that, if the receiver's bounds were set to that rectangle, the area of the receiver which is capable of displaying data (that is, not covered by the "trimmings") would be the rectangle described by the arguments (relative to the receiver's parent).
computeTrim
in class Scrollable
Scrollable.getClientArea()
public void deselectAll()
If an item is selected, it is deselected. If an item is not selected, it remains unselected.
SWTError
- public Color getBackground()
Control
getBackground
in class Control
public Color getForeground()
Control
getForeground
in class Control
public Font getFont()
Control
getFont
in class Control
public int getItemCount()
public int getItemHeight()
This operation will fail if the height of one item could not be queried from the OS.
SWTError
- public TableTreeItem[] getItems()
public TableTreeItem[] getSelection()
This operation will fail if the selected items cannot be queried from the OS.
SWTError
- public int getSelectionCount()
This operation will fail if the number of selected items cannot be queried from the OS.
SWTError
- public Table getTable()
public int indexOf(TableTreeItem item)
The widget is searched starting at 0 until an item is found that is equal to the search item. If no item is found, -1 is returned. Indexing is zero based. This index is relative to the parent only.
item
- the search item
public TableTreeItem getItem(Point point)
point
- the point used to locate the item
IllegalArgumentException
- SWTException
- public void removeAll()
This operation will fail when an item could not be removed in the OS.
SWTError
- public void removeSelectionListener(SelectionListener listener)
listener
- the listener
SWTError
- public void removeTreeListener(TreeListener listener)
listener
- the listener
SWTError
- public void selectAll()
If an item is not selected, it is selected. If an item is selected, it remains selected.
SWTError
- public void setBackground(Color color)
Control
setBackground
in class Control
color
- the new color (or null)public void setEnabled(boolean enabled)
Control
true
,
and disables it otherwise. A disabled control is typically
not selectable from the user interface and draws with an
inactive or "grayed" look.
setEnabled
in class Control
enabled
- the new enabled statepublic void setFont(Font font)
Control
setFont
in class Control
font
- the new font (or null)public void setForeground(Color color)
Control
setForeground
in class Control
color
- the new color (or null)public void setMenu(Menu menu)
Control
setMenu
in class Control
menu
- the new pop up menupublic void setSelection(TableTreeItem[] items)
items
- new selection
SWTError
- public void setToolTipText(String string)
Control
setToolTipText
in class Control
string
- the new tool tip text (or null)public void showItem(TableTreeItem item)
item
- the item to be shown
SWTError
- public void showSelection()
If there is no selection or the selection is already visible, this method does nothing. If the selection is scrolled out of view, the top index of the widget is changed such that selection becomes visible.
SWTError
-
|
Eclipse Platform 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |