Class PresentationElement
- java.lang.Object
-
- com.nomagic.magicdraw.uml.MDElementImpl
-
- com.nomagic.magicdraw.uml.ElementImpl
-
- com.nomagic.magicdraw.uml.symbols.PresentationElement
-
- All Implemented Interfaces:
BaseElement
,MDElement
,ModelElementProvider
,NameOwner
,java.beans.PropertyChangeListener
,java.lang.Cloneable
,java.lang.Comparable
,java.util.EventListener
- Direct Known Subclasses:
DiagramPresentationElement
,PathConnector
@OpenApi public abstract class PresentationElement extends ElementImpl implements java.beans.PropertyChangeListener, ModelElementProvider, NameOwner
Base class for all visual elements used in the UML diagrams.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
com.nomagic.magicdraw.uml.symbols.PresentationElement.SmartListenerConfigData
An information about smart listener configs.static class
com.nomagic.magicdraw.uml.symbols.PresentationElement.StructureCache
A cache used for caching results of complicated computations from symbols structures.
-
Field Summary
Fields Modifier and Type Field Description private boolean
addedInSortManager
private static java.lang.Boolean
antialiasingState
private static boolean
CREATE_ELEMENT_LISTENER
private boolean
createElementListener
static int
DASHED_STROKE
Dashed path stroke.static int
DEFAULT_LINE_WIDTH
private boolean
disposed
A flag to indicate that element was disposed.static int
DOTTED_STROKE
Dotted path stroke.private com.nomagic.magicdraw.uml.ElementReference<Element>
element
Model element which holds all information.private java.lang.String
fontProperty
Property id that holds the fontprivate static java.awt.font.FontRenderContext
FRC_F_T
private static java.awt.font.FontRenderContext
FRC_T_T
static int
HANDLE_SIZE
private boolean
hasSurface
private com.nomagic.magicdraw.uml.symbols.PresentationElement.SmartListenerConfigData
lastUsedSmartListenerConfigData
Smart listener config used for last listener registration.private boolean
layouting
private java.lang.Boolean
loadedVisibility
Load time visibilitystatic double
MAX_LINE_WIDTH
static double
MIN_LINE_WIDTH
private boolean
needRecreateListeners
private PresentationElement
parent
parent object for this objectprivate static UnmodifiableDimension
PREFERRED_SIZE
private PropertyManager
propertyManager
Properties managerprivate java.lang.String
propertyManagerName
The name of property manager.static int
SHADOW_WIDTH
Symbol shadow width in pixelsprivate static java.util.Map<java.lang.Class,SmartListenerConfig>
smartListenerConfigurationsCache
private SmartPropertyChangeListener
smartPropertyChangeListener
static int
SOLID_STROKE
Solid path stroke.private static boolean
testUpdateFlag
A flag used internally for testing update methodsprivate java.lang.String
textColorProperty
Property id that holds the text colorprivate boolean
textEditable
private static java.util.Map<PresentationElement,java.lang.Integer>
updatedSymbols
Static map used for debugging purposesprivate com.nomagic.magicdraw.uml.symbols.PresentationElementVisibility
visibility
Indicates whether object is visible or not.
-
Constructor Summary
Constructors Constructor Description PresentationElement()
default constructorPresentationElement(PresentationElement parent)
Constructor
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addPresentationElement(PresentationElement element)
Add given child to this symbol.void
addPresentationElement(PresentationElement element, int index)
Add given child to this symbol at given indexvoid
addPresentationElementWithoutResize(PresentationElement element)
void
addProperty(Property prop)
Add property to presentation element.java.awt.Rectangle
adjustBoundsForMoving(java.awt.Rectangle rec, java.util.Collection<PresentationElement> movedTogether)
validate bounds for movingvoid
adjustChildBounds(java.awt.Rectangle bounds, PresentationElement element)
For adjusting child bounds when child type is not known but bounds should be corrected.void
adjustChildBoundsForMoving(java.awt.Rectangle bounds, PresentationElement element)
For adjusting child bounds when child type is not known but bounds should be corrected.boolean
alwaysShowTooltip()
void
applyProperties(PropertyManager manager)
Applies properties from given property managerboolean
askDeleteDataConfirmation()
Declared as interface with default implementation for subclasses.void
atInsert()
Invalidates object at insertprotected void
atInsertChildren()
void
autosizeAndResizeManipulatedParent()
Autosize and resize manipulated element - itself(if this element has manipulator) or manipulated parent.void
autosizeAndResizeParent()
Resize itself and initiate parent resizeboolean
beforeDelete(com.nomagic.magicdraw.commands.MacroCommand deleteCommand, java.util.Collection removeTogether)
Method is called before deleting symbol with user "DELETE" actionvoid
boundsChanged()
void
boundsChanged(java.awt.Rectangle bounds)
boolean
canAddChild(BaseElement o)
boolean
canAddChild(PresentationElement o)
Check of given symbol can be added as child into this symbol.boolean
canAddInstance(BaseElement o)
Checks if this object can add element of given type.boolean
canAddInstance(PresentationElement o)
Object view has no children.protected boolean
canBeDisposedOnUpdate()
Some symbols removes themselves on update if they are not valid by model anymore.boolean
canChangeElementParent(java.util.Collection<PresentationElement> movedTogether, BaseElement newParent)
Returns true, if symbol does not restrict it's element ownership changeboolean
canChangeParent(java.util.Collection<? extends PresentationElement> movedTogether, BaseElement newParent, boolean changeElementParent)
Returns true, if element can change parent.boolean
canChangeParent(java.util.Collection children, BaseElement newParent)
Returns true, if element can change parent.protected boolean
canFill()
boolean
canHavePaths()
void
changeProperties(PropertyManager manager)
void
changeProperty(Property prop)
Changes property of the view to the given onvoid
changePropertyManager(PropertyManager manager)
Changes current properties manager to the given one.boolean
checkElementParentOnAdd(PresentationElement child)
protected com.nomagic.magicdraw.uml.symbols.PresentationElementVisibility
checkProxyVisibility(com.nomagic.magicdraw.uml.symbols.PresentationElementVisibility visibility)
protected boolean
checkShowsProxy()
protected java.util.List<PresentationElement>
childrenForMoving()
Calculates selected children for moving or takes result from cached.static void
clearAntialiasingState()
void
clearShowsProxy()
PresentationElement
clone()
Returns a copy of theElement
.void
collectSubManipulatedElements(java.util.List<PresentationElement> col)
Collects all visible and manipulated elements in this hierarchy.void
collectSubPresentationElements(java.util.Collection<PresentationElement> collection)
Collects all sub-presentation elements into given collection.void
collectSubPresentationElements(java.util.Collection<PresentationElement> collection, java.util.function.Predicate<PresentationElement> predicate)
Collects all sub-presentation elements that match given predicate into given collection.void
collectSubShowingPresentationElements(java.util.Collection<PresentationElement> col)
Collect all visible children starting from current element.private void
collectSubShowingPresentationElements(java.util.Collection<PresentationElement> col, boolean checkVisibilityInParent)
Collect all visible children starting from current element.com.nomagic.magicdraw.commands.Command
constructChangePropertyCommand(Property prop)
Constructs the command for property changing.abstract boolean
coversPoint(int x, int y)
checks if object covers provided pointprivate void
createAdditionalSmartListenerConfig(java.util.List<SmartListenerConfig> configurations)
void
createPropertyChangeListener()
protected void
createPropertyManager()
Create default property manager for symbol.protected void
createSmartListenerConfig(java.util.List<SmartListenerConfig> configurations)
void
dispose()
disposes ends of links when link is deletedprotected void
disposeChildren()
Removes all children from itself.protected void
disposeListener()
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)
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)
java.awt.Color
dynamicFillColor()
java.awt.Color
dynamicLineColor()
int
dynamicLineWidth()
int
dynamicLineWidth(int width)
boolean
dynamicPaintShadow()
java.awt.BasicStroke
dynamicStroke()
java.awt.BasicStroke
dynamicStroke(int width)
java.awt.BasicStroke
dynamicStroke(java.awt.BasicStroke stroke)
java.awt.Color
dynamicStyleFillColor(java.awt.Color color, boolean useFill)
java.awt.Paint
dynamicStyleFillPaint(java.awt.Paint paint, java.awt.Color fillColor, int x1, int y1, int x2, int y2)
java.awt.Color
dynamicStyleLineColor(java.awt.Color color)
java.awt.Color
dynamicStyleTextColor(java.awt.Color color)
int
dynamicStyleTransparency()
int
dynamicStyleTransparency(javax.swing.Icon target)
protected <T> T
dynamicStyleValue(T merged, java.util.function.BiFunction<com.nomagic.magicdraw.uml.symbols.DynamicStyle,T,T> valueProvider)
com.nomagic.magicdraw.uml.symbols.shapes.TextObject.HorizontalPosition
dynamicTextAlignment(com.nomagic.magicdraw.uml.symbols.shapes.TextObject.HorizontalPosition target)
java.awt.Color
dynamicTextColor()
void
editName(java.awt.event.KeyEvent evt)
Starts online diagram editing for a symbolvoid
editName(java.awt.event.KeyEvent evt, java.util.Map<java.lang.String,java.lang.Boolean> textEditorOptions)
Starts online diagram editing for a symbolElement
findParentForData(PresentationElement newParent, com.nomagic.uml2.ElementAddContext addContext)
static PresentationElement
findPresentationElement(java.util.Collection<PresentationElement> elements, Element data)
Finds presentation element with given Element among given elementsvoid
firePropertyChange(java.lang.String propertyName, java.lang.Object oldValue, java.lang.Object newValue)
DelegatesfirePropertyChange
to thePropertyChangeSupport
, the member of this class, which reports a bound property update to any registered listeners.java.lang.String
generateID()
Element
getActualElement()
Because some views returns theirs parent model element, we do not know have they this member set or not.Property
getActualProperty(java.lang.String s)
Returns actual property.protected java.util.List<com.nomagic.magicdraw.uml.symbols.SymbolDecorator>
getAdditionalRenderersToNotify()
java.lang.Class[]
getAssignableModelElementsClasses()
Returns an array of ModelElements classes that can be assigned as ModelElement to this PresentationElement.protected boolean
getBooleanPropertyValue(java.lang.String propertyID, boolean defaultValue)
java.awt.Rectangle
getBounds()
Method returns bounds of this element.java.awt.Shape
getBoundsShape(ConverterToShape converterToShape)
Provides a bounding shape of the symboljava.awt.Rectangle
getBoundsToRepaint()
Return bounds of the symbol that must be repainted.java.awt.Rectangle
getBoundsWithChildrenOnEdge()
java.awt.Point
getCenterlinePoint()
Gets a point for centerline drawing.int
getCenterlinePointX()
Gets x coordinate for centerline drawing.int
getCenterlinePointY()
Gets y coordinate for centerline drawing.PresentationElement
getChildPresentationElementForContextMenu(java.awt.Point pt)
Returns child element for showing context menu.java.util.List<PresentationElement>
getChildrenWithSymbolProperties()
protected SmartListenerConfig
getConfiguration()
private com.nomagic.magicdraw.uml.symbols.PresentationElement.SmartListenerConfigData
getConfigurations()
DiagramPresentationElement
getDiagramPresentationElement()
Returns diagram of this presentation element.DiagramSurface
getDiagramSurface()
Returns diagram surface for this presentation element.java.util.Comparator<PresentationElement>
getDrawComparator()
protected java.util.List<SmartListenerConfig>
getDynamicConfigurations()
Gets non-cacheable smart listener configurations.PresentationElement
getDynamicStyleOwner()
Element
getElement()
Returns model element of this presentation element.java.lang.String
getElementNumberDisplayMode()
Returns element numbering display mode for presentation elementjava.util.Collection<? extends Element>
getElementsForLinkConnecting()
The same as getElementsForLinkConnecting(), just takes into account SymbolDecoratorsElement
getElementToConnectLink(Element path, boolean asClient)
The same as internalGetElementToConnectLink(), just takes into account SymbolDecoratorsElement
getElementToMove()
Returns element that should be used for during "move" operation.Element
getExpectedDataParent(PresentationElement child)
Returns expected element parent.private static int
getExtraGapWidth(int width)
java.awt.Color
getFillColor()
Returns fill colorjava.awt.Font
getFont()
Gets font of this object view.int
getFontHeight()
Gets font height.static java.awt.font.FontRenderContext
getFontRenderContext()
java.lang.String
getHumanName()
Returns human representation of the data typejava.lang.String
getHumanType()
Returns human representation of the data typejava.awt.Point
getIntersection(int x, int y, PathElement path)
java.awt.Color
getLineColor()
Returns line colorint
getLineWidth()
PresentationElement
getManipulatedElementAt(java.awt.Point pt)
Gets manipulated symbol at specified point pt.PresentationElement
getManipulatedElementAt(java.awt.Point pt, com.nomagic.magicdraw.uml.symbols.SortManagerProvider sortManagerProvider)
Gets manipulate symbol at specified point pt.java.util.List<PresentationElement>
getManipulatedIntersectionWith(java.awt.Rectangle rect)
Returns vector of manipulated objects whose intersect with given rectanglejava.util.List<PresentationElement>
getManipulatedIntersectionWith(java.awt.Rectangle rect, boolean completelyCovered)
Returns vector of manipulated objects whose intersect with given rectanglePresentationElement
getManipulatedParent()
java.util.List<PresentationElement>
getManipulatedPresentationElements()
Returns a list of children of this element those have manipulator.java.awt.Rectangle
getManipulationBounds(java.awt.Point relativePoint)
Gets manipulation bounds of the symbol.UnmodifiableDimension
getManipulationPreferredDimension()
java.awt.Point
getMiddlePoint()
Returns middle point of this element.java.awt.Point
getMiddlePoint(java.awt.Point relativePoint)
Gets middle point of this view,int
getMiddlePointX()
protected int
getMiddlePointX(java.awt.Point relativePoint)
int
getMiddlePointY()
protected int
getMiddlePointY(java.awt.Point relativePoint)
UnmodifiableDimension
getMinimumDimension()
get minimum possible size for objectjava.awt.Rectangle
getNotCopyBounds()
get not copy bounds of object throws NoRectangleDefinedExceptionprotected int
getNotZoomedTolerance()
BaseElement
getObjectParent()
Returns the presentation element parent.PresentationElement
getParent()
Returns parent of this element.PresentationElement
getParentSymbolPropertyOwner()
Returns parent symbol property manager to which this symbol delegates symbol property related functionality.java.awt.Rectangle
getPreferredBounds()
Calculate the smallest rectangle which would fit all contained shapesUnmodifiableDimension
getPreferredDimension()
Returns preferable dimension of the element.UnmodifiableDimension
getPreferredDimensionForAutosize()
Returns preferable dimension of the element for autosize.This implementation simple returns preferred size.java.awt.Dimension
getPreferredSize()
Deprecated.PresentationElement
getPresentationElementAt(int index)
Gets object view at specified position from containerPresentationElement
getPresentationElementAt(java.awt.Point p)
Gets object view at point.PresentationElement
getPresentationElementAt(java.awt.Point relativePoint, com.nomagic.magicdraw.uml.symbols.SortManagerProvider sortManagerProvider)
Gets object view at point.int
getPresentationElementCount()
Returns children count in container.int
getPresentationElementIndex(PresentationElement element)
Get index of the given presentation element in the container.java.util.List<PresentationElement>
getPresentationElements()
Returns all children of this elementjava.util.List<PresentationElement>
getPresentationElementsAt(java.awt.Point p)
Gets objects at point.java.util.List<PresentationElement>
getPresentationElementsAt(java.awt.Point relativePoint, com.nomagic.magicdraw.uml.symbols.SortManagerProvider sortManagerProvider)
Gets object view at point.java.awt.BasicStroke
getPresentationElementStroke()
Return a stroke used to paint symbol's main partjava.awt.BasicStroke
getPresentationElementStroke(int width)
Return a stroke used to paint symbol's main partProject
getProjectImpl()
Property
getProperty(java.lang.String id)
Returns element's property with given id.PropertyManager
getPropertyManager()
Returns the propertyManager of this element.java.lang.String
getPropertyManagerName()
PropertyManager
getRealPropertyManager()
com.nomagic.magicdraw.uml.symbols.SymbolDecorator
getRenderer()
Gets rendered which could decorate this symbol.java.util.List<PresentationElement>
getSelected()
Returns a list of selected elements in the diagram.private SmartListenerConfig
getStaticConfiguration()
java.awt.Color
getStereotypeColor()
Returns text colorjava.awt.Font
getStereotypeFont()
Gets stereotype font of this object view.protected java.lang.String
getStringPropertyValue(java.lang.String propertyID, java.lang.String defaultValue)
static java.awt.BasicStroke
getStroke(float width, int cap, int join, float miterLimit, float[] dash, float dash_phase)
Get cached stroke.static java.awt.BasicStroke
getStroke(int lineStyle)
Get cached stroke of given style and default width.static java.awt.BasicStroke
getStroke(int lineStyle, int width)
Get cached stroke of given style and width.static java.awt.BasicStroke
getStroke(int lineStyle, int width, int join)
Get cached stroke of given style, width and join.static java.awt.BasicStroke
getStroke(int lineStyle, int width, int join, int cap)
Get cached stroke of given style, width and join.static java.awt.BasicStroke
getStroke(java.awt.BasicStroke stroke, int width)
Get cached stroke of given width.protected static com.nomagic.magicdraw.uml.symbols.SymbolDecorator
getSymbolRenderer(PresentationElement presentationElement)
private com.nomagic.magicdraw.commands.SymbolUpdater
getSymbolUpdater()
java.awt.Color
getTextColor()
Returns text colorint
getTolerance()
Returns tolerancecom.nomagic.magicdraw.uml.symbols.PresentationElementVisibility
getVisibility()
java.util.List<PresentationElement>
getVisiblePresentationElements()
protected void
handleModelDelete()
handles model element delete property Change event.boolean
hasDiagramSurface()
boolean
hasManipulatedPresentationElements()
boolean
hasManipulator()
Returns true, if view has manipulator (is selectable)boolean
hasSharedData()
Returns true if data of this object can be shared.void
initialize()
Initialize symbol and its children state.void
initializeAndAutosize()
Initialize symbol and call autosize recursivelyprotected void
internalApplyProperties(PropertyManager manager)
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)
java.awt.Shape
internalGetBoundsShape(ConverterToShape converterToShape)
java.util.Collection<? extends Element>
internalGetElementsForLinkConnecting()
Returns all possible element that can be used for some link connecting.Element
internalGetElementToConnectLink(Element path, boolean asClient)
Returns element that should be used for given link connecting.java.awt.BasicStroke
internalGetPresentationElementStroke(int width)
Return a stroke used to paint symbol's main partvoid
internalSilentApply()
Silently applies all properties after initializationprotected void
internalSnapToGrid(float step)
protected void
internalSnapToGrid(java.awt.Point p, float step)
protected void
internalUpdatePresentationElement()
Internal symbol update method for subclassing.abstract boolean
intersects(int x, int y, int width, int height)
checks whether object intersects with given rectangleboolean
invalidate()
Invalidates this element.boolean
isCanChildrenChangeEdge()
boolean
isChildVisible(PresentationElement child)
Returns true if given child of this object is visible.boolean
isContentHidden()
protected boolean
isCreateElementListener()
boolean
isDetectable()
Not detectable symbols are not drawn even they are visible.boolean
isDisposed()
Checks if element was explicitly disposed by callingdispose()
method.boolean
isLayouting()
boolean
isMovableByMoveManager()
Method indicates if object of this instance must be registered in move manager.private static boolean
isMovingWith(PresentationElement view, java.util.Collection<PresentationElement> movedViews)
boolean
isNotNull(Element element)
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
isPreserveProportionsWhenGrowing()
Controls if the symbol should preserve proportions when growing.boolean
isSelected()
Returns true, if this element is selected in the diagram.boolean
isShowElementTypeAsLabel()
boolean
isShowsProxy()
protected boolean
isSnapToGrid()
boolean
isSortable()
If OV is sortable (must be added to sort manager for sorting) method must return true;static boolean
isTestUpdateFlag()
boolean
isTextEditable()
Checks text editing flag.boolean
isUseFillColor()
protected boolean
isUseFillColorByProperty()
boolean
isUseGradientForFill()
Do we need to use gradient for fill color? Checks diagram property.private boolean
isValidElement(Element element)
boolean
isVisible()
boolean
isVisibleInDiagram()
Check if this symbol is visible in diagram (visible itself and its parent is visible)boolean
isVisibleOrShrunken()
private void
makeOverviewPanelDirty()
void
movePathElements()
void
movePathElementsRecursively()
boolean
mustShowContextMenu()
void
notifyCreated()
Notify move manager about created presentation element.protected void
notifyDiagramFrameSizeChange()
Notify diagram frame about change in this symbol.private void
notifyRendererAboutSymbolPropertyChanges(java.util.Collection<com.nomagic.magicdraw.uml.symbols.SymbolDecorator> renderers, PropertyManager newManager, PropertyManager oldManager)
Notifies symbol renderer about symbol property changes.void
notifyRepaintManager(boolean boundsChanged)
Notifies the repaint manager about changes in bounds.void
onFind()
Scrolls diagram canvas to this symbol and selects this symbolvoid
onFind(boolean center)
Scrolls diagram canvas to this symbol and selects this symbolprotected void
onFontChange()
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)
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
preDisposeOnUpdate()
Validate symbol against model and try to fix it before actual symbol update.protected boolean
prepareForFillDrawing(java.awt.Graphics2D g, int x1, int y1, int x2, int y2)
Prepares graphics for fill drawing.protected boolean
prepareForLineDrawing(java.awt.Graphics2D g)
Prepares graphics for line drawingprotected boolean
prepareForShadowDrawing(java.awt.Graphics2D g)
Prepares graphics for symbol shadow drawing.protected void
prepareForTextDrawing(java.awt.Graphics2D g)
Prepares graphics for text drawingvoid
propertyChange(java.beans.PropertyChangeEvent e)
Listens for property change it can be: data was edited text box was editedvoid
recreateListeners()
Recreates model listeners for this symbol.void
recursiveAutosize()
Resize recursively all symbols.void
registerInSortManager()
Registers this view in the sort managervoid
rememberBounds()
Remember old boundsvoid
rememberBounds(java.awt.Rectangle bounds)
void
removeFromSortManager()
Removes this OV from sort manager.protected void
removeItSelfOnUpdate()
Remove itself during update and register this changed in command history.void
removePresentationElement(PresentationElement element)
Removes given childvoid
resizeParent()
Method that initiates parent resize to accommodate children if some child's bounds are changed.void
sAddPresentationElement(PresentationElement element)
Add given child to this symbol.void
sAddPresentationElement(PresentationElement element, int index)
Add given child to this symbol at given indexprotected java.util.List<PresentationElement>
selectChildrenForMoving()
Calculates children for moving together with this symbol.java.util.List<PresentationElement>
selectObjectsForMoving()
if calling simple set bounds for container shapes container moves itself and inner/related views This method selects which views must be moved.protected java.util.List<PathElement>
selectPathsForMoving(java.util.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.void
setBounds(int x, int y, int width, int height)
abstract void
setBounds(java.awt.Rectangle rect)
sets bounds of this object viewvoid
setCreateElementListener(boolean createElementListener)
void
setDiagramSurface(DiagramSurface surface)
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
setFillColor(java.awt.Color c)
Sets fill colorboolean
setFont(java.awt.Font font)
Sets font for this object view.protected void
setFontProperty(java.lang.String fontProperty)
void
setLayouting(boolean v)
void
setLineColor(java.awt.Color c)
Sets line colorvoid
setLineWidth(int width)
void
setLoadedVisibility(boolean visible)
void
setLocation(int x, int y)
sets location of objectvoid
setLocation(java.awt.Point location)
sets location of objectvoid
setNeedRecreateListeners(boolean needRecreateListeners)
Set a need to recreated models listeners flagvoid
setParent(PresentationElement parent)
Sets parent for this view.void
setPresentationElements(java.util.List<PresentationElement> elements)
Sets children of this elementvoid
setPropertyManager(PropertyManager man)
Sets property managervoid
setPropertyManagerName(java.lang.String propertyManagerName)
void
setSelected(boolean select)
Selects or deselects this presentation element in the diagram.void
setSelected(java.util.List<PresentationElement> elements)
Selects given elements in the diagram.void
setSize(int width, int height)
set dimension of draw objectvoid
setSize(UnmodifiableDimension size)
set dimension of draw objectvoid
setSize(java.awt.Dimension size)
set dimension of draw objectvoid
setStereotypeColor(java.awt.Color c)
Sets text colorvoid
setStereotypeFont(java.awt.Font font)
Sets stereotype font for this object view.static void
setStrokeIfNotTheSame(java.awt.Graphics2D g, java.awt.Stroke stroke)
static void
setTestUpdateFlag(boolean testUpdateFlag)
void
setTextColor(java.awt.Color c)
Sets text colorprotected void
setTextColorProperty(java.lang.String textColorProperty)
void
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.void
setVisible(boolean visible)
Sets element visibility flag.void
silentApply()
Silently applies all properties after initializationvoid
silentApply(boolean recreateListeners)
Silently applies all properties after initializationvoid
simpleSetBounds(int x, int y, int width, int height)
void
simpleSetBounds(java.awt.Rectangle rect)
Sets bounding rectangle.void
snapToGrid(java.awt.Point p, float step)
Snap to grid this pointvoid
snapToGrid(java.awt.Rectangle r, float step)
Snap to grid this rectanglevoid
snapViewToGrid(float step)
Snap to grid this pointstatic void
sortObjectsByX(java.util.List<? extends PresentationElement> vector)
Sorts objectViews by x ascending.static void
sortObjectsByY(java.util.List<? extends PresentationElement> vector)
Sorts objectViews by y in ascending order.void
sRemovePresentationElement(PresentationElement element)
Removes given childvoid
sSetBounds(int x, int y, int width, int height)
abstract void
sSetBounds(java.awt.Rectangle rect)
Sets bounds of this object view only.void
sSetElement(Element element)
void
sSetLineWidth(int width)
void
sSetLocation(int x, int y)
Sets location of object.void
sSetLocation(java.awt.Point location)
sets location of objectvoid
sSetParent(PresentationElement parent)
Sets parent for this view.void
sSetParentForAll(java.util.Collection<PresentationElement> elements)
Sets itself as parent to the all PresentationElement from given vector.void
sSetPresentationElements(java.util.List<PresentationElement> elements)
Sets children of this elementvoid
sSetSize(int width, int height)
Sets dimension of draw object.void
sSetSize(UnmodifiableDimension size)
set dimension of draw objectvoid
sSetSize(java.awt.Dimension size)
set dimension of draw objectvoid
sSetVisibility(com.nomagic.magicdraw.uml.symbols.PresentationElementVisibility visibility)
Sets element visibility flag.void
sSetVisible(boolean visible)
Sets element visibility flag.boolean
tryToDeleteModelElementUponRemoval()
Override this method if you do not want model element to be deleted upon symbol deletion.void
update()
Major presentation element update by model element method.void
updateAfterLoad()
void
updateLabelsIgnoringSuspendableLater(java.util.Collection<com.nomagic.magicdraw.uml.symbols.shapes.LabelWrapper> wrappers)
void
updateLater()
If it is possible method adds view to update list.void
updateModelByView()
Updates model according current view structure.protected void
updateModelByViewInternal()
Updates model according current view structure.void
updateViewAfterPropertyChange()
boolean
useParentProperties()
Does this element uses parent properties or has it own?-
Methods inherited from class com.nomagic.magicdraw.uml.MDElementImpl
accept, accept, addPropertyChangeListener, canAdd, canAdd, canAddChild, canBeDeleted, canDeleteChild, compareTo, createSortKeys, getClassType, getCommandForAppending, getID, getName, getProject, getProjectProvider, getResourceID, getSortKeys, hasListeners, isEditable, removeAllChildren, removeAllParents, removeAllPropertyChangeListeners, removePropertyChangeListener, setID, setProjectProvider, sGetID, toString
-
-
-
-
Field Detail
-
CREATE_ELEMENT_LISTENER
private static final boolean CREATE_ELEMENT_LISTENER
-
antialiasingState
private static java.lang.Boolean antialiasingState
-
MAX_LINE_WIDTH
public static final double MAX_LINE_WIDTH
- See Also:
- Constant Field Values
-
MIN_LINE_WIDTH
public static final double MIN_LINE_WIDTH
- See Also:
- Constant Field Values
-
HANDLE_SIZE
public static final int HANDLE_SIZE
- See Also:
- Constant Field Values
-
testUpdateFlag
private static boolean testUpdateFlag
A flag used internally for testing update methods
-
updatedSymbols
private static java.util.Map<PresentationElement,java.lang.Integer> updatedSymbols
Static map used for debugging purposes
-
SOLID_STROKE
@OpenApi public static final int SOLID_STROKE
Solid path stroke.- See Also:
- Constant Field Values
-
DASHED_STROKE
@OpenApi public static final int DASHED_STROKE
Dashed path stroke.- See Also:
- Constant Field Values
-
DOTTED_STROKE
@OpenApi public static final int DOTTED_STROKE
Dotted path stroke.- See Also:
- Constant Field Values
-
SHADOW_WIDTH
public static final int SHADOW_WIDTH
Symbol shadow width in pixels- See Also:
- Constant Field Values
-
DEFAULT_LINE_WIDTH
public static final int DEFAULT_LINE_WIDTH
- See Also:
- Constant Field Values
-
hasSurface
private boolean hasSurface
-
addedInSortManager
private boolean addedInSortManager
-
layouting
private boolean layouting
-
createElementListener
private boolean createElementListener
-
smartListenerConfigurationsCache
private static java.util.Map<java.lang.Class,SmartListenerConfig> smartListenerConfigurationsCache
-
propertyManager
private PropertyManager propertyManager
Properties manager
-
visibility
private com.nomagic.magicdraw.uml.symbols.PresentationElementVisibility visibility
Indicates whether object is visible or not.
-
parent
private PresentationElement parent
parent object for this object
-
textEditable
private boolean textEditable
-
element
@CheckForNull private com.nomagic.magicdraw.uml.ElementReference<Element> element
Model element which holds all information.
-
propertyManagerName
@CheckForNull private java.lang.String propertyManagerName
The name of property manager. If this name is null, property manager will be set by element class name.
-
smartPropertyChangeListener
@CheckForNull private SmartPropertyChangeListener smartPropertyChangeListener
-
loadedVisibility
private java.lang.Boolean loadedVisibility
Load time visibility
-
textColorProperty
@CheckForNull private java.lang.String textColorProperty
Property id that holds the text color
-
fontProperty
private java.lang.String fontProperty
Property id that holds the font
-
needRecreateListeners
private boolean needRecreateListeners
-
lastUsedSmartListenerConfigData
private com.nomagic.magicdraw.uml.symbols.PresentationElement.SmartListenerConfigData lastUsedSmartListenerConfigData
Smart listener config used for last listener registration. Keep it in order to not register the same listeners again if asked.
-
disposed
private boolean disposed
A flag to indicate that element was disposed.
-
PREFERRED_SIZE
private static UnmodifiableDimension PREFERRED_SIZE
-
FRC_F_T
private static final java.awt.font.FontRenderContext FRC_F_T
-
FRC_T_T
private static final java.awt.font.FontRenderContext FRC_T_T
-
-
Constructor Detail
-
PresentationElement
public PresentationElement(@CheckForNull PresentationElement parent)
Constructor- Parameters:
parent
- parent element
-
PresentationElement
public PresentationElement()
default constructor
-
-
Method Detail
-
sSetElement
public void sSetElement(@CheckForNull Element element)
-
generateID
public java.lang.String generateID()
- Overrides:
generateID
in classcom.nomagic.magicdraw.uml.MDElementImpl
-
isValidElement
private boolean isValidElement(@CheckForNull Element element)
-
getElementNumberDisplayMode
public java.lang.String getElementNumberDisplayMode()
Returns element numbering display mode for presentation element- Returns:
- the elementNumber Display mode
-
setElement
public void setElement(@CheckForNull Element element)
-
getElement
@OpenApi @CheckForNull public Element 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
@CheckForNull public Element getActualElement()
Because some views returns theirs parent model element, we do not know have they this member set or not.
-
sSetParent
public void sSetParent(@CheckForNull PresentationElement parent)
Sets parent for this view. For adding symbols to other symbols useaddPresentationElement(PresentationElement)
orsAddPresentationElement(PresentationElement)
}- Parameters:
parent
- parent view
-
setParent
public void setParent(PresentationElement parent)
Sets parent for this view. For adding symbols to other symbols useaddPresentationElement(PresentationElement)
orsAddPresentationElement(PresentationElement)
}- Parameters:
parent
- parent view
-
hasSharedData
public boolean hasSharedData()
Returns true if data of this object can be shared. If data is not shared data can be deleted with del key. Or it must be deleted with CRL+D- Returns:
- true if data of this object can be shared.
-
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
public final void collectSubPresentationElements(java.util.Collection<PresentationElement> collection)
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(java.util.Collection<PresentationElement> collection, java.util.function.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
public final void collectSubShowingPresentationElements(java.util.Collection<PresentationElement> col)
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
-
collectSubShowingPresentationElements
private void collectSubShowingPresentationElements(java.util.Collection<PresentationElement> col, boolean checkVisibilityInParent)
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.WARNING this method does not works correctly when elements are in compartment, because compartments are not visible and inner elements are not collected.
- Parameters:
col
- result
-
getPresentationElementAt
@CheckForNull public PresentationElement getPresentationElementAt(java.awt.Point p)
Gets object view at point.- Parameters:
p
- object view at point location- Returns:
- object view at this point
-
getPresentationElementAt
@CheckForNull public PresentationElement getPresentationElementAt(java.awt.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 java.util.List<PresentationElement> getPresentationElementsAt(java.awt.Point p)
Gets objects at point.- Parameters:
p
- object view at point location.- Returns:
- object view at this point.
-
getPresentationElementsAt
@CheckForNull public java.util.List<PresentationElement> getPresentationElementsAt(java.awt.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 final PresentationElement getPresentationElementAt(int index)
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
public int getPresentationElementIndex(PresentationElement element)
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
public boolean isParentOf(@CheckForNull PresentationElement child)
Checks if object is child of this object.- Parameters:
child
- object to check.- Returns:
- true if obj is child of this object.
-
isParentOf
public boolean isParentOf(BaseElement obj)
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 parent of this object.
-
setDiagramSurface
public void setDiagramSurface(@CheckForNull DiagramSurface surface)
-
registerInSortManager
public void registerInSortManager()
Registers this view in the sort manager
-
getDiagramSurface
@CheckForNull @OpenApi public DiagramSurface getDiagramSurface()
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
public PresentationElement clone()
Description copied from class:ElementImpl
Returns a copy of theElement
.- Specified by:
clone
in interfaceBaseElement
- Overrides:
clone
in classElementImpl
- Returns:
- the cloned object
-
getParent
@OpenApi public PresentationElement getParent()
Returns parent of this element.- Returns:
- parent of this element.
-
getPreferredSize
@Deprecated @OpenApi public final java.awt.Dimension getPreferredSize()
Deprecated.Returns preferable dimension of the element.- Returns:
- preferred dimension
-
getPreferredDimension
@OpenApi public UnmodifiableDimension getPreferredDimension()
Returns preferable dimension of the element.- Returns:
- preferred dimension
-
getPreferredDimensionForAutosize
public UnmodifiableDimension getPreferredDimensionForAutosize()
Returns preferable dimension of the element for autosize.This implementation simple returns preferred size.- Returns:
- preferred dimension
-
getPreferredBounds
public java.awt.Rectangle getPreferredBounds()
Calculate the smallest rectangle which would fit all contained shapes- Returns:
- rectangle
-
getMinimumDimension
public UnmodifiableDimension getMinimumDimension()
get minimum possible size for object- Returns:
- minimum dimension
-
setSize
public final void setSize(UnmodifiableDimension size)
set dimension of draw object
-
setSize
public final void setSize(java.awt.Dimension size)
set dimension of draw object
-
sSetSize
public final void sSetSize(java.awt.Dimension size)
set dimension of draw object
-
sSetSize
public final void sSetSize(UnmodifiableDimension size)
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
public final void setLocation(java.awt.Point location)
sets location of object
-
sSetLocation
public final void sSetLocation(java.awt.Point location)
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
public abstract void setBounds(java.awt.Rectangle rect) throws NoRectangleDefinedException
sets bounds of this object view- Parameters:
rect
- rectangle of bounds- Throws:
NoRectangleDefinedException
-
sSetBounds
public abstract void sSetBounds(java.awt.Rectangle rect) throws NoRectangleDefinedException
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
public void simpleSetBounds(java.awt.Rectangle rect)
Sets bounding rectangle.- Parameters:
rect
- new bounding rectangle.
-
movePathElements
public void movePathElements()
-
movePathElementsRecursively
public final void movePathElementsRecursively()
-
getMiddlePoint
@CheckForNull @OpenApi public java.awt.Point 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
@CheckForNull public java.awt.Point getMiddlePoint(java.awt.Point relativePoint)
Gets middle point of this view,- Parameters:
relativePoint
- relative point- Returns:
- middle point
-
getMiddlePointX
protected int getMiddlePointX(java.awt.Point relativePoint)
-
getMiddlePointY
protected int getMiddlePointY(java.awt.Point relativePoint)
-
getIntersection
@CheckForNull public java.awt.Point getIntersection(int x, int y, @CheckForNull PathElement path)
-
getBounds
@OpenApi public java.awt.Rectangle getBounds() throws NoRectangleDefinedException
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(com.nomagic.magicdraw.uml.symbols.shapes.ShapeElement, java.awt.Rectangle)
-
getManipulationBounds
public java.awt.Rectangle getManipulationBounds(@CheckForNull java.awt.Point relativePoint)
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
public java.awt.Rectangle getBoundsToRepaint() throws NoRectangleDefinedException
Return bounds of the symbol that must be repainted. throws NoRectangleDefinedException- Returns:
- rectangle of bounds
- Throws:
NoRectangleDefinedException
-
getNotCopyBounds
public java.awt.Rectangle getNotCopyBounds() throws NoRectangleDefinedException
get not copy bounds of object throws NoRectangleDefinedException- Returns:
- rectangle of bounds
- Throws:
NoRectangleDefinedException
-
intersects
public abstract 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 abstract boolean coversPoint(int x, int y)
checks if object covers provided point- Returns:
- true if object covers this point
-
selectObjectsForMoving
public java.util.List<PresentationElement> 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
protected final java.util.List<PresentationElement> childrenForMoving()
Calculates selected children for moving or takes result from cached.- Returns:
- list of children for moving.
- See Also:
selectChildrenForMoving()
,PresentationElement.StructureCache
-
selectChildrenForMoving
protected java.util.List<PresentationElement> 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:
childrenForMoving()
-
selectPathsForMoving
protected java.util.List<PathElement> selectPathsForMoving(@CheckForNull java.util.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
-
isMovingWith
private static boolean isMovingWith(PresentationElement view, java.util.Collection<PresentationElement> movedViews)
- Returns:
- true if the given view's bounds will change when moving given movedViews For example, incoming path will be moved (one of its ends will change) when moving some shape
-
setPresentationElements
public void setPresentationElements(java.util.List<PresentationElement> elements)
Sets children of this element- Parameters:
elements
- children
-
sSetPresentationElements
public void sSetPresentationElements(java.util.List<PresentationElement> elements)
Sets children of this element- Parameters:
elements
- children
-
getPresentationElements
@OpenApi public java.util.List<PresentationElement> getPresentationElements()
Returns all children of this element- Returns:
- all children of this element. The collection is unmodifiable.
-
getVisiblePresentationElements
public final java.util.List<PresentationElement> getVisiblePresentationElements()
- Returns:
- not modifiable list of visible elements, including not detectable ones that should not be painted.
- See Also:
isDetectable()
-
removePresentationElement
public void removePresentationElement(PresentationElement element)
Removes given child- Parameters:
element
- child
-
sRemovePresentationElement
public void sRemovePresentationElement(PresentationElement element)
Removes given child- Parameters:
element
- child
-
addPresentationElement
public final void addPresentationElement(PresentationElement element)
Add given child to this symbol.- Parameters:
element
- child to add
-
addPresentationElement
public void addPresentationElement(PresentationElement element, int index)
Add given child to this symbol at given index- Parameters:
element
- child to addindex
- index to add at. Can be -1
-
addPresentationElementWithoutResize
public void addPresentationElementWithoutResize(PresentationElement element)
-
sAddPresentationElement
public final void sAddPresentationElement(PresentationElement element)
Add given child to this symbol.- Parameters:
element
- child to add
-
sAddPresentationElement
public void sAddPresentationElement(PresentationElement element, int index)
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
public java.util.Comparator<PresentationElement> getDrawComparator()
-
mustShowContextMenu
public boolean mustShowContextMenu()
-
canHavePaths
public boolean canHavePaths()
- Returns:
- true if symbol can have connected paths. Return false here.
-
canAddChild
public boolean canAddChild(PresentationElement o)
Check of given symbol can be added as child into this symbol.- Parameters:
o
- symbol- Returns:
- true if symbol can be added
-
canAddChild
public final boolean canAddChild(BaseElement o)
- Specified by:
canAddChild
in interfaceMDElement
- Overrides:
canAddChild
in classcom.nomagic.magicdraw.uml.MDElementImpl
-
checkElementParentOnAdd
public boolean checkElementParentOnAdd(PresentationElement child)
-
canAddInstance
public boolean canAddInstance(PresentationElement o)
Object view has no children.
-
canAddInstance
public final boolean canAddInstance(BaseElement o)
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 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.- See Also:
getDiagramPresentationElement()
-
setSelected
@OpenApi public void setSelected(java.util.List<PresentationElement> elements)
Selects given elements in the diagram.- Parameters:
elements
- elements to select.- See Also:
getDiagramPresentationElement()
-
setSelected
@OpenApi public void setSelected(boolean select)
Selects or deselects this presentation element in the diagram.- Parameters:
select
- select or deselect this presentation element.- See Also:
getDiagramPresentationElement()
-
getSelected
@OpenApi public java.util.List<PresentationElement> getSelected()
Returns a list of selected elements in the diagram.- Returns:
- a list of selected elements. List is unmodifiable.
- See Also:
getDiagramPresentationElement()
-
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()
,initialize()
-
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 public DiagramPresentationElement getDiagramPresentationElement()
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:
update()
-
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
public static java.awt.font.FontRenderContext 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()
If it is possible method adds view to update list. View will be updated when all other commands are executed. If this is not possible updates immediately.
-
updateLabelsIgnoringSuspendableLater
public void updateLabelsIgnoringSuspendableLater(java.util.Collection<com.nomagic.magicdraw.uml.symbols.shapes.LabelWrapper> wrappers)
-
getSymbolUpdater
@CheckForNull private com.nomagic.magicdraw.commands.SymbolUpdater getSymbolUpdater()
-
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
public void propertyChange(java.beans.PropertyChangeEvent e)
Listens for property change it can be: data was edited text box was edited- Specified by:
propertyChange
in interfacejava.beans.PropertyChangeListener
-
handleModelDelete
protected void handleModelDelete()
handles model element delete property Change event. typical implementation is to delete ov from parent.
-
setFont
public boolean setFont(java.awt.Font font)
Sets font for this object view.- Parameters:
font
- new font.
-
setStereotypeFont
public void setStereotypeFont(java.awt.Font font)
Sets stereotype font for this object view.- Parameters:
font
- new font.
-
getFont
public java.awt.Font getFont()
Gets font of this object view. It returns font from the project.- Returns:
- font of the text object.
-
getStereotypeFont
@CheckForNull public java.awt.Font getStereotypeFont()
Gets stereotype font of this object view. It returns font from the project.- Returns:
- font of the text object.
-
getHumanType
public java.lang.String 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
public java.lang.String 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
@CheckForNull public PresentationElement getManipulatedElementAt(java.awt.Point pt)
Gets manipulated symbol at specified point pt.- Parameters:
pt
-Point
- Returns:
- manipulate symbol
-
getManipulatedElementAt
@CheckForNull public PresentationElement getManipulatedElementAt(java.awt.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
public final void sSetParentForAll(java.util.Collection<PresentationElement> elements)
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
public final void snapToGrid(java.awt.Rectangle r, float step)
Snap to grid this rectangle
-
snapToGrid
public final void snapToGrid(java.awt.Point p, float step)
Snap to grid this point
-
internalSnapToGrid
protected void internalSnapToGrid(java.awt.Point p, float step)
-
snapViewToGrid
public void snapViewToGrid(float step)
Snap to grid this point
-
internalSnapToGrid
protected void internalSnapToGrid(float step)
-
collectSubManipulatedElements
@OpenApi public final void collectSubManipulatedElements(java.util.List<PresentationElement> col)
Collects all visible and manipulated elements in this hierarchy.
-
getManipulatedPresentationElements
@OpenApi public final java.util.List<PresentationElement> 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
public static void sortObjectsByX(java.util.List<? extends PresentationElement> vector)
Sorts objectViews by x ascending.- Parameters:
vector
- - Vector which contains Object Views.
-
sortObjectsByY
public static void sortObjectsByY(java.util.List<? extends PresentationElement> vector)
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
public boolean isChildVisible(PresentationElement child)
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
@CheckForNull public java.util.List<PresentationElement> getManipulatedIntersectionWith(java.awt.Rectangle rect)
Returns vector of manipulated objects whose intersect with given rectangle
-
getManipulatedIntersectionWith
@CheckForNull public java.util.List<PresentationElement> getManipulatedIntersectionWith(java.awt.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.
-
findParentForData
@CheckForNull public Element findParentForData(PresentationElement newParent, com.nomagic.uml2.ElementAddContext addContext)
-
getExpectedDataParent
@CheckForNull public Element getExpectedDataParent(PresentationElement child)
Returns expected element parent. Some views "SimpleActivityRegionView" has no element but it should accept drag and drop of other presentation element- Returns:
- Most suitable element parent for given child element
-
getFillColor
public java.awt.Color getFillColor()
Returns fill color
-
getLineColor
public java.awt.Color getLineColor()
Returns line color
-
canFill
protected boolean canFill()
- Returns:
- true if symbol can be filled with some color
-
isUseFillColor
public final boolean isUseFillColor()
- Returns:
- use fill color flag
-
isUseFillColorByProperty
protected boolean isUseFillColorByProperty()
-
getTextColor
public java.awt.Color getTextColor()
Returns text color
-
setTextColor
public void setTextColor(java.awt.Color c)
Sets text color
-
getStereotypeColor
public java.awt.Color getStereotypeColor()
Returns text color
-
setStereotypeColor
public void setStereotypeColor(java.awt.Color c)
Sets text color
-
setFillColor
public void setFillColor(java.awt.Color c)
Sets fill color
-
prepareForFillDrawing
protected boolean prepareForFillDrawing(java.awt.Graphics2D g, int x1, int y1, int x2, int y2)
Prepares graphics for fill drawing. Sets fill color if useFill property is set. Sets gradient if useGradientForFill() method returns true.- Parameters:
g
- the given graphicsx1
- gradient first point xy1
- gradient first point yx2
- gradient second point xy2
- gradient second point y- Returns:
- true, if symbol can be filled
- See Also:
isUseGradientForFill()
,isUseFillColor()
-
dynamicStyleFillPaint
@CheckForNull public java.awt.Paint dynamicStyleFillPaint(@CheckForNull java.awt.Paint paint, java.awt.Color fillColor, int x1, int y1, int x2, int y2)
-
dynamicTextColor
public java.awt.Color dynamicTextColor()
-
dynamicLineColor
public java.awt.Color dynamicLineColor()
-
dynamicFillColor
@CheckForNull public java.awt.Color dynamicFillColor()
-
dynamicStyleFillColor
@CheckForNull public java.awt.Color dynamicStyleFillColor(@CheckForNull java.awt.Color color, boolean useFill)
-
dynamicStyleLineColor
public final java.awt.Color dynamicStyleLineColor(java.awt.Color color)
-
dynamicStyleTextColor
public final java.awt.Color dynamicStyleTextColor(java.awt.Color color)
-
dynamicStyleTransparency
public final int dynamicStyleTransparency()
-
dynamicStyleTransparency
public final int dynamicStyleTransparency(javax.swing.Icon target)
-
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, java.util.function.BiFunction<com.nomagic.magicdraw.uml.symbols.DynamicStyle,T,T> valueProvider)
-
dynamicPaintShadow
public boolean dynamicPaintShadow()
-
getDynamicStyleOwner
@CheckForNull public PresentationElement getDynamicStyleOwner()
-
prepareForShadowDrawing
protected boolean prepareForShadowDrawing(java.awt.Graphics2D g)
Prepares graphics for symbol shadow drawing. If diagram allows shadows, sets darker diagram background color to given graphics.- Parameters:
g
- the given graphics
-
prepareForLineDrawing
protected boolean prepareForLineDrawing(java.awt.Graphics2D g)
Prepares graphics for line drawing
-
setStrokeIfNotTheSame
public static void setStrokeIfNotTheSame(java.awt.Graphics2D g, java.awt.Stroke stroke)
-
prepareForTextDrawing
protected void prepareForTextDrawing(java.awt.Graphics2D g)
Prepares graphics for text drawing
-
useParentProperties
@OpenApi public boolean useParentProperties()
Does this element uses parent properties or has it own?- Returns:
- true, if element does not have properties and uses parent's.
-
getParentSymbolPropertyOwner
@CheckForNull public PresentationElement getParentSymbolPropertyOwner()
Returns parent symbol property manager to which this symbol delegates symbol property related functionality.- Returns:
- parent parent symbol to delegate or null if this symbol does not delegate.
-
getPropertyManager
@OpenApi public final PropertyManager getPropertyManager()
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:
useParentProperties()
,PresentationElementsManager.setPresentationElementProperties(com.nomagic.magicdraw.uml.symbols.PresentationElement, com.nomagic.magicdraw.properties.PropertyManager)
-
createPropertyManager
protected void createPropertyManager()
Create default property manager for symbol.
-
setPropertyManager
public final void setPropertyManager(@CheckForNull PropertyManager man)
Sets property manager
-
getRealPropertyManager
public final PropertyManager getRealPropertyManager()
- Returns:
- the propertyManager
-
getProperty
@CheckForNull @OpenApi public Property getProperty(java.lang.String id)
Returns element's property with given id.- Parameters:
id
- ID of property.- Returns:
- property with given id or null if element does not have such property.
- See Also:
useParentProperties()
-
addProperty
@OpenApi public final void addProperty(Property prop)
Add property to presentation element. This method should be called only on a new instance of presentation element while it is not added into the diagram. In order to change some property usePresentationElementsManager.setPresentationElementProperties(com.nomagic.magicdraw.uml.symbols.PresentationElement, com.nomagic.magicdraw.properties.PropertyManager)
- Parameters:
prop
- property
-
changePropertyManager
public void changePropertyManager(PropertyManager manager)
Changes current properties manager to the given one.- Parameters:
manager
- properties
-
changeProperties
public void changeProperties(PropertyManager manager)
-
applyProperties
public final void applyProperties(PropertyManager manager)
Applies properties from given property manager- Parameters:
manager
- new properties
-
makeOverviewPanelDirty
private void makeOverviewPanelDirty()
-
internalApplyProperties
protected void internalApplyProperties(PropertyManager manager)
Applies properties from given property manager- Parameters:
manager
- new properties
-
onFontChange
protected void onFontChange()
-
notifyRendererAboutSymbolPropertyChanges
private void notifyRendererAboutSymbolPropertyChanges(java.util.Collection<com.nomagic.magicdraw.uml.symbols.SymbolDecorator> renderers, PropertyManager newManager, @CheckForNull PropertyManager oldManager)
Notifies symbol renderer about symbol property changes.- Parameters:
renderers
- - symbol renderers to notify.newManager
- - property manager after property changes.oldManager
- - original property manager.
-
getAdditionalRenderersToNotify
protected java.util.List<com.nomagic.magicdraw.uml.symbols.SymbolDecorator> getAdditionalRenderersToNotify()
-
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
-
adjustBoundsForMoving
public java.awt.Rectangle adjustBoundsForMoving(java.awt.Rectangle rec, java.util.Collection<PresentationElement> movedTogether)
validate bounds for moving
-
adjustChildBoundsForMoving
public void adjustChildBoundsForMoving(java.awt.Rectangle bounds, PresentationElement element)
For adjusting child bounds when child type is not known but bounds should be corrected.
-
adjustChildBounds
public void adjustChildBounds(java.awt.Rectangle bounds, PresentationElement element)
For adjusting child bounds when child type is not known but bounds should be corrected.
-
getActualProperty
@CheckForNull public Property getActualProperty(java.lang.String s)
Returns actual property. If use parent properties, returns property from parent else returns its own property
-
isMovableByMoveManager
public boolean isMovableByMoveManager()
Method indicates if object of this instance must be registered in move manager.
-
boundsChanged
public final void boundsChanged()
-
boundsChanged
public final void boundsChanged(java.awt.Rectangle bounds)
-
notifyCreated
public final void notifyCreated()
Notify move manager about created presentation element.
-
rememberBounds
public void rememberBounds()
Remember old bounds
-
rememberBounds
public void rememberBounds(java.awt.Rectangle bounds)
-
editName
@OpenApi public final void editName(@CheckForNull java.awt.event.KeyEvent evt)
Starts online diagram editing for a symbol- Parameters:
evt
- first key event or null
-
editName
@OpenApi public void editName(@CheckForNull java.awt.event.KeyEvent evt, @CheckForNull java.util.Map<java.lang.String,java.lang.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
-
constructChangePropertyCommand
public final com.nomagic.magicdraw.commands.Command constructChangePropertyCommand(Property prop)
Constructs the command for property changing.- Parameters:
prop
- the new property.- Returns:
- created command name
-
changeProperty
public final void changeProperty(Property prop)
Changes property of the view to the given on- Parameters:
prop
- property to change
-
isLayouting
public boolean isLayouting()
-
setLayouting
public void setLayouting(boolean v)
-
getManipulatedParent
@CheckForNull @OpenApi public final PresentationElement getManipulatedParent()
- Returns:
- first parent with manipulator or null if such does not exist.
-
getManipulationPreferredDimension
public UnmodifiableDimension getManipulationPreferredDimension()
- Returns:
- size for manipulator manipulations
-
getObjectParent
@OpenApi public BaseElement 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:
getParent()
-
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(java.lang.String propertyName, @CheckForNull java.lang.Object oldValue, @CheckForNull java.lang.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:
PropertyChangeSupport
-
hasDiagramSurface
public boolean hasDiagramSurface()
-
setLineColor
public void setLineColor(java.awt.Color c)
Sets line color
-
setUseFillColor
public void setUseFillColor(boolean use)
Sets use fill color
-
findPresentationElement
@CheckForNull public static PresentationElement findPresentationElement(java.util.Collection<PresentationElement> elements, Element data)
Finds presentation element with given Element among given elements
-
canChangeElementParent
public boolean canChangeElementParent(java.util.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(java.util.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
public final boolean canChangeParent(java.util.Collection children, @CheckForNull BaseElement newParent)
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 element can change parent.
-
getAssignableModelElementsClasses
public final java.lang.Class[] 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
public void setPropertyManagerName(@CheckForNull java.lang.String propertyManagerName)
-
getPropertyManagerName
@CheckForNull public java.lang.String getPropertyManagerName()
-
getChildPresentationElementForContextMenu
public PresentationElement getChildPresentationElementForContextMenu(java.awt.Point pt)
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
public java.awt.Rectangle getBoundsWithChildrenOnEdge()
-
getElementToConnectLink
@CheckForNull public final Element getElementToConnectLink(@CheckForNull Element path, boolean asClient)
The same as internalGetElementToConnectLink(), just takes into account SymbolDecorators- Returns:
- all possible elements
- See Also:
getElementsForLinkConnecting()
,internalGetElementToConnectLink(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Element, boolean)
-
internalGetElementToConnectLink
@CheckForNull public Element internalGetElementToConnectLink(@CheckForNull Element path, boolean asClient)
Returns element that should be used for given link connecting. All possible elements are return by method getElementsForLinkConnecting. Usually this method should be overridden together with getElementsForLinkConnecting().- Returns:
- all possible elements
- See Also:
getElementsForLinkConnecting()
-
getElementToMove
public Element getElementToMove()
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:
getElement()
-
getElementsForLinkConnecting
public final java.util.Collection<? extends Element> getElementsForLinkConnecting()
The same as getElementsForLinkConnecting(), just takes into account SymbolDecorators- Returns:
- all possible elements
- See Also:
getElementsForLinkConnecting()
,getElementToConnectLink(Element, boolean)
-
internalGetElementsForLinkConnecting
public java.util.Collection<? extends Element> internalGetElementsForLinkConnecting()
Returns all possible element that can be used for some link connecting. One of these elements are return in method getElementToConnectLink() in specific situation. Usually this method should be overridden together with getElementsForLinkConnecting().- Returns:
- all possible elements
- See Also:
getElementToConnectLink(Element, boolean)
-
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
protected final SmartListenerConfig getConfiguration()
- Returns:
- a merged configuration of both static and dynamic configs
-
getStaticConfiguration
private SmartListenerConfig getStaticConfiguration()
- Returns:
- static configuration of smart listener by symbol type
-
createAdditionalSmartListenerConfig
private void createAdditionalSmartListenerConfig(java.util.List<SmartListenerConfig> configurations)
-
getConfigurations
private com.nomagic.magicdraw.uml.symbols.PresentationElement.SmartListenerConfigData getConfigurations()
- Returns:
- constructs configurations (both static and dynamic)
-
getDynamicConfigurations
protected java.util.List<SmartListenerConfig> 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.
-
disposeListener
protected void disposeListener()
-
updateAfterLoad
public void updateAfterLoad()
-
createSmartListenerConfig
protected void createSmartListenerConfig(java.util.List<SmartListenerConfig> configurations)
-
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.nomagic.magicdraw.commands.MacroCommand deleteCommand, java.util.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
@OpenApi @CheckForNull public final java.awt.Shape getBoundsShape(ConverterToShape converterToShape)
Provides a bounding shape of the symbol- Parameters:
converterToShape
- transform bounding shape according this converter- Returns:
- bounding shape of the symbol
-
internalGetBoundsShape
@CheckForNull public java.awt.Shape internalGetBoundsShape(ConverterToShape converterToShape)
-
getPresentationElementStroke
@OpenApi public final java.awt.BasicStroke 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)
-
sSetLineWidth
public void sSetLineWidth(int width)
-
getLineWidth
public int getLineWidth()
-
dynamicLineWidth
public int dynamicLineWidth()
-
dynamicLineWidth
public int dynamicLineWidth(int width)
-
getPresentationElementStroke
@OpenApi public final java.awt.BasicStroke getPresentationElementStroke(int width)
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
public final java.awt.BasicStroke dynamicStroke()
-
dynamicStroke
public java.awt.BasicStroke dynamicStroke(int width)
-
dynamicStroke
public java.awt.BasicStroke dynamicStroke(java.awt.BasicStroke stroke)
-
internalGetPresentationElementStroke
public java.awt.BasicStroke internalGetPresentationElementStroke(int width)
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
@OpenApi public static java.awt.BasicStroke getStroke(java.awt.BasicStroke stroke, int width)
Get cached stroke of given width.- Parameters:
stroke
- base stroke.width
- of the stroke.- Returns:
- stroke
-
getStroke
@OpenApi public static java.awt.BasicStroke getStroke(int lineStyle)
Get cached stroke of given style and default width.- Parameters:
lineStyle
- style of line.- Returns:
- stroke
- See Also:
SOLID_STROKE
,DASHED_STROKE
,DOTTED_STROKE
-
getStroke
@OpenApi public static java.awt.BasicStroke getStroke(int lineStyle, int width)
Get cached stroke of given style and width.- Parameters:
lineStyle
- style of linewidth
- width- Returns:
- stroke
- See Also:
SOLID_STROKE
,DASHED_STROKE
,DOTTED_STROKE
-
getStroke
@OpenApi public static java.awt.BasicStroke getStroke(int lineStyle, int width, int join)
Get cached stroke of given style, width and join.- Parameters:
lineStyle
- style of linewidth
- width- Returns:
- stroke
- See Also:
SOLID_STROKE
,DASHED_STROKE
,DOTTED_STROKE
,BasicStroke.JOIN_BEVEL
,BasicStroke.JOIN_MITER
,BasicStroke.JOIN_ROUND
-
getStroke
@OpenApi public static java.awt.BasicStroke getStroke(int lineStyle, int width, int join, int cap)
Get cached stroke of given style, width and join.- Parameters:
lineStyle
- style of linewidth
- width- Returns:
- stroke
- See Also:
SOLID_STROKE
,DASHED_STROKE
,DOTTED_STROKE
,BasicStroke.JOIN_BEVEL
,BasicStroke.JOIN_MITER
,BasicStroke.JOIN_ROUND
-
getExtraGapWidth
private static int getExtraGapWidth(int width)
-
getStroke
@OpenApi public static java.awt.BasicStroke getStroke(float width, int cap, int join, float miterLimit, @CheckForNull float[] dash, float dash_phase)
Get cached stroke.- See Also:
BasicStroke(float, int, int, float, float[], float)
-
getChildrenWithSymbolProperties
public java.util.List<PresentationElement> 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
@CheckForNull public java.awt.Point 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.
-
setTextColorProperty
protected final void setTextColorProperty(@CheckForNull java.lang.String textColorProperty)
-
setFontProperty
protected final void setFontProperty(java.lang.String fontProperty)
-
getProjectImpl
public Project getProjectImpl()
- Specified by:
getProjectImpl
in interfaceMDElement
- Overrides:
getProjectImpl
in classcom.nomagic.magicdraw.uml.MDElementImpl
-
setNeedRecreateListeners
public void setNeedRecreateListeners(boolean needRecreateListeners)
Set a need to recreated models listeners flag- Parameters:
needRecreateListeners
- a new value
-
isNotNull
public boolean isNotNull(@CheckForNull Element element)
-
getBooleanPropertyValue
protected boolean getBooleanPropertyValue(java.lang.String propertyID, boolean defaultValue)
-
getStringPropertyValue
protected java.lang.String getStringPropertyValue(java.lang.String propertyID, java.lang.String defaultValue)
-
clearAntialiasingState
public static void clearAntialiasingState()
-
isTestUpdateFlag
public static boolean isTestUpdateFlag()
-
setTestUpdateFlag
public static void setTestUpdateFlag(boolean testUpdateFlag)
-
-