bibliothek.gui.dock.util
Class UIProperties<V,U extends UIValue<V>>

java.lang.Object
  extended by bibliothek.gui.dock.util.UIProperties<V,U>
Direct Known Subclasses:
ColorManager

public class UIProperties<V,U extends UIValue<V>>
extends Object


Constructor Summary
UIProperties()
           
 
Method Summary
<P extends U>
void
add(String id, Class<? super P> kind, P value)
          Installs a new UIValue.
 void clear(Priority priority)
          Removes all values that stored under the given priority.
 V get(String id)
          Gets a resource.
protected  UIBridge<V,? extends U> getBridgeFor(Class<?> clazz)
          Searches a bridge that can be used for clazz.
 void lockUpdate()
          Tells this manager to stall all updates.
<P extends U>
void
publish(Priority priority, Class<? extends P> kind, UIBridge<V,P> bridge)
          Adds a new bridge between this UIProperties and a set of UIValues that have a certain type.
 void put(Priority priority, String id, V resource)
          Sets a new resource and informs all UIValue that are observing id about the change.
 void remove(U value)
          Uninstalls an observer of a resource
 void unlockUpdate()
          Tells this manager no longer to stall updates.
 void unpublish(Priority priority, Class<? extends U> kind)
          Removes the bridge that handles the UIValues of kind kind.
 void unpublish(Priority priority, UIBridge<V,? extends U> bridge)
          Searches for all occurrences of bridge and removes them.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UIProperties

public UIProperties()
Method Detail

lockUpdate

public void lockUpdate()
Tells this manager to stall all updates. No UIValue will be informed when a color or provider changes.


unlockUpdate

public void unlockUpdate()
Tells this manager no longer to stall updates. This triggers a full update on all UIValues.


publish

public <P extends U> void publish(Priority priority,
                                  Class<? extends P> kind,
                                  UIBridge<V,P> bridge)
Adds a new bridge between this UIProperties and a set of UIValues that have a certain type.

Type Parameters:
P - the kind of UIValues the bridge can handle.
Parameters:
priority - the importance of the new provider
kind - the kind of values that the new bridge should handle
bridge - the new bridge

unpublish

public void unpublish(Priority priority,
                      Class<? extends U> kind)
Removes the bridge that handles the UIValues of kind kind.

Parameters:
priority - the importance of the bridge
kind - some kind of UIValue

unpublish

public void unpublish(Priority priority,
                      UIBridge<V,? extends U> bridge)
Searches for all occurrences of bridge and removes them. All UIValues that used bridge are redistributed.

Parameters:
priority - the importance of the bridge
bridge - the bridge to remove

add

public <P extends U> void add(String id,
                              Class<? super P> kind,
                              P value)
Installs a new UIValue. The value will be informed about any change in the resource id.

Type Parameters:
P - the type of the value
Parameters:
id - the id of the resource that value will monitor
kind - the type of the observer
value - the new value

remove

public void remove(U value)
Uninstalls an observer of a resource

Parameters:
value - the observer to remove

getBridgeFor

protected UIBridge<V,? extends U> getBridgeFor(Class<?> clazz)
Searches a bridge that can be used for clazz.

Parameters:
clazz - the type whose bridge is searched
Returns:
the bridge or null

put

public void put(Priority priority,
                String id,
                V resource)
Sets a new resource and informs all UIValue that are observing id about the change.

Parameters:
priority - the importance of this value
id - the id of the color
resource - the new resource

get

public V get(String id)
Gets a resource.

Parameters:
id - the id of the resource
Returns:
the resource or null
See Also:
put(Priority, String, Object)

clear

public void clear(Priority priority)
Removes all values that stored under the given priority.

Parameters:
priority - the priority whose elements should be removed