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 Modifier and Type Field Description private boolean
containment
Flag indicates if the element is containedprivate java.util.Collection
displayableTypes
The collection of displayable elements class types.private boolean
parentApplicant
The selected element intends to be the parent for other element.private Project
project
Project to which the element belongs.private java.util.Collection
selectableRestrictedElements
Stereotypes and metaclasses for filtering selectable elementsprivate java.util.Collection
selectableTypes
The collection of selectable elements class types.private boolean
typeElement
Type element flagprivate boolean
useUnspecified
Canbe selected or not? -
Fields inherited from class com.nomagic.magicdraw.properties.Property
DEFAULT_PROPERTY_RESOURCE_PROVIDER, EDITABLE, NULL, NULL_ID_PROPERTY_RESOURCE_PROVIDER, UNDEFINED, VALUE
-
-
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 void
accept(PropertyVisitor v)
Accepts the given visitor.ElementProperty
clone()
Clones the property.java.lang.String
getClassType()
Returns property class type.java.util.Collection
getDisplayableTypes()
Returns displayable elements class types.Element
getElement()
Returns model elementjava.lang.String
getElementID()
Returns stored element ID (real value of Property).java.lang.Object
getOriginalValue()
Does not convert persistent value to element, but returns at it is (id of element)java.util.Collection
getSelectableRestrictedElements()
Returns a stereotypes and metaclasses for filtering selectable elementsjava.util.Collection
getSelectableTypes()
Returns selectable elements class types.static java.lang.String
getStringRepresentation(java.lang.Object element)
java.lang.Object
getValue()
Returns properties value.java.lang.String
getValueStringRepresentation()
Returns value's string representation.boolean
isContainment()
Tests Is containment.boolean
isOrdered()
boolean
isParentApplicant()
Checks if selected element intends to be the parent for other elementboolean
isTypeElement()
Test is Type Element.boolean
isUseUnspecified()
Returns 'use unspecified' flag for this property.void
setContainment(boolean containment)
Set containment.void
setDisplayableTypes(java.util.Collection displayableTypes)
Set Displayable types.void
setOrdered(boolean ordered)
void
setParentApplicant(boolean parentApplicant)
Set parent applicant.void
setProject(Project project)
Set project.void
setPropertyData(java.util.Collection displayableTypes, java.util.Collection selectableTypes, boolean ordered, boolean containment)
Sets data for property members.void
setSelectableRestrictedElements(java.util.Collection elements)
Sets a stereotypes and metaclasses for filtering selectable elementsvoid
setSelectableTypes(java.util.Collection selectableTypes)
Set Select table types.void
setTypeElement(boolean typeElement)
Set type Element.void
setUseUnspecified(boolean useUnspecified)
Set Use Unspecified.void
setValue(java.lang.Object value)
Sets new property value.-
Methods inherited from class com.nomagic.magicdraw.properties.Property
_getValue, _isFrozen, _setFrozen, _setValue, addPropertyChangeListener, addSource, addSources, areValuesEqual, checkFrozen, checkFrozen, createCellEditor, createTableCellRenderer, equals, firePropertyChange, generateDefaultDescriptionID, getAdditionalProperties, getAdditionalProperty, getDescription, getDescriptionID, getFirstElementFromSources, getGroup, getID, getIntroductoryVersion, getName, getNonEditableReason, getProjectFromSourcesOrActive, getPureDescription, getResourceProvider, getResourceProviderID, getSourceAsElement, getSources, getSourcesAsStream, getUndefinedString, getUndefinedString, hashCode, isEditable, isUndefinedState, isValueCompatible, removePropertyChangeListener, setAdditionalProperties, setAdditionalProperty, setDescription, setDescriptionID, setEditable, setGroup, setID, setIntroductoryVersion, setNonEditableReason, setResourceProvider, setResourceProviderID, setSources, setUndefinedState, toString
-
-
-
-
Field Detail
-
selectableTypes
@CheckForNull private java.util.Collection selectableTypes
The collection of selectable elements class types.
-
displayableTypes
@CheckForNull private java.util.Collection displayableTypes
The collection of displayable elements class types.
-
useUnspecified
private boolean useUnspecified
Canbe selected or not?
-
parentApplicant
private boolean parentApplicant
The selected element intends to be the parent for other element.
-
containment
private boolean containment
Flag indicates if the element is contained
-
typeElement
private boolean typeElement
Type element flag
-
project
@CheckForNull private Project project
Project to which the element belongs.
-
selectableRestrictedElements
@CheckForNull private java.util.Collection selectableRestrictedElements
Stereotypes and metaclasses for filtering selectable elements
-
-
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:
getClassType
in interfacePropertyVisitorAcceptor
- Overrides:
getClassType
in 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:
setSelectableTypes
in 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:
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
@CheckForNull public java.util.Collection getSelectableTypes()
Returns selectable elements class types.- Specified by:
getSelectableTypes
in interfacecom.nomagic.magicdraw.properties.ElementFilterProperty
- Returns:
- selectable types.
-
getDisplayableTypes
@CheckForNull public java.util.Collection 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
public void setValue(@CheckForNull java.lang.Object value)
Sets new property value. Will fire aPropertyChangeEvent
with 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:
accept
in interfacePropertyVisitorAcceptor
- Overrides:
accept
in classProperty
- Parameters:
v
- the PropertyVisitor.- Throws:
java.lang.Exception
-
getValueStringRepresentation
public java.lang.String 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
public static java.lang.String getStringRepresentation(@CheckForNull java.lang.Object element)
-
setProject
public void setProject(@CheckForNull Project project)
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
public java.util.Collection getSelectableRestrictedElements()
Returns a stereotypes and metaclasses for filtering selectable elements- Specified by:
getSelectableRestrictedElements
in 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:
setSelectableRestrictedElements
in 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:
setPropertyData
in interfacecom.nomagic.magicdraw.properties.ElementFilterProperty
-
isOrdered
public boolean isOrdered()
- Specified by:
isOrdered
in interfacecom.nomagic.magicdraw.properties.ElementFilterProperty
- See Also:
ElementFilterProperty.isOrdered()
-
setOrdered
public void setOrdered(boolean ordered)
- Specified by:
setOrdered
in interfacecom.nomagic.magicdraw.properties.ElementFilterProperty
- See Also:
ElementFilterProperty.setOrdered(boolean)
-
-