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
,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, TO, UNDEFINED, VALUE, VALUE_ANNOTATIONS
-
Constructor Summary
ConstructorDescriptionDefault constructor.ElementProperty
(String id, Object element) The property constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Accepts the given visitor.clone()
Clones the property.Returns property class type.Returns displayable elements class types.Returns model elementReturns stored element ID (real value of Property).Does not convert persistent value to element, but returns at it is (id of element)Returns a stereotypes and metaclasses for filtering selectable elementsReturns selectable elements class types.static String
getStringRepresentation
(Object element) getValue()
Returns properties value.Returns value's string representation.boolean
Tests Is containment.boolean
Check Element list property is Ordered.boolean
Checks if selected element intends to be the parent for other elementboolean
Test is Type Element.boolean
Returns 'use unspecified' flag for this property.void
setContainment
(boolean containment) Set containment.void
setDisplayableTypes
(Collection displayableTypes) Set Displayable types.void
setOrdered
(boolean ordered) void
setParentApplicant
(boolean parentApplicant) Set parent applicant.void
setProject
(Project project) Set project.void
setPropertyData
(Collection displayableTypes, Collection selectableTypes, boolean ordered, boolean containment) Sets data for property members.void
setSelectableRestrictedElements
(Collection elements) Sets a stereotypes and metaclasses for filtering selectable elementsvoid
setSelectableTypes
(Collection selectableTypes) Set Select table types.void
setTypeElement
(boolean typeElement) Set type Element.void
setUseUnspecified
(boolean useUnspecified) Set Use Unspecified.void
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 Details
-
ElementProperty
public ElementProperty()Default constructor. Value of the property will be null. ID will be empty string. Property is editable. -
ElementProperty
The property constructor.- Parameters:
id
- the ID of property.element
- some type - model Element or String.
-
-
Method Details
-
clone
Clones the property. -
getClassType
Returns property class type.- Specified by:
getClassType
in interfacePropertyVisitorAcceptor
- Overrides:
getClassType
in classProperty
- Returns:
- PropertyID.ELEMENT_PROPERTY
- See Also:
-
setSelectableTypes
Set Select table types.- Specified by:
setSelectableTypes
in interfacecom.nomagic.magicdraw.properties.ElementFilterProperty
- Parameters:
selectableTypes
- List of select table types.
-
setDisplayableTypes
Set Displayable types.- Specified by:
setDisplayableTypes
in 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:
setContainment
in 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
Returns selectable elements class types.- Specified by:
getSelectableTypes
in interfacecom.nomagic.magicdraw.properties.ElementFilterProperty
- Returns:
- selectable types.
-
getDisplayableTypes
Returns displayable elements class types.- Specified by:
getDisplayableTypes
in 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
Sets new property value. Will fire aPropertyChangeEvent
with propertyName - property ID, newValue and oldValue. -
getOriginalValue
Does not convert persistent value to element, but returns at it is (id of element) -
getElementID
Returns stored element ID (real value of Property).- Returns:
- value of the property.
-
getValue
Returns properties value. -
getElement
Returns model element- Returns:
- Model Element.
-
accept
Accepts the given visitor.- Specified by:
accept
in interfacePropertyVisitorAcceptor
- Overrides:
accept
in classProperty
- Parameters:
v
- the PropertyVisitor.- Throws:
Exception
-
getValueStringRepresentation
Description copied from class:Property
Returns value's string representation.- Overrides:
getValueStringRepresentation
in classProperty
- Returns:
- string "null" if property does not have value;
value. toString()
if property has value.
-
getStringRepresentation
-
setProject
Set project.- Specified by:
setProject
in interfacecom.nomagic.magicdraw.properties.ElementFilterProperty
- Parameters:
project
- Given project.
-
isContainment
public boolean isContainment()Tests Is containment.- Specified by:
isContainment
in interfacecom.nomagic.magicdraw.properties.ElementFilterProperty
- Returns:
- boolean
-
isTypeElement
public boolean isTypeElement()Test is Type Element. -
getSelectableRestrictedElements
Returns a stereotypes and metaclasses for filtering selectable elements- Specified by:
getSelectableRestrictedElements
in interfacecom.nomagic.magicdraw.properties.ElementFilterProperty
-
setSelectableRestrictedElements
Sets a stereotypes and metaclasses for filtering selectable elements- Specified by:
setSelectableRestrictedElements
in interfacecom.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 interfacecom.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 interfacecom.nomagic.magicdraw.properties.ElementFilterProperty
- Returns:
- boolean.
- See Also:
-
ElementFilterProperty.isOrdered()
-
setOrdered
public void setOrdered(boolean ordered) - Specified by:
setOrdered
in interfacecom.nomagic.magicdraw.properties.ElementFilterProperty
- See Also:
-
ElementFilterProperty.setOrdered(boolean)
-