Class PresentationElement

    • Field Detail

      • SOLID_STROKE

        @OpenApi
        public static final int SOLID_STROKE
        Solid path stroke.
        See Also:
        Constant Field Values
      • DASHED_STROKE

        @OpenApi
        public static final int DASHED_STROKE
        Dashed path stroke.
        See Also:
        Constant Field Values
      • DOTTED_STROKE

        @OpenApi
        public static final int DOTTED_STROKE
        Dotted path stroke.
        See Also:
        Constant Field Values
    • Method Detail

      • getElement

        @OpenApi
        @CheckForNull
        public Element getElement()
        Returns model element of this presentation element. Some presentation elements (for example TextBoxes) do not have model elements.
        Specified by:
        getElement in interface ModelElementProvider
        Returns:
        model element of this presentation element.
      • getDiagramSurface

        @CheckForNull
        @OpenApi
        public DiagramSurface getDiagramSurface()
        Returns diagram surface for this presentation element. DiagramSurface is null if diagram of this element is not opened in some window.
        Returns:
        diagram surface or null if diagram is not opened.
      • getParent

        @OpenApi
        public final PresentationElement getParent()
        Returns parent of this element.
        Returns:
        parent of this element.
      • getPreferredSize

        @Deprecated
        @OpenApi
        public final java.awt.Dimension getPreferredSize()
        Deprecated.
        Returns preferable dimension of the element.
        Returns:
        preferred dimension
      • getPreferredDimension

        @OpenApi
        public UnmodifiableDimension getPreferredDimension()
        Returns preferable dimension of the element.
        Returns:
        preferred dimension
      • getMiddlePoint

        @CheckForNull
        @OpenApi
        public java.awt.Point getMiddlePoint()
        Returns middle point of this element. Middle point for shapes usually will be center point of bounds, middle point for paths will be center of path curve.
        Returns:
        point that is considered as middle for this element.
      • getPresentationElements

        @OpenApi
        public java.util.List<PresentationElement> getPresentationElements()
        Returns all children of this element
        Returns:
        all children of this element. The collection is unmodifiable.
      • setAllSelected

        @OpenApi
        public void setAllSelected​(boolean select)
        Selects(or deselects) all presentation elements in the diagram.
        Parameters:
        select - select or deselect all elements.
      • setSelected

        @OpenApi
        public void setSelected​(java.util.List<PresentationElement> elements)
        Selects given elements in the diagram.
        Parameters:
        elements - elements to select.
      • setSelected

        @OpenApi
        public void setSelected​(boolean select)
        Selects or deselects this presentation element in the diagram.
        Parameters:
        select - select or deselect this presentation element.
      • getSelected

        @OpenApi
        public java.util.List<PresentationElement> getSelected()
        Returns a list of selected elements in the diagram.
        Returns:
        a list of selected elements. List is unmodifiable.
      • isSelected

        @OpenApi
        public boolean isSelected()
        Returns true, if this element is selected in the diagram.
        Returns:
        true, if this element is selected in the diagram.
      • getDiagramPresentationElement

        @OpenApi
        public final DiagramPresentationElement getDiagramPresentationElement()
        Returns diagram of this presentation element.
        Returns:
        diagram of this presentation element.
      • onFind

        @OpenApi
        public final void onFind()
        Scrolls diagram canvas to this symbol and selects this symbol
      • onFind

        @OpenApi
        public final void onFind​(boolean center)
        Scrolls diagram canvas to this symbol and selects this symbol
        Parameters:
        center - if true, centers current view in the center of the window.
      • collectSubManipulatedElements

        @OpenApi
        public final void collectSubManipulatedElements​(java.util.List<PresentationElement> col)
        Collects all visible and manipulated elements in this hierarchy.
      • getManipulatedPresentationElements

        @OpenApi
        public final java.util.List<PresentationElement> getManipulatedPresentationElements()
        Returns a list of children of this element those have manipulator.
        Returns:
        a list of manipulated elements. Collection is unmodifiable.
      • hasManipulatedPresentationElements

        @OpenApi
        public final boolean hasManipulatedPresentationElements()
        Returns:
        true if at least one child is manipulated and visible
      • useParentProperties

        @OpenApi
        public boolean useParentProperties()
        Does this element uses parent properties or has it own?
        Returns:
        true, if element does not have properties and uses parent's.
      • getProperty

        @CheckForNull
        @OpenApi
        public Property getProperty​(java.lang.String id)
        Returns element's property with given id.
        Parameters:
        id - ID of property.
        Returns:
        property with given id or null if element does not have such property.
        See Also:
        useParentProperties()
      • editName

        @OpenApi
        public final void editName​(@CheckForNull
                                   java.awt.event.KeyEvent evt)
        Starts online diagram editing for a symbol
        Parameters:
        evt - first key event or null
      • editName

        @OpenApi
        public void editName​(@CheckForNull
                             java.awt.event.KeyEvent evt,
                             @CheckForNull
                             java.util.Map<java.lang.String,​java.lang.Boolean> textEditorOptions)
        Starts online diagram editing for a symbol
        Parameters:
        evt - first key event or null
        textEditorOptions - boolean options for text editor. Passed when creating text editor with TextEditorFactory
      • getManipulatedParent

        @CheckForNull
        @OpenApi
        public final PresentationElement getManipulatedParent()
        Returns:
        first parent with manipulator or null if such does not exist.
      • getObjectParent

        @OpenApi
        public BaseElement getObjectParent()
        Returns the presentation element parent. Implementation of super method.
        Specified by:
        getObjectParent in interface BaseElement
        Overrides:
        getObjectParent in class com.nomagic.magicdraw.uml.MDElementImpl
        Returns:
        the parent of the element.
        See Also:
        getParent()
      • getBoundsShape

        @OpenApi
        @CheckForNull
        public final java.awt.Shape getBoundsShape​(ConverterToShape converterToShape)
        Provides a bounding shape of the symbol
        Parameters:
        converterToShape - transform bounding shape according this converter
        Returns:
        bounding shape of the symbol
      • getPresentationElementStroke

        @OpenApi
        public final java.awt.BasicStroke getPresentationElementStroke()
        Return a stroke used to paint symbol's main part
        Returns:
        a stroke used to paint symbol's main part
      • getPresentationElementStroke

        @OpenApi
        public final java.awt.BasicStroke getPresentationElementStroke​(int width)
        Return a stroke used to paint symbol's main part
        Parameters:
        width - a custom stroke width. Other stroke parameters will be specific to symbol
        Returns:
        a stroke used to paint symbol's main part
      • getStroke

        @OpenApi
        public static java.awt.BasicStroke getStroke​(java.awt.BasicStroke stroke,
                                                     int width)
        Get cached stroke of given width.
        Parameters:
        stroke - base stroke.
        width - of the stroke.
        Returns:
        stroke
      • getStroke

        @OpenApi
        public static java.awt.BasicStroke getStroke​(int lineStyle)
        Get cached stroke of given style and default width.
        Parameters:
        lineStyle - style of line.
        Returns:
        stroke
        See Also:
        SOLID_STROKE, DASHED_STROKE, DOTTED_STROKE
      • getStroke

        @OpenApi
        public static java.awt.BasicStroke getStroke​(int lineStyle,
                                                     int width)
        Get cached stroke of given style and width.
        Parameters:
        lineStyle - style of line
        width - width
        Returns:
        stroke
        See Also:
        SOLID_STROKE, DASHED_STROKE, DOTTED_STROKE
      • getStroke

        @OpenApi
        public static java.awt.BasicStroke getStroke​(int lineStyle,
                                                     int width,
                                                     int join)
        Get cached stroke of given style, width and join.
        Parameters:
        lineStyle - style of line
        width - width
        Returns:
        stroke
        See Also:
        SOLID_STROKE, DASHED_STROKE, DOTTED_STROKE, BasicStroke.JOIN_BEVEL, BasicStroke.JOIN_MITER, BasicStroke.JOIN_ROUND
      • getStroke

        @OpenApi
        public static java.awt.BasicStroke getStroke​(int lineStyle,
                                                     int width,
                                                     int join,
                                                     int cap)
        Get cached stroke of given style, width and join.
        Parameters:
        lineStyle - style of line
        width - width
        Returns:
        stroke
        See Also:
        SOLID_STROKE, DASHED_STROKE, DOTTED_STROKE, BasicStroke.JOIN_BEVEL, BasicStroke.JOIN_MITER, BasicStroke.JOIN_ROUND
      • getStroke

        @OpenApi
        public static java.awt.BasicStroke getStroke​(float width,
                                                     int cap,
                                                     int join,
                                                     float miterLimit,
                                                     @CheckForNull
                                                     float[] dash,
                                                     float dash_phase)
        Get cached stroke.
        See Also:
        BasicStroke(float, int, int, float, float[], float)