com.yworks.yfiles.server.graphml.flexio
Class TableLayoutConfigurator

java.lang.Object
  extended bycom.yworks.yfiles.server.graphml.flexio.TableLayoutConfigurator

public class TableLayoutConfigurator
extends java.lang.Object

Support class that correctly configures a PartitionGrid information from a given table configuration.

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);
 


Constructor Summary
TableLayoutConfigurator()
           
 
Method Summary
 void cleanUp(Graph graph)
          Destroy all information that results from a previous prepareAll(y.layout.LayoutGraph) and a subsequent layout.
 double[] getColumnLayout(Table originalTable, NodeLayout nodeLayout)
          Return the sizes of all leaf columns.
 double getMinimalTableDistance()
          Gets the minimal distance between two different table nodes.
 double[] getRowLayout(Table originalTable, NodeLayout nodeLayout)
          Return the sizes of all leaf rows.
 boolean isCompactionEnabled()
          Specifies whether or not to enable size compaction for table nodes.
 boolean isFromSketch()
          Specifies whether or not from sketch mode should be enabled.
 boolean isHorizontalLayout()
          Gets whether the configurator will prepare its associated graph for a vertical (that is top-to-bottom or bottom-to-top) layout calculation or a horizontal (that is left-to-right or right-to-left) one.
 void prepareAll(LayoutGraph graph)
          Setup partition grid information from a graph that contains table structures.
 void restoreAll(Graph graph)
          Write back all information from the partition grid.
 void setCompactionEnabled(boolean compactionEnabled)
          Specifies whether or not to enable size compaction for table nodes.
 void setFromSketch(boolean fromSketch)
          Specifies whether or not from sketch mode should be enabled.
 void setHorizontalLayout(boolean horizontalLayout)
          Sets whether the configurator will prepare its associated graph for a vertical (that is top-to-bottom or bottom-to-top) layout calculation or a horizontal (that is left-to-right or right-to-left) one.
 void setMinimalTableDistance(double distance)
          Sets the minimal distance between two different table nodes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TableLayoutConfigurator

public TableLayoutConfigurator()
Method Detail

getMinimalTableDistance

public double getMinimalTableDistance()
Gets the minimal distance between two different table nodes.

Returns:
The minimal distance between two different table nodes

setMinimalTableDistance

public void setMinimalTableDistance(double distance)
Sets the minimal distance between two different table nodes

Parameters:
distance - The minimal distance between two different table nodes

isCompactionEnabled

public boolean isCompactionEnabled()
Specifies whether or not to enable size compaction for table nodes.

If size compaction is enabled, the size of a column or row (or a table node for that matter) may be reduced due to layout calculation, but never below the column's or row's minimum size. If size compaction is disabled, columns and rows (and therefore table nodes) may only grow due to layout calculation.

The default value for this property is true.

Returns:
Whether or not to enable size compaction for table nodes.

setCompactionEnabled

public void setCompactionEnabled(boolean compactionEnabled)
Specifies whether or not to enable size compaction for table nodes.

If size compaction is enabled, the size of a column or row (or a table node for that matter) may be reduced due to layout calculation, but never below the column's or row's minimum size. If size compaction is disabled, columns and rows (and therefore table nodes) may only grow due to layout calculation.

The default value for this property is true.

Parameters:
compactionEnabled - Whether or not to enable size compaction for table nodes.

isHorizontalLayout

public boolean isHorizontalLayout()
Gets whether the configurator will prepare its associated graph for a vertical (that is top-to-bottom or bottom-to-top) layout calculation or a horizontal (that is left-to-right or right-to-left) one.

The default value for this property is false.

Returns:
Whether the configurator will prepare its associated graph for a horizontal layout.

setHorizontalLayout

public void setHorizontalLayout(boolean horizontalLayout)
Sets whether the configurator will prepare its associated graph for a vertical (that is top-to-bottom or bottom-to-top) layout calculation or a horizontal (that is left-to-right or right-to-left) one.

The default value for this property is false.

Parameters:
horizontalLayout - Whether the configurator will prepare its associated graph for a horizontal layout.

isFromSketch

public boolean isFromSketch()
Specifies whether or not from sketch mode should be enabled.

If enabled, the positions of the table group nodes are considered, i.e., for horizontal layout configuration these nodes are sorted according to their y-coordinate and for vertical layout configuration according to their x-coordinate.

Returns:
Whether or not from sketch mode should be enabled.

setFromSketch

public void setFromSketch(boolean fromSketch)
Specifies whether or not from sketch mode should be enabled.

If enabled, the positions of the table group nodes are considered, i.e., for horizontal layout configuration these nodes are sorted according to their y-coordinate and for vertical layout configuration according to their x-coordinate.

Parameters:
fromSketch - Whether or not from sketch mode should be enabled.

prepareAll

public void prepareAll(LayoutGraph graph)
Setup partition grid information from a graph that contains table structures.

If a DataProvider is registered with the key GraphRoundtripSupportBase.TABLE_DPKEY the tables are retrieved from this provider. Otherwise, a custom provider is created which retrieves the tables from TableNodeStyle or DynamicTableNodeStyle instances.

Parameters:
graph -

restoreAll

public void restoreAll(Graph graph)
Write back all information from the partition grid.

Note that it is not safe to call this method without a previous prepareAll(y.layout.LayoutGraph). This method calls cleanUp(y.base.Graph) implicitly.

Parameters:
graph - The graph to restore.

cleanUp

public void cleanUp(Graph graph)
Destroy all information that results from a previous prepareAll(y.layout.LayoutGraph) and a subsequent layout.

Parameters:
graph - The graph to clean up.

getColumnLayout

public double[] getColumnLayout(Table originalTable,
                                NodeLayout nodeLayout)
Return the sizes of all leaf columns.

This method does not modify the table. You also need to call cleanUp(y.base.Graph) explicitly if you don't need the TableLayoutConfigurator anymore.

Parameters:
originalTable - The table.
nodeLayout - The final layout of the node that owns the table.
Returns:
The sizes of all leaf columns in the given table, in their natural order.

getRowLayout

public double[] getRowLayout(Table originalTable,
                             NodeLayout nodeLayout)
Return the sizes of all leaf rows.

This method does not modify the table. You also need to call cleanUp(y.base.Graph) explicitly if you don't need the TableLayoutConfigurator anymore.

Parameters:
originalTable - The table.
nodeLayout - The final layout of the node that owns the table.
Returns:
The sizes of all leaf rows in the given table, in their natural order.


Copyright © 2000-2013 yWorks GmbH. All rights reserved