ilog.tgo.interactor
Class IltEditLinkPortInteractor

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

public class IltEditLinkPortInteractor
extends IlvManagerViewInteractor
implements IlvPermanentInteractorInterface

This class is a view interactor which lets the user add or remove link connection ports of nodes by clicking on them.

This interactor provides two edition modes:

  1. FREE_LINK_PORT_MODE: In this mode,
  2. EXISTING_LINK_PORT_MODE: In this mode, only the link ports that currently exist in the IltLinkPort enumeration can be set on a node. Link ports that are currently set in the node will be displayed as active link ports. Link ports that exist but are not currently set in the node will be displayed as inactive link ports. You can click on an active or inactive link port to change its state.

When this interactor is set in a Network or Equipment component, all changes performed by this interactor will be stored in the component through a mutable style sheet. Methods getStyleSheet(ilog.views.IlvManagerView), attachStyleSheet(ilog.views.IlvManagerView) and detachStyleSheet(ilog.views.IlvManagerView) are used to define the mutable style sheet that will be used for the given view. By default, these methods create a specific mutable style sheet for each view. This mutable style sheet is appended to the list of style sheets currently set in the component. If later on, method setStyleSheets is called, attention must be taken to not erase any changes performed by this interactor. The method getStyleSheet() can be used to retrieve the current mutable style sheet and save it for future use.

This interactor has the following constraints:

Since:
JTGO 2.6
See Also:
IlpMutableStyleSheet, IlpNetwork, IlpEquipment, IltLinkPort, Serialized Form

Field Summary
static int EXISTING_LINK_PORT_MODE
          This interactor mode indicates that only the link ports that are currently defined can be edited by the interactor.
static int FREE_LINK_PORT_MODE
          This interactor mode indicates that link ports will be created whenever the user clicks on a point within a node.
 
Constructor Summary
IltEditLinkPortInteractor()
          Creates the interactor.
 
Method Summary
 IltLinkPort addLinkPort(IltCompositeGraphic graphic, IltLinkPort pin)
          Adds the given link connection port to the node.
 IltLinkPort addLinkPort(IltCompositeGraphic graphic, IlvRect linkConnectionRect, IlvPoint location)
          Creates a link connection port on a node, at a given position.
protected  void attach(IlvManagerView view)
          Called when the interactor is attached to the manager view.
protected  void attachStyleSheet(IlvManagerView view)
          Initializes a mutable style sheet to the given view.
protected  String createLinkPortName(IltCompositeGraphic graphic, float fx, float fy)
          Returns the name that will be used to create a new link port in the given object.
protected  void detach()
          Called when the interactor is detached from the view.
protected  void detachStyleSheet(IlvManagerView view)
          Ends the style sheet edition.
 Color getActiveColor()
          Returns the color used to draw active link ports.
 Color getInactiveColor()
          Returns the color used to draw inactive link ports.
 int getMode()
          Returns the interactor mode.
protected  IlpMutableStyleSheet getStyleSheet()
          Returns the mutable style sheet that is being used by this interactor to save the modifications in the current attached Network or Equipment components.
 IlpMutableStyleSheet getStyleSheet(IlvManagerView view)
          Returns the mutable style sheet used to store changes in link port configuration for the given view.
 boolean isPermanent()
          Returns false if this interactor removes itself after processing an event.
protected  void processMouseEvent(MouseEvent event)
          Processes the mouse events.
 void removeLinkPort(IltCompositeGraphic graphic, IltLinkPort pin)
          Removes a link connection port from a node.
 void setActiveColor(Color c)
          Sets the color used to draw active link ports.
 void setInactiveColor(Color c)
          Returns the color used to draw inactive link ports.
 void setMode(int m)
          Defines the interactor mode: FREE_LINK_PORT_MODE EXISTING_LINK_PORT_MODE
 void setPermanent(boolean set)
          Changes the mode of this interactor.
protected  void setStyleSheet(IlpMutableStyleSheet css)
          Sets the mutable style sheet that is being used by this interactor to save the modifications in the Network and Equipment components.
 
Methods inherited from class ilog.views.IlvManagerViewInteractor
addFocusListener, addKeyListener, addMouseListener, addMouseMotionListener, allowEnsureVisible, allowEnsureVisible, disableEvents, drawGhost, drawGhost, enableEvents, ensureVisible, ensureVisible, getManager, getManagerView, getTransformer, handleExpose, isXORGhost, processEvent, processFocusEvent, processKeyEvent, processMouseMotionEvent, removeFocusListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, setXORGhost
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FREE_LINK_PORT_MODE

public static int FREE_LINK_PORT_MODE
This interactor mode indicates that link ports will be created whenever the user clicks on a point within a node.

Since:
JTGO 4.5

EXISTING_LINK_PORT_MODE

public static int EXISTING_LINK_PORT_MODE
This interactor mode indicates that only the link ports that are currently defined can be edited by the interactor.

Since:
JTGO 4.5
Constructor Detail

IltEditLinkPortInteractor

public IltEditLinkPortInteractor()
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.

getMode

public int getMode()
Returns the interactor mode.

Returns:
FREE_LINK_PORT_MODE or EXISTING_LINK_PORT_MODE
Since:
JTGO 4.5

setMode

public void setMode(int m)
Defines the interactor mode:

Parameters:
m - Interactor mode
Since:
JTGO 4.5

getActiveColor

public Color getActiveColor()
Returns the color used to draw active link ports.

Returns:
color that is used to draw link ports that are currently set in the node.
Since:
JTGO 4.5

setActiveColor

public void setActiveColor(Color c)
Sets the color used to draw active link ports.

Parameters:
c - Color that is used to draw link ports that are currently set in the node.
Since:
JTGO 4.5

getInactiveColor

public Color getInactiveColor()
Returns the color used to draw inactive link ports.

This color is only used if the interactor mode is set to EXISTING_LINK_PORT_MODE.

Returns:
color that is used to draw link ports that exist but which are not currently set in the node.
Since:
JTGO 4.5

setInactiveColor

public void setInactiveColor(Color c)
Returns the color used to draw inactive link ports.

This color is only used if the interactor mode is set to EXISTING_LINK_PORT_MODE.

Parameters:
c - color that is used to draw link ports that exist but which are not currently set in the node.
Since:
JTGO 4.5

attach

protected void attach(IlvManagerView view)
Description copied from class: IlvManagerViewInteractor
Called when the interactor is attached to the manager view.

Overrides:
attach in class IlvManagerViewInteractor
Parameters:
view - The manager view.
See Also:
IlvManagerViewInteractor.detach()

detach

protected void detach()
Description copied from class: IlvManagerViewInteractor
Called when the interactor is detached from the view.

Overrides:
detach in class IlvManagerViewInteractor
See Also:
IlvManagerViewInteractor.attach(ilog.views.IlvManagerView)

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)

addLinkPort

public IltLinkPort addLinkPort(IltCompositeGraphic graphic,
                               IlvRect linkConnectionRect,
                               IlvPoint location)
Creates a link connection port on a node, at a given position.

Parameters:
graphic - the graphic object
linkConnectionRect - the graphic object's link connection rectangle, in manager coordinates
location - the new link connection port's current location, in manager coordinates
Returns:
the new link connection port's name

addLinkPort

public IltLinkPort addLinkPort(IltCompositeGraphic graphic,
                               IltLinkPort pin)
Adds the given link connection port to the node.

Parameters:
graphic - Graphic
pin - Link connection port
Returns:
Link connection port that was added
Since:
JTGO 4.5

removeLinkPort

public void removeLinkPort(IltCompositeGraphic graphic,
                           IltLinkPort pin)
Removes a link connection port from a node.


getStyleSheet

public IlpMutableStyleSheet getStyleSheet(IlvManagerView view)
Returns the mutable style sheet used to store changes in link port configuration for the given view.

Parameters:
view - Manager view
Returns:
Mutable style sheet that is being used for the given view or null if the view has never been edited before or is not able to use style sheet customization.
Since:
JTGO 4.5

getStyleSheet

protected IlpMutableStyleSheet getStyleSheet()
Returns the mutable style sheet that is being used by this interactor to save the modifications in the current attached Network or Equipment components.

Returns:
Mutable style sheet being used when this interactor is attached to a component, or null otherwise.
Since:
JTGO 4.5

setStyleSheet

protected void setStyleSheet(IlpMutableStyleSheet css)
Sets the mutable style sheet that is being used by this interactor to save the modifications in the Network and Equipment components.

This method must be called only when attaching this interactor to the view.

Since:
JTGO 4.5
See Also:
attachStyleSheet(ilog.views.IlvManagerView view)

attachStyleSheet

protected void attachStyleSheet(IlvManagerView view)
Initializes a mutable style sheet to the given view. This mutable style sheet allows changed performed by this interactor to be changed in the Network and Equipment components using CSS.

Parameters:
view - Manager view
Since:
JTGO 4.0

detachStyleSheet

protected void detachStyleSheet(IlvManagerView view)
Ends the style sheet edition.

Parameters:
view - Manager view
Since:
JTGO 4.0

createLinkPortName

protected String createLinkPortName(IltCompositeGraphic graphic,
                                    float fx,
                                    float fy)
Returns the name that will be used to create a new link port in the given object.

Parameters:
graphic - Graphic where the link port will be added
fx - main point's x coordinate, relative to the bounding box (0 = left, 1 = right)
fy - main point's y coordinate, relative to the bounding box (0 = top, 1 = bottom)
Returns:
Link connection port name.
Since:
JTGO 4.5


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