Package com.nomagic.magicdraw.properties
Class ColorProperty
- java.lang.Object
-
- com.nomagic.magicdraw.properties.Property
-
- com.nomagic.magicdraw.properties.ColorProperty
-
- All Implemented Interfaces:
PropertyVisitorAcceptor
,java.lang.Cloneable
@OpenApiAll public class ColorProperty extends Property
The property for storing and editing some Color value.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ALLOW_NONE
-
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 ColorProperty()
Default constructor.ColorProperty(java.lang.String id, java.awt.Color value)
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.ColorProperty
clone()
Clones the property.java.lang.String
getClassType()
Returns property class type.java.awt.Color
getColor()
Returns value as color object.static java.lang.String
getStringRepresentation(java.awt.Color c)
java.lang.String
getValueStringRepresentation()
Returns value's string representation.protected boolean
isValueCompatible(java.lang.Object 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, getValue, hashCode, isEditable, isUndefinedState, removeAnnotation, removePropertyChangeListener, setAdditionalProperties, setAdditionalProperty, setAnnotations, setDescription, setDescriptionID, setEditable, setGroup, setID, setIntroductoryVersion, setNonEditableReason, setResourceProvider, setResourceProviderID, setSources, setUndefinedState, setValue, toString
-
-
-
-
Field Detail
-
ALLOW_NONE
public static final java.lang.String ALLOW_NONE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ColorProperty
public ColorProperty()
Default constructor. Value of the property will be null. ID will be empty string.
-
ColorProperty
public ColorProperty(java.lang.String id, @CheckForNull java.awt.Color value)
The property constructor.- Parameters:
id
- the ID of property.value
- the color value of the property.
-
-
Method Detail
-
getValueStringRepresentation
public java.lang.String getValueStringRepresentation()
Returns value's string representation.- Overrides:
getValueStringRepresentation
in classProperty
- Returns:
- value's string representation - "RGB [red, green, blue]". If value null, returns "
".
-
getStringRepresentation
public static java.lang.String getStringRepresentation(java.awt.Color c)
-
isValueCompatible
protected boolean isValueCompatible(java.lang.Object value)
- Overrides:
isValueCompatible
in classProperty
- Returns:
- true if given object can be assigned as value to this property
-
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
-
getColor
public java.awt.Color getColor()
Returns value as color object.- Returns:
- value as color.
-
getClassType
public java.lang.String getClassType()
Returns property class type.- Specified by:
getClassType
in interfacePropertyVisitorAcceptor
- Overrides:
getClassType
in classProperty
- Returns:
- PropertyID.COLOR_PROPERTY
- See Also:
PropertyID.COLOR_PROPERTY
-
clone
public ColorProperty clone()
Description copied from class:Property
Clones the property. Clone is not deep, the clone will have the same instance of value. The clone will not have registered PropertyChangeListeners.
-
-