convertPropertyValue,
setPropertyValueNoBroadcast and
getPropertyValue(Property) one can determine how
property values are stored.
When using the supplied implementations of this class then the member variables which
hold property values have to be declared in the class which inherits last in the inheriting
chain and they have to be publicProperties have to be registered by one of the registerProperty methods. They take among other arguments an Object named id which has to be a String that represents the name of the member variable. The registering has to occur in the constructor of the inheriting class. It is no allowed to add or change properties later on.
Example:
public class Foo extends PropertySet
{
protected int intProp;
public Foo()
{
registerProperty("PropertyA", 0, new Type(int.class), (short)0, "intProp");
}
}
| Modifier and Type | Class and Description |
|---|---|
| private class |
| Modifier and Type | Field and Description |
|---|---|
| private HashMap | |
| private HashMap | |
| private HashMap | |
| protected MultiTypeInterfaceContainer | |
| private com. | |
| protected MultiTypeInterfaceContainer | |
| private int | |
| protected com. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | addPropertiesChangeListener(String[] propNames, com.
|
| public synchronized void | addPropertyChangeListener(String str, com.
|
| public synchronized void | addVetoableChangeListener(String str, com.
|
| protected void | assignPropertyId(com.
The Property object that is being assigned an id. prop,The object which identifies the storage used for the property's value. id)Assigns an identifier object to a Property object so that the identifier
can be obtained by |
| private boolean | |
| private Object | |
| protected boolean | Returns: true - Conversion was successful. newVal contains a valid value for the property. false - conversion failed for some reason.- in-param property for which the data is to be converted. property,- out-param which contains the converted value on return. newVal, Object[] - out-param the current value of the property. It is used in calls to the
XVetoableChangeListener and XPropertyChangeListener. curVal, Object - in-param. The value that is to be converted so that it matches Property and the internally used
dataformat for that property. setVal)Converts a value in a way so that it is appropriate for storing as a property value, that is
|
| protected void | fire(com.
Properties which will be or have been affected. properties,the new values of the properties. newValues, Object[] the old values of the properties. oldValues, boolean true means fire to VetoableChangeListener, false means fire to
XPropertyChangedListener and XMultiPropertyChangedListener. bVetoable)This method fires events to XPropertyChangeListener,XVetoableChangeListener and XPropertiesChangeListener event sinks. |
| public void | firePropertiesChangeEvent(String[] propNames, com.
|
| public Object | |
| protected com. | Returns: Array of all Property objects.Returns an array of all Property objects or an array of length null if there are no properties. |
| protected com. | Returns: The Property object with the name propertyName.The name of the property (Property.Name) propertyName)Returns the Property object for a given property name or null if that property does not exists (i.e. it has not been registered). |
| protected com. | Returns: The Property object with the handle nHandleThe handle of the property (Property.Handle). nHandle)Returns the Property object with a handle (Property.Handle) as specified by the argument nHandle. |
| protected Object | Returns: The id object that identifies the storage used for the property's value.The property for which the id is to be retrieved. propReturns the identifier object for a certain Property. |
| public synchronized com. | |
| public Object | |
| protected Object | Returns: The value of the property.The property for which the value is to be retrieved. propertyRetrieves the value of a property. |
| public Object[] | getPropertyValues(String[] propNames)
If a value for a property could not be retrieved then the respective element in the returned array has the value null. |
| protected void | initMappings()
Initializes data structures used for mappings of property names to property object, property handles to property objects and property objects to id objects. |
| protected void | postDisposing()
Overrides com. Makes sure that listeners which are kept in aBoundLC (XPropertyChangeListener) and aVetoableLC (XVetoableChangeListener) receive a disposing call. |
| protected void | putProperty(com.
The Property object that is to be stored. propStores a Property object so that it can be retrieved subsequently by
|
| protected void | registerProperty(com.
The property to be registered. prop,Identifies the properties storage. id)Registers a property with this helper class and associates the argument id with it. |
| protected void | registerProperty(String
The property's name (Property.Name). name, int The property's handle (Property.Handle). handle, Type The property's type (Property.Type). type, short The property's attributes (Property.Attributes). attributes, Object Identifies the property's storage. id)Registers a property with this helper class and associates the argument id with it. |
| protected void | registerProperty(String
The property's name (Property.Name). name, Type The property's type (Property.Type). type, short The property's attributes (Property.Attributes). attributes, Object Identifies the property's storage. id)Registers a property with this class and associates the argument id with it. |
| protected void | registerProperty(String
The name of the property. propertyName, String The name of the member variable that holds the value of the property. memberName, short The property attributes. attributes)Registers a property with this class. |
| protected void | registerProperty(String
The name of the property and the member variable that holds the property's value. propertyName, short The property attributes. attributes)Registers a property with this class. |
| public void | removePropertiesChangeListener(com.
|
| public synchronized void | |
| public synchronized void | |
| public void | |
| public void | setPropertyValue(String
The name of the property. name, Object The new value of the property. value)Sets the value of a property. |
| protected void | setPropertyValue(com.
The property whose value is to be set. prop,The new value for the property. value)Sets the value of a property. |
| protected void | setPropertyValueNoBroadcast(com.
the property for which the new value is set property,the new value for the property. newVal)Sets the value of a property. |
| public void | setPropertyValues(String[] propNames, Object[] values)
If the array of property names contains an unknown property then it will be ignored. |
| _handleToPropertyMap | back to summary |
|---|---|
| private HashMap<Integer, com. | |
| _nameToPropertyMap | back to summary |
|---|---|
| private HashMap<String, com. | |
| _propertyToIdMap | back to summary |
|---|---|
| private HashMap<com. | |
| aBoundLC | back to summary |
|---|---|
| protected MultiTypeInterfaceContainer aBoundLC | |
| arProperties | back to summary |
|---|---|
| private com. | |
| aVetoableLC | back to summary |
|---|---|
| protected MultiTypeInterfaceContainer aVetoableLC | |
| lastHandle | back to summary |
|---|---|
| private int lastHandle | |
| propertySetInfo | back to summary |
|---|---|
| protected com. | |
| PropertySet | back to summary |
|---|---|
| public PropertySet() | |
| addPropertiesChangeListener | back to summary |
|---|---|
| public void addPropertiesChangeListener(String[] propNames, com. | |
| addPropertyChangeListener | back to summary |
|---|---|
| public synchronized void addPropertyChangeListener(String str, com. | |
| addVetoableChangeListener | back to summary |
|---|---|
| public synchronized void addVetoableChangeListener(String str, com. | |
| assignPropertyId | back to summary |
|---|---|
| protected void assignPropertyId(com. Assigns an identifier object to a Property object so that the identifier
can be obtained by
| |
| checkType | back to summary |
|---|---|
| private boolean checkType(Object obj) | |
| convert | back to summary |
|---|---|
| private Object convert(Class<T> cl, Object obj) throws com.sun.star.lang.IllegalArgumentException | |
| convertPropertyValue | back to summary |
|---|---|
| protected boolean convertPropertyValue(com. Converts a value in a way so that it is appropriate for storing as a property value, that is
This method converts values by help of the com.sun.star.uno.AnyConverter which only does a few widening conversions on integer types and floating point types. For example, there is the property PropA with a Type equivalent to int.class and the value of the property is to be stored in a member variable of type int with name intProp. Then setPropertyValue is called: set.setPropertyValue( "PropA", Byte.valueOf( (byte)111));At some point setPropertyValue will call convertPropertyValue and pass in the Byte object. Since we allow that Byte values can be used with the property and know that the value is to be stored in intProp (type int) we convert the Byte object into an Integer object which is then returned in the out-parameter newVal. This conversion is actually performed by the AnyConverter. Later the setPropertyValueNoBroadcast is called with that Integer object and the int value can be easily extracted from the object and be assigned to the member intProp. The method handles Any arguments the same as Object arguments. That is, the setVal argument can be a java.lang.Boolean or a com.sun.star.uno.Any containing a java.lang.Boolean. Likewise, a member containing a property value can be a com.sun.star.uno.Any or a java.lang.Object. Then, no conversion is necessary, since they can hold all possible values. However, if the member is an Object and setVal is an Any then the object contained in the any is assigned to the member. The extra type information which exists as Type object in the Any will get lost. If this is not intended then use an Any variable rather than an Object. If a member is an Object or Any and the argument setVal is an Object, other than String or array, then it is presumed to be a UNO object and queried for XInterface. If successful, the out-param newVal returns the XInterface. If a member is a UNO interface, then setVal is queried for this interface and the result is returned. If setVal is null then newVal will be null too after return. If a property value is stored using a primitive type the out-parameters curVal and newVal contain the respective wrapper class (e.g.java.lang.Byte, etc.). curVal is used in calls to the XVetoableChangeListener and XPropertyChangeListener.
| |
| fire | back to summary |
|---|---|
| protected void fire(com. This method fires events to XPropertyChangeListener,XVetoableChangeListener and XPropertiesChangeListener event sinks. To distinguish what listeners are to be called the argument bVetoable is to be set to true if a XVetoableChangeListener is meant. For XPropertyChangeListener and XPropertiesChangeListener it is to be set to false.
| |
| firePropertiesChangeEvent | back to summary |
|---|---|
| public void firePropertiesChangeEvent(String[] propNames, com. | |
| getFastPropertyValue | back to summary |
|---|---|
| public Object getFastPropertyValue(int nHandle) throws com.sun.star.beans.UnknownPropertyException, com.sun.star.lang.WrappedTargetException | |
| getProperties | back to summary |
|---|---|
| protected com. Returns an array of all Property objects or an array of length null if there
are no properties. Override this method if you want to implement your own mapping from names
to Property objects. Then you also have to override
| |
| getProperty | back to summary |
|---|---|
| protected com. Returns the Property object for a given property name or null if that property does
not exists (i.e. it has not been registered). Override this method
if you want to implement your own mapping from property names to Property objects.
Then you also have to override
| |
| getPropertyByHandle | back to summary |
|---|---|
| protected com. Returns the Property object with a handle (Property.Handle) as specified by the argument
nHandle. The method returns null if there is no such property (i.e. it has not
been registered). Override this method if you want to implement your own mapping from handles
to Property objects. Then you also have to override
| |
| getPropertyId | back to summary |
|---|---|
| protected Object getPropertyId(com. Returns the identifier object for a certain Property. The object must have been
previously assigned to the Property object by
| |
| getPropertySetInfo | back to summary |
|---|---|
| public synchronized com. | |
| getPropertyValue | back to summary |
|---|---|
| public Object getPropertyValue(String name) throws com.sun.star.beans.UnknownPropertyException, com.sun.star.lang.WrappedTargetException | |
| getPropertyValue | back to summary |
|---|---|
| protected Object getPropertyValue(com. Retrieves the value of a property. This implementation presumes that the values are stored in member variables
of the furthest inheriting class (see
| |
| getPropertyValues | back to summary |
|---|---|
| public Object[] getPropertyValues(String[] propNames) If a value for a property could not be retrieved then the respective element in the returned array has the value null. | |
| initMappings | back to summary |
|---|---|
| protected void initMappings() Initializes data structures used for mappings of property names to property object,
property handles to property objects and property objects to id objects.
Override this method if you want to implement your own mappings. Then you also need to
override | |
| postDisposing | back to summary |
|---|---|
| protected void postDisposing() Overrides com. Makes sure that listeners which are kept in aBoundLC (XPropertyChangeListener) and aVetoableLC (XVetoableChangeListener) receive a disposing call. Also those listeners are released.
| |
| putProperty | back to summary |
|---|---|
| protected void putProperty(com. Stores a Property object so that it can be retrieved subsequently by
| |
| registerProperty | back to summary |
|---|---|
| protected void registerProperty(com. Registers a property with this helper class and associates the argument id with it.
id is used to identify the storage of the property value. How property values are stored
and retrieved is determined by the methods
| |
| registerProperty | back to summary |
|---|---|
| protected void registerProperty(String name, int handle, Type type, short attributes, Object id) Registers a property with this helper class and associates the argument id with it.
It does the same as | |
| registerProperty | back to summary |
|---|---|
| protected void registerProperty(String name, Type type, short attributes, Object id) Registers a property with this class and associates the argument id with it.
It does the same as | |
| registerProperty | back to summary |
|---|---|
| protected void registerProperty(String propertyName, String memberName, short attributes) Registers a property with this class. This method expects that property values
are stored in member variables as is the case if the methods convertPropertyValue,
setPropertyValueNoBroadcast and getPropertyValue(Property) are not overridden.
It is presumed that the type of the member variable
corresponds Property.Type. For example, if the TypeClass of Property.Type is to be
a TypeClass.SHORT then the member must be a short or java.lang.Short.
The handle for the property is generated. | |
| registerProperty | back to summary |
|---|---|
| protected void registerProperty(String propertyName, short attributes) Registers a property with this class. It is presumed that the name of property is equal to the name of the member variable that holds the property value.
| |
| removePropertiesChangeListener | back to summary |
|---|---|
| public void removePropertiesChangeListener(com. | |
| removePropertyChangeListener | back to summary |
|---|---|
| public synchronized void removePropertyChangeListener(String propName, com. | |
| removeVetoableChangeListener | back to summary |
|---|---|
| public synchronized void removeVetoableChangeListener(String propName, com. | |
| setFastPropertyValue | back to summary |
|---|---|
| public void setFastPropertyValue(int nHandle, Object aValue) throws com.sun.star.beans.UnknownPropertyException, com.sun.star.beans.PropertyVetoException, com.sun.star.lang.IllegalArgumentException, com.sun.star.lang.WrappedTargetException | |
| setPropertyValue | back to summary |
|---|---|
| public void setPropertyValue(String name, Object value) throws com.sun.star.beans.UnknownPropertyException, com.sun.star.beans.PropertyVetoException, com.sun.star.lang.IllegalArgumentException, com.sun.star.lang.WrappedTargetException Sets the value of a property. The idl description for this interfaces, stipulates that the argument value is an Any. Since a java.lang.Object reference has the same meaning as an Any this function accepts java anys (com.sun.star.uno.Any) and all other appropriate objects as arguments. The value argument can be one of these:
| |
| setPropertyValue | back to summary |
|---|---|
| protected void setPropertyValue(com. Sets the value of a property. It checks if the property's attributes (READONLY,MAYBEVOID), allow that the new value can be set. It also causes the notification of listeners.
| |
| setPropertyValueNoBroadcast | back to summary |
|---|---|
| protected void setPropertyValueNoBroadcast(com. Sets the value of a property. In this implementation property values are stored in member variables
(see
| |
| setPropertyValues | back to summary |
|---|---|
| public void setPropertyValues(String[] propNames, Object[] values) throws com.sun.star.beans.PropertyVetoException, com.sun.star.lang.IllegalArgumentException, com.sun.star.lang.WrappedTargetException If the array of property names contains an unknown property then it will be ignored. | |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public com. | |
| public com. | |
| public boolean |
| PropertySetInfo | back to summary |
|---|---|
| private PropertySetInfo() | |
| getProperties | back to summary |
|---|---|
| public com. | |
| getPropertyByName | back to summary |
|---|---|
| public com. | |
| hasPropertyByName | back to summary |
|---|---|
| public boolean hasPropertyByName(String name) | |