bibliothek.gui.dock.util
Class PropertyValue<A>

java.lang.Object
  extended by bibliothek.gui.dock.util.PropertyValue<A>
Type Parameters:
A - the type of wrapper value

public abstract class PropertyValue<A>
extends Object

A wrapper for a value which is either read from DockProperties, or can be set by the client directly.

Author:
Benjamin Sigg

Constructor Summary
PropertyValue(PropertyKey<A> key)
          Creates a new value.
 
Method Summary
 PropertyKey<A> getKey()
          Gest the key which is used to access the value in DockProperties.
 A getOwnValue()
          Gets the value that was set through setValue(Object).
 DockProperties getProperties()
          Gets the currently observed properties.
 A getValue()
          Gets the current value.
 void setProperties(DockProperties properties)
          Sets the DockProperties which should be observed.
 void setValue(A value)
          Sets the current value.
protected abstract  void valueChanged(A oldValue, A newValue)
          Invoked when the value has been changed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyValue

public PropertyValue(PropertyKey<A> key)
Creates a new value.

Parameters:
key - the key used to access the value in DockProperties
Method Detail

setProperties

public void setProperties(DockProperties properties)
Sets the DockProperties which should be observed.

Parameters:
properties - the new properties, can be null

getProperties

public DockProperties getProperties()
Gets the currently observed properties.

Returns:
the map, or null

getKey

public PropertyKey<A> getKey()
Gest the key which is used to access the value in DockProperties.

Returns:
the key

getValue

public A getValue()
Gets the current value. The result is the argument of setValue(Object) if the argument was not null, or else the value read from the properties.

Returns:
the value or null if no value was found at all

getOwnValue

public A getOwnValue()
Gets the value that was set through setValue(Object).

Returns:
the value, might be null

setValue

public void setValue(A value)
Sets the current value.

Parameters:
value - the value, null if the value should be read from the properties

valueChanged

protected abstract void valueChanged(A oldValue,
                                     A newValue)
Invoked when the value has been changed.

Parameters:
oldValue - the new value
newValue - the old value