bibliothek.gui.dock.util
Class TypedPropertyUIScheme

java.lang.Object
  extended by bibliothek.gui.dock.util.TypedPropertyUIScheme
All Implemented Interfaces:
UIScheme<java.lang.Object,UIValue<java.lang.Object>,UIBridge<java.lang.Object,UIValue<java.lang.Object>>>

public class TypedPropertyUIScheme
extends java.lang.Object
implements UIScheme<java.lang.Object,UIValue<java.lang.Object>,UIBridge<java.lang.Object,UIValue<java.lang.Object>>>

This UIScheme is intended to be used by a TypedUIProperties to fill in gaps by reading selected keys of a DockProperties.

Author:
Benjamin Sigg

Constructor Summary
TypedPropertyUIScheme(DockProperties properties)
          Creates a new scheme
 
Method Summary
 void addListener(UISchemeListener<java.lang.Object,UIValue<java.lang.Object>,UIBridge<java.lang.Object,UIValue<java.lang.Object>>> listener)
          Adds a listener to this scheme.
protected  void fire(UISchemeEvent<java.lang.Object,UIValue<java.lang.Object>,UIBridge<java.lang.Object,UIValue<java.lang.Object>>> event)
          Forwards the event event to all registered UIListeners.
 UIBridge<java.lang.Object,UIValue<java.lang.Object>> getBridge(Path name, UIProperties<java.lang.Object,UIValue<java.lang.Object>,UIBridge<java.lang.Object,UIValue<java.lang.Object>>> properties)
          Creates the UIBridge that handles resources of type name.
 java.lang.Object getResource(java.lang.String name, UIProperties<java.lang.Object,UIValue<java.lang.Object>,UIBridge<java.lang.Object,UIValue<java.lang.Object>>> properties)
          Creates the resource with name name.
 void install(UIProperties<java.lang.Object,UIValue<java.lang.Object>,UIBridge<java.lang.Object,UIValue<java.lang.Object>>> properties)
          Informs this scheme that it is now used by properties.
<V,A extends V>
void
link(PropertyKey<A> source, TypedUIProperties.Type<V> destinationType, java.lang.String destinationId)
          Creates a link between the key source and the resource destinationId.
 void removeListener(UISchemeListener<java.lang.Object,UIValue<java.lang.Object>,UIBridge<java.lang.Object,UIValue<java.lang.Object>>> listener)
          Removes a listener from this scheme.
 void uninstall(UIProperties<java.lang.Object,UIValue<java.lang.Object>,UIBridge<java.lang.Object,UIValue<java.lang.Object>>> properties)
          Informs this scheme that it is no longer used by properties.
<V> void
unlink(TypedUIProperties.Type<V> destinationType, java.lang.String destinationId)
          Disables the connection leading to the resource destinationId.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TypedPropertyUIScheme

public TypedPropertyUIScheme(DockProperties properties)
Creates a new scheme

Parameters:
properties - the source of all the information to read, not null
Method Detail

link

public <V,A extends V> void link(PropertyKey<A> source,
                                 TypedUIProperties.Type<V> destinationType,
                                 java.lang.String destinationId)
Creates a link between the key source and the resource destinationId. If there is an older link to the same id, then the older link is removed first.

Type Parameters:
V - the type to read from a DockProperties
A - the type to write into a TypedUIProperties
Parameters:
source - the key for the resource
destinationType - the type of the resource
destinationId - the identifier of the resource

unlink

public <V> void unlink(TypedUIProperties.Type<V> destinationType,
                       java.lang.String destinationId)
Disables the connection leading to the resource destinationId.

Type Parameters:
V - the destinationType
Parameters:
destinationType - the type of the resource
destinationId - the identifier of the resource that should no longer be managed by this scheme

addListener

public void addListener(UISchemeListener<java.lang.Object,UIValue<java.lang.Object>,UIBridge<java.lang.Object,UIValue<java.lang.Object>>> listener)
Description copied from interface: UIScheme
Adds a listener to this scheme.

Specified by:
addListener in interface UIScheme<java.lang.Object,UIValue<java.lang.Object>,UIBridge<java.lang.Object,UIValue<java.lang.Object>>>
Parameters:
listener - the new listener, not null

removeListener

public void removeListener(UISchemeListener<java.lang.Object,UIValue<java.lang.Object>,UIBridge<java.lang.Object,UIValue<java.lang.Object>>> listener)
Description copied from interface: UIScheme
Removes a listener from this scheme.

Specified by:
removeListener in interface UIScheme<java.lang.Object,UIValue<java.lang.Object>,UIBridge<java.lang.Object,UIValue<java.lang.Object>>>
Parameters:
listener - the listener to remove

fire

protected void fire(UISchemeEvent<java.lang.Object,UIValue<java.lang.Object>,UIBridge<java.lang.Object,UIValue<java.lang.Object>>> event)
Forwards the event event to all registered UIListeners.

Parameters:
event - the event to forward

getBridge

public UIBridge<java.lang.Object,UIValue<java.lang.Object>> getBridge(Path name,
                                                                      UIProperties<java.lang.Object,UIValue<java.lang.Object>,UIBridge<java.lang.Object,UIValue<java.lang.Object>>> properties)
Description copied from interface: UIScheme
Creates the UIBridge that handles resources of type name.

Specified by:
getBridge in interface UIScheme<java.lang.Object,UIValue<java.lang.Object>,UIBridge<java.lang.Object,UIValue<java.lang.Object>>>
Parameters:
name - the name of the bridge
properties - the map that will use the resource
Returns:
the new bridge or null if this scheme does not know name

getResource

public java.lang.Object getResource(java.lang.String name,
                                    UIProperties<java.lang.Object,UIValue<java.lang.Object>,UIBridge<java.lang.Object,UIValue<java.lang.Object>>> properties)
Description copied from interface: UIScheme
Creates the resource with name name. This method may be called often and should complete quickly.

Specified by:
getResource in interface UIScheme<java.lang.Object,UIValue<java.lang.Object>,UIBridge<java.lang.Object,UIValue<java.lang.Object>>>
Parameters:
name - the name of some resource
properties - the map that will use the resource
Returns:
the resource or null if this scheme does not know name

install

public void install(UIProperties<java.lang.Object,UIValue<java.lang.Object>,UIBridge<java.lang.Object,UIValue<java.lang.Object>>> properties)
Description copied from interface: UIScheme
Informs this scheme that it is now used by properties.

Specified by:
install in interface UIScheme<java.lang.Object,UIValue<java.lang.Object>,UIBridge<java.lang.Object,UIValue<java.lang.Object>>>
Parameters:
properties - the owner of this scheme

uninstall

public void uninstall(UIProperties<java.lang.Object,UIValue<java.lang.Object>,UIBridge<java.lang.Object,UIValue<java.lang.Object>>> properties)
Description copied from interface: UIScheme
Informs this scheme that it is no longer used by properties.

Specified by:
uninstall in interface UIScheme<java.lang.Object,UIValue<java.lang.Object>,UIBridge<java.lang.Object,UIValue<java.lang.Object>>>
Parameters:
properties - an old client of this scheme