ilog.ds.adapter
Class IlAbstractSDMModelAdapter

java.lang.Object
  |
  +--ilog.ds.adapter.IlAbstractAdapter
        |
        +--ilog.ds.adapter.IlAbstractSDMModelAdapter
All Implemented Interfaces:
BatchListener, DataSourceListener, EventListener, IlFreezableAdapter, SDMDSListener, ilog.views.sdm.event.SDMModelListener, ilog.views.sdm.event.SDMPropertyChangeListener
Direct Known Subclasses:
IlsSDMDS2IlvSDMViewAdapter

public abstract class IlAbstractSDMModelAdapter
extends IlAbstractAdapter
implements SDMDSListener, ilog.views.sdm.event.SDMModelListener, ilog.views.sdm.event.SDMPropertyChangeListener

This class adapts the events from the IlSDMDataSource to a JViews IlvSDMModel. It does not implement how elements are created or updated, that is, how the properties from the data source are mapped to the IlvMutableSDMLink, and IlvMutableSDMNode themselves. This class supports the mapping between the data source objects and the model objects. It stores the data source reference.

See Also:
IlSDMDataSource, IlSDMDataSourceEditor, IlvMutableSDMNode, IlvMutableSDMLink

Inner Class Summary
protected  class IlAbstractSDMModelAdapter.SDMRefEvent
           
 
Field Summary
protected  boolean _alreadyAdjusting
           
protected  Map _ds2model
           
protected  Map _model2ds
           
protected  LinkedList _refEvents
           
protected  ilog.views.sdm.IlvSDMModel _sdm
           
protected  IlSDMDataSource _sds
           
protected  IlSDMDataSourceEditor _sdse
           
 
Fields inherited from class ilog.ds.adapter.IlAbstractAdapter
_dispatchListeners, _events, _frozenEvents, _inBatchedEvents, _inTransaction, _isFrozen, _syncStrategy
 
Constructor Summary
IlAbstractSDMModelAdapter()
           
 
Method Summary
 void adjustmentFinished(ilog.views.sdm.event.SDMModelEvent event)
           
protected  boolean checkAdjustment(ilog.views.sdm.event.SDMModelEvent event)
           
protected abstract  Object createLink(String tag, Object parent, Object from, Object to, Map properties)
          Method called to create a link in the sdm model.
protected abstract  Object createNode(String tag, Object parent, Map properties)
          Method called to create a node in the sdm model.
 void dataChanged(ilog.views.sdm.event.SDMModelEvent event)
           
 void dataSourceChange(DataSourceEvent e)
          DataSourceListener implementation
protected  void dispatchBatchedEvent(EventObject event)
           
protected  void dispatchBatchedEvents(ArrayList batchedEvents)
           
 Object getDSLink(Object link)
           
 Object getDSNode(Object node)
           
 ilog.views.sdm.IlvSDMModel getModel()
          Gets the IlvSDMModel in use by this adapter.
 IlSDMDataSource getSDMDataSource()
          Gets the IlSDMDataSource in use by this adapter.
 IlSDMDataSourceEditor getSDMDataSourceEditor()
          Gets the IlSDMDataSourceEditor in use by this adapter.
 Object getSDMLink(Object dsLink)
           
 Object getSDMNode(Object dsNode)
           
protected  Object getSynchronizationObject()
           
protected  void internalDataSourceChange(DataSourceEvent e)
          Internal code called in the Swing event thread
protected  void internalLinkAdded(SDMLinkEvent e)
          Internal method called when dispatching events.
protected  void internalLinkRemoved(SDMLinkEvent e)
          Internal method called when dispatching events.
protected  void internalLinkUpdated(SDMLinkEvent e)
          Internal method called when dispatching events.
protected  void internalNodeAdded(SDMNodeEvent e)
          Internal method called when dispatching events.
protected  void internalNodeRemoved(SDMNodeEvent e)
          Internal method called when dispatching events.
protected  void internalNodeUpdated(SDMNodeEvent e)
          Internal method called when dispatching events.
 void linkChange(SDMLinkEvent e)
          This method is invoked when a link has been added, removed, or updated in the SDMDataSource.
 void linkDestinationChanged(ilog.views.sdm.event.SDMModelEvent event)
           
 void linkSourceChanged(ilog.views.sdm.event.SDMModelEvent event)
           
 void nodeChange(SDMNodeEvent e)
          This method is invoked when a node has been added, removed, or updated in the SDMDataSource.
 void objectAdded(ilog.views.sdm.event.SDMModelEvent event)
           
 void objectRemoved(ilog.views.sdm.event.SDMModelEvent event)
           
protected  void postDispatchBatchedEvents(ArrayList events)
           
protected  void preDispatchBatchedEvents(ArrayList events)
           
protected  void processRefEvents()
           
 void propertyChanged(ilog.views.sdm.event.SDMPropertyChangeEvent event)
           
 void setModel(ilog.views.sdm.IlvSDMModel sdm)
          Sets the IlvSDMModel to use
 void setSDMDataSource(IlSDMDataSource sds)
          Sets the IlSDMDataSource to use.
 void setSDMDataSourceEditor(IlSDMDataSourceEditor sdse)
          Sets the IlSDMDataSourceEditor to use.
protected abstract  void updateLink(Object link, Map properties)
          Method called to update a link in the sdm model.
protected abstract  void updateNode(Object node, Map properties)
          Method called to update a node in the sdm model.
 
Methods inherited from class ilog.ds.adapter.IlAbstractAdapter
addDispatchListener, addDSEvent, clearDSEvents, endBatch, firePostDispatchBatchedEventsEvent, firePreDispatchBatchedEventsEvent, GetColor, getSynchronizationStrategy, isFrozen, isInBatchedEvents, isInTransaction, removeDispatchListener, setFrozen, setSynchronizationStrategy, startBatch
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_alreadyAdjusting

protected boolean _alreadyAdjusting

_refEvents

protected LinkedList _refEvents

_model2ds

protected Map _model2ds

_ds2model

protected Map _ds2model

_sds

protected IlSDMDataSource _sds

_sdse

protected IlSDMDataSourceEditor _sdse

_sdm

protected ilog.views.sdm.IlvSDMModel _sdm
Constructor Detail

IlAbstractSDMModelAdapter

public IlAbstractSDMModelAdapter()
Method Detail

getSynchronizationObject

protected Object getSynchronizationObject()
Description copied from class: IlAbstractAdapter
Gets the object to synchronize in the synchronization strategy used by this adapter.
Overrides:
getSynchronizationObject in class IlAbstractAdapter
Following copied from class: ilog.ds.adapter.IlAbstractAdapter
Returns:
this by default, the data model generally (in subsclasses)

getDSNode

public final Object getDSNode(Object node)

getDSLink

public final Object getDSLink(Object link)

getSDMNode

public final Object getSDMNode(Object dsNode)

getSDMLink

public final Object getSDMLink(Object dsLink)

createNode

protected abstract Object createNode(String tag,
                                     Object parent,
                                     Map properties)
Method called to create a node in the sdm model.
Parameters:
tag - The symbolic type of the element.
parent - The parent of the node, may be null.
properties - The properties of the node from the data source.
Returns:
the newly created SDM node, corresponding to the parameters.

updateNode

protected abstract void updateNode(Object node,
                                   Map properties)
Method called to update a node in the sdm model.
Parameters:
node - the node to update
properties - The updated properties from the data source

createLink

protected abstract Object createLink(String tag,
                                     Object parent,
                                     Object from,
                                     Object to,
                                     Map properties)
Method called to create a link in the sdm model.
Parameters:
tag - The symbolic type of the element.
parent - The parent of the link, may be null.
from - The origin of the link
to - The target of the link
properties - The properties of the link from the data source.
Returns:
the newly created SDM link, corresponding to the parameters.

updateLink

protected abstract void updateLink(Object link,
                                   Map properties)
Method called to update a link in the sdm model.
Parameters:
link - the link to update
properties - The updated properties from the data source

setModel

public void setModel(ilog.views.sdm.IlvSDMModel sdm)
Sets the IlvSDMModel to use

getModel

public ilog.views.sdm.IlvSDMModel getModel()
Gets the IlvSDMModel in use by this adapter.

getSDMDataSource

public IlSDMDataSource getSDMDataSource()
Gets the IlSDMDataSource in use by this adapter.

getSDMDataSourceEditor

public IlSDMDataSourceEditor getSDMDataSourceEditor()
Gets the IlSDMDataSourceEditor in use by this adapter.

setSDMDataSource

public void setSDMDataSource(IlSDMDataSource sds)
Sets the IlSDMDataSource to use.

setSDMDataSourceEditor

public void setSDMDataSourceEditor(IlSDMDataSourceEditor sdse)
Sets the IlSDMDataSourceEditor to use.

dataSourceChange

public void dataSourceChange(DataSourceEvent e)
DataSourceListener implementation
Following copied from interface: ilog.ds.DataSourceListener
Parameters:
e - The event
See Also:
DataSourceEvent

nodeChange

public void nodeChange(SDMNodeEvent e)
This method is invoked when a node has been added, removed, or updated in the SDMDataSource.
Specified by:
nodeChange in interface SDMDSListener
Parameters:
e - The event
See Also:
SDMNodeEvent, IlSDMDataSource

linkChange

public void linkChange(SDMLinkEvent e)
This method is invoked when a link has been added, removed, or updated in the SDMDataSource.
Specified by:
linkChange in interface SDMDSListener
Parameters:
e - The event
See Also:
SDMLinkEvent, IlSDMDataSource

internalDataSourceChange

protected void internalDataSourceChange(DataSourceEvent e)
Internal code called in the Swing event thread
Overrides:
internalDataSourceChange in class IlAbstractAdapter

internalNodeAdded

protected void internalNodeAdded(SDMNodeEvent e)
Internal method called when dispatching events.
Parameters:
e - The node event.
See Also:
SDMNodeEvent

internalNodeUpdated

protected void internalNodeUpdated(SDMNodeEvent e)
Internal method called when dispatching events.
Parameters:
e - The node event.
See Also:
SDMNodeEvent

internalNodeRemoved

protected void internalNodeRemoved(SDMNodeEvent e)
Internal method called when dispatching events.
Parameters:
e - The node event.
See Also:
SDMNodeEvent

internalLinkAdded

protected void internalLinkAdded(SDMLinkEvent e)
Internal method called when dispatching events.
Parameters:
e - The link event.
See Also:
LinkEvent

internalLinkUpdated

protected void internalLinkUpdated(SDMLinkEvent e)
Internal method called when dispatching events.
Parameters:
e - The link event.
See Also:
LinkEvent

internalLinkRemoved

protected void internalLinkRemoved(SDMLinkEvent e)
Internal method called when dispatching events.
Parameters:
e - The link event.
See Also:
LinkEvent

preDispatchBatchedEvents

protected void preDispatchBatchedEvents(ArrayList events)
Description copied from class: IlAbstractAdapter
dispatching events methods
Overrides:
preDispatchBatchedEvents in class IlAbstractAdapter

postDispatchBatchedEvents

protected void postDispatchBatchedEvents(ArrayList events)
Overrides:
postDispatchBatchedEvents in class IlAbstractAdapter

dispatchBatchedEvent

protected void dispatchBatchedEvent(EventObject event)
Overrides:
dispatchBatchedEvent in class IlAbstractAdapter

dispatchBatchedEvents

protected void dispatchBatchedEvents(ArrayList batchedEvents)
Overrides:
dispatchBatchedEvents in class IlAbstractAdapter

checkAdjustment

protected boolean checkAdjustment(ilog.views.sdm.event.SDMModelEvent event)

adjustmentFinished

public void adjustmentFinished(ilog.views.sdm.event.SDMModelEvent event)
Specified by:
adjustmentFinished in interface ilog.views.sdm.event.SDMModelListener

dataChanged

public void dataChanged(ilog.views.sdm.event.SDMModelEvent event)
Specified by:
dataChanged in interface ilog.views.sdm.event.SDMModelListener

linkDestinationChanged

public void linkDestinationChanged(ilog.views.sdm.event.SDMModelEvent event)
Specified by:
linkDestinationChanged in interface ilog.views.sdm.event.SDMModelListener

linkSourceChanged

public void linkSourceChanged(ilog.views.sdm.event.SDMModelEvent event)
Specified by:
linkSourceChanged in interface ilog.views.sdm.event.SDMModelListener

objectAdded

public void objectAdded(ilog.views.sdm.event.SDMModelEvent event)
Specified by:
objectAdded in interface ilog.views.sdm.event.SDMModelListener

objectRemoved

public void objectRemoved(ilog.views.sdm.event.SDMModelEvent event)
Specified by:
objectRemoved in interface ilog.views.sdm.event.SDMModelListener

propertyChanged

public void propertyChanged(ilog.views.sdm.event.SDMPropertyChangeEvent event)
Specified by:
propertyChanged in interface ilog.views.sdm.event.SDMPropertyChangeListener

processRefEvents

protected void processRefEvents()