Search this API

y.view.tabular
Class TableGroupNodeRealizer

java.lang.Object
  extended by y.view.NodeRealizer
      extended by y.view.GenericNodeRealizer
          extended by y.view.hierarchy.GenericGroupNodeRealizer
              extended by y.view.tabular.TableGroupNodeRealizer
All Implemented Interfaces:
NodeLayout, GroupFeature, MouseInputEditorProvider

public class TableGroupNodeRealizer
extends GenericGroupNodeRealizer

A node realizer for group nodes that may be used to organize its content nodes into columns and/or rows. The realizer's columns and rows are stored in a hierarchical fashion (i.e. each column may contain child columns, each row may contain child rows) with the top-level columns and rows being stored in a table structure that is accessible via getTable(). A node is considered to belong to a column or row, if the realizer's associated group node is the node's parent according to HierarchyManager.getParentNode(y.base.Node) and the node's center is contained in the bounding box of the column or row.

IncrementalHierarchicLayouter provides layout support for table nodes. However, the tabular data represented by table nodes has to be explicitly prepared for layout calculation. Using Graph2DLayoutExecutor this can be done in the following way:

 IncrementalHierarchicLayouter ihl = ...
 Graph2DLayoutExecutor g2dle = ...

 // the important line
 g2dle.setConfiguringTableNodeRealizers(true);

 g2dle.doLayout(graph, ihl);
 

 

Nested Class Summary
static interface TableGroupNodeRealizer.Column
          A Column is a vertical stripe of a given width within a node represented by a TableGroupNodeRealizer.
static interface TableGroupNodeRealizer.ColumnContainer
          A container for columns.
static class TableGroupNodeRealizer.ColumnNodeLabelModel
          NodeLabelModel that positions a node label relative to a column in a TableGroupNodeRealizer's table model.
static interface TableGroupNodeRealizer.Row
          A Row is a horizontal stripe of a given height within a node represented by a TableGroupNodeRealizer.
static interface TableGroupNodeRealizer.RowContainer
          A container for rows.
static class TableGroupNodeRealizer.RowNodeLabelModel
          NodeLabelModel that positions a node label relative to a row in a TableGroupNodeRealizer's table model.
static interface TableGroupNodeRealizer.Table
          Stores the top-level columns and rows of a TableGroupNodeRealizer and provides methods for finding columns and rows according to contained nodes or coordinates as well as methods to move a node into a column or row.
 
Nested classes/interfaces inherited from class y.view.hierarchy.GenericGroupNodeRealizer
GenericGroupNodeRealizer.GenericAutoBoundsFeature
 
Nested classes/interfaces inherited from class y.view.GenericNodeRealizer
GenericNodeRealizer.BoundsChangedHandler, GenericNodeRealizer.ContainsTest, GenericNodeRealizer.Factory, GenericNodeRealizer.GenericMouseInputEditorProvider, GenericNodeRealizer.GenericSizeConstraintProvider, GenericNodeRealizer.HotSpotHitTest, GenericNodeRealizer.HotSpotPainter, GenericNodeRealizer.Initializer, GenericNodeRealizer.IntersectionTest, GenericNodeRealizer.LabelBoundsChangedHandler, GenericNodeRealizer.LabelFactory, GenericNodeRealizer.LayerHandler, GenericNodeRealizer.Painter, GenericNodeRealizer.PortCandidateListProvider, GenericNodeRealizer.SelectionChangeHandler, GenericNodeRealizer.UnionRectCalculator, GenericNodeRealizer.UserDataHandler
 
Field Summary
 
Fields inherited from class y.view.NodeRealizer
height, HOTSPOT_E, HOTSPOT_N, HOTSPOT_NE, HOTSPOT_NONE, HOTSPOT_NW, HOTSPOT_S, HOTSPOT_SE, HOTSPOT_SW, HOTSPOT_W, width, x, y
 
Constructor Summary
TableGroupNodeRealizer()
          Creates a new TableGroupNodeRealizer that uses the default configuration.
TableGroupNodeRealizer(NodeRealizer nr)
          Creates a new TableGroupNodeRealizer that adopts as much of the specified prototype realizer's settings as possible.
 
Method Summary
protected  void adoptValues(GenericNodeRealizer nr)
          Tries to copy all the values from the given instance to this instance.
 void configureColumnLabel(NodeLabel nl, TableGroupNodeRealizer.Column c, boolean inside, double topBottomRatio)
          Configures the specified label as a column label for the specified column.
 void configureRowLabel(NodeLabel nl, TableGroupNodeRealizer.Row r, boolean inside, double leftRightRatio)
          Configures the specified label as a row label for the specified row.
 NodeRealizer createCopy(NodeRealizer nr)
          Creates a copy of the given Realizer, using as much information as possible from the given instance to create a new GenericNodeRealizer instance.
static java.util.Map createDefaultConfigurationMap()
          Returns a map containing the default configuration for this realizer.
 YInsets getDefaultColumnInsets()
          Returns the default column insets.
 double getDefaultColumnWidth()
          Returns the default width of columns.
 double getDefaultMinimumColumnWidth()
          Returns the default minimum width of columns.
 double getDefaultMinimumRowHeight()
          Returns the default minimum height of rows.
 double getDefaultRowHeight()
          Returns the default height of rows.
 YInsets getDefaultRowInsets()
          Returns the default row insets.
 TableGroupNodeRealizer.Table getTable()
          Returns the table model associated to this realizer.
 boolean isAutoResizeTable()
          Determines whether resizing this realizer should automatically resize columns and rows of the associated table model accordingly.
 void read(java.io.ObjectInputStream in)
          Deprecated. Use the GraphML format instead.
 void setAutoResizeTable(boolean autoResizeTable)
          Specifies whether resizing this realizer should automatically resize columns and rows of the associated table model accordingly.
 void setDefaultColumnInsets(YInsets defaultColumnInsets)
          Specifies the default column insets.
 void setDefaultColumnWidth(double defaultColumnWidth)
          Specifies the default width of columns.
 void setDefaultMinimumColumnWidth(double defaultMinimumColumnWidth)
          Specifies the default minimum width of column.
 void setDefaultMinimumRowHeight(double defaultMinimumRowHeight)
          Specifies the default minimum height of rows.
 void setDefaultRowHeight(double defaultRowHeight)
          Specifies the default height of rows.
 void setDefaultRowInsets(YInsets defaultRowInsets)
          Specifies the default row insets.
 void setFrame(double x, double y, double width, double height)
          Sets the size and location of the realizer.
 void setFrame(java.awt.geom.Rectangle2D frame)
          Sets the size and location of the realizer.
 void setSize(double width, double height)
          Sets the size of the realizer.
protected  void sizeChanged(java.awt.geom.Rectangle2D oldBounds)
          Callback method invoked from setFrame and setSize.
 void updateTableBounds()
          Ensures that the bounds of the realizer encompass the bounds of all columns and rows in its table model as well as that the bounds of any given column (row) encompasses the bounds of all of its child columns (rows).
 void write(java.io.ObjectOutputStream out)
          Deprecated. Use the GraphML format instead.
 
Methods inherited from class y.view.hierarchy.GenericGroupNodeRealizer
calcUnionRect, getAutoBoundsFeature, getBorderInsets, getBoundingBox, getClosedHeight, getClosedWidth, getMinimalInsets, getStateChangeListener, isAutoResize, isBoundsDirty, isGroupClosed, setAutoResize, setBorderInsets, setBorderInsets, setBoundsDirty, setClosedHeight, setClosedWidth, setGroupClosed, setMinimalInsets, setMinimalInsets
 
Methods inherited from class y.view.GenericNodeRealizer
boundsChanged, contains, createNodeLabel, findIntersection, findMouseInputEditor, getConfiguration, getFactory, getLayer, getMouseInputEditorProvider, getPortCandidates, getSizeConstraintProvider, getStyleProperties, getStyleProperty, getUserData, hotSpotHit, labelBoundsChanged, paint, paintHotSpots, paintNode, paintSloppy, removeStyleProperty, setConfiguration, setLayer, setStyleProperty, setUserData
 
Methods inherited from class y.view.NodeRealizer
addLabel, addPort, calcUnionRect, calcUnionRectImpl, calcUnionRectLabels, calcUnionRectPorts, createCopy, findBBIntersection, getCenterX, getCenterY, getFillColor, getFillColor2, getHeight, getHotSpotColor, getLabel, getLabel, getLabelText, getLineColor, getLineType, getNode, getPort, getSloppySelectionColor, getWidth, getX, getY, intersects, invalidatePortPositions, isInBox, isSelected, isTransparent, isVisible, labelCount, moveBy, paintLayer, paintLayerSloppy, paintPorts, paintText, portCount, removeLabel, removeLabel, removePort, removePort, repaint, setCenter, setCenterX, setCenterY, setEdgesDirty, setFillColor, setFillColor2, setHeight, setHotSpotColor, setLabel, setLabelText, setLayer, setLineColor, setLineType, setLocation, setSelected, setSloppySelectionColor, setTransparent, setVisible, setWidth, setX, setY
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableGroupNodeRealizer

public TableGroupNodeRealizer()
Creates a new TableGroupNodeRealizer that uses the default configuration.

See Also:
createDefaultConfigurationMap()

TableGroupNodeRealizer

public TableGroupNodeRealizer(NodeRealizer nr)
Creates a new TableGroupNodeRealizer that adopts as much of the specified prototype realizer's settings as possible.

Parameters:
nr - a prototype realizer.
Method Detail

isAutoResizeTable

public boolean isAutoResizeTable()
Determines whether resizing this realizer should automatically resize columns and rows of the associated table model accordingly.

Returns:
true if resizing the realizer will automatically resize columns and rows of the associated table model accordingly; false otherwise.
See Also:
setAutoResizeTable(boolean), setSize(double, double), setFrame(double, double, double, double)

setAutoResizeTable

public void setAutoResizeTable(boolean autoResizeTable)
Specifies whether resizing this realizer should automatically resize columns and rows of the associated table model accordingly.

Parameters:
autoResizeTable - if true, resizing the realizer will automatically resize columns and rows of the associated table model accordingly.
See Also:
isAutoResizeTable(), setSize(double, double), setFrame(double, double, double, double)

updateTableBounds

public void updateTableBounds()
Ensures that the bounds of the realizer encompass the bounds of all columns and rows in its table model as well as that the bounds of any given column (row) encompasses the bounds of all of its child columns (rows).


adoptValues

protected void adoptValues(GenericNodeRealizer nr)
Description copied from class: GenericNodeRealizer
Tries to copy all the values from the given instance to this instance. Customization interfaces will be copied by reference, user-defined data will be copied using the GenericNodeRealizer.UserDataHandler implementation or by reference if no such handler is registered with the argument's instance.

Overrides:
adoptValues in class GenericGroupNodeRealizer
Parameters:
nr - the realizer to obtain the configuration from

createCopy

public NodeRealizer createCopy(NodeRealizer nr)
Description copied from class: GenericNodeRealizer
Creates a copy of the given Realizer, using as much information as possible from the given instance to create a new GenericNodeRealizer instance.

Overrides:
createCopy in class GenericGroupNodeRealizer
Parameters:
nr - the realizer to create the copy of
Returns:
a instance of GenericNodeRealizer

getTable

public TableGroupNodeRealizer.Table getTable()
Returns the table model associated to this realizer. Initially, the table contains one column and one row.

Returns:
the table model associated to this realizer.

getDefaultColumnWidth

public double getDefaultColumnWidth()
Returns the default width of columns. This value determines the initial width for each column that is created.

The default value for this property is 30.

Returns:
the default width of columns.
See Also:
setDefaultColumnWidth(double)

setDefaultColumnWidth

public void setDefaultColumnWidth(double defaultColumnWidth)
Specifies the default width of columns. Changing this value will only affect the initial width of columns that are created afterwards.

The default value for this property is 30.

Parameters:
defaultColumnWidth - the new default width of columns.
See Also:
getDefaultColumnWidth()

getDefaultMinimumColumnWidth

public double getDefaultMinimumColumnWidth()
Returns the default minimum width of columns. This value determines the initial minimum width for each column that is created.

The default value for this property is 30.

Returns:
the default minimum width of columns.
See Also:
setDefaultMinimumColumnWidth(double)

setDefaultMinimumColumnWidth

public void setDefaultMinimumColumnWidth(double defaultMinimumColumnWidth)
Specifies the default minimum width of column. Changing this value will only affect the initial minimum width of columns that are created afterwards.

The default value for this property is 30.

Parameters:
defaultMinimumColumnWidth - the new default minimum width of columns.
See Also:
getDefaultMinimumColumnWidth()

getDefaultColumnInsets

public YInsets getDefaultColumnInsets()
Returns the default column insets. This value determines the initial insets for each column that is created.

The default value for this property is null.

Returns:
the default column insets.
See Also:
setDefaultColumnInsets(y.geom.YInsets)

setDefaultColumnInsets

public void setDefaultColumnInsets(YInsets defaultColumnInsets)
Specifies the default column insets. Changing this value will only affect the initial insets of columns that are created afterwards.

The default value for this property is null.

Parameters:
defaultColumnInsets - the new default insets for columns.
See Also:
getDefaultColumnInsets()

getDefaultRowHeight

public double getDefaultRowHeight()
Returns the default height of rows. This value determines the initial height for each row that is created.

The default value for this property is 30.

Returns:
the default height of rows.
See Also:
setDefaultRowHeight(double)

setDefaultRowHeight

public void setDefaultRowHeight(double defaultRowHeight)
Specifies the default height of rows. Changing this value will only affect the initial height of rows that are created afterwards.

The default value for this property is 30.

Parameters:
defaultRowHeight - the new default height of rows.
See Also:
getDefaultRowHeight()

getDefaultMinimumRowHeight

public double getDefaultMinimumRowHeight()
Returns the default minimum height of rows. This value determines the initial minimum height for each row that is created.

The default value for this property is 30.

Returns:
the default minimum height of rows.
See Also:
setDefaultMinimumRowHeight(double)

setDefaultMinimumRowHeight

public void setDefaultMinimumRowHeight(double defaultMinimumRowHeight)
Specifies the default minimum height of rows. Changing this value will only affect the initial minimum height of rows that are created afterwards.

The default value for this property is 30.

Parameters:
defaultMinimumRowHeight - the new default minimum height of rows.
See Also:
getDefaultMinimumRowHeight()

getDefaultRowInsets

public YInsets getDefaultRowInsets()
Returns the default row insets. This value determines the initial insets for each row that is created.

The default value for this property is null.

Returns:
the default row insets.
See Also:
setDefaultRowInsets(y.geom.YInsets)

setDefaultRowInsets

public void setDefaultRowInsets(YInsets defaultRowInsets)
Specifies the default row insets. Changing this value will only affect the initial insets of rows that are created afterwards.

The default value for this property is null.

Parameters:
defaultRowInsets - the new default insets for rows.
See Also:
getDefaultRowInsets()

createDefaultConfigurationMap

public static java.util.Map createDefaultConfigurationMap()
Returns a map containing the default configuration for this realizer.
Interface Implementation
Painter default table painter
ContainsTest no implementation, i.e. delegates to NodeRealizer.contains(double, double)
Initializer no implementation, i.e. does nothing
HotSpotHitTest specialized implementation that rejects any and all hotspot hits
HotSpotPainter specialized implementation that does not paint any hotspots at all
GenericMouseInputEditorProvider MultiplexingNodeEditor that uses subordinate editors
GenericAutoBoundsFeature specialized implementation that takes column top and bottom as well as row left and right insets into account
GenericSizeConstraintProvider specialized implementation that calculates the minimum size according to the accumulated minimum sizes (and insets) of the table model's columns and rows
LabelBoundsChangedHandler DefaultGenericAutoBoundsFeature

Returns:
a map containing the default configuration for this realizer.

configureColumnLabel

public void configureColumnLabel(NodeLabel nl,
                                 TableGroupNodeRealizer.Column c,
                                 boolean inside,
                                 double topBottomRatio)
Configures the specified label as a column label for the specified column. The label is assigned a TableGroupNodeRealizer.ColumnNodeLabelModel (if it does not already use one) and a suitable model parameter corresponding to the specified column and position.

Parameters:
nl - the label to configure.
c - the column to which associate the label to.
inside - if true the label is positioned within the bounds of the specified column; if false the label is positioned right above or right below the specified column according to the specified top to bottom ratio.
topBottomRatio - a value in [0,1] specifying the vertical position of the label. If the label is placed within the column bounds, 0 means at the top, 1 means at the bottom. If the label is placed outside the column, values less than 0.5 result in a "right above" placement while values equal to or greater than 0.5 result in a "right below" placement.

configureRowLabel

public void configureRowLabel(NodeLabel nl,
                              TableGroupNodeRealizer.Row r,
                              boolean inside,
                              double leftRightRatio)
Configures the specified label as a row label for the specified row. The label is assigned a TableGroupNodeRealizer.RowNodeLabelModel (if it does not already use one) and a suitable model parameter corresponding to the specified row and position. Additionally, "left aligned" labels will be rotated to 270 degrees clockwise while "right aligned" labels will be rotated to 90 degrees clockwise.

Parameters:
nl - the label to configure.
r - the row to which associate the label to.
inside - if true the label is positioned within the bounds of the specified row; if false the label is positioned to the left or to the right of the specified row according to the specified left to right ratio.
leftRightRatio - a value in [0,1] specifying the horizontal position of the label. If the label is placed within the row bounds, 0 means to the left, 1 means to the right. If the label is placed outside the row, values less than 0.5 result in a "to the left" placement while values equal to or greater than 0.5 result in a "to the right" placement. Additionally, the rotation angle of "left aligned" labels is set to 270 degrees while the rotation angle of "right aligned" labels is set to 90 degrees.

read

public void read(java.io.ObjectInputStream in)
          throws java.io.IOException,
                 java.lang.ClassNotFoundException
Deprecated. Use the GraphML format instead.

Description copied from class: NodeRealizer
Reads in the serialized form of this realizer. The realizer must have been written out before by it's NodeRealizer.write(ObjectOutputStream) method.

Overrides:
read in class GenericGroupNodeRealizer
Throws:
java.io.IOException
java.lang.ClassNotFoundException

write

public void write(java.io.ObjectOutputStream out)
           throws java.io.IOException
Deprecated. Use the GraphML format instead.

Description copied from class: NodeRealizer
Writes this realizer in a serialized form to the given stream.

Overrides:
write in class GenericGroupNodeRealizer
Throws:
java.io.IOException

setSize

public void setSize(double width,
                    double height)
Sets the size of the realizer. Overwritten to invoke sizeChanged(java.awt.geom.Rectangle2D).

Specified by:
setSize in interface NodeLayout
Overrides:
setSize in class NodeRealizer
Parameters:
width - the new width.
height - the new height.

setFrame

public void setFrame(double x,
                     double y,
                     double width,
                     double height)
Sets the size and location of the realizer. Overwritten to invoke sizeChanged(java.awt.geom.Rectangle2D).

Note: This method does not call this realizer's version of setSize and setLocation but rather the super class implementations.

Overrides:
setFrame in class NodeRealizer
Parameters:
x - the new x-coordinate of the upper left corner of the realizer.
y - the new y-coordinate of the upper left corner of the realizer.
width - the new width of the realizer.
height - the new height of the realizer.

setFrame

public void setFrame(java.awt.geom.Rectangle2D frame)
Sets the size and location of the realizer. Invoking this method is equivalent to:
setFrame(frame.getX(), frame.getY(), frame.getWidth(), frame.getHeight());

Overrides:
setFrame in class NodeRealizer
Parameters:
frame - the new size and location of the realizer.

sizeChanged

protected void sizeChanged(java.awt.geom.Rectangle2D oldBounds)
Callback method invoked from setFrame and setSize. If autoResizeTable is set to true, size changes are propagated to columns and rows.

Parameters:
oldBounds - the old location and size of the realizer.
See Also:
isAutoResizeTable(), setFrame(java.awt.geom.Rectangle2D), setFrame(double, double, double, double), setSize(double, double)

© Copyright 2000-2021,
yWorks GmbH.
All rights reserved.