public class CTreeCell
extends java.lang.Object
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 |
---|---|
static boolean |
carbon
true if the platform is detected as being "carbon"
|
protected boolean |
childVisible
indicates whether or not this cell's child area is visible
|
protected CTree |
ctree
the container to which this cell's item belongs
|
protected boolean |
ghostToggle
If true, the toggle will not be drawn, but will take up space
|
static boolean |
gtk
true if the platform is detected as being "gtk"
|
(package private) int |
hAlign
the horizontal alignment to use when positioning the control in the client area, if it was created
|
protected boolean |
holdControl |
protected int |
indent
the amount by which the toggle, and thus the rest of the cell, is to be indented
|
protected boolean |
isGridLine
indicates whether or not this cell is to be drawn as though it were a gridline.
|
protected CTreeItem |
item
the item to which this cell belongs
|
int |
marginBottom
An amount of margin to be applied to the bottom of the cell.
|
int |
marginHeight
An amount of margin to be applied to both the top and bottom of the cell.
|
int |
marginLeft
An amount of margin to be applied to the left side of the cell.
|
int |
marginRight
An amount of margin to be applied to the right side of the cell.
|
int |
marginTop
An amount of margin to be applied to the top of the cell.
|
int |
marginWidth
An amount of margin to be applied to both the left and right sides of the cell.
|
protected boolean |
mouseDown
indicates whether or not the primary mouse button is down, whether or not it is over this cell.
|
protected boolean |
mouseOver
indicates whether or not the mouse is over this cell.
|
protected boolean |
mouseOverToggle
indicates whether or not the mouse is over this cell's toggle.
|
protected boolean |
open
indicates whether or not this cell is considered 'open' or 'closed'.
|
protected boolean |
selected
indicates whether or not this cell is selected, and thereby included in the
container's current selection list.
|
protected int |
style
the style settings for this cell
|
protected boolean |
toggleVisible
indicates whether or not this cell's toggle is visible
|
int |
toggleWidth
sets the width of the toggle
|
(package private) int |
vAlign
the vertical alignment to use when positioning the control in the client area, if it was created
|
protected boolean |
visible
indicates whether or not this cell is visible and should be considered for
painting by the container.
|
static boolean |
win32
true if the platform is detected as being "win32"
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(int eventType,
org.eclipse.swt.widgets.Listener handler) |
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener) |
void |
addPropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener) |
void |
clear() |
(package private) org.eclipse.swt.graphics.Point |
computeChildSize(int wHint,
int hHint) |
org.eclipse.swt.graphics.Point |
computeClientSize(int wHint,
int hHint)
compute the size of this cell's client area; that is, compute the size
of the area which is not covered by margins, toggles, or checks.
|
(package private) org.eclipse.swt.graphics.Point |
computeControlSize(int wHint,
int hHint) |
org.eclipse.swt.graphics.Point |
computeSize(int wHint,
int hHint)
Compute the preferred size of the cell for its current state (open or closed, if applicable)
just the way it would be done in a regular SWT layout.
|
protected org.eclipse.swt.graphics.Point |
computeTextSize(int wHint,
int hHint) |
(package private) boolean |
contains(org.eclipse.swt.widgets.Control control) |
protected org.eclipse.swt.widgets.Control |
createChildControl(org.eclipse.swt.widgets.Composite parent)
Create the contents of your custom cell's Child Area here.
|
protected org.eclipse.swt.widgets.Control |
createControl(org.eclipse.swt.widgets.Composite parent)
Create the contents of your custom cell here
|
(package private) void |
dispose() |
protected void |
firePropertyChange(java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue) |
org.eclipse.swt.graphics.Color |
getBackground()
Returns the active background color.
|
org.eclipse.swt.graphics.Rectangle |
getBounds()
Returns the bounds of this cell, relative to the container's body.
|
org.eclipse.swt.graphics.Color |
getCellBackground()
Returns the stored background color.
|
org.eclipse.swt.graphics.Color |
getCellForeground()
Returns the stored foreground color.
|
boolean |
getChecked()
Returns whether or not this cell is checked.
|
int[] |
getChildSpan()
Get information on if and how the child area of this CTableTree will span
the columns.
|
org.eclipse.swt.graphics.Rectangle |
getClientArea()
Get the client area of this cell.
|
protected java.util.List |
getColorManagedControls()
Get a list containing all of the controls whose colors (foreground and background)
are managed by this cell.
|
CTreeColumn |
getColumn() |
protected org.eclipse.swt.widgets.Display |
getDisplay() |
protected java.util.List |
getEventManagedControls()
Get a list containing all of the controls whose events (such as mouse and keyboard)
are managed by this cell.
|
org.eclipse.swt.graphics.Font |
getFont()
Get the font in use by this cell.
|
org.eclipse.swt.graphics.Color |
getForeground()
Returns the active foreground color.
|
int |
getHeight() |
org.eclipse.swt.graphics.Image |
getImage() |
org.eclipse.swt.graphics.Image[] |
getImages() |
int |
getIndent() |
int |
getIndex() |
org.eclipse.swt.graphics.Point |
getLocation() |
boolean |
getPainted() |
org.eclipse.swt.graphics.Point |
getSize() |
int |
getStyle() |
java.lang.String |
getText() |
(package private) boolean |
getToggleVisible() |
int |
getWidth() |
protected void |
handleMouseEvent(org.eclipse.swt.widgets.Event event,
boolean selectionActive)
Give the Item a chance to handle the mouse event
|
(package private) void |
initialize() |
protected org.eclipse.swt.graphics.GC |
internalGC() |
boolean |
isCheckCell() |
boolean |
isOpen() |
boolean |
isSelected() |
(package private) boolean |
isToggle(int x,
int y) |
boolean |
isTreeCell() |
protected void |
layout() |
protected void |
layout(org.eclipse.swt.widgets.Control control) |
protected void |
layoutChild() |
protected void |
layoutChild(org.eclipse.swt.widgets.Control childControl) |
protected void |
locate(org.eclipse.swt.widgets.Control control) |
protected void |
locateChild() |
(package private) void |
paint(org.eclipse.swt.graphics.GC gc,
org.eclipse.swt.graphics.Rectangle ebounds) |
(package private) void |
paintCell(org.eclipse.swt.graphics.GC gc,
org.eclipse.swt.graphics.Point offset) |
boolean |
paintClientArea(org.eclipse.swt.graphics.GC gc,
org.eclipse.swt.graphics.Rectangle area) |
void |
redraw() |
void |
removeListener(int eventType,
org.eclipse.swt.widgets.Listener handler) |
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener) |
void |
removePropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener) |
protected void |
restoreState(java.util.Map memento) |
protected java.util.Map |
saveState() |
void |
setBackground(org.eclipse.swt.graphics.Color color) |
void |
setCheck(boolean check) |
void |
setChecked(boolean checked) |
void |
setChildSpan(int start,
int len)
Set which columns the Child Area of this CTableTreeCell will span.
The default setting is: start == -1 and len == 1. |
void |
setChildVisible(boolean visible) |
protected void |
setControlLayoutData(int horizontalAlignment,
int verticalAlignment) |
protected void |
setCursor(int id) |
protected void |
setExclusions(org.eclipse.swt.widgets.Control exclude) |
protected void |
setExclusions(java.util.List colors,
java.util.List events) |
boolean |
setFocus() |
void |
setFont(org.eclipse.swt.graphics.Font font) |
void |
setForeground(org.eclipse.swt.graphics.Color color) |
void |
setGridLine(boolean isGridLine) |
void |
setImage(org.eclipse.swt.graphics.Image image) |
void |
setImages(org.eclipse.swt.graphics.Image[] images) |
void |
setIndent(int indent) |
void |
setOpen(boolean open)
Requests the cell to either open or close
|
(package private) void |
setPainted(boolean painted) |
(package private) void |
setSelected(boolean selected)
Set the selection state of this cell.
|
void |
setText(java.lang.String string) |
void |
setToggleVisible(boolean visible)
Sets the visibility of the cell's Toggle
|
void |
setToggleVisible(boolean visible,
boolean ghost)
Sets the visibility of the cell's Toggle
|
void |
setVisible(boolean visible)
Sets the visibility of the cell
|
protected void |
snap(org.eclipse.swt.graphics.Rectangle bounds)
Called during setBounds.
|
boolean |
update()
Updates this cell with its item's data object, as returned by
item.getData().
|
boolean |
update(java.lang.Object element,
java.lang.String[] properties)
Updates the given properties of this CTableCell with the given element
|
protected void |
updateColors()
Update the background and foreground colors for the cell and any contained
controls.
|
public static final boolean carbon
public static final boolean gtk
public static final boolean win32
protected CTree ctree
protected CTreeItem item
protected int style
int hAlign
int vAlign
protected boolean open
protected boolean selected
protected boolean visible
protected boolean childVisible
protected boolean toggleVisible
protected boolean ghostToggle
protected boolean mouseDown
protected boolean mouseOver
protected boolean mouseOverToggle
public int marginLeft
public int marginWidth
public int marginRight
public int marginTop
public int marginHeight
public int marginBottom
public int toggleWidth
protected int indent
protected boolean isGridLine
protected boolean holdControl
public CTreeCell(CTreeItem item, int style)
public void addListener(int eventType, org.eclipse.swt.widgets.Listener handler)
eventType
- handler
- public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- public void addPropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
propertyName
- listener
- public void clear()
org.eclipse.swt.graphics.Point computeChildSize(int wHint, int hHint)
public org.eclipse.swt.graphics.Point computeClientSize(int wHint, int hHint)
wHint
- hHint
- Point
representing the computed sizeorg.eclipse.swt.graphics.Point computeControlSize(int wHint, int hHint)
public org.eclipse.swt.graphics.Point computeSize(int wHint, int hHint)
wHint
- hHint
- protected org.eclipse.swt.graphics.Point computeTextSize(int wHint, int hHint)
boolean contains(org.eclipse.swt.widgets.Control control)
control
- protected org.eclipse.swt.widgets.Control createChildControl(org.eclipse.swt.widgets.Composite parent)
parent
- the parent composite of your new controlprotected org.eclipse.swt.widgets.Control createControl(org.eclipse.swt.widgets.Composite parent)
parent
- the parent composite of your new controlvoid dispose()
protected void firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
propertyName
- oldValue
- newValue
- public org.eclipse.swt.graphics.Color getBackground()
activeBackground
,
getForeground()
,
setBackground(Color)
public org.eclipse.swt.graphics.Rectangle getBounds()
public org.eclipse.swt.graphics.Color getCellBackground()
storedBackground
public org.eclipse.swt.graphics.Color getCellForeground()
storedForeground
public boolean getChecked()
public int[] getChildSpan()
setChildSpan(int, int)
public org.eclipse.swt.graphics.Rectangle getClientArea()
protected java.util.List getColorManagedControls()
protected java.util.List getEventManagedControls()
public org.eclipse.swt.graphics.Font getFont()
public org.eclipse.swt.graphics.Color getForeground()
activeForeground
,
getBackground()
,
setForeground(Color)
public org.eclipse.swt.graphics.Image getImage()
public org.eclipse.swt.graphics.Image[] getImages()
public int getIndent()
public org.eclipse.swt.graphics.Point getLocation()
public boolean getPainted()
public org.eclipse.swt.graphics.Point getSize()
public int getIndex()
public int getHeight()
public int getWidth()
public CTreeColumn getColumn()
public int getStyle()
public java.lang.String getText()
boolean isToggle(int x, int y)
boolean getToggleVisible()
protected void handleMouseEvent(org.eclipse.swt.widgets.Event event, boolean selectionActive)
event
- the EventselectionActive
- void initialize()
protected org.eclipse.swt.graphics.GC internalGC()
public boolean isCheckCell()
public boolean isOpen()
public boolean isSelected()
public boolean isTreeCell()
protected void layout()
protected void layout(org.eclipse.swt.widgets.Control control)
protected void layoutChild()
protected void layoutChild(org.eclipse.swt.widgets.Control childControl)
protected void locate(org.eclipse.swt.widgets.Control control)
protected void locateChild()
void paint(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle ebounds)
gc
- the GC upon which the cell will be paintedebounds
- the bounding rectangle of the Container's paint eventvoid paintCell(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Point offset)
public boolean paintClientArea(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle area)
protected org.eclipse.swt.widgets.Display getDisplay()
public void redraw()
public void removeListener(int eventType, org.eclipse.swt.widgets.Listener handler)
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
public void removePropertyChangeListener(java.lang.String propertyName, java.beans.PropertyChangeListener listener)
protected void restoreState(java.util.Map memento)
protected java.util.Map saveState()
public void setBackground(org.eclipse.swt.graphics.Color color)
public void setCheck(boolean check)
public void setChecked(boolean checked)
public void setChildSpan(int start, int len)
setChildSpan(0, -1)
.start
- the column in which the child area will begin. A value of -1
indicates that the child area should begin in the same column
as its title area (same cell).len
- how many columns, starting with the one specified by 'start',
the child area will span. A value of '-1' indicates that the
child area should span all the way to the end of the last
column.getChildSpan()
public void setChildVisible(boolean visible)
protected void setControlLayoutData(int horizontalAlignment, int verticalAlignment)
protected void setCursor(int id)
protected void setExclusions(org.eclipse.swt.widgets.Control exclude)
protected void setExclusions(java.util.List colors, java.util.List events)
public boolean setFocus()
public void setFont(org.eclipse.swt.graphics.Font font)
public void setForeground(org.eclipse.swt.graphics.Color color)
public void setGridLine(boolean isGridLine)
public void setImage(org.eclipse.swt.graphics.Image image)
public void setImages(org.eclipse.swt.graphics.Image[] images)
public void setIndent(int indent)
public void setOpen(boolean open)
The base implementation creates the Child Area the first time setOpen(true) is called (if, of course, the cell was created with the SWT.DROP_DOWN style).
What exactly open refers to can be overridden by subclasses
open
- if true, the cell will open, otherwise it will closevoid setPainted(boolean painted)
void setSelected(boolean selected)
selected
- true if selected, false otherwisepublic void setText(java.lang.String string)
public void setToggleVisible(boolean visible)
visible
- public void setToggleVisible(boolean visible, boolean ghost)
If ghost is true, then the toggle will occupy space even when not visible - this is especially usefull for building trees
visible
- ghost
- public void setVisible(boolean visible)
visible
- protected void snap(org.eclipse.swt.graphics.Rectangle bounds)
bounds
- public boolean update()
update(Object, String[])
public boolean update(java.lang.Object element, java.lang.String[] properties)
Functionality is only provided for a basic cell, subclasses should override
element
- the data to use in updating the cellproperties
- the properties of the cell to be updatedprotected void updateColors()