Class ElementProperty

  • All Implemented Interfaces:
    com.nomagic.magicdraw.properties.ElementFilterProperty, PropertyVisitorAcceptor, java.lang.Cloneable

    @OpenApiAll
    public class ElementProperty
    extends Property
    implements com.nomagic.magicdraw.properties.ElementFilterProperty
    Property for selecting Element of given type. Editor of this property allows to choose some specific Element from all existing elements in the current project.
    • Constructor Detail

      • ElementProperty

        public ElementProperty()
        Default constructor. Value of the property will be null. ID will be empty string. Property is editable.
      • ElementProperty

        public ElementProperty​(java.lang.String id,
                               @CheckForNull
                               java.lang.Object element)
        The property constructor.
        Parameters:
        id - the ID of property.
        element - some type - model Element or String.
    • Method Detail

      • setSelectableTypes

        public void setSelectableTypes​(@CheckForNull
                                       java.util.Collection selectableTypes)
        Set Select table types.
        Specified by:
        setSelectableTypes in interface com.nomagic.magicdraw.properties.ElementFilterProperty
        Parameters:
        selectableTypes - List of select table types.
      • setDisplayableTypes

        public void setDisplayableTypes​(@CheckForNull
                                        java.util.Collection displayableTypes)
        Set Displayable types.
        Specified by:
        setDisplayableTypes in interface com.nomagic.magicdraw.properties.ElementFilterProperty
        Parameters:
        displayableTypes - List of Displayable type.
      • setUseUnspecified

        public void setUseUnspecified​(boolean useUnspecified)
        Set Use Unspecified.
        Parameters:
        useUnspecified - Use Unspecified flag.
      • setParentApplicant

        public void setParentApplicant​(boolean parentApplicant)
        Set parent applicant.
        Parameters:
        parentApplicant - Parent applicant.
      • setContainment

        public void setContainment​(boolean containment)
        Set containment.
        Specified by:
        setContainment in interface com.nomagic.magicdraw.properties.ElementFilterProperty
        Parameters:
        containment - Containment value.
      • setTypeElement

        public void setTypeElement​(boolean typeElement)
        Set type Element.
        Parameters:
        typeElement - The given type element.
      • getSelectableTypes

        @CheckForNull
        public java.util.Collection getSelectableTypes()
        Returns selectable elements class types.
        Specified by:
        getSelectableTypes in interface com.nomagic.magicdraw.properties.ElementFilterProperty
        Returns:
        selectable types.
      • getDisplayableTypes

        @CheckForNull
        public java.util.Collection getDisplayableTypes()
        Returns displayable elements class types.
        Specified by:
        getDisplayableTypes in interface com.nomagic.magicdraw.properties.ElementFilterProperty
        Returns:
        displayable types.
      • isUseUnspecified

        public boolean isUseUnspecified()
        Returns 'use unspecified' flag for this property.
        Returns:
        'use unspecified' flag for this property.
      • isParentApplicant

        public boolean isParentApplicant()
        Checks if selected element intends to be the parent for other element
        Returns:
        true - if selected element intends to be the parent of the other element; otherwise - false.
      • setValue

        public void setValue​(@CheckForNull
                             java.lang.Object value)
        Sets new property value. Will fire a PropertyChangeEvent with propertyName - property ID, newValue and oldValue.
        Overrides:
        setValue in class Property
        Parameters:
        value - model element or ID.
      • getOriginalValue

        public java.lang.Object getOriginalValue()
        Does not convert persistent value to element, but returns at it is (id of element)
      • getElementID

        @CheckForNull
        public java.lang.String getElementID()
        Returns stored element ID (real value of Property).
        Returns:
        value of the property.
      • getValue

        @CheckForNull
        public java.lang.Object getValue()
        Returns properties value.
        Overrides:
        getValue in class Property
        Returns:
        value of the property.
      • getElement

        @CheckForNull
        public Element getElement()
        Returns model element
        Returns:
        Model Element.
      • getValueStringRepresentation

        public java.lang.String getValueStringRepresentation()
        Description copied from class: Property
        Returns value's string representation.
        Overrides:
        getValueStringRepresentation in class Property
        Returns:
        string "null" if property does not have value; value. toString() if property has value.
      • getStringRepresentation

        public static java.lang.String getStringRepresentation​(@CheckForNull
                                                               java.lang.Object element)
      • setProject

        public void setProject​(@CheckForNull
                               Project project)
        Set project.
        Specified by:
        setProject in interface com.nomagic.magicdraw.properties.ElementFilterProperty
        Parameters:
        project - Given project.
      • isContainment

        public boolean isContainment()
        Tests Is containment.
        Specified by:
        isContainment in interface com.nomagic.magicdraw.properties.ElementFilterProperty
        Returns:
        boolean
      • isTypeElement

        public boolean isTypeElement()
        Test is Type Element.
      • getSelectableRestrictedElements

        public java.util.Collection getSelectableRestrictedElements()
        Returns a stereotypes and metaclasses for filtering selectable elements
        Specified by:
        getSelectableRestrictedElements in interface com.nomagic.magicdraw.properties.ElementFilterProperty
      • setSelectableRestrictedElements

        public void setSelectableRestrictedElements​(@CheckForNull
                                                    java.util.Collection elements)
        Sets a stereotypes and metaclasses for filtering selectable elements
        Specified by:
        setSelectableRestrictedElements in interface com.nomagic.magicdraw.properties.ElementFilterProperty
        Parameters:
        elements - elements
      • setPropertyData

        public void setPropertyData​(@CheckForNull
                                    java.util.Collection displayableTypes,
                                    @CheckForNull
                                    java.util.Collection selectableTypes,
                                    boolean ordered,
                                    boolean containment)
        Sets data for property members. This method takes collections of class types. You must add into these collections class types from constants class ClassTypes.
        Specified by:
        setPropertyData in interface com.nomagic.magicdraw.properties.ElementFilterProperty
      • isOrdered

        public boolean isOrdered()
        Specified by:
        isOrdered in interface com.nomagic.magicdraw.properties.ElementFilterProperty
        See Also:
        ElementFilterProperty.isOrdered()
      • setOrdered

        public void setOrdered​(boolean ordered)
        Specified by:
        setOrdered in interface com.nomagic.magicdraw.properties.ElementFilterProperty
        See Also:
        ElementFilterProperty.setOrdered(boolean)