public class IltEditLinkPortInteractor extends IlvManagerViewInteractor implements IlvPermanentInteractorInterface
This interactor provides two edition modes:
FREE_LINK_PORT_MODE
: In this mode,
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:
IlpMutableStyleSheet
,
IlpNetwork
,
IlpEquipment
,
IltLinkPort
,
Serialized FormModifier and Type | Field and Description |
---|---|
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 and Description |
---|
IltEditLinkPortInteractor()
Creates the interactor.
|
Modifier and Type | Method and Description |
---|---|
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,
double fx,
double 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.
|
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
public static int FREE_LINK_PORT_MODE
public static int EXISTING_LINK_PORT_MODE
public IltEditLinkPortInteractor()
public boolean isPermanent()
false
if this interactor removes itself after processing
an event.isPermanent
in interface IlvPermanentInteractorInterface
public void setPermanent(boolean set)
setPermanent
in interface IlvPermanentInteractorInterface
set
- the new mode.public int getMode()
FREE_LINK_PORT_MODE
or EXISTING_LINK_PORT_MODE
public void setMode(int m)
m
- Interactor modepublic Color getActiveColor()
public void setActiveColor(Color c)
c
- Color that is used to draw link ports
that are currently set in the node.public Color getInactiveColor()
This color is only used if the interactor mode is
set to EXISTING_LINK_PORT_MODE
.
public void setInactiveColor(Color c)
This color is only used if the interactor mode is
set to EXISTING_LINK_PORT_MODE
.
c
- color that is used to draw link ports that exist
but which are not currently set in the node.protected void attach(IlvManagerView view)
IlvManagerViewInteractor
attach
in class IlvManagerViewInteractor
view
- The manager view.IlvManagerViewInteractor.detach()
protected void detach()
IlvManagerViewInteractor
detach
in class IlvManagerViewInteractor
IlvManagerViewInteractor.attach(ilog.views.IlvManagerView)
protected void processMouseEvent(MouseEvent event)
IlvManagerViewInteractor
MouseListener
registered with this interactor (if any).processMouseEvent
in class IlvManagerViewInteractor
event
- The event.IlvManagerViewInteractor.addMouseListener(java.awt.event.MouseListener)
public IltLinkPort addLinkPort(IltCompositeGraphic graphic, IlvRect linkConnectionRect, IlvPoint location)
graphic
- the graphic objectlinkConnectionRect
- the graphic object's link connection rectangle, in manager coordinateslocation
- the new link connection port's current location, in manager coordinatespublic IltLinkPort addLinkPort(IltCompositeGraphic graphic, IltLinkPort pin)
graphic
- Graphicpin
- Link connection portpublic void removeLinkPort(IltCompositeGraphic graphic, IltLinkPort pin)
public IlpMutableStyleSheet getStyleSheet(IlvManagerView view)
view
- Manager viewnull
if the view has never been
edited before or is not able to use style sheet customization.protected IlpMutableStyleSheet getStyleSheet()
null
otherwise.protected void setStyleSheet(IlpMutableStyleSheet css)
This method must be called only when attaching this interactor to the view.
attachStyleSheet(ilog.views.IlvManagerView view)
protected void attachStyleSheet(IlvManagerView view)
view
- Manager viewprotected void detachStyleSheet(IlvManagerView view)
view
- Manager viewprotected String createLinkPortName(IltCompositeGraphic graphic, double fx, double fy)
graphic
- Graphic where the link port will be addedfx
- 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)© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.