Y
- indexing type for vertical axisX
- indexing type for horizontal axispublic class ButtonCellBehavior<X extends java.lang.Number,Y extends java.lang.Number> extends Painter<X,Y> implements org.eclipse.swt.widgets.Listener
When the cell is clicked the look of the cell becomes flat.
Only 2 pixel wide edge of cells is painted so the majority of the output of the underlying Painter.NAME_CELLS painter remains visible. Colors used are SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW, SWT.COLOR_WIDGET_LIGHT_SHADOW and SWT.COLOR_WIDGET_NORMAL_SHADOW.
Cells in the zone become not selectable.
Usage example:
new ButtonCellPainter(matrix.getColumnHeader());
collapsedImage, expanded, expandedImage, frozenX, frozenY, gc, hasChildren, image, isSelected, NAME_BACKGORUND, NAME_CELLS, NAME_DRAG_ITEM_X, NAME_DRAG_ITEM_Y, NAME_EMBEDDED_CONTROLS, NAME_EMULATED_CONTROLS, NAME_FOCUS_CELL, NAME_FREEZE_HEAD_LINE_X, NAME_FREEZE_HEAD_LINE_Y, NAME_FREEZE_TAIL_LINE_X, NAME_FREEZE_TAIL_LINE_Y, NAME_FROZEN_HEAD_HEAD, NAME_FROZEN_HEAD_NONE, NAME_FROZEN_HEAD_TAIL, NAME_FROZEN_NONE_HEAD, NAME_FROZEN_NONE_NONE, NAME_FROZEN_NONE_TAIL, NAME_FROZEN_TAIL_HEAD, NAME_FROZEN_TAIL_NONE, NAME_FROZEN_TAIL_TAIL, NAME_LINES_X, NAME_LINES_Y, nodeImageSize, SCOPE_CELLS, SCOPE_CELLS_ITEM_X, SCOPE_CELLS_ITEM_Y, SCOPE_CELLS_X, SCOPE_CELLS_Y, SCOPE_ENTIRE, SCOPE_LINES_X, SCOPE_LINES_Y, selectionHighlight, style, text, textLayout, textSize
Constructor and Description |
---|
ButtonCellBehavior(Zone<X,Y> zone) |
Modifier and Type | Method and Description |
---|---|
void |
clean()
Restores the default
GC settings modified by modified by in Painter.init()
or Painter.paint(int, int, int, int) . |
void |
handleEvent(org.eclipse.swt.widgets.Event e) |
protected boolean |
init()
Allows graphic optimization by performing operation that can be taken out
of the cell painting loop.
|
protected boolean |
isPushed(X indexX,
Y indexY)
Returns true if the cell at the specified location is in pushed state,
or false otherwise.
|
static void |
main(java.lang.String[] args) |
void |
paint(int x,
int y,
int width,
int height)
Draws on the canvas within the given boundaries according to the given indexes.
|
protected void |
paintIdle(int x,
int y,
int width,
int height)
Paints the cell when it is in the idle (not pushed) state.
|
protected void |
paintPushed(int x,
int y,
int width,
int height)
Paints the cell when it is in the pushed state.
|
void |
setup(X indexX,
Y indexY)
Configures the painter properties according to the given indexes.
|
align, clipText, computeSize, dispose, getData, getName, getScope, getZone, hasTreeLinesVisible, isEnabled, isTreeEnabled, setData, setEnabled, setNodeImages, setTreeLinesVisible, setTreeVisible, setupSpatial
public void handleEvent(org.eclipse.swt.widgets.Event e)
handleEvent
in interface org.eclipse.swt.widgets.Listener
protected boolean init()
Painter
If this method returns false the
Painter.paint(int, int, int, int)
and Painter.clean()
methods will not be executed.
public void setup(X indexX, Y indexY)
Painter
Default implementation invokes Painter.setupSpatial(Number, Number)
and determines if the cell is selected, therefore when overridden should
call super.setup
.
public void paint(int x, int y, int width, int height)
Painter
protected boolean isPushed(X indexX, Y indexY)
indexX
- index of a section item in the horizontal axisindexY
- index of a section item in the vertical axis.protected void paintPushed(int x, int y, int width, int height)
itemX
- index of a section item in the horizontal axisindexY
- index of a section item in the vertical axis.x
- the x coordinate of the painting boundariesy
- the y coordinate of the painting boundarieswidth
- the width of the painting boundariesheight
- the height of the painting boundariesprotected void paintIdle(int x, int y, int width, int height)
itemX
- index of a section item in the horizontal axisindexY
- index of a section item in the vertical axis.x
- the x coordinate of the painting boundariesy
- the y coordinate of the painting boundarieswidth
- the width of the painting boundariesheight
- the height of the painting boundariespublic void clean()
Painter
GC
settings modified by modified by in Painter.init()
or Painter.paint(int, int, int, int)
.public static void main(java.lang.String[] args)
Copyright © 2011 netanel.pl. All Rights Reserved.