ilog.tgo.interactor
Class IltMakeLinkInteractor

java.lang.Object
  extended by ilog.views.IlvManagerViewInteractor
      extended by ilog.tgo.interactor.IltMakeLinkInteractor
All Implemented Interfaces:
IlvPermanentInteractorInterface, Serializable
Direct Known Subclasses:
IltMakePolyLinkInteractor

public class IltMakeLinkInteractor
extends IlvManagerViewInteractor
implements IlvPermanentInteractorInterface

This class is a view interactor which lets the user connect two nodes by a link.

By default, this interactor creates a straight link between the two nodes. However the following configuration is also available:

See Also:
Serialized Form

Nested Class Summary
static class IltMakeLinkInteractor.Gesture
          This class enumerates the possible gestures recognized by this interactor.
 
Constructor Summary
IltMakeLinkInteractor()
          Creates the interactor.
 
Method Summary
protected  boolean accept(IltCompositeGraphic graphic)
          This method tests if an object can be the origin or destination of the link.
protected  boolean acceptDestination(IltCompositeGraphic node)
          This method tests if a composite object can be the destination of the link.
protected  boolean acceptOrigin(IltCompositeGraphic node)
          This method tests if a composite object can be the origin of the link.
protected  void drawGhost(Graphics g)
          Draws an outline of the link to be created.
protected  boolean endOnDoubleClick()
          Returns true if the interactor will stop requesting points when the user performs a double-click.
 Color getPortsColor()
          Returns the color of the ports.
protected  void handleExpose(Graphics g)
          Called by the view when the view is drawn.
protected  boolean isEnoughDistance(IlvPoint p1, IlvPoint p2)
          Checks the distance between two consecutive points that are created.
 boolean isLinkConnectionPortMode()
          Returns true if the interactor allows the end-user to select the link connection ports.
 boolean isPermanent()
          Returns false if this interactor removes itself after processing an event.
 boolean isSelfLinkAllowed()
          Returns true if the creation of self-links is allowed, and returns false otherwise.
protected  boolean numberOfPointsReached()
          Returns true if the number of desired points is reached.
protected  void processMouseEvent(MouseEvent event)
          Processes the mouse events.
protected  void processMouseMotionEvent(MouseEvent event)
          Processes the mouse moved and mouse dragged events.
protected  void react(MouseEvent event)
          Allows you to implement an interaction when the user moves the mouse to add a point to the polypoint.
 void setLinkConnectionPortMode(boolean portMode)
          Allows or disallows the selection of link connection ports.
 void setPermanent(boolean set)
          Changes the mode of this interactor.
 void setPortsColor(Color color)
          Changes the color of the ports.
 void setSelfLinkAllowed(boolean allow)
          Enables or disables the creation of self-links.
 void trigger(AWTEvent event, IltObject origin, IltObject destination, IltCompositeGrapher grapher)
          This method is called when the user has released the mouse, thus finishing a drag operation.
 void trigger(AWTEvent event, IltObject origin, IltObject destination, IltLinkPort originPort, IltLinkPort destinationPort, IltCompositeGrapher grapher)
          This method is called when the user has released the mouse, thus finishing a drag operation.
 
Methods inherited from class ilog.views.IlvManagerViewInteractor
addFocusListener, addKeyListener, addMouseListener, addMouseMotionListener, allowEnsureVisible, allowEnsureVisible, attach, detach, disableEvents, drawGhost, enableEvents, ensureVisible, ensureVisible, getManager, getManagerView, getTransformer, 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

IltMakeLinkInteractor

public IltMakeLinkInteractor()
Creates the interactor.

Method Detail

isPermanent

public boolean isPermanent()
Returns false if this interactor removes itself after processing an event.

Specified by:
isPermanent in interface IlvPermanentInteractorInterface

setPermanent

public void setPermanent(boolean set)
Changes the mode of this interactor.

Specified by:
setPermanent in interface IlvPermanentInteractorInterface
Parameters:
set - the new mode.

isLinkConnectionPortMode

public boolean isLinkConnectionPortMode()
Returns true if the interactor allows the end-user to select the link connection ports.


setLinkConnectionPortMode

public void setLinkConnectionPortMode(boolean portMode)
Allows or disallows the selection of link connection ports.


getPortsColor

public Color getPortsColor()
Returns the color of the ports.


setPortsColor

public void setPortsColor(Color color)
Changes the color of the ports.


setSelfLinkAllowed

public final void setSelfLinkAllowed(boolean allow)
Enables or disables the creation of self-links. A self-link is a link with the same origin and destination node. The default value is true.

Since:
JViews 7.5
See Also:
isSelfLinkAllowed()

isSelfLinkAllowed

public final boolean isSelfLinkAllowed()
Returns true if the creation of self-links is allowed, and returns false otherwise.

Since:
JViews 7.5
See Also:
setSelfLinkAllowed(boolean), acceptDestination(ilog.tgo.graphic.IltCompositeGraphic)

handleExpose

protected void handleExpose(Graphics g)
Description copied from class: IlvManagerViewInteractor
Called by the view when the view is drawn. This method calls the method IlvManagerViewInteractor.drawGhost(java.awt.Graphics). If the interactor is in XOR Ghost drawing mode, the default XOR color of the view is set on the Graphics before calling drawGhost(Graphics).

Overrides:
handleExpose in class IlvManagerViewInteractor
Parameters:
g - The graphics.
See Also:
IlvManagerViewInteractor.drawGhost(java.awt.Graphics), IlvManagerViewInteractor.isXORGhost(), IlvManagerView.getDefaultXORColor()

isEnoughDistance

protected boolean isEnoughDistance(IlvPoint p1,
                                   IlvPoint p2)
Checks the distance between two consecutive points that are created.

This method returns always true, as this interactor does not support links with multiple points.

Since:
JViews 7.5
See Also:
IltMakePolyLinkInteractor

numberOfPointsReached

protected boolean numberOfPointsReached()
Returns true if the number of desired points is reached.

This method returns always false, as this interactor does not support links with multiple points.

Since:
JViews 7.5
See Also:
IltMakePolyLinkInteractor

endOnDoubleClick

protected boolean endOnDoubleClick()
Returns true if the interactor will stop requesting points when the user performs a double-click.

This method returns always false as this interactor does not support links with multiple points.

Since:
JViews 7.5

accept

protected boolean accept(IltCompositeGraphic graphic)
This method tests if an object can be the origin or destination of the link.

Parameters:
graphic - the graphic object to test

acceptOrigin

protected boolean acceptOrigin(IltCompositeGraphic node)
This method tests if a composite object can be the origin of the link.

The default implementation calls accept.

Parameters:
node - the node to test

acceptDestination

protected boolean acceptDestination(IltCompositeGraphic node)
This method tests if a composite object can be the destination of the link.

The default implementation calls accept. This method also verifies if self-links can be created or not.

Parameters:
node - the node to test

drawGhost

protected void drawGhost(Graphics g)
Draws an outline of the link to be created.

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

trigger

public void trigger(AWTEvent event,
                    IltObject origin,
                    IltObject destination,
                    IltCompositeGrapher grapher)
This method is called when the user has released the mouse, thus finishing a drag operation. It is responsible for creating the link and attaching it at the given node sides..

This implementation creates an IltLink with the IltSONET.State.Active state and adds it in the given grapher.

As this method instantiates an IltObject, any subclass which overrides this method to instantiate its own IltObject should never call super.trigger.

Parameters:
event - the event that launched the method.
origin - the start node of the link
destination - the end node of the link
grapher - the grapher in which the link should be displayed

trigger

public void trigger(AWTEvent event,
                    IltObject origin,
                    IltObject destination,
                    IltLinkPort originPort,
                    IltLinkPort destinationPort,
                    IltCompositeGrapher grapher)
This method is called when the user has released the mouse, thus finishing a drag operation. It is responsible for creating the link and attaching it at the given node sides..

This implementation creates an IltLink with the IltSONET.State.Active state and adds it in the given grapher.

As this method instantiates an IltObject, any subclass which overrides this method to instantiate its own IltObject should never call super.trigger.

Parameters:
event - the event that launched the method.
origin - the start node of the link
destination - the end node of the link
originPort - the IltLinkPort to connect at, or null
destinationPort - the IltLinkPort to connect at, or null
grapher - the grapher in which the link should be displayed

react

protected void react(MouseEvent event)
Allows you to implement an interaction when the user moves the mouse to add a point to the polypoint. The point is given in the object's coordinate system.

Parameters:
event - Mouse event
Since:
JViews 7.5

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.