public class Diagram extends Box
Modifier and Type | Class and Description |
---|---|
static class |
Diagram.State
The states diagram can be in.
|
Box.BoxSide
Constructor and Description |
---|
Diagram(org.w3c.dom.Element element,
java.util.LinkedHashMap<java.lang.Integer,java.lang.Object> objectMap)
Loads a diagram from the given XML element representing one.
|
Diagram(java.awt.geom.Rectangle2D.Double rectangle,
ArrangeData.ArrangeStyle arrangeStyle,
LayoutConstraints.ConstraintType constraintType)
Creates a new diagram.
|
Modifier and Type | Method and Description |
---|---|
void |
arrange()
Lays out the diagram from scratch according to its current position without necessarily
maintaining existing element positions.
|
void |
endManual()
Ends manual mode, fixing the diagram if necessary.
|
void |
endTransaction()
Performs all the work needed to effect all accumulated position changes since
startTransaction() , then ends the current transaction. |
java.awt.geom.Rectangle2D.Double |
getBounds()
Returns union of the user-defined default bounds and children enclosing rectangle.
|
double |
getRetraceDistance()
Returns the distance a box has to be moved before its lines are retraced instead of
reconnected.
|
Diagram.State |
getState()
Returns the current state of the diagram.
|
void |
remove()
Removes the element and its descendant elements.
|
org.w3c.dom.Element |
saveToXML(org.w3c.dom.Document doc,
java.util.LinkedHashMap<java.lang.Object,java.lang.Integer> idMap)
Saves this diagram to an XML element in the given document.
|
void |
setRetraceDistance(double distance)
Sets the distance a box has to be moved before its lines are retraced instead of reconnected.
|
void |
startManual()
Sets the diagram to manual mode, where only line connections and rectangle nesting are
maintained.
|
void |
startTransaction()
Starts a transaction of diagram operations.
|
connectTo, connectTo, connectTo, createOutsideLabel, createOutsideLabel, getChildren, getIncidentLines, getOutsideLabels, getShape, move, move, move, move, resize, setMinHeight, setMinSize, setMinWidth, setSpacing
convertToBox, convertToBox, convertToContainer, convertToContainer, createBox, createBox, createBox, createContainer, createContainer, findChildContainerEnclosingRectangle, findDescendantEnclosingRectangle, getArrangeData, getArrangeStyle, getBoxes, getContainers, getDescendantBoxes, getDescendantBoxes, getDescendantBoxOutsideLabels, getDescendantContainers, getDescendantLines, getDescendantOutsideLabels, getLines, getOwner, getPureContainers, getUsedArrangeData, getUsedArrangeStyle, setArrangeStyle
contains, createInsideLabel, createInsideLabel, createInsideLabel, findNextRectangleEnclosingRectangle, getBottom, getCenter, getCenterX, getCenterY, getHeight, getInsideLabels, getLayoutConstraints, getLeft, getMinHeight, getMinWidth, getRight, getTop, getWidth, setConstraintType
getDiagram, getSpacing, remove
public Diagram(java.awt.geom.Rectangle2D.Double rectangle, ArrangeData.ArrangeStyle arrangeStyle, LayoutConstraints.ConstraintType constraintType)
rectangle
- the bounding rectangle of the new diagramarrangeStyle
- the style according to which to arrange the elements of the diagramconstraintType
- the type of the layout constraints for the diagrampublic Diagram(org.w3c.dom.Element element, java.util.LinkedHashMap<java.lang.Integer,java.lang.Object> objectMap)
objectMap
, from their IDs in the given XML.element
- an XML element representing a diagram.objectMap
- a map from object IDs in the XML to the objects of this diagram.public Diagram.State getState()
public double getRetraceDistance()
public void setRetraceDistance(double distance)
distance
- the new minimum retrace distancepublic java.awt.geom.Rectangle2D.Double getBounds()
getBounds
in class AbstractContainer
public void arrange()
public void startTransaction()
endTransaction()
, if
possible. Some operations may still be performed earlier, particularly if multiple operation
types are mixed in a single transaction. Transactions achieve better performance than
performing operations individually. Note that changes to the diagram's element hierarchy are
still immediate, only changes to their position are delayed.public void endTransaction()
startTransaction()
, then ends the current transaction.public void startManual()
public void endManual()
public void remove()
Element
public org.w3c.dom.Element saveToXML(org.w3c.dom.Document doc, java.util.LinkedHashMap<java.lang.Object,java.lang.Integer> idMap)
idMap
, using idMap.size()
as the ID for each new element.doc
- the document in which to create the elementidMap
- a map from the objects of this diagram to their IDs in the resulting XML.