V
- The kind of values this map containsU
- The kind of observers used to read values from this mapB
- The kind of bridges used to transfer values V
to observers U
public class UIProperties<V,U extends UIValue<V>,B extends UIBridge<V,U>>
extends java.lang.Object
Constructor and Description |
---|
UIProperties(DockController controller)
Creates a new map.
|
Modifier and Type | Method and Description |
---|---|
void |
add(java.lang.String id,
Path path,
U value)
Installs a new
UIValue . |
void |
clear(Priority priority)
Removes all values that stored under the given priority.
|
V |
get(java.lang.String id)
Gets a resource.
|
void |
get(java.lang.String id,
Path kind,
U key)
Call
UIValue.set(Object) with the matching value that is stored in this
map for id . |
B |
getBridge(Priority priority,
Path path)
|
protected B |
getBridgeFor(Path path)
Searches a bridge that can be used for
path . |
DockController |
getController()
Gets the controller in whose realm this map is used.
|
UIScheme<V,U,B> |
getScheme(Priority priority)
Gets the
UIScheme that is used to fill up missing values in
the level priority . |
boolean |
isObserved(Path path)
Tells whether the bridge with id
path is observed by at least one UIValue . |
boolean |
isObserved(java.lang.String id)
Tells whether the value with id
id is observed by at least one UIValue . |
boolean |
isStored(B bridge)
Tells whether
bridge is stored in this map. |
void |
lockUpdate()
Tells this manager to stall all updates.
|
void |
publish(Priority priority,
Path path,
B bridge)
Adds a new bridge between this
UIProperties and a set of
UIValue s that have a certain type. |
void |
put(Priority priority,
java.lang.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 |
setScheme(Priority priority,
UIScheme<V,U,B> scheme)
|
void |
unlockUpdate()
Tells this manager no longer to stall updates.
|
void |
unpublish(Priority priority,
B bridge)
Searches for all occurrences of
bridge and removes them. |
void |
unpublish(Priority priority,
Path path)
Removes the bridge that handles the
UIValue s of kind path . |
public UIProperties(DockController controller)
controller
- the owner of this mappublic DockController getController()
null
public void lockUpdate()
UIValue
will
be informed when a color or provider changes.public void unlockUpdate()
UIValue
s.public UIScheme<V,U,B> getScheme(Priority priority)
UIScheme
that is used to fill up missing values in
the level priority
.priority
- some prioritynull
setScheme(Priority, UIScheme)
public void setScheme(Priority priority, UIScheme<V,U,B> scheme)
UIScheme
for the level priority
of this
UIProperties
. The scheme will be used to fill missing values of this properties. Since
a "missing resource" cannot be removed, any attempt to delete a resource created by a scheme
must fail.priority
- the level which will be provided with new values from scheme
.scheme
- the new scheme or null
public void publish(Priority priority, Path path, B bridge)
UIProperties
and a set of
UIValue
s that have a certain type.priority
- the importance of the new providerpath
- the path for which this bridge should be used.bridge
- the new bridgepublic void unpublish(Priority priority, Path path)
UIValue
s of kind path
. Please note
that bridges created by the current UIScheme
cannot be removed. Also note that the removed bridge
may be replaced by a bridge created by the current UIScheme
.priority
- the importance of the bridgepath
- the path of the bridgepublic void unpublish(Priority priority, B bridge)
bridge
and removes them. Please note
that bridges created by the current UIScheme
cannot be removed. Also note that the removed bridge
may be replaced by a bridge created by the current UIScheme
.
All UIValue
s that used bridge
are redistributed.priority
- the importance of the bridgebridge
- the bridge to removepublic boolean isStored(B bridge)
bridge
is stored in this map.bridge
- some object to searchtrue
if bridge
was found anywherepublic boolean isObserved(Path path)
path
is observed by at least one UIValue
.path
- the name of some UIBridge
path
is observedpublic void add(java.lang.String id, Path path, U value)
UIValue
. The value will be informed about
any change in the resource id
.id
- the id of the resource that value
will monitorpath
- the kind of the valuevalue
- the new observerpublic void remove(U value)
value
- the observer to removepublic boolean isObserved(java.lang.String id)
id
is observed by at least one UIValue
.id
- the name of some valueid
is observedprotected B getBridgeFor(Path path)
path
.path
- the kind of bridge that is searched. First a bridge for
path
will be searched, then for the parent of path
,
and so on...null
public void put(Priority priority, java.lang.String id, V resource)
UIValue
that are observing id
about the change.
Please note that values created by an UIScheme
cannot be removed, and that a removed value may
be replaced by a value of an UIScheme
.priority
- the importance of this valueid
- the name of the valueresource
- the new resource, can be null
public V get(java.lang.String id)
id
- the id of the resourcenull
put(Priority, String, Object)
public void get(java.lang.String id, Path kind, U key)
UIValue.set(Object)
with the matching value that is stored in this
map for id
.id
- the unique identifier of the value to readkind
- the kind of value key
iskey
- the destination of the value