Class PresentationElement
java.lang.Object
com.nomagic.magicdraw.uml.MDElementImpl
com.nomagic.magicdraw.uml.symbols.PresentationElement
- All Implemented Interfaces:
BaseElement
,MDElement
,ModelElementProvider
,NameOwner
,PropertyChangeListener
,Cloneable
,Comparable
,EventListener
- Direct Known Subclasses:
AbstractDiagramPresentationElement
,PathConnector
@OpenApi
public abstract class PresentationElement
extends com.nomagic.magicdraw.uml.MDElementImpl
implements PropertyChangeListener, ModelElementProvider, NameOwner
Base class for all visual elements used in the UML diagrams.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Dashed path stroke.static final int
static final int
Dotted path stroke.static final int
static final double
static final double
protected com.dassault_systemes.modeler.foundation.diagram.style.PresentationElementStyle
static final int
Symbol shadow width in pixelsstatic final int
Solid path stroke. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal void
Add given child to this symbol.void
addPresentationElement
(PresentationElement element, int index) Add given child to this symbol at given indexvoid
final void
addProperty
(Property prop) Deprecated, for removal: This API element is subject to removal in a future version.adjustBoundsBeforeChange
(Rectangle rec, boolean autosizeOperation, Collection<PresentationElement> movedTogether) Validate bounds before bounds change operationvoid
adjustChildBounds
(Rectangle bounds, PresentationElement element) For adjusting child bounds when child type is not known but bounds should be corrected.void
adjustChildBoundsForMoving
(Rectangle bounds, PresentationElement element) For adjusting child bounds when child type is not known but bounds should be corrected.boolean
final void
applyProperties
(com.dassault_systemes.modeler.magic.diagram.styledelegates.PresentationElementStyleChanger changer) Applies properties from given property managerboolean
Declared as interface with default implementation for subclasses.void
atInsert()
Invalidates object at insertprotected void
void
Autosize and resize manipulated element - itself(if this element has manipulator) or manipulated parent.void
Resize itself and initiate parent resizeboolean
beforeDelete
(com.dassault_systemes.modeler.foundation.editing.CompositeCommand deleteCommand, Collection removeTogether) Method is called before deleting symbol with user "DELETE" actionfinal void
final void
boundsChanged
(Rectangle bounds) final boolean
canAddChild
(BaseElement element) boolean
canAddChild
(PresentationElement symbol) Check of given symbol can be added as child into this symbol.final boolean
canAddInstance
(BaseElement element) Checks if this object can add element of given type.boolean
canAddInstance
(PresentationElement symbol) Object view has no children.protected boolean
Some symbols removes themselves on update if they are not valid by model anymore.boolean
canChangeElementOwner
(Collection<PresentationElement> movedTogether, BaseElement newParent) Returns true, if symbol does not restrict it's element ownership changeboolean
canChangeParent
(Collection<? extends PresentationElement> movedTogether, BaseElement newParent, boolean changeElementParent) Returns true, if element can change parent.final boolean
canChangeParent
(Collection children, BaseElement newParent) Returns true, if element can change parent.protected boolean
canFill()
boolean
void
changeProperties
(com.dassault_systemes.modeler.magic.diagram.styledelegates.PresentationElementStyleChanger changer) boolean
protected com.nomagic.magicdraw.uml.symbols.PresentationElementVisibility
checkProxyVisibility
(com.nomagic.magicdraw.uml.symbols.PresentationElementVisibility visibility) protected boolean
protected final List<PresentationElement>
Calculates selected children for moving or takes result from cached.void
clone()
final void
Collects all visible and manipulated elements in this hierarchy.final void
collectSubPresentationElements
(Collection<PresentationElement> collection) Collects all sub-presentation elements into given collection.final void
collectSubPresentationElements
(Collection<PresentationElement> collection, Predicate<PresentationElement> predicate) Collects all sub-presentation elements that match given predicate into given collection.final void
Collect all visible children starting from current element.final boolean
coversPoint
(int x, int y) checks if object covers provided pointabstract boolean
coversPoint
(int x, int y, com.nomagic.magicdraw.uml.symbols.IntersectionKind kind) checks if object covers provided pointcom.nomagic.magicdraw.uml.symbols.FillStrategy
protected com.dassault_systemes.modeler.foundation.diagram.style.PresentationElementStyle
Creates the presentation element style for this presentation element.final void
protected void
createSmartListenerConfig
(List<SmartListenerConfig> configurations) void
dispose()
disposes ends of links when link is deletedprotected void
Removes all children from itself.protected void
void
draw
(com.nomagic.magicdraw.uml.symbols.DiagramPaintContext context) Draw symbol using renderer or symbol specific draw if renderer is not available.void
drawBackground
(com.nomagic.magicdraw.uml.symbols.DiagramPaintContext context) final void
drawSymbol
(com.nomagic.magicdraw.uml.symbols.DiagramPaintContext context) Draw symbol as defined by standard notation.void
drawSymbolBackground
(com.nomagic.magicdraw.uml.symbols.DiagramPaintContext context) int
int
dynamicLineWidth
(int width) boolean
final BasicStroke
dynamicStroke
(int width) dynamicStroke
(BasicStroke stroke) dynamicStyleFillColor
(Color color, boolean useFill) final Color
dynamicStyleLineColor
(Color color) final Color
dynamicStyleTextColor
(Color color) final int
final int
dynamicStyleTransparency
(Icon target) protected <T> T
dynamicStyleValue
(T merged, BiFunction<com.dassault_systemes.modeler.foundation.common.style.DynamicStyle, T, T> valueProvider) com.nomagic.magicdraw.uml.symbols.shapes.TextObject.HorizontalPosition
dynamicTextAlignment
(com.nomagic.magicdraw.uml.symbols.shapes.TextObject.HorizontalPosition target) final void
Starts online diagram editing for a symbolvoid
Starts online diagram editing for a symbolcom.dassault_systemes.modeler.foundation.model.ModelElement
Returns element owner for given child.com.dassault_systemes.modeler.foundation.model.ModelElement
findOwnerForElement
(PresentationElement newParent, com.dassault_systemes.modeler.foundation.model.ModelElementOwnershipContext ownershipContext) static PresentationElement
findPresentationElement
(Collection<PresentationElement> elements, com.dassault_systemes.modeler.foundation.model.ModelElement modelElement) Finds presentation element with given Element among given elementsvoid
firePropertyChange
(String propertyName, Object oldValue, Object newValue) DelegatesfirePropertyChange
to thePropertyChangeSupport
, the member of this class, which reports a bound property update to any registered listeners.Generate ID.Returns diagram of this presentation element.Because some views returns theirs parent model element, we do not know have they this member set or not.List<com.nomagic.magicdraw.uml.symbols.SymbolDecorator>
final Class[]
Returns an array of ModelElements classes that can be assigned as ModelElement to this PresentationElement.Method returns bounds of this element.final Shape
getBoundsShape
(ConverterToShape converterToShape) Provides a bounding shape of the symbolReturn bounds of the symbol that must be repainted.Gets a point for centerline drawing.int
Gets x coordinate for centerline drawing.int
Gets y coordinate for centerline drawing.Returns child element for showing context menu.protected final SmartListenerConfig
Deprecated, for removal: This API element is subject to removal in a future version.useDiagramPresentationElement.get(PresentationElement)
.Will be removed in 2026x.Deprecated, for removal: This API element is subject to removal in a future version.protected List<SmartListenerConfig>
Gets non-cacheable smart listener configurations.com.dassault_systemes.modeler.foundation.diagram.style.StylePropertyDelegate
final PresentationElement
Returns model element of this presentation element.final Collection<? extends Element>
The same as getElementsForLinkConnecting(), just takes into account SymbolDecoratorsfinal Element
getElementToConnectRelationship
(Element relationship, boolean asClient) The same as#internalGetElementToConnectRelationship(Element, boolean)
, just takes into account SymbolDecoratorsReturns fill colorgetFont()
Gets font of this object view.final int
Gets font height.static FontRenderContext
Returns human representation of the data typeReturns human representation of the data typegetIntersection
(int x, int y, PathElement path) Returns line colorint
final PresentationElement
Gets manipulated symbol at specified point pt.getManipulatedElementAt
(Point pt, com.nomagic.magicdraw.uml.symbols.IntersectionKind intersectionKind) Gets manipulated symbol at specified point pt.getManipulatedElementAt
(Point pt, com.nomagic.magicdraw.uml.symbols.SortManagerProvider sortManagerProvider) Gets manipulate symbol at specified point pt.Returns vector of manipulated objects whose intersect with given rectanglegetManipulatedIntersectionWith
(Rectangle rect, boolean completelyCovered) Returns vector of manipulated objects whose intersect with given rectanglegetManipulatedIntersectionWith
(Rectangle rect, boolean completelyCovered, com.nomagic.magicdraw.uml.symbols.IntersectionKind kind) Returns vector of manipulated objects whose intersect with given rectanglegetManipulatedIntersectionWith
(Rectangle rect, com.nomagic.magicdraw.uml.symbols.IntersectionKind kind) Returns vector of manipulated objects whose intersect with given rectanglefinal PresentationElement
final List<PresentationElement>
Returns a list of children of this element those have manipulator.getManipulationBounds
(Point relativePoint) Gets manipulation bounds of the symbol.Returns middle point of this element.getMiddlePoint
(Point relativePoint) Gets middle point of this view,int
protected int
getMiddlePointX
(Point relativePoint) int
protected int
getMiddlePointY
(Point relativePoint) get minimum possible size for objectcom.dassault_systemes.modeler.foundation.model.ModelElement
final Collection<? extends com.dassault_systemes.modeler.foundation.model.ModelElement>
Returns all possible element that can be used for relationships connecting.final com.dassault_systemes.modeler.foundation.model.ModelElement
getModelElementToConnectRelationship
(com.dassault_systemes.modeler.foundation.model.ModelElement relationship, boolean asClient) The same asinternalGetModelElementToConnectRelationship(ModelElement, boolean)
, just takes into account SymbolDecoratorscom.dassault_systemes.modeler.foundation.model.ModelElement
Returns element that should be used for during "move" operation.get not copy bounds of object throws NoRectangleDefinedExceptionprotected int
Returns the presentation element parent.com.dassault_systemes.modeler.foundation.diagram.style.StylePropertyDelegate
final PresentationElement
Returns parent of this element.Returns parent to which this symbol delegates style attributes related functionality.Calculate the smallest rectangle which would fit all contained shapesReturns preferable dimension of the element.Returns preferable dimension of the element for autosize.This implementation simple returns preferred size.final Dimension
Deprecated, for removal: This API element is subject to removal in a future version.final PresentationElement
getPresentationElementAt
(int index) Gets object view at specified position from containerfinal PresentationElement
Gets object view at point.getPresentationElementAt
(Point pt, com.nomagic.magicdraw.uml.symbols.IntersectionKind kind) Gets object view at point.final PresentationElement
getPresentationElementAt
(Point relativePoint, com.nomagic.magicdraw.uml.symbols.SortManagerProvider sortManagerProvider) Gets object view at point.getPresentationElementAt
(Point relativePoint, com.nomagic.magicdraw.uml.symbols.SortManagerProvider sortManagerProvider, com.nomagic.magicdraw.uml.symbols.IntersectionKind kind) Gets object view at point.final int
Returns children count in container.int
Get index of the given presentation element in the container.Returns all children of this elementfinal List<PresentationElement>
Gets objects at point.getPresentationElementsAt
(Point p, com.nomagic.magicdraw.uml.symbols.IntersectionKind kind) Gets objects at point.getPresentationElementsAt
(Point relativePoint, com.nomagic.magicdraw.uml.symbols.SortManagerProvider sortManagerProvider) Gets object view at point.getPresentationElementsAt
(Point relativePoint, com.nomagic.magicdraw.uml.symbols.SortManagerProvider sortManagerProvider, com.nomagic.magicdraw.uml.symbols.IntersectionKind kind) Gets object view at point.final BasicStroke
Return a stroke used to paint symbol's main partfinal BasicStroke
getPresentationElementStroke
(int width) Return a stroke used to paint symbol's main partDeprecated, for removal: This API element is subject to removal in a future version.final Property
getProperty
(String propertyId) Deprecated, for removal: This API element is subject to removal in a future version.usePresentationElementsManager#getProperty(PresentationElement)
.final PropertyManager
Deprecated, for removal: This API element is subject to removal in a future version.com.nomagic.magicdraw.uml.symbols.SymbolDecorator
Gets rendered which could decorate this symbol.Returns a list of selected elements in the diagram.static BasicStroke
getStroke
(float width, int cap, int join, float miterLimit, float[] dash, float dash_phase) Get cached stroke.static BasicStroke
getStroke
(int lineStyle) Get cached stroke of given style and default width.static BasicStroke
getStroke
(int lineStyle, int width) Get cached stroke of given style and width.static BasicStroke
getStroke
(int lineStyle, int width, int join) Get cached stroke of given style, width and join.static BasicStroke
getStroke
(int lineStyle, int width, int join, int cap) Get cached stroke of given style, width and join.static BasicStroke
getStroke
(BasicStroke stroke, int width) Get cached stroke of given width.com.dassault_systemes.modeler.foundation.diagram.style.PresentationElementStyle
getStyle()
protected static com.nomagic.magicdraw.uml.symbols.SymbolDecorator
getSymbolRenderer
(PresentationElement presentationElement) final int
Returns tolerancecom.nomagic.magicdraw.uml.symbols.PresentationElementVisibility
final List<PresentationElement>
protected void
Handles model element delete property Change event.final boolean
boolean
Returns true, if view has manipulator (is selectable)boolean
Returns true ifModelElement
of this symbol can represented with other symbol.void
Initialize symbol and its children state.final void
Initialize symbol and call autosize recursivelyprotected void
internalApplyProperties
(com.dassault_systemes.modeler.magic.diagram.styledelegates.PresentationElementStyleChanger changer) Applies properties from given property managerprotected void
internalBeforeUpdate
(com.nomagic.magicdraw.uml.symbols.SymbolDecorator renderer) protected void
internalCreatePropertyChangeListener
(com.nomagic.magicdraw.uml.symbols.PresentationElement.SmartListenerConfigData data) internalGetBoundsShape
(ConverterToShape converterToShape) Collection<? extends com.dassault_systemes.modeler.foundation.model.ModelElement>
Returns all possible element that can be used for some relationship connecting.static Collection<? extends com.dassault_systemes.modeler.foundation.model.ModelElement>
com.dassault_systemes.modeler.foundation.model.ModelElement
internalGetModelElementToConnectRelationship
(com.dassault_systemes.modeler.foundation.model.ModelElement relationship, boolean asClient) Returns element that should be used for given relationship connecting.internalGetPresentationElementStroke
(int width) Return a stroke used to paint symbol's main partprotected Font
protected Color
boolean
internalIsSuitableToConnectRelationship
(com.dassault_systemes.modeler.foundation.model.RelationshipEnd<?> end) static boolean
internalIsSuitableToConnectRelationship
(PresentationElement symbol, com.dassault_systemes.modeler.foundation.model.RelationshipEnd<?> end) void
Silently applies all properties after initializationprotected void
internalSnapToGrid
(float step) protected void
internalSnapToGrid
(Point p, float step) protected void
Internal symbol update method for subclassing.final boolean
intersects
(int x, int y, int width, int height) checks whether object intersects with given rectangleabstract boolean
intersects
(int x, int y, int width, int height, com.nomagic.magicdraw.uml.symbols.IntersectionKind kind) checks whether object intersects with given rectangleboolean
Invalidates this element.boolean
boolean
Returns true if given child of this object is visible.boolean
protected boolean
boolean
Not detectable symbols are not drawn even they are visible.boolean
Checks if element was explicitly disposed by callingdispose()
method.boolean
boolean
Method indicates if object of this instance must be registered in move manager.boolean
boolean
isParentOf
(BaseElement obj) Returns true, if current element is parent of given element.boolean
isParentOf
(PresentationElement child) Checks if object is child of this object.boolean
Controls if the symbol should preserve proportions when growing.boolean
Returns true, if this element is selected in the diagram.boolean
boolean
protected boolean
boolean
If OV is sortable (must be added to sort manager for sorting) method must return true;final boolean
isSuitableToConnectRelationship
(com.dassault_systemes.modeler.foundation.model.RelationshipEnd end) boolean
Checks text editing flag.boolean
protected boolean
boolean
Do we need to use gradient for fill color? Checks diagram property.final boolean
boolean
Check if this symbol is visible in diagram (visible itself and its parent is visible)final boolean
void
final void
boolean
final void
Notify move manager about created presentation element.protected void
Notify diagram frame about change in this symbol.void
notifyRepaintManager
(boolean boundsChanged) Notifies the repaint manager about changes in bounds.void
onChildAdd
(PresentationElement child) void
onChildRemove
(PresentationElement child) void
final void
onFind()
Scrolls diagram canvas to this symbol and selects this symbolfinal void
onFind
(boolean center) Scrolls diagram canvas to this symbol and selects this symbolvoid
void
onParentChange
(PresentationElement child, PresentationElement oldChildParent) void
paintAdornments
(com.nomagic.magicdraw.uml.symbols.DiagramPaintContext context) void
paintAdornmentsBackground
(com.nomagic.magicdraw.uml.symbols.DiagramPaintContext context) abstract void
paintChildren
(com.nomagic.magicdraw.uml.symbols.DiagramPaintContext context) final void
paintChildrenAndAdornments
(com.nomagic.magicdraw.uml.symbols.DiagramPaintContext context) Paint symbol adornments and childrenvoid
paintChildrenBackground
(com.nomagic.magicdraw.uml.symbols.DiagramPaintContext context) abstract void
paintSelf
(com.nomagic.magicdraw.uml.symbols.DiagramPaintContext context) void
paintSelfBackground
(com.nomagic.magicdraw.uml.symbols.DiagramPaintContext context) protected boolean
Validate symbol against model and try to fix it before actual symbol update.protected boolean
Prepares graphics for line drawingprotected boolean
Prepares graphics for symbol shadow drawing.protected void
Prepares graphics for text drawingvoid
Listens for property change it can be: data was edited text box was editedvoid
Recreates model listeners for this symbol.void
Resize recursively all symbols.void
Registers this view in the sort managervoid
Remember old boundsvoid
rememberBounds
(Rectangle bounds) void
Removes this OV from sort manager.protected void
Remove itself during update and register this changed in command history.void
Removes given childvoid
Method that initiates parent resize to accommodate children if some child's bounds are changed.final void
Add given child to this symbol.void
sAddPresentationElement
(PresentationElement element, int index) Add given child to this symbol at given indexprotected List<PresentationElement>
Calculates children for moving together with this symbol.if calling simple set bounds for container shapes container moves itself and inner/related views This method selects which views must be moved.protected List<PathElement>
selectPathsForMoving
(List<PresentationElement> subPresentationElements) Select paths to move with current symbol from deep structure.void
setAllSelected
(boolean select) Selects(or deselects) all presentation elements in the diagram.final void
setBounds
(int x, int y, int width, int height) abstract void
sets bounds of this object viewvoid
setCreateElementListener
(boolean createElementListener) boolean
setDummyResizeMode
(boolean b) In dummy resize mode symbol may not resize according it children or move children on bounds changed and etc.void
setElement
(Element element) void
Sets fill colorboolean
Sets font for this object view.void
setLayouting
(boolean v) void
Sets line colorvoid
setLineWidth
(int width) final void
setLoadedVisibility
(boolean visible) final void
setLocation
(int x, int y) sets location of objectfinal void
setLocation
(Point location) sets location of objectvoid
setModelElement
(com.dassault_systemes.modeler.foundation.model.ModelElement element) void
setNeedRecreateListeners
(boolean needRecreateListeners) Set a need to recreated models listeners flagvoid
setParent
(PresentationElement parent) Sets parent for this view.void
setPresentationElements
(List<PresentationElement> elements) Sets children of this elementvoid
setPropertyManagerName
(String propertyManagerName) void
setSelected
(boolean select) Selects or deselects this presentation element in the diagram.void
setSelected
(List<PresentationElement> elements) Selects given elements in the diagram.final void
setSize
(int width, int height) set dimension of draw objectfinal void
setSize
(UnmodifiableDimension size) set dimension of draw objectfinal void
set dimension of draw objectvoid
Sets text colorvoid
setTextEditable
(boolean editable) Sets text editing flag.void
setUseFillColor
(boolean use) Sets use fill colorvoid
setVisibility
(com.nomagic.magicdraw.uml.symbols.PresentationElementVisibility visibility) Sets element visibility flag.final void
setVisible
(boolean visible) Sets element visibility flag.final void
Silently applies all properties after initializationfinal void
silentApply
(boolean recreateListeners) Silently applies all properties after initializationfinal void
simpleSetBounds
(int x, int y, int width, int height) void
simpleSetBounds
(Rectangle rect) Sets bounding rectangle.final void
snapToGrid
(Point p, float step) Snap to grid this pointfinal void
snapToGrid
(Rectangle r, float step) Snap to grid this rectanglevoid
snapViewToGrid
(float step) Snap to grid this pointstatic void
sortObjectsByX
(List<? extends PresentationElement> vector) Sorts objectViews by x ascending.static void
sortObjectsByY
(List<? extends PresentationElement> vector) Sorts objectViews by y in ascending order.void
Removes given childfinal void
sSetBounds
(int x, int y, int width, int height) abstract void
sSetBounds
(Rectangle rect) Sets bounds of this object view only.void
sSetElement
(Element element) final void
sSetLocation
(int x, int y) Sets location of object.final void
sSetLocation
(Point location) sets location of objectvoid
sSetModelElement
(com.dassault_systemes.modeler.foundation.model.ModelElement element) void
sSetParent
(PresentationElement parent) Sets parent for this view.final void
sSetParentForAll
(Collection<PresentationElement> elements) Sets itself as parent to the all PresentationElement from given vector.void
sSetPresentationElements
(List<PresentationElement> elements) Sets children of this elementfinal void
sSetSize
(int width, int height) Sets dimension of draw object.final void
set dimension of draw objectfinal void
set dimension of draw objectvoid
sSetVisibility
(com.nomagic.magicdraw.uml.symbols.PresentationElementVisibility visibility) Sets element visibility flag.final void
sSetVisible
(boolean visible) Sets element visibility flag.boolean
Override this method if you do not want model element to be deleted upon symbol deletion.final void
update()
Major presentation element update by model element method.void
void
updateLabelsIgnoringSuspendableLater
(Collection<com.nomagic.magicdraw.uml.symbols.shapes.LabelWrapper> wrappers) void
Registers this symbol to postponed "update" at the end of current command execution.final void
Updates model according current view structure.protected void
Updates model according current view structure.void
boolean
Deprecated, for removal: This API element is subject to removal in a future version.useuseParentStyle()
boolean
Does this element uses parent style or has it's own?Methods inherited from class com.nomagic.magicdraw.uml.MDElementImpl
accept, accept, addPropertyChangeListener, canAdd, canAddChild, canBeDeleted, canDeleteChild, compareTo, createSortKeys, getClassType, getID, getName, getProjectProvider, getResourceID, getSortKeys, hasListeners, isEditable, removeAllParents, removeAllPropertyChangeListeners, removePropertyChangeListener, setID, setProjectProvider, setResourceIDProvider, sGetID, toString
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.nomagic.magicdraw.uml.BaseElement
canAdd, isSelfChangeable
Methods inherited from interface com.nomagic.magicdraw.uml.MDElement
getProject
-
Field Details
-
MAX_LINE_WIDTH
public static final double MAX_LINE_WIDTH- See Also:
-
MIN_LINE_WIDTH
public static final double MIN_LINE_WIDTH- See Also:
-
HANDLE_SIZE
public static final int HANDLE_SIZE- See Also:
-
SOLID_STROKE
@OpenApi public static final int SOLID_STROKESolid path stroke.- See Also:
-
DASHED_STROKE
@OpenApi public static final int DASHED_STROKEDashed path stroke.- See Also:
-
DOTTED_STROKE
@OpenApi public static final int DOTTED_STROKEDotted path stroke.- See Also:
-
SHADOW_WIDTH
public static final int SHADOW_WIDTHSymbol shadow width in pixels- See Also:
-
DEFAULT_LINE_WIDTH
public static final int DEFAULT_LINE_WIDTH- See Also:
-
peStyle
protected com.dassault_systemes.modeler.foundation.diagram.style.PresentationElementStyle peStyle
-
-
Constructor Details
-
PresentationElement
public PresentationElement() -
PresentationElement
-
-
Method Details
-
sSetElement
-
generateID
Description copied from class:com.nomagic.magicdraw.uml.MDElementImpl
Generate ID.- Overrides:
generateID
in classcom.nomagic.magicdraw.uml.MDElementImpl
-
setElement
-
getElement
Returns model element of this presentation element. Some presentation elements (for example TextBoxes) do not have model elements.- Specified by:
getElement
in interfaceModelElementProvider
- Returns:
- model element of this presentation element.
-
getActualElement
Because some views returns theirs parent model element, we do not know have they this member set or not. -
sSetParent
Sets parent for this view. For adding symbols to other symbols useaddPresentationElement(PresentationElement)
orsAddPresentationElement(PresentationElement)
}- Parameters:
parent
- parent view
-
setParent
Sets parent for this view. For adding symbols to other symbols useaddPresentationElement(PresentationElement)
orsAddPresentationElement(PresentationElement)
}- Parameters:
parent
- parent view
-
onParentChange
-
onChildAdd
-
onChildRemove
-
setTextEditable
public void setTextEditable(boolean editable) Sets text editing flag.- Parameters:
editable
- flag
-
isTextEditable
public boolean isTextEditable()Checks text editing flag.- Returns:
true
if the object view text is editable;false
otherwise.
-
collectSubPresentationElements
Collects all sub-presentation elements into given collection. Includes this symbol too.- Parameters:
collection
- collection in which sub presentation elements should be collected.
-
collectSubPresentationElements
public final void collectSubPresentationElements(Collection<PresentationElement> collection, Predicate<PresentationElement> predicate) Collects all sub-presentation elements that match given predicate into given collection. Includes this symbol too.- Parameters:
collection
- collection in which sub presentation elements should be collected.predicate
- predicate that will check if sub element should be included.
-
collectSubShowingPresentationElements
Collect all visible children starting from current element. In case some element in hierarchy is not visible, children of this element are not added also even if they are visible.- Parameters:
col
- result
-
getPresentationElementAt
Gets object view at point.- Parameters:
p
- object view at point location- Returns:
- object view at this point
-
getPresentationElementAt
@CheckForNull public PresentationElement getPresentationElementAt(Point pt, com.nomagic.magicdraw.uml.symbols.IntersectionKind kind) Gets object view at point.- Parameters:
p
- object view at point locationkind
- intersection kind to check for- Returns:
- object view at this point
-
getPresentationElementAt
@CheckForNull public final PresentationElement getPresentationElementAt(Point relativePoint, com.nomagic.magicdraw.uml.symbols.SortManagerProvider sortManagerProvider) Gets object view at point.- Parameters:
relativePoint
- object view at point location.sortManagerProvider
- sort manager for searching elements.- Returns:
- object view at this point.
-
getPresentationElementAt
@CheckForNull public PresentationElement getPresentationElementAt(Point relativePoint, com.nomagic.magicdraw.uml.symbols.SortManagerProvider sortManagerProvider, com.nomagic.magicdraw.uml.symbols.IntersectionKind kind) Gets object view at point.- Parameters:
relativePoint
- object view at point location.sortManagerProvider
- sort manager for searching elements.kind
- intersection kind to check for- Returns:
- object view at this point.
-
getPresentationElementsAt
Gets objects at point.- Parameters:
p
- object view at point location.- Returns:
- object view at this point.
-
getPresentationElementsAt
@CheckForNull public List<PresentationElement> getPresentationElementsAt(Point p, com.nomagic.magicdraw.uml.symbols.IntersectionKind kind) Gets objects at point.- Parameters:
p
- object view at point location.kind
- intersection kind to check for- Returns:
- object view at this point.
-
getPresentationElementsAt
@CheckForNull public List<PresentationElement> getPresentationElementsAt(Point relativePoint, com.nomagic.magicdraw.uml.symbols.SortManagerProvider sortManagerProvider) Gets object view at point.- Parameters:
relativePoint
- object view at point location.sortManagerProvider
- sort manager for searching elements.- Returns:
- object view at this point.
-
getPresentationElementsAt
@CheckForNull public List<PresentationElement> getPresentationElementsAt(Point relativePoint, com.nomagic.magicdraw.uml.symbols.SortManagerProvider sortManagerProvider, com.nomagic.magicdraw.uml.symbols.IntersectionKind kind) Gets object view at point.- Parameters:
relativePoint
- object view at point location.sortManagerProvider
- sort manager for searching elements.kind
- intersection kind to check for- Returns:
- object view at this point.
-
getPresentationElementAt
Gets object view at specified position from container- Parameters:
index
- container element index- Returns:
- symbol at given index
-
getPresentationElementCount
public final int getPresentationElementCount()Returns children count in container.- Returns:
- children count in container.
-
getPresentationElementIndex
Get index of the given presentation element in the container.- Parameters:
element
- presentation element- Returns:
- index in the presentation element container or -1 if such presentation element can not be found
-
isParentOf
Checks if object is child of this object.- Parameters:
child
- object to check.- Returns:
- true if obj is child of this object.
-
isParentOf
Description copied from interface:BaseElement
Returns true, if current element is parent of given element. Return false in this implementation.- Specified by:
isParentOf
in interfaceBaseElement
- Overrides:
isParentOf
in classcom.nomagic.magicdraw.uml.MDElementImpl
- Parameters:
obj
- the given element(possible child).- Returns:
- true if obj is the parent of this object.
-
onDiagramSurfaceSet
public void onDiagramSurfaceSet() -
registerInSortManager
public void registerInSortManager()Registers this view in the sort manager -
getDiagramSurface
@Deprecated(since="2024x Refresh3", forRemoval=true) @CheckForNull @OpenApi public DiagramSurface getDiagramSurface()Deprecated, for removal: This API element is subject to removal in a future version.useDiagramSurface.getDiagramSurface(PresentationElement)
. Will be removed in 2026x version.Returns diagram surface for this presentation element. DiagramSurface is null if diagram of this element is not opened in some window.- Returns:
- diagram surface or null if diagram is not opened.
-
clone
- Specified by:
clone
in interfaceBaseElement
- Overrides:
clone
in classcom.nomagic.magicdraw.uml.MDElementImpl
-
getParent
Returns parent of this element.- Returns:
- parent of this element.
-
getPreferredSize
Deprecated, for removal: This API element is subject to removal in a future version.usegetPreferredDimension()
. Will be removed in 2026x version.Returns preferable dimension of the element.- Returns:
- preferred dimension
-
getPreferredDimension
Returns preferable dimension of the element.- Returns:
- preferred dimension
-
getPreferredDimensionForAutosize
Returns preferable dimension of the element for autosize.This implementation simple returns preferred size.- Returns:
- preferred dimension
-
getPreferredBounds
Calculate the smallest rectangle which would fit all contained shapes- Returns:
- rectangle
-
getMinimumDimension
get minimum possible size for object- Returns:
- minimum dimension
-
setSize
set dimension of draw object -
setSize
set dimension of draw object -
sSetSize
set dimension of draw object -
sSetSize
set dimension of draw object -
setSize
public final void setSize(int width, int height) set dimension of draw object -
sSetSize
public final void sSetSize(int width, int height) Sets dimension of draw object. -
setLocation
sets location of object -
sSetLocation
sets location of object -
setLocation
public final void setLocation(int x, int y) sets location of object -
sSetLocation
public final void sSetLocation(int x, int y) Sets location of object. -
setBounds
sets bounds of this object view- Parameters:
rect
- rectangle of bounds- Throws:
NoRectangleDefinedException
-
sSetBounds
Sets bounds of this object view only.- Parameters:
rect
- rectangle of bounds.- Throws:
NoRectangleDefinedException
-
sSetBounds
public final void sSetBounds(int x, int y, int width, int height) -
simpleSetBounds
public final void simpleSetBounds(int x, int y, int width, int height) -
setBounds
public final void setBounds(int x, int y, int width, int height) -
simpleSetBounds
Sets bounding rectangle.- Parameters:
rect
- new bounding rectangle.
-
movePathElements
public void movePathElements() -
movePathElementsRecursively
public final void movePathElementsRecursively() -
getMiddlePoint
Returns middle point of this element. Middle point for shapes usually will be center point of bounds, middle point for paths will be center of path curve.- Returns:
- point that is considered as middle for this element.
-
getMiddlePointX
public int getMiddlePointX() -
getMiddlePointY
public int getMiddlePointY() -
getMiddlePoint
Gets middle point of this view,- Parameters:
relativePoint
- relative point- Returns:
- middle point
-
getMiddlePointX
-
getMiddlePointY
-
getIntersection
-
getBounds
Method returns bounds of this element. Use PresentationElementsManager to change a bounds of the element.- Returns:
- bounds of the element.
- Throws:
NoRectangleDefinedException
- when bounds can not be calculated (some presentation elements are abstract and can not have bounds).- See Also:
-
PresentationElementsManager.reshapeShapeElement
-
getManipulationBounds
Gets manipulation bounds of the symbol. Manipulation bounds might differ from symbol bounds, they can be larger or smaller to help user manipulate the symbol.- Parameters:
relativePoint
- active user point to construct manipulation bounds.- Returns:
- symbol manipulation bounds.
-
getBoundsToRepaint
Return bounds of the symbol that must be repainted. throws NoRectangleDefinedException- Returns:
- rectangle of bounds
- Throws:
NoRectangleDefinedException
-
getNotCopyBounds
get not copy bounds of object throws NoRectangleDefinedException- Returns:
- rectangle of bounds
- Throws:
NoRectangleDefinedException
-
intersects
public final boolean intersects(int x, int y, int width, int height) checks whether object intersects with given rectangle- Returns:
- true if object and rectangle intersects
-
coversPoint
public final boolean coversPoint(int x, int y) checks if object covers provided point- Returns:
- true if object covers this point
-
intersects
public abstract boolean intersects(int x, int y, int width, int height, com.nomagic.magicdraw.uml.symbols.IntersectionKind kind) checks whether object intersects with given rectangle- Returns:
- true if object and rectangle intersects
-
coversPoint
public abstract boolean coversPoint(int x, int y, com.nomagic.magicdraw.uml.symbols.IntersectionKind kind) checks if object covers provided point- Returns:
- true if object covers this point
-
selectObjectsForMoving
if calling simple set bounds for container shapes container moves itself and inner/related views This method selects which views must be moved. -
childrenForMoving
Calculates selected children for moving or takes result from cached.- Returns:
- list of children for moving.
- See Also:
-
selectChildrenForMoving()
PresentationElement.StructureCache
-
selectChildrenForMoving
Calculates children for moving together with this symbol. This method should not be called by user. This method is just for implementation and override purpose. childrenForMoving() must be used outside.- See Also:
-
selectPathsForMoving
protected List<PathElement> selectPathsForMoving(@CheckForNull List<PresentationElement> subPresentationElements) Select paths to move with current symbol from deep structure. Some paths can be connected to current symbol, but owned in some deep child of this symbol.- Parameters:
subPresentationElements
- sub children of this symbol- Returns:
- paths to move together with current symbol
-
setPresentationElements
Sets children of this element- Parameters:
elements
- children
-
sSetPresentationElements
Sets children of this element- Parameters:
elements
- children
-
getPresentationElements
Returns all children of this element- Returns:
- all children of this element. The collection is unmodifiable.
-
getVisiblePresentationElements
- Returns:
- not modifiable list of visible elements, including not detectable ones that should not be painted.
- See Also:
-
removePresentationElement
Removes given child- Parameters:
element
- child
-
sRemovePresentationElement
Removes given child- Parameters:
element
- child
-
addPresentationElement
Add given child to this symbol.- Parameters:
element
- child to add
-
addPresentationElement
Add given child to this symbol at given index- Parameters:
element
- child to addindex
- index to add at. Can be -1
-
addPresentationElementWithoutResize
-
sAddPresentationElement
Add given child to this symbol.- Parameters:
element
- child to add
-
sAddPresentationElement
Add given child to this symbol at given index- Parameters:
element
- child to addindex
- index to add at. Can be -1
-
draw
public void draw(com.nomagic.magicdraw.uml.symbols.DiagramPaintContext context) Draw symbol using renderer or symbol specific draw if renderer is not available. Also draw adornments.- Parameters:
context
- paint context
-
drawBackground
public void drawBackground(com.nomagic.magicdraw.uml.symbols.DiagramPaintContext context) -
drawSymbolBackground
public void drawSymbolBackground(com.nomagic.magicdraw.uml.symbols.DiagramPaintContext context) -
paintSelfBackground
public void paintSelfBackground(com.nomagic.magicdraw.uml.symbols.DiagramPaintContext context) -
paintChildrenBackground
public void paintChildrenBackground(com.nomagic.magicdraw.uml.symbols.DiagramPaintContext context) -
drawSymbol
public final void drawSymbol(com.nomagic.magicdraw.uml.symbols.DiagramPaintContext context) Draw symbol as defined by standard notation. Does not use renderers and adornments.- Parameters:
context
- paint context
-
paintChildrenAndAdornments
public final void paintChildrenAndAdornments(com.nomagic.magicdraw.uml.symbols.DiagramPaintContext context) Paint symbol adornments and children- Parameters:
context
- paint context
-
paintSelf
public abstract void paintSelf(com.nomagic.magicdraw.uml.symbols.DiagramPaintContext context) -
paintChildren
public abstract void paintChildren(com.nomagic.magicdraw.uml.symbols.DiagramPaintContext context) -
paintAdornmentsBackground
public void paintAdornmentsBackground(com.nomagic.magicdraw.uml.symbols.DiagramPaintContext context) -
paintAdornments
public void paintAdornments(com.nomagic.magicdraw.uml.symbols.DiagramPaintContext context) -
getRenderer
@CheckForNull public com.nomagic.magicdraw.uml.symbols.SymbolDecorator getRenderer()Gets rendered which could decorate this symbol.- Returns:
- symbol renderer.
-
getSymbolRenderer
@CheckForNull protected static com.nomagic.magicdraw.uml.symbols.SymbolDecorator getSymbolRenderer(PresentationElement presentationElement) -
getDrawComparator
-
mustShowContextMenu
public boolean mustShowContextMenu() -
canHavePaths
public boolean canHavePaths()- Returns:
- true if symbol can have connected paths. Return false here.
-
canAddChild
Check of given symbol can be added as child into this symbol.- Parameters:
symbol
- symbol- Returns:
- true if symbol can be added
-
canAddChild
- Specified by:
canAddChild
in interfaceMDElement
- Overrides:
canAddChild
in classcom.nomagic.magicdraw.uml.MDElementImpl
-
canAddInstance
Object view has no children. -
canAddInstance
Description copied from interface:BaseElement
Checks if this object can add element of given type. Current implementation returns false.- Specified by:
canAddInstance
in interfaceBaseElement
- Overrides:
canAddInstance
in classcom.nomagic.magicdraw.uml.MDElementImpl
- Returns:
- true if this object can elements of a given type.
-
dispose
public void dispose()disposes ends of links when link is deleted- Specified by:
dispose
in interfaceBaseElement
- Overrides:
dispose
in classcom.nomagic.magicdraw.uml.MDElementImpl
-
disposeChildren
protected void disposeChildren()Removes all children from itself. Such removing causes calling dispose for every child. -
setAllSelected
@OpenApi public void setAllSelected(boolean select) Selects(or deselects) all presentation elements in the diagram.- Parameters:
select
- select or deselect all elements.
-
setSelected
Selects given elements in the diagram.- Parameters:
elements
- elements to select.
-
setSelected
@OpenApi public void setSelected(boolean select) Selects or deselects this presentation element in the diagram.- Parameters:
select
- select or deselect this presentation element.
-
getSelected
Returns a list of selected elements in the diagram.- Returns:
- a list of selected elements. List is unmodifiable.
-
isSelected
@OpenApi public boolean isSelected()Returns true, if this element is selected in the diagram.- Returns:
- true, if this element is selected in the diagram.
-
isDetectable
public boolean isDetectable()Not detectable symbols are not drawn even they are visible. Not detectable symbols cannot be selected even they have manipulator.- Returns:
- true if selection and painting of this symbol is currently allowed
-
initializeAndAutosize
public final void initializeAndAutosize()Initialize symbol and call autosize recursively- See Also:
-
recursiveAutosize
public void recursiveAutosize()Resize recursively all symbols. Method must be called if something is changed in symbol (for example minimum size) and you want to resize (autosize) all hierarchy -
initialize
public void initialize()Initialize symbol and its children state. Symbol must be initialized before doing any resize, painting and etc. These operations can lead to unpredictable results otherwise. -
getDiagramPresentationElement
@OpenApi @Deprecated(since="2024x Refresh3", forRemoval=true) public final DiagramPresentationElement getDiagramPresentationElement()Deprecated, for removal: This API element is subject to removal in a future version.useDiagramPresentationElement.get(PresentationElement)
.Will be removed in 2026x.Returns diagram of this presentation element.- Returns:
- diagram of this presentation element.
-
getAbstractDiagramPresentationElement
Returns diagram of this presentation element.- Returns:
- diagram of this presentation element.
-
onFind
@OpenApi public final void onFind()Scrolls diagram canvas to this symbol and selects this symbol -
onFind
@OpenApi public final void onFind(boolean center) Scrolls diagram canvas to this symbol and selects this symbol- Parameters:
center
- if true, centers current view in the center of the window.
-
resizeParent
public void resizeParent()Method that initiates parent resize to accommodate children if some child's bounds are changed. -
autosizeAndResizeParent
public void autosizeAndResizeParent()Resize itself and initiate parent resize -
autosizeAndResizeManipulatedParent
public void autosizeAndResizeManipulatedParent()Autosize and resize manipulated element - itself(if this element has manipulator) or manipulated parent. -
update
public final void update()Major presentation element update by model element method. Any outside code must call this method for updating the symbol by data. This method calls internal update (updatePresentationElement()) and also calls update for symbol decorator if such exits.- See Also:
-
internalUpdatePresentationElement()
SymbolDecorator
-
internalBeforeUpdate
protected void internalBeforeUpdate(@CheckForNull com.nomagic.magicdraw.uml.symbols.SymbolDecorator renderer) -
removeItSelfOnUpdate
protected void removeItSelfOnUpdate()Remove itself during update and register this changed in command history. -
internalUpdatePresentationElement
protected void internalUpdatePresentationElement()Internal symbol update method for subclassing. It is called from update as part of full update action.- See Also:
-
canBeDisposedOnUpdate
protected boolean canBeDisposedOnUpdate()Some symbols removes themselves on update if they are not valid by model anymore. Check if such operation is possible at this moment. Do not remove symbol on undo or redo operations. We very often have situation when symbol is updated during these operations and structure in model is not yet fully restored.- Returns:
- true if path can be removed if not valid
-
preDisposeOnUpdate
protected boolean preDisposeOnUpdate()Validate symbol against model and try to fix it before actual symbol update. If symbol is not valid and can not be fixed, request symbol dispose by returning true. Check if symbol should be disposed, because model does not correspond to symbol. This may happen for example if path supplier or client in model is changed, but path still is connected to symbols of old ends.Method also can fix symbol if possible - for example reconnect path to other symbols in diagram and etc.
- Returns:
- true if symbol must be disposed
-
getFontHeight
public final int getFontHeight()Gets font height.- Returns:
- font height
-
isUseGradientForFill
public boolean isUseGradientForFill()Do we need to use gradient for fill color? Checks diagram property.- Returns:
- diagram gradient fill color value.
-
getFontRenderContext
-
isVisible
public final boolean isVisible()- Returns:
- true if element visibility is
PresentationElementVisibility.VISIBLE
- See Also:
-
PresentationElementVisibility.isVisible()
-
isVisibleOrShrunken
public final boolean isVisibleOrShrunken()- Returns:
- true if element visibility is
PresentationElementVisibility.VISIBLE
orPresentationElementVisibility.SHRUNKEN
- See Also:
-
PresentationElementVisibility.isVisibleOrShrunken()
-
sSetVisible
public final void sSetVisible(boolean visible) Sets element visibility flag.- Parameters:
visible
- flag value- See Also:
-
PresentationElementVisibility.apply(boolean)
-
setVisible
public final void setVisible(boolean visible) Sets element visibility flag.- Parameters:
visible
- flag value- See Also:
-
PresentationElementVisibility.apply(boolean)
-
getVisibility
public com.nomagic.magicdraw.uml.symbols.PresentationElementVisibility getVisibility()- Returns:
- element visibility
-
sSetVisibility
public void sSetVisibility(com.nomagic.magicdraw.uml.symbols.PresentationElementVisibility visibility) Sets element visibility flag.- Parameters:
visibility
- flag value
-
setVisibility
public void setVisibility(com.nomagic.magicdraw.uml.symbols.PresentationElementVisibility visibility) Sets element visibility flag.- Parameters:
visibility
- flag value
-
removeFromSortManager
public void removeFromSortManager()Removes this OV from sort manager. -
updateViewAfterPropertyChange
public void updateViewAfterPropertyChange() -
updateLater
public void updateLater()Registers this symbol to postponed "update" at the end of current command execution. Symbol will be updated when all other commands are executed. If this is not possible to register, updates symbol immediately. -
updateLabelsIgnoringSuspendableLater
public void updateLabelsIgnoringSuspendableLater(Collection<com.nomagic.magicdraw.uml.symbols.shapes.LabelWrapper> wrappers) -
updateModelByViewInternal
protected void updateModelByViewInternal()Updates model according current view structure. In some cases changes in model must be made keeping in mind current structure of symbols.Does nothing here, but subclasses may override
-
updateModelByView
public final void updateModelByView()Updates model according current view structure. In some cases changes in model must be made keeping in mind current structure of symbols. -
propertyChange
Listens for property change it can be: data was edited text box was edited- Specified by:
propertyChange
in interfacePropertyChangeListener
-
handleModelDelete
protected void handleModelDelete()Handles model element delete property Change event. Typical implementation is to delete this symbol from parent. -
setFont
Sets font for this object view.- Parameters:
font
- new font.
-
getFont
Gets font of this object view. It returns font from the project.- Returns:
- font of the text object.
-
internalGetSpecificFont
-
getHumanType
Returns human representation of the data type- Specified by:
getHumanType
in interfaceBaseElement
- Overrides:
getHumanType
in classcom.nomagic.magicdraw.uml.MDElementImpl
- Returns:
- the name of the data
-
getHumanName
Returns human representation of the data type- Specified by:
getHumanName
in interfaceBaseElement
- Overrides:
getHumanName
in classcom.nomagic.magicdraw.uml.MDElementImpl
- Returns:
- the name of the data
-
askDeleteDataConfirmation
public boolean askDeleteDataConfirmation()Declared as interface with default implementation for subclasses. If some subclasses upon delete may ask about delete data object as well, they have to redefine this method and return true. By default all objects are removed without asking- Returns:
- confirmation status -- true if asking is necessary, false otherwise
-
getManipulatedElementAt
Gets manipulated symbol at specified point pt.- Parameters:
pt
-Point
- Returns:
- manipulate symbol
-
getManipulatedElementAt
@CheckForNull public PresentationElement getManipulatedElementAt(Point pt, com.nomagic.magicdraw.uml.symbols.IntersectionKind intersectionKind) Gets manipulated symbol at specified point pt.- Parameters:
pt
-Point
intersectionKind
- intersection kind to check for- Returns:
- manipulate symbol
-
getManipulatedElementAt
@CheckForNull public PresentationElement getManipulatedElementAt(Point pt, com.nomagic.magicdraw.uml.symbols.SortManagerProvider sortManagerProvider) Gets manipulate symbol at specified point pt.- Parameters:
pt
-Point
sortManagerProvider
- provides sort manager in which to search.- Returns:
- manipulate symbol
-
sSetParentForAll
Sets itself as parent to the all PresentationElement from given vector. -
hasManipulator
public boolean hasManipulator()Returns true, if view has manipulator (is selectable) -
invalidate
public boolean invalidate()Invalidates this element. -
isSnapToGrid
protected boolean isSnapToGrid() -
snapToGrid
Snap to grid this rectangle -
snapToGrid
Snap to grid this point -
internalSnapToGrid
-
snapViewToGrid
public void snapViewToGrid(float step) Snap to grid this point -
internalSnapToGrid
protected void internalSnapToGrid(float step) -
collectSubManipulatedElements
Collects all visible and manipulated elements in this hierarchy. -
getManipulatedPresentationElements
Returns a list of children of this element those have manipulator.- Returns:
- a list of manipulated elements. Collection is unmodifiable.
-
hasManipulatedPresentationElements
@OpenApi public final boolean hasManipulatedPresentationElements()- Returns:
- true if at least one child is manipulated and visible
-
getTolerance
public final int getTolerance()Returns tolerance -
getNotZoomedTolerance
protected int getNotZoomedTolerance() -
atInsert
public void atInsert()Invalidates object at insert- Specified by:
atInsert
in interfaceBaseElement
- Overrides:
atInsert
in classcom.nomagic.magicdraw.uml.MDElementImpl
-
isDisposed
public boolean isDisposed()Checks if element was explicitly disposed by callingdispose()
method. CallingatInsert()
clears dispose flag. Newly created element is not disposed.- Returns:
- true if element was disposed
-
atInsertChildren
protected void atInsertChildren() -
sortObjectsByX
Sorts objectViews by x ascending.- Parameters:
vector
- - Vector which contains Object Views.
-
sortObjectsByY
Sorts objectViews by y in ascending order.- Parameters:
vector
- - Vector which contains Object Views.
-
isSortable
public boolean isSortable()If OV is sortable (must be added to sort manager for sorting) method must return true; -
isChildVisible
Returns true if given child of this object is visible. For methods and attributes Method or Attribute field view can hide objects without changing visibility flag method isVisible() returns true, but method can be not show. This method must avoid such situations and return true if parent shows this object and false if it hides. -
isVisibleInDiagram
public boolean isVisibleInDiagram()Check if this symbol is visible in diagram (visible itself and its parent is visible)- Returns:
- true if symbol is visible in the diagram
-
getManipulatedIntersectionWith
Returns vector of manipulated objects whose intersect with given rectangle -
getManipulatedIntersectionWith
@CheckForNull public List<PresentationElement> getManipulatedIntersectionWith(Rectangle rect, com.nomagic.magicdraw.uml.symbols.IntersectionKind kind) Returns vector of manipulated objects whose intersect with given rectangle -
getManipulatedIntersectionWith
@CheckForNull public List<PresentationElement> getManipulatedIntersectionWith(Rectangle rect, boolean completelyCovered) Returns vector of manipulated objects whose intersect with given rectangle- Parameters:
completelyCovered
- take only completely covered by rectangle symbols. Ignore symbols with just intersected bounds.
-
getManipulatedIntersectionWith
@CheckForNull public List<PresentationElement> getManipulatedIntersectionWith(Rectangle rect, boolean completelyCovered, com.nomagic.magicdraw.uml.symbols.IntersectionKind kind) Returns vector of manipulated objects whose intersect with given rectangle- Parameters:
completelyCovered
- take only completely covered by rectangle symbols. Ignore symbols with just intersected bounds.kind
- intersection kind to check for
-
findOwnerForElement
@CheckForNull public com.dassault_systemes.modeler.foundation.model.ModelElement findOwnerForElement(PresentationElement newParent, com.dassault_systemes.modeler.foundation.model.ModelElementOwnershipContext ownershipContext) -
findOwnerForChildElement
@CheckForNull public com.dassault_systemes.modeler.foundation.model.ModelElement findOwnerForChildElement(PresentationElement child) Returns element owner for given child.- Returns:
- most suitable owner for given child's element
-
checkElementOwnerOnChange
-
getFillColor
Returns fill color -
getLineColor
Returns line color -
canFill
protected boolean canFill()- Returns:
- true if symbol can be filled with some color
-
isUseFillColor
public boolean isUseFillColor()- Returns:
- use fill color flag
-
isUseFillColorByProperty
protected boolean isUseFillColorByProperty() -
getTextColor
-
internalGetSpecificTextColor
-
setTextColor
Sets text color -
setFillColor
Sets fill color -
createFillStrategy
public com.nomagic.magicdraw.uml.symbols.FillStrategy createFillStrategy() -
dynamicTextColor
-
dynamicLineColor
-
dynamicFillColor
-
dynamicStyleFillColor
-
dynamicStyleLineColor
-
dynamicStyleTextColor
-
dynamicStyleTransparency
public final int dynamicStyleTransparency() -
dynamicStyleTransparency
-
dynamicTextAlignment
@CheckForNull public com.nomagic.magicdraw.uml.symbols.shapes.TextObject.HorizontalPosition dynamicTextAlignment(com.nomagic.magicdraw.uml.symbols.shapes.TextObject.HorizontalPosition target) -
dynamicStyleValue
@CheckForNull protected <T> T dynamicStyleValue(@CheckForNull T merged, BiFunction<com.dassault_systemes.modeler.foundation.common.style.DynamicStyle, T, T> valueProvider) -
dynamicPaintShadow
public boolean dynamicPaintShadow() -
getDynamicStyleOwner
-
prepareForShadowDrawing
Prepares graphics for symbol shadow drawing. If diagram allows shadows, sets darker diagram background color to given graphics.- Parameters:
g
- the given graphics
-
prepareForLineDrawing
Prepares graphics for line drawing -
prepareForTextDrawing
Prepares graphics for text drawing -
useParentStyle
@OpenApi public boolean useParentStyle()Does this element uses parent style or has it's own?- Returns:
- true, if element does not have style and uses parent's style.
-
useParentProperties
Deprecated, for removal: This API element is subject to removal in a future version.useuseParentStyle()
-
getParentSymbolStyleOwner
Returns parent to which this symbol delegates style attributes related functionality.- Returns:
- parent symbol to delegate or null if this symbol does not delegate.
-
getPropertyManager
@OpenApi @Deprecated(since="2024x Refresh3", forRemoval=true) public final PropertyManager getPropertyManager()Deprecated, for removal: This API element is subject to removal in a future version.usePresentationElementsManager.addProperty(PresentationElement, Property)
. Will be removed in 2026x version.Returns the propertyManager of this element. If element does not have properties, empty manager will be created.
Use method useParentProperties() to check if properties exist.
Use PresentationElementsManager to change the properties.- Returns:
- propertyManager of this element.
- See Also:
-
useParentStyle()
PresentationElementsManager.setPresentationElementProperties
-
createPresentationElementStyle
protected com.dassault_systemes.modeler.foundation.diagram.style.PresentationElementStyle createPresentationElementStyle()Creates the presentation element style for this presentation element. Override only if a specific style for a specific presentation element should be created. The default implementation is to get style though style registry -
getStyle
public com.dassault_systemes.modeler.foundation.diagram.style.PresentationElementStyle getStyle() -
getProperty
@CheckForNull @OpenApi @Deprecated(since="2024x Refresh3", forRemoval=true) public final Property getProperty(String propertyId) Deprecated, for removal: This API element is subject to removal in a future version.usePresentationElementsManager#getProperty(PresentationElement)
. Will be removed in 2026x version.Returns element's property with given id.- Parameters:
propertyId
- ID of property.- Returns:
- property with given id or null if element does not have such property.
-
addProperty
@Deprecated(since="2024x Refresh3", forRemoval=true) @OpenApi public final void addProperty(Property prop) Deprecated, for removal: This API element is subject to removal in a future version.usePresentationElementsManager.addProperty(PresentationElement, Property)
. Will be removed in 2026x version.Add property to a presentation element. This method should be called only on a new instance of a presentation element while it is not added into the diagram. In order to change some property usePresentationElementsManager
#setPresentationElementProperties- Parameters:
prop
- property
-
changeProperties
public void changeProperties(com.dassault_systemes.modeler.magic.diagram.styledelegates.PresentationElementStyleChanger changer) -
applyProperties
public final void applyProperties(com.dassault_systemes.modeler.magic.diagram.styledelegates.PresentationElementStyleChanger changer) Applies properties from given property manager- Parameters:
manager
- new properties
-
internalApplyProperties
protected void internalApplyProperties(com.dassault_systemes.modeler.magic.diagram.styledelegates.PresentationElementStyleChanger changer) Applies properties from given property manager- Parameters:
changer
- new properties
-
onFontChange
public void onFontChange() -
getAdditionalRenderersToNotifyOnPropertiesChange
public List<com.nomagic.magicdraw.uml.symbols.SymbolDecorator> getAdditionalRenderersToNotifyOnPropertiesChange() -
silentApply
public final void silentApply()Silently applies all properties after initialization -
silentApply
public final void silentApply(boolean recreateListeners) Silently applies all properties after initialization- Parameters:
recreateListeners
- recreate listeners if needed
-
internalSilentApply
public void internalSilentApply()Silently applies all properties after initialization -
adjustBoundsBeforeChange
public Rectangle adjustBoundsBeforeChange(Rectangle rec, boolean autosizeOperation, Collection<PresentationElement> movedTogether) Validate bounds before bounds change operation -
adjustChildBoundsForMoving
For adjusting child bounds when child type is not known but bounds should be corrected. -
adjustChildBounds
For adjusting child bounds when child type is not known but bounds should be corrected. -
getEffectiveStyleOwner
-
getEffectiveStyleDelegate
public com.dassault_systemes.modeler.foundation.diagram.style.StylePropertyDelegate getEffectiveStyleDelegate()- Returns:
- the effective style property delegate, returned from the effective style owner
-
getOwnStyleDelegate
public com.dassault_systemes.modeler.foundation.diagram.style.StylePropertyDelegate getOwnStyleDelegate()- Returns:
- the own style property delegate
-
isMovableByMoveManager
public boolean isMovableByMoveManager()Method indicates if object of this instance must be registered in move manager. -
boundsChanged
public final void boundsChanged() -
boundsChanged
-
notifyCreated
public final void notifyCreated()Notify move manager about created presentation element. -
rememberBounds
public void rememberBounds()Remember old bounds -
rememberBounds
-
editName
Starts online diagram editing for a symbol- Parameters:
evt
- first key event or null
-
editName
@OpenApi public void editName(@CheckForNull KeyEvent evt, @CheckForNull Map<String, Boolean> textEditorOptions) Starts online diagram editing for a symbol- Parameters:
evt
- first key event or nulltextEditorOptions
- boolean options for text editor. Passed when creating text editor withTextEditorFactory
-
isLayouting
public boolean isLayouting() -
setLayouting
public void setLayouting(boolean v) -
getManipulatedParent
- Returns:
- first parent with manipulator or null if such does not exist.
-
getManipulationPreferredDimension
- Returns:
- size for manipulator manipulations
-
getObjectParent
Returns the presentation element parent. Implementation of super method.- Specified by:
getObjectParent
in interfaceBaseElement
- Overrides:
getObjectParent
in classcom.nomagic.magicdraw.uml.MDElementImpl
- Returns:
- the parent of the element.
- See Also:
-
notifyRepaintManager
public void notifyRepaintManager(boolean boundsChanged) Notifies the repaint manager about changes in bounds. -
notifyDiagramFrameSizeChange
protected void notifyDiagramFrameSizeChange()Notify diagram frame about change in this symbol. Change may be a reason for diagram frame resize. -
firePropertyChange
public void firePropertyChange(String propertyName, @CheckForNull Object oldValue, @CheckForNull Object newValue) Description copied from interface:BaseElement
DelegatesfirePropertyChange
to thePropertyChangeSupport
, the member of this class, which reports a bound property update to any registered listeners. No event is fired if old and new values are equal or null.- Specified by:
firePropertyChange
in interfaceBaseElement
- Overrides:
firePropertyChange
in classcom.nomagic.magicdraw.uml.MDElementImpl
- Parameters:
propertyName
- the programmatic name of the property that was changed.oldValue
- the old value of the propertynewValue
- the new value of the property- See Also:
-
setLineColor
Sets line color -
setUseFillColor
public void setUseFillColor(boolean use) Sets use fill color -
findPresentationElement
@CheckForNull public static PresentationElement findPresentationElement(Collection<PresentationElement> elements, com.dassault_systemes.modeler.foundation.model.ModelElement modelElement) Finds presentation element with given Element among given elements -
canChangeElementOwner
public boolean canChangeElementOwner(Collection<PresentationElement> movedTogether, @CheckForNull BaseElement newParent) Returns true, if symbol does not restrict it's element ownership change- Parameters:
movedTogether
- collection of the elements, whose will change the parent together with this symbolnewParent
- new symbol parent- Returns:
- true if parent of element can be changed.
-
canChangeParent
public boolean canChangeParent(Collection<? extends PresentationElement> movedTogether, @CheckForNull BaseElement newParent, boolean changeElementParent) Returns true, if element can change parent.- Parameters:
movedTogether
- collection of the elements, whose will change the parent together with this.newParent
- new symbol parentchangeElementParent
- change element parent- Returns:
- true if parent of symbol can be changed
-
canChangeParent
Returns true, if element can change parent.- Specified by:
canChangeParent
in interfaceBaseElement
- Overrides:
canChangeParent
in classcom.nomagic.magicdraw.uml.MDElementImpl
- Parameters:
children
- collection of the elements, whose will change the parent together with this.newParent
- new parent object.- Returns:
- true if an element can change parent.
-
getAssignableModelElementsClasses
Returns an array of ModelElements classes that can be assigned as ModelElement to this PresentationElement. The specific PresentationElement must override this method and return an array of specific ModelElements' classes.- Returns:
- an array of assignable ModelElements' classes.
-
setPropertyManagerName
-
getPropertyManagerName
-
getChildPresentationElementForContextMenu
Returns child element for showing context menu. Maybe it is better to show context menu for child, not for element itself. In such case returns child.- Parameters:
pt
- the point- Returns:
- child or itself.
-
isCanChildrenChangeEdge
public boolean isCanChildrenChangeEdge() -
getBoundsWithChildrenOnEdge
-
getElementToConnectRelationship
@CheckForNull public final Element getElementToConnectRelationship(@CheckForNull Element relationship, boolean asClient) The same as#internalGetElementToConnectRelationship(Element, boolean)
, just takes into account SymbolDecorators- Returns:
- all possible elements
- See Also:
-
getElementsForRelationshipConnecting()
#internalGetElementToConnectRelationship(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Element, boolean)
-
getModelElementToConnectRelationship
@CheckForNull public final com.dassault_systemes.modeler.foundation.model.ModelElement getModelElementToConnectRelationship(@CheckForNull com.dassault_systemes.modeler.foundation.model.ModelElement relationship, boolean asClient) The same asinternalGetModelElementToConnectRelationship(ModelElement, boolean)
, just takes into account SymbolDecorators- Returns:
- all possible elements
-
isSuitableToConnectRelationship
public final boolean isSuitableToConnectRelationship(com.dassault_systemes.modeler.foundation.model.RelationshipEnd end) - Returns:
- true if given possible elements (end of relationship) is suitable to connect given relationship to this symbol
-
internalGetModelElementToConnectRelationship
@CheckForNull public com.dassault_systemes.modeler.foundation.model.ModelElement internalGetModelElementToConnectRelationship(@CheckForNull com.dassault_systemes.modeler.foundation.model.ModelElement relationship, boolean asClient) Returns element that should be used for given relationship connecting. All possible elements are returned by methodgetModelElementsForRelationshipConnecting()
.- Returns:
- all possible elements
- See Also:
-
internalIsSuitableToConnectRelationship
public boolean internalIsSuitableToConnectRelationship(com.dassault_systemes.modeler.foundation.model.RelationshipEnd<?> end) - Returns:
- true if given possible elements (end of relationship) is suitable to connect given relationship to this symbol
-
internalIsSuitableToConnectRelationship
public static boolean internalIsSuitableToConnectRelationship(PresentationElement symbol, com.dassault_systemes.modeler.foundation.model.RelationshipEnd<?> end) -
getModelElementToMove
@CheckForNull public com.dassault_systemes.modeler.foundation.model.ModelElement getModelElementToMove()Returns element that should be used for during "move" operation. In most cases this is the same as getElement(), but some symbols maybe override and return some other related element.- Returns:
- element to move
- See Also:
-
getElementsForRelationshipConnecting
The same as getElementsForLinkConnecting(), just takes into account SymbolDecorators- Returns:
- all possible elements
- See Also:
-
getModelElementsForRelationshipConnecting
public final Collection<? extends com.dassault_systemes.modeler.foundation.model.ModelElement> getModelElementsForRelationshipConnecting()Returns all possible element that can be used for relationships connecting.- Returns:
- all possible elements
-
internalGetModelElementsForRelationshipConnecting
public Collection<? extends com.dassault_systemes.modeler.foundation.model.ModelElement> internalGetModelElementsForRelationshipConnecting()Returns all possible element that can be used for some relationship connecting.- Returns:
- all possible elements
-
internalGetModelElementsForRelationshipConnecting
public static Collection<? extends com.dassault_systemes.modeler.foundation.model.ModelElement> internalGetModelElementsForRelationshipConnecting(PresentationElement symbol) -
isCreateElementListener
protected boolean isCreateElementListener() -
setCreateElementListener
public void setCreateElementListener(boolean createElementListener) -
createPropertyChangeListener
public final void createPropertyChangeListener() -
internalCreatePropertyChangeListener
protected void internalCreatePropertyChangeListener(com.nomagic.magicdraw.uml.symbols.PresentationElement.SmartListenerConfigData data) -
recreateListeners
public void recreateListeners()Recreates model listeners for this symbol. This method should be called only in exceptional cases when new features to the symbol are added dynamically (e.g. decorators) and model listening scope should be expanded. -
getConfiguration
- Returns:
- a merged configuration of both static and dynamic configs
-
getDynamicConfigurations
Gets non-cacheable smart listener configurations. Default symbol smart listeners are cacheable and reused in all instances of a symbol. Dynamic parts of symbols (e.g. added via renderers and decorators) should use dynamic configurations.- Returns:
- a list of dynamic smart listener configurations.
-
disposePropertyChangeListener
protected void disposePropertyChangeListener() -
updateAfterLoad
public void updateAfterLoad() -
createSmartListenerConfig
-
isShowElementTypeAsLabel
public boolean isShowElementTypeAsLabel() -
isShowsProxy
public boolean isShowsProxy() -
clearShowsProxy
public void clearShowsProxy() -
checkShowsProxy
protected boolean checkShowsProxy() -
setLoadedVisibility
public final void setLoadedVisibility(boolean visible) -
checkProxyVisibility
protected com.nomagic.magicdraw.uml.symbols.PresentationElementVisibility checkProxyVisibility(com.nomagic.magicdraw.uml.symbols.PresentationElementVisibility visibility) -
beforeDelete
public boolean beforeDelete(com.dassault_systemes.modeler.foundation.editing.CompositeCommand deleteCommand, Collection removeTogether) Method is called before deleting symbol with user "DELETE" action- Parameters:
removeTogether
- other symbols participating in delete operation- Returns:
- true, if symbol can be deleted
-
tryToDeleteModelElementUponRemoval
public boolean tryToDeleteModelElementUponRemoval()Override this method if you do not want model element to be deleted upon symbol deletion.- Returns:
- true, if model element has to be deleted.
-
alwaysShowTooltip
public boolean alwaysShowTooltip() -
getBoundsShape
Provides a bounding shape of the symbol- Parameters:
converterToShape
- transform bounding shape according this converter- Returns:
- bounding shape of the symbol
-
internalGetBoundsShape
-
getPresentationElementStroke
Return a stroke used to paint symbol's main part- Returns:
- a stroke used to paint symbol's main part
-
isContentHidden
public boolean isContentHidden() -
setLineWidth
public void setLineWidth(int width) -
getLineWidth
public int getLineWidth() -
dynamicLineWidth
public int dynamicLineWidth() -
dynamicLineWidth
public int dynamicLineWidth(int width) -
getPresentationElementStroke
Return a stroke used to paint symbol's main part- Parameters:
width
- a custom stroke width. Other stroke parameters will be specific to symbol- Returns:
- a stroke used to paint symbol's main part
-
dynamicStroke
-
dynamicStroke
-
dynamicStroke
-
internalGetPresentationElementStroke
Return a stroke used to paint symbol's main part- Parameters:
width
- a custom stroke width. Other stroke parameters will be specific to symbol- Returns:
- a stroke used to paint symbol's main part
-
getStroke
Get cached stroke of given width.- Parameters:
stroke
- base stroke.width
- of the stroke.- Returns:
- stroke
-
getStroke
Get cached stroke of given style and default width.- Parameters:
lineStyle
- style of line.- Returns:
- stroke
- See Also:
-
getStroke
Get cached stroke of given style and width.- Parameters:
lineStyle
- style of linewidth
- width- Returns:
- stroke
- See Also:
-
getStroke
Get cached stroke of given style, width and join.- Parameters:
lineStyle
- style of linewidth
- width- Returns:
- stroke
- See Also:
-
getStroke
Get cached stroke of given style, width and join.- Parameters:
lineStyle
- style of linewidth
- width- Returns:
- stroke
- See Also:
-
getStroke
@OpenApi public static BasicStroke getStroke(float width, int cap, int join, float miterLimit, @CheckForNull float[] dash, float dash_phase) Get cached stroke. -
getChildrenWithSymbolProperties
-
isPreserveProportionsWhenGrowing
public boolean isPreserveProportionsWhenGrowing()Controls if the symbol should preserve proportions when growing.- Returns:
- true if proportions should be preserved, false otherwise.
-
setDummyResizeMode
public boolean setDummyResizeMode(boolean b) In dummy resize mode symbol may not resize according it children or move children on bounds changed and etc. This is more as hack for resize problems during load or diagram layout- Parameters:
b
- new value
-
getCenterlinePoint
Gets a point for centerline drawing.- Returns:
- centerline point.
-
getCenterlinePointX
public int getCenterlinePointX()Gets x coordinate for centerline drawing.- Returns:
- x coordinate for centerline.
-
getCenterlinePointY
public int getCenterlinePointY()Gets y coordinate for centerline drawing.- Returns:
- y coordinate for centerline.
-
getProjectImpl
Deprecated, for removal: This API element is subject to removal in a future version.useProject.getProject(BaseElement)
. Will be removed in 2026x.This method is deprecated and will be removed soon.- Specified by:
getProjectImpl
in interfaceMDElement
- Overrides:
getProjectImpl
in classcom.nomagic.magicdraw.uml.MDElementImpl
- Returns:
- project
-
setNeedRecreateListeners
public void setNeedRecreateListeners(boolean needRecreateListeners) Set a need to recreated models listeners flag- Parameters:
needRecreateListeners
- a new value
-
isNotNull
-
getModelElement
@CheckForNull public com.dassault_systemes.modeler.foundation.model.ModelElement getModelElement() -
sSetModelElement
public void sSetModelElement(@CheckForNull com.dassault_systemes.modeler.foundation.model.ModelElement element) -
setModelElement
public void setModelElement(@CheckForNull com.dassault_systemes.modeler.foundation.model.ModelElement element)
-
PresentationElementsManager.addProperty(PresentationElement, Property)
.