bibliothek.gui.dock.util
Class DockProperties

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

public class DockProperties
extends java.lang.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

Nested Class Summary
private  class DockProperties.Entry<A>
          An entry that contains key, listeners and a value.
 
Field Summary
private  java.util.Map<PropertyKey<?>,DockProperties.Entry<?>> map
          the map of values
 
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.
private  void check(DockProperties.Entry<?> entry)
          Checks whether entry has to be stored any longer.
<A> A
get(PropertyKey<A> key)
          Gets the value accessed by key.
private
<A> DockProperties.Entry<A>
getEntry(PropertyKey<A> key, boolean secure)
          Gets the entry for 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

map

private java.util.Map<PropertyKey<?>,DockProperties.Entry<?>> map
the map of values

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

get

public <A> A get(PropertyKey<A> key)
Gets the value accessed by key.

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

getEntry

private <A> DockProperties.Entry<A> getEntry(PropertyKey<A> key,
                                             boolean secure)
Gets the entry for key.

Type Parameters:
A - the type of the entry
Parameters:
key - the name of the entry
secure - true if null is not a valid result.
Returns:
the entry of null, but only if secure is false

check

private void check(DockProperties.Entry<?> entry)
Checks whether entry has to be stored any longer.

Parameters:
entry - the entry that may be deleted