org.openbp.cockpit.modeler
Class AutoConnector

java.lang.Object
  extended by org.openbp.cockpit.modeler.AutoConnector

public class AutoConnector
extends java.lang.Object

The autoconnector tries to auto-connect an inserted node or socket to the current node/socket using control and data links.

Author:
Heiko Erhardt

Field Summary
static int DLA_CASTABLE_TYPES
          Data link autoconnector operation mode: Connect castable types
static int DLA_COMPATIBLE_TYPES
          Data link autoconnector operation mode: Connect compatible types
static int DLA_CONVERTIBLE_TYPES
          Data link autoconnector operation mode: Connect convertible types
static int DLA_IDENTICAL_NAMES
          Data link autoconnector operation mode: Connect identical names
static int DLA_IDENTICAL_TYPES
          Data link autoconnector operation mode: Connect identical types
static int DLA_OFF
          Data link autoconnector operation mode: Off
 
Constructor Summary
AutoConnector(Modeler modeler, CH.ifa.draw.framework.Figure newFigure)
          Constructor for auto-connecting a newly added figure to the currently selected figure.
AutoConnector(Modeler modeler, SocketFigure sourceSocketFigure, SocketFigure targetSocketFigure)
          Constructor for auto-connecting two given sockets.
 
Method Summary
 void adjustNodeGeometry()
          Adjusts the geometry of the newly inserted node, if any.
 void autoConnectAll()
          Tries to auto-connect control as well as data links if the autoconnect options allow for this.
 boolean autoConnectControlLink()
          Tries to auto-connect an inserted node or socket to the current node/socket.
 boolean autoConnectDataLinks()
          Tries to auto-connect an inserted node or socket to the current node/socket.
static java.lang.String checkAutoConversion(Param sourceParam, java.lang.String sourceMemberPath, Param targetParam, java.lang.String targetMemberPath)
          Checks if an auto conversion should be applied in order to link the given parameters.
static void determineDataLinkAutoConnectorMode()
          Called if the data link auto connector mode option has changed.
static int getDataLinkAutoConnectorMode()
          Gets the data link auto connector mode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DLA_OFF

public static final int DLA_OFF
Data link autoconnector operation mode: Off

See Also:
Constant Field Values

DLA_IDENTICAL_NAMES

public static final int DLA_IDENTICAL_NAMES
Data link autoconnector operation mode: Connect identical names

See Also:
Constant Field Values

DLA_IDENTICAL_TYPES

public static final int DLA_IDENTICAL_TYPES
Data link autoconnector operation mode: Connect identical types

See Also:
Constant Field Values

DLA_COMPATIBLE_TYPES

public static final int DLA_COMPATIBLE_TYPES
Data link autoconnector operation mode: Connect compatible types

See Also:
Constant Field Values

DLA_CASTABLE_TYPES

public static final int DLA_CASTABLE_TYPES
Data link autoconnector operation mode: Connect castable types

See Also:
Constant Field Values

DLA_CONVERTIBLE_TYPES

public static final int DLA_CONVERTIBLE_TYPES
Data link autoconnector operation mode: Connect convertible types

See Also:
Constant Field Values
Constructor Detail

AutoConnector

public AutoConnector(Modeler modeler,
                     CH.ifa.draw.framework.Figure newFigure)
Constructor for auto-connecting a newly added figure to the currently selected figure.

Parameters:
modeler - Modeler in charge
newFigure - The newly added NodeFigure or SocketFigure

AutoConnector

public AutoConnector(Modeler modeler,
                     SocketFigure sourceSocketFigure,
                     SocketFigure targetSocketFigure)
Constructor for auto-connecting two given sockets.

Parameters:
modeler - Modeler in charge
sourceSocketFigure - Source socket figure
targetSocketFigure - Target socket figure
Method Detail

getDataLinkAutoConnectorMode

public static int getDataLinkAutoConnectorMode()
Gets the data link auto connector mode.


determineDataLinkAutoConnectorMode

public static void determineDataLinkAutoConnectorMode()
Called if the data link auto connector mode option has changed.


checkAutoConversion

public static java.lang.String checkAutoConversion(Param sourceParam,
                                                   java.lang.String sourceMemberPath,
                                                   Param targetParam,
                                                   java.lang.String targetMemberPath)
Checks if an auto conversion should be applied in order to link the given parameters.

Parameters:
sourceParam - Source node parameter (may not be null)
sourceMemberPath - Source data member access path (may be null)
targetParam - Target node parameter (may not be null)
targetMemberPath - Target data member access path (may be null)
Returns:
The return value denotes the source member path that is required for the auto conversion. If no auto conversion is possible, null will be returned.

autoConnectAll

public void autoConnectAll()
Tries to auto-connect control as well as data links if the autoconnect options allow for this.


autoConnectControlLink

public boolean autoConnectControlLink()
Tries to auto-connect an inserted node or socket to the current node/socket.

Returns:
true: Source and target sockets have been determined and successfully connected.
false: Autoconnect not possible.

autoConnectDataLinks

public boolean autoConnectDataLinks()
Tries to auto-connect an inserted node or socket to the current node/socket.

Returns:
true: Source and target sockets have been determined and successfully connected.
false: Autoconnect not possible.

adjustNodeGeometry

public void adjustNodeGeometry()
Adjusts the geometry of the newly inserted node, if any. Adjusts the orientation of the node according to the processes' orientation, the position of the currently selected node and the orientation of the newly inserted node.



Copyright © 2011. All Rights Reserved.