com.sdm.quasar.client.core.data.plugin
Interface NodeController

All Known Implementing Classes:
DefaultNodeController

public interface NodeController

Version:
1.$Revision$
Author:
Thomas Wolf

Method Summary
 void addValueHandler(ValueHandler valueHandler)
          Adds a ValueHandler to the list of value handlers in this node.
 void allowNotification()
          Allows notification of changes.
 boolean canModifyValue(Context context)
          Calls the chain of value handlers to test whether the value of this node can be modified
 void continueNodeValueChangedNotification()
          Continues the notification across the node graph that this node's value has been changed.
 DataCore getDataCore()
           
 java.util.List getDependentNodes()
           
 java.util.Set getIndexSet(Context context)
          Calls the chain of value handlers to return a Set of the index values for the node.
 java.lang.String getKey()
          Shortcut für getNode().
 java.lang.Object getMetadata(java.lang.Class storingClass, java.lang.String key)
          Returns a stored data object for a plug in or a value handler
 Node getNode()
           
 java.lang.Object getValue(Context context)
          Calls the chain of value handlers to return the indexed value of the node
 boolean hasValue(Context context)
          Calls the chain of value handlers to test whether this node has a value
 void notifyChildrenOfSourceValueChange()
          This method notifies all of this node's children that their source value has changed.
 void notifySourcesOfChildValueChange()
          This method notifies all of this node's sources that this node's value has changed.
 java.lang.Object removeMetadata(java.lang.Class storingClass, java.lang.String key)
          Removes a data object for a plug in or a value handler.
 void setMetadata(java.lang.Class storingClass, java.lang.String key, java.lang.Object value)
          Stores a data object for a plug in or a value handler.
 void setValue(Context context, java.lang.Object value)
          Calls the chain of value handlers to set the (indexed) value of the node
 void startNodeValueChangedNotification()
          Starts the notification across the node graph that this node's value has been changed.
 void stopNotification()
          Temporary stops the notification of changes.
 

Method Detail

getKey

public java.lang.String getKey()
Shortcut für getNode().Node.getKey().

Returns:
the key for this node

getNode

public Node getNode()
Returns:
the node that defines the value of this NodeController.

getDataCore

public DataCore getDataCore()
Returns:
the data core that this node is installed in

getMetadata

public java.lang.Object getMetadata(java.lang.Class storingClass,
                                    java.lang.String key)
Returns a stored data object for a plug in or a value handler

Parameters:
storingClass - the class that the data object has been stored for
key - the key under which the data object has been stored
Returns:
the data object, may be null if no such key exists

setMetadata

public void setMetadata(java.lang.Class storingClass,
                        java.lang.String key,
                        java.lang.Object value)
Stores a data object for a plug in or a value handler.

Parameters:
storingClass - the class that the data object has been stored for
key - the key under which the data object should be stored
value - the data object

removeMetadata

public java.lang.Object removeMetadata(java.lang.Class storingClass,
                                       java.lang.String key)
Removes a data object for a plug in or a value handler.

Parameters:
storingClass - the class that the data object has been stored for
key - the key under which the data object has been stored
Returns:
the data object, may be null if no such key exists

addValueHandler

public void addValueHandler(ValueHandler valueHandler)
Adds a ValueHandler to the list of value handlers in this node.

These value handlers will be called in the reverse order they have been registered.

Node that a value handler may only be added while the node is being registered.

Important

: The first value handler to be added, which is the last value handler to be called, must take responsibility for storing and retrieving the value in accordance to the structure description defined by Node.


getValue

public java.lang.Object getValue(Context context)
Calls the chain of value handlers to return the indexed value of the node

Parameters:
context - the context to resolve the indices
Returns:
the indexed value of the node
See Also:
DataManager.getValue(String, Context)

setValue

public void setValue(Context context,
                     java.lang.Object value)
Calls the chain of value handlers to set the (indexed) value of the node

Parameters:
context - the context to resolve the indices
value - the value of the node
See Also:
DataManager.setValue(String, Context, Object)

getIndexSet

public java.util.Set getIndexSet(Context context)
Calls the chain of value handlers to return a Set of the index values for the node. The method returns null for not indexed nodes.

Parameters:
context - the context to resolve the indices
Returns:
A Set of the index values for the node or null.

hasValue

public boolean hasValue(Context context)
Calls the chain of value handlers to test whether this node has a value

Parameters:
context - the context to resolve the indices
Returns:
true if the node does have a value
See Also:
DataManager.hasValue(String)

canModifyValue

public boolean canModifyValue(Context context)
Calls the chain of value handlers to test whether the value of this node can be modified

Returns:
true if the value can be modified
See Also:
DataManager.canModifyValue(String)

continueNodeValueChangedNotification

public void continueNodeValueChangedNotification()
Continues the notification across the node graph that this node's value has been changed. The nodes that this node depends on are notified that their child has changed. Then it notifies the dependent nodes that their source value has changed.


notifySourcesOfChildValueChange

public void notifySourcesOfChildValueChange()
This method notifies all of this node's sources that this node's value has changed.


notifyChildrenOfSourceValueChange

public void notifyChildrenOfSourceValueChange()
This method notifies all of this node's children that their source value has changed.


stopNotification

public void stopNotification()
Temporary stops the notification of changes. Changes are no longer propagated through the hierarchy.

Important: When calling this method you must ensure that the corresponding allowNotification() will be called even in case of an error by using try ... finally.


allowNotification

public void allowNotification()
Allows notification of changes.

Important: After calling this method the caller must start an appropriate notification.


startNodeValueChangedNotification

public void startNodeValueChangedNotification()
Starts the notification across the node graph that this node's value has been changed. First all value handlers of this node are notified that this node's value has changed. Then nodes that this node depends on are notified that their child has changed. Then it notifies the dependent nodes that their source value has changed.

This notification may also be used to notify the node that the value has been changed by means outside the control of the data store.


getDependentNodes

public java.util.List getDependentNodes()
Returns:
the keys of the nodes that depend on this node in the order they are notified