com.yworks.yfiles.server.graphml.flexio.data
Class Table

java.lang.Object
  extended bycom.yworks.yfiles.server.graphml.flexio.data.Table
All Implemented Interfaces:
IMarkupExtensionFactory

public class Table
extends java.lang.Object
implements IMarkupExtensionFactory

Defines a table structure.

The table serves as blueprint to set up a PartitionGrid for the use with IncrementalHierarchicLayouter.

To set up a PartitionGrid a TableLayoutConfigurator has to prepare the graph before the layout and restore it afterwards:

 // graph is of type StyledLayoutGraph
 IncrementalHierarchicLayouter ihl = new IncrementalHierarchicLayouter();
 TableLayoutConfigurator tlc = new TableLayoutConfigurator();
 tlc.prepareAll(graph);
 graph.doLayout(ihl);
 tlc.restoreAll(graph);
 


Nested Class Summary
static class Table.StripeDefaults
          The default settings for a newly created Column or Row.
 
Constructor Summary
Table()
          Creates a new instance.
 
Method Summary
 void addColumn(Column column)
          Adds the given column to the root column.
 void addRow(Row row)
          Adds the given row to the root row.
 Column createColumn()
          Creates a new column at root level.
 Column createColumn(Column parent)
          Creates a new column as child of the given column.
 Column createColumn(Column parent, int index)
          Creates a new column as child of the given column at the given index.
 Column createColumn(Column parent, int i, double width, double minimumSize, Insets insets, INodeStyle style)
          Creates a new column as child of the given parent.
 Column createColumn(int index)
          Creates a new column at root level at the given index.
protected  Table.StripeDefaults createColumnDefaults()
           
 MarkupExtension createMarkupExtension(Lookup lookup)
          Creates a markup extension that can be used instead of the original class.
protected  Column createNewColumn()
          Creates a new column using the default settings.
protected  Row createNewRow()
          Creates a new row using the default settings.
 Row createRow()
          Creates a new Row at root level.
 Row createRow(int index)
          Creates a new Row at root level at the given index.
 Row createRow(Row parent)
          Creates a new Row at as child of the given parent row.
 Row createRow(Row parent, int index)
          Creates a new Row at as child of the given parent row at the given index.
 Row createRow(Row parent, int i, double height, double minimumSize, Insets insets, INodeStyle style)
          Creates a new row as child of the given parent.
protected  Table.StripeDefaults createRowDefaults()
           
 Insets getAccumulatedInsets()
          Calculates the accumulated insets for the table.
 Table.StripeDefaults getColumnDefaults()
          Default settings for newly created columns.
 java.util.ArrayList getColumns()
          A list with the root level columns.
 Insets getInsets()
          Gets the table's insets.
 java.awt.geom.Rectangle2D.Double getLayout()
          Gets the bounding box of the table.
 YPoint getRelativeLocation()
          Gets the relative location of the upper left corner of the table.
 Column getRootColumn()
           
 Row getRootRow()
          The root row.
 Table.StripeDefaults getRowDefaults()
          Default settings for newly created rows.
 java.util.ArrayList getRows()
          A list with the root level rows.
static boolean isRoot(Column column)
          Whether the given column is the root column of a table.
static boolean isRoot(Row row)
          Whether the given row is the root row of a table.
 void placeInCell(Node tableNode, Node node, Column column, Row row)
          Convenience method which places a node such that the layouter sees it in the table cell which is specified by the given row and column.
 boolean removeColumn(Column column)
          Removes the given column from the root column.
 boolean removeRow(Row row)
          Removes the given row from the children of the root row.
 void setColumnDefaults(Table.StripeDefaults columnDefaults)
          Default settings for newly created columns.
 void setInsets(Insets insets)
          Sets the table's insets.
 void setRelativeLocation(YPoint relativeLocation)
          Sets the relative location of the upper left corner of the table.
 void setRowDefaults(Table.StripeDefaults rowDefaults)
          Sets the default settings for newly created rows.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Table

public Table()
Creates a new instance.

Method Detail

getInsets

public Insets getInsets()
Gets the table's insets.

Returns:
The table's insets.

setInsets

public void setInsets(Insets insets)
Sets the table's insets.

Parameters:
insets - The table's insets.

getRelativeLocation

public YPoint getRelativeLocation()
Gets the relative location of the upper left corner of the table.

The actual interpretation of this value depends on the context. If the table is bound to a node, this location is usually interpreted relative to the upper left corner of the node layout.

Returns:
The relative location of the upper left corner of the table.

setRelativeLocation

public void setRelativeLocation(YPoint relativeLocation)
Sets the relative location of the upper left corner of the table.

The actual interpretation of this value depends on the context. If the table is bound to a node, this location is usually interpreted relative to the upper left corner of the node layout.

Parameters:
relativeLocation - The relative location of the upper left corner of the table.

getRowDefaults

public Table.StripeDefaults getRowDefaults()
Default settings for newly created rows.

Returns:
The row defaults.

createRowDefaults

protected Table.StripeDefaults createRowDefaults()

setRowDefaults

public void setRowDefaults(Table.StripeDefaults rowDefaults)
Sets the default settings for newly created rows.

Parameters:
rowDefaults - The row defaults.

getColumnDefaults

public Table.StripeDefaults getColumnDefaults()
Default settings for newly created columns.

Returns:
The column defaults.

createColumnDefaults

protected Table.StripeDefaults createColumnDefaults()

setColumnDefaults

public void setColumnDefaults(Table.StripeDefaults columnDefaults)
Default settings for newly created columns.

Parameters:
columnDefaults - The column defaults.

getRows

public java.util.ArrayList getRows()
A list with the root level rows.

Developers should not modify this list directly but use addRow / removeRow to add or remove rows.

Returns:
A list with the root level rows.

getColumns

public java.util.ArrayList getColumns()
A list with the root level columns.

Developers should not modify this list directly but use addColumn / removeColumn to add or remove columns.

Returns:
A list with the root level columns.

addRow

public void addRow(Row row)
Adds the given row to the root row.

Parameters:
row - The row to add.

removeRow

public boolean removeRow(Row row)
Removes the given row from the children of the root row.

If the given row is not a child of the root row of this table this method does nothing and returns false.

Parameters:
row - The row to remove.
Returns:
true if the row was a child of the root row and if it has been removed successfully.

addColumn

public void addColumn(Column column)
Adds the given column to the root column.

Parameters:
column - The column to add.

removeColumn

public boolean removeColumn(Column column)
Removes the given column from the root column.

If the given row is not a child of the root column of this table this method does nothing and returns false.

Parameters:
column - The column to remove.
Returns:
true if the column was a child of the root column and if it has been removed successfully.

createMarkupExtension

public MarkupExtension createMarkupExtension(Lookup lookup)
Description copied from interface: IMarkupExtensionFactory
Creates a markup extension that can be used instead of the original class.

Specified by:
createMarkupExtension in interface IMarkupExtensionFactory
Parameters:
lookup - The lookup that shall be considered when creating the markup extension.

getAccumulatedInsets

public Insets getAccumulatedInsets()
Calculates the accumulated insets for the table.

Returns:
The accumulated insets for the table.

getRootRow

public Row getRootRow()
The root row.

The root row is a container for the rows at root level.

Returns:
The root row.

createColumn

public Column createColumn()
Creates a new column at root level.

Developers should use this method or one of the other createColumn() methods to create new columns.

This method creates a new column, sets defaults, parent and table correctly and adds the newly created row to the column.

Returns:
The newly created column.

createColumn

public Column createColumn(int index)
Creates a new column at root level at the given index.

Developers should use this method or one of the other createColumn() methods to create new columns.

This method creates a new column, sets defaults, parent and table correctly and adds the newly created row to the column.

Parameters:
index - The position of the newly added column.
Returns:
The newly created column.

createColumn

public Column createColumn(Column parent)
Creates a new column as child of the given column.

Developers should use this method or one of the other createColumn() methods to create new columns.

This method creates a new column, sets defaults, parent and table correctly and adds the newly created row to the column.

Returns:
The newly created column.

createColumn

public Column createColumn(Column parent,
                           int index)
Creates a new column as child of the given column at the given index.

Developers should use this method or one of the other createColumn() methods to create new columns.

This method creates a new column, sets defaults, parent and table correctly and adds the newly created row to the column.

Parameters:
index - The position of the new column.
Returns:
The newly created column.

createNewColumn

protected Column createNewColumn()
Creates a new column using the default settings.

The addColumn() methods delegate to this method to create the column instance.

Returns:
A newly created column.

createColumn

public Column createColumn(Column parent,
                           int i,
                           double width,
                           double minimumSize,
                           Insets insets,
                           INodeStyle style)
Creates a new column as child of the given parent.

Parameters:
parent - The parent to add the column to.
i - The index to add the column at.
width - The size of the new column.
minimumSize - The minimum size of the new column.
insets - The insets of the new column.
style - The style of the new column.
Returns:
The newly created column.

createRow

public Row createRow(Row parent,
                     int i,
                     double height,
                     double minimumSize,
                     Insets insets,
                     INodeStyle style)
Creates a new row as child of the given parent.

Parameters:
parent - The parent to add the row to.
i - The index to add the row at.
height - The size of the new row.
minimumSize - The minimum size of the new row.
insets - The insets of the new row.
style - The style of the new row.
Returns:
The newly created row.

createRow

public Row createRow()
Creates a new Row at root level.

Developers should use this method or one of the other createRow() methods to create new rows.

This method creates a new row, sets defaults, parent and table correctly and adds the newly created row to the root.

Returns:
The newly created row.

createRow

public Row createRow(int index)
Creates a new Row at root level at the given index.

Developers should use this method or one of the other createRow() methods to create new rows.

This method creates a new row, sets defaults, parent and table correctly and adds the newly created row to the root.

Returns:
The newly created row.

createRow

public Row createRow(Row parent)
Creates a new Row at as child of the given parent row.

Developers should use this method or one of the other createRow() methods to create new rows.

This method creates a new row, sets defaults, parent and table correctly and adds the newly created row to the root.

Returns:
The newly created row.

createRow

public Row createRow(Row parent,
                     int index)
Creates a new Row at as child of the given parent row at the given index.

Developers should use this method or one of the other createRow() methods to create new rows.

This method creates a new row, sets defaults, parent and table correctly and adds the newly created row to the root.

Returns:
The newly created row.

createNewRow

protected Row createNewRow()
Creates a new row using the default settings.

The addRow() methods delegate to this method to create the row instance.

Returns:
A newly created row.

getLayout

public java.awt.geom.Rectangle2D.Double getLayout()
Gets the bounding box of the table.

The upper left corner of the bounding box is the relative location to the upper left corner of the node which contains this table.

Returns:
The bounding box of the table.

placeInCell

public void placeInCell(Node tableNode,
                        Node node,
                        Column column,
                        Row row)
Convenience method which places a node such that the layouter sees it in the table cell which is specified by the given row and column.

Parameters:
tableNode - The node the table is assigned to.
node - The node to place.
column - The column to place the node in.
row - The row to place the node in.

isRoot

public static boolean isRoot(Column column)
Whether the given column is the root column of a table.

Parameters:
column - The column.
Returns:
true if the given column is the root column of a table.

isRoot

public static boolean isRoot(Row row)
Whether the given row is the root row of a table.

Parameters:
row - The row.
Returns:
true if the given row is the root row of a table.

getRootColumn

public Column getRootColumn()


Copyright © 2000-2013 yWorks GmbH. All rights reserved