Class ShapeElement

java.lang.Object
com.nomagic.magicdraw.uml.MDElementImpl
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 Details

    • SPACE

      public static final int SPACE
      Space between bounds and some inner object.
      See Also:
    • SPACE_INSETS

      public static final com.nomagic.ui.UnmodifiableInsets SPACE_INSETS
      Insets with all locations equal to SPACE
      See Also:
    • SPACE_INSETS_EMPTY_TOP_BOTTOM

      public static final com.nomagic.ui.UnmodifiableInsets SPACE_INSETS_EMPTY_TOP_BOTTOM
      Insets with top/bottom equals to zero and right/left equals to SPACE
      See Also:
    • NULL_INSETS

      public static final com.nomagic.ui.UnmodifiableInsets NULL_INSETS
      Insets with all locations equal to 0
    • NEED_AUTOSIZE_FULL

      public static final byte NEED_AUTOSIZE_FULL
      Flag for doing full autosize - calculation of preferred size and children layout
      See Also:
    • NEED_AUTOSIZE_LAYOUT

      public static final byte NEED_AUTOSIZE_LAYOUT
      Flag for doing only children layout during autosize
      See Also:
    • NEED_AUTOSIZE_NONE

      public static final byte NEED_AUTOSIZE_NONE
      Flag for ignoring autosize
      See Also:
    • BORDER_ELEMENT_MARGIN_ALL

      public static final String BORDER_ELEMENT_MARGIN_ALL
      See Also:
    • BORDER_ELEMENT_MARGIN_LEFT

      public static final String BORDER_ELEMENT_MARGIN_LEFT
      See Also:
    • BORDER_ELEMENT_MARGIN_RIGHT

      public static final String BORDER_ELEMENT_MARGIN_RIGHT
      See Also:
    • BORDER_ELEMENT_MARGIN_TOP

      public static final String BORDER_ELEMENT_MARGIN_TOP
      See Also:
    • BORDER_ELEMENT_MARGIN_BOTTOM

      public static final String BORDER_ELEMENT_MARGIN_BOTTOM
      See Also:
    • BORDER_ELEMENT_MARGIN_LEFT_RIGHT

      public static final String BORDER_ELEMENT_MARGIN_LEFT_RIGHT
      See Also:
    • BORDER_ELEMENT_MARGIN_TOP_BOTTOM

      public static final String BORDER_ELEMENT_MARGIN_TOP_BOTTOM
      See Also:
    • BORDER_ELEMENT_MARGIN_NONE

      public static final String BORDER_ELEMENT_MARGIN_NONE
      See Also:
    • BORDER_ELEMENT_MARGIN_MODES

      public static final List<String> 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

      public ShapeElement(@CheckForNull PresentationElement parent)
  • 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

      public String getSuspendShapeAutoResizeMode()
      Specified by:
      getSuspendShapeAutoResizeMode in interface com.nomagic.magicdraw.uml.symbols.SuspendShapeAutoResizeModeProvider
    • sSetSuspendShapeAutoResizeMode

      public void sSetSuspendShapeAutoResizeMode(String mode)
    • setSuspendShapeAutoResizeMode

      public void setSuspendShapeAutoResizeMode(String mode)
    • getBounds

      public Rectangle getBounds()
      Description copied from class: PresentationElement
      Method returns bounds of this element. Use PresentationElementsManager to change a bounds of the element.
      Overrides:
      getBounds in class PresentationElement
      Returns:
      bounds of the element.
      See Also:
      • PresentationElementsManager.reshapeShapeElement
    • getNotCopyBounds

      public Rectangle getNotCopyBounds()
      Description copied from class: PresentationElement
      get not copy bounds of object throws NoRectangleDefinedException
      Overrides:
      getNotCopyBounds in class PresentationElement
      Returns:
      rectangle of bounds
    • getMiddlePoint

      public final Point getMiddlePoint(Point rel)
      Description copied from class: PresentationElement
      Gets middle point of this view,
      Overrides:
      getMiddlePoint in class PresentationElement
      Parameters:
      rel - relative point
      Returns:
      middle point
    • getMiddlePointX

      public int getMiddlePointX(Point rel)
      Overrides:
      getMiddlePointX in class PresentationElement
    • getMiddlePointY

      public int getMiddlePointY(Point rel)
      Overrides:
      getMiddlePointY in class PresentationElement
    • getMiddlePoint

      public final Point 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 class PresentationElement
      Returns:
      point that is considered as middle for this element.
    • getMiddlePointX

      public int getMiddlePointX()
      Overrides:
      getMiddlePointX in class PresentationElement
    • getMiddlePointY

      public int getMiddlePointY()
      Overrides:
      getMiddlePointY in class PresentationElement
    • sSetBounds

      public void sSetBounds(Rectangle bounds)
      Description copied from class: PresentationElement
      Sets bounds of this object view only.
      Specified by:
      sSetBounds in class PresentationElement
      Parameters:
      bounds - rectangle of bounds.
    • adjustBounds

      public void adjustBounds(Rectangle bounds)
      Validates bounds
      Parameters:
      bounds - bounds
    • setBounds

      public void setBounds(Rectangle bounds)
      Description copied from class: PresentationElement
      sets bounds of this object view
      Specified by:
      setBounds in class PresentationElement
      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 class PresentationElement
      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 class PresentationElement
      Returns:
      true if object and rectangle intersects
    • clone

      public ShapeElement clone()
      Specified by:
      clone in interface BaseElement
      Overrides:
      clone in class PathConnector
    • movePathElements

      public void movePathElements()
      Overrides:
      movePathElements in class PathConnector
    • clearOldRect

      public final void clearOldRect()
    • setOldRect

      public final void setOldRect(Rectangle old)
    • movePathElement

      protected void movePathElement(PathElement path, @CheckForNull PathConnector requestor)
      Description copied from class: PathConnector
      Calculates position of a path element.
      Specified by:
      movePathElement in class PathConnector
      Parameters:
      path - element which position will be calculated.
      requestor - the requestor of this path moving. Implementations may check to avoid endless loops.
    • getIntersection

      public Point getIntersection(int x, int y, @CheckForNull PathElement path)
      Overrides:
      getIntersection in class PresentationElement
    • getIntersection

      public Point getIntersection(int x1, int y1, int x2, int y2, @CheckForNull PathElement path)
      Gets intersection point between shape view bounding rectangle and line.
      Parameters:
      x1 - first point of the line
      y1 - first point of the line
      x2 - second point of the line
      y2 - second point of the line
      path - 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 line
      y1 - first point of the line
      x2 - second point of the line
      y2 - second point of the line
      bounds - shape bounds
      boundingShape - bounding shape
      Returns:
      intersection point
    • accept

      @OpenApi public void accept(Visitor visitor) throws Exception
      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 interface MDElement
      Overrides:
      accept in class PathConnector
      Parameters:
      visitor - which visits this element.
      Throws:
      Exception
    • setPreferredDimension

      public final void setPreferredDimension(int width, int height)
    • getPreferredDimension

      public final UnmodifiableDimension getPreferredDimension()
      Description copied from class: PresentationElement
      Returns preferable dimension of the element.
      Overrides:
      getPreferredDimension in class PresentationElement
      Returns:
      preferred dimension
    • simpleSetBounds

      public final void simpleSetBounds(Rectangle rect)
      Description copied from class: PresentationElement
      Sets bounding rectangle.
      Overrides:
      simpleSetBounds in class PresentationElement
      Parameters:
      rect - new bounding rectangle.
    • simpleSetBounds

      public final void simpleSetBounds(int x, int y, int width, int height, boolean calculatePrefSize)
    • simpleSetBounds

      public void simpleSetBounds(Rectangle rect, boolean calculatePrefSize)
      Sets the bounding rectangle of this shape view to the specified value for bounds. 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 class PresentationElement
    • moveLinksToSelf

      protected void moveLinksToSelf()
      Move links to self.
    • addBreakPoints

      protected void addBreakPoints(PathElement link)
      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 - size
      locationX - x location
      locationY - y location
      prefSizeWidth - preferred size width
      prefSizeHeight - preferred size height
    • maximumDimension

      protected void maximumDimension(Dimension size)
    • 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

      @CheckForNull protected UnmodifiableDimension getDefaultDimension()
    • getSizeForDrawing

      @CheckForNull public UnmodifiableDimension 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 class PresentationElement
    • 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 class PresentationElement
    • calculateMinimumDimension

      public final void calculateMinimumDimension()
      calculates minimum size
    • minimumDimension

      protected void minimumDimension(Dimension min)
      calculates minimum size
      Parameters:
      min - minimum size
    • setMinimumDimension

      public final void setMinimumDimension(int width, int height)
      Sets min size
      Parameters:
      width - width
      height - height
    • getMinimumDimension

      public final UnmodifiableDimension getMinimumDimension()
      Description copied from class: PresentationElement
      get minimum possible size for object
      Overrides:
      getMinimumDimension in class PresentationElement
      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 class PresentationElement
      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

      protected void preferredDimension(Dimension pref, int locationX, int locationY)
    • prefDimensionByManipulatedChildren

      protected void prefDimensionByManipulatedChildren(Dimension pref, int locationX, int locationY)
    • canHavePaths

      public boolean canHavePaths()
      Overrides:
      canHavePaths in class PresentationElement
      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 - path
      transformation - transformation
      Returns:
      shape
    • internalGetBoundsShape

      @CheckForNull public Shape internalGetBoundsShape(ConverterToShape converterToShape)
      Overrides:
      internalGetBoundsShape in class PresentationElement
    • 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 class PresentationElement
      Parameters:
      changer - new properties
    • canBeAutosized

      protected boolean canBeAutosized()
    • isSnapToGrid

      protected boolean isSnapToGrid()
      Overrides:
      isSnapToGrid in class PresentationElement
    • toString

      public String toString()
      Description copied from class: com.nomagic.magicdraw.uml.MDElementImpl
      Returns string representation of this element. Useful for debugging purposes.
      Overrides:
      toString in class com.nomagic.magicdraw.uml.MDElementImpl
    • getFixedConnectionPoints

      public Point[] 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 class PresentationElement
    • 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

      protected void onChildEdgeChange(ShapeElement child)
    • 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

      @CheckForNull public Point calculateAdjustOnEdgeLocation(Rectangle bounds)
      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

      public static boolean isShapeOnEdge(PresentationElement symbol)
    • adjustOnEdgeChildren

      public void adjustOnEdgeChildren()
      Adjust on edge all children
    • adjustOnEdge

      public Point adjustOnEdge(Rectangle bounds, int edge, int position, int cornerDistance)
      Calculates location of given rectangle according given parent edge and position on edge.
      Parameters:
      bounds - the given rectangle
      edge - the parent bounds
      position - the position on edge
      cornerDistance - 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 class PresentationElement
    • getNearestEdge

      public int getNearestEdge(Rectangle r)
      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 x
      y - the given point y
      Returns:
      nearest edge
      See Also:
    • setLoadedDimension

      public void setLoadedDimension(@CheckForNull UnmodifiableDimension loadedDimension)
    • getLoadedDimension

      @CheckForNull public UnmodifiableDimension 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 class PresentationElement
    • getInsetsForOnEdgeShapes

      protected Insets 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

      protected boolean prepareForShadowDrawing(Graphics2D g)
      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 class PresentationElement
      Parameters:
      g - the given graphics
    • shouldDrawShadow

      protected boolean shouldDrawShadow()
    • getEdgeLine

      @CheckForNull public Line getEdgeLine(int edge)
      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 interface com.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

      public Point findFreePlaceForShapeOnBorder(ShapeElement shape, Rectangle shapeB)
      Looks for available position slot for given shape on a border
      Parameters:
      shape - shape added on some border
      shapeB - 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 interface com.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 interface com.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 interface com.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 interface com.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 class PathConnector
      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

      public boolean isChildLayoutable(PresentationElement child)
      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

      public String getBorderElementMargin()
    • sSetBorderElementMargin

      public void sSetBorderElementMargin(String value)
    • setBorderElementMargin

      public void setBorderElementMargin(String value)
    • hasManipulator

      public boolean hasManipulator()
      Description copied from class: PresentationElement
      Returns true, if view has manipulator (is selectable)
      Overrides:
      hasManipulator in class PresentationElement
    • 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

      public UnmodifiableDimension getManipulationPreferredDimension()
      Overrides:
      getManipulationPreferredDimension in class PresentationElement
      Returns:
      size for manipulator manipulations
    • minimumOrMinimumShrinkableDimension

      protected void minimumOrMinimumShrinkableDimension(Dimension size)
    • minimumDimensionForShrinking

      public void minimumDimensionForShrinking(Dimension size, int locationX, int locationY)
      Parameters:
      size - size
      locationX - location X
      locationY - location Y
    • getDimensionForShrinking

      public UnmodifiableDimension getDimensionForShrinking(int width, int height)
    • isShrinkable

      public boolean isShrinkable()
    • ensurePreferredDimensionIfShrinkable

      public void ensurePreferredDimensionIfShrinkable()
    • ensurePreferredDimensionIfShrinkable

      public void ensurePreferredDimensionIfShrinkable(Rectangle bounds)
    • calculateAndGetPreferredDimension

      public UnmodifiableDimension calculateAndGetPreferredDimension()
    • calculateAndGetMinimumShrinkingDimension

      public UnmodifiableDimension calculateAndGetMinimumShrinkingDimension(int locationX, int locationY)
    • getPreferredDimensionForAutosize

      public UnmodifiableDimension getPreferredDimensionForAutosize()
      Description copied from class: PresentationElement
      Returns preferable dimension of the element for autosize.This implementation simple returns preferred size.
      Overrides:
      getPreferredDimensionForAutosize in class PresentationElement
      Returns:
      preferred dimension
    • isSnapShapesOnBorderToGrid

      public static boolean isSnapShapesOnBorderToGrid()
    • setSnapShapesOnBorderToGrid

      public static void setSnapShapesOnBorderToGrid(boolean snapShapesOnBorderToGrid)