Package com.nomagic.magicdraw.properties
Class ElementProperty
- java.lang.Object
-
- com.nomagic.magicdraw.properties.Property
-
- com.nomagic.magicdraw.properties.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.
-
-
Field Summary
-
Fields inherited from class com.nomagic.magicdraw.properties.Property
DEFAULT_PROPERTY_RESOURCE_PROVIDER, EDITABLE, NULL, NULL_ID_PROPERTY_RESOURCE_PROVIDER, UNDEFINED, VALUE, VALUE_ANNOTATIONS
-
-
Constructor Summary
Constructors Constructor Description ElementProperty()Default constructor.ElementProperty(java.lang.String id, java.lang.Object element)The property constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(PropertyVisitor v)Accepts the given visitor.ElementPropertyclone()Clones the property.java.lang.StringgetClassType()Returns property class type.java.util.CollectiongetDisplayableTypes()Returns displayable elements class types.ElementgetElement()Returns model elementjava.lang.StringgetElementID()Returns stored element ID (real value of Property).java.lang.ObjectgetOriginalValue()Does not convert persistent value to element, but returns at it is (id of element)java.util.CollectiongetSelectableRestrictedElements()Returns a stereotypes and metaclasses for filtering selectable elementsjava.util.CollectiongetSelectableTypes()Returns selectable elements class types.static java.lang.StringgetStringRepresentation(java.lang.Object element)java.lang.ObjectgetValue()Returns properties value.java.lang.StringgetValueStringRepresentation()Returns value's string representation.booleanisContainment()Tests Is containment.booleanisOrdered()Check Element list property is Ordered.booleanisParentApplicant()Checks if selected element intends to be the parent for other elementbooleanisTypeElement()Test is Type Element.booleanisUseUnspecified()Returns 'use unspecified' flag for this property.voidsetContainment(boolean containment)Set containment.voidsetDisplayableTypes(java.util.Collection displayableTypes)Set Displayable types.voidsetOrdered(boolean ordered)voidsetParentApplicant(boolean parentApplicant)Set parent applicant.voidsetProject(Project project)Set project.voidsetPropertyData(java.util.Collection displayableTypes, java.util.Collection selectableTypes, boolean ordered, boolean containment)Sets data for property members.voidsetSelectableRestrictedElements(java.util.Collection elements)Sets a stereotypes and metaclasses for filtering selectable elementsvoidsetSelectableTypes(java.util.Collection selectableTypes)Set Select table types.voidsetTypeElement(boolean typeElement)Set type Element.voidsetUseUnspecified(boolean useUnspecified)Set Use Unspecified.voidsetValue(java.lang.Object value)Sets new property value.-
Methods inherited from class com.nomagic.magicdraw.properties.Property
_getValue, _isFrozen, _setFrozen, _setValue, addAnnotation, addPropertyChangeListener, addSource, addSources, areEqualByValue, areValuesEqual, checkFrozen, checkFrozen, createCellEditor, createTableCellRenderer, equals, firePropertyChange, generateDefaultDescriptionID, getAdditionalProperties, getAdditionalProperty, getAnnotation, getAnnotations, getDescription, getDescriptionID, getFirstElementFromSources, getGroup, getID, getIntroductoryVersion, getName, getNonEditableReason, getProjectFromSourcesOrActive, getPureDescription, getResourceProvider, getResourceProviderID, getSortableValueStringRepresentation, getSourceAsElement, getSources, getSourcesAsStream, getUndefinedString, getUndefinedString, hashCode, isEditable, isUndefinedState, isValueCompatible, removeAnnotation, removePropertyChangeListener, setAdditionalProperties, setAdditionalProperty, setAnnotations, setDescription, setDescriptionID, setEditable, setGroup, setID, setIntroductoryVersion, setNonEditableReason, setResourceProvider, setResourceProviderID, setSources, setUndefinedState, toString
-
-
-
-
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
-
clone
public ElementProperty clone()
Clones the property.
-
getClassType
public java.lang.String getClassType()
Returns property class type.- Specified by:
getClassTypein interfacePropertyVisitorAcceptor- Overrides:
getClassTypein classProperty- Returns:
- PropertyID.ELEMENT_PROPERTY
- See Also:
PropertyID.ELEMENT_PROPERTY
-
setSelectableTypes
public void setSelectableTypes(@CheckForNull java.util.Collection selectableTypes)Set Select table types.- Specified by:
setSelectableTypesin interfacecom.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:
setDisplayableTypesin interfacecom.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:
setContainmentin interfacecom.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:
getSelectableTypesin interfacecom.nomagic.magicdraw.properties.ElementFilterProperty- Returns:
- selectable types.
-
getDisplayableTypes
@CheckForNull public java.util.Collection getDisplayableTypes()
Returns displayable elements class types.- Specified by:
getDisplayableTypesin interfacecom.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 aPropertyChangeEventwith propertyName - property ID, newValue and oldValue.
-
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.
-
getElement
@CheckForNull public Element getElement()
Returns model element- Returns:
- Model Element.
-
accept
public void accept(PropertyVisitor v) throws java.lang.Exception
Accepts the given visitor.- Specified by:
acceptin interfacePropertyVisitorAcceptor- Overrides:
acceptin classProperty- Parameters:
v- the PropertyVisitor.- Throws:
java.lang.Exception
-
getValueStringRepresentation
public java.lang.String getValueStringRepresentation()
Description copied from class:PropertyReturns value's string representation.- Overrides:
getValueStringRepresentationin classProperty- 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:
setProjectin interfacecom.nomagic.magicdraw.properties.ElementFilterProperty- Parameters:
project- Given project.
-
isContainment
public boolean isContainment()
Tests Is containment.- Specified by:
isContainmentin interfacecom.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:
getSelectableRestrictedElementsin interfacecom.nomagic.magicdraw.properties.ElementFilterProperty
-
setSelectableRestrictedElements
public void setSelectableRestrictedElements(@CheckForNull java.util.Collection elements)Sets a stereotypes and metaclasses for filtering selectable elements- Specified by:
setSelectableRestrictedElementsin interfacecom.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:
setPropertyDatain interfacecom.nomagic.magicdraw.properties.ElementFilterProperty
-
isOrdered
public boolean isOrdered()
Description copied from interface:com.nomagic.magicdraw.properties.ElementFilterPropertyCheck Element list property is Ordered.- Specified by:
isOrderedin interfacecom.nomagic.magicdraw.properties.ElementFilterProperty- Returns:
- boolean.
- See Also:
ElementFilterProperty.isOrdered()
-
setOrdered
public void setOrdered(boolean ordered)
- Specified by:
setOrderedin interfacecom.nomagic.magicdraw.properties.ElementFilterProperty- See Also:
ElementFilterProperty.setOrdered(boolean)
-
-