Class ShapeElement
java.lang.Object
com.nomagic.magicdraw.uml.MDElementImpl
com.nomagic.magicdraw.uml.symbols.PresentationElement
com.nomagic.magicdraw.uml.symbols.paths.PathConnector
com.nomagic.magicdraw.uml.symbols.shapes.ShapeElement
- All Implemented Interfaces:
BaseElement
,MDElement
,ModelElementProvider
,com.nomagic.magicdraw.uml.symbols.manipulators.centerlines.CenterlineableShape
,com.nomagic.magicdraw.uml.symbols.SuspendShapeAutoResizeModeProvider
,NameOwner
,PropertyChangeListener
,Cloneable
,Comparable
,EventListener
- Direct Known Subclasses:
com.nomagic.magicdraw.uml.symbols.shapes.ContainerShapeView
,NNaryAssociationView
@OpenApi
public abstract class ShapeElement
extends PathConnector
implements com.nomagic.magicdraw.uml.symbols.manipulators.centerlines.CenterlineableShape, com.nomagic.magicdraw.uml.symbols.SuspendShapeAutoResizeModeProvider
Base class for all kinds of "shape" like symbols.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final int
static final int
static final int
static final byte
Flag for doing full autosize - calculation of preferred size and children layoutstatic final byte
Flag for doing only children layout during autosizestatic final byte
Flag for ignoring autosizestatic final int
static final com.nomagic.ui.UnmodifiableInsets
Insets with all locations equal to 0static final int
static final int
static final int
static final int
Space between bounds and some inner object.static final com.nomagic.ui.UnmodifiableInsets
Insets with all locations equal to SPACEstatic final com.nomagic.ui.UnmodifiableInsets
Insets with top/bottom equals to zero and right/left equals to SPACEstatic final int
Fields inherited from class com.nomagic.magicdraw.uml.symbols.paths.PathConnector
showsProxy
Fields inherited from class com.nomagic.magicdraw.uml.symbols.PresentationElement
DASHED_STROKE, DEFAULT_LINE_WIDTH, DOTTED_STROKE, HANDLE_SIZE, MAX_LINE_WIDTH, MIN_LINE_WIDTH, peStyle, SHADOW_WIDTH, SOLID_STROKE
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Method accepts a visitor, and calls method "visit<class name>(this)" of a visitor.protected void
addBreakPoints
(PathElement link) Adds break points to link to self.void
adjustBounds
(Rectangle bounds) Validates boundsadjustBoundsBeforeChange
(Rectangle rec, boolean autosizeOperation, Collection<PresentationElement> movedTogether) Validate bounds before bounds change operationvoid
Adjust shape on the edge of its parent.adjustOnEdge
(Rectangle bounds, int edge, int position, int cornerDistance) Calculates location of given rectangle according given parent edge and position on edge.void
Adjust on edge all childrenfinal void
autosize()
void
autosize
(boolean calculatePrefSize) Calculate preferred size and make this shape size at least as preferred (if size is smaller)void
Resize itself and initiate parent resizeCalculates on edge location for a shape.calculateAndGetMinimumShrinkingDimension
(int locationX, int locationY) protected void
calculateAutosizeDimension
(Dimension size, int locationX, int locationY, int prefSizeWidth, int prefSizeHeight) Calculates size of shape to be at least as preferred and fit all childrenvoid
final void
calculates minimum sizeprotected com.nomagic.magicdraw.uml.symbols.shapes.ShapeElement.OnEdgeBounds
final void
final void
calculatePreferredDimension
(int locationX, int locationY) protected boolean
boolean
final void
clone()
boolean
coversPoint
(int x, int y, com.nomagic.magicdraw.uml.symbols.IntersectionKind kind) checks if object covers provided pointcreateBoundsShape
(PathElement path, BoundsTransformation transformation) Creates bounding shape for intersection calculation.void
final void
ensureDimension
(boolean rememberBounds) If size is smaller than the preferred size, makes shape larger.void
void
findFreePlaceForShapeOnBorder
(ShapeElement shape, Rectangle shapeB) Looks for available position slot for given shape on a borderMethod returns bounds of this element.List<com.nomagic.magicdraw.uml.symbols.manipulators.centerlines.CenterlineableShape>
getCenterlineableInnerParts
(int orientation) Gets shape inner parts which have centerlines.com.nomagic.ui.UnmodifiableInsets
getChildrenInsets
(com.nomagic.magicdraw.uml.symbols.shapes.InsetsLevel insetsLevel) protected UnmodifiableDimension
getDimensionForShrinking
(int width, int height) getEdgeLine
(int edge) Returns a line representing a specified edge.Point[]
-----1------ | | | | 4 2 | | | | ----3-------protected int
getHeaderInsetReduce
(int edge, com.nomagic.magicdraw.uml.symbols.shapes.ShapeElement.OnEdgeBounds bounds) protected Insets
getIntersection
(int x1, int y1, int x2, int y2, PathElement path) Gets intersection point between shape view bounding rectangle and line.static Point
getIntersection
(int x1, int y1, int x2, int y2, Rectangle bounds, ContainerShape boundingShape) Gets intersection point between bounding shape (or rectangle) and line.getIntersection
(int x, int y, PathElement path) getManipulatedElementAt
(Point pt, com.nomagic.magicdraw.uml.symbols.IntersectionKind intersectionKind) Gets manipulated symbol at specified point pt.final Point
Returns middle point of this element.final Point
getMiddlePoint
(Point rel) Gets middle point of this view,int
int
getMiddlePointX
(Point rel) int
int
getMiddlePointY
(Point rel) final UnmodifiableDimension
get minimum possible size for objectint
getNearestEdge
(int x, int y) Return the nearest edge to given point.int
Return the nearest edge to given rectangle.byte
get not copy bounds of object throws NoRectangleDefinedExceptionint
Returns some edge constant if this shape must be on its parent edge.int
int
Returns position on edge.final UnmodifiableDimension
Returns preferable dimension of the element.Returns preferable dimension of the element for autosize.This implementation simple returns preferred size.com.nomagic.magicdraw.uml.symbols.ReshapeMode
boolean
Returns true, if view has manipulator (is selectable)void
Initialize symbol and its children state.void
internalApplyProperties
(com.dassault_systemes.modeler.magic.diagram.styledelegates.PresentationElementStyleChanger changer) Applies properties from given property managerinternalGetBoundsShape
(ConverterToShape converterToShape) void
Silently applies all properties after initializationboolean
intersects
(int x, int y, int width, int height, com.nomagic.magicdraw.uml.symbols.IntersectionKind kind) checks whether object intersects with given rectangleboolean
Returns autosize flag.boolean
Indicates if the centerline provided by this shape is provided by its inner parts, not the shape itself.boolean
Check if given child is "layoutable" - it means this shape controls the bounds of child inside layoutChildren() method.boolean
Indicates whether this shape provides horizontal center-lines to other shapes.boolean
isOnEdge()
Returns true if symbol is on edgestatic boolean
isShapeOnEdge
(PresentationElement symbol) boolean
static boolean
protected boolean
boolean
boolean
Indicates whether this shape provides vertical center-lines to other shapes.void
Layout children of this shape.void
layoutChildren
(boolean calculatePrefSize) Layout children of this shape.protected void
maximumDimension
(Dimension size) protected void
calculates minimum sizevoid
minimumDimensionForShrinking
(Dimension size, int locationX, int locationY) protected void
protected void
Move links to self.protected void
movePathElement
(PathElement path, PathConnector requestor) Calculates position of a path element.void
protected boolean
Check if shape should be resized to a maximum size.protected boolean
Check if shape can be resized to a preferred size.protected void
onChildEdgeChange
(ShapeElement child) protected void
prefDimensionByManipulatedChildren
(Dimension pref, int locationX, int locationY) protected void
preferredDimension
(Dimension pref, int locationX, int locationY) protected boolean
Prepares graphics for symbol shadow drawing.boolean
Indicates if this shape can provide a horizontal centerline for other shapes to snap.boolean
Indicates if this shape can provide a vertical centerline for other shapes to snap.void
Resize recursively all symbols.void
Resets the CALCULATE_PREFERRED_REGARDING_CHILDREN value to the default.void
setAutosize
(boolean val) Sets autosize flag.void
setBorderElementMargin
(String value) void
sets bounds of this object viewvoid
setCalculatePreferredRegardingChildren
(boolean flag) Sets the CALCULATE_PREFERRED_REGARDING_CHILDREN value.void
setLoadedDimension
(UnmodifiableDimension loadedDimension) final void
setMinimumDimension
(int width, int height) Sets min sizevoid
setNeedAutosizeFlag
(byte needAutosize) final void
setOldRect
(Rectangle old) void
setOnEdge
(int onEdge) Sets on edge property.final void
setPreferredDimension
(int width, int height) void
setReshapeMode
(com.nomagic.magicdraw.uml.symbols.ReshapeMode mode) Set symbol reshape modestatic void
setSnapShapesOnBorderToGrid
(boolean snapShapesOnBorderToGrid) void
void
setUseFixedConnectionPoints
(boolean useFixed) protected boolean
final void
simpleSetBounds
(int x, int y, int width, int height, boolean calculatePrefSize) final void
simpleSetBounds
(Rectangle rect) Sets bounding rectangle.void
simpleSetBounds
(Rectangle rect, boolean calculatePrefSize) Sets the bounding rectangle of this shape view to the specified value forbounds
.boolean
Indicates if this shape can be snapped to centerlines.void
sSetAutosize
(boolean val) Simple setter for autosize flag.void
sSetBorderElementMargin
(String value) void
sSetBounds
(Rectangle bounds) Sets bounds of this object view only.void
void
sSetVisibility
(com.nomagic.magicdraw.uml.symbols.PresentationElementVisibility visibility) Sets element visibility flag.toString()
Returns string representation of this element.void
Registers this symbol to postponed "update" at the end of current command execution.Methods inherited from class com.nomagic.magicdraw.uml.symbols.paths.PathConnector
addConnectedPathElement, checkShowsProxy, clearShowsProxy, createSmartListenerConfig, dispose, disposeConnectedPaths, findSymbolForEnd, findSymbolForEnd, getConnectedPathElement, getConnectedPathElementCount, getConnectedPathElements, getConnectedPathElements, getConnectedPathElements, getPreferredArrowLength, isShowsProxy, movePathElement, removeConnectedPathElement, sAddConnectedPathElement, selectPathsForMoving, setParent, setVisibility, sRemoveConnectedPathElement, sSetConnectedPathElements, supportsVisibleConnectedPathElementsIfSelfInvisible
Methods inherited from class com.nomagic.magicdraw.uml.symbols.PresentationElement
addPresentationElement, addPresentationElement, addPresentationElementWithoutResize, addProperty, adjustChildBounds, adjustChildBoundsForMoving, alwaysShowTooltip, applyProperties, askDeleteDataConfirmation, atInsert, atInsertChildren, autosizeAndResizeManipulatedParent, beforeDelete, boundsChanged, boundsChanged, canAddChild, canAddChild, canAddInstance, canAddInstance, canBeDisposedOnUpdate, canChangeElementOwner, canChangeParent, canChangeParent, canFill, changeProperties, checkElementOwnerOnChange, checkProxyVisibility, childrenForMoving, collectSubManipulatedElements, collectSubPresentationElements, collectSubPresentationElements, collectSubShowingPresentationElements, coversPoint, createFillStrategy, createPresentationElementStyle, createPropertyChangeListener, disposeChildren, disposePropertyChangeListener, draw, drawBackground, drawSymbol, drawSymbolBackground, dynamicFillColor, dynamicLineColor, dynamicLineWidth, dynamicLineWidth, dynamicPaintShadow, dynamicStroke, dynamicStroke, dynamicStroke, dynamicStyleFillColor, dynamicStyleLineColor, dynamicStyleTextColor, dynamicStyleTransparency, dynamicStyleTransparency, dynamicStyleValue, dynamicTextAlignment, dynamicTextColor, editName, editName, findOwnerForChildElement, findOwnerForElement, findPresentationElement, firePropertyChange, generateID, getAbstractDiagramPresentationElement, getActualElement, getAdditionalRenderersToNotifyOnPropertiesChange, getAssignableModelElementsClasses, getBoundsShape, getBoundsToRepaint, getBoundsWithChildrenOnEdge, getCenterlinePoint, getCenterlinePointX, getCenterlinePointY, getChildPresentationElementForContextMenu, getChildrenWithSymbolProperties, getConfiguration, getDiagramPresentationElement, getDiagramSurface, getDrawComparator, getDynamicConfigurations, getDynamicStyleOwner, getEffectiveStyleDelegate, getEffectiveStyleOwner, getElement, getElementsForRelationshipConnecting, getElementToConnectRelationship, getFillColor, getFont, getFontHeight, getFontRenderContext, getHumanName, getHumanType, getLineColor, getLineWidth, getManipulatedElementAt, getManipulatedElementAt, getManipulatedIntersectionWith, getManipulatedIntersectionWith, getManipulatedIntersectionWith, getManipulatedIntersectionWith, getManipulatedParent, getManipulatedPresentationElements, getManipulationBounds, getModelElement, getModelElementsForRelationshipConnecting, getModelElementToConnectRelationship, getModelElementToMove, getNotZoomedTolerance, getObjectParent, getOwnStyleDelegate, getParent, getParentSymbolStyleOwner, getPreferredBounds, getPreferredSize, getPresentationElementAt, getPresentationElementAt, getPresentationElementAt, getPresentationElementAt, getPresentationElementAt, getPresentationElementCount, getPresentationElementIndex, getPresentationElements, getPresentationElementsAt, getPresentationElementsAt, getPresentationElementsAt, getPresentationElementsAt, getPresentationElementStroke, getPresentationElementStroke, getProjectImpl, getProperty, getPropertyManager, getPropertyManagerName, getRenderer, getSelected, getStroke, getStroke, getStroke, getStroke, getStroke, getStroke, getStyle, getSymbolRenderer, getTextColor, getTolerance, getVisibility, getVisiblePresentationElements, handleModelDelete, hasManipulatedPresentationElements, hasSharedModelElement, initializeAndAutosize, internalBeforeUpdate, internalCreatePropertyChangeListener, internalGetModelElementsForRelationshipConnecting, internalGetModelElementsForRelationshipConnecting, internalGetModelElementToConnectRelationship, internalGetPresentationElementStroke, internalGetSpecificFont, internalGetSpecificTextColor, internalIsSuitableToConnectRelationship, internalIsSuitableToConnectRelationship, internalSnapToGrid, internalSnapToGrid, internalUpdatePresentationElement, intersects, invalidate, isCanChildrenChangeEdge, isChildVisible, isContentHidden, isCreateElementListener, isDetectable, isDisposed, isLayouting, isMovableByMoveManager, isNotNull, isParentOf, isParentOf, isPreserveProportionsWhenGrowing, isSelected, isShowElementTypeAsLabel, isSortable, isSuitableToConnectRelationship, isTextEditable, isUseFillColor, isUseFillColorByProperty, isUseGradientForFill, isVisible, isVisibleInDiagram, isVisibleOrShrunken, movePathElementsRecursively, mustShowContextMenu, notifyCreated, notifyDiagramFrameSizeChange, notifyRepaintManager, onChildAdd, onChildRemove, onDiagramSurfaceSet, onFind, onFind, onFontChange, onParentChange, paintAdornments, paintAdornmentsBackground, paintChildren, paintChildrenAndAdornments, paintChildrenBackground, paintSelf, paintSelfBackground, preDisposeOnUpdate, prepareForLineDrawing, prepareForTextDrawing, propertyChange, recreateListeners, registerInSortManager, rememberBounds, rememberBounds, removeFromSortManager, removeItSelfOnUpdate, removePresentationElement, resizeParent, sAddPresentationElement, sAddPresentationElement, selectChildrenForMoving, selectObjectsForMoving, setAllSelected, setBounds, setCreateElementListener, setDummyResizeMode, setElement, setFillColor, setFont, setLayouting, setLineColor, setLineWidth, setLoadedVisibility, setLocation, setLocation, setModelElement, setNeedRecreateListeners, setPresentationElements, setPropertyManagerName, setSelected, setSelected, setSize, setSize, setSize, setTextColor, setTextEditable, setUseFillColor, setVisible, silentApply, silentApply, simpleSetBounds, snapToGrid, snapToGrid, snapViewToGrid, sortObjectsByX, sortObjectsByY, sRemovePresentationElement, sSetBounds, sSetElement, sSetLocation, sSetLocation, sSetModelElement, sSetParent, sSetParentForAll, sSetPresentationElements, sSetSize, sSetSize, sSetSize, sSetVisible, tryToDeleteModelElementUponRemoval, update, updateAfterLoad, updateLabelsIgnoringSuspendableLater, updateModelByView, updateModelByViewInternal, updateViewAfterPropertyChange, useParentProperties, useParentStyle
Methods inherited from class com.nomagic.magicdraw.uml.MDElementImpl
accept, addPropertyChangeListener, canAdd, canAddChild, canBeDeleted, canDeleteChild, compareTo, createSortKeys, getClassType, getID, getName, getProjectProvider, getResourceID, getSortKeys, hasListeners, isEditable, removeAllParents, removeAllPropertyChangeListeners, removePropertyChangeListener, setID, setProjectProvider, setResourceIDProvider, sGetID
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.nomagic.magicdraw.uml.BaseElement
canAdd, isSelfChangeable
Methods inherited from interface com.nomagic.magicdraw.uml.symbols.manipulators.centerlines.CenterlineableShape
asPresentationElement, getAbstractDiagramPresentationElement, getCenterlinePoint, getCenterlinePointX, getCenterlinePointY
Methods inherited from interface com.nomagic.magicdraw.uml.MDElement
getProject
-
Field Details
-
SPACE
public static final int SPACESpace between bounds and some inner object.- See Also:
-
SPACE_INSETS
public static final com.nomagic.ui.UnmodifiableInsets SPACE_INSETSInsets with all locations equal to SPACE- See Also:
-
SPACE_INSETS_EMPTY_TOP_BOTTOM
public static final com.nomagic.ui.UnmodifiableInsets SPACE_INSETS_EMPTY_TOP_BOTTOMInsets with top/bottom equals to zero and right/left equals to SPACE- See Also:
-
NULL_INSETS
public static final com.nomagic.ui.UnmodifiableInsets NULL_INSETSInsets with all locations equal to 0 -
NEED_AUTOSIZE_FULL
public static final byte NEED_AUTOSIZE_FULLFlag for doing full autosize - calculation of preferred size and children layout- See Also:
-
NEED_AUTOSIZE_LAYOUT
public static final byte NEED_AUTOSIZE_LAYOUTFlag for doing only children layout during autosize- See Also:
-
NEED_AUTOSIZE_NONE
public static final byte NEED_AUTOSIZE_NONEFlag for ignoring autosize- See Also:
-
BORDER_ELEMENT_MARGIN_ALL
- See Also:
-
BORDER_ELEMENT_MARGIN_LEFT
- See Also:
-
BORDER_ELEMENT_MARGIN_RIGHT
- See Also:
-
BORDER_ELEMENT_MARGIN_TOP
- See Also:
-
BORDER_ELEMENT_MARGIN_BOTTOM
- See Also:
-
BORDER_ELEMENT_MARGIN_LEFT_RIGHT
- See Also:
-
BORDER_ELEMENT_MARGIN_TOP_BOTTOM
- See Also:
-
BORDER_ELEMENT_MARGIN_NONE
- See Also:
-
BORDER_ELEMENT_MARGIN_MODES
-
NO_EDGE
public static final int NO_EDGE- See Also:
-
TOP_EDGE
public static final int TOP_EDGE- See Also:
-
RIGHT_EDGE
public static final int RIGHT_EDGE- See Also:
-
BOTTOM_EDGE
public static final int BOTTOM_EDGE- See Also:
-
LEFT_EDGE
public static final int LEFT_EDGE- See Also:
-
ON_EDGE_POSITION
public static final int ON_EDGE_POSITION- See Also:
-
OUTSIDE_EDGE_POSITION
public static final int OUTSIDE_EDGE_POSITION- See Also:
-
INSIDE_EDGE_POSITION
public static final int INSIDE_EDGE_POSITION- See Also:
-
-
Constructor Details
-
ShapeElement
public ShapeElement() -
ShapeElement
-
-
Method Details
-
setAutosize
public void setAutosize(boolean val) Sets autosize flag.- Parameters:
val
- new value of a flag
-
isAutosized
public boolean isAutosized()Returns autosize flag.- Returns:
- value of autosize flag.
-
sSetAutosize
public void sSetAutosize(boolean val) Simple setter for autosize flag.- Parameters:
val
- value
-
getSuspendShapeAutoResizeMode
- Specified by:
getSuspendShapeAutoResizeMode
in interfacecom.nomagic.magicdraw.uml.symbols.SuspendShapeAutoResizeModeProvider
-
sSetSuspendShapeAutoResizeMode
-
setSuspendShapeAutoResizeMode
-
getBounds
Description copied from class:PresentationElement
Method returns bounds of this element. Use PresentationElementsManager to change a bounds of the element.- Overrides:
getBounds
in classPresentationElement
- Returns:
- bounds of the element.
- See Also:
-
PresentationElementsManager.reshapeShapeElement
-
getNotCopyBounds
Description copied from class:PresentationElement
get not copy bounds of object throws NoRectangleDefinedException- Overrides:
getNotCopyBounds
in classPresentationElement
- Returns:
- rectangle of bounds
-
getMiddlePoint
Description copied from class:PresentationElement
Gets middle point of this view,- Overrides:
getMiddlePoint
in classPresentationElement
- Parameters:
rel
- relative point- Returns:
- middle point
-
getMiddlePointX
- Overrides:
getMiddlePointX
in classPresentationElement
-
getMiddlePointY
- Overrides:
getMiddlePointY
in classPresentationElement
-
getMiddlePoint
Description copied from class:PresentationElement
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.- Overrides:
getMiddlePoint
in classPresentationElement
- Returns:
- point that is considered as middle for this element.
-
getMiddlePointX
public int getMiddlePointX()- Overrides:
getMiddlePointX
in classPresentationElement
-
getMiddlePointY
public int getMiddlePointY()- Overrides:
getMiddlePointY
in classPresentationElement
-
sSetBounds
Description copied from class:PresentationElement
Sets bounds of this object view only.- Specified by:
sSetBounds
in classPresentationElement
- Parameters:
bounds
- rectangle of bounds.
-
adjustBounds
Validates bounds- Parameters:
bounds
- bounds
-
setBounds
Description copied from class:PresentationElement
sets bounds of this object view- Specified by:
setBounds
in classPresentationElement
- Parameters:
bounds
- rectangle of bounds
-
coversPoint
public boolean coversPoint(int x, int y, com.nomagic.magicdraw.uml.symbols.IntersectionKind kind) Description copied from class:PresentationElement
checks if object covers provided point- Specified by:
coversPoint
in classPresentationElement
- Returns:
- true if object covers this point
-
intersects
public boolean intersects(int x, int y, int width, int height, com.nomagic.magicdraw.uml.symbols.IntersectionKind kind) Description copied from class:PresentationElement
checks whether object intersects with given rectangle- Specified by:
intersects
in classPresentationElement
- Returns:
- true if object and rectangle intersects
-
clone
- Specified by:
clone
in interfaceBaseElement
- Overrides:
clone
in classPathConnector
-
movePathElements
public void movePathElements()- Overrides:
movePathElements
in classPathConnector
-
clearOldRect
public final void clearOldRect() -
setOldRect
-
movePathElement
Description copied from class:PathConnector
Calculates position of a path element.- Specified by:
movePathElement
in classPathConnector
- Parameters:
path
- element which position will be calculated.requestor
- the requestor of this path moving. Implementations may check to avoid endless loops.
-
getIntersection
- Overrides:
getIntersection
in classPresentationElement
-
getIntersection
Gets intersection point between shape view bounding rectangle and line.- Parameters:
x1
- first point of the liney1
- first point of the linex2
- second point of the liney2
- second point of the linepath
- path- Returns:
- intersection point
-
getIntersection
public static Point getIntersection(int x1, int y1, int x2, int y2, Rectangle bounds, ContainerShape boundingShape) Gets intersection point between bounding shape (or rectangle) and line.- Parameters:
x1
- first point of the liney1
- first point of the linex2
- second point of the liney2
- second point of the linebounds
- shape boundsboundingShape
- bounding shape- Returns:
- intersection point
-
accept
Description copied from interface:MDElement
Method accepts a visitor, and calls method "visit<class name>(this)" of a visitor. See "Visitor" pattern for more details.- Specified by:
accept
in interfaceMDElement
- Overrides:
accept
in classPathConnector
- Parameters:
visitor
- which visits this element.- Throws:
Exception
-
setPreferredDimension
public final void setPreferredDimension(int width, int height) -
getPreferredDimension
Description copied from class:PresentationElement
Returns preferable dimension of the element.- Overrides:
getPreferredDimension
in classPresentationElement
- Returns:
- preferred dimension
-
simpleSetBounds
Description copied from class:PresentationElement
Sets bounding rectangle.- Overrides:
simpleSetBounds
in classPresentationElement
- Parameters:
rect
- new bounding rectangle.
-
simpleSetBounds
public final void simpleSetBounds(int x, int y, int width, int height, boolean calculatePrefSize) -
simpleSetBounds
Sets the bounding rectangle of this shape view to the specified value forbounds
. Moves all links connected to this shape connection points.- Parameters:
rect
- the new bounds for the shape view.calculatePrefSize
- need to calculate preferred size
-
calculateEdge
public void calculateEdge() -
edgeChanged
public void edgeChanged() -
autosize
public final void autosize() -
autosize
public void autosize(boolean calculatePrefSize) Calculate preferred size and make this shape size at least as preferred (if size is smaller)- Parameters:
calculatePrefSize
- calculate preferred size
-
autosizeAndResizeParent
public void autosizeAndResizeParent()Description copied from class:PresentationElement
Resize itself and initiate parent resize- Overrides:
autosizeAndResizeParent
in classPresentationElement
-
moveLinksToSelf
protected void moveLinksToSelf()Move links to self. -
addBreakPoints
Adds break points to link to self.- Parameters:
link
- path
-
calculateAutosizeDimension
protected void calculateAutosizeDimension(Dimension size, int locationX, int locationY, int prefSizeWidth, int prefSizeHeight) Calculates size of shape to be at least as preferred and fit all children- Parameters:
size
- sizelocationX
- x locationlocationY
- y locationprefSizeWidth
- preferred size widthprefSizeHeight
- preferred size height
-
maximumDimension
-
ensureDimension
public final void ensureDimension(boolean rememberBounds) If size is smaller than the preferred size, makes shape larger.- Parameters:
rememberBounds
- flag
-
needAdjustToPreferred
protected boolean needAdjustToPreferred()Check if shape can be resized to a preferred size. Usually it is true if shape is manipulated and isAutosize is true.- Returns:
- true if adjustments are necessary
-
needAdjustToMaximumDimension
protected boolean needAdjustToMaximumDimension()Check if shape should be resized to a maximum size.- Returns:
- true if adjustments are necessary
-
getDefaultDimension
-
getSizeForDrawing
-
recursiveAutosize
public void recursiveAutosize()Description copied from class:PresentationElement
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- Overrides:
recursiveAutosize
in classPresentationElement
-
initialize
public void initialize()Description copied from class:PresentationElement
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.- Overrides:
initialize
in classPresentationElement
-
calculateMinimumDimension
public final void calculateMinimumDimension()calculates minimum size -
minimumDimension
calculates minimum size- Parameters:
min
- minimum size
-
setMinimumDimension
public final void setMinimumDimension(int width, int height) Sets min size- Parameters:
width
- widthheight
- height
-
getMinimumDimension
Description copied from class:PresentationElement
get minimum possible size for object- Overrides:
getMinimumDimension
in classPresentationElement
- Returns:
- minimum dimension
-
getManipulatedElementAt
public PresentationElement getManipulatedElementAt(Point pt, com.nomagic.magicdraw.uml.symbols.IntersectionKind intersectionKind) Description copied from class:PresentationElement
Gets manipulated symbol at specified point pt.- Overrides:
getManipulatedElementAt
in classPresentationElement
- Parameters:
pt
-Point
intersectionKind
- intersection kind to check for- Returns:
- manipulate symbol
-
calculatePreferredDimension
public final void calculatePreferredDimension() -
calculatePreferredDimension
public final void calculatePreferredDimension(int locationX, int locationY) -
preferredDimension
-
prefDimensionByManipulatedChildren
-
canHavePaths
public boolean canHavePaths()- Overrides:
canHavePaths
in classPresentationElement
- Returns:
- true if symbol can have connected paths. Return false here.
-
createBoundsShape
public ContainerShape createBoundsShape(@CheckForNull PathElement path, BoundsTransformation transformation) Creates bounding shape for intersection calculation.- Parameters:
path
- pathtransformation
- transformation- Returns:
- shape
-
internalGetBoundsShape
- Overrides:
internalGetBoundsShape
in classPresentationElement
-
internalApplyProperties
public void internalApplyProperties(com.dassault_systemes.modeler.magic.diagram.styledelegates.PresentationElementStyleChanger changer) Description copied from class:PresentationElement
Applies properties from given property manager- Overrides:
internalApplyProperties
in classPresentationElement
- Parameters:
changer
- new properties
-
canBeAutosized
protected boolean canBeAutosized() -
isSnapToGrid
protected boolean isSnapToGrid()- Overrides:
isSnapToGrid
in classPresentationElement
-
toString
Description copied from class:com.nomagic.magicdraw.uml.MDElementImpl
Returns string representation of this element. Useful for debugging purposes.- Overrides:
toString
in classcom.nomagic.magicdraw.uml.MDElementImpl
-
getFixedConnectionPoints
-----1------ | | | | 4 2 | | | | ----3-------- Returns:
- array of 4 points used to connect paths to fixed points.
-
isUseFixedConnectionPoints
public boolean isUseFixedConnectionPoints() -
setUseFixedConnectionPoints
public void setUseFixedConnectionPoints(boolean useFixed) -
internalSilentApply
public void internalSilentApply()Description copied from class:PresentationElement
Silently applies all properties after initialization- Overrides:
internalSilentApply
in classPresentationElement
-
getChildrenInsets
@CheckForNull public com.nomagic.ui.UnmodifiableInsets getChildrenInsets(com.nomagic.magicdraw.uml.symbols.shapes.InsetsLevel insetsLevel) - Parameters:
insetsLevel
- describes the level of insets- Returns:
- shape insets for children
-
setOnEdge
public void setOnEdge(int onEdge) Sets on edge property.- Parameters:
onEdge
- the edge constant- See Also:
-
onChildEdgeChange
-
getOnEdge
public int getOnEdge()Returns some edge constant if this shape must be on its parent edge.- Returns:
- edge constant
- See Also:
-
getOnEdgePosition
public int getOnEdgePosition()Returns position on edge.- Returns:
- position on edge.
- See Also:
-
getOnEdgeCornerDistance
public int getOnEdgeCornerDistance()- Returns:
- inset from a corner
-
adjustOnEdge
public void adjustOnEdge()Adjust shape on the edge of its parent. -
calculateAdjustOnEdgeLocation
Calculates on edge location for a shape.- Parameters:
bounds
- bounds- Returns:
- location on edge or null if shape is not on edge
-
isOnEdge
public boolean isOnEdge()Returns true if symbol is on edge- Returns:
- true if on edge
-
isShapeOnEdge
-
adjustOnEdgeChildren
public void adjustOnEdgeChildren()Adjust on edge all children -
adjustOnEdge
Calculates location of given rectangle according given parent edge and position on edge.- Parameters:
bounds
- the given rectangleedge
- the parent boundsposition
- the position on edgecornerDistance
- distance from a corner- Returns:
- adjusted point
-
adjustBoundsBeforeChange
public Rectangle adjustBoundsBeforeChange(Rectangle rec, boolean autosizeOperation, Collection<PresentationElement> movedTogether) Description copied from class:PresentationElement
Validate bounds before bounds change operation- Overrides:
adjustBoundsBeforeChange
in classPresentationElement
-
getNearestEdge
Return the nearest edge to given rectangle.- Parameters:
r
- the given rectangle.- Returns:
- nearest edge
- See Also:
-
getNearestEdge
public int getNearestEdge(int x, int y) Return the nearest edge to given point.- Parameters:
x
- the given point xy
- the given point y- Returns:
- nearest edge
- See Also:
-
setLoadedDimension
-
getLoadedDimension
-
updateLater
public void updateLater()Description copied from class:PresentationElement
Registers this symbol to postponed "update" at the end of current command execution. Symbol will be updated when all other commands are executed. If this is not possible to register, updates symbol immediately.- Overrides:
updateLater
in classPresentationElement
-
getInsetsForOnEdgeShapes
-
calculateOnEdgeBounds
protected com.nomagic.magicdraw.uml.symbols.shapes.ShapeElement.OnEdgeBounds calculateOnEdgeBounds() -
getHeaderInsetReduce
protected int getHeaderInsetReduce(int edge, com.nomagic.magicdraw.uml.symbols.shapes.ShapeElement.OnEdgeBounds bounds) -
isVerticalCenterlineProvider
public boolean isVerticalCenterlineProvider()Indicates whether this shape provides vertical center-lines to other shapes.- Returns:
- true if this shape provides vertical center lines, false otherwise.
-
isHorizontalCenterlineProvider
public boolean isHorizontalCenterlineProvider()Indicates whether this shape provides horizontal center-lines to other shapes.- Returns:
- true if this shape provides horizontal center-lines, false otherwise.
-
prepareForShadowDrawing
Description copied from class:PresentationElement
Prepares graphics for symbol shadow drawing. If diagram allows shadows, sets darker diagram background color to given graphics.- Overrides:
prepareForShadowDrawing
in classPresentationElement
- Parameters:
g
- the given graphics
-
shouldDrawShadow
protected boolean shouldDrawShadow() -
getEdgeLine
Returns a line representing a specified edge.- Parameters:
edge
- - edge of the shape element.- Returns:
- a line that represents an edge.
-
getCenterlineableInnerParts
public List<com.nomagic.magicdraw.uml.symbols.manipulators.centerlines.CenterlineableShape> getCenterlineableInnerParts(int orientation) Description copied from interface:com.nomagic.magicdraw.uml.symbols.manipulators.centerlines.CenterlineableShape
Gets shape inner parts which have centerlines.- Specified by:
getCenterlineableInnerParts
in interfacecom.nomagic.magicdraw.uml.symbols.manipulators.centerlines.CenterlineableShape
- Parameters:
orientation
- orientation of inner parts centerlines.- Returns:
- a list of inner parts which can have centerlines.
-
findFreePlaceForShapeOnBorder
Looks for available position slot for given shape on a border- Parameters:
shape
- shape added on some bordershapeB
- bounds of shape. This method can be used while drawing a new shape, so we cannot take bounds from shape- Returns:
- new location for shape
-
providesVerticalCenterline
public boolean providesVerticalCenterline()Description copied from interface:com.nomagic.magicdraw.uml.symbols.manipulators.centerlines.CenterlineableShape
Indicates if this shape can provide a vertical centerline for other shapes to snap.- Specified by:
providesVerticalCenterline
in interfacecom.nomagic.magicdraw.uml.symbols.manipulators.centerlines.CenterlineableShape
- Returns:
- true if this shape provides vertical centerline, false otherwise.
-
providesHorizontalCenterline
public boolean providesHorizontalCenterline()Description copied from interface:com.nomagic.magicdraw.uml.symbols.manipulators.centerlines.CenterlineableShape
Indicates if this shape can provide a horizontal centerline for other shapes to snap.- Specified by:
providesHorizontalCenterline
in interfacecom.nomagic.magicdraw.uml.symbols.manipulators.centerlines.CenterlineableShape
- Returns:
- true if this shape provides horizontal centerline, false otherwise.
-
snapsToCenterlines
public boolean snapsToCenterlines()Description copied from interface:com.nomagic.magicdraw.uml.symbols.manipulators.centerlines.CenterlineableShape
Indicates if this shape can be snapped to centerlines.- Specified by:
snapsToCenterlines
in interfacecom.nomagic.magicdraw.uml.symbols.manipulators.centerlines.CenterlineableShape
- Returns:
- true if this shape can be snapped to centerlines, false otherwise.
-
isCenterlineInner
public boolean isCenterlineInner()Description copied from interface:com.nomagic.magicdraw.uml.symbols.manipulators.centerlines.CenterlineableShape
Indicates if the centerline provided by this shape is provided by its inner parts, not the shape itself.- Specified by:
isCenterlineInner
in interfacecom.nomagic.magicdraw.uml.symbols.manipulators.centerlines.CenterlineableShape
- Returns:
- true if centerline is inner, false otherwise.
-
getNeedAutosizeFlag
public byte getNeedAutosizeFlag() -
setNeedAutosizeFlag
public void setNeedAutosizeFlag(byte needAutosize) -
sSetVisibility
public void sSetVisibility(com.nomagic.magicdraw.uml.symbols.PresentationElementVisibility visibility) Description copied from class:PresentationElement
Sets element visibility flag.- Overrides:
sSetVisibility
in classPathConnector
- Parameters:
visibility
- flag value
-
layoutChildren
public void layoutChildren()Layout children of this shape. This method is declared final to control a layout flag. Subclasses must override internalLayoutChildren. -
layoutChildren
public void layoutChildren(boolean calculatePrefSize) Layout children of this shape. This method is declared final to a control layout flag. Subclasses must override internalLayoutChildren- Parameters:
calculatePrefSize
- calculate preferred size
-
isChildLayoutable
Check if given child is "layoutable" - it means this shape controls the bounds of child inside layoutChildren() method. Not "layoutable" children are just moved together with parents, but layoutChildren() do not control their location.- Parameters:
child
- child- Returns:
- true, if given child is layed-out inside autosize method of this shape. False here
-
setCalculatePreferredRegardingChildren
public void setCalculatePreferredRegardingChildren(boolean flag) Sets the CALCULATE_PREFERRED_REGARDING_CHILDREN value. By default, this value is true. If it was changed, it must be reverted, so put the resetting to default in finally block. For resetting to default value use:resetCalculatePreferredRegardingChildren()
- Parameters:
flag
- the value to set
-
resetCalculatePreferredRegardingChildren
public void resetCalculatePreferredRegardingChildren()Resets the CALCULATE_PREFERRED_REGARDING_CHILDREN value to the default. -
getBorderElementMargin
-
sSetBorderElementMargin
-
setBorderElementMargin
-
hasManipulator
public boolean hasManipulator()Description copied from class:PresentationElement
Returns true, if view has manipulator (is selectable)- Overrides:
hasManipulator
in classPresentationElement
-
getReshapeMode
public com.nomagic.magicdraw.uml.symbols.ReshapeMode getReshapeMode()- Returns:
- current symbol reshape mode
-
setReshapeMode
public void setReshapeMode(com.nomagic.magicdraw.uml.symbols.ReshapeMode mode) Set symbol reshape mode- Parameters:
mode
- reshape mode
-
getManipulationPreferredDimension
- Overrides:
getManipulationPreferredDimension
in classPresentationElement
- Returns:
- size for manipulator manipulations
-
minimumOrMinimumShrinkableDimension
-
minimumDimensionForShrinking
- Parameters:
size
- sizelocationX
- location XlocationY
- location Y
-
getDimensionForShrinking
-
isShrinkable
public boolean isShrinkable() -
ensurePreferredDimensionIfShrinkable
public void ensurePreferredDimensionIfShrinkable() -
ensurePreferredDimensionIfShrinkable
-
calculateAndGetPreferredDimension
-
calculateAndGetMinimumShrinkingDimension
-
getPreferredDimensionForAutosize
Description copied from class:PresentationElement
Returns preferable dimension of the element for autosize.This implementation simple returns preferred size.- Overrides:
getPreferredDimensionForAutosize
in classPresentationElement
- Returns:
- preferred dimension
-
isSnapShapesOnBorderToGrid
public static boolean isSnapShapesOnBorderToGrid() -
setSnapShapesOnBorderToGrid
public static void setSnapShapesOnBorderToGrid(boolean snapShapesOnBorderToGrid)
-