ilog.cpl.graph
Class IlpGraphHandlerWithDataSource

java.lang.Object
  extended by ilog.cpl.graph.IlpAbstractGraphHandler
      extended by ilog.cpl.graph.IlpGraphHandlerWithDataSource
All Implemented Interfaces:
IlpExpansionHandler, IlpGraphHandler, IlpLoadHandler, IlpNodeHandler, IlpPositionHandler
Direct Known Subclasses:
IlpEquipmentHandlerWithDataSource, IlpNetworkHandlerWithDataSource

public abstract class IlpGraphHandlerWithDataSource
extends IlpAbstractGraphHandler

This class is the recommended handler for the graph component. It should be set when an IlpDataSource and an IlpAbstractNodeAdapter are in use.

The handler performs editing operations by accessing the data source. Any changes in the data source are then extended to the graph model through the adapter.

The handler also communicates directly with the adapter.

Since:
JTGO 4.0
See Also:
IlpGraphController.setGraphHandler(ilog.cpl.graph.IlpGraphHandler), IlpAbstractNodeAdapter, IlpDataSource

Field Summary
 
Fields inherited from interface ilog.cpl.graph.IlpNodeHandler
LINK_FROM_NODE, LINK_FROM_PORT, LINK_TO_NODE, LINK_TO_PORT
 
Constructor Summary
  IlpGraphHandlerWithDataSource(IlpMutableGraphModel model, IlpGraphView view, IlpGraphController controller, IlpAbstractNodeAdapter adapter, IlpMutableDataSource datasource)
          Creates the handler.
protected IlpGraphHandlerWithDataSource(IlpMutableGraphModel model, IlpGraphView view, IlpGraphController controller, IlpAbstractNodeAdapter adapter, IlpMutableDataSource datasource, JComponent component)
          Creates the handler.
 
Method Summary
protected abstract  IlpGraphHandlerWithoutDataSource createSimpleHandler()
          Instantiates the non-datasource handler.
protected  IlpClass findIlpClass(Class clazz, IlpAttributeGroup attributes)
          Returns an IlpClass for the creation of a new object.
 IlpAbstractNodeAdapter getAdapter()
          Gets the adapter between the graph model and the data source.
 IlpMutableDataSource getDataSource()
          Gets the data source into which this handler will create objects.
 IlpMutableGraphModel getGraphModel()
          Returns the model to which this handler is associated.
 IlpGraphView getGraphView()
          Returns the view to which this handler is associated.
 void handleChangeRelationship(IlpRepresentationObject object, IlpRepresentationObject parent, IlpPosition position)
          Requests the change of relationship of an object.
 void handleCloneObject(Collection objects)
          Requests the creation of a set of copied objects.
 void handleCollapseObject(IlpRepresentationObject object)
          Requests the collapse of a container object.
 Object handleCreateObject(Class clazz, IlpAttributeGroup attributes, Map properties, IlpPosition position)
          Creates a temporary object in the model, an object in the data source, and asks the adapter to replace the temporary object with a real one.
 void handleExpandObject(IlpRepresentationObject object)
          Requests the expansion of a container object.
 void handleLoad(URL modelDescription)
          Erases the model and loads a set of objects, given as a URL, into it.
 void handleMoveObject(Map newPositions)
          Requests the change of the position or shape of a set of representation objects.
 void handleRemoveObject(Collection objects)
          Deletes a set of objects from the model.
 void handleUpdateObject(IlpRepresentationObject object, Map newValues)
          Requests a change to some of the properties of an object.
protected  boolean propagatePositionToDataSource(IlpObject object, IlpPositionSource reason)
          This method determines whether position changes are forwarded to the data source, or kept local in the graph view.
 void setDataSource(IlpMutableDataSource datasource)
           
protected  void setGraphController(IlpGraphController controller)
          Sets the controller component.
protected  void setGraphModel(IlpMutableGraphModel model)
           
protected  void setGraphView(IlpGraphView view)
           
 void setPropagatePositionToDataSource(boolean value)
          Sets if position changes shall be forwarded to the data source, or kept local in the graph view.
 
Methods inherited from class ilog.cpl.graph.IlpAbstractGraphHandler
createDefaultClass, createObject, createObjectId, endBatch, getClassName, getDefaultClass, getGraphController, getHandlerLogger, startBatch
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlpGraphHandlerWithDataSource

protected IlpGraphHandlerWithDataSource(IlpMutableGraphModel model,
                                        IlpGraphView view,
                                        IlpGraphController controller,
                                        IlpAbstractNodeAdapter adapter,
                                        IlpMutableDataSource datasource,
                                        JComponent component)
Creates the handler.

Parameters:
model - The model attached to the component.
view - The view attached to the component.
controller - The controller associated with this handler.
adapter - The adapter attached to the component.
datasource - The datasource attached to the adapter.
component - The component that the controller is attached to.

IlpGraphHandlerWithDataSource

public IlpGraphHandlerWithDataSource(IlpMutableGraphModel model,
                                     IlpGraphView view,
                                     IlpGraphController controller,
                                     IlpAbstractNodeAdapter adapter,
                                     IlpMutableDataSource datasource)
Creates the handler.

Parameters:
model - The component model.
view - The component view.
controller - The component controller.
adapter - The adapter between the data source and the model.
datasource - The data source.
Method Detail

createSimpleHandler

protected abstract IlpGraphHandlerWithoutDataSource createSimpleHandler()
Instantiates the non-datasource handler.

Internal method or field: do not use!

getGraphModel

public IlpMutableGraphModel getGraphModel()
Returns the model to which this handler is associated.

Overrides:
getGraphModel in class IlpAbstractGraphHandler
Internal method or field: do not use!

setGraphModel

protected void setGraphModel(IlpMutableGraphModel model)
Internal method or field: do not use!

getGraphView

public IlpGraphView getGraphView()
Returns the view to which this handler is associated.


setGraphView

protected void setGraphView(IlpGraphView view)
Internal method or field: do not use!

setGraphController

protected void setGraphController(IlpGraphController controller)
Description copied from class: IlpAbstractGraphHandler
Sets the controller component.

Overrides:
setGraphController in class IlpAbstractGraphHandler
Internal method or field: do not use!

getDataSource

public IlpMutableDataSource getDataSource()
Gets the data source into which this handler will create objects.


setDataSource

public void setDataSource(IlpMutableDataSource datasource)
Internal method or field: do not use!

getAdapter

public IlpAbstractNodeAdapter getAdapter()
Gets the adapter between the graph model and the data source.


handleCreateObject

public Object handleCreateObject(Class clazz,
                                 IlpAttributeGroup attributes,
                                 Map properties,
                                 IlpPosition position)
Creates a temporary object in the model, an object in the data source, and asks the adapter to replace the temporary object with a real one.

Parameters:
clazz - An implementation of IlpRepresentationNode.
attributes - A set of attributes for the object to be created, or null.
properties - A set of hints for the object to be created, or null.
position - The desired position/shape of the object, or null.
Returns:
Identifier of the object that has been created

handleRemoveObject

public void handleRemoveObject(Collection objects)
Deletes a set of objects from the model.

Parameters:
objects - A collection of IlpRepresentationObjects.

handleUpdateObject

public void handleUpdateObject(IlpRepresentationObject object,
                               Map newValues)
Requests a change to some of the properties of an object.

Parameters:
object - The representation object.
newValues - A map, mapping each IlpAttribute to be changed to its new values.

handleCloneObject

public void handleCloneObject(Collection objects)
Requests the creation of a set of copied objects.

Parameters:
objects - A collection of IlpRepresentationObjects.

handleChangeRelationship

public void handleChangeRelationship(IlpRepresentationObject object,
                                     IlpRepresentationObject parent,
                                     IlpPosition position)
Requests the change of relationship of an object.

Parameters:
object - The representation object.
parent - The new parent of the object; null implies a root object.
position - The position of the object.
See Also:
IlpNodeHandler.handleChangeRelationship(ilog.cpl.model.IlpRepresentationObject, ilog.cpl.model.IlpRepresentationObject, ilog.cpl.graphic.IlpPosition)

propagatePositionToDataSource

protected boolean propagatePositionToDataSource(IlpObject object,
                                                IlpPositionSource reason)
This method determines whether position changes are forwarded to the data source, or kept local in the graph view.

The default implementation always returns true, which means that it synchronizes the position of the object in the data source with the one in the view. To modify this behavior, you can specify a different value through method setPropagatePositionToDataSource(boolean) or override this method in subclasses. A subclass could always returns false, so that the view could be modified locally without persistency.

Parameters:
object - The business object for which the position is to be modified.
reason - The reason for the position change, or null if it is unknown.
See Also:
setPropagatePositionToDataSource(boolean)

setPropagatePositionToDataSource

public void setPropagatePositionToDataSource(boolean value)
Sets if position changes shall be forwarded to the data source, or kept local in the graph view.

You can use this method to modify the default implementation, which always returns true, which means that it synchronizes the position of the object in the data source with the one in the view.

Parameters:
value - Flag indicating if position will be forwarded to data source or not.
Since:
JViews 7.5
See Also:
propagatePositionToDataSource(IlpObject, IlpPositionSource)

handleMoveObject

public void handleMoveObject(Map newPositions)
Requests the change of the position or shape of a set of representation objects.

Parameters:
newPositions - A map from IlpRepresentationObject to IlpPositionChange.

handleExpandObject

public void handleExpandObject(IlpRepresentationObject object)
Requests the expansion of a container object.

Parameters:
object - The container to be expanded.

handleCollapseObject

public void handleCollapseObject(IlpRepresentationObject object)
Requests the collapse of a container object.

Parameters:
object - The container to be collapsed.

handleLoad

public void handleLoad(URL modelDescription)
Erases the model and loads a set of objects, given as a URL, into it.

Parameters:
modelDescription - The URL that gives access to the model description. Its format depends on the handler implementation.

findIlpClass

protected IlpClass findIlpClass(Class clazz,
                                IlpAttributeGroup attributes)
Returns an IlpClass for the creation of a new object.

This method should be overridden in subclasses. The default implementation uses an IlpDefaultClassManager and returns an IlpClass containing the given attributes.

Overrides:
findIlpClass in class IlpAbstractGraphHandler
Parameters:
clazz - An implementation of IlpRepresentationNode.
attributes - A set of attributes for the object to be created, or null.
See Also:
IlpAbstractGraphHandler.createObject(Class, IlpAttributeGroup, Map, Object)


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.   . All Rights Reserved.