Class DiagramPresentationElement
- java.lang.Object
-
- com.nomagic.magicdraw.uml.MDElementImpl
-
- com.nomagic.magicdraw.uml.ElementImpl
-
- com.nomagic.magicdraw.uml.symbols.PresentationElement
-
- com.nomagic.magicdraw.uml.symbols.DiagramPresentationElement
-
- All Implemented Interfaces:
com.nomagic.magicdraw.core.diagram.DiagramPresentationImplementer
,BaseElement
,MDElement
,ModelElementProvider
,com.nomagic.magicdraw.uml.symbols.shapes.DiagramFrameHeaderOwner
,StereotypesDisplayModeOwner
,NameOwner
,java.beans.PropertyChangeListener
,java.lang.Cloneable
,java.lang.Comparable
,java.util.EventListener
@OpenApi public class DiagramPresentationElement extends PresentationElement implements com.nomagic.magicdraw.uml.symbols.shapes.DiagramFrameHeaderOwner, StereotypesDisplayModeOwner, com.nomagic.magicdraw.core.diagram.DiagramPresentationImplementer
Class for representing UML diagram. Diagram purpose is to contain set of presentation elements.
For diagram creation useModelElementsManager
class.
For working with diagram presentation elements usePresentationElementsManager
class.- See Also:
ModelElementsManager
,PresentationElementsManager
-
-
Field Summary
-
Fields inherited from class com.nomagic.magicdraw.uml.symbols.PresentationElement
DASHED_STROKE, DOTTED_STROKE, SOLID_STROKE
-
Fields inherited from interface com.nomagic.magicdraw.uml.symbols.shapes.StereotypesDisplayModeOwner
DSL_STEREOTYPE_DISPLAY_MODE_ALL, DSL_STEREOTYPE_DISPLAY_MODE_LAST, DSL_STEREOTYPE_DISPLAY_MODE_NONE, DSL_STEREOTYPE_DISPLAY_MODES, STEREOTYPE_DISPLAY_MODE_DO_NOT_DISPLAY_STEREOTYPES, STEREOTYPE_DISPLAY_MODE_ICON, STEREOTYPE_DISPLAY_MODE_SHAPE_IMAGE, STEREOTYPE_DISPLAY_MODE_SHAPE_IMAGE_AND_TEXT, STEREOTYPE_DISPLAY_MODE_TEXT, STEREOTYPE_DISPLAY_MODE_TEXT_AND_ICON, STEREOTYPES_DISPLAY_MODES, STEREOTYPES_DISPLAY_MODES_SIMPLE
-
-
Constructor Summary
Constructors Constructor Description DiagramPresentationElement()
Constructs new empty diagram.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
accept(Visitor visitor)
Method accepts visitor, and calls method visit<class name>(this) of visitor .boolean
addContentPropertyChangeListener(java.beans.PropertyChangeListener listener)
Registers the listener for changes in all symbols contained in the diagram.void
close()
Closes diagram window.java.util.Collection<PresentationElement>
collectPresentationElementsRecursively()
Collects all elements in this diagram recursively.java.util.Collection<PresentationElement>
collectShowingManipulatedElementsRecursively()
Collects all visible manipulated elements in this diagram recursively.java.util.Collection<PresentationElement>
collectShowingPresentationElementsRecursively()
Collects all visible elements in this diagram recursively.void
ensureLoaded()
Ensures that diagram is loaded.PresentationElement
findPresentationElement(Element element, java.lang.Class presentationElementClass)
Finds presentation element for given model element of given symbol type in this diagram.PresentationElement
findPresentationElementForPathConnecting(BaseElement element, java.lang.Class presentationElementClass)
Finds presentation element to connect some PathElement for given model element of given type in this diagram.java.util.stream.Stream<PresentationElement>
findPresentationElementsForPathConnecting(Element element, java.lang.Class presentationElementClass)
Finds presentations element to connect some PathElement for given model element of given type in this diagram.Diagram
getDiagram()
Returns Diagram model element of this presentation element.DiagramFrameView
getDiagramFrame()
Get the frame of the diagram.DiagramType
getDiagramType()
Returns the type of the diagram.java.util.Collection<Element>
getUsedModelElements()
Returns collection of model elements that has views in this diagram.java.util.Collection<Element>
getUsedModelElements(boolean checkOnlyPersistent)
Deprecated.checkOnlyPersistent parameter is ignored.java.util.Set<Element>
getUsedModelElements(UsedElementPolicy usedElementPolicy)
Returns collection of model elements that are used in this diagram.boolean
isElementInDiagram(Element element)
Checks if given element exist in any diagram.boolean
isElementInDiagram(Element element, UsedElementPolicy usedElementPolicy)
Checks if given element exist in any diagram.boolean
isInitialFrameSizeSet()
boolean
isLoaded()
Check if diagram is loaded.boolean
isSymbolDiagram()
Checks if diagram displays symbols as its contents.boolean
layout(boolean useCommands)
Layout the diagram using default layouter.boolean
layout(boolean useCommands, DiagramLayouter layouter)
Layouts the diagram with the specified layouter.boolean
layout(boolean useCommands, DiagramLayouter diagramLayouter, AbstractDiagramLayouterOptionsGroup options)
Layout the diagram.void
open()
Open the diagramvoid
open(boolean showProgress)
Open the diagram in a new diagram tab, or activates diagram tab if this diagram is already openvoid
openInActiveTab(boolean showProgress)
Open diagram in currently active diagram tab If no other diagram is opened yet, creates a new tab If this diagram is already opened, simply activates that tabboolean
removeContentPropertyChangeListener(java.beans.PropertyChangeListener listener)
Unregister the given listener from the diagram.void
setDiagramType(DiagramType type)
Sets the type of the diagram and fires the property change event with name ExtendedPropertyNames.EDIT_DIAGRAM_TYPE .void
setInitialFrameSizeSet(boolean value)
Set a flag that diagram frame size should not be recalculated on opening.void
sSetDiagramType(DiagramType type)
Sets the type of the diagram.-
Methods inherited from class com.nomagic.magicdraw.uml.symbols.PresentationElement
addProperty, collectSubManipulatedElements, editName, editName, getBoundsShape, getManipulatedParent, getManipulatedPresentationElements, getMiddlePoint, getObjectParent, getParent, getPreferredDimension, getPreferredSize, getPresentationElementStroke, getPresentationElementStroke, getPropertyManager, getSelected, getStroke, getStroke, getStroke, getStroke, getStroke, getStroke, hasManipulatedPresentationElements, isSelected, onFind, onFind, setAllSelected, setSelected, setSelected
-
Methods inherited from class com.nomagic.magicdraw.uml.MDElementImpl
accept, canAdd, canAdd, canAddChild, canBeDeleted, compareTo, createSortKeys, getClassType, getCommandForAppending, getProject, getProjectProvider, getResourceID, getSortKeys, hasListeners, isEditable, removeAllChildren, removeAllParents, removeAllPropertyChangeListeners, setProjectProvider, sGetID, toString
-
-
-
-
Method Detail
-
sSetDiagramType
@OpenApi public void sSetDiagramType(@CheckForNull DiagramType type)
Sets the type of the diagram.- Parameters:
type
- the type of the diagram
-
setDiagramType
@OpenApi public void setDiagramType(DiagramType type)
Sets the type of the diagram and fires the property change event with name ExtendedPropertyNames.EDIT_DIAGRAM_TYPE .- Parameters:
type
- the type of the diagram- See Also:
ExtendedPropertyNames.EDIT_DIAGRAM_TYPE
,Project
-
getDiagramType
@OpenApi public DiagramType getDiagramType()
Returns the type of the diagram.- Returns:
- the type of the diagram
- See Also:
DiagramTypes.UML_CLASS_DIAGRAM
,DiagramTypes.UML_USECASE_DIAGRAM
,DiagramTypes.UML_COMMUNICATION_DIAGRAM
,DiagramTypes.UML_SEQUENCE_DIAGRAM
,DiagramTypes.UML_STATECHART_DIAGRAM
,DiagramTypes.UML_PROTOCOL_STATE_MACHINE_DIAGRAM
,DiagramTypes.UML_ACTIVITY_DIAGRAM
,DiagramTypes.UML_COMPOSITE_STRUCTURE_DIAGRAM
,DiagramTypes.UML_OBJECT_DIAGRAM
,DiagramTypes.UML_PACKAGE_DIAGRAM
,DiagramTypes.UML_COMPONENT_DIAGRAM
,DiagramTypes.UML_DEPLOYMENT_DIAGRAM
,DiagramTypes.UML_PROFILE_DIAGRAM
-
getDiagram
@OpenApi public Diagram getDiagram()
Returns Diagram model element of this presentation element.- Returns:
- Diagram object of this element.
- See Also:
getElement()
-
accept
@OpenApi public void accept(Visitor visitor) throws java.lang.Exception
Description copied from interface:MDElement
Method accepts visitor, and calls method visit<class name>(this) of visitor . See Visitor pattern for more details.
-
open
@OpenApi public void open()
Open the diagram
-
open
@OpenApi public void open(boolean showProgress)
Open the diagram in a new diagram tab, or activates diagram tab if this diagram is already open- Parameters:
showProgress
- show progress dialog
-
openInActiveTab
@OpenApi public void openInActiveTab(boolean showProgress)
Open diagram in currently active diagram tab If no other diagram is opened yet, creates a new tab If this diagram is already opened, simply activates that tab- Parameters:
showProgress
- show progress dialog
-
findPresentationElement
@OpenApi @CheckForNull public final PresentationElement findPresentationElement(@CheckForNull Element element, @CheckForNull java.lang.Class presentationElementClass)
Finds presentation element for given model element of given symbol type in this diagram. Does recursive search in the diagram.- Parameters:
element
- the given ModelElement.presentationElementClass
- the class of presentation element or null if any.- Returns:
- found presentation element or null if given ModelElement does not have presentation element in this diagram.
-
findPresentationElementForPathConnecting
@CheckForNull @OpenApi public final PresentationElement findPresentationElementForPathConnecting(BaseElement element, java.lang.Class presentationElementClass)
Finds presentation element to connect some PathElement for given model element of given type in this diagram. Does recursive search. For example if TemplateSignature will be passes as element, Class owning that signature will be found.- Parameters:
element
- the given ModelElementpresentationElementClass
- the class of presentation element or null if any.- Returns:
- found presentation element or null if given ModelElement does not have presentation element in this diagram.
-
findPresentationElementsForPathConnecting
@OpenApi public final java.util.stream.Stream<PresentationElement> findPresentationElementsForPathConnecting(Element element, java.lang.Class presentationElementClass)
Finds presentations element to connect some PathElement for given model element of given type in this diagram. Does recursive search. For example if TemplateSignature will be passes as element, Class owning that signature will be found.- Parameters:
element
- the given ModelElementpresentationElementClass
- the class of presentation element or null if any.- Returns:
- a stream of presentation elements
-
isLoaded
@OpenApi public boolean isLoaded()
Check if diagram is loaded.- Returns:
- true if diagram contents is loaded
-
ensureLoaded
@OpenApi public void ensureLoaded()
Ensures that diagram is loaded. If diagram is not loaded, loads it. Make sure the project is active before invoking this method. Otherwise diagram may not be loaded.
-
close
@OpenApi public final void close()
Closes diagram window.
-
layout
@OpenApi public boolean layout(boolean useCommands)
Layout the diagram using default layouter.Make sure before doing layout:
- diagram is opened - use
open()
to open diagram. - session is closed - use
SessionManager.closeSession(Project)
to close session.
PresentationElement.setSelected(java.util.List)
()} to selects symbols in the diagram.- Parameters:
useCommands
- true to create commands. If true, this command will be available in project's command history.- Returns:
- true if layout was performed.
- diagram is opened - use
-
layout
@OpenApi public boolean layout(boolean useCommands, DiagramLayouter layouter)
Layouts the diagram with the specified layouter.Make sure before doing layout:
- diagram is opened - use
open()
to open diagram. - session is closed - use
SessionManager.closeSession(Project)
to close session.
PresentationElement.setSelected(java.util.List)
()} to selects symbols in the diagram.- Parameters:
useCommands
- true to create commands. If true, this command will be available in project's command historylayouter
- layouter to be used for layouting- Returns:
- true if layout was performed.
- diagram is opened - use
-
layout
@OpenApi public boolean layout(boolean useCommands, DiagramLayouter diagramLayouter, AbstractDiagramLayouterOptionsGroup options)
Layout the diagram.Make sure before doing layout:
- diagram is opened - use
open()
to open diagram. - session is closed - use
SessionManager.closeSession(Project)
to close session.
PresentationElement.setSelected(java.util.List)
()} to selects symbols in the diagram.- Parameters:
useCommands
- true to create commands. If true, this command will be available in project's command historydiagramLayouter
- layouter to useoptions
- layout options- Returns:
- true if layout was performed
- diagram is opened - use
-
getUsedModelElements
@OpenApi @Deprecated public java.util.Collection<Element> getUsedModelElements(boolean checkOnlyPersistent)
Deprecated.checkOnlyPersistent parameter is ignored. UsegetUsedModelElements()
Returns collection of model elements that are drawn in this diagram.- Parameters:
checkOnlyPersistent
- if true, result includes elements for symbols which are saved to XMI and not created at run-time. If false, includes all elements.- Returns:
- collection of model elements.
-
getUsedModelElements
@OpenApi public java.util.Collection<Element> getUsedModelElements()
Returns collection of model elements that has views in this diagram.- Returns:
- collection of model elements.
-
getUsedModelElements
@OpenApi public java.util.Set<Element> getUsedModelElements(UsedElementPolicy usedElementPolicy)
Returns collection of model elements that are used in this diagram.- Parameters:
usedElementPolicy
- used element policy- Returns:
- collection of model elements.
-
collectShowingManipulatedElementsRecursively
@OpenApi public java.util.Collection<PresentationElement> collectShowingManipulatedElementsRecursively()
Collects all visible manipulated elements in this diagram recursively.- Returns:
- manipulated elements in this diagram
-
collectShowingPresentationElementsRecursively
@OpenApi public java.util.Collection<PresentationElement> collectShowingPresentationElementsRecursively()
Collects all visible elements in this diagram recursively.- Returns:
- visible elements in this diagram
-
collectPresentationElementsRecursively
@OpenApi public java.util.Collection<PresentationElement> collectPresentationElementsRecursively()
Collects all elements in this diagram recursively.- Returns:
- elements in this diagram
-
isElementInDiagram
@OpenApi public boolean isElementInDiagram(Element element)
Checks if given element exist in any diagram.- Parameters:
element
- element- Returns:
- true if element exist in any diagram otherwise false
-
isElementInDiagram
@OpenApi public boolean isElementInDiagram(Element element, UsedElementPolicy usedElementPolicy)
Checks if given element exist in any diagram.- Parameters:
element
- element- Returns:
- true if element exist in any diagram otherwise false
-
getDiagramFrame
@OpenApi @CheckForNull public DiagramFrameView getDiagramFrame()
Get the frame of the diagram.- Returns:
- frame of the diagram.
-
addContentPropertyChangeListener
@OpenApi public boolean addContentPropertyChangeListener(java.beans.PropertyChangeListener listener)
Registers the listener for changes in all symbols contained in the diagram.- Parameters:
listener
- thePropertyChangeListener
to be added- Returns:
- true if listener was added - it wasn't there yet, otherwise false
-
removeContentPropertyChangeListener
@OpenApi public boolean removeContentPropertyChangeListener(java.beans.PropertyChangeListener listener)
Unregister the given listener from the diagram.- Parameters:
listener
- the PropertyChangeListener to be removed- Returns:
- true if listener was removed
-
isInitialFrameSizeSet
@OpenApi public boolean isInitialFrameSizeSet()
- Returns:
- false if diagram frame size should not recalculated on opening.
-
setInitialFrameSizeSet
@OpenApi public void setInitialFrameSizeSet(boolean value)
Set a flag that diagram frame size should not be recalculated on opening.- Parameters:
value
- new value
-
isSymbolDiagram
@OpenApi public boolean isSymbolDiagram()
Checks if diagram displays symbols as its contents. Other type of diagrams may be tables, matrices.- Returns:
- true if diagram displays symbols
-
-