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 Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final intstatic final intstatic final intstatic final byteFlag for doing full autosize - calculation of preferred size and children layoutstatic final byteFlag for doing only children layout during autosizestatic final byteFlag for ignoring autosizestatic final intstatic final com.nomagic.ui.UnmodifiableInsetsInsets with all locations equal to 0static final intstatic final intstatic final intstatic final intSpace between bounds and some inner object.static final com.nomagic.ui.UnmodifiableInsetsInsets with all locations equal to SPACEstatic final com.nomagic.ui.UnmodifiableInsetsInsets with top/bottom equals to zero and right/left equals to SPACEstatic final intFields inherited from class com.nomagic.magicdraw.uml.symbols.paths.PathConnector
showsProxyFields 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 TypeMethodDescriptionvoidMethod accepts a visitor, and calls method "visit<class name>(this)" of a visitor.protected voidaddBreakPoints(PathElement link) Adds break points to link to self.voidadjustBounds(Rectangle bounds) Validates boundsadjustBoundsBeforeChange(Rectangle rec, boolean autosizeOperation, Collection<PresentationElement> movedTogether) Validate bounds before bounds change operationvoidAdjust 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.voidAdjust on edge all childrenfinal voidautosize()voidautosize(boolean calculatePrefSize) Calculate preferred size and make this shape size at least as preferred (if size is smaller)voidResize itself and initiate parent resizeCalculates on edge location for a shape.calculateAndGetMinimumShrinkingDimension(int locationX, int locationY) protected voidcalculateAutosizeDimension(Dimension size, int locationX, int locationY, int prefSizeWidth, int prefSizeHeight) Calculates size of shape to be at least as preferred and fit all childrenvoidfinal voidcalculates minimum sizeprotected com.nomagic.magicdraw.uml.symbols.shapes.ShapeElement.OnEdgeBoundsfinal voidfinal voidcalculatePreferredDimension(int locationX, int locationY) protected booleanbooleanfinal voidclone()booleancoversPoint(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.voidfinal voidensureDimension(boolean rememberBounds) If size is smaller than the preferred size, makes shape larger.voidvoidfindFreePlaceForShapeOnBorder(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.UnmodifiableInsetsgetChildrenInsets(com.nomagic.magicdraw.uml.symbols.shapes.InsetsLevel insetsLevel) protected UnmodifiableDimensiongetDimensionForShrinking(int width, int height) getEdgeLine(int edge) Returns a line representing a specified edge.Point[]-----1------ | | | | 4 2 | | | | ----3-------protected intgetHeaderInsetReduce(int edge, com.nomagic.magicdraw.uml.symbols.shapes.ShapeElement.OnEdgeBounds bounds) protected InsetsgetIntersection(int x1, int y1, int x2, int y2, PathElement path) Gets intersection point between shape view bounding rectangle and line.static PointgetIntersection(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 PointReturns middle point of this element.final PointgetMiddlePoint(Point rel) Gets middle point of this view,intintgetMiddlePointX(Point rel) intintgetMiddlePointY(Point rel) final UnmodifiableDimensionget minimum possible size for objectintgetNearestEdge(int x, int y) Return the nearest edge to given point.intReturn the nearest edge to given rectangle.byteget not copy bounds of object throws NoRectangleDefinedExceptionintReturns some edge constant if this shape must be on its parent edge.intintReturns position on edge.final UnmodifiableDimensionReturns preferable dimension of the element.Returns preferable dimension of the element for autosize.This implementation simple returns preferred size.com.nomagic.magicdraw.uml.symbols.ReshapeModebooleanReturns true, if view has manipulator (is selectable)voidInitialize symbol and its children state.voidinternalApplyProperties(com.dassault_systemes.modeler.magic.diagram.styledelegates.PresentationElementStyleChanger changer) Applies properties from given property managerinternalGetBoundsShape(ConverterToShape converterToShape) voidSilently applies all properties after initializationbooleanintersects(int x, int y, int width, int height, com.nomagic.magicdraw.uml.symbols.IntersectionKind kind) checks whether object intersects with given rectanglebooleanReturns autosize flag.booleanIndicates if the centerline provided by this shape is provided by its inner parts, not the shape itself.booleanCheck if given child is "layoutable" - it means this shape controls the bounds of child inside layoutChildren() method.booleanIndicates whether this shape provides horizontal center-lines to other shapes.booleanisOnEdge()Returns true if symbol is on edgestatic booleanisShapeOnEdge(PresentationElement symbol) booleanstatic booleanprotected booleanbooleanbooleanIndicates whether this shape provides vertical center-lines to other shapes.voidLayout children of this shape.voidlayoutChildren(boolean calculatePrefSize) Layout children of this shape.protected voidmaximumDimension(Dimension size) protected voidcalculates minimum sizevoidminimumDimensionForShrinking(Dimension size, int locationX, int locationY) protected voidprotected voidMove links to self.protected voidmovePathElement(PathElement path, PathConnector requestor) Calculates position of a path element.voidprotected booleanCheck if shape should be resized to a maximum size.protected booleanCheck if shape can be resized to a preferred size.protected voidonChildEdgeChange(ShapeElement child) protected voidprefDimensionByManipulatedChildren(Dimension pref, int locationX, int locationY) protected voidpreferredDimension(Dimension pref, int locationX, int locationY) protected booleanPrepares graphics for symbol shadow drawing.booleanIndicates if this shape can provide a horizontal centerline for other shapes to snap.booleanIndicates if this shape can provide a vertical centerline for other shapes to snap.voidResize recursively all symbols.voidResets the CALCULATE_PREFERRED_REGARDING_CHILDREN value to the default.voidsetAutosize(boolean val) Sets autosize flag.voidsetBorderElementMargin(String value) voidsets bounds of this object viewvoidsetCalculatePreferredRegardingChildren(boolean flag) Sets the CALCULATE_PREFERRED_REGARDING_CHILDREN value.voidsetLoadedDimension(UnmodifiableDimension loadedDimension) final voidsetMinimumDimension(int width, int height) Sets min sizevoidsetNeedAutosizeFlag(byte needAutosize) final voidsetOldRect(Rectangle old) voidsetOnEdge(int onEdge) Sets on edge property.final voidsetPreferredDimension(int width, int height) voidsetReshapeMode(com.nomagic.magicdraw.uml.symbols.ReshapeMode mode) Set symbol reshape modestatic voidsetSnapShapesOnBorderToGrid(boolean snapShapesOnBorderToGrid) voidvoidsetUseFixedConnectionPoints(boolean useFixed) protected booleanfinal voidsimpleSetBounds(int x, int y, int width, int height, boolean calculatePrefSize) final voidsimpleSetBounds(Rectangle rect) Sets bounding rectangle.voidsimpleSetBounds(Rectangle rect, boolean calculatePrefSize) Sets the bounding rectangle of this shape view to the specified value forbounds.booleanIndicates if this shape can be snapped to centerlines.voidsSetAutosize(boolean val) Simple setter for autosize flag.voidsSetBorderElementMargin(String value) voidsSetBounds(Rectangle bounds) Sets bounds of this object view only.voidvoidsSetVisibility(com.nomagic.magicdraw.uml.symbols.PresentationElementVisibility visibility) Sets element visibility flag.toString()Returns string representation of this element.voidRegisters 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, supportsVisibleConnectedPathElementsIfSelfInvisibleMethods 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, useParentStyleMethods 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, sGetIDMethods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.nomagic.magicdraw.uml.BaseElement
canAdd, isSelfChangeableMethods inherited from interface com.nomagic.magicdraw.uml.symbols.manipulators.centerlines.CenterlineableShape
asPresentationElement, getAbstractDiagramPresentationElement, getCenterlinePoint, getCenterlinePointX, getCenterlinePointYMethods 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:
getSuspendShapeAutoResizeModein interfacecom.nomagic.magicdraw.uml.symbols.SuspendShapeAutoResizeModeProvider
-
sSetSuspendShapeAutoResizeMode
-
setSuspendShapeAutoResizeMode
-
getBounds
Description copied from class:PresentationElementMethod returns bounds of this element. Use PresentationElementsManager to change a bounds of the element.- Overrides:
getBoundsin classPresentationElement- Returns:
- bounds of the element.
- See Also:
-
PresentationElementsManager.reshapeShapeElement
-
getNotCopyBounds
Description copied from class:PresentationElementget not copy bounds of object throws NoRectangleDefinedException- Overrides:
getNotCopyBoundsin classPresentationElement- Returns:
- rectangle of bounds
-
getMiddlePoint
Description copied from class:PresentationElementGets middle point of this view,- Overrides:
getMiddlePointin classPresentationElement- Parameters:
rel- relative point- Returns:
- middle point
-
getMiddlePointX
- Overrides:
getMiddlePointXin classPresentationElement
-
getMiddlePointY
- Overrides:
getMiddlePointYin classPresentationElement
-
getMiddlePoint
Description copied from class:PresentationElementReturns 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:
getMiddlePointin classPresentationElement- Returns:
- point that is considered as middle for this element.
-
getMiddlePointX
public int getMiddlePointX()- Overrides:
getMiddlePointXin classPresentationElement
-
getMiddlePointY
public int getMiddlePointY()- Overrides:
getMiddlePointYin classPresentationElement
-
sSetBounds
Description copied from class:PresentationElementSets bounds of this object view only.- Specified by:
sSetBoundsin classPresentationElement- Parameters:
bounds- rectangle of bounds.
-
adjustBounds
Validates bounds- Parameters:
bounds- bounds
-
setBounds
Description copied from class:PresentationElementsets bounds of this object view- Specified by:
setBoundsin 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:PresentationElementchecks if object covers provided point- Specified by:
coversPointin 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:PresentationElementchecks whether object intersects with given rectangle- Specified by:
intersectsin classPresentationElement- Returns:
- true if object and rectangle intersects
-
clone
- Specified by:
clonein interfaceBaseElement- Overrides:
clonein classPathConnector
-
movePathElements
public void movePathElements()- Overrides:
movePathElementsin classPathConnector
-
clearOldRect
public final void clearOldRect() -
setOldRect
-
movePathElement
Description copied from class:PathConnectorCalculates position of a path element.- Specified by:
movePathElementin 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:
getIntersectionin 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:MDElementMethod accepts a visitor, and calls method "visit<class name>(this)" of a visitor. See "Visitor" pattern for more details.- Specified by:
acceptin interfaceMDElement- Overrides:
acceptin classPathConnector- Parameters:
visitor- which visits this element.- Throws:
Exception
-
setPreferredDimension
public final void setPreferredDimension(int width, int height) -
getPreferredDimension
Description copied from class:PresentationElementReturns preferable dimension of the element.- Overrides:
getPreferredDimensionin classPresentationElement- Returns:
- preferred dimension
-
simpleSetBounds
Description copied from class:PresentationElementSets bounding rectangle.- Overrides:
simpleSetBoundsin 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:PresentationElementResize itself and initiate parent resize- Overrides:
autosizeAndResizeParentin 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:PresentationElementResize 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:
recursiveAutosizein classPresentationElement
-
initialize
public void initialize()Description copied from class:PresentationElementInitialize 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:
initializein 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:PresentationElementget minimum possible size for object- Overrides:
getMinimumDimensionin classPresentationElement- Returns:
- minimum dimension
-
getManipulatedElementAt
public PresentationElement getManipulatedElementAt(Point pt, com.nomagic.magicdraw.uml.symbols.IntersectionKind intersectionKind) Description copied from class:PresentationElementGets manipulated symbol at specified point pt.- Overrides:
getManipulatedElementAtin classPresentationElement- Parameters:
pt-PointintersectionKind- 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:
canHavePathsin 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:
internalGetBoundsShapein classPresentationElement
-
internalApplyProperties
public void internalApplyProperties(com.dassault_systemes.modeler.magic.diagram.styledelegates.PresentationElementStyleChanger changer) Description copied from class:PresentationElementApplies properties from given property manager- Overrides:
internalApplyPropertiesin classPresentationElement- Parameters:
changer- new properties
-
canBeAutosized
protected boolean canBeAutosized() -
isSnapToGrid
protected boolean isSnapToGrid()- Overrides:
isSnapToGridin classPresentationElement
-
toString
Description copied from class:com.nomagic.magicdraw.uml.MDElementImplReturns string representation of this element. Useful for debugging purposes.- Overrides:
toStringin 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:PresentationElementSilently applies all properties after initialization- Overrides:
internalSilentApplyin 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:PresentationElementValidate bounds before bounds change operation- Overrides:
adjustBoundsBeforeChangein 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:PresentationElementRegisters 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:
updateLaterin 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:PresentationElementPrepares graphics for symbol shadow drawing. If diagram allows shadows, sets darker diagram background color to given graphics.- Overrides:
prepareForShadowDrawingin 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.CenterlineableShapeGets shape inner parts which have centerlines.- Specified by:
getCenterlineableInnerPartsin 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.CenterlineableShapeIndicates if this shape can provide a vertical centerline for other shapes to snap.- Specified by:
providesVerticalCenterlinein 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.CenterlineableShapeIndicates if this shape can provide a horizontal centerline for other shapes to snap.- Specified by:
providesHorizontalCenterlinein 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.CenterlineableShapeIndicates if this shape can be snapped to centerlines.- Specified by:
snapsToCenterlinesin 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.CenterlineableShapeIndicates if the centerline provided by this shape is provided by its inner parts, not the shape itself.- Specified by:
isCenterlineInnerin 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:PresentationElementSets element visibility flag.- Overrides:
sSetVisibilityin 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:PresentationElementReturns true, if view has manipulator (is selectable)- Overrides:
hasManipulatorin 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:
getManipulationPreferredDimensionin 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:PresentationElementReturns preferable dimension of the element for autosize.This implementation simple returns preferred size.- Overrides:
getPreferredDimensionForAutosizein classPresentationElement- Returns:
- preferred dimension
-
isSnapShapesOnBorderToGrid
public static boolean isSnapShapesOnBorderToGrid() -
setSnapShapesOnBorderToGrid
public static void setSnapShapesOnBorderToGrid(boolean snapShapesOnBorderToGrid)
-