public class IlvDashboardLinkManager extends Object
Constructor and Description |
---|
IlvDashboardLinkManager(IlvDashboardEditor editor)
Creates an
IlvDashboardLinkManager . |
Modifier and Type | Method and Description |
---|---|
protected void |
enterDestination(IlvDashboardSymbol symbol)
This method is called when the mouse enter a symbol
|
protected void |
enterLinkCreationMode(IlvDashboardDiagram dashboard,
IlvPaletteSymbol link)
This method is invoked before the Dashboard Editor switches to
link creation mode.
|
protected void |
enterOrigin(IlvDashboardSymbol symbol)
This method is called when the mouse enters a symbol
while the user selects a link origin.
|
protected void |
exitDestination(IlvDashboardSymbol symbol)
This method is called when the mouse exits a symbol
while the make link interactor is selecting a link destination.
|
protected void |
exitLinkCreationMode(IlvDashboardDiagram dashboard)
This method is invoked when the Dashboard Editor exits
link creation mode.
|
protected void |
exitOrigin(IlvDashboardSymbol symbol)
This method is called when the mouse exits a symbol
while the user chooses a link origin.
|
protected IlvDashboardSymbol |
getDestination()
Returns the selected link destination symbol.
|
IlvDashboardEditor |
getEditor()
Returns the Dashboard Editor object.
|
protected Color |
getHighlightColor()
Returns the color used to draw the connection rectangles.
|
static Iterator<IlvGraphic> |
getInPorts(IlvDashboardSymbol symbol)
Returns all the in port elements of a given symbol.
|
Cursor |
getIntermediatePointCursor()
Returns the cursor used when the mouse is at a location
where an intermediate point can be created.
|
Cursor |
getInvalidCursor()
Returns the invalid cursor.
|
protected Point |
getLastPoint()
Returns the last location processed by the link manager through
processOrigin(IlvDashboardDiagram, Point) or
processDestination(IlvDashboardDiagram, Point) |
protected IlvDashboardSymbol |
getOrigin()
Returns the selected link origin symbol.
|
static Iterator<IlvGraphic> |
getOutPorts(IlvDashboardSymbol symbol)
Returns all the out port elements of a given symbol.
|
protected IlvGraphic |
getPort(IlvTransformer transfo,
Point point)
Returns the link port of a previously processed symbol.
|
protected IlvRect |
getPortBoundingBox(IlvDashboardSymbol symbol,
IlvGraphic port)
Returns the bounding box of a link port.
|
int |
getPortMinSize()
Returns the port minimum size.
|
Cursor |
getValidCursor()
Returns the cursor used when the mouse is at a valid link
connection location.
|
protected void |
highlightDestination(IlvDashboardSymbol symbol,
boolean highlight)
Highlights or stops highlighting a link destination candidate.
|
protected void |
highlightOrigin(IlvDashboardSymbol symbol,
boolean highlight)
Highlights or stops highlighting a link origin candidate.
|
protected void |
highlightPort(Graphics dst,
IlvRect rect)
Highlights a symbol link port.
|
protected void |
highlightSymbol(Graphics dst,
IlvRect rect)
Highlights a symbol.
|
boolean |
isIntermediatePointsModeAllowed()
Checks whether intermediate point mode allowed or not.
|
protected boolean |
isLinkCreationAllowed(IlvDashboardDiagram dashboard)
Tests whether the Dashboard Editor is in a state that allows creating links,
for example,there are at least two nodes in the dashboard
diagram.
|
protected boolean |
isValidDestination(IlvPaletteSymbol link,
IlvDashboardSymbol sourceNode,
IlvGraphic portOut,
IlvDashboardSymbol targetNode,
IlvGraphic portIn)
Tests whether a symbol or a port is accepted as a link destination.
|
protected boolean |
isValidOrigin(IlvPaletteSymbol link,
IlvDashboardSymbol sourceNode,
IlvGraphic outPort)
Tests whether a symbol or a port is accepted as a link origin.
|
protected void |
linkAdded(IlvDashboardSymbol linkSymbol)
Invoked when a link symbol has been created and added to
the dashboard diagram.
|
protected void |
originSelected(IlvDashboardSymbol origin,
IlvGraphic outPort)
Invoked when the link origin has been selected.
|
protected boolean |
processDestination(IlvDashboardDiagram dashboard,
Point point)
This function is called by the Make Link interactor at each mouse
motion event, when the user chooses the link destination.
|
protected boolean |
processOrigin(IlvDashboardDiagram dashboard,
Point point)
This function is repeatedly called when the user moves the mouse
while choosing the link origin symbol.
|
void |
setIntermediatePointCursor(Cursor cursor)
Sets the cursor to be used when the mouse is at a location
where an intermediate point can be created.
|
void |
setIntermediatePointsModeAllowed(boolean allowed)
Sets the intermediate points mode allowed.
|
void |
setInvalidCursor(Cursor cursor)
Sets the cursor to be used when the mouse is not at a valid location.
|
void |
setPortMinSize(int size)
Sets the minimum size of the link ports.
|
void |
setValidCursor(Cursor cursor)
Sets the cursor to be used when the mouse is at a valid link
connection location.
|
public IlvDashboardLinkManager(IlvDashboardEditor editor)
IlvDashboardLinkManager
.editor
- The Dashboard Editor instance.protected void originSelected(IlvDashboardSymbol origin, IlvGraphic outPort)
origin
- The selected link source symbol.outPort
- The selected out port, if any.public IlvDashboardEditor getEditor()
protected boolean isValidOrigin(IlvPaletteSymbol link, IlvDashboardSymbol sourceNode, IlvGraphic outPort)
When the user chooses the link origin, each time the mouse enters a symbol, this function is called once for the symbol itself and once for each out port of the symbol to collect the valid out ports of the symbol.
link
- The prototype of the link to be created.sourceNode
- The link source symbol to test.outPort
- The out port to test, or null
if the test
applies to the link source symbol itself. Note: the
name of the port object includes its prefix port_out_
or port_inout_
.true
if the link source is valid.IlvGraphic.getName()
protected boolean processOrigin(IlvDashboardDiagram dashboard, Point point)
dashboard
- The target dashboard diagram.point
- The current mouse location.true
if the mouse is at a valid link origin.protected IlvDashboardSymbol getOrigin()
protected IlvDashboardSymbol getDestination()
protected IlvGraphic getPort(IlvTransformer transfo, Point point)
transfo
- The transformer of the view.point
- The location of the potential port.protected void exitOrigin(IlvDashboardSymbol symbol)
symbol
- The previous symbol under the mouse pointer.protected void enterOrigin(IlvDashboardSymbol symbol)
isValidOrigin(IlvPaletteSymbol, IlvDashboardSymbol, IlvGraphic)
for the symbol itself (without specifying the out port)
and then for all its out ports.symbol
- The new symbol under the mouse pointer.public static Iterator<IlvGraphic> getInPorts(IlvDashboardSymbol symbol)
symbol
- The symbol.public static Iterator<IlvGraphic> getOutPorts(IlvDashboardSymbol symbol)
symbol
- The symbol.protected IlvRect getPortBoundingBox(IlvDashboardSymbol symbol, IlvGraphic port)
symbol
- The symbol containing the port.port
- The port.setPortMinSize(int)
protected boolean isValidDestination(IlvPaletteSymbol link, IlvDashboardSymbol sourceNode, IlvGraphic portOut, IlvDashboardSymbol targetNode, IlvGraphic portIn)
When the user chooses the link destination, each time the mouse enters a symbol, this function is called once for the symbol itself and once for each in port of the symbol to collect the valid in ports of the symbol.
link
- The prototype of the link to be created.sourceNode
- The link source symbol that has already been selected.portOut
- The selected out port if any, or null
if no out port is used. Note: the name of the given port
includes its
prefix port_out_
or port_inout_
.targetNode
- The link target symbol to test.portIn
- The in port to test,
or null if the test applies to the link target symbol itself.
Note: the name of the given port includes
its prefix port_in_
or port_inout_
.true
if the link destination is accepted.protected boolean processDestination(IlvDashboardDiagram dashboard, Point point)
isValidDestination(IlvPaletteSymbol, IlvDashboardSymbol, IlvGraphic, IlvDashboardSymbol, IlvGraphic)
to collect all the valid in ports of the symbol, and tests whether
the symbol itself can be connected. All the accepted locations are
then highlighted.dashboard
- The edited dashboard diagram.point
- The new mouse location.true
if the mouse is on a valid link target connection.protected void enterDestination(IlvDashboardSymbol symbol)
symbol
- The symbol previously under the mouse pointer.protected void exitDestination(IlvDashboardSymbol symbol)
symbol
- The symbol previously under the mouse pointer.protected void highlightDestination(IlvDashboardSymbol symbol, boolean highlight)
symbol
- The symbol.highlight
- true
if the symbol is to be highlighted.public void setPortMinSize(int size)
size
- The port minimum size.getPortMinSize()
,
getPortBoundingBox(IlvDashboardSymbol, IlvGraphic)
public int getPortMinSize()
setPortMinSize(int)
protected void highlightOrigin(IlvDashboardSymbol symbol, boolean highlight)
symbol
- The symbol.highlight
- true
if the symbol is to be highlighted.protected void highlightSymbol(Graphics dst, IlvRect rect)
dst
- The destination.rect
- The area to highlight.protected void highlightPort(Graphics dst, IlvRect rect)
dst
- The destination.rect
- The area to highlight.protected Color getHighlightColor()
highlightOrigin(IlvDashboardSymbol, boolean)
protected boolean isLinkCreationAllowed(IlvDashboardDiagram dashboard)
dashboard
- The current dashboard diagram.true
if links can be created.protected void enterLinkCreationMode(IlvDashboardDiagram dashboard, IlvPaletteSymbol link)
dashboard
- The target dashboard diagram where a link is
to be created.link
- The palette symbol corresponding to the link to
be created.protected void exitLinkCreationMode(IlvDashboardDiagram dashboard)
dashboard
- The target dashboard diagram.public boolean isIntermediatePointsModeAllowed()
public void setIntermediatePointsModeAllowed(boolean allowed)
allowed
- The intermediate points mode.public Cursor getInvalidCursor()
setInvalidCursor(Cursor)
public void setInvalidCursor(Cursor cursor)
cursor
- The cursor.getInvalidCursor()
,
setIntermediatePointCursor(Cursor)
,
setIntermediatePointsModeAllowed(boolean)
,
isIntermediatePointsModeAllowed()
public Cursor getIntermediatePointCursor()
setIntermediatePointCursor(Cursor)
public void setIntermediatePointCursor(Cursor cursor)
cursor
- The cursor.getIntermediatePointCursor()
public Cursor getValidCursor()
setValidCursor(Cursor)
public void setValidCursor(Cursor cursor)
cursor
- The valid cursor.getValidCursor()
protected Point getLastPoint()
processOrigin(IlvDashboardDiagram, Point)
or
processDestination(IlvDashboardDiagram, Point)
protected void linkAdded(IlvDashboardSymbol linkSymbol)
linkSymbol
- The newly added link symbol.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.