Search this API

y.view.tabular
Class TableSupport

java.lang.Object
  extended by y.view.tabular.TableSupport

public class TableSupport
extends java.lang.Object

This class is meant to ease working with the table structure of a TableGroupNodeRealizer. If offers methods to add rows and column, modify their position in the row or column hierarchy and change their size. In contrast to the according methods of TableGroupNodeRealizer these implementations do also update the sizes of the row's or column's ancestor containers and move content nodes and bends of the table so that they keep their position relative to the rows and columns they are associated with.

See Also:
moveSingleBends
 

Constructor Summary
TableSupport()
          Creates a new instance of this class.
 
Method Summary
 TableGroupNodeRealizer.Column addColumn(TableGroupNodeRealizer.ColumnContainer container, int position)
          Adds a new column to the container at the specified position and updates the sizes of it's new ancestors accordingly.
 TableGroupNodeRealizer.Row addRow(TableGroupNodeRealizer.RowContainer container, int position)
          Adds a new row to the container at the specified position and updates the sizes of it's new ancestors accordingly.
 void collectBends(Graph2D graph, java.awt.geom.Rectangle2D bounds, java.util.Collection contentBends)
          Collects all bends of edges of the specified graph whose coordinates lie inside the specified bounds and stores them in the contentBends container.
 void collectContents(Node node, java.awt.geom.Rectangle2D bounds, java.util.Collection contentNodes)
          Collects the child nodes of the specified group node whose coordinates lie inside the specified bounds and stores them in the contentNodes container.
 boolean isMoveSingleBends()
          Determines which bends are moved when a column or row changes its location.
 void moveContents(Graph2D graph, NodeList nodes, BendList bends, double dx, double dy)
          All nodes and bends in the specified lists are moved by the given distances.
 boolean setHeight(TableGroupNodeRealizer.Row row, double newHeight, boolean moveContentOfChangedRow)
          Sets the newSize for the row and updates the sizes of it's new ancestors accordingly.
 void setIndex(TableGroupNodeRealizer.Column column, int index)
          Sets the position of the column in it's parent container to the new index.
 void setIndex(TableGroupNodeRealizer.Row row, int index)
          Sets the position of the row in it's parent container to the new index.
 void setMoveSingleBends(boolean moveSingleBends)
          Specifies which bends are moved when a column or row changes its location.
 void setParent(TableGroupNodeRealizer.Column column, TableGroupNodeRealizer.ColumnContainer container)
          The container is set as the parent of the column and the sizes of it's old and new ancestors is updated accordingly.
 void setParent(TableGroupNodeRealizer.Row row, TableGroupNodeRealizer.RowContainer container)
          The container is set as the parent of the row and the sizes of it's old and new ancestors is updated accordingly.
 boolean setWidth(TableGroupNodeRealizer.Column column, double newWidth, boolean moveContentOfChangedColumn)
          Sets the newSize for the specified column and updates the sizes of it's new ancestors accordingly.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableSupport

public TableSupport()
Creates a new instance of this class.

Method Detail

moveContents

public void moveContents(Graph2D graph,
                         NodeList nodes,
                         BendList bends,
                         double dx,
                         double dy)
All nodes and bends in the specified lists are moved by the given distances.

Parameters:
graph - The graph the nodes and bends belong to.
nodes - A list of nodes that shall be moved.
bends - A list of bends that shall be moved.
dx - The horizontal value that shall be added to the nodes' and bends' position.
dy - The vertical value that shall be added to the nodes' and bends' position.

collectContents

public void collectContents(Node node,
                            java.awt.geom.Rectangle2D bounds,
                            java.util.Collection contentNodes)

Collects the child nodes of the specified group node whose coordinates lie inside the specified bounds and stores them in the contentNodes container.

Parameters:
node - The parent group nodes whose child nodes should be collected.
bounds - The bounds content nodes have to lie in to be collected.
contentNodes - The container to which the collected nodes are added.

collectBends

public void collectBends(Graph2D graph,
                         java.awt.geom.Rectangle2D bounds,
                         java.util.Collection contentBends)
Collects all bends of edges of the specified graph whose coordinates lie inside the specified bounds and stores them in the contentBends container.

Parameters:
graph - The graph to collect the bends from.
bounds - The bounds bends have to lie in to be collected.
contentBends - The container to which the collected bends are added.

setParent

public void setParent(TableGroupNodeRealizer.Column column,
                      TableGroupNodeRealizer.ColumnContainer container)

The container is set as the parent of the column and the sizes of it's old and new ancestors is updated accordingly.

All child nodes of the TableGroupNodeRealizer are moved accordingly so that each child node's position stays the same relative to it's containing column.

All bends that are chosen with respect to the setting of moveSingleBends are also moved accordingly.

Parameters:
column - The column to reparent.
container - The new parent container of the column.
See Also:
moveSingleBends

setParent

public void setParent(TableGroupNodeRealizer.Row row,
                      TableGroupNodeRealizer.RowContainer container)

The container is set as the parent of the row and the sizes of it's old and new ancestors is updated accordingly.

All child nodes of the TableGroupNodeRealizer are moved accordingly so that each child node's position stays the same relative to it's containing row.

All bends that are chosen with respect to the setting of moveSingleBends are also moved accordingly.

Parameters:
row - The row to reparent.
container - The new parent container of the row.
See Also:
moveSingleBends

setIndex

public void setIndex(TableGroupNodeRealizer.Column column,
                     int index)

Sets the position of the column in it's parent container to the new index.

All child nodes of the TableGroupNodeRealizer are moved accordingly so that each child node's position stays the same relative to it's containing column.

All bends that are chosen with respect to the setting of moveSingleBends are also moved accordingly.

Parameters:
column - The column to reposition.
index - The new position of the column in it's parent container.

setIndex

public void setIndex(TableGroupNodeRealizer.Row row,
                     int index)

Sets the position of the row in it's parent container to the new index.

All child nodes of the TableGroupNodeRealizer are moved accordingly so that each child node's position stays the same relative to it's containing row.

All bends that are chosen with respect to the setting of moveSingleBends are also moved accordingly.

Parameters:
row - The row to reposition.
index - The new position of the row in it's parent container.

addColumn

public TableGroupNodeRealizer.Column addColumn(TableGroupNodeRealizer.ColumnContainer container,
                                               int position)

Adds a new column to the container at the specified position and updates the sizes of it's new ancestors accordingly.

All child nodes of the TableGroupNodeRealizer are moved accordingly so that each child node's position stays the same relative to it's containing column.

All bends that are chosen with respect to the setting of moveSingleBends are also moved accordingly.

Parameters:
container - The parent container to add a column to.
position - The position of the new column.
See Also:
isMoveSingleBends(), setMoveSingleBends(boolean)

addRow

public TableGroupNodeRealizer.Row addRow(TableGroupNodeRealizer.RowContainer container,
                                         int position)

Adds a new row to the container at the specified position and updates the sizes of it's new ancestors accordingly.

All child nodes of the TableGroupNodeRealizer are moved accordingly so that each child node's position stays the same relative to it's containing row.

All bends that are chosen with respect to the setting of moveSingleBends are also moved accordingly.

Parameters:
container - The parent container to add a row to.
position - The position of the new row.
See Also:
moveSingleBends

setHeight

public boolean setHeight(TableGroupNodeRealizer.Row row,
                         double newHeight,
                         boolean moveContentOfChangedRow)

Sets the newSize for the row and updates the sizes of it's new ancestors accordingly.

All child nodes of other rows are moved accordingly so that each child node's position stays the same relative to it's containing row. If content nodes associated with the specified row shall be moved as well can be designated by moveContentOfChangedRow. If true it's content nodes are moved to keep their position relative to the bottom border of the row, otherwise they won't be moved so they stay put relative to the top border of the row.

All bends that are chosen with respect to the setting of moveSingleBends are also moved accordingly.

Parameters:
row - The row to resize.
newHeight - The new height of the row.
moveContentOfChangedRow - If content nodes of the passed row shall be moved as well.
See Also:
isMoveSingleBends(), setMoveSingleBends(boolean)

setWidth

public boolean setWidth(TableGroupNodeRealizer.Column column,
                        double newWidth,
                        boolean moveContentOfChangedColumn)

Sets the newSize for the specified column and updates the sizes of it's new ancestors accordingly.

All child nodes of other columns are moved accordingly so that each child node's position stays the same relative to it's containing column. If content nodes associated with the column shall be moved as well can be designated by moveContentOfChangedColumn. If true it's content nodes are moved to keep their position relative to the bottom border of the column, otherwise they won't be moved so they stay put relative to the top border of the column.

All bends that are chosen with respect to the setting of moveSingleBends are also moved accordingly.

Parameters:
column - The column to resize.
newWidth - The new width of the column.
moveContentOfChangedColumn - If content nodes of the passed column shall be moved as well.
See Also:
moveSingleBends

isMoveSingleBends

public boolean isMoveSingleBends()
Determines which bends are moved when a column or row changes its location. The following methods call isMoveSingleBends:

The default value of this property is true.

Returns:
true if every bend inside a column or row that changes its location is moved accordingly and false if only bends of edges that connect nodes that are moved due to a column or row changing its location are moved accordingly.
See Also:
setMoveSingleBends(boolean)

setMoveSingleBends

public void setMoveSingleBends(boolean moveSingleBends)
Specifies which bends are moved when a column or row changes its location.

The default value of this property is true.

Parameters:
moveSingleBends - true if every bend inside a column or row that changes its location should be moved accordingly and false if only bends of edges that connect nodes that are moved due to a column or row changing its location should be moved accordingly.
See Also:
isMoveSingleBends()

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