Class ElementProperty

java.lang.Object
com.nomagic.magicdraw.properties.Property
com.nomagic.magicdraw.properties.ElementProperty
All Implemented Interfaces:
com.nomagic.magicdraw.properties.ElementFilterProperty, PropertyVisitorAcceptor, 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 Details

    • ElementProperty

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

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

    • clone

      public ElementProperty clone()
      Clones the property.
      Overrides:
      clone in class Property
      Returns:
      the clone of this property.
    • getClassType

      public String getClassType()
      Returns property class type.
      Specified by:
      getClassType in interface PropertyVisitorAcceptor
      Overrides:
      getClassType in class Property
      Returns:
      PropertyID.ELEMENT_PROPERTY
      See Also:
    • setSelectableTypes

      public void setSelectableTypes(@CheckForNull 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 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 Collection getSelectableTypes()
      Returns selectable elements class types.
      Specified by:
      getSelectableTypes in interface com.nomagic.magicdraw.properties.ElementFilterProperty
      Returns:
      selectable types.
    • getDisplayableTypes

      @CheckForNull public 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 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 Object getOriginalValue()
      Does not convert persistent value to element, but returns at it is (id of element)
    • getElementID

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

      @CheckForNull public 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.
    • accept

      public void accept(PropertyVisitor v) throws Exception
      Accepts the given visitor.
      Specified by:
      accept in interface PropertyVisitorAcceptor
      Overrides:
      accept in class Property
      Parameters:
      v - the PropertyVisitor.
      Throws:
      Exception
    • getValueStringRepresentation

      public 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 String getStringRepresentation(@CheckForNull 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 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 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 Collection displayableTypes, @CheckForNull 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()
      Description copied from interface: com.nomagic.magicdraw.properties.ElementFilterProperty
      Check Element list property is Ordered.
      Specified by:
      isOrdered in interface com.nomagic.magicdraw.properties.ElementFilterProperty
      Returns:
      boolean.
      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)