Package com.nomagic.magicdraw.properties
Class ChoiceProperty
java.lang.Object
com.nomagic.magicdraw.properties.Property
com.nomagic.magicdraw.properties.AbstractChoiceProperty
com.nomagic.magicdraw.properties.ChoiceProperty
- All Implemented Interfaces:
PropertyVisitorAcceptor,Cloneable
- Direct Known Subclasses:
LocaleProperty
The property selecting some value from a list of possible values or entering a new String value.
-
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
ConstructorsConstructorDescriptionDefault constructor.ChoiceProperty(String id, int index, List choice) The constructor.ChoiceProperty(String id, int index, List choice, int max) The constructor.ChoiceProperty(String id, Object value, List choice) The constructor.ChoiceProperty(String id, Object value, List choice, int max) The constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidAccepts thePropertyVisitor.clone()Clones the property.Returns property class type.intgetIndex()Returns the index of value in the choice list.booleanReturn append value flag.voidsetAppendValue(boolean appendValue) Sets the append value flag.voidSets the list of possible values for selecting.voidsetIndex(int val) Sets index of selected value.voidSets value of the property.toString()The string representation of the property.Methods inherited from class com.nomagic.magicdraw.properties.AbstractChoiceProperty
getChoice, isEditableValue, isUndefinedStateAvailable, isValuesTranslatable, setEditableValue, setUndefinedStateAvailable, setValuesTranslatableMethods inherited from class com.nomagic.magicdraw.properties.Property
_getValue, _isFrozen, _setFrozen, _setValue, addAnnotation, addPropertyChangeListener, addSource, addSources, areEqualByValue, areValuesEqual, checkFrozen, checkFrozen, 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, getValue, getValueStringRepresentation, hashCode, isEditable, isUndefinedState, isValueCompatible, removeAnnotation, removePropertyChangeListener, setAdditionalProperties, setAdditionalProperty, setAnnotations, setDescription, setDescriptionID, setEditable, setGroup, setID, setIntroductoryVersion, setNonEditableReason, setResourceProvider, setResourceProviderID, setSources, setUndefinedState
-
Constructor Details
-
ChoiceProperty
public ChoiceProperty()Default constructor. Value of the property will be null. ID will be empty string. -
ChoiceProperty
The constructor.- Parameters:
id- the ID of property.value- the value of the property.choice- the list of possible values.
-
ChoiceProperty
The constructor.- Parameters:
id- the ID of property.value- the value of the property.choice- the list of possible values.max- the maximum size of possible values list.
-
ChoiceProperty
The constructor.- Parameters:
id- the ID of property.index- the index in choice of selected value.choice- the list of possible values.max- the maximum size of possible values list.
-
ChoiceProperty
The constructor.- Parameters:
id- the ID of property.index- the index in choice of selected value.choice- the list of possible values.
-
-
Method Details
-
isAppendValue
public boolean isAppendValue()Return append value flag.- Returns:
- the appendValue flag.
-
setAppendValue
public void setAppendValue(boolean appendValue) Sets the append value flag. If property is editable, entered value is appended to the choice.- Parameters:
appendValue- the append state of the property.
-
accept
Accepts thePropertyVisitor.- Specified by:
acceptin interfacePropertyVisitorAcceptor- Overrides:
acceptin classProperty- Parameters:
v- the given visitor.- Throws:
Exception
-
getIndex
public int getIndex()Returns the index of value in the choice list.- Returns:
- index of value in the choice list; if value is not in the choice list, return -1.
-
setChoice
Sets the list of possible values for selecting. Sets only mMaximum number of values from the List's beginning.- Overrides:
setChoicein classAbstractChoiceProperty- Parameters:
val- a new possible values list.
-
setIndex
public void setIndex(int val) Sets index of selected value. The index in possible values' list of new property value.- Parameters:
val- a new index.
-
setValue
Sets value of the property. -
getClassType
Returns property class type.- Specified by:
getClassTypein interfacePropertyVisitorAcceptor- Overrides:
getClassTypein classProperty- Returns:
- PropertyID.CHOICE_PROPERTY.
- See Also:
-
toString
The string representation of the property. Used for debugging purposes only. -
clone
Description copied from class:PropertyClones the property. Clone is not deep, the clone will have the same instance of value. The clone will not have registered PropertyChangeListeners.- Overrides:
clonein classAbstractChoiceProperty- Returns:
- the cloned property.
-