ilog.tgo.interactor
Class IltMoveInteractor

java.lang.Object
  extended by ilog.views.IlvManagerViewInteractor
      extended by ilog.tgo.interactor.IltMoveInteractor
All Implemented Interfaces:
Serializable

public class IltMoveInteractor
extends IlvManagerViewInteractor

This class is a view interactor which lets the user move a ILOG JTGO composite graphic object, triggering a method when it is done.

This interactor expects to be pushed onto a view like this:

      AWTEvent event = ...; // a mouse down event
      view.pushInteractor(new IltMoveInteractor(composite),event);
 
The interactor removes itself from the manager view after calling the trigger method.

See Also:
Serialized Form

Constructor Summary
IltMoveInteractor(IltcCompositeGraphic composite)
          Creates the interactor.
 
Method Summary
protected  void drawGhost(Graphics g)
          Draws an outline of the composite graphic object being moved.
 IltcCompositeGraphic getGraphic()
          Returns the composite graphic object.
protected  void processMouseEvent(MouseEvent event)
          Processes the mouse events.
protected  void processMouseMotionEvent(MouseEvent event)
          Processes the mouse moved and mouse dragged events.
protected  void trigger(AWTEvent event, float dx, float dy)
          This method is called when the user has released the mouse, thus finishing the move operation.
protected  boolean validate(IlvPoint pos, IlvPoint origpos)
          Returns true if the moved distance is sufficiently large for warranting a move of the object.
 
Methods inherited from class ilog.views.IlvManagerViewInteractor
addFocusListener, addKeyListener, addMouseListener, addMouseMotionListener, allowEnsureVisible, allowEnsureVisible, attach, detach, disableEvents, drawGhost, enableEvents, ensureVisible, ensureVisible, getManager, getManagerView, getTransformer, handleExpose, isXORGhost, processEvent, processFocusEvent, processKeyEvent, removeFocusListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, setXORGhost
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IltMoveInteractor

public IltMoveInteractor(IltcCompositeGraphic composite)
Creates the interactor.

Parameters:
composite - the composite graphic object which received the initial mouse-down event
Method Detail

getGraphic

public IltcCompositeGraphic getGraphic()
Returns the composite graphic object.


validate

protected boolean validate(IlvPoint pos,
                           IlvPoint origpos)
Returns true if the moved distance is sufficiently large for warranting a move of the object.

The default implementation of this function returns true when the distance between pos and and origpos is at least 4 pixels.

Parameters:
pos - current position (in view coordinates)
origpos - original position (in view coordinates)

drawGhost

protected void drawGhost(Graphics g)
Draws an outline of the composite graphic object being moved.

Overrides:
drawGhost in class IlvManagerViewInteractor
Parameters:
g - a graphics context in XOR mode
See Also:
IlvManagerViewInteractor.handleExpose(java.awt.Graphics), IlvManagerViewInteractor.setXORGhost(boolean)

trigger

protected void trigger(AWTEvent event,
                       float dx,
                       float dy)
This method is called when the user has released the mouse, thus finishing the move operation. It is responsible for actually moving the object.

Parameters:
event - the event that launched the method.
dx - the horizontal move
dy - the vertical move

processMouseEvent

protected void processMouseEvent(MouseEvent event)
Description copied from class: IlvManagerViewInteractor
Processes the mouse events. The method dispatches the event to the MouseListener registered with this interactor (if any).

Overrides:
processMouseEvent in class IlvManagerViewInteractor
Parameters:
event - The event.
See Also:
IlvManagerViewInteractor.addMouseListener(java.awt.event.MouseListener)

processMouseMotionEvent

protected void processMouseMotionEvent(MouseEvent event)
Description copied from class: IlvManagerViewInteractor
Processes the mouse moved and mouse dragged events. The method dispatches the event to the MouseMotionListener registered with this interactor (if any).

Overrides:
processMouseMotionEvent in class IlvManagerViewInteractor
Parameters:
event - The event.
See Also:
IlvManagerViewInteractor.addMouseMotionListener(java.awt.event.MouseMotionListener)


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