com.sdm.quasar.client.swing.data.plugins.impl
Class DefaultCUFValueModelPlugIn

java.lang.Object
  extended bycom.sdm.quasar.client.core.data.plugin.AbstractDataManagerPlugIn
      extended bycom.sdm.quasar.client.swing.data.plugins.impl.DefaultCUFValueModelPlugIn
All Implemented Interfaces:
CUFValueModelPlugIn, DataManagerPlugIn, Disposable, EventNotificationValueHandlerListener

public class DefaultCUFValueModelPlugIn
extends AbstractDataManagerPlugIn
implements CUFValueModelPlugIn, EventNotificationValueHandlerListener

Implementation for com.sdm.quasar.client.core.data.cuf.CUFValueModelPlugIn.

This implementation can be added as one of the later plug ins. It requires an installed IndexedValuesPlugIn.

Note: this is work in progress. It should be extended as needed until it covers the whole scope of the cuf value models.

Version:
1.0
Author:
Bernd Olleck, sd&m AG

Nested Class Summary
protected  class DefaultCUFValueModelPlugIn.DelegateAccessAdapter
          Adapter that offers a DelegateAccess based on a target node and an indexed node.
protected  class DefaultCUFValueModelPlugIn.SelectionInListAdapter
          Adapter that offers a SelectionInList based on an IndexedNode.
protected  class DefaultCUFValueModelPlugIn.ValueModelAdapter
          Adapter that offers a ValueModel based on the methods available in NodeController.
 
Constructor Summary
DefaultCUFValueModelPlugIn()
          Constructor.
 
Method Summary
 void dispose()
          Disposes the component.
 DelegateAccess getDelegateAccess(java.lang.String key, java.lang.String keyIndexedValue)
          Returns a DelegateAccess for the node with the given key based on an indexed node that contains the value which is passed to DelegateAccess#getValue(java.lang.Object).
protected  DefaultCUFValueModelPlugIn.DelegateAccessAdapter getDelegateAccessAdapter(NodeController node)
          Returns the DefaultCUFValueModelPlugIn.DelegateAccessAdapter stored in the metadata of the node.
protected  DefaultCUFValueModelPlugIn.SelectionInListAdapter getSelectionInListAdapter(NodeController node)
          Returns the SelectionInList stored in the metadata of the node.
 SelectionInList getSelectionInListValueModel(java.lang.String key)
          Returns a SelectionInList for the node with the given key.
 ValueModel getValueModel(java.lang.String key)
          Returns a ValueModel for the node with the given key
protected  DefaultCUFValueModelPlugIn.ValueModelAdapter getValueModelAdapter(NodeController node)
          Returns the DefaultCUFValueModelPlugIn.ValueModelAdapter stored in the metadata of the node.
 void notifyChildValueChanged(NodeController node, java.lang.String childKey)
          Notifies a selection in list if present that one of its child values may have changed.
protected  void notifyNodeAdded(NodeController node)
          Registers tthe #eventNotificationValueHandler.
 void notifyNodeValueChanged(NodeController node)
          Notifies the value model registered for that node.
protected  void notifyNodeWillBeRemoved(NodeController node)
          Called by the DataCore before a node will be removed.
 void notifySourceValueChanged(NodeController node, java.lang.String sourceKey)
          Notifies the value model registered for that node
protected  void setDelegateAccessAdapter(NodeController node, DefaultCUFValueModelPlugIn.DelegateAccessAdapter selectionInList)
          Stores the DefaultCUFValueModelPlugIn.DelegateAccessAdapter in the metadata of the node
protected  void setSelectionInListAdapter(NodeController node, DefaultCUFValueModelPlugIn.SelectionInListAdapter selectionInList)
          Stores the SelectionInList in the metadata of the node
protected  void setValueModelAdapter(NodeController node, DefaultCUFValueModelPlugIn.ValueModelAdapter adapter)
          Stores the DefaultCUFValueModelPlugIn.ValueModelAdapter in the metadata of the node
 
Methods inherited from class com.sdm.quasar.client.core.data.plugin.AbstractDataManagerPlugIn
getDataCore, install
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sdm.quasar.client.core.data.DataManagerPlugIn
install
 

Constructor Detail

DefaultCUFValueModelPlugIn

public DefaultCUFValueModelPlugIn()
Constructor.

Method Detail

notifyNodeAdded

protected void notifyNodeAdded(NodeController node)
Registers tthe #eventNotificationValueHandler.

Specified by:
notifyNodeAdded in class AbstractDataManagerPlugIn
Parameters:
node - the node that has been added
See Also:
AbstractDataManagerPlugIn.notifyNodeAdded(NodeController)

notifyNodeWillBeRemoved

protected void notifyNodeWillBeRemoved(NodeController node)
Description copied from class: AbstractDataManagerPlugIn
Called by the DataCore before a node will be removed.

Specified by:
notifyNodeWillBeRemoved in class AbstractDataManagerPlugIn
Parameters:
node - the key of the node that will be removed.

getValueModel

public ValueModel getValueModel(java.lang.String key)
Description copied from interface: CUFValueModelPlugIn
Returns a ValueModel for the node with the given key

Specified by:
getValueModel in interface CUFValueModelPlugIn
Parameters:
key - the key of the node
Returns:
the value model for that node

getSelectionInListValueModel

public SelectionInList getSelectionInListValueModel(java.lang.String key)
Description copied from interface: CUFValueModelPlugIn
Returns a SelectionInList for the node with the given key. The node must be an IndexedNode.

Specified by:
getSelectionInListValueModel in interface CUFValueModelPlugIn
Parameters:
key - the key of the node
Returns:
the value model for that node

getDelegateAccess

public DelegateAccess getDelegateAccess(java.lang.String key,
                                        java.lang.String keyIndexedValue)
Description copied from interface: CUFValueModelPlugIn
Returns a DelegateAccess for the node with the given key based on an indexed node that contains the value which is passed to DelegateAccess#getValue(java.lang.Object).

Specified by:
getDelegateAccess in interface CUFValueModelPlugIn
Parameters:
key - the key of the node whose value should be returned
keyIndexedValue - the key of the indexed node that forms the base of the delegate access
Returns:
the delegate access for that node

notifyNodeValueChanged

public void notifyNodeValueChanged(NodeController node)
Notifies the value model registered for that node.

Specified by:
notifyNodeValueChanged in interface EventNotificationValueHandlerListener
Parameters:
node - the node whose value has changed
See Also:
EventNotificationValueHandlerListener.notifyNodeValueChanged(NodeController)

notifyChildValueChanged

public void notifyChildValueChanged(NodeController node,
                                    java.lang.String childKey)
Notifies a selection in list if present that one of its child values may have changed.

Specified by:
notifyChildValueChanged in interface EventNotificationValueHandlerListener
Parameters:
node - the node whose child value has changed
childKey - the key of the child node that has changed
See Also:
EventNotificationValueHandlerListener.notifyChildValueChanged(NodeController, String)

notifySourceValueChanged

public void notifySourceValueChanged(NodeController node,
                                     java.lang.String sourceKey)
Notifies the value model registered for that node

Specified by:
notifySourceValueChanged in interface EventNotificationValueHandlerListener
Parameters:
node - the node whose source value has changed
sourceKey - the key of the source node that has changed
See Also:
EventNotificationValueHandlerListener.notifySourceValueChanged(NodeController, String)

dispose

public void dispose()
             throws DisposeException
Description copied from interface: Disposable
Disposes the component.

Important:
This method is called by an administrating component and must never be called directly.

The implementation should release any resources or objects allocated and any services registered. Furthermore, this method should be developed carefully to free a maximum of resources even when the system may have become unstable. In case of one or multiple errors, you should collect them in a DisposeException, continue with the execution, and throw it at the end of the method.

Note: The implementation must not return before the component is disposed. Any threads or asynchronous calls started must be completed before this method returns.

Specified by:
dispose in interface Disposable
Overrides:
dispose in class AbstractDataManagerPlugIn
Throws:
DisposeException
See Also:
Disposable.dispose()

getValueModelAdapter

protected DefaultCUFValueModelPlugIn.ValueModelAdapter getValueModelAdapter(NodeController node)
Returns the DefaultCUFValueModelPlugIn.ValueModelAdapter stored in the metadata of the node.

Parameters:
node - the node
Returns:
the adapter or null if it hasn't been stored yet

setValueModelAdapter

protected void setValueModelAdapter(NodeController node,
                                    DefaultCUFValueModelPlugIn.ValueModelAdapter adapter)
Stores the DefaultCUFValueModelPlugIn.ValueModelAdapter in the metadata of the node

Parameters:
node - the node
adapter - the adapter to be stored

getSelectionInListAdapter

protected DefaultCUFValueModelPlugIn.SelectionInListAdapter getSelectionInListAdapter(NodeController node)
Returns the SelectionInList stored in the metadata of the node.

Parameters:
node - the node
Returns:
the adapter or null if it hasn't been stored yet

setSelectionInListAdapter

protected void setSelectionInListAdapter(NodeController node,
                                         DefaultCUFValueModelPlugIn.SelectionInListAdapter selectionInList)
Stores the SelectionInList in the metadata of the node

Parameters:
node - the node
selectionInList - the adapter to be stored

getDelegateAccessAdapter

protected DefaultCUFValueModelPlugIn.DelegateAccessAdapter getDelegateAccessAdapter(NodeController node)
Returns the DefaultCUFValueModelPlugIn.DelegateAccessAdapter stored in the metadata of the node.

Parameters:
node - the node
Returns:
the adapter or null if it hasn't been stored yet

setDelegateAccessAdapter

protected void setDelegateAccessAdapter(NodeController node,
                                        DefaultCUFValueModelPlugIn.DelegateAccessAdapter selectionInList)
Stores the DefaultCUFValueModelPlugIn.DelegateAccessAdapter in the metadata of the node

Parameters:
node - the node
selectionInList - the adapter to be stored