org.openbp.cockpit.modeler.figures.process
Class ParamConnection

java.lang.Object
  extended by CH.ifa.draw.standard.AbstractFigure
      extended by org.openbp.cockpit.modeler.figures.spline.PolySplineFigure
          extended by org.openbp.cockpit.modeler.figures.spline.PolySplineConnection
              extended by org.openbp.cockpit.modeler.figures.process.ParamConnection
All Implemented Interfaces:
CH.ifa.draw.framework.ConnectionFigure, CH.ifa.draw.framework.Figure, CH.ifa.draw.framework.FigureChangeListener, CH.ifa.draw.util.Storable, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, UpdatableFigure, ProcessElementContainer, VisualElement, InteractionClient

public class ParamConnection
extends PolySplineConnection
implements ProcessElementContainer

Spline figure representing a data link.

Author:
Stephan Moritz
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.openbp.cockpit.modeler.figures.spline.PolySplineConnection
DECO_ANIMATION, label, NAN
 
Fields inherited from class org.openbp.cockpit.modeler.figures.spline.PolySplineFigure
drawDecorations, LEFT_CONTROLPOINT, RIGHT_CONTROLPOINT, segments
 
Fields inherited from interface org.openbp.cockpit.modeler.figures.VisualElement
VISUAL_DISPLAY_ALL, VISUAL_DND_PARTICIPANT, VISUAL_VISIBLE
 
Fields inherited from interface CH.ifa.draw.framework.Figure
POPUP_MENU
 
Constructor Summary
ParamConnection(DataLink dataLink, CH.ifa.draw.framework.Connector startConnector, CH.ifa.draw.framework.Connector endConnector, ProcessDrawing drawing)
          Constructor.
ParamConnection(ProcessDrawing drawing)
          Constructor for a virgin figure.
 
Method Summary
protected  void addEndConnectorChangeListener()
          Adds ourself as figure change listener to the end socket we are connected to.
protected  void addStartConnectorChangeListener()
          Adds ourself as figure change listener to the start socket we are connected to.
 boolean canConnectFigures(CH.ifa.draw.framework.Figure startFigure, CH.ifa.draw.framework.Figure endFigure, int flags)
          Delegates the check to the underlying control link.
 boolean connectsSame(CH.ifa.draw.framework.ConnectionFigure other)
          Tests whether a connection connects the same figures as another connection figure.
 void decodeGeometry()
           
protected  boolean decodeParameter(java.lang.String parameter, java.lang.String errName)
           
 void draw(java.awt.Graphics g)
           
protected  java.lang.String encode()
           
 void encodeGeometry()
           
 ProcessElementContainer findProcessElementContainer(int x, int y)
          Gets the direct child element at the given coordinates.
 ProcessElementContainer findProcessElementContainerInside(int x, int y)
          Gets the innermost child at the given coordinates.
 void flipOrientation()
          Flips (toggles) the locked orientation of the associated parameter figures.
 DataLink getDataLink()
          Returns the data link associated with this parameter connection.
 ProcessObject getProcessElement()
          Returns the contained process element.
 ProcessObject getReferredProcessElement()
          Returns the process element this figure refers to.
protected  void handleConnect(CH.ifa.draw.framework.Figure startFigure, CH.ifa.draw.framework.Figure endFigure)
          Handles the connection of a connection.
protected  void handleDisconnect(CH.ifa.draw.framework.Figure startFigure, CH.ifa.draw.framework.Figure endFigure)
          Handles the disconnection of a connection.
protected  void initializeFigureAttributes()
          Initializes the figure's drawing attributes.
 boolean isMinimized()
          Checks if the connection is minimized.
 boolean isOrientationLocked()
          Checks if the direction is locked.
 void layoutAndAdjustConnection()
          Performs a layout of the connection, adjusting connection start/end point directions.
 void release()
           
protected  void removeEndConnectorChangeListener()
          Removes ourself as figure change listener from the end socket we are connected to.
protected  void removeStartConnectorChangeListener()
          Removes ourself as figure change listener from the start socket we are connected to.
 CH.ifa.draw.framework.Figure selectionOnDelete()
          Start socket should be selected on deletion.
protected  boolean shouldReverse(CH.ifa.draw.framework.Figure startFigure, CH.ifa.draw.framework.Figure endFigure)
          Checks if connection should be reversed.
 void toggleOrientationLock()
          Toggles the orientation lock.
 java.lang.String toString()
          Returns a string representation of this object.
 
Methods inherited from class org.openbp.cockpit.modeler.figures.spline.PolySplineConnection
basicMoveBy, canConnect, connectedTextLocator, connectEnd, connectStart, constrainCtrlPoint, containsPoint, decode, disconnectEnd, disconnectStart, displayBox, dragActionTriggered, dragEnded, dragStarted, drawDecorations, drawSpline, endFigure, endPoint, endPoint, figureChanged, figureInvalidated, figureRemoved, figureRequestRemove, figureRequestUpdate, findVisualElement, findVisualElementInside, getAllDropRegions, getAllImportersAt, getDrawing, getDropRegions, getEndConnector, getEndFactor, getImportersAt, getLabel, getParentElement, getPresentationFigure, getStartConnector, getStartFactor, getSubClients, handleEvent, handles, importData, isVisible, layoutConnection, read, setDrawing, setEndConnector, setEndFactor, setPointAt, setStartConnector, setStartFactor, setVisible, startFigure, startPoint, startPoint, updateConnection, updateFigure, updatePresentationFigure, write
 
Methods inherited from class org.openbp.cockpit.modeler.figures.spline.PolySplineFigure
adjustOpposite, basicDisplayBox, basicSetCtrlPoint, canConnect, clearShapeCache, connectorAt, findSegment, getAnimationDecoration, getAttribute, getCtrlPointAt, getEndDecoration, getFrameColor, getPointAt, getPointOnCurve, getSplineBounds, getStartDecoration, getStroke, isEmpty, joinSegments, pointAt, pointCount, rebuildShapeCache, removePoint, segmentAt, setAnimationDecoration, setAttribute, setCtrlPointAt, setDrawDecorations, setEndDecoration, setFrameColor, setPointAt, setStartDecoration, setStroke, splitSegment
 
Methods inherited from class CH.ifa.draw.standard.AbstractFigure
addFigureChangeListener, addToContainer, center, changed, clone, connectionInsets, connectorVisibility, decompose, displayBox, displayBox, figures, findFigureInside, getZValue, includes, invalidate, listener, moveBy, removeFigureChangeListener, removeFromContainer, setZValue, size, willChange
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.openbp.cockpit.modeler.figures.VisualElement
findVisualElement, findVisualElementInside, getDrawing, getParentElement, getPresentationFigure, handleEvent, isVisible, setDrawing, setVisible, updatePresentationFigure
 
Methods inherited from interface CH.ifa.draw.framework.Figure
addFigureChangeListener, addToContainer, basicDisplayBox, canConnect, center, changed, clone, connectedTextLocator, connectionInsets, connectorAt, connectorVisibility, containsPoint, decompose, displayBox, displayBox, displayBox, figures, findFigureInside, getAttribute, getZValue, handles, includes, invalidate, isEmpty, listener, moveBy, removeFigureChangeListener, removeFromContainer, setAttribute, setZValue, size, willChange
 
Methods inherited from interface CH.ifa.draw.util.Storable
read, write
 
Methods inherited from interface org.openbp.jaspira.gui.interaction.InteractionClient
dragActionTriggered, dragEnded, dragStarted, getAllDropRegions, getAllImportersAt, getDropRegions, getImportersAt, getSubClients, importData
 
Methods inherited from interface org.openbp.cockpit.modeler.figures.generic.UpdatableFigure
updateFigure
 
Methods inherited from interface CH.ifa.draw.framework.ConnectionFigure
joinSegments, pointAt, pointCount, splitSegment
 

Constructor Detail

ParamConnection

public ParamConnection(DataLink dataLink,
                       CH.ifa.draw.framework.Connector startConnector,
                       CH.ifa.draw.framework.Connector endConnector,
                       ProcessDrawing drawing)
Constructor.

Parameters:
dataLink - Link represented by this figure
startConnector - Start connector the connection should attach to
endConnector - End connector the connection should attach to
drawing - Process drawing that owns the figure

ParamConnection

public ParamConnection(ProcessDrawing drawing)
Constructor for a virgin figure.

Parameters:
drawing - Process drawing that owns the figure
Method Detail

initializeFigureAttributes

protected void initializeFigureAttributes()
Initializes the figure's drawing attributes.


getDataLink

public DataLink getDataLink()
Returns the data link associated with this parameter connection.


toString

public java.lang.String toString()
Returns a string representation of this object.

Overrides:
toString in class java.lang.Object

draw

public void draw(java.awt.Graphics g)
Specified by:
draw in interface CH.ifa.draw.framework.Figure
Overrides:
draw in class PolySplineFigure
See Also:
AbstractFigure.draw(Graphics g)

canConnectFigures

public boolean canConnectFigures(CH.ifa.draw.framework.Figure startFigure,
                                 CH.ifa.draw.framework.Figure endFigure,
                                 int flags)
Delegates the check to the underlying control link. (true if data types match and one is an entry, the other one an exit parameter)

Specified by:
canConnectFigures in class PolySplineConnection
Parameters:
startFigure - Proposed start figure
endFigure - Proposed end figure
flags - App-specific flags that may define constraints for the connection check
See Also:
PolySplineConnection.canConnectFigures(Figure start, Figure end, int flags)

shouldReverse

protected boolean shouldReverse(CH.ifa.draw.framework.Figure startFigure,
                                CH.ifa.draw.framework.Figure endFigure)
Description copied from class: PolySplineConnection
Checks if connection should be reversed.

Overrides:
shouldReverse in class PolySplineConnection
Parameters:
startFigure - Proposed start figure
endFigure - Proposed end figure
Returns:
The default implementation always returns false
See Also:
PolySplineConnection.shouldReverse(Figure startFigure, Figure endFigure)

handleConnect

protected void handleConnect(CH.ifa.draw.framework.Figure startFigure,
                             CH.ifa.draw.framework.Figure endFigure)
Description copied from class: PolySplineConnection
Handles the connection of a connection. Does nothing by default.

Overrides:
handleConnect in class PolySplineConnection
Parameters:
startFigure - Figure to connnect to
endFigure - Figure to connnect to
See Also:
PolySplineConnection.handleConnect(Figure startFigure, Figure endFigure)

handleDisconnect

protected void handleDisconnect(CH.ifa.draw.framework.Figure startFigure,
                                CH.ifa.draw.framework.Figure endFigure)
Description copied from class: PolySplineConnection
Handles the disconnection of a connection. Does nothing by default.

Overrides:
handleDisconnect in class PolySplineConnection
Parameters:
startFigure - Figure to disconnect from
endFigure - Figure to disconnect from
See Also:
PolySplineConnection.handleDisconnect(Figure startFigure, Figure endFigure)

connectsSame

public boolean connectsSame(CH.ifa.draw.framework.ConnectionFigure other)
Description copied from class: PolySplineConnection
Tests whether a connection connects the same figures as another connection figure.

Specified by:
connectsSame in interface CH.ifa.draw.framework.ConnectionFigure
Specified by:
connectsSame in class PolySplineConnection
Parameters:
other - Connection to check on equality with this figure
Returns:
true: If the start and end figures of this connection and the other connection match.
false: If the start or end figure is different.
See Also:
PolySplineConnection.connectsSame(ConnectionFigure other)

addStartConnectorChangeListener

protected void addStartConnectorChangeListener()
Adds ourself as figure change listener to the start socket we are connected to.

Overrides:
addStartConnectorChangeListener in class PolySplineConnection
See Also:
PolySplineConnection.addStartConnectorChangeListener()

removeStartConnectorChangeListener

protected void removeStartConnectorChangeListener()
Removes ourself as figure change listener from the start socket we are connected to.

Overrides:
removeStartConnectorChangeListener in class PolySplineConnection
See Also:
PolySplineConnection.removeStartConnectorChangeListener()

addEndConnectorChangeListener

protected void addEndConnectorChangeListener()
Adds ourself as figure change listener to the end socket we are connected to.

Overrides:
addEndConnectorChangeListener in class PolySplineConnection
See Also:
PolySplineConnection.addEndConnectorChangeListener()

removeEndConnectorChangeListener

protected void removeEndConnectorChangeListener()
Removes ourself as figure change listener from the end socket we are connected to.

Overrides:
removeEndConnectorChangeListener in class PolySplineConnection
See Also:
PolySplineConnection.removeEndConnectorChangeListener()

isMinimized

public boolean isMinimized()
Checks if the connection is minimized.

Overrides:
isMinimized in class PolySplineConnection

release

public void release()
Specified by:
release in interface CH.ifa.draw.framework.Figure
Overrides:
release in class PolySplineConnection
See Also:
Figure.release()

isOrientationLocked

public boolean isOrientationLocked()
Checks if the direction is locked.


toggleOrientationLock

public void toggleOrientationLock()
Toggles the orientation lock.


flipOrientation

public void flipOrientation()
Flips (toggles) the locked orientation of the associated parameter figures.


layoutAndAdjustConnection

public void layoutAndAdjustConnection()
Description copied from class: PolySplineConnection
Performs a layout of the connection, adjusting connection start/end point directions. The method tries to ensure that the connection does not cross its start/end point figures by adjusting the direction the connection will take from its start or end point. By default, this method just calls the PolySplineConnection.layoutConnection() method.

Overrides:
layoutAndAdjustConnection in class PolySplineConnection
See Also:
PolySplineConnection.layoutAndAdjustConnection()

decodeGeometry

public void decodeGeometry()

encodeGeometry

public void encodeGeometry()

decodeParameter

protected boolean decodeParameter(java.lang.String parameter,
                                  java.lang.String errName)
Overrides:
decodeParameter in class PolySplineConnection

encode

protected java.lang.String encode()
Overrides:
encode in class PolySplineConnection

getProcessElement

public ProcessObject getProcessElement()
Description copied from interface: ProcessElementContainer
Returns the contained process element.

Specified by:
getProcessElement in interface ProcessElementContainer
See Also:
ProcessElementContainer.getProcessElement()

getReferredProcessElement

public ProcessObject getReferredProcessElement()
Description copied from interface: ProcessElementContainer
Returns the process element this figure refers to. The returned element will be used for property browser and tool tip display. This is usually the same as returned by ProcessElementContainer.getProcessElement(), however this might be different also for example for sockets of initial/final nodes sockets, which will return their parent node.

Specified by:
getReferredProcessElement in interface ProcessElementContainer
See Also:
ProcessElementContainer.getReferredProcessElement()

selectionOnDelete

public CH.ifa.draw.framework.Figure selectionOnDelete()
Start socket should be selected on deletion.

Specified by:
selectionOnDelete in interface ProcessElementContainer
Returns:
Next figure to be selected or null
See Also:
ProcessElementContainer.selectionOnDelete()

findProcessElementContainer

public ProcessElementContainer findProcessElementContainer(int x,
                                                           int y)
Description copied from interface: ProcessElementContainer
Gets the direct child element at the given coordinates.

Specified by:
findProcessElementContainer in interface ProcessElementContainer
Parameters:
x - Document coordinate
y - Document coordinate
Returns:
The child element or null if no such child exists
See Also:
ProcessElementContainer.findProcessElementContainer(int, int)

findProcessElementContainerInside

public ProcessElementContainer findProcessElementContainerInside(int x,
                                                                 int y)
Description copied from interface: ProcessElementContainer
Gets the innermost child at the given coordinates.

Specified by:
findProcessElementContainerInside in interface ProcessElementContainer
Parameters:
x - Document coordinate
y - Document coordinate
Returns:
The child element or this if the point is in this element itself or null otherwise
See Also:
ProcessElementContainer.findProcessElementContainerInside(int, int)


Copyright © 2011. All Rights Reserved.