Class UMLDocument
java.lang.Object
org.tquadrat.foundation.javadoc.umlgraph.UMLDocument
@ClassVersion(sourceVersion="$Id: UMLDocument.java 1282 2026-09-08 23:52:53Z tquadrat $")
@API(status=INTERNAL,
since="0.0.5")
public final class UMLDocument
extends Object
The container for a UML diagram.
- Author:
- Thomas Thrien - thomas.thrien@tquadrat.org
- Version:
- $Id: UMLDocument.java 1282 2026-09-08 23:52:53Z tquadrat $
- Since:
- 0.0.5
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String[]The CSS styles.private DimensionWidth and height for this UML diagram.private intThe id counter.private final SVGThe SVG that represents the diagram.private final Collection<TypeSymbol> The SVG symbols representing the types.static final SVGColorThe colour 'black'.static final SVGColorThe colour 'white'.static final doubleThe spacing between UML graph elements: 50.0 px.static final StringThe name of the CSS resource file: "resources/uml.css". -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal StringaddClippath(SVGRectangle clipRectangle) Creates an SVG<clipPath>element from the given rectangle and adds it to the SVG root element for this UML document.final voidaddConnector(UMLConnector connector) Adds a UML connector for two type elements to this UML document.final booleanaddSymbol(TypeSymbol symbol) Adds the symbol for a type element to the UML documentfinal voidPlaces a symbol in the output diagram.final StringcreateId()Creates a new id that is unique inside the current UML document instance.final SVGReturns the SVG root element for this UML document.final Optional<TypeSymbol> Returns the symbol with for the type element with the given name from this UML document.private static final String[]loadCSS()Loads the CSS from the resources.final voidsetDimension(double width, double height) Sets the width and height for the UML diagram.final StringtoString()
-
Field Details
-
UML_CSS
-
SVG_COLOR_BLACK
The colour 'black'. -
SVG_COLOR_WHITE
The colour 'white'. -
SVG_ELEMENT_SPACING
The spacing between UML graph elements: 50.0 px.- See Also:
-
m_Dimension
Width and height for this UML diagram. -
m_IdCounter
-
m_Root
-
m_TypeSymbols
The SVG symbols representing the types. -
m_CSSStyles
The CSS styles.
-
-
Constructor Details
-
UMLDocument
public UMLDocument()Creates a newUMLDocumentinstance.
-
-
Method Details
-
addClippath
Creates an SVG<clipPath>element from the given rectangle and adds it to the SVG root element for this UML document.- Parameters:
clipRectangle- The rectangle that defines the clip path.- Returns:
- The id of the new SVG
<clipPath>element.
-
addConnector
Adds a UML connector for two type elements to this UML document.- Parameters:
connector- The connector.
-
addSymbol
Adds the symbol for a type element to the UML document- Parameters:
symbol- The symbol to add.- Returns:
trueif the symbol was added,falseif not.
-
addUse
-
createId
-
getSVGRoot
Returns the SVG root element for this UML document.- Returns:
- The SVG root element.
-
getSymbol
Returns the symbol with for the type element with the given name from this UML document.- Parameters:
name- The name of the type element.- Returns:
- An instance of
Optionalthat contains the symbol.
-
loadCSS
Loads the CSS from the resources.- Returns:
- The CSS styles.
- Throws:
IOException- There is a problem on reading the resource with the CSS.
-
setDimension
Sets the width and height for the UML diagram.- Parameters:
width- The width.height- The height.
-
toString
-
