Package com.mxgraph.layout
Class mxGraphLayout
java.lang.Object
com.mxgraph.layout.mxGraphLayout
- All Implemented Interfaces:
mxIGraphLayout
- Direct Known Subclasses:
mxCircleLayout
,mxCompactTreeLayout
,mxEdgeLabelLayout
,mxFastOrganicLayout
,mxHierarchicalLayout
,mxOrganicLayout
,mxOrthogonalLayout
,mxParallelEdgeLayout
,mxPartitionLayout
,mxStackLayout
Abstract bass class for layouts
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionmxGraphLayout
(mxGraph graph) Constructs a new fast organic layout for the specified graph. -
Method Summary
Modifier and TypeMethodDescriptionvoid
arrangeGroups
(Object[] groups, int border) Updates the bounds of the given groups to include all children.void
Executes the layout for the children of the specified parent.getConstraint
(Object key, Object cell) Returns the constraint for the given key and cell.getConstraint
(Object key, Object cell, Object edge, boolean source) Returns the constraint for the given key and cell.getGraph()
Returns the associated graph.getParentOffset
(Object parent) getVertexBounds
(Object vertex) Returns anthat 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
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
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
setOrthogonalEdge
(Object edge, boolean value) Disables or enables orthogonal end segments of the given edgevoid
setUseBoundingBox
(boolean useBoundingBox) setVertexLocation
(Object vertex, double x, double y) Sets the new position of the given cell taking into account the size of the bounding box ifis true.
-
Field Details
-
graph
Holds the enclosing graph. -
parent
The parent cell of the layout, if any -
useBoundingBox
protected boolean useBoundingBoxBoolean indicating if the bounding box of the label should be used if its available. Default is true.
-
-
Constructor Details
-
mxGraphLayout
Constructs a new fast organic layout for the specified graph.
-
-
Method Details
-
execute
Description copied from interface:mxIGraphLayout
Executes the layout for the children of the specified parent.- Specified by:
execute
in interfacemxIGraphLayout
- Parameters:
parent
- Parent cell that contains the children to be layed out.
-
moveCell
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 interfacemxIGraphLayout
- Parameters:
cell
- Cell which is being moved.x
- X-coordinate of the new cell location.y
- Y-coordinate of the new cell location.
-
getGraph
Returns the associated graph. -
getConstraint
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
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
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
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
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
Disables or enables the edge style of the given edge. -
setOrthogonalEdge
Disables or enables orthogonal end segments of the given edge -
getParentOffset
-
setEdgePoints
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
Returns anthat defines the bounds of the given cell or the bounding box if is true. -
setVertexLocation
Sets the new position of the given cell taking into account the size of the bounding box ifis 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. -
arrangeGroups
Updates the bounds of the given groups to include all children. Call this with the groups in parent to child order, top-most group first, eg. arrangeGroups(graph, mxUtils.sortCells(Arrays.asList( new Object[] { v1, v3 }), true).toArray(), 10);- Parameters:
groups
- the groups to adjustborder
- the border applied to the adjusted groups
-