public class CTree
extends org.eclipse.swt.widgets.Composite
implements org.eclipse.swt.widgets.Listener
NOTE: THIS WIDGET AND ITS API ARE STILL UNDER DEVELOPMENT. THIS IS A PRE-RELEASE ALPHA VERSION. USERS SHOULD EXPECT API CHANGES IN FUTURE VERSIONS.
Modifier and Type | Field and Description |
---|---|
(package private) java.util.List |
addedItems |
protected org.eclipse.swt.widgets.Canvas |
body |
static boolean |
carbon
true if the platform is detected as being "carbon"
|
(package private) java.lang.Class[] |
cellClasses |
protected SColors |
colors |
(package private) int[] |
columnOrder |
(package private) CTreeColumn[] |
columns |
boolean |
drawViewportEast |
boolean |
drawViewportNorth |
boolean |
drawViewportSouth |
boolean |
drawViewportWest |
protected java.lang.String |
emptyMessage |
(package private) boolean |
fillerColumnSet |
static boolean |
gtk
true if the platform is detected as being "gtk"
|
protected boolean |
hasFocus |
protected org.eclipse.swt.widgets.ScrollBar |
hBar |
protected org.eclipse.swt.widgets.Composite |
header |
(package private) int |
heightOld |
protected boolean |
hLines |
(package private) org.eclipse.swt.graphics.GC |
internalGC |
protected org.eclipse.swt.widgets.Table |
internalTable |
(package private) java.util.List |
itemList |
protected boolean |
lastLine |
protected CTreeLayout |
layout |
protected boolean |
linesVisible |
protected boolean |
nativeGrid |
(package private) boolean |
nativeHeader |
protected java.util.List |
paintedItems
A list of items that will actually be painted to the screen.
Subclasses may override the order as the order of paintedItems represents the final drawing order of the items - the last item in this list is drawn to the screen last and is, therefore, drawn on top of any overlapping items. |
boolean |
paintGridAsBackground |
(package private) java.util.List |
removedItems |
protected boolean |
selectable
Signifies whether or not the items of this container can be selected.
|
protected java.util.List |
selection
A list of the selected items.
|
protected boolean |
selectOnToggle
Signifies whether or not the items of this container are selected when
their toggle is clicked on, as opposed to their body.
|
protected CTreeItem |
shiftSel
The first item selected with the SHIFT or CTRL key pressed.
|
(package private) CTreeColumn |
sortColumn |
(package private) int |
sortDirection |
protected int |
style |
(package private) int |
topOld |
(package private) boolean |
updatePaintedList |
protected org.eclipse.swt.widgets.ScrollBar |
vBar |
protected boolean |
vLines |
static boolean |
win32
true if the platform is detected as being "win32"
|
Constructor and Description |
---|
CTree(org.eclipse.swt.widgets.Composite parent,
int style) |
Modifier and Type | Method and Description |
---|---|
(package private) void |
addColumn(CTreeColumn column,
int style) |
(package private) void |
addItem(CTreeItem item) |
(package private) void |
addItem(int index,
CTreeItem item) |
(package private) void |
addItems() |
void |
addPaintedItemListener(org.eclipse.swt.widgets.Listener listener)
Adds the listener to the collection of listeners who will be notified
when the Paint Status of an item changes.
|
void |
addSelectionListener(org.eclipse.swt.events.SelectionListener listener)
An item may be considered visible, and will be returned with
CTree#getVisibleItems() , even though it will not be
painted on the screen. |
void |
addTreeListener(org.eclipse.swt.events.TreeListener listener) |
void |
clear(int index,
boolean all) |
void |
clearAll(boolean all) |
void |
deselectAll() |
(package private) void |
firePaintedItemEvent(CTreeItem item,
boolean isPainted) |
protected void |
fireSelectionEvent(boolean defaultSelection) |
(package private) org.eclipse.swt.widgets.Composite |
getBody() |
int |
getCheckColumn() |
boolean |
getCheckRoots() |
SColors |
getColors() |
(package private) CTreeColumn |
getColumn(int index) |
int |
getColumnCount() |
int[] |
getColumnOrder() |
(package private) CTreeColumn[] |
getColumns() |
(package private) int[] |
getColumnWidths() |
protected org.eclipse.swt.graphics.Rectangle |
getContentArea() |
java.lang.String |
getEmptyMessage()
The Empty Message is the text message that will be displayed when there
are no Items to be displayed (the CTable is empty).
|
int |
getGridLineWidth() |
(package private) org.eclipse.swt.widgets.Composite |
getHeader() |
int |
getHeaderHeight() |
boolean |
getHeaderVisible() |
(package private) org.eclipse.swt.widgets.Table |
getInternalTable() |
CTreeItem |
getItem(int index) |
(package private) CTreeItem |
getItem(int x,
int y) |
int |
getItemCount() |
int |
getItemHeight() |
CTreeItem[] |
getItems()
Returns a (possibly empty) array of items contained in the
receiver that are direct item children of the receiver.
|
(package private) java.util.List |
getItems(CTreeItem item,
boolean all)
returns a deep list of items belonging to the given item
|
protected CTreeItem[] |
getItems(org.eclipse.swt.graphics.Rectangle rect)
Get a list of items within, or touching, the given rectangle.
|
boolean |
getLastLineVisible() |
boolean |
getLinesVisible() |
boolean |
getNativeHeader() |
protected java.util.List |
getPaintedItems() |
CTreeItem |
getParentItem() |
(package private) org.eclipse.swt.graphics.Point |
getScrollPosition() |
CTreeItem[] |
getSelection() |
int |
getSelectionCount() |
boolean |
getSelectOnToggle() |
boolean |
getSelectOnTreeToggle() |
protected CTreeColumn |
getSortColumn()
returns the sort column of this container as an CTreeColumn.
|
int |
getSortDirection() |
int |
getStyle() |
CTreeItem |
getTopItem() |
int |
getTreeColumn() |
int |
getTreeIndent() |
void |
handleEvent(org.eclipse.swt.widgets.Event event) |
protected void |
handleMouseEvents(org.eclipse.swt.widgets.Event event) |
boolean |
hasTreeColumn()
Convenience method indicating whether or not the treeColumn is set to an
actual column, and thus the tree hierarchy will be displayed.
|
int |
indexOf(CTreeColumn column) |
int |
indexOf(CTreeItem item) |
boolean |
isEmpty() |
boolean |
isVisible(CTreeItem item)
Use this method to find out if an item is visible, and thus has the potential to be
painted.
|
(package private) java.util.List |
items(boolean all) |
(package private) void |
layout(int eventType,
CTreeCell cell)
Event types:
SWT.Collapse
SWT.Expand
SWT.Resize
|
(package private) void |
layout(int eventType,
CTreeColumn column)
Event types:
SWT.Move
SWT.Resize
|
(package private) void |
layout(int eventType,
CTreeItem item)
Event types:
SWT.Collapse
SWT.Expand
SWT.Hide
SWT.Move
SWT.Show
|
(package private) org.eclipse.swt.graphics.Rectangle |
mapRectangle(int x,
int y,
int width,
int height) |
(package private) org.eclipse.swt.graphics.Rectangle |
mapRectangle(org.eclipse.swt.graphics.Rectangle rect) |
protected void |
paintBackground(org.eclipse.swt.graphics.GC gc,
org.eclipse.swt.graphics.Rectangle ebounds) |
protected void |
paintBody(org.eclipse.swt.widgets.Event e) |
protected void |
paintColumns(org.eclipse.swt.graphics.GC gc,
org.eclipse.swt.graphics.Rectangle ebounds) |
protected void |
paintFocus(org.eclipse.swt.graphics.GC gc,
org.eclipse.swt.graphics.Rectangle ebounds) |
protected void |
paintGridLines(org.eclipse.swt.graphics.GC gc,
org.eclipse.swt.graphics.Rectangle ebounds) |
protected void |
paintItemBackgrounds(org.eclipse.swt.graphics.GC gc,
org.eclipse.swt.graphics.Rectangle ebounds) |
protected void |
paintItems(org.eclipse.swt.graphics.GC gc,
org.eclipse.swt.graphics.Rectangle ebounds) |
protected void |
paintSelectionIndicators(org.eclipse.swt.graphics.GC gc,
org.eclipse.swt.graphics.Rectangle ebounds) |
protected void |
paintViewport(org.eclipse.swt.graphics.GC gc,
org.eclipse.swt.graphics.Rectangle ebounds) |
void |
redraw(CTreeCell cell) |
void |
redraw(CTreeItem item) |
void |
removeAll() |
(package private) void |
removeColumn(CTreeColumn column) |
(package private) void |
removeItem(CTreeItem item) |
void |
removePaintedItemListener(org.eclipse.swt.widgets.Listener listener) |
void |
removeSelectionListener(org.eclipse.swt.events.SelectionListener listener) |
void |
removeTreeListener(org.eclipse.swt.events.TreeListener listener) |
(package private) void |
scrollTo(org.eclipse.swt.graphics.Point pt) |
(package private) void |
scrollToX(int x) |
(package private) void |
scrollToY(int y) |
void |
selectAll() |
void |
setBackground(org.eclipse.swt.graphics.Color color)
disabled: use the SColors class instead
|
void |
setCellClass(java.lang.Class clazz) |
void |
setCellClasses(java.lang.Class[] classes) |
void |
setCheckColumn(int column,
boolean roots) |
void |
setColumnOrder(int[] order) |
void |
setEmptyMessage(java.lang.String string)
Sets the message that will be displayed when their are no Items to be
displayed (the Container is empty).
|
boolean |
setFocus() |
void |
setForeground(org.eclipse.swt.graphics.Color color)
currently disabled: use the CTableColors class instead
|
void |
setHeaderVisible(boolean show) |
void |
setHorizontalLinesVisible(boolean visible) |
void |
setInsertMark(CTreeItem item,
boolean before) |
void |
setItemCount(int count) |
void |
setLayout(org.eclipse.swt.widgets.Layout layout)
Sets the layout which is associated with the receiver to be the argument
which may be null.
|
void |
setLinesVisible(boolean visible) |
void |
setLinesVisible(boolean visible,
boolean lastLine)
If lastLine == false, then lines are only drawn in between items (if, of
course, visible == true)
|
void |
setNativeHeader(boolean nativeHeader) |
(package private) void |
setOrigin(int x,
int y) |
void |
setRedraw(boolean redraw) |
(package private) void |
setScrollPosition(org.eclipse.swt.graphics.Point origin) |
void |
setSelectable(boolean selectable)
Enables items in this Container to be selected
|
void |
setSelection(CTreeItem item) |
void |
setSelection(CTreeItem[] items) |
void |
setSelection(CTreeItem from,
CTreeItem to) |
void |
setSelectOnToggle(boolean select)
If the the user clicks on the toggle of an item (treeCell or not) the
corresponding item will become selected if, and only if, selectOnToggle
is true
|
void |
setSelectOnTreeToggle(boolean select)
If the the user clicks on the toggle of the treeCell the corresponding item will
become selected if, and only if, selectOnTreeToggle is true
|
void |
setSortColumn(CTreeColumn column) |
void |
setSortDirection(int direction) |
void |
setTopItem(CTreeItem item) |
void |
setTreeColumn(int column)
The Tree Column indicates which column should act as the tree by placing
the expansion toggle in its cell.
|
void |
setTreeIndent(int indent)
Sets the amount to indent child items from their parent.
|
void |
setVerticalLinesVisible(boolean visible) |
void |
showColumn(CTreeColumn column)
TODO
|
void |
showItem(CTreeItem item) |
void |
showSelection() |
boolean |
toggleSelection(CTreeItem item)
toggle the selection state of the item
|
void |
updateColors() |
protected void |
updatePaintedItems() |
changed, checkSubclass, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, 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, getBackground, getBackgroundImage, getBorderWidth, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, 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, requestLayout, setBackgroundImage, setBounds, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFont, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, isAutoDirection, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString
public static final boolean carbon
public static final boolean gtk
public static final boolean win32
org.eclipse.swt.graphics.GC internalGC
protected java.util.List paintedItems
protected java.util.List selection
protected CTreeItem shiftSel
protected boolean selectable
protected boolean selectOnToggle
java.lang.Class[] cellClasses
protected int style
protected org.eclipse.swt.widgets.Canvas body
protected org.eclipse.swt.widgets.Composite header
protected org.eclipse.swt.widgets.Table internalTable
CTreeColumn[] columns
int[] columnOrder
boolean fillerColumnSet
boolean nativeHeader
CTreeColumn sortColumn
int sortDirection
protected org.eclipse.swt.widgets.ScrollBar hBar
protected org.eclipse.swt.widgets.ScrollBar vBar
protected boolean hasFocus
protected java.lang.String emptyMessage
protected boolean linesVisible
protected boolean lastLine
protected boolean vLines
protected boolean hLines
protected SColors colors
protected boolean nativeGrid
protected CTreeLayout layout
public boolean drawViewportNorth
public boolean drawViewportEast
public boolean drawViewportSouth
public boolean drawViewportWest
public boolean paintGridAsBackground
java.util.List addedItems
java.util.List removedItems
int topOld
int heightOld
boolean updatePaintedList
java.util.List itemList
void addColumn(CTreeColumn column, int style)
void addItem(CTreeItem item)
void addItem(int index, CTreeItem item)
void addItems()
public void addPaintedItemListener(org.eclipse.swt.widgets.Listener listener)
An item may be considered visible, and will be returned with
CTree#getVisibleItems()
, even though it will not be
painted on the screen. Paint status, on the other hand, refers to whether
or not an item will actually be painted when the
paintBody(Event)
method is called.
The Event that is passed to this listener will have the item, whose Paint Status has changed, set as Event.item. The actual Paint Status is dertermined through the value of the Event's detail field: values > 0 mean the item will be painted, while values < 0 mean the item will not be painted.
listener
- the listener which should be notifiedremovePaintedItemListener(org.eclipse.swt.widgets.Listener)
,
getPaintedItems()
public void addSelectionListener(org.eclipse.swt.events.SelectionListener listener)
CTree#getVisibleItems()
, even though it will not be
painted on the screen. Paint status, on the other hand, refers to whether
or not an item will actually be painted when the
paintBody(Event)
method is called.#getVisibleItems()
public void addTreeListener(org.eclipse.swt.events.TreeListener listener)
public void clear(int index, boolean all)
public void clearAll(boolean all)
public void deselectAll()
void firePaintedItemEvent(CTreeItem item, boolean isPainted)
protected void fireSelectionEvent(boolean defaultSelection)
org.eclipse.swt.widgets.Composite getBody()
public int getCheckColumn()
public boolean getCheckRoots()
public SColors getColors()
public int getColumnCount()
public int[] getColumnOrder()
int[] getColumnWidths()
protected org.eclipse.swt.graphics.Rectangle getContentArea()
public java.lang.String getEmptyMessage()
org.aspencloud.widgets.ccontainer#setEmptyMessage(java.lang.String)
public int getGridLineWidth()
org.eclipse.swt.widgets.Composite getHeader()
public int getHeaderHeight()
public boolean getHeaderVisible()
org.eclipse.swt.widgets.Table getInternalTable()
public CTreeItem getItem(int index)
public int getItemCount()
public int getItemHeight()
public CTreeItem[] 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.
org.eclipse.swt.SWTException
- java.util.List getItems(CTreeItem item, boolean all)
protected CTreeItem[] getItems(org.eclipse.swt.graphics.Rectangle rect)
rect
- public boolean getLastLineVisible()
public boolean getLinesVisible()
public boolean getNativeHeader()
protected java.util.List getPaintedItems()
public CTreeItem getParentItem()
org.eclipse.swt.graphics.Point getScrollPosition()
public CTreeItem[] getSelection()
public int getSelectionCount()
public boolean getSelectOnToggle()
setSelectOnToggle(boolean)
public boolean getSelectOnTreeToggle()
setSelectOnTreeToggle(boolean)
public int getSortDirection()
public int getStyle()
getStyle
in class org.eclipse.swt.widgets.Widget
public CTreeItem getTopItem()
public int getTreeColumn()
public int getTreeIndent()
public void handleEvent(org.eclipse.swt.widgets.Event event)
handleEvent
in interface org.eclipse.swt.widgets.Listener
protected void handleMouseEvents(org.eclipse.swt.widgets.Event event)
public boolean hasTreeColumn()
Note that if the hierarchy is not displayed, then certain methods are able to be optimized and will take advantage of this fact
public int indexOf(CTreeColumn column)
public int indexOf(CTreeItem item)
CTreeColumn getColumn(int index)
CTreeColumn[] getColumns()
CTreeItem getItem(int x, int y)
protected CTreeColumn getSortColumn()
public boolean isEmpty()
public boolean isVisible(CTreeItem item)
An Item will be visible when every parent between it and the root of the tree is expanded
item
- the item in questionjava.util.List items(boolean all)
void layout(int eventType, CTreeCell cell)
Event types:
eventType
- cell
- void layout(int eventType, CTreeColumn column)
Event types:
eventType
- column
- void layout(int eventType, CTreeItem item)
Event types:
eventType
- item
- org.eclipse.swt.graphics.Rectangle mapRectangle(int x, int y, int width, int height)
org.eclipse.swt.graphics.Rectangle mapRectangle(org.eclipse.swt.graphics.Rectangle rect)
protected void paintBackground(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle ebounds)
protected void paintBody(org.eclipse.swt.widgets.Event e)
protected void paintColumns(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle ebounds)
protected void paintFocus(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle ebounds)
protected void paintGridLines(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle ebounds)
protected void paintItemBackgrounds(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle ebounds)
protected void paintItems(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle ebounds)
protected void paintSelectionIndicators(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle ebounds)
protected void paintViewport(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle ebounds)
public void redraw(CTreeCell cell)
public void redraw(CTreeItem item)
public void removeAll()
void removeColumn(CTreeColumn column)
void removeItem(CTreeItem item)
public void removePaintedItemListener(org.eclipse.swt.widgets.Listener listener)
public void removeSelectionListener(org.eclipse.swt.events.SelectionListener listener)
public void removeTreeListener(org.eclipse.swt.events.TreeListener listener)
void scrollTo(org.eclipse.swt.graphics.Point pt)
void scrollToX(int x)
void scrollToY(int y)
public void selectAll()
public void setBackground(org.eclipse.swt.graphics.Color color)
setBackground
in class org.eclipse.swt.widgets.Control
public void setCellClass(java.lang.Class clazz)
public void setCellClasses(java.lang.Class[] classes)
public void setCheckColumn(int column, boolean roots)
public void setColumnOrder(int[] order)
public void setEmptyMessage(java.lang.String string)
string
- the message to be displayedpublic boolean setFocus()
setFocus
in class org.eclipse.swt.widgets.Composite
public void setForeground(org.eclipse.swt.graphics.Color color)
post a feature request if you need it enabled
setForeground
in class org.eclipse.swt.widgets.Control
public void setHeaderVisible(boolean show)
public void setHorizontalLinesVisible(boolean visible)
public void setInsertMark(CTreeItem item, boolean before)
public void setItemCount(int count)
public void setLayout(org.eclipse.swt.widgets.Layout layout)
setLayout
in class org.eclipse.swt.widgets.Composite
layout
- the receiver's new layout or nullorg.eclipse.swt.SWTException
- public void setLinesVisible(boolean visible)
public void setLinesVisible(boolean visible, boolean lastLine)
visible
- lastLine
- whether or not the last line is set visibleorg.aspencloud.widgets.ccontainer#setLinesVisible(boolean)
public void setNativeHeader(boolean nativeHeader)
void setOrigin(int x, int y)
public void setRedraw(boolean redraw)
setRedraw
in class org.eclipse.swt.widgets.Control
void setScrollPosition(org.eclipse.swt.graphics.Point origin)
public void setSelectable(boolean selectable)
selectable
- public void setSelection(CTreeItem item)
public void setSelection(CTreeItem[] items)
public void setSelectOnToggle(boolean select)
select
- the new state of selectOnTogglepublic void setSelectOnTreeToggle(boolean select)
select
- the new state of selectOnTreeTogglepublic void setSortColumn(CTreeColumn column)
public void setSortDirection(int direction)
public void setTopItem(CTreeItem item)
public void setTreeColumn(int column)
If column is greater than the number of columns, or is less than zero then no column will have an expansion toggle (or room for one).
column
- the column to use for the treepublic void setTreeIndent(int indent)
Suitable defaults are set according to SWT.Platform, but the option to customize is still exposed through this metho
Note that only the Tree Column will be indented; if there is no Tree Column then this setting will have no affect. If you need the entire Item and all of its columns to be indented, please file a feature request at sourceforge.net/projects/calypsorcp
indent
- public void setVerticalLinesVisible(boolean visible)
public void showColumn(CTreeColumn column)
column
- public void showItem(CTreeItem item)
public void showSelection()
public boolean toggleSelection(CTreeItem item)
item
- the item whose selection state is to be toggledpublic void updateColors()
protected void updatePaintedItems()