|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.view.tabular.TableNodePainter
public class TableNodePainter
Dedicated painter implementation for
tables
. The painter
works by traversing the table and delegating the actual painting to
exchangeable subordinate painters that are responsible for painting
Nested Class Summary | |
---|---|
static class |
TableNodePainter.PainterType
Enumeration type for subordinate painter types of a TableNodePainter . |
Field Summary | |
---|---|
static java.lang.String |
ALTERNATE_COLUMN_SELECTION_STYLE_ID
Style property key used by the alternating painter instances when painting an odd-numbered and selected column of a TableGroupNodeRealizer . |
static java.lang.String |
ALTERNATE_COLUMN_STYLE_ID
Style property key used by the alternating painter instances when painting an odd-numbered, but not selected column of a TableGroupNodeRealizer . |
static java.lang.String |
ALTERNATE_ROW_SELECTION_STYLE_ID
Style property key used by the alternating painter instances when painting an odd-numbered and selected row of a TableGroupNodeRealizer . |
static java.lang.String |
ALTERNATE_ROW_STYLE_ID
Style property key used by the alternating painter instances when painting an odd-numbered, but not selected row of a TableGroupNodeRealizer . |
static java.lang.String |
COLUMN_SELECTION_STYLE_ID
Style property key for the visual style used when painting a selected column of a TableGroupNodeRealizer . |
static java.lang.String |
COLUMN_STYLE_ID
Style property key for the visual style used when painting an unselected column of a TableGroupNodeRealizer . |
static int |
IGNORE_INSET_ALL
Bit mask to ignore all inset types. |
static int |
IGNORE_INSET_COLUMN_ALL
Bit mask to ignore all column related insets types. |
static int |
IGNORE_INSET_COLUMN_BOTTOM
Type specifier to ignore bottom insets of columns. |
static int |
IGNORE_INSET_COLUMN_LEFT
Type specifier to ignore left insets of columns. |
static int |
IGNORE_INSET_COLUMN_RIGHT
Type specifier to ignore right insets of columns. |
static int |
IGNORE_INSET_COLUMN_TOP
Type specifier to ignore top insets of columns. |
static int |
IGNORE_INSET_NONE
Type specifier to ignore no inset types. |
static int |
IGNORE_INSET_ROW_ALL
Bit mask to ignore all row related insets types. |
static int |
IGNORE_INSET_ROW_BOTTOM
Type specifier to ignore bottom insets of rows. |
static int |
IGNORE_INSET_ROW_LEFT
Type specifier to ignore left insets of rows. |
static int |
IGNORE_INSET_ROW_RIGHT
Type specifier to ignore right insets of rows. |
static int |
IGNORE_INSET_ROW_TOP
Type specifier to ignore top insets of rows. |
static TableNodePainter.PainterType |
PAINTER_COLUMN_BACKGROUND
Identifier for the subordinate painter instance responsible for painting column backgrounds. |
static TableNodePainter.PainterType |
PAINTER_COLUMN_FOREGROUND
Identifier for the painter instance responsible for painting column foregrounds. |
static TableNodePainter.PainterType |
PAINTER_ROW_BACKGROUND
Identifier for the subordinate painter instance responsible for painting row backgrounds. |
static TableNodePainter.PainterType |
PAINTER_ROW_FOREGROUND
Identifier for the subordinate painter instance responsible for painting row foregrounds. |
static TableNodePainter.PainterType |
PAINTER_TABLE_BACKGROUND
Identifier for the subordinate painter instance responsible for painting the table background. |
static TableNodePainter.PainterType |
PAINTER_TABLE_FOREGROUND
Identifier for the subordinate painter instance responsible for painting the table foreground. |
static java.lang.String |
ROW_SELECTION_STYLE_ID
Style property key for the visual style used when painting a selected row of a TableGroupNodeRealizer . |
static java.lang.String |
ROW_STYLE_ID
Style property key for the visual style used when painting an unselected row of a TableGroupNodeRealizer . |
static java.lang.String |
TABLE_SELECTION_STYLE_ID
Style property key for the visual style used when painting the table of a selected TableGroupNodeRealizer . |
static java.lang.String |
TABLE_STYLE_ID
Style property key for the visual style used when painting the table of an unselected TableGroupNodeRealizer . |
Constructor Summary | |
---|---|
protected |
TableNodePainter()
Creates a new TableNodePainter instance without
any registered subordinate painter instances. |
Method Summary | |
---|---|
static TableGroupNodeRealizer.Column |
getColumn(NodeRealizer dummy)
Returns the Column that is currently being painted by the
subordinate painter of a TableNodePainter or null
if the painter is not responsible for column painting. |
int |
getIgnoredInsetTypes()
Returns a bit mask encoding the ignored inset types of the TableNodePainter . |
static TableGroupNodeRealizer |
getOriginalContext(NodeRealizer dummy)
Returns the TableGroupNodeRealizer that is being painted
by a TableNodePainter . |
static TableGroupNodeRealizer.Row |
getRow(NodeRealizer dummy)
Returns the Row that is currently being painted by the
subordinate painter of a TableNodePainter or null
if the painter is not responsible for row painting. |
GenericNodeRealizer.Painter |
getSubPainter(TableNodePainter.PainterType type)
Returns the subordinate painter instance for the specified type. |
static TableGroupNodeRealizer.Table |
getTable(NodeRealizer dummy)
Returns the Table of the TableGroupNodeRealizer
that is being painted by a TableNodePainter . |
static TableNodePainter |
newAlternatingColumnsInstance()
Creates a TableNodePainter that is configured to
use subordinate painters that alternate between the default column styles
and the styles registered for the
ALTERNATE_COLUMN_SELECTION_STYLE_ID and
ALTERNATE_COLUMN_STYLE_ID keys. |
static TableNodePainter |
newAlternatingInstance()
Creates a TableNodePainter that is configured to
use subordinate painters that alternate between the default column and row
styles and the styles registered for the corresponding
ALTERNATE_XXX style keys. |
static TableNodePainter |
newAlternatingRowsInstance()
Creates a TableNodePainter that is configured to
use subordinate painters that alternate between the default row styles
and the styles registered for the
ALTERNATE_ROW_SELECTION_STYLE_ID and
ALTERNATE_ROW_STYLE_ID keys. |
static TableNodePainter |
newBpmnInstance()
Creates a TableNodePainter that is configured to
use subordinate foreground painters (but no background painters) that
create a BPMN pool-like visual representation of the table. |
static TableNodePainter |
newDefaultInstance()
Creates a TableNodePainter that is configured to
use default subordinate painters. |
void |
paint(NodeRealizer context,
java.awt.Graphics2D graphics)
Paints the table node. |
protected void |
paintBackground(GenericNodeRealizer dummy,
java.awt.Graphics2D graphics,
boolean sloppy)
Paints the table node background. |
protected void |
paintForeground(GenericNodeRealizer dummy,
java.awt.Graphics2D graphics,
boolean sloppy)
Paints the table node foreground. |
protected void |
paintHotSpots(NodeRealizer context,
java.awt.Graphics2D graphics)
Paints the node's hot spots (that is resize handles). |
protected void |
paintNode(NodeRealizer context,
java.awt.Graphics2D graphics,
boolean sloppy)
Paints the actual table node by delegating to methods paintBackground
and
paintForeground
in this order. |
protected void |
paintPorts(NodeRealizer context,
java.awt.Graphics2D graphics)
Paints the node's ports. |
void |
paintSloppy(NodeRealizer context,
java.awt.Graphics2D graphics)
Paints the table node in sloppy mode. |
protected void |
paintText(NodeRealizer context,
java.awt.Graphics2D graphics)
Paints the node's labels. |
void |
setIgnoredInsetTypes(int ignoredInsetTypes)
Specifies a bit mask for inset types to ignore. |
void |
setSubPainter(TableNodePainter.PainterType type,
GenericNodeRealizer.Painter painter)
Sets a subordinate painter for the paint responsibilities represented by the specified type. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String TABLE_SELECTION_STYLE_ID
TableGroupNodeRealizer
.
TableStyle
,
Constant Field Valuespublic static final java.lang.String TABLE_STYLE_ID
TableGroupNodeRealizer
.
TableStyle
,
Constant Field Valuespublic static final java.lang.String ALTERNATE_COLUMN_SELECTION_STYLE_ID
TableGroupNodeRealizer
.
A column is considered to be odd-number, when the index of the column in
its container's column list is odd.
TableStyle
,
newAlternatingInstance()
,
newAlternatingColumnsInstance()
,
Constant Field Valuespublic static final java.lang.String ALTERNATE_COLUMN_STYLE_ID
TableGroupNodeRealizer
.
A column is considered to be odd-number, when the index of the column in
its container's column list is odd.
TableStyle
,
newAlternatingInstance()
,
newAlternatingColumnsInstance()
,
Constant Field Valuespublic static final java.lang.String COLUMN_SELECTION_STYLE_ID
TableGroupNodeRealizer
.
TableStyle
,
Constant Field Valuespublic static final java.lang.String COLUMN_STYLE_ID
TableGroupNodeRealizer
.
TableStyle
,
Constant Field Valuespublic static final java.lang.String ROW_SELECTION_STYLE_ID
TableGroupNodeRealizer
.
TableStyle
,
Constant Field Valuespublic static final java.lang.String ROW_STYLE_ID
TableGroupNodeRealizer
.
TableStyle
,
Constant Field Valuespublic static final java.lang.String ALTERNATE_ROW_SELECTION_STYLE_ID
TableGroupNodeRealizer
.
A row is considered to be odd-number, when the index of the row in
its container's row list is odd.
TableStyle
,
newAlternatingInstance()
,
newAlternatingRowsInstance()
,
Constant Field Valuespublic static final java.lang.String ALTERNATE_ROW_STYLE_ID
TableGroupNodeRealizer
.
A row is considered to be odd-number, when the index of the row in
its container's row list is odd.
TableStyle
,
newAlternatingInstance()
,
newAlternatingRowsInstance()
,
Constant Field Valuespublic static final TableNodePainter.PainterType PAINTER_TABLE_FOREGROUND
getSubPainter(y.view.tabular.TableNodePainter.PainterType)
,
setSubPainter(y.view.tabular.TableNodePainter.PainterType, y.view.GenericNodeRealizer.Painter)
public static final TableNodePainter.PainterType PAINTER_TABLE_BACKGROUND
getSubPainter(y.view.tabular.TableNodePainter.PainterType)
,
setSubPainter(y.view.tabular.TableNodePainter.PainterType, y.view.GenericNodeRealizer.Painter)
public static final TableNodePainter.PainterType PAINTER_COLUMN_FOREGROUND
getSubPainter(y.view.tabular.TableNodePainter.PainterType)
,
setSubPainter(y.view.tabular.TableNodePainter.PainterType, y.view.GenericNodeRealizer.Painter)
public static final TableNodePainter.PainterType PAINTER_COLUMN_BACKGROUND
getSubPainter(y.view.tabular.TableNodePainter.PainterType)
,
setSubPainter(y.view.tabular.TableNodePainter.PainterType, y.view.GenericNodeRealizer.Painter)
public static final TableNodePainter.PainterType PAINTER_ROW_FOREGROUND
getSubPainter(y.view.tabular.TableNodePainter.PainterType)
,
setSubPainter(y.view.tabular.TableNodePainter.PainterType, y.view.GenericNodeRealizer.Painter)
public static final TableNodePainter.PainterType PAINTER_ROW_BACKGROUND
getSubPainter(y.view.tabular.TableNodePainter.PainterType)
,
setSubPainter(y.view.tabular.TableNodePainter.PainterType, y.view.GenericNodeRealizer.Painter)
public static final int IGNORE_INSET_ALL
setIgnoredInsetTypes(int)
,
getIgnoredInsetTypes()
,
Constant Field Valuespublic static final int IGNORE_INSET_NONE
setIgnoredInsetTypes(int)
,
getIgnoredInsetTypes()
,
Constant Field Valuespublic static final int IGNORE_INSET_COLUMN_TOP
setIgnoredInsetTypes(int)
,
getIgnoredInsetTypes()
,
Constant Field Valuespublic static final int IGNORE_INSET_COLUMN_LEFT
setIgnoredInsetTypes(int)
,
getIgnoredInsetTypes()
,
Constant Field Valuespublic static final int IGNORE_INSET_COLUMN_BOTTOM
setIgnoredInsetTypes(int)
,
getIgnoredInsetTypes()
,
Constant Field Valuespublic static final int IGNORE_INSET_COLUMN_RIGHT
setIgnoredInsetTypes(int)
,
getIgnoredInsetTypes()
,
Constant Field Valuespublic static final int IGNORE_INSET_ROW_TOP
setIgnoredInsetTypes(int)
,
getIgnoredInsetTypes()
,
Constant Field Valuespublic static final int IGNORE_INSET_ROW_LEFT
setIgnoredInsetTypes(int)
,
getIgnoredInsetTypes()
,
Constant Field Valuespublic static final int IGNORE_INSET_ROW_BOTTOM
setIgnoredInsetTypes(int)
,
getIgnoredInsetTypes()
,
Constant Field Valuespublic static final int IGNORE_INSET_ROW_RIGHT
setIgnoredInsetTypes(int)
,
getIgnoredInsetTypes()
,
Constant Field Valuespublic static final int IGNORE_INSET_COLUMN_ALL
setIgnoredInsetTypes(int)
,
getIgnoredInsetTypes()
,
Constant Field Valuespublic static final int IGNORE_INSET_ROW_ALL
setIgnoredInsetTypes(int)
,
getIgnoredInsetTypes()
,
Constant Field ValuesConstructor Detail |
---|
protected TableNodePainter()
TableNodePainter
instance without
any registered subordinate painter instances.
Method Detail |
---|
public static TableNodePainter newDefaultInstance()
TableNodePainter
that is configured to
use default subordinate painters.
VisualStyle
instance
from the table realizer's registered style properties using the
appropriate key (see below).
TableStyle.getBorderFillColor(NodeRealizer)
,
TableStyle.getBorderLineColor(NodeRealizer)
,
and
TableStyle.getBorderLineType(NodeRealizer)
null
, the border area defined by the insets
is painted using these colors and stroke.
Then, the table's, column's, or row's inner area is painted
using the colors and stroke defined by the style's
TableStyle.getFillColor(NodeRealizer)
,
TableStyle.getLineColor(NodeRealizer)
,
and
TableStyle.getLineType(NodeRealizer)
null
, the complete table, column, or row area is painted
using these latter colors and stroke.
fillColor
, lineColor
,
and lineType
.
TableStyle
,
GenericNodeRealizer.getStyleProperty(String)
public static TableNodePainter newAlternatingInstance()
TableNodePainter
that is configured to
use subordinate painters that alternate between the default column and row
styles and the styles registered for the corresponding
ALTERNATE_XXX
style keys. The default styles are used for
columns and rows with an even index in their container's list of columns
or rows and the alternate styles will be used for columns and rows with
an odd index.
The actual painting behavior is the same as for
newDefaultInstance()
.
newDefaultInstance()
,
ALTERNATE_COLUMN_SELECTION_STYLE_ID
,
ALTERNATE_COLUMN_STYLE_ID
,
ALTERNATE_ROW_SELECTION_STYLE_ID
,
ALTERNATE_ROW_STYLE_ID
public static TableNodePainter newAlternatingColumnsInstance()
TableNodePainter
that is configured to
use subordinate painters that alternate between the default column styles
and the styles registered for the
ALTERNATE_COLUMN_SELECTION_STYLE_ID
and
ALTERNATE_COLUMN_STYLE_ID
keys.
The default styles are used for columns with an even index in their
container's list of columns and the alternate styles will be used for
columns with an odd index.
The actual painting behavior is the same as for
newDefaultInstance()
.
newDefaultInstance()
,
ALTERNATE_COLUMN_SELECTION_STYLE_ID
,
ALTERNATE_COLUMN_STYLE_ID
public static TableNodePainter newAlternatingRowsInstance()
TableNodePainter
that is configured to
use subordinate painters that alternate between the default row styles
and the styles registered for the
ALTERNATE_ROW_SELECTION_STYLE_ID
and
ALTERNATE_ROW_STYLE_ID
keys.
The default styles are used for rows with an even index in their
container's list of rows and the alternate styles will be used for
rows with an odd index.
The actual painting behavior is the same as for
newDefaultInstance()
.
newDefaultInstance()
,
ALTERNATE_ROW_SELECTION_STYLE_ID
,
ALTERNATE_ROW_STYLE_ID
public static TableNodePainter newBpmnInstance()
TableNodePainter
that is configured to
use subordinate foreground painters (but no background painters) that
create a BPMN pool-like visual representation of the table.
public GenericNodeRealizer.Painter getSubPainter(TableNodePainter.PainterType type)
type
- the painter type specifying which painter instance to retrieve.
public void setSubPainter(TableNodePainter.PainterType type, GenericNodeRealizer.Painter painter)
type
- the type representing a specific set of painting
responsibilities.painter
- the painter to handle the responsibilities represented
by the specified type.public int getIgnoredInsetTypes()
TableNodePainter
.
Defaults to IGNORE_INSET_NONE
.
TableNodePainter
setIgnoredInsetTypes(int)
public void setIgnoredInsetTypes(int ignoredInsetTypes)
E.g. suppose you have set the mask to IGNORE_INSET_COLUMN_LEFT
.
Suppose further there is one top level column, such that
column.calculateBounds().getX() == 0 column.getInsets().left == 10Ordinarily, the painters responsible for painting a column's first child would be invoked with a dummy realizer whose x-coordinate equals
10
. However, due to left column insets being ignored,
the dummy's x-coordinate will equal 0
.
TableGroupNodeRealizer.Column.calculateBounds()
or TableGroupNodeRealizer.Row.calculateBounds()
.
Consequently, ignoring these insets for painting might result in the visual
representation of a table node being out-of-sync with the geometric bounds
being used for selecting/resizing/reordering columns and rows using
TableSelectionEditor
/
TableSizeEditor
/
TableOrderEditor
.
Defaults to IGNORE_INSET_NONE
.
ignoredInsetTypes
- the mask for inset types to ignore.
Either IGNORE_INSET_NONE
, IGNORE_INSET_ALL
,
or a bit-wise combination of
getIgnoredInsetTypes()
public void paint(NodeRealizer context, java.awt.Graphics2D graphics)
.paintHotSpots(context, graphics);
paintNode(context, graphics, false);
paintText(context, graphics);
paint
in interface GenericNodeRealizer.Painter
protected void paintHotSpots(NodeRealizer context, java.awt.Graphics2D graphics)
paint(NodeRealizer, Graphics2D)
to
draw the hot spots of the node if necessary.
By default it calls the context's
paintHotSpots
method if the context is selected.
context
- the node realizer for which hot spots may be drawn.graphics
- the graphics to draw on.protected void paintPorts(NodeRealizer context, java.awt.Graphics2D graphics)
paint(NodeRealizer, Graphics2D)
to
draw the ports of the node. By default it calls the context's
paintPorts
method.
context
- the node realizer for which node ports should be drawn.graphics
- the graphics to draw on.protected void paintText(NodeRealizer context, java.awt.Graphics2D graphics)
paint(NodeRealizer, Graphics2D)
to
draw the labels of the node. By default it calls the context's
paintText
method
if the context has at least one label.
context
- the node realizer for which the labels should be drawn.graphics
- the graphics to draw on.public void paintSloppy(NodeRealizer context, java.awt.Graphics2D graphics)
paintNode(context, graphics, true);
paintSloppy
in interface GenericNodeRealizer.Painter
protected void paintNode(NodeRealizer context, java.awt.Graphics2D graphics, boolean sloppy)
paintBackground
and
paintForeground
in this order.
A dummy realizer of type GenericNodeRealizer
will be passed
to the two aforementioned methods.
The bounds of the dummy will be set to be the bounds of the table,
column, or row that should be painted.
The dummy's GenericNodeRealizer.getUserData()
method
will return the original TableGroupNodeRealizer
's user
data. Moreover, methods
getOriginalContext(y.view.NodeRealizer)
,
getColumn(y.view.NodeRealizer)
,
getTable(y.view.NodeRealizer)
, and
getRow(y.view.NodeRealizer)
can be used to extract useful
information from the dummy.
context
- the context node to paint.graphics
- the graphics context to paint upon.sloppy
- whether or not to paint the node sloppily.paintBackground(y.view.GenericNodeRealizer, java.awt.Graphics2D, boolean)
,
paintForeground(y.view.GenericNodeRealizer, java.awt.Graphics2D, boolean)
protected void paintBackground(GenericNodeRealizer dummy, java.awt.Graphics2D graphics, boolean sloppy)
See
paintNode
for how to access context information provided by the dummy.
Called from
paintNode(y.view.NodeRealizer, java.awt.Graphics2D, boolean)
.
dummy
- a dummy whose geometry is set to match the table, column,
or row that should be painted.graphics
- the graphics context to paint upon.sloppy
- whether or not to paint the node sloppily.paintNode(y.view.NodeRealizer, java.awt.Graphics2D, boolean)
,
paintForeground(y.view.GenericNodeRealizer, java.awt.Graphics2D, boolean)
protected void paintForeground(GenericNodeRealizer dummy, java.awt.Graphics2D graphics, boolean sloppy)
See
paintNode
for how to access context information provided by the dummy.
Called from
paintNode(y.view.NodeRealizer, java.awt.Graphics2D, boolean)
.
dummy
- a dummy whose geometry is set to match the table, column,
or row that should be painted.graphics
- the graphics context to paint upon.sloppy
- whether or not to paint the node sloppily.paintNode(y.view.NodeRealizer, java.awt.Graphics2D, boolean)
,
paintBackground(y.view.GenericNodeRealizer, java.awt.Graphics2D, boolean)
public static TableGroupNodeRealizer getOriginalContext(NodeRealizer dummy)
TableGroupNodeRealizer
that is being painted
by a TableNodePainter
.
dummy
- the dummy GenericNodeRealizer
instance
that is passed to the
paint
and
paintSloppy
methods of a TableNodePainter
's subordinate painter.
TableGroupNodeRealizer
that is being painted
by a TableNodePainter
.public static TableGroupNodeRealizer.Table getTable(NodeRealizer dummy)
Table
of the TableGroupNodeRealizer
that is being painted by a TableNodePainter
.
dummy
- the dummy GenericNodeRealizer
instance
that is passed to the
paint
and
paintSloppy
methods of a TableNodePainter
's subordinate painter.
Table
of the TableGroupNodeRealizer
that is being painted by a TableNodePainter
.public static TableGroupNodeRealizer.Column getColumn(NodeRealizer dummy)
Column
that is currently being painted by the
subordinate painter of a TableNodePainter
or null
if the painter is not responsible for column painting.
dummy
- the dummy GenericNodeRealizer
instance
that is passed to the
paint
and
paintSloppy
methods of a TableNodePainter
's subordinate painter.
Column
that is currently being painted by the
subordinate painter of a TableNodePainter
or null
if the painter is not responsible for column painting.public static TableGroupNodeRealizer.Row getRow(NodeRealizer dummy)
Row
that is currently being painted by the
subordinate painter of a TableNodePainter
or null
if the painter is not responsible for row painting.
dummy
- the dummy GenericNodeRealizer
instance
that is passed to the
paint
and
paintSloppy
methods of a TableNodePainter
's subordinate painter.
Row
that is currently being painted by the
subordinate painter of a TableNodePainter
or null
if the painter is not responsible for row painting.
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |