JGraph X 1.4.1.0


com.mxgraph.layout
Class mxGraphLayout

java.lang.Object
  extended by com.mxgraph.layout.mxGraphLayout
All Implemented Interfaces:
mxIGraphLayout
Direct Known Subclasses:
mxCircleLayout, mxCompactTreeLayout, mxEdgeLabelLayout, mxFastOrganicLayout, mxHierarchicalLayout, mxOrganicLayout, mxOrthogonalLayout, mxParallelEdgeLayout, mxPartitionLayout, mxStackLayout

public abstract class mxGraphLayout
extends Object
implements mxIGraphLayout

Abstract bass class for layouts


Field Summary
protected  mxGraph graph
          Holds the enclosing graph.
protected  boolean useBoundingBox
          Boolean indicating if the bounding box of the label should be used if its available.
 
Constructor Summary
mxGraphLayout(mxGraph graph)
          Constructs a new fast organic layout for the specified graph.
 
Method Summary
 Object getConstraint(Object key, Object cell)
          Returns the constraint for the given key and cell.
 Object getConstraint(Object key, Object cell, Object edge, boolean source)
          Returns the constraint for the given key and cell.
 mxGraph getGraph()
          Returns the associated graph.
 mxRectangle getVertexBounds(Object vertex)
          Returns an that defines the bounds of the given cell or the bounding box if is true.
 boolean isEdgeIgnored(Object edge)
          Returns true if the given edge has no source or target terminal.
 boolean isUseBoundingBox()
           
 boolean isVertexIgnored(Object vertex)
          Returns true if the given vertex has no connected edges.
 boolean isVertexMovable(Object vertex)
          Returns true if the given vertex may be moved by the layout.
 void moveCell(Object cell, double x, double y)
          Notified when a cell is being moved in a parent that has automatic layout to update the cell state (eg.
 void setEdgePoints(Object edge, List<mxPoint> points)
          Sets the control points of the given edge to the given list of mxPoints.
 void setEdgeStyleEnabled(Object edge, boolean value)
          Disables or enables the edge style of the given edge.
 void setUseBoundingBox(boolean useBoundingBox)
           
 mxRectangle setVertexLocation(Object vertex, double x, double y)
          Sets the new position of the given cell taking into account the size of the bounding box if is true.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.mxgraph.layout.mxIGraphLayout
execute
 

Field Detail

graph

protected mxGraph graph
Holds the enclosing graph.


useBoundingBox

protected boolean useBoundingBox
Boolean indicating if the bounding box of the label should be used if its available. Default is true.

Constructor Detail

mxGraphLayout

public mxGraphLayout(mxGraph graph)
Constructs a new fast organic layout for the specified graph.

Method Detail

moveCell

public void moveCell(Object cell,
                     double x,
                     double y)
Description copied from interface: mxIGraphLayout
Notified when a cell is being moved in a parent that has automatic layout to update the cell state (eg. index) so that the outcome of the layout will position the vertex as close to the point (x, y) as possible.

Specified by:
moveCell in interface mxIGraphLayout
Parameters:
cell - Cell which is being moved.
x - X-coordinate of the new cell location.
y - Y-coordinate of the new cell location.

getGraph

public mxGraph getGraph()
Returns the associated graph.


getConstraint

public Object getConstraint(Object key,
                            Object cell)
Returns the constraint for the given key and cell. This implementation always returns the value for the given key in the style of the given cell.

Parameters:
key - Key of the constraint to be returned.
cell - Cell whose constraint should be returned.

getConstraint

public Object getConstraint(Object key,
                            Object cell,
                            Object edge,
                            boolean source)
Returns the constraint for the given key and cell. The optional edge and source arguments are used to return inbound and outgoing routing- constraints for the given edge and vertex. This implementation always returns the value for the given key in the style of the given cell.

Parameters:
key - Key of the constraint to be returned.
cell - Cell whose constraint should be returned.
edge - Optional cell that represents the connection whose constraint should be returned. Default is null.
source - Optional boolean that specifies if the connection is incoming or outgoing. Default is false.

isUseBoundingBox

public boolean isUseBoundingBox()
Returns:
the useBoundingBox

setUseBoundingBox

public void setUseBoundingBox(boolean useBoundingBox)
Parameters:
useBoundingBox - the useBoundingBox to set

isVertexMovable

public boolean isVertexMovable(Object vertex)
Returns true if the given vertex may be moved by the layout.

Parameters:
vertex - Object that represents the vertex to be tested.
Returns:
Returns true if the vertex can be moved.

isVertexIgnored

public boolean isVertexIgnored(Object vertex)
Returns true if the given vertex has no connected edges.

Parameters:
vertex - Object that represents the vertex to be tested.
Returns:
Returns true if the vertex should be ignored.

isEdgeIgnored

public boolean isEdgeIgnored(Object edge)
Returns true if the given edge has no source or target terminal.

Parameters:
edge - Object that represents the edge to be tested.
Returns:
Returns true if the edge should be ignored.

setEdgeStyleEnabled

public void setEdgeStyleEnabled(Object edge,
                                boolean value)
Disables or enables the edge style of the given edge.


setEdgePoints

public void setEdgePoints(Object edge,
                          List<mxPoint> points)
Sets the control points of the given edge to the given list of mxPoints. Set the points to null to remove all existing points for an edge.


getVertexBounds

public mxRectangle getVertexBounds(Object vertex)
Returns an that defines the bounds of the given cell or the bounding box if is true.


setVertexLocation

public mxRectangle setVertexLocation(Object vertex,
                                     double x,
                                     double y)
Sets the new position of the given cell taking into account the size of the bounding box if is true. The change is only carried out if the new location is not equal to the existing location, otherwise the geometry is not replaced with an updated instance. The new or old bounds are returned (including overlapping labels). Parameters: cell - whose geometry is to be set. x - Integer that defines the x-coordinate of the new location. y - Integer that defines the y-coordinate of the new location.


JGraph X 1.4.1.0


Copyright (c) 2010 Gaudenz Alder. All rights reserved.