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

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

public class ProcessVariableConnection
extends CH.ifa.draw.standard.AbstractFigure
implements ProcessElementContainer

Graphical represention of a datalink between a node parameter and a process variable. Note that this figure is not really a connection but a symbol that is to be displayed as part a ParamFigure

Author:
Stephan Moritz
See Also:
Serialized Form

Field Summary
static int ARROW_SIZE
          Length of the connection arrow
 
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
ProcessVariableConnection(DataLink link, ParamFigure paramFigure)
          Constructor.
 
Method Summary
 void basicDisplayBox(java.awt.Point start, java.awt.Point end)
           
protected  void basicMoveBy(int dx, int dy)
           
 boolean canConnect()
           
 java.awt.Rectangle displayBox()
           
 void dragActionTriggered(java.lang.Object regionId, java.awt.Point p)
          Called to signal additional actions, such as hovering for a certain time over the region.
 void dragEnded(java.awt.datatransfer.Transferable transferable)
          called when a dragging has ended.
 void dragStarted(java.awt.datatransfer.Transferable transferable)
          Called when a dragging has been started.
 void draw(java.awt.Graphics g)
          Draws the connection.
 java.util.List getAllDropRegions(java.util.List flavors, java.awt.datatransfer.Transferable data, java.awt.event.MouseEvent mouseEvent)
          Returns a list of all regions of this client AND possible sub clients.
 java.util.List getAllImportersAt(java.awt.Point p)
          Returns all importers which will be accepted at the given point by this client or one of its sub clients.
 DataLink getDataLink()
          Gets the the data link that this figure represents.
 ProcessDrawing getDrawing()
          Gets the drawing the element is a part of.
 java.util.List getDropRegions(java.util.List flavors, java.awt.datatransfer.Transferable data, java.awt.event.MouseEvent mouseEvent)
          Returns a list of drop regions of this client that are compatible with the provided data flavors.
 java.util.List getImportersAt(java.awt.Point p)
          Returns all importers which will be accepted at the given point by this client.
 VisualElement getParentElement()
          Gets parent element of this element, if any.
 CH.ifa.draw.framework.Figure getPresentationFigure()
          Gets the presentation figure of this element.
 ProcessObject getProcessElement()
          Returns the contained process element.
 ProcessObject getReferredProcessElement()
          Returns the process element this figure refers to.
 java.util.List getSubClients()
          Returns subordinate clients of this client.
 boolean handleEvent(VisualElementEvent event)
          Handler method that is called for handling events.
 java.util.Vector handles()
           
 boolean importData(java.lang.Object regionId, java.awt.datatransfer.Transferable data, java.awt.Point p)
          Imports the given transferable into the given region.
 boolean isVisible()
          Gets the flag if the element is currently visible.
 void release()
           
 CH.ifa.draw.framework.Figure selectionOnDelete()
          No object should be selected on deletion.
 void setDrawing(ProcessDrawing drawing)
          Sets the drawing the element is a part of.
 void setVisible(boolean visible)
          Sets the flag if the element is currently visible.
 java.lang.String toString()
          Returns a string representation of this object.
 void updateFigure()
          Synchronizes this figure with its provider, i\.e\. the object that is represented by the figure.
 void updatePresentationFigure()
          Updates (reinitializes) the presentation figure.
 
Methods inherited from class CH.ifa.draw.standard.AbstractFigure
addFigureChangeListener, addToContainer, center, changed, clone, connectedTextLocator, connectionInsets, connectorAt, connectorVisibility, containsPoint, decompose, displayBox, displayBox, figures, findFigureInside, getAttribute, getZValue, includes, invalidate, isEmpty, listener, moveBy, read, removeFigureChangeListener, removeFromContainer, setAttribute, setZValue, size, willChange, write
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface CH.ifa.draw.framework.Figure
addFigureChangeListener, addToContainer, center, changed, clone, connectedTextLocator, connectionInsets, connectorAt, connectorVisibility, containsPoint, decompose, displayBox, displayBox, figures, findFigureInside, getAttribute, getZValue, includes, invalidate, isEmpty, listener, moveBy, removeFigureChangeListener, removeFromContainer, setAttribute, setZValue, size, willChange
 
Methods inherited from interface CH.ifa.draw.util.Storable
read, write
 

Field Detail

ARROW_SIZE

public static final int ARROW_SIZE
Length of the connection arrow

See Also:
Constant Field Values
Constructor Detail

ProcessVariableConnection

public ProcessVariableConnection(DataLink link,
                                 ParamFigure paramFigure)
Constructor.

Parameters:
link - Link represented by this figure
paramFigure - Source parameter figure of the global link
Method Detail

getDataLink

public DataLink getDataLink()
Gets the the data link that this figure represents.


toString

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

Overrides:
toString in class java.lang.Object

basicMoveBy

protected void basicMoveBy(int dx,
                           int dy)
Specified by:
basicMoveBy in class CH.ifa.draw.standard.AbstractFigure

basicDisplayBox

public void basicDisplayBox(java.awt.Point start,
                            java.awt.Point end)
Specified by:
basicDisplayBox in interface CH.ifa.draw.framework.Figure
Specified by:
basicDisplayBox in class CH.ifa.draw.standard.AbstractFigure

displayBox

public java.awt.Rectangle displayBox()
Specified by:
displayBox in interface CH.ifa.draw.framework.Figure
Specified by:
displayBox in class CH.ifa.draw.standard.AbstractFigure

handles

public java.util.Vector handles()
Specified by:
handles in interface CH.ifa.draw.framework.Figure
Specified by:
handles in class CH.ifa.draw.standard.AbstractFigure

draw

public void draw(java.awt.Graphics g)
Draws the connection. If the decoration manager reports stroke and frame decorations for this figure, overlays the figure with a rectangle.

Specified by:
draw in interface CH.ifa.draw.framework.Figure
Specified by:
draw in class CH.ifa.draw.standard.AbstractFigure

canConnect

public boolean canConnect()
Specified by:
canConnect in interface CH.ifa.draw.framework.Figure
Overrides:
canConnect in class CH.ifa.draw.standard.AbstractFigure

release

public void release()
Specified by:
release in interface CH.ifa.draw.framework.Figure
Overrides:
release in class CH.ifa.draw.standard.AbstractFigure

getProcessElement

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

Specified by:
getProcessElement in interface ProcessElementContainer

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

selectionOnDelete

public CH.ifa.draw.framework.Figure selectionOnDelete()
No object should be selected on deletion.

Specified by:
selectionOnDelete in interface ProcessElementContainer
Returns:
Next figure to be selected or null

setDrawing

public void setDrawing(ProcessDrawing drawing)
Description copied from interface: VisualElement
Sets the drawing the element is a part of.

Specified by:
setDrawing in interface VisualElement

getDrawing

public ProcessDrawing getDrawing()
Description copied from interface: VisualElement
Gets the drawing the element is a part of.

Specified by:
getDrawing in interface VisualElement

getParentElement

public VisualElement getParentElement()
Description copied from interface: VisualElement
Gets parent element of this element, if any.

Specified by:
getParentElement in interface VisualElement

getPresentationFigure

public CH.ifa.draw.framework.Figure getPresentationFigure()
Description copied from interface: VisualElement
Gets the presentation figure of this element.

Specified by:
getPresentationFigure in interface VisualElement
Returns:
The presentation figure
Note that this can be the visual element itself if it does not have a separate presentation figure

updatePresentationFigure

public void updatePresentationFigure()
Description copied from interface: VisualElement
Updates (reinitializes) the presentation figure.

Specified by:
updatePresentationFigure in interface VisualElement

isVisible

public boolean isVisible()
Description copied from interface: VisualElement
Gets the flag if the element is currently visible.

Specified by:
isVisible in interface VisualElement

setVisible

public void setVisible(boolean visible)
Description copied from interface: VisualElement
Sets the flag if the element is currently visible.

Specified by:
setVisible in interface VisualElement

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
Parameters:
event - Event that desribes the event
Returns:
true: The event was handled by the element.
false: No special handling, perform the default handling.

getDropRegions

public java.util.List getDropRegions(java.util.List flavors,
                                     java.awt.datatransfer.Transferable data,
                                     java.awt.event.MouseEvent mouseEvent)
Description copied from interface: InteractionClient
Returns a list of drop regions of this client that are compatible with the provided data flavors.

Specified by:
getDropRegions in interface InteractionClient
Parameters:
flavors - List of data flavors to check
data - Transferable to be imported
mouseEvent - Mouse event that initiated the drag action
Returns:
A list of DragAwareRegion object or null if the drop client cannot satisfy at least one of the supplied data flavors.
The list will contain only regions that belong directly to this drop client.

getImportersAt

public java.util.List getImportersAt(java.awt.Point p)
Description copied from interface: InteractionClient
Returns all importers which will be accepted at the given point by this client.

Specified by:
getImportersAt in interface InteractionClient
Parameters:
p - Current mouse position in screen coordinates
Returns:
A list of Importer objects or null

getAllImportersAt

public java.util.List getAllImportersAt(java.awt.Point p)
Description copied from interface: InteractionClient
Returns all importers which will be accepted at the given point by this client or one of its sub clients.

Specified by:
getAllImportersAt in interface InteractionClient
Parameters:
p - Current mouse position in screen coordinates
Returns:
A list of Importer objects or null

getAllDropRegions

public java.util.List getAllDropRegions(java.util.List flavors,
                                        java.awt.datatransfer.Transferable data,
                                        java.awt.event.MouseEvent mouseEvent)
Description copied from interface: InteractionClient
Returns a list of all regions of this client AND possible sub clients.

Specified by:
getAllDropRegions in interface InteractionClient
Parameters:
flavors - List of data flavors to check
data - Transferable to import
mouseEvent - Mouse event that initiated the drag action
Returns:
A list of DragAwareRegion object or null if the drop client or one of its sub clients cannot satisfy at least one of the supplied data flavors

importData

public boolean importData(java.lang.Object regionId,
                          java.awt.datatransfer.Transferable data,
                          java.awt.Point p)
Description copied from interface: InteractionClient
Imports the given transferable into the given region.

Specified by:
importData in interface InteractionClient
Parameters:
regionId - Id of the region to import into (see BasicDropRegion.getId)
data - Transferable to import
p - Drop point in glass coordinates
Returns:
true The data was successfully imported.
false An error occured while importing the data.

dragStarted

public void dragStarted(java.awt.datatransfer.Transferable transferable)
Description copied from interface: InteractionClient
Called when a dragging has been started.

Specified by:
dragStarted in interface InteractionClient
Parameters:
transferable - Transferable to be dragged

dragEnded

public void dragEnded(java.awt.datatransfer.Transferable transferable)
Description copied from interface: InteractionClient
called when a dragging has ended.

Specified by:
dragEnded in interface InteractionClient
Parameters:
transferable - Transferable that has been dragged

dragActionTriggered

public void dragActionTriggered(java.lang.Object regionId,
                                java.awt.Point p)
Description copied from interface: InteractionClient
Called to signal additional actions, such as hovering for a certain time over the region.

Specified by:
dragActionTriggered in interface InteractionClient
Parameters:
regionId - Id of the region to import into (see BasicDropRegion.getId)
p - Current mouse position in screen coordinates

getSubClients

public java.util.List getSubClients()
Description copied from interface: InteractionClient
Returns subordinate clients of this client.

Specified by:
getSubClients in interface InteractionClient
Returns:
A list of InteractionClient objects or null if this drop client doesn't have sub drop clients

updateFigure

public void updateFigure()
Description copied from interface: UpdatableFigure
Synchronizes this figure with its provider, i\.e\. the object that is represented by the figure. Updates the figure according to the current properties of the provider.

Specified by:
updateFigure in interface UpdatableFigure


Copyright © 2011. All Rights Reserved.