@OpenApiAll public class PropertyManager extends java.lang.Object implements java.lang.Cloneable, java.beans.PropertyChangeListener, PropertyVisitorAcceptor
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
IS_UNIQUE
Identifies the property as "unique".
|
protected com.nomagic.utils.ExtendedPropertyChangeSupport |
mSupport
PropertyChangeListeners support. |
static java.lang.String |
OWN_PROPERTY_ADDED
Identifies type of
PropertyChangeEvent . |
static java.lang.String |
OWN_PROPERTY_REMOVED
Identifies type of
PropertyChangeEvent . |
Constructor and Description |
---|
PropertyManager()
Constructs new property manager
|
PropertyManager(PropertyManager parentPropertyManager,
java.lang.String name,
java.util.List<? extends Property> properties)
Constructs new property manager.
|
PropertyManager(java.lang.String name,
java.util.List<? extends Property> properties)
Constructs new property manager.
|
Modifier and Type | Method and Description |
---|---|
void |
accept(PropertyVisitor visitor)
Accepts the given visitor.
|
void |
addProperties(java.util.Collection<Property> properties)
Adds the properties to the property manager.
|
void |
addProperty(Property prop)
Adds the property to the property manager.
|
void |
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds
PropertyChangeListener to the listeners list. |
void |
append(java.util.List<Property> properties)
Adds not existing properties from given list to itself.
|
void |
append(java.util.List<Property> properties,
boolean makeUndefined,
boolean mergeSources)
Adds not existing properties from given list to itself.
|
void |
append(PropertyManager manager)
Adds not existing properties from given manager to itself.
|
void |
append(PropertyManager manager,
boolean makeUndefined,
boolean mergeSources)
Adds not existing properties from given manager to itself.
|
void |
apply(java.util.Collection<Property> properties)
Applies properties from given list.
|
void |
apply(PropertyManager manager)
Applies properties from given manager.
|
void |
applyValues(java.util.Collection<Property> col)
Applies properties values only from given list.
|
PropertyManager |
clone()
Clones the manager.
|
static java.util.List<Property> |
cloneProperties(java.util.List<Property> properties) |
java.util.List<Property> |
distinct(java.util.List<Property> properties)
Returns properties those are not equal to the given properties.
|
void |
distinct(PropertyManager man)
Sets to itself properties those are not equal to the given properties.
|
boolean |
equalsTo(PropertyManager given) |
boolean |
equalsWithValues(PropertyManager pm,
java.util.Set<java.lang.String> ids)
Check it equals with given property value.
|
static void |
generateDefaultDescriptionID(PropertyManager manager) |
static void |
generateNullDescriptionID(PropertyManager manager) |
java.lang.String |
getClassType()
Returns property class type.
|
java.util.Collection<java.lang.String> |
getHiddenProperties() |
java.lang.String |
getID()
Get ID
|
java.lang.String |
getName()
Returns name of the property manager.
|
java.util.List<Property> |
getOrderedProperties()
Returns list of properties.
|
java.util.List<Property> |
getOwnProperties()
Returns the list of the properties.
|
PropertyManager |
getParentPropertyManager() |
java.util.List<Property> |
getProperties()
Returns the list of the properties.
|
Property |
getProperty(java.lang.String id)
Returns the property from the properties list with given id.
|
Property |
getPropertyByName(java.lang.String name)
Returns property from the properties list with given name.
|
Style |
getStyle()
Get property style.
|
void |
hideParentProperty(java.lang.String propertyID)
Hides given property with id from parent property manager.
|
boolean |
isFrozen() |
boolean |
isHiddenParentProperty(java.lang.String propertyID)
Check if property with a given ID is hidden parent property
|
boolean |
isTheSame(PropertyManager manager)
Check if given property manager is the same as current.
|
void |
leaveTheSame(PropertyManager manager)
Removes from this manager all properties those does not exist in the given manager.
|
void |
leaveTheSame(PropertyManager manager,
boolean makeUndefined,
boolean mergeSources)
Removes from this manager all properties those does not exist in the given manager.
|
PropertyManager |
makeCopy()
Make copy of property.
|
void |
makeOwnProperty(Property prop)
Makes given property as own property even if property with such id is in parent (makes property not shared)
|
protected void |
mergeBooleanProperty(BooleanProperty currentProp,
BooleanProperty otherProp) |
protected void |
mergeChoiceProperty(ChoiceProperty currentProperty,
ChoiceProperty otherProperty) |
protected void |
mergeElementProperty(ElementProperty currentProp,
ElementProperty otherProp) |
protected void |
mergeProperties(Property currentManagerProperty,
Property property,
boolean makeUndefined,
boolean mergeSources) |
protected void |
mergePropertyByType(Property currentProperty,
Property otherProperty) |
void |
propertyChange(java.beans.PropertyChangeEvent e)
Listens to
PropertyChangeEvents . |
void |
removeProperty(java.util.Collection<java.lang.String> propertyIDs)
Removes all properties with given ids.
|
void |
removeProperty(Property prop)
Removes the property from the property manager.
|
void |
removeProperty(java.lang.String id)
Removes the property with given ID from the property manager.
|
void |
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes
PropertyChangeListener from the listeners list. |
void |
retainProperties(java.util.Collection<java.lang.String> ids)
Removes all properties except the the ones with given ids.
|
void |
setFrozen(boolean mFrozen) |
void |
setID(java.lang.String id)
Sets id for this property manager.
|
void |
setName(java.lang.String name)
Sets name of the manager.
|
void |
setParentPropertyManager(PropertyManager parentPropertyManager)
Set parent Property Manager.
|
void |
setParentPropertyManagerOnly(PropertyManager parentPropertyManager)
Set parent Property Manager.
|
void |
setProperties(java.util.List<Property> prop)
Sets the list of the properties.
|
void |
setPropertyEnableMap(java.lang.String propertyId,
java.lang.Object[][] map)
Set Property Enable Map
|
void |
setStyle(Style style)
Set style.
|
java.lang.String |
sGetID()
Property manager simple ID getter (does not generate ID if it is not present).
|
void |
shareProperty(Property prop)
Makes given property shared form parent PropertyManager.
|
void |
showParentProperty(java.lang.String propertyID)
Show parent property.
|
java.lang.String |
toString()
Returns info used for debug.
|
public static final java.lang.String OWN_PROPERTY_ADDED
PropertyChangeEvent
. This type of even is fired
when particular property is added to PropertyManager
own properties collection.
It may be triggered by addProperty(Property)
or makeOwnProperty(Property)
method call.public static final java.lang.String OWN_PROPERTY_REMOVED
PropertyChangeEvent
. This type of even is fired
when particular property is removed from PropertyManager
own properties collection.
It may be triggered by removeProperty(Property)
or shareProperty(Property)
method call.public static final java.lang.String IS_UNIQUE
Property.setAdditionalProperty(String, Object)
:
property.setAdditionalProperty(PropertyManager.IS_UNIQUE, true);
leaveTheSame(PropertyManager, boolean, boolean)
method.@CheckForNull protected com.nomagic.utils.ExtendedPropertyChangeSupport mSupport
PropertyChangeListeners
support. Used to fire
events when own properties collection changes.public PropertyManager()
public PropertyManager(@CheckForNull java.lang.String name, @CheckForNull java.util.List<? extends Property> properties)
name
- the name of the manager.properties
- the list of properties.public PropertyManager(@CheckForNull PropertyManager parentPropertyManager, @CheckForNull java.lang.String name, @CheckForNull java.util.List<? extends Property> properties)
name
- the name of the manager.properties
- the list of properties.parentPropertyManager
- parent property manager which can provides properties can be shared in this manager.@CheckForNull public java.util.Collection<java.lang.String> getHiddenProperties()
public java.lang.String getID()
@CheckForNull public java.lang.String sGetID()
null
@CheckForNull public PropertyManager getParentPropertyManager()
public void setParentPropertyManager(@CheckForNull PropertyManager parentPropertyManager)
parentPropertyManager
- parent managerpublic void setParentPropertyManagerOnly(@CheckForNull PropertyManager parentPropertyManager)
parentPropertyManager
- parent manager@CheckForNull public Property getProperty(java.lang.String id)
id
- the ID of property.@CheckForNull public Property getPropertyByName(java.lang.String name)
name
- name of the propertypublic void addProperty(Property prop)
prop
- the new property.public void addProperties(java.util.Collection<Property> properties)
properties
- the new properties.public void removeProperty(Property prop)
prop
- the property.public void removeProperty(java.lang.String id)
id
- the property's ID.public java.util.List<Property> getProperties()
public java.util.List<Property> getOwnProperties()
public void setProperties(java.util.List<Property> prop)
prop
- the list of new properties for this manager.public java.util.List<Property> getOrderedProperties()
public PropertyManager clone()
clone
in class java.lang.Object
public static java.util.List<Property> cloneProperties(java.util.List<Property> properties)
public PropertyManager makeCopy()
public void apply(PropertyManager manager)
manager
- manager which properties will be applied to this.apply(Collection)
public void apply(java.util.Collection<Property> properties)
properties
- collection of properties to be applied to this.public void applyValues(java.util.Collection<Property> col)
col
- collection of properties to be applied to this.public void leaveTheSame(PropertyManager manager)
manager
- the given manager.public void leaveTheSame(PropertyManager manager, boolean makeUndefined, boolean mergeSources)
manager
- the given manager.makeUndefined
- existing property in this manager will be set to undefined state if property in given manager has different value.mergeSources
- if true, properties sources will be mergedprotected void mergeProperties(Property currentManagerProperty, Property property, boolean makeUndefined, boolean mergeSources)
protected void mergePropertyByType(Property currentProperty, Property otherProperty)
protected void mergeBooleanProperty(BooleanProperty currentProp, BooleanProperty otherProp)
protected void mergeElementProperty(ElementProperty currentProp, ElementProperty otherProp)
protected void mergeChoiceProperty(ChoiceProperty currentProperty, ChoiceProperty otherProperty)
public void setName(java.lang.String name)
name
- the new name.public java.lang.String getName()
public java.util.List<Property> distinct(java.util.List<Property> properties)
properties
- the given properties.public void distinct(PropertyManager man)
man
- the manager with given properties.public void propertyChange(java.beans.PropertyChangeEvent e)
PropertyChangeEvents
. Takes new value from the
event(new value must be a list of properties) and sets these properties
to itself.propertyChange
in interface java.beans.PropertyChangeListener
e
- the property change event.public void accept(PropertyVisitor visitor) throws java.lang.Exception
accept
in interface PropertyVisitorAcceptor
visitor
- the PropertyVisitor.java.lang.Exception
public java.lang.String getClassType()
getClassType
in interface PropertyVisitorAcceptor
PropertyID.PROPERTY_MANAGER
public void append(PropertyManager manager)
manager
- the manager with properties.public void append(PropertyManager manager, boolean makeUndefined, boolean mergeSources)
manager
- the manager with properties.makeUndefined
- existing property in this manager will be set to undefined state if property in given manager has different value.mergeSources
- if true, properties sources will be mergedpublic void append(java.util.List<Property> properties)
properties
- the list of given properties.public void append(java.util.List<Property> properties, boolean makeUndefined, boolean mergeSources)
properties
- the list of given properties.makeUndefined
- existing property in this manager will be set to undefined state if property in given manager has different value.mergeSources
- if true, properties sources will be mergedpublic java.lang.String toString()
toString
in class java.lang.Object
public void shareProperty(Property prop)
prop
- property to share.public void makeOwnProperty(Property prop)
prop
- propertypublic void hideParentProperty(java.lang.String propertyID)
propertyID
- property ID to hide from parent manager;public boolean isHiddenParentProperty(java.lang.String propertyID)
propertyID
- property IDpublic void showParentProperty(java.lang.String propertyID)
propertyID
- property IDpublic void setID(@CheckForNull java.lang.String id)
id
- new id of this property manager.@CheckForNull public Style getStyle()
public void setStyle(@CheckForNull Style style)
style
- The style to set.public void setPropertyEnableMap(java.lang.String propertyId, java.lang.Object[][] map)
propertyId
- Property id.map
- mappublic void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
PropertyChangeListener
to the listeners list.
Each listeners receives OWN_PROPERTY_ADDED
and OWN_PROPERTY_REMOVED
event types.listener
- the PropertyChangeListener
to be addedPropertyChangeSupport
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
PropertyChangeListener
from the listeners list.
Each listeners receives OWN_PROPERTY_ADDED
and OWN_PROPERTY_REMOVED
event types.listener
- the PropertyChangeListener to be removedPropertyChangeSupport
public boolean equalsTo(PropertyManager given)
public static void generateDefaultDescriptionID(PropertyManager manager)
public static void generateNullDescriptionID(PropertyManager manager)
public boolean equalsWithValues(PropertyManager pm, java.util.Set<java.lang.String> ids)
pm
- The given property value.ids
- properties IDs to check (may be null - to check all properties)public void removeProperty(java.util.Collection<java.lang.String> propertyIDs)
propertyIDs
- ids of the properties to remove from the manager.public void retainProperties(java.util.Collection<java.lang.String> ids)
ids
- ids of the properties to leave in the manager.public boolean isTheSame(PropertyManager manager)
manager
- managerpublic boolean isFrozen()
public void setFrozen(boolean mFrozen)