com.sun.star.lib.uno.helper

Class PropertySetMixin

public final class PropertySetMixin extends Object

A helper mixin to implement certain UNO interfaces related to property set handling on top of the attributes of a given UNO interface type.

A client will mix in this class by keeping a reference to an instance of this class, and forwarding all methods of (a subset of the interfaces) com.sun.star.beans.XPropertySet, com.sun.star.beans.XFastPropertySet, and com.sun.star.beans.XPropertyAccess to it.

Client code should not use the monitors associated with instances of this class, as they are used for internal purposes.

Since: UDK 3.2

Nested Class Summary
static classPropertySetMixin.BoundListeners
A class used by clients of PropertySetMixin when implementing UNO interface type attribute setter functions.
Constructor Summary
PropertySetMixin(XComponentContext context, XInterface object, Type type, String[] absentOptional)
The constructor.
Method Summary
voidaddPropertyChangeListener(String propertyName, XPropertyChangeListener listener)
Implements com.sun.star.beans.XPropertySet.addPropertyChangeListener.
voidaddVetoableChangeListener(String propertyName, XVetoableChangeListener listener)
Implements com.sun.star.beans.XPropertySet.addVetoableChangeListener.
voiddispose()
Marks this instance as being disposed.
ObjectgetFastPropertyValue(int handle)
Implements com.sun.star.beans.XFastPropertySet.getFastPropertyValue.
XPropertySetInfogetPropertySetInfo()
Implements com.sun.star.beans.XPropertySet.getPropertySetInfo.
ObjectgetPropertyValue(String propertyName)
Implements com.sun.star.beans.XPropertySet.getPropertyValue.
PropertyValue[]getPropertyValues()
Implements com.sun.star.beans.XPropertyAccess.getPropertyValues.
voidprepareSet(String propertyName, PropertySetMixin.BoundListeners bound)
A simplified version of PropertySetMixin.
voidremovePropertyChangeListener(String propertyName, XPropertyChangeListener listener)
Implements com.sun.star.beans.XPropertySet.removePropertyChangeListener.
voidremoveVetoableChangeListener(String propertyName, XVetoableChangeListener listener)
Implements com.sun.star.beans.XPropertySet.removeVetoableChangeListener.
voidsetFastPropertyValue(int handle, Object value)
Implements com.sun.star.beans.XFastPropertySet.setFastPropertyValue.
voidsetPropertyValue(String propertyName, Object value)
Implements com.sun.star.beans.XPropertySet.setPropertyValue.
voidsetPropertyValues(PropertyValue[] props)
Implements com.sun.star.beans.XPropertyAccess.setPropertyValues.

Constructor Detail

PropertySetMixin

public PropertySetMixin(XComponentContext context, XInterface object, Type type, String[] absentOptional)
The constructor.

Parameters: context the component context used by this instance; must not be null, and must supply the service com.sun.star.reflection.CoreReflection and the singleton com.sun.star.reflection.theTypeDescriptionManager object the client UNO object into which this instance is mixed in; must not be null, and must support the given type type the UNO interface type whose attributes are mapped to properties; must not be null, and must represent a UNO interface type absentOptional a list of optional properties that are not present, and should thus not be visible via com.sun.star.beans.XPropertySet.getPropertySetInfo, com.sun.star.beans.XPropertySet.addPropertyChangeListener, com.sun.star.beans.XPropertySet.removePropertyChangeListener, com.sun.star.beans.XPropertySet.addVetoableChangeListener, and com.sun.star.beans.XPropertySet.removeVetoableChangeListener; null is treated the same as an empty list; if non-null, the given array must not be modified after it is passed to this constructor. For consistency reasons, the given absentOptional should only contain the names of attributes that represent optional properties that are not present (that is, the attribute getters and setters always throw a com.sun.star.beans.UnknownPropertyException), and should contain each such name only once. If an optional property is not present (that is, the corresponding attribute getter and setter always throw a com.sun.star.beans.UnknownPropertyException) but is not contained in the given absentOptional, then it will be visible via com.sun.star.beans.XPropertySet.getPropertySetInfo as a com.sun.star.beans.Property with a set com.sun.star.beans.PropertyAttribute.OPTIONAL. If the given object does not implement com.sun.star.beans.XPropertySet, then the given absentOptional is effectively ignored and can be null or empty.

Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(String propertyName, XPropertyChangeListener listener)
Implements com.sun.star.beans.XPropertySet.addPropertyChangeListener.

If a listener is added more than once, it will receive all relevant notifications multiple times.

addVetoableChangeListener

public void addVetoableChangeListener(String propertyName, XVetoableChangeListener listener)
Implements com.sun.star.beans.XPropertySet.addVetoableChangeListener.

If a listener is added more than once, it will receive all relevant notifications multiple times.

dispose

public void dispose()
Marks this instance as being disposed.

See com.sun.star.lang.XComponent for the general concept of disposing UNO objects. On the first call to this method, all registered listeners (com.sun.star.beans.XPropertyChangeListeners and com.sun.star.beans.XVetoableChangeListeners) are notified of the disposing source. Any subsequent calls to this method are ignored.

getFastPropertyValue

public Object getFastPropertyValue(int handle)
Implements com.sun.star.beans.XFastPropertySet.getFastPropertyValue.

getPropertySetInfo

public XPropertySetInfo getPropertySetInfo()
Implements com.sun.star.beans.XPropertySet.getPropertySetInfo.

getPropertyValue

public Object getPropertyValue(String propertyName)
Implements com.sun.star.beans.XPropertySet.getPropertyValue.

getPropertyValues

public PropertyValue[] getPropertyValues()
Implements com.sun.star.beans.XPropertyAccess.getPropertyValues.

prepareSet

public void prepareSet(String propertyName, PropertySetMixin.BoundListeners bound)
A simplified version of PropertySetMixin.

This method is useful for attributes that are not constrained.

Parameters: propertyName the name of the property (which is the same as the name of the attribute that is going to be set) bound a reference to a fresh BoundListeners instance (which has not been passed to this method before, and on which BoundListeners has not yet been called); may only be null if the attribute that is going to be set is not bound

removePropertyChangeListener

public void removePropertyChangeListener(String propertyName, XPropertyChangeListener listener)
Implements com.sun.star.beans.XPropertySet.removePropertyChangeListener.

removeVetoableChangeListener

public void removeVetoableChangeListener(String propertyName, XVetoableChangeListener listener)
Implements com.sun.star.beans.XPropertySet.removeVetoableChangeListener.

setFastPropertyValue

public void setFastPropertyValue(int handle, Object value)
Implements com.sun.star.beans.XFastPropertySet.setFastPropertyValue.

setPropertyValue

public void setPropertyValue(String propertyName, Object value)
Implements com.sun.star.beans.XPropertySet.setPropertyValue.

setPropertyValues

public void setPropertyValues(PropertyValue[] props)
Implements com.sun.star.beans.XPropertyAccess.setPropertyValues.