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

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.FlowConnection
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 FlowConnection
extends PolySplineConnection
implements ProcessElementContainer

Spline figure representing a control 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
FlowConnection(ControlLink controlLink, ProcessDrawing drawing)
          Constructor.
FlowConnection(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 start, CH.ifa.draw.framework.Figure end, int flags)
          Delegates the check to the underlying control link.
 void connectEnd(CH.ifa.draw.framework.Connector newEndConnector)
          If the given connector belongs to a param figure, we search for the corresponding socket figure.
 boolean connectsSame(CH.ifa.draw.framework.ConnectionFigure other)
          Tests whether a connection connects the same figures as another connection figure.
 void connectStart(CH.ifa.draw.framework.Connector newStartConnector)
          If the given connector belongs to a param figure, we search for the corresponding socket figure.
 void decodeGeometry()
           
protected  boolean decodeParameter(java.lang.String parameter, java.lang.String errName)
           
 java.awt.Rectangle displayBox()
          The display box equals the bounds of the spline enlarged by 30 pixels vertically and horizontally.
 void draw(java.awt.Graphics g)
           
 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.
 ControlLink getControlLink()
          Returns the control link associated with this flow 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 start, CH.ifa.draw.framework.Figure end)
          Handles the connection of a connection.
protected  void handleDisconnect(CH.ifa.draw.framework.Figure start, CH.ifa.draw.framework.Figure end)
          Handles the disconnection of a connection.
 boolean handleEvent(VisualElementEvent event)
          Handler method that is called for handling events.
protected  void initializeFigureAttributes()
          Initializes the figure's drawing attributes.
 boolean isMinimized()
          Checks if the connection is minimized.
 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 start, CH.ifa.draw.framework.Figure end)
          Checks if connection should be reversed.
 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, constrainCtrlPoint, containsPoint, decode, disconnectEnd, disconnectStart, dragActionTriggered, dragEnded, dragStarted, drawDecorations, drawSpline, encode, endFigure, endPoint, endPoint, figureChanged, figureInvalidated, figureRemoved, figureRequestRemove, figureRequestUpdate, findVisualElement, findVisualElementInside, getAllDropRegions, getAllImportersAt, getDrawing, getDropRegions, getEndConnector, getEndFactor, getImportersAt, getLabel, getParentElement, getPresentationFigure, getStartConnector, getStartFactor, getSubClients, handles, importData, isVisible, layoutAndAdjustConnection, 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, 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, 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

FlowConnection

public FlowConnection(ControlLink controlLink,
                      ProcessDrawing drawing)
Constructor.

Parameters:
controlLink - Control represented by this figure
drawing - Process drawing that owns the figure

FlowConnection

public FlowConnection(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.


decodeParameter

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

getControlLink

public ControlLink getControlLink()
Returns the control link associated with this flow connection.


toString

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

Overrides:
toString in class java.lang.Object

displayBox

public java.awt.Rectangle displayBox()
Description copied from class: PolySplineFigure
The display box equals the bounds of the spline enlarged by 30 pixels vertically and horizontally.

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

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 start,
                                 CH.ifa.draw.framework.Figure end,
                                 int flags)
Delegates the check to the underlying control link. (true if one is an entry, the other one an exit socket)

Specified by:
canConnectFigures in class PolySplineConnection
Parameters:
start - Proposed start figure
end - 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 start,
                                CH.ifa.draw.framework.Figure end)
Description copied from class: PolySplineConnection
Checks if connection should be reversed.

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

handleConnect

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

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

handleDisconnect

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

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

connectStart

public void connectStart(CH.ifa.draw.framework.Connector newStartConnector)
If the given connector belongs to a param figure, we search for the corresponding socket figure.

Specified by:
connectStart in interface CH.ifa.draw.framework.ConnectionFigure
Overrides:
connectStart in class PolySplineConnection
See Also:
PolySplineConnection.connectStart(Connector newStartConnector)

connectEnd

public void connectEnd(CH.ifa.draw.framework.Connector newEndConnector)
If the given connector belongs to a param figure, we search for the corresponding socket figure.

Specified by:
connectEnd in interface CH.ifa.draw.framework.ConnectionFigure
Overrides:
connectEnd in class PolySplineConnection
See Also:
PolySplineConnection.connectEnd(Connector newEndConnector)

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()

decodeGeometry

public void decodeGeometry()

encodeGeometry

public void encodeGeometry()

handleEvent

public boolean handleEvent(VisualElementEvent event)
Description copied from interface: VisualElement
Handler method that is called for handling events. Events can be cursor events, selection events etc.

Specified by:
handleEvent in interface VisualElement
Overrides:
handleEvent in class PolySplineConnection
Parameters:
event - Event that desribes the event
Returns:
true: The event was handled by the element.
false: No special handling, perform the default handling.
See Also:
VisualElement.handleEvent(VisualElementEvent event)

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.