@OpenApiAll
public class PresentationElementsManager
extends java.lang.Object
SessionManager
.
This manager can be used only if some session was created with SessionManager. See code sample in SessionManager description for more details.
SessionManager
Modifier | Constructor and Description |
---|---|
protected |
PresentationElementsManager()
Private constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
changePathBreakPoints(PathElement element,
java.util.List newBreakPoints)
Changes the break points of the given PathElement.
|
void |
changePathPoints(PathElement element,
java.awt.Point supplierPoint,
java.awt.Point clientPoint,
java.util.List<java.awt.Point> newBreakPoints)
Changes the points of the given PathElement.
|
PathElement |
connectComment(ShapeElement comment,
PresentationElement target)
Connects given comment with note anchor to the given presentation element.
|
PathElement |
connectNote(ShapeElement noteOrComment,
PresentationElement target)
Connects given note or comment shape with an anchor to the given presentation element.
|
PathElement |
createContainmentLink(PresentationElement parentView,
PresentationElement childView)
Connects given parent and child elements with containment link.
|
ShapeElement |
createImageShape(DiagramPresentationElement diagram,
java.io.File imageFile)
Creates an image shape in the given diagram.
|
ShapeElement |
createImageShape(PresentationElement parent,
java.io.File imageFile,
java.awt.Point location)
Creates an image shape in the given parent.
|
ShapeElement |
createNote(DiagramPresentationElement diagram)
Creates a note in the given diagram.
|
ShapeElement |
createNote(PresentationElement parent,
java.awt.Point location)
Creates a note in the given parent.
|
PartView |
createPartShape(Property part,
PresentationElement parent,
java.util.List<Property> nestedPath,
boolean createRelationships,
java.awt.Point location)
Creates part shape on the diagram at a given coordinate.
|
PathElement |
createPathElement(Element relationship,
PresentationElement client,
PresentationElement supplier)
Creates a PathElement for given relationship between given client and supplier PresentationElements.
|
ShapeElement |
createRectangularShape(DiagramPresentationElement diagram)
Creates a rectangular shape in the given diagram.
|
ShapeElement |
createRectangularShape(PresentationElement parent,
java.awt.Point location)
Creates a rectangular shape in the given parent.
|
ShapeElement |
createSeparator(DiagramPresentationElement diagram)
Creates a separator shape in the given diagram.
|
ShapeElement |
createSeparator(PresentationElement parent,
java.awt.Point location)
Creates a separator shape in the parent.
|
PathElement |
createSequenceMessage(Message message,
MessageSort sort,
ShapeElement from,
ShapeElement to,
boolean recursive,
int diagonal,
Message insertAfter,
int verticalGap)
Creates a PathElement for given message between given client (from) and supplier (to) PresentationElements.
|
ShapeElement |
createShapeElement(Element element,
PresentationElement parent)
Creates a ShapeElement for given ModelElement in the given diagram.
|
ShapeElement |
createShapeElement(Element element,
PresentationElement parent,
boolean createRelationships)
Creates a ShapeElement for given ModelElement in the given diagram.
|
ShapeElement |
createShapeElement(Element element,
PresentationElement parent,
boolean createRelationships,
java.awt.Point location)
Creates a ShapeElement for given ModelElement in the given diagram.
|
SwimlaneView |
createSwimlane(java.util.List<? extends ActivityPartition> horizontal,
java.util.List<? extends ActivityPartition> vertical,
DiagramPresentationElement diagram)
Creates a swimlane in a given diagram.
|
ShapeElement |
createTextBox(DiagramPresentationElement diagram)
Creates a text box in the given diagram.
|
ShapeElement |
createTextBox(PresentationElement parent,
java.awt.Point location)
Creates a text box in the given parent.
|
void |
deletePresentationElement(PresentationElement element)
Removes given element from the diagram.
|
static PresentationElementsManager |
getInstance()
Returns an instance of this manager.
|
protected boolean |
isPresentationElementEditable(PresentationElement element) |
void |
movePresentationElement(PresentationElement view,
java.awt.Point location)
Moves a presentation element to the specified location.
|
void |
movePresentationElement(PresentationElement view,
PresentationElement parent,
java.awt.Point location)
Moves a presentation element to the given parent and the specified location.
|
void |
movePresentationElement(PresentationElement view,
PresentationElement parent,
java.awt.Point location,
boolean canChangeElementOwner)
Moves a presentation element to the given parent and the specified location.
|
void |
movePresentationElements(java.util.List<PresentationElement> views,
java.awt.Point location)
Moves a list of presentation elements to the specified location.
|
void |
movePresentationElements(java.util.List<PresentationElement> views,
PresentationElement parent,
java.awt.Point location)
Moves a list of presentation elements to the given parent and the specified location.
|
void |
movePresentationElements(java.util.List<PresentationElement> views,
PresentationElement parent,
java.awt.Point location,
boolean canChangeElementOwner)
Moves a list of presentation elements to the given parent and the specified location.
|
void |
resetLabelPositions(PathElement element)
Moves all given PathElement's labels to the default position(for example default position for name label
is a middle of the path).
|
void |
reshapeShapeElement(ShapeElement element,
java.awt.Rectangle newBounds)
Reshapes given ShapeElement.
|
void |
setConstraintForNote(ShapeElement note,
Constraint constraint)
Shows given constraint in the given note.
|
void |
setPresentationElementProperties(PresentationElement view,
PropertyManager propertyManager)
Changes symbol properties of a given presentation element.
|
void |
setText(ShapeElement shape,
java.lang.String text)
Sets text for given symbol.
|
protected PresentationElementsManager()
public static PresentationElementsManager getInstance()
public ShapeElement createShapeElement(Element element, PresentationElement parent) throws ReadOnlyElementException
element
- the given ModelElement to create ShapeElement for.parent
- presentation element in which symbol should be created. In case created symbol is illegal in such parent method can produce unpredictable results. Valid combination is such as package in package, class in package and etc.ReadOnlyElementException
- if diagram is read only.public ShapeElement createShapeElement(Element element, PresentationElement parent, boolean createRelationships, @CheckForNull java.awt.Point location) throws ReadOnlyElementException
element
- the given ModelElement to create ShapeElement for.createRelationships
- create relationships to other symbols or not.parent
- presentation element in which symbol should be created. In case created symbol is illegal in such parent method can produce unpredictable results. Valid combination is such as package in package, class in package and etc.location
- the location where the new symbol is placedReadOnlyElementException
- if diagram is read only.public ShapeElement createShapeElement(Element element, PresentationElement parent, boolean createRelationships) throws ReadOnlyElementException
element
- the given ModelElement to create ShapeElement for.createRelationships
- create relationships to other symbols or not.parent
- presentation element in which symbol should be created. In case created symbol is illegal in such parent method can produce unpredictable results. Valid combination is such as package in package, class in package and etc.ReadOnlyElementException
- if diagram is read only.public PathElement createPathElement(Element relationship, PresentationElement client, PresentationElement supplier) throws ReadOnlyElementException
relationship
- the given relationship.client
- a PresentationElement of relationship client.supplier
- a PresentationElement of relationship supplier.ReadOnlyElementException
- if diagram is read only.public void deletePresentationElement(PresentationElement element) throws ReadOnlyElementException
element
- the element to remove.ReadOnlyElementException
- if diagram is read only.protected boolean isPresentationElementEditable(PresentationElement element)
public void movePresentationElement(PresentationElement view, PresentationElement parent, java.awt.Point location) throws ReadOnlyElementException
view
- presentation element to move.parent
- parent to move into.location
- location to move to.ReadOnlyElementException
- if element permissions prohibited to perform this operation.public void movePresentationElement(PresentationElement view, PresentationElement parent, java.awt.Point location, boolean canChangeElementOwner) throws ReadOnlyElementException
view
- presentation element to move.parent
- parent to move into.location
- location to move to.canChangeElementOwner
- allow to change Element owner if needed by symbols structureReadOnlyElementException
- if element permissions prohibited to perform this operation.public void movePresentationElement(PresentationElement view, java.awt.Point location) throws ReadOnlyElementException
view
- symbol to move.location
- location to move to.ReadOnlyElementException
- if element permissions prohibited to perform this operation.public void movePresentationElements(java.util.List<PresentationElement> views, PresentationElement parent, java.awt.Point location) throws ReadOnlyElementException
views
- presentation elements to move.parent
- parent to move into.location
- location to move to.ReadOnlyElementException
- if element permissions prohibited to perform this operation.public void movePresentationElements(java.util.List<PresentationElement> views, PresentationElement parent, java.awt.Point location, boolean canChangeElementOwner) throws ReadOnlyElementException
views
- presentation elements to move.parent
- parent to move into.location
- location to move to.canChangeElementOwner
- allow to change Element owner if needed by symbols structureReadOnlyElementException
- if element permissions prohibited to perform this operation.public void movePresentationElements(java.util.List<PresentationElement> views, java.awt.Point location) throws ReadOnlyElementException
views
- presentation elements to move.location
- location to move to.ReadOnlyElementException
- if element permissions prohibited to perform this operation.public void reshapeShapeElement(ShapeElement element, java.awt.Rectangle newBounds) throws ReadOnlyElementException
element
- the ShapeElement to reshape.newBounds
- a new bounds of the element.ReadOnlyElementException
- if element is read only.public void changePathBreakPoints(PathElement element, java.util.List newBreakPoints) throws ReadOnlyElementException
element
- the given PathElement.newBreakPoints
- a list of new PathElement break pointsReadOnlyElementException
- if given element is read only and can't edit.java.lang.IllegalArgumentException
- if given element is null or if given breakpoints are nullpublic void changePathPoints(PathElement element, java.awt.Point supplierPoint, java.awt.Point clientPoint, java.util.List<java.awt.Point> newBreakPoints) throws ReadOnlyElementException
element
- the given PathElement.supplierPoint
- new supplierclientPoint
- new client pointnewBreakPoints
- a list of new PathElement break pointsReadOnlyElementException
- if given element is read only and can't editjava.lang.IllegalArgumentException
- if given element is null or if given breakpoints are nullpublic void resetLabelPositions(PathElement element) throws ReadOnlyElementException
element
- the given PathElement to reset labels for.ReadOnlyElementException
- if given element is read only and can not be editedjava.lang.IllegalArgumentException
- if given element is null.public void setPresentationElementProperties(PresentationElement view, PropertyManager propertyManager) throws ReadOnlyElementException
PresentationElement view = // some view ChoiceProperty property = (ChoiceProperty) view.getProperty(PropertyID.TAGGED_VALUES_DISPLAY_MODE); Property clonedProperty = property.clone(); clonedProperty.setValue(ClassifierView.IN_COMPARTMENT); // important to create a new property manager or clone the old one! PropertyManager properties = new PropertyManager(); properties.addProperty(clonedProperty); PresentationElementsManager.getInstance().setPresentationElementProperties(view, properties);
view
- symbol for which to change the property manager.propertyManager
- a newly created or cloned manager with new properties, do not reuse the old property manager.ReadOnlyElementException
- if given element is null and can not be edited.java.lang.IllegalArgumentException
- if given element and properties is null and the element 's type can't have properties.public ShapeElement createNote(DiagramPresentationElement diagram) throws ReadOnlyElementException
diagram
- the diagram to create ShapeElement in.ReadOnlyElementException
- if diagram is read only and cannot edit.java.lang.IllegalArgumentException
- if given diagram is null.public ShapeElement createNote(PresentationElement parent, @CheckForNull java.awt.Point location) throws ReadOnlyElementException
parent
- the parent to create Note inlocation
- location of created NoteReadOnlyElementException
- if diagram is read only and can not be editedjava.lang.IllegalArgumentException
- if parent is nullpublic ShapeElement createTextBox(DiagramPresentationElement diagram) throws ReadOnlyElementException
diagram
- the diagram to create ShapeElement in.ReadOnlyElementException
- if diagram is read only and cannot edit.java.lang.IllegalArgumentException
- if given diagram is null.public ShapeElement createImageShape(PresentationElement parent, java.io.File imageFile, @CheckForNull java.awt.Point location) throws ReadOnlyElementException
parent
- the parent to create Image Shape inimageFile
- image filelocation
- location of created Image ShapeReadOnlyElementException
- if diagram is read only and can not be editedjava.lang.IllegalArgumentException
- if parent is nullpublic ShapeElement createImageShape(DiagramPresentationElement diagram, java.io.File imageFile) throws ReadOnlyElementException
diagram
- the diagram to create Image Shape inimageFile
- image fileReadOnlyElementException
- if diagram is read only and cannot edit.java.lang.IllegalArgumentException
- if given diagram is null.public ShapeElement createTextBox(PresentationElement parent, @CheckForNull java.awt.Point location) throws ReadOnlyElementException
parent
- the parent to create TextBox inlocation
- location of TextBoxReadOnlyElementException
- if diagram is read only and can not be editedjava.lang.IllegalArgumentException
- if given parent is nullpublic ShapeElement createSeparator(DiagramPresentationElement diagram) throws ReadOnlyElementException
diagram
- the diagram to create ShapeElement in.ReadOnlyElementException
- if diagram is read only and cannot edit.java.lang.IllegalArgumentException
- if given diagram is null.public ShapeElement createSeparator(PresentationElement parent, @CheckForNull java.awt.Point location) throws ReadOnlyElementException
parent
- the parent to create Separator inlocation
- location of SeparatorReadOnlyElementException
- if diagram is read only and can not be editedjava.lang.IllegalArgumentException
- if given parent is nullpublic ShapeElement createRectangularShape(DiagramPresentationElement diagram) throws ReadOnlyElementException
diagram
- the diagram to create ShapeElement in.ReadOnlyElementException
- if diagram is read only and cannot edit.java.lang.IllegalArgumentException
- if given diagram is null.public ShapeElement createRectangularShape(PresentationElement parent, @CheckForNull java.awt.Point location) throws ReadOnlyElementException
parent
- the parent to create Rectangular Shape inlocation
- location of shapeReadOnlyElementException
- if diagram is read only and can not be editedjava.lang.IllegalArgumentException
- if given parent is nullpublic PathElement connectNote(ShapeElement noteOrComment, PresentationElement target) throws ReadOnlyElementException
noteOrComment
- the given note or comment shape.target
- the presentation element to connect note (or comment) to.ReadOnlyElementException
- if note (or comment) is read-only and cannot edit.java.lang.IllegalArgumentException
- if given note is not instance of NoteView or comment is not instance of CommentView.public PathElement connectComment(ShapeElement comment, PresentationElement target) throws ReadOnlyElementException
comment
- comment to connect.target
- the presentation element to connect comment to.ReadOnlyElementException
- if comment is read-only and not editable.java.lang.IllegalArgumentException
- if given comment is not an instance of CommentView.public void setText(ShapeElement shape, java.lang.String text) throws ReadOnlyElementException
shape
- the given symbol.text
- a new text for a given symbol.ReadOnlyElementException
- if diagram is read only.java.lang.IllegalArgumentException
- if given node is not instance of NoteView,TextBoxView,SeparatorView.public void setConstraintForNote(ShapeElement note, Constraint constraint) throws ReadOnlyElementException
note
- the given note.constraint
- the given constraint.ReadOnlyElementException
- if note is read only and cannot edit.java.lang.IllegalArgumentException
- if given node is not instance of NoteView.public SwimlaneView createSwimlane(java.util.List<? extends ActivityPartition> horizontal, java.util.List<? extends ActivityPartition> vertical, DiagramPresentationElement diagram) throws ReadOnlyElementException
horizontal
- list of horizontal partitionsvertical
- list of vertical partitionsdiagram
- parent for swimlaneReadOnlyElementException
- if given diagram is read only and cannot edit.java.lang.IllegalArgumentException
- if given diagram is null.public PathElement createContainmentLink(PresentationElement parentView, PresentationElement childView) throws ReadOnlyElementException
parentView
- the presentation element of the parent element.childView
- the presentation element of the child element.ReadOnlyElementException
- if diagram is read only.java.lang.IllegalArgumentException
- if parent element does not contain child element.public PathElement createSequenceMessage(Message message, MessageSort sort, ShapeElement from, ShapeElement to, boolean recursive, int diagonal, Message insertAfter, int verticalGap) throws ReadOnlyElementException
message
- the given message.sort
- message sort.from
- a ShapeElement of message client lifeline.to
- a ShapeElement of message supplier lifeline.recursive
- true if message is recursive (recursive message can be only when from == to).diagonal
- vertical size of diagonal message, or 0 if the message is not diagonal.insertAfter
- the new message is inserted after this message, or null to insert before all messages.verticalGap
- vertical gap before the new message.ReadOnlyElementException
- if diagram is read only.@CheckForNull public PartView createPartShape(Property part, PresentationElement parent, java.util.List<Property> nestedPath, boolean createRelationships, @CheckForNull java.awt.Point location) throws ReadOnlyElementException
part
- part for which to create a shape.parent
- parent symbol in which to add the part.nestedPath
- a list of nested parts in which to nest the given part symbol.createRelationships
- controls whether to display connected paths.location
- location on the diagram where to move the part.ReadOnlyElementException
- if diagram is read only.