ilog.cpl.graph
Class IlpGraphController

java.lang.Object
  extended by ilog.cpl.graphic.IlpAbstractGraphicController
      extended by ilog.cpl.graph.IlpGraphController
All Implemented Interfaces:
IlpGraphicController, IlpInteractorManager, IlpMutableInteractorManager, FocusListener, KeyListener, MouseListener, MouseMotionListener, EventListener, MouseInputListener
Direct Known Subclasses:
IlpEquipmentController, IlpNetworkController

public abstract class IlpGraphController
extends IlpAbstractGraphicController

This class manages interactions between the user and the view.

Since:
JTGO 4.0

Field Summary
 
Fields inherited from class ilog.cpl.graphic.IlpAbstractGraphicController
lastInteractedObject, lastInteractionStates
 
Constructor Summary
protected IlpGraphController(IlpContext context)
          Creates a controller.
 
Method Summary
protected  void cleanMutableStyleSheet(Collection objects)
          Removes dynamic rules that have been added to the component mutable style sheet.
 void cloneObject(Collection objects)
          Requests the creation of a set of copied objects.
 void collapseObject(IlpRepresentationObject object)
          Requests the collapse of a container object.
 Object createObject(Class clazz, IlpAttributeGroup attributes, Map properties, IlpPosition position)
          Requests the creation of an object belonging to a given class, with a set of attributes, and with a given position.
 void expandObject(IlpRepresentationObject object)
          Requests the expansion of a container object.
 IlpObjectInteractor getCollapsionBackgroundInteractor()
          Returns the interactor attached to the background of a subnetwork.
 IlpObjectInteractor getCollapsionIconInteractor()
          Returns the interactor attached to the collapse icon of a subnetwork.
 IlpObjectInteractor getCompleteObjectInteractor(IlpRepresentationObject object)
          Returns the interactor responsible for handling events on the given object in the graphic view controlled by this instance.
protected abstract  Logger getControllerLogger()
          Access the logger.
protected abstract  IlpGraphHandler getDefaultHandler()
          Retrieves the default handler.
protected abstract  Class getDefaultHandlerClass()
          Retrieves the default handler class.
 IlpExpansionHandler getExpansionHandler()
          Returns the handler for container operations.
 IlpObjectInteractor getExpansionIconInteractor()
          Returns the interactor attached to the icon of a collapsed subnetwork.
 IlpObjectInteractor getExpansionInteractor()
          Returns the interactor attached to the base element of a collapsed subnetwork.
 Component getFocusEventComponent()
          Returns the component, closely related to the view, whose focus events shall be forwarded to the interactor.
 IlpGraphHandler getGraphHandler()
          Returns the handler for everything.
protected  IlpGraphView getGraphView()
          Access the view.
 Component getKeyEventComponent()
          Returns the component, closely related to the view, whose key events shall be forwarded to the interactor.
 IlpLoadHandler getLoadHandler()
          Returns the handler for load operations.
 Component getMouseEventComponent()
          Returns the component, closely related to the view, whose mouse events shall be forwarded to the interactor.
 IlpNodeHandler getNodeHandler()
          Returns the handler for object-related operations.
 IlpInteractionState getObjectInteractionState(IlpObjectInteractor oInteractor, IlpObjectInteractionContext context)
          Looks up the interaction state corresponding to the given context used by object interaction.
 IlpPositionHandler getPositionHandler()
          Returns the handler for move/reshape operations.
 void handleChangeRelationship(IlpRepresentationNode object, IlpRepresentationNode parent, IlpPosition position)
          Requests the change of relationship of an object.
 boolean isUsingCustomHandler()
          Verifies which handler is being used.
 void load(URL modelDescription)
          Erases the model and loads a new set of objects, given as a URL, into it.
 void moveObject(Map newPositions)
          Requests a change to the position or shape of a set of representation objects.
 void removeObject(Collection objects)
          Requests the deletion of a set of objects.
 void removeObjectInteractors(IlpRepresentationObject object)
          Removes all the interactors associated with the given object.
 void setCollapsionBackgroundInteractor(IlpObjectInteractor collapsionBackgroundInteractor)
          Sets the interactor attached to the background of a subnetwork.
 void setCollapsionIconInteractor(IlpObjectInteractor collapsionIconInteractor)
          Sets the interactor attached to the collapse icon of a subnetwork.
 void setExpansionHandler(IlpExpansionHandler expansionHandler)
          Sets the handler for container operations.
 void setExpansionIconInteractor(IlpObjectInteractor expansionIconInteractor)
          Sets the interactor attached to the icon of a collapsed subnetwork.
 void setExpansionInteractor(IlpObjectInteractor expansionInteractor)
          Sets the interactor attached to the base element of a collapsed subnetwork.
 void setGraphHandler(IlpGraphHandler handler)
          Sets the handler for everything.
 void setLoadHandler(IlpLoadHandler loadHandler)
          Sets the handler for load operations.
 void setNodeHandler(IlpNodeHandler nHandler)
          Sets the handler for object-related operations.
 void setPositionHandler(IlpPositionHandler positionHandler)
          Sets the handler for move/reshape operations.
 void updateObject(IlpRepresentationNode object, Map newValues)
          Requests a change to some properties of an object.
 
Methods inherited from class ilog.cpl.graphic.IlpAbstractGraphicController
attach, attachView, createGraphicViewStyleManager, createViewInteractionContext, detach, focusGained, focusLost, getContext, getDefaultInteractorManager, getDefaultViewInteractor, getObjectInteractor, getObjectInteractor, getObjectInteractor, getObjectInteractor, getObjectInteractor, getView, getViewInteractionContext, getViewInteractor, initGraphicViewStyleManager, initInteractorManager, keyPressed, keyReleased, keyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, removeObjectInteractors, removeObjectInteractors, setDefaultInteractorManager, setDefaultViewInteractor, setObjectInteractor, setObjectInteractor, setObjectInteractor, setObjectInteractor, setObjectInteractor, setViewInteractor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlpGraphController

protected IlpGraphController(IlpContext context)
Creates a controller. It can be attached to an IlpGraphView by calling setController on the view.

Parameters:
context - The context to be used within the controller.
Method Detail

getControllerLogger

protected abstract Logger getControllerLogger()
Access the logger.

Returns:
The appropriate logger to be used internally to log messages.

getGraphView

protected IlpGraphView getGraphView()
Access the view.

Returns:
The view in which this controller is attached to.

getMouseEventComponent

public Component getMouseEventComponent()
Description copied from class: IlpAbstractGraphicController
Returns the component, closely related to the view, whose mouse events shall be forwarded to the interactor.

Overrides:
getMouseEventComponent in class IlpAbstractGraphicController

getKeyEventComponent

public Component getKeyEventComponent()
Description copied from class: IlpAbstractGraphicController
Returns the component, closely related to the view, whose key events shall be forwarded to the interactor.

Overrides:
getKeyEventComponent in class IlpAbstractGraphicController

getFocusEventComponent

public Component getFocusEventComponent()
Description copied from class: IlpAbstractGraphicController
Returns the component, closely related to the view, whose focus events shall be forwarded to the interactor.

Overrides:
getFocusEventComponent in class IlpAbstractGraphicController

getDefaultHandlerClass

protected abstract Class getDefaultHandlerClass()
Retrieves the default handler class.

Internal method or field: do not use!

getDefaultHandler

protected abstract IlpGraphHandler getDefaultHandler()
Retrieves the default handler.

Internal method or field: do not use!

getNodeHandler

public IlpNodeHandler getNodeHandler()
Returns the handler for object-related operations.


setNodeHandler

public void setNodeHandler(IlpNodeHandler nHandler)
Sets the handler for object-related operations.


getPositionHandler

public IlpPositionHandler getPositionHandler()
Returns the handler for move/reshape operations.


setPositionHandler

public void setPositionHandler(IlpPositionHandler positionHandler)
Sets the handler for move/reshape operations.


getExpansionHandler

public IlpExpansionHandler getExpansionHandler()
Returns the handler for container operations.


setExpansionHandler

public void setExpansionHandler(IlpExpansionHandler expansionHandler)
Sets the handler for container operations.


getLoadHandler

public IlpLoadHandler getLoadHandler()
Returns the handler for load operations.


setLoadHandler

public void setLoadHandler(IlpLoadHandler loadHandler)
Sets the handler for load operations.


getGraphHandler

public IlpGraphHandler getGraphHandler()
Returns the handler for everything.

This method returns the handler if set through setGraphHandler. The method returns null if individual handlers have been installed for object-related, move/reshape, container, loading or editing operations.

Returns:
The handler for all operations, or null.
See Also:
setGraphHandler(ilog.cpl.graph.IlpGraphHandler), getNodeHandler(), getPositionHandler(), getExpansionHandler(), getLoadHandler()
Internal method or field: do not use!

setGraphHandler

public void setGraphHandler(IlpGraphHandler handler)
Sets the handler for everything.

The default handler for the network component is IlpNetworkHandlerWithoutDataSource; there is a predefined handler to be used with data source (IlpNetworkHandlerWithDataSource).

Similarly, there is the IlpEquipmentHandlerWithoutDataSource and IlpEquipmentHandlerWithDataSource for the equipment component.

See Also:
IlpNetworkHandlerWithoutDataSource, IlpNetworkHandlerWithDataSource, IlpEquipmentHandlerWithoutDataSource, IlpEquipmentHandlerWithDataSource
Internal method or field: do not use!

isUsingCustomHandler

public boolean isUsingCustomHandler()
Verifies which handler is being used.

Returns:
true if the user has installed a non-default (custom) handler. false if otherwise.
Internal method or field: do not use!

createObject

public Object createObject(Class clazz,
                           IlpAttributeGroup attributes,
                           Map properties,
                           IlpPosition position)
Requests the creation of an object belonging to a given class, with a set of attributes, and with a given position.

Parameters:
clazz - A subclass 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:
The identifier of the object that has been created or null if the object could not be created by this controller.
See Also:
IlpNodeHandler.handleCreateObject(java.lang.Class, ilog.cpl.model.IlpAttributeGroup, java.util.Map, ilog.cpl.graphic.IlpPosition)

removeObject

public void removeObject(Collection objects)
Requests the deletion of a set of objects.

Parameters:
objects - A collection of IlpRepresentationNodes.
See Also:
IlpNodeHandler.handleRemoveObject(java.util.Collection)

cleanMutableStyleSheet

protected void cleanMutableStyleSheet(Collection objects)
Removes dynamic rules that have been added to the component mutable style sheet.

This method is used to remove object selectors from the mutable style sheet when the objects are removed from the model after a user interaction. Selectors of type: #id and #id:linkLayoutRenderer are removed.

Parameters:
objects - Collection of IlpRepresentationObject
Since:
JViews 7.5
See Also:
removeObject(Collection)

updateObject

public void updateObject(IlpRepresentationNode object,
                         Map newValues)
Requests a change to some properties of an object.

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

cloneObject

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

Parameters:
objects - A collection of IlpRepresentationNodes.
See Also:
IlpNodeHandler.handleCloneObject(java.util.Collection)

handleChangeRelationship

public void handleChangeRelationship(IlpRepresentationNode object,
                                     IlpRepresentationNode 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)

moveObject

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

Parameters:
newPositions - A map from IlpRepresentationNode to IlpPositionChange.
See Also:
IlpPositionHandler.handleMoveObject(java.util.Map)

expandObject

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

Parameters:
object - The container to be expanded.
See Also:
IlpExpansionHandler.handleExpandObject(ilog.cpl.model.IlpRepresentationObject)

collapseObject

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

Parameters:
object - The container to be collapsed.
See Also:
IlpExpansionHandler.handleCollapseObject(ilog.cpl.model.IlpRepresentationObject)

load

public void load(URL modelDescription)
Erases the model and loads a new set of objects, given as a URL, into it. The format of the model description depends on the handler implementation.

See Also:
IlpLoadHandler.handleLoad(java.net.URL)

removeObjectInteractors

public void removeObjectInteractors(IlpRepresentationObject object)
Removes all the interactors associated with the given object.

Specified by:
removeObjectInteractors in interface IlpMutableInteractorManager
Overrides:
removeObjectInteractors in class IlpAbstractGraphicController

getCompleteObjectInteractor

public IlpObjectInteractor getCompleteObjectInteractor(IlpRepresentationObject object)
Returns the interactor responsible for handling events on the given object in the graphic view controlled by this instance.

Overrides:
getCompleteObjectInteractor in class IlpAbstractGraphicController
Internal method or field: do not use!

getObjectInteractionState

public IlpInteractionState getObjectInteractionState(IlpObjectInteractor oInteractor,
                                                     IlpObjectInteractionContext context)
Looks up the interaction state corresponding to the given context used by object interaction.

Overrides:
getObjectInteractionState in class IlpAbstractGraphicController
Parameters:
oInteractor - The object interactor.
context - The context in which the event occurred.

getCollapsionIconInteractor

public IlpObjectInteractor getCollapsionIconInteractor()
Returns the interactor attached to the collapse icon of a subnetwork.


setCollapsionIconInteractor

public void setCollapsionIconInteractor(IlpObjectInteractor collapsionIconInteractor)
Sets the interactor attached to the collapse icon of a subnetwork.

Parameters:
collapsionIconInteractor - The new interactor.

getCollapsionBackgroundInteractor

public IlpObjectInteractor getCollapsionBackgroundInteractor()
Returns the interactor attached to the background of a subnetwork.


setCollapsionBackgroundInteractor

public void setCollapsionBackgroundInteractor(IlpObjectInteractor collapsionBackgroundInteractor)
Sets the interactor attached to the background of a subnetwork.

Parameters:
collapsionBackgroundInteractor - The new interactor.

getExpansionIconInteractor

public IlpObjectInteractor getExpansionIconInteractor()
Returns the interactor attached to the icon of a collapsed subnetwork.


setExpansionIconInteractor

public void setExpansionIconInteractor(IlpObjectInteractor expansionIconInteractor)
Sets the interactor attached to the icon of a collapsed subnetwork.

Parameters:
expansionIconInteractor - The new interactor.

getExpansionInteractor

public IlpObjectInteractor getExpansionInteractor()
Returns the interactor attached to the base element of a collapsed subnetwork.


setExpansionInteractor

public void setExpansionInteractor(IlpObjectInteractor expansionInteractor)
Sets the interactor attached to the base element of a collapsed subnetwork.

Parameters:
expansionInteractor - The new interactor.


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