@OpenApiAll public class Property extends java.lang.Object implements java.lang.Cloneable, PropertyVisitorAcceptor
Modifier and Type | Field and Description |
---|---|
protected static PropertyResourceProvider |
DEFAULT_PROPERTY_RESOURCE_PROVIDER
Default property resource provider.
|
static java.lang.String |
EDITABLE
"Editable" property name
|
protected com.nomagic.utils.ArrayListMap |
mAdditionalProperties
Additional properties map
|
protected java.lang.String |
mDescriptionID
Property description ID.
|
protected boolean |
mEditable
If the property is not enabled then it's editor should be disabled.
|
protected java.lang.String |
mGroupName
Property group name
|
protected java.lang.String |
mID
Property ID.
|
protected PropertyResourceProvider |
mResourceProvider
The resource provider for this property.
|
protected java.util.Collection<com.nomagic.magicdraw.uml.ElementReference<java.lang.Object>> |
mSources
Source of the property.
|
protected com.nomagic.utils.ExtendedPropertyChangeSupport |
mSupport
PropertyChangeListeners support. |
protected boolean |
mUndefinedState
Set undefined state.
|
protected java.lang.Object |
mValue
The value of the property.
|
static java.lang.String |
NULL
Representation of null value as string.
|
static PropertyResourceProvider |
NULL_ID_PROPERTY_RESOURCE_PROVIDER
A resource provider which does not try to translate property ID.
|
static java.lang.String |
UNDEFINED
Property "undefined" state literal.
|
static java.lang.String |
VALUE
"Value" property name
|
Constructor and Description |
---|
Property()
Constructs new property.
|
Property(java.lang.String id,
java.lang.Object value)
The property constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
_isFrozen() |
void |
_setFrozen(boolean frozen)
This is an internal api method to mark property as frozen.
|
void |
accept(PropertyVisitor v)
Accepts the given visitor.
|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Delegates
addPropertyChangeListener to the
PropertyChangeSupport , the member of this class,
which adds a PropertyChangeListener to the listener list. |
void |
addSource(java.lang.Object source)
Add source object to a project.
|
void |
addSources(java.util.Collection<?> sources)
Append given sources to already existing ones.
|
protected boolean |
areValuesEqual(java.lang.Object oldValue,
java.lang.Object newValue)
Check if values are equal before setting new value.
|
Property |
clone()
Clones the property.
|
javax.swing.CellEditor |
createCellEditor(com.nomagic.magicdraw.properties.ui.jideui.RendererEditorFactory factory)
Returns the cell editor which edits this property in swing table.
|
javax.swing.table.TableCellRenderer |
createTableCellRenderer(com.nomagic.magicdraw.properties.ui.jideui.RendererEditorFactory factory)
Returns the cell renderer which renders this property in swing table.
|
boolean |
equals(java.lang.Object o)
Properties are equal if their id are equals.
|
void |
firePropertyChange(java.lang.String propertyName,
java.lang.Object oldValue,
java.lang.Object newValue)
Delegates
firePropertyChange to the
PropertyChangeSupport , the member of this class,
which reports a bound property update to any registered listeners. |
static java.lang.String |
generateDefaultDescriptionID(Property property)
Generates default property description id from property id
|
java.util.Map<java.lang.String,java.lang.Object> |
getAdditionalProperties()
Return a map structure of attached tags to this property.
|
java.lang.Object |
getAdditionalProperty(java.lang.String tag)
Return attached "tag" like string value
|
java.lang.String |
getClassType()
Returns property class type.
|
java.lang.String |
getDescription()
Returns property description from resource provider by property description id.
|
java.lang.String |
getDescriptionID()
Returns property description ID.
|
java.lang.String |
getGroup()
Returns group name for property.
|
java.lang.String |
getID()
Returns property id.
|
java.lang.String |
getIntroductoryVersion()
Get application version the property was introduced in.
|
java.lang.String |
getName()
Returns name of the property.
|
java.lang.String |
getNonEditableReason()
Returns the property reason
|
Project |
getProjectFromSourcesOrActive()
Looks for a project of property's sources
|
java.lang.String |
getPureDescription()
Returns pure description - does not goes into resource provider.
|
PropertyResourceProvider |
getResourceProvider()
Returns
PropertyResourceProvider . |
java.lang.String |
getResourceProviderID()
Returns Resource provider ID.
|
java.util.Collection<?> |
getSources()
Return a collection of property sources.
|
static java.lang.String |
getUndefinedString()
Returns representation string for "undefined" property state
|
static java.lang.String |
getUndefinedString(Property property)
Returns representation string for "undefined" property state.
|
java.lang.Object |
getValue()
Returns properties value.
|
java.lang.String |
getValueStringRepresentation()
Returns value's string representation.
|
int |
hashCode()
The hash code will be the same as ID's hash code.
|
boolean |
isEditable()
Gets mEnabled flag's value.
|
boolean |
isUndefinedState()
Returns value undefined state flag.
|
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Delegates
removePropertyChangeListener to the
PropertyChangeSupport , the member of this class,
which removes a PropertyChangeListener from the listener list. |
void |
setAdditionalProperties(java.util.Map<java.lang.String,java.lang.Object> tags)
Replace current tags with a new ones
|
void |
setAdditionalProperty(java.lang.String key,
java.lang.Object value)
Attach tag like key-value information to a property
|
void |
setDescription(java.lang.String description)
Set property description
|
void |
setDescriptionID(java.lang.String descriptionID)
Set property description ID.
|
void |
setEditable(boolean editable)
Set mEnabled flag's value.
|
void |
setGroup(java.lang.String group)
Sets new group name.
|
void |
setID(java.lang.String id)
Sets property id.
|
void |
setIntroductoryVersion(java.lang.String introductoryVersion)
Set application version property is introduced in.
|
void |
setNonEditableReason(java.lang.String reason)
Sets the property reason
|
void |
setResourceProvider(PropertyResourceProvider provider)
Sets PropertyResourceProvider for this property.
|
void |
setResourceProviderID(java.lang.String resourceProviderID)
Set resource provider ID.
|
void |
setSources(java.util.Collection<?> sources)
Set property's sources.
|
void |
setUndefinedState(boolean value)
Sets undefined state for this property.
|
void |
setValue(java.lang.Object value)
Sets new property value.
|
java.lang.String |
toString()
Return string representation of property for debug purposes.
|
public static final java.lang.String VALUE
public static final java.lang.String EDITABLE
public static final java.lang.String UNDEFINED
PropertyChangeEvent.getPropertyName()
return
this string when state of the property changes it's "undefined" state.setUndefinedState(boolean)
,
Constant Field Valuespublic static final java.lang.String NULL
protected static PropertyResourceProvider DEFAULT_PROPERTY_RESOURCE_PROVIDER
public static PropertyResourceProvider NULL_ID_PROPERTY_RESOURCE_PROVIDER
protected PropertyResourceProvider mResourceProvider
protected com.nomagic.utils.ExtendedPropertyChangeSupport mSupport
PropertyChangeListeners
support. Every property fires event
on value change.protected boolean mUndefinedState
protected java.lang.String mID
protected java.lang.String mDescriptionID
protected java.lang.Object mValue
protected java.lang.String mGroupName
protected boolean mEditable
protected java.util.Collection<com.nomagic.magicdraw.uml.ElementReference<java.lang.Object>> mSources
protected com.nomagic.utils.ArrayListMap mAdditionalProperties
public Property()
public Property(java.lang.String id, @CheckForNull java.lang.Object value)
id
- the ID of property.value
- the value of the property.public java.lang.String getName()
PropertyResourceProvider
with key - Property ID.public java.lang.String getID()
public void setID(java.lang.String id)
id
- a new property id.public void setValue(@CheckForNull java.lang.Object value)
PropertyChangeEvent
with propertyName - property
ID, newValue and oldValue.value
- a new property value.protected boolean areValuesEqual(java.lang.Object oldValue, java.lang.Object newValue)
oldValue
- current value.newValue
- new value.public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- some other Property.public int hashCode()
hashCode
in class java.lang.Object
public java.lang.Object getValue()
public java.lang.String getValueStringRepresentation()
value.
toString()
if property has value.public void accept(PropertyVisitor v) throws java.lang.Exception
accept
in interface PropertyVisitorAcceptor
v
- the PropertyVisitor.java.lang.Exception
@CheckForNull public javax.swing.CellEditor createCellEditor(com.nomagic.magicdraw.properties.ui.jideui.RendererEditorFactory factory)
factory
- factory@CheckForNull public javax.swing.table.TableCellRenderer createTableCellRenderer(com.nomagic.magicdraw.properties.ui.jideui.RendererEditorFactory factory)
factory
- factorypublic Property clone()
clone
in class java.lang.Object
public void setUndefinedState(boolean value)
value
- the new value of undefined state flag.public boolean isUndefinedState()
public java.lang.String getClassType()
getClassType
in interface PropertyVisitorAcceptor
PropertyID.PROPERTY
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
addPropertyChangeListener
to the
PropertyChangeSupport
, the member of this class,
which adds a PropertyChangeListener
to the listener list.listener
- the PropertyChangeListener
to be addedPropertyChangeSupport
public void firePropertyChange(java.lang.String propertyName, @CheckForNull java.lang.Object oldValue, @CheckForNull java.lang.Object newValue)
firePropertyChange
to the
PropertyChangeSupport
, the member of this class,
which reports a bound property update to any registered listeners.
No event is fired if old and new are equal and non-null.propertyName
- the programmatic name of the property that was changed.oldValue
- the old value of the propertynewValue
- the new value of the propertyPropertyChangeSupport
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
removePropertyChangeListener
to the
PropertyChangeSupport
, the member of this class,
which removes a PropertyChangeListener from the listener list.listener
- the PropertyChangeListener to be removedPropertyChangeSupport
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getResourceProviderID()
public void setResourceProviderID(java.lang.String resourceProviderID)
resourceProviderID
- resource provider idpublic void setResourceProvider(@CheckForNull PropertyResourceProvider provider)
provider
- the given provider.public PropertyResourceProvider getResourceProvider()
PropertyResourceProvider
. If property does not have
resource provider returns shared instance of
DefaultPropertyResourceProvider
.PropertyResourceProvider
or default one.public java.lang.String getGroup()
public void setGroup(@CheckForNull java.lang.String group)
group
- group name, can be null.public java.lang.String getDescriptionID()
public void setDescriptionID(@CheckForNull java.lang.String descriptionID)
descriptionID
- description id.public void setDescription(@CheckForNull java.lang.String description)
description
- description@CheckForNull public java.lang.String getDescription()
public java.lang.String getPureDescription()
public static java.lang.String generateDefaultDescriptionID(Property property)
property
- the given property.public boolean isEditable()
public void setEditable(boolean editable)
editable
- new value.public static java.lang.String getUndefinedString()
public static java.lang.String getUndefinedString(Property property)
QPropertiesHelper.UNDEFINED_STRING
.property
- property for which undefined string is get.public java.util.Collection<?> getSources()
setSources(java.util.Collection)
public void setSources(java.util.Collection<?> sources)
sources
- sourcesgetSources()
public void addSources(java.util.Collection<?> sources)
sources
- sources to appendgetSources()
public void addSource(java.lang.Object source)
source
- source objectgetSources()
@CheckForNull public java.lang.Object getAdditionalProperty(java.lang.String tag)
tag
- tag keypublic void setAdditionalProperty(java.lang.String key, @CheckForNull java.lang.Object value)
key
- tag keyvalue
- tag value@CheckForNull public java.util.Map<java.lang.String,java.lang.Object> getAdditionalProperties()
setAdditionalProperty(String, Object)
public void setAdditionalProperties(@CheckForNull java.util.Map<java.lang.String,java.lang.Object> tags)
tags
- new tagspublic boolean _isFrozen()
public void _setFrozen(boolean frozen)
frozen
- frozen property statepublic java.lang.String getNonEditableReason()
public void setNonEditableReason(java.lang.String reason)
reason
- reason why property is not editablepublic Project getProjectFromSourcesOrActive()
@CheckForNull public java.lang.String getIntroductoryVersion()
public void setIntroductoryVersion(@CheckForNull java.lang.String introductoryVersion)
introductoryVersion
- current application version or null