| 
 | Search this API | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecty.layout.AbstractLayoutStage
y.layout.FixNodeLayoutStage
public class FixNodeLayoutStage
FixNodeLayoutStage fixes the initial position of either a single
 node or the alignment of the bounding box of several nodes (but not the
 positions of the individual nodes).
 
   The absolute coordinates of the fix point are the same before and
   after invoking the core layout algorithm. However, the relative coordinates of the nodes
   are altered by the core layout algorithm.
 
core layout algorithm.
 It only moves the entire graph as a post-processing step.
 For use-cases with a so-called incremental layout where the algorithm should only arrange some of the elements
 while the other elements should not (or only slightly) change, please take a look at
 the PartialLayouter, the IncrementalHierarchicLayouter
 (see mode IncrementalHierarchicLayouter.LAYOUT_MODE_INCREMENTAL),
 or the SmartOrganicLayouter (see scope SmartOrganicLayouter.SCOPE_SUBSET).|  Fixing a single node in different layouts |  Fixing a single node in different layouts | 
| Field Summary | |
|---|---|
| static byte | FIX_POINT_POLICY_CENTERFix point calculation policy specifying that the center of a rectangle containing all fixed nodes is considered the fix point. | 
| static byte | FIX_POINT_POLICY_LOWER_LEFTFix point calculation policy specifying that the lower left corner of a rectangle containing all fixed nodes is considered the fix point. | 
| static byte | FIX_POINT_POLICY_LOWER_RIGHTFix point calculation policy specifying that the lower right corner of a rectangle containing all fixed nodes is considered the fix point. | 
| static byte | FIX_POINT_POLICY_UPPER_LEFTFix point calculation policy specifying that the upper left corner of a rectangle containing all fixed nodes is considered the fix point. | 
| static byte | FIX_POINT_POLICY_UPPER_RIGHTFix point calculation policy specifying that the upper right corner of a rectangle containing all fixed nodes is considered the fix point. | 
| static java.lang.Object | FIXED_NODE_DPKEYA DataProviderkey for determining the nodes that should be considered fixed | 
| Fields inherited from interface y.layout.Layouter | 
|---|
| EDGE_ID_DPKEY, NODE_ID_DPKEY, NODE_TYPE_DPKEY, SELECTED_EDGES, SELECTED_NODES | 
| Constructor Summary | |
|---|---|
| FixNodeLayoutStage()Creates a new FixNodeLayoutStageinstance with default settings. | |
| FixNodeLayoutStage(Layouter coreLayouter)Creates a new FixNodeLayoutStageinstance using the given algorithm
 ascore layout algorithm. | |
| Method Summary | |
|---|---|
| protected  java.awt.geom.Rectangle2D | calculateBounds(LayoutGraph graph,
                NodeList fixedNodes)Calculates the bounding box of the specified nodes. | 
| protected  YPoint | calculateFixPoint(LayoutGraph graph,
                  NodeList fixedNodes)Calculates the fix point for the specified nodes in the specified graph. | 
| protected  YPoint | calculateFixPoint(java.awt.geom.Rectangle2D bounds)Calculates the fix point of the specified rectangle according to the policy returned by getFixPointPolicy(). | 
|  boolean | canLayout(LayoutGraph graph)Accepts all graphs that can be handled by the core layout algorithm. | 
|  void | doLayout(LayoutGraph graph)Delegates to the core layout algorithmand moves the fixed point back to its initial
 location. | 
|  byte | getFixPointPolicy()Returns the fix point calculation policy used in calculateFixPoint(Rectangle2D)to determine which
 point in the corresponding rectangle should be considered fixed. | 
|  boolean | isIncludingEdges()Returns whether or not subgraph edges are taken into account when calculating the bounding box of the fixed nodes. | 
|  boolean | isIncludingLabels()Returns whether or not label geometries are taken into account when calculating the bounding box of the fixed nodes. | 
|  void | setFixPointPolicy(byte policy)Specifies the fix point calculation policy used in calculateFixPoint(Rectangle2D)to determine which
 point in the corresponding rectangle should be considered fixed. | 
|  void | setIncludingEdges(boolean includingEdges)Specifies whether or not subgraph edges are taken into account when calculating the bounding box of the fixed nodes. | 
|  void | setIncludingLabels(boolean includingLabels)Specifies whether or not label geometries are taken into account when calculating the bounding box of the fixed nodes. | 
| Methods inherited from class y.layout.AbstractLayoutStage | 
|---|
| canLayoutCore, doLayoutCore, getCoreLayouter, setCoreLayouter | 
| 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.Object FIXED_NODE_DPKEY
DataProvider key for determining the nodes that should be considered fixed
core layout algorithm.
 It only moves the entire graph as a post-processing step.
 For use-cases with a so-called incremental layout where the algorithm should only arrange some of the elements
 while the other elements should not (or only slightly) change, please take a look at
 the PartialLayouter, the IncrementalHierarchicLayouter
 (see mode IncrementalHierarchicLayouter.LAYOUT_MODE_INCREMENTAL),
 or the SmartOrganicLayouter (see scope SmartOrganicLayouter.SCOPE_SUBSET).public static final byte FIX_POINT_POLICY_CENTER
setFixPointPolicy(byte), 
Constant Field Valuespublic static final byte FIX_POINT_POLICY_UPPER_LEFT
setFixPointPolicy(byte), 
Constant Field Valuespublic static final byte FIX_POINT_POLICY_UPPER_RIGHT
setFixPointPolicy(byte), 
Constant Field Valuespublic static final byte FIX_POINT_POLICY_LOWER_RIGHT
setFixPointPolicy(byte), 
Constant Field Valuespublic static final byte FIX_POINT_POLICY_LOWER_LEFT
setFixPointPolicy(byte), 
Constant Field Values| Constructor Detail | 
|---|
public FixNodeLayoutStage()
FixNodeLayoutStage instance with default settings.
public FixNodeLayoutStage(Layouter coreLayouter)
FixNodeLayoutStage instance using the given algorithm
 as core layout algorithm.
coreLayouter - the core layout algorithm| Method Detail | 
|---|
public byte getFixPointPolicy()
calculateFixPoint(Rectangle2D) to determine which
 point in the corresponding rectangle should be considered fixed.
setFixPointPolicy(byte)public void setFixPointPolicy(byte policy)
calculateFixPoint(Rectangle2D) to determine which
 point in the corresponding rectangle should be considered fixed.
FIX_POINT_POLICY_CENTERpolicy - one of the valid fix point calculation policies
java.lang.IllegalArgumentException - if the specified policy is unknownpublic boolean isIncludingEdges()
true if subgraph edges are taken into account, false otherwisesetIncludingEdges(boolean), 
calculateBounds(LayoutGraph, NodeList)public void setIncludingEdges(boolean includingEdges)
includingEdges - true if subgraph edges should be taken into account, false 
                       otherwisecalculateBounds(LayoutGraph, NodeList)public boolean isIncludingLabels()
true if label geometries are taken into account, false otherwisesetIncludingLabels(boolean), 
calculateBounds(LayoutGraph, NodeList)public void setIncludingLabels(boolean includingLabels)
includingLabels - true if label geometries should be taken into account, false
                        otherwisecalculateBounds(LayoutGraph, NodeList)public boolean canLayout(LayoutGraph graph)
core layout algorithm.
 
   If there is no core layout algorithm, all graphs are accepted.
 
graph - the input graph
true if there is no core layout algorithm or the core layout algorithm accepts the graph,
         false otherwiseLayouter.doLayout(LayoutGraph)public void doLayout(LayoutGraph graph)
core layout algorithm and moves the fixed point back to its initial
 location.
graph - the input graphLayouter.canLayout(LayoutGraph)
protected YPoint calculateFixPoint(LayoutGraph graph,
                                   NodeList fixedNodes)
   The default implementation calls calculateBounds(LayoutGraph, NodeList) and
   calculateFixPoint(Rectangle2D).
 
   This method is called by doLayout(LayoutGraph) to determine the point that will have the same
   coordinates before and after invoking the core layout algorithm. It may be overridden
   to introduce a custom policy for retrieving the fix point.
 
graph - the graph associated with the specified nodesfixedNodes - the list of nodes for which a fix point has to be determined
getFixPointPolicy(), 
calculateBounds(LayoutGraph, NodeList), 
calculateFixPoint(Rectangle2D)protected YPoint calculateFixPoint(java.awt.geom.Rectangle2D bounds)
getFixPointPolicy().
 
   If the specified rectangle is null or the rectangle has negative width or negative
   height then null will be returned.
 
   This method is called by calculateFixPoint(LayoutGraph, NodeList). It may be overridden
   to introduce a custom policy for retrieving the fix point.
 
bounds - the rectangle for which to determine the fix point
null if
 nothing should be fixed
java.lang.IllegalArgumentException - if the current fix point policy is invalidgetFixPointPolicy()
protected java.awt.geom.Rectangle2D calculateBounds(LayoutGraph graph,
                                                    NodeList fixedNodes)
   The calculated bounds may contain edges and/or labels.
 
   This method is called by calculateFixPoint(LayoutGraph, NodeList) and may be overridden to customize the 
   size of the bounds.
 
graph - the graph associated with the specified nodesfixedNodes - the list of nodes for which to determine the bounding box
isIncludingEdges(), 
isIncludingLabels(), 
calculateFixPoint(LayoutGraph, NodeList)| 
 | © Copyright 2000-2025, yWorks GmbH. All rights reserved. | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||