bibliothek.gui.dock.util
Class DockProperties

java.lang.Object
  extended by bibliothek.gui.dock.util.DockProperties

public class DockProperties
extends Object

A set of properties that are used at different places all over the framework. No component should expect that there are any entries in this map.

Author:
Benjamin Sigg

Constructor Summary
DockProperties()
           
 
Method Summary
<A> void
addListener(PropertyKey<A> key, DockPropertyListener<A> listener)
          Adds a listener that will be informed whenever the value accessed through key changes.
<A> A
get(PropertyKey<A> key)
          Gets the value accessed by key.
<A> void
removeListener(PropertyKey<A> key, DockPropertyListener<A> listener)
          Removes an earlier added listener.
<A> void
set(PropertyKey<A> key, A value)
          Sets a value.
<A> void
setOrRemove(PropertyKey<A> key, A value)
          Either sets the property key to value or set the default value for key.
 void toDefault(PropertyKey<?> key)
          Tells the entry key that the user has never set its value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DockProperties

public DockProperties()
Method Detail

set

public <A> void set(PropertyKey<A> key,
                    A value)
Sets a value.

Type Parameters:
A - the type of the value
Parameters:
key - the key to access the value
value - the value, can be null

setOrRemove

public <A> void setOrRemove(PropertyKey<A> key,
                            A value)
Either sets the property key to value or set the default value for key.

Type Parameters:
A - the type of the value
Parameters:
key - the key to access the value
value - the new value, if null then the default value will be set

toDefault

public void toDefault(PropertyKey<?> key)
Tells the entry key that the user has never set its value. Also removes the old value of the entry.

Parameters:
key - the key to access the entry

get

public <A> A get(PropertyKey<A> key)
Gets the value accessed by key. If the value in the properties is null, then the default value is returned.

Type Parameters:
A - the type of the value
Parameters:
key - the key to search
Returns:
the value or null

addListener

public <A> void addListener(PropertyKey<A> key,
                            DockPropertyListener<A> listener)
Adds a listener that will be informed whenever the value accessed through key changes.

Type Parameters:
A - the type of the value
Parameters:
key - the key that accesses the value
listener - the new listener

removeListener

public <A> void removeListener(PropertyKey<A> key,
                               DockPropertyListener<A> listener)
Removes an earlier added listener.

Type Parameters:
A - the type of value observed by the listener
Parameters:
key - the key to access the observed entry
listener - the listener to remove