ilog.cpl.graphic
Class IlpAbstractGraphicController

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

public abstract class IlpAbstractGraphicController
extends Object
implements IlpGraphicController, MouseInputListener, KeyListener, FocusListener

This class is part of the MVC trio and is responsible for storing and setting the interactors to the view and graphics. It is also responsible for creating or retrieving the graphic view configuration and setting it in the graphic view.

Since:
JTGO 3.0

Field Summary
protected  WeakReference lastInteractedObject
          The object interaction state used for the last interacted object.
protected  WeakHashMap lastInteractionStates
           
 
Constructor Summary
IlpAbstractGraphicController(IlpContext context)
          Creates a controller.
 
Method Summary
 void attach(IlpGraphicView v)
          Attaches a controller to a given view.
protected  void attachView(IlpGraphicView view)
           
protected  IlpGraphicViewStyleManager createGraphicViewStyleManager(IlpContext context, IlpGraphicView view)
          Creates the graphic view style manager, either by retrieving it from an XML file or any other storage, or simply by creating an empty instance.
protected  IlpViewInteractionContext createViewInteractionContext(IlpGraphicView view)
          Returns a new view interaction context for the given view.
 void detach()
          Detaches a controller from its view.
 void focusGained(FocusEvent e)
           
 void focusLost(FocusEvent e)
           
 IlpObjectInteractor getCompleteObjectInteractor(IlpRepresentationObject object)
          Returns the interactor responsible for handling events on the given object in the graphic view controlled by this instance.
 IlpContext getContext()
          Returns the context used by the interaction with the graphic view.
 IlpInteractorManager getDefaultInteractorManager()
          Gets the default interactor manager.
 IlpViewInteractor getDefaultViewInteractor()
          Returns the default view interactor.
 Component getFocusEventComponent()
          Returns the component, closely related to the view, whose focus events shall be forwarded to the interactor.
 Component getKeyEventComponent()
          Returns the component, closely related to the view, whose key events shall be forwarded to the interactor.
 Component getMouseEventComponent()
          Returns the component, closely related to the view, whose mouse events shall be forwarded to the interactor.
 IlpInteractionState getObjectInteractionState(IlpObjectInteractor ointeractor, IlpObjectInteractionContext ctxt)
          Looks up the interaction state corresponding to the given context used by object interaction.
 IlpObjectInteractor getObjectInteractor(IlpObject object)
          Returns the interactor associated with the given business object in the graphic view controlled by this instance.
 IlpObjectInteractor getObjectInteractor(IlpObject object, IlpAttribute attribute)
          Returns the interactor associated with the given business object and the given attribute in the graphic view controlled by this instance.
 IlpObjectInteractor getObjectInteractor(IlpRepresentationObject object)
          Returns the interactor associated with the given object in the graphic view controlled by this instance.
 IlpObjectInteractor getObjectInteractor(IlpRepresentationObject object, IlpAttribute attribute)
          Returns the interactor associated with the given object and the given attribute in the graphic view controlled by this instance.
 IlpObjectInteractor getObjectInteractor(Object key)
          Returns the interactor associated with the given key in the graphic view controlled by this instance.
 IlpGraphicView getView()
          Returns the view that is being controlled.
 IlpViewInteractionContext getViewInteractionContext()
          Returns the view interaction context.
 IlpViewInteractor getViewInteractor()
          Returns the interactor associated with the view.
protected  void initGraphicViewStyleManager(IlpContext context, IlpGraphicView view)
          Creates the graphic view style manager, either retrieving the configuration from an XML file or any other storage, or simply creating an empty instance; and initializes the view with it.
protected  void initInteractorManager(IlpContext context)
          Returns the default interactor manager from the context.
 void keyPressed(KeyEvent e)
           
 void keyReleased(KeyEvent e)
           
 void keyTyped(KeyEvent e)
           
 void mouseClicked(MouseEvent e)
           
 void mouseDragged(MouseEvent e)
           
 void mouseEntered(MouseEvent e)
           
 void mouseExited(MouseEvent e)
           
 void mouseMoved(MouseEvent e)
           
 void mousePressed(MouseEvent e)
           
 void mouseReleased(MouseEvent e)
           
 void removeObjectInteractors()
          Remove all the interactors associated with representation objects.
 void removeObjectInteractors(IlpObject object)
          Removes all the interactors associated with the given business object.
 void removeObjectInteractors(IlpRepresentationObject object)
          Removes all the interactors associated with the given object.
 void setDefaultInteractorManager(IlpInteractorManager defaultManager)
          Sets the default interactor manager.
 void setDefaultViewInteractor(IlpViewInteractor interactor)
          Sets the default view interactor.
 void setObjectInteractor(IlpObject object, IlpAttribute attribute, IlpObjectInteractor interactor)
          Sets the interactor associated with the given business object and attribute.
 void setObjectInteractor(IlpObject object, IlpObjectInteractor interactor)
          Sets the interactor associated with the given business object.
 void setObjectInteractor(IlpRepresentationObject object, IlpAttribute attribute, IlpObjectInteractor interactor)
          Sets the interactor associated with the given object and attribute.
 void setObjectInteractor(IlpRepresentationObject object, IlpObjectInteractor interactor)
          Sets the interactor associated with the given object.
 void setObjectInteractor(Object key, IlpObjectInteractor interactor)
          Sets the interactor associated with the given key.
 void setViewInteractor(IlpViewInteractor interactor)
          Sets the interactor associated with the view.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lastInteractedObject

protected WeakReference lastInteractedObject
The object interaction state used for the last interacted object.

Internal method or field: do not use!

lastInteractionStates

protected WeakHashMap lastInteractionStates
Internal method or field: do not use!
Constructor Detail

IlpAbstractGraphicController

public IlpAbstractGraphicController(IlpContext context)
Creates a controller. It can be attached to a view by calling setController on the view.

Throws:
IllegalArgumentException - if the given context is equal to null.
Method Detail

getMouseEventComponent

public Component getMouseEventComponent()
Returns the component, closely related to the view, whose mouse events shall be forwarded to the interactor.


getKeyEventComponent

public Component getKeyEventComponent()
Returns the component, closely related to the view, whose key events shall be forwarded to the interactor.


getFocusEventComponent

public Component getFocusEventComponent()
Returns the component, closely related to the view, whose focus events shall be forwarded to the interactor.


getContext

public IlpContext getContext()
Returns the context used by the interaction with the graphic view.

Specified by:
getContext in interface IlpGraphicController

getView

public IlpGraphicView getView()
Returns the view that is being controlled.

Specified by:
getView in interface IlpGraphicController

getViewInteractor

public IlpViewInteractor getViewInteractor()
Returns the interactor associated with the view.

Specified by:
getViewInteractor in interface IlpGraphicController

setViewInteractor

public void setViewInteractor(IlpViewInteractor interactor)
Sets the interactor associated with the view.

Specified by:
setViewInteractor in interface IlpGraphicController

getDefaultViewInteractor

public IlpViewInteractor getDefaultViewInteractor()
Returns the default view interactor. This is called when view interactors detach themselves: they install the default view interactor instead of themselves.

Specified by:
getDefaultViewInteractor in interface IlpGraphicController

setDefaultViewInteractor

public void setDefaultViewInteractor(IlpViewInteractor interactor)
Sets the default view interactor. This method is usually called during initialization of the component only.

Note: Setting the default view interactor does not change the currently active view interactor immediately. It has an effect on the view interactor only the next time an interactor detaches itself.

See Also:
setViewInteractor(ilog.cpl.interactor.IlpViewInteractor)

setDefaultInteractorManager

public void setDefaultInteractorManager(IlpInteractorManager defaultManager)
Sets the default interactor manager.

The default interactor manager is used to retrieve interactor information, when it cannot be found in this graphic controller.


getDefaultInteractorManager

public IlpInteractorManager getDefaultInteractorManager()
Gets the default interactor manager.

The default manager is used to retrieve interactor information, when it cannot be found in this controller.

By default, the default interactor manager is defined in the application context used to create the graphic controller instance.


attach

public void attach(IlpGraphicView v)
Attaches a controller to a given view. The graphic view style manager is initialized and set in the graphic view.

Specified by:
attach in interface IlpGraphicController
Throws:
IllegalStateException - if the controller is already attached to a graphic view.

attachView

protected void attachView(IlpGraphicView view)
Internal method or field: do not use!

detach

public void detach()
Detaches a controller from its view.

Specified by:
detach in interface IlpGraphicController

getViewInteractionContext

public final IlpViewInteractionContext getViewInteractionContext()
Returns the view interaction context.


getObjectInteractionState

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

Parameters:
ointeractor - The object interactor.
ctxt - The context where the event occurred.

initGraphicViewStyleManager

protected void initGraphicViewStyleManager(IlpContext context,
                                           IlpGraphicView view)
Creates the graphic view style manager, either retrieving the configuration from an XML file or any other storage, or simply creating an empty instance; and initializes the view with it.

Internal method or field: do not use!

createGraphicViewStyleManager

protected IlpGraphicViewStyleManager createGraphicViewStyleManager(IlpContext context,
                                                                   IlpGraphicView view)
Creates the graphic view style manager, either by retrieving it from an XML file or any other storage, or simply by creating an empty instance.

See Also:
IlpDefaultGraphicViewStyleManager
Internal method or field: do not use!

createViewInteractionContext

protected IlpViewInteractionContext createViewInteractionContext(IlpGraphicView view)
Returns a new view interaction context for the given view. This method is called each time this controller is attached to a new view. It may be redefined in subclasses to provide a new type of view interactor.

Parameters:
view - The view for which to create a view interaction context.

initInteractorManager

protected void initInteractorManager(IlpContext context)
Returns the default interactor manager from the context.

Internal method or field: do not use!

getObjectInteractor

public IlpObjectInteractor getObjectInteractor(Object key)
Returns the interactor associated with the given key in the graphic view controlled by this instance.

Specified by:
getObjectInteractor in interface IlpInteractorManager

getObjectInteractor

public IlpObjectInteractor getObjectInteractor(IlpRepresentationObject object)
Returns the interactor associated with the given object in the graphic view controlled by this instance.

Specified by:
getObjectInteractor in interface IlpInteractorManager

getObjectInteractor

public IlpObjectInteractor getObjectInteractor(IlpRepresentationObject object,
                                               IlpAttribute attribute)
Returns the interactor associated with the given object and the given attribute in the graphic view controlled by this instance.

Specified by:
getObjectInteractor in interface IlpInteractorManager

getObjectInteractor

public IlpObjectInteractor getObjectInteractor(IlpObject object)
Returns the interactor associated with the given business object in the graphic view controlled by this instance.

Specified by:
getObjectInteractor in interface IlpInteractorManager

getObjectInteractor

public IlpObjectInteractor getObjectInteractor(IlpObject object,
                                               IlpAttribute attribute)
Returns the interactor associated with the given business object and the given attribute in the graphic view controlled by this instance.

Specified by:
getObjectInteractor in interface IlpInteractorManager

setObjectInteractor

public void setObjectInteractor(Object key,
                                IlpObjectInteractor interactor)
Sets the interactor associated with the given key.

Specified by:
setObjectInteractor in interface IlpMutableInteractorManager

setObjectInteractor

public void setObjectInteractor(IlpRepresentationObject object,
                                IlpObjectInteractor interactor)
Sets the interactor associated with the given object.

Specified by:
setObjectInteractor in interface IlpMutableInteractorManager

setObjectInteractor

public void setObjectInteractor(IlpRepresentationObject object,
                                IlpAttribute attribute,
                                IlpObjectInteractor interactor)
Sets the interactor associated with the given object and attribute.

Specified by:
setObjectInteractor in interface IlpMutableInteractorManager

setObjectInteractor

public void setObjectInteractor(IlpObject object,
                                IlpObjectInteractor interactor)
Sets the interactor associated with the given business object.

Specified by:
setObjectInteractor in interface IlpMutableInteractorManager

setObjectInteractor

public void setObjectInteractor(IlpObject object,
                                IlpAttribute attribute,
                                IlpObjectInteractor interactor)
Sets the interactor associated with the given business object and attribute.

Specified by:
setObjectInteractor in interface IlpMutableInteractorManager

removeObjectInteractors

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

Specified by:
removeObjectInteractors in interface IlpMutableInteractorManager

removeObjectInteractors

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

Specified by:
removeObjectInteractors in interface IlpMutableInteractorManager

removeObjectInteractors

public void removeObjectInteractors()
Remove all the interactors associated with representation objects.

Specified by:
removeObjectInteractors in interface IlpMutableInteractorManager
Since:
JTGO 4.0

mouseClicked

public void mouseClicked(MouseEvent e)
Specified by:
mouseClicked in interface MouseListener

mousePressed

public void mousePressed(MouseEvent e)
Specified by:
mousePressed in interface MouseListener

mouseReleased

public void mouseReleased(MouseEvent e)
Specified by:
mouseReleased in interface MouseListener

mouseEntered

public void mouseEntered(MouseEvent e)
Specified by:
mouseEntered in interface MouseListener

mouseExited

public void mouseExited(MouseEvent e)
Specified by:
mouseExited in interface MouseListener

mouseDragged

public void mouseDragged(MouseEvent e)
Specified by:
mouseDragged in interface MouseMotionListener

mouseMoved

public void mouseMoved(MouseEvent e)
Specified by:
mouseMoved in interface MouseMotionListener

keyTyped

public void keyTyped(KeyEvent e)
Specified by:
keyTyped in interface KeyListener

keyPressed

public void keyPressed(KeyEvent e)
Specified by:
keyPressed in interface KeyListener

keyReleased

public void keyReleased(KeyEvent e)
Specified by:
keyReleased in interface KeyListener

focusGained

public void focusGained(FocusEvent e)
Specified by:
focusGained in interface FocusListener

focusLost

public void focusLost(FocusEvent e)
Specified by:
focusLost in interface FocusListener

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.

Internal method or field: do not use!


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