public abstract class IlpGraphHandlerWithDataSource extends IlpAbstractGraphHandler
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.
IlpGraphController.setGraphHandler(ilog.cpl.graph.IlpGraphHandler)
,
IlpAbstractNodeAdapter
,
IlpDataSource
LINK_FROM_NODE, LINK_FROM_PORT, LINK_TO_NODE, LINK_TO_PORT
Modifier | Constructor and Description |
---|---|
|
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.
|
Modifier and Type | Method and Description |
---|---|
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<? extends IlpRepresentationNode> 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<String,Object> 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<IlpRepresentationNode,IlpPositionChange> newPositions)
Requests the change of the position or shape of a set of representation
objects.
|
void |
handleRemoveObject(Collection<? extends IlpRepresentationNode> 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.
|
createDefaultClass, createObject, createObjectId, endBatch, getClassName, getDefaultClass, getGraphController, getHandlerLogger, startBatch
protected IlpGraphHandlerWithDataSource(IlpMutableGraphModel model, IlpGraphView view, IlpGraphController controller, IlpAbstractNodeAdapter adapter, IlpMutableDataSource datasource, JComponent component)
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.public IlpGraphHandlerWithDataSource(IlpMutableGraphModel model, IlpGraphView view, IlpGraphController controller, IlpAbstractNodeAdapter adapter, IlpMutableDataSource datasource)
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.protected abstract IlpGraphHandlerWithoutDataSource createSimpleHandler()
public IlpMutableGraphModel getGraphModel()
getGraphModel
in class IlpAbstractGraphHandler
protected void setGraphModel(IlpMutableGraphModel model)
public IlpGraphView getGraphView()
protected void setGraphView(IlpGraphView view)
protected void setGraphController(IlpGraphController controller)
IlpAbstractGraphHandler
setGraphController
in class IlpAbstractGraphHandler
public IlpMutableDataSource getDataSource()
public void setDataSource(IlpMutableDataSource datasource)
public IlpAbstractNodeAdapter getAdapter()
public Object handleCreateObject(Class<?> clazz, IlpAttributeGroup attributes, Map<String,Object> properties, IlpPosition position)
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
.public void handleRemoveObject(Collection<? extends IlpRepresentationNode> objects)
objects
- A collection of IlpRepresentationObject
s.public void handleUpdateObject(IlpRepresentationObject object, Map newValues)
object
- The representation object.newValues
- A map, mapping each IlpAttribute
to be
changed to its new values.public void handleCloneObject(Collection<? extends IlpRepresentationNode> objects)
objects
- A collection of IlpRepresentationObject
s.public void handleChangeRelationship(IlpRepresentationObject object, IlpRepresentationObject parent, IlpPosition position)
object
- The representation object.parent
- The new parent of the object; null
implies a root object.position
- The position of the object.IlpNodeHandler.handleChangeRelationship(ilog.cpl.model.IlpRepresentationObject, ilog.cpl.model.IlpRepresentationObject, ilog.cpl.graphic.IlpPosition)
protected boolean propagatePositionToDataSource(IlpObject object, IlpPositionSource reason)
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.
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.setPropagatePositionToDataSource(boolean)
public void setPropagatePositionToDataSource(boolean value)
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.
value
- Flag indicating if position will be forwarded to data
source or not.propagatePositionToDataSource(IlpObject, IlpPositionSource)
public void handleMoveObject(Map<IlpRepresentationNode,IlpPositionChange> newPositions)
newPositions
- A map from IlpRepresentationObject
to
IlpPositionChange
.public void handleExpandObject(IlpRepresentationObject object)
object
- The container to be expanded.public void handleCollapseObject(IlpRepresentationObject object)
object
- The container to be collapsed.public void handleLoad(URL modelDescription)
modelDescription
- The URL that gives access to the model
description. Its format depends on the
handler implementation.protected IlpClass findIlpClass(Class<?> clazz, IlpAttributeGroup attributes)
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.
findIlpClass
in class IlpAbstractGraphHandler
clazz
- An implementation of IlpRepresentationNode
.attributes
- A set of attributes for the object to be created,
or null
.IlpAbstractGraphHandler.createObject(Class, IlpAttributeGroup, Map, Object)
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.