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

java.lang.Object
  extended by CH.ifa.draw.standard.AbstractFigure
      extended by CH.ifa.draw.standard.CompositeFigure
          extended by org.openbp.cockpit.modeler.figures.tag.AbstractTagFigure
              extended by org.openbp.cockpit.modeler.figures.tag.StraightTagFigure
                  extended by org.openbp.cockpit.modeler.figures.process.ParamFigure
All Implemented Interfaces:
CH.ifa.draw.framework.Figure, CH.ifa.draw.framework.FigureChangeListener, CH.ifa.draw.standard.TextHolder, CH.ifa.draw.util.Storable, java.io.Serializable, java.lang.Cloneable, java.util.EventListener, ChildFigure, Expandable, ShadowDropper, UpdatableFigure, LayoutableTag, ProcessElementContainer, VisualElement, InteractionClient

public class ParamFigure
extends StraightTagFigure
implements ProcessElementContainer, CH.ifa.draw.standard.TextHolder

Figure that is used to represent node params of a socket. Is also capable of displaying a connection to a process variable.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.openbp.cockpit.modeler.figures.tag.AbstractTagFigure
AbstractTagFigure.TagContent
 
Field Summary
static java.lang.String PARAM_TYPE_NAME
          Name of a data type name parameter that accepts a dropped data type item
 
Fields inherited from class org.openbp.cockpit.modeler.figures.tag.StraightTagFigure
tagOrientation
 
Fields inherited from class org.openbp.cockpit.modeler.figures.tag.AbstractTagFigure
angle, content, CONTENT_DATA, CONTENT_FLOW, CONTENT_ICON, CONTENT_INTERACTION, CONTENT_STATIC, CONTENT_TEXT, CONTENT_USER1, CONTENT_USER2, contentState, currentContentState, DECO_TAGCONTENTTYPE, layouter, origin, parent, presentationFigure, shadowFigure, visualStatus
 
Fields inherited from class CH.ifa.draw.standard.CompositeFigure
_nHighestZ, _nLowestZ, fFigures
 
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
ParamFigure(AbstractTagFigure parent, NodeParam nodeParam, java.awt.Point origin)
           
 
Method Summary
 boolean acceptsTyping()
           
 void addParamConnection(ParamConnection connection)
          Adds a parameter connection.
 void basicSetAngle(double angle)
          Sets the angle to the given one.
 boolean canConnect()
           
 java.awt.Rectangle compactDisplayBox()
          Returns the display box of the param icon.
 void connect(CH.ifa.draw.framework.Figure connectedFigure)
           
 CH.ifa.draw.framework.Locator connectedTextLocator(CH.ifa.draw.framework.Figure text)
           
 CH.ifa.draw.framework.Connector connectorAt(int x, int y)
           
 boolean containsPoint(int x, int y)
           
protected  XFigure createPresentationFigure()
          Creates the presentation figure of this node.
 void decodeGeometry()
          Decodes geometric information of the param.
protected  void decodeParameter(java.lang.String parameter)
          Decodes a single parameter.
protected  int determineStandardTitleDistance()
          Computes the standard title distance based on the text size.
 void disconnect(CH.ifa.draw.framework.Figure disconnectFigure)
           
 java.awt.Rectangle displayBox()
           
 void draw(java.awt.Graphics g)
          Saves the transformation, draws the tag and restores the transformation.
 void encodeGeometry()
          Stores geometric information in the paramobject.
 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.
 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.awt.Font getFont()
           
 NodeParam getNodeParam()
          Gets the the node param represented by this figure.
 ProcessObject getProcessElement()
          Returns the contained process element.
 ProcessObject getReferredProcessElement()
          Returns the process element this figure refers to.
 java.lang.String getText()
           
 boolean handleEvent(VisualElementEvent event)
          Handler method that is called for handling events.
 java.util.Vector handles()
          We do not want any handles, so we return an empty vector.
 boolean importData(java.lang.Object regionId, java.awt.datatransfer.Transferable data, java.awt.Point p)
          Imports the given transferable into the given region.
protected  void initContent(java.lang.Object modelObject)
          Creates the content of this tag.
protected  void initShadow()
          Creates the shadow figure of the tag's presentation figure.
protected  void initTagLayouter()
          Creates the layouter for this tag.
 boolean isVerticalOrientation()
          Gets the vertical orientation.
 int overlayColumns()
           
 void release()
           
 void removeConnections()
          Removes all connections from/to this figure.
 void removeParamConnection(ParamConnection connection)
          Removes a parameter connection.
 void removeProcessVariableConnection()
          Removes an existing process variable connection to this param (i\.e\. a datalink between this param and a process variable).
 CH.ifa.draw.framework.Figure selectionOnDelete()
          Select socket on deletion.
 ProcessVariableConnection setProcessVariableConnection(ProcessVariable param, DataLink data)
          Creates a new process variable connection figure and a new process variable figure and adds them.
 void setText(java.lang.String newText)
           
 java.awt.Rectangle textDisplayBox()
           
 java.lang.String toString()
          Returns a string representation of this object.
 void updateFigure()
          Causes all UpdatableFigure children to updateFigure.
 
Methods inherited from class org.openbp.cockpit.modeler.figures.tag.StraightTagFigure
getTagOrientation, positionDisplayBox
 
Methods inherited from class org.openbp.cockpit.modeler.figures.tag.AbstractTagFigure
addContent, addContentAt, applyContentState, basicDisplayBox, basicMoveBy, changed, checkDecoratedContentState, determine2WayOrientation, determineDecoratedContentState, dragActionTriggered, dragEnded, dragStarted, findFigure, findFigureInside, findVisualElement, findVisualElementInside, getAllDropRegions, getAllImportersAt, getAngle, getCenterFigure, getCenterFigureBox, getContent, getContentFigureAt, getContentState, getDrawing, getFillColor, getImportersAt, getLayouter, getNumberOfContents, getOrigin, getParent, getParentElement, getPresentationFigure, getShadow, getSubClients, getVisualStatus, initPresentationFigure, invalidate, isVisible, layoutTag, moveContent, read, setAngle, setContentState, setDrawing, setFillColor, setLayouter, setOrigin, setParent, setVisible, setVisualStatus, updatePresentationFigure, write
 
Methods inherited from class CH.ifa.draw.standard.CompositeFigure
add, addAll, addAll, bringToFront, draw, figureAt, figureChanged, figureCount, figureInvalidated, figureRemoved, figureRequestRemove, figureRequestUpdate, figures, figures, figuresReverse, findFigure, findFigure, findFigureInsideWithout, findFigureWithout, getFigureFromLayer, getLayer, includes, init, orphan, orphanAll, orphanAll, remove, removeAll, removeAll, removeAll, replace, sendToBack, sendToLayer
 
Methods inherited from class CH.ifa.draw.standard.AbstractFigure
addFigureChangeListener, addToContainer, center, clone, connectionInsets, connectorVisibility, decompose, displayBox, displayBox, getAttribute, getZValue, isEmpty, listener, moveBy, removeFigureChangeListener, removeFromContainer, setAttribute, 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, center, changed, clone, connectionInsets, connectorVisibility, 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
 
Methods inherited from interface org.openbp.jaspira.gui.interaction.InteractionClient
dragActionTriggered, dragEnded, dragStarted, getAllDropRegions, getAllImportersAt, getImportersAt, getSubClients
 
Methods inherited from interface CH.ifa.draw.framework.FigureChangeListener
figureChanged, figureInvalidated, figureRemoved, figureRequestRemove, figureRequestUpdate
 

Field Detail

PARAM_TYPE_NAME

public static final java.lang.String PARAM_TYPE_NAME
Name of a data type name parameter that accepts a dropped data type item

See Also:
Constant Field Values
Constructor Detail

ParamFigure

public ParamFigure(AbstractTagFigure parent,
                   NodeParam nodeParam,
                   java.awt.Point origin)
Method Detail

createPresentationFigure

protected XFigure createPresentationFigure()
Creates the presentation figure of this node. By default, this is an XRoundRectangleFigure

Overrides:
createPresentationFigure in class AbstractTagFigure
Returns:
The presentation figure

initTagLayouter

protected void initTagLayouter()
Description copied from class: StraightTagFigure
Creates the layouter for this tag. By default, this is a HorizontalLayouter

Overrides:
initTagLayouter in class StraightTagFigure
See Also:
AbstractTagFigure.initTagLayouter()

initContent

protected void initContent(java.lang.Object modelObject)
Creates the content of this tag. By default, this method does nothing.

Overrides:
initContent in class AbstractTagFigure
Parameters:
modelObject - Model object this tag represents or null

initShadow

protected void initShadow()
Description copied from class: AbstractTagFigure
Creates the shadow figure of the tag's presentation figure.

Overrides:
initShadow in class AbstractTagFigure
See Also:
AbstractTagFigure.initShadow()

getNodeParam

public NodeParam getNodeParam()
Gets the the node param represented by this figure.


toString

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

Overrides:
toString in class java.lang.Object

addParamConnection

public void addParamConnection(ParamConnection connection)
Adds a parameter connection.

Parameters:
connection - Connection to add

removeParamConnection

public void removeParamConnection(ParamConnection connection)
Removes a parameter connection.

Parameters:
connection - Connection to remove

removeConnections

public void removeConnections()
Removes all connections from/to this figure.


setProcessVariableConnection

public ProcessVariableConnection setProcessVariableConnection(ProcessVariable param,
                                                              DataLink data)
Creates a new process variable connection figure and a new process variable figure and adds them.

Parameters:
param - The process variable thst we want to conenct to
data - the datalink representing the connection
Returns:
ProcessVariableConnection The created connection object or null

removeProcessVariableConnection

public void removeProcessVariableConnection()
Removes an existing process variable connection to this param (i\.e\. a datalink between this param and a process variable).


determineStandardTitleDistance

protected int determineStandardTitleDistance()
Computes the standard title distance based on the text size.

Returns:
The distance or 0

isVerticalOrientation

public boolean isVerticalOrientation()
Gets the vertical orientation.

Overrides:
isVerticalOrientation in class AbstractTagFigure

handles

public java.util.Vector handles()
Description copied from class: AbstractTagFigure
We do not want any handles, so we return an empty vector.

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

connectorAt

public CH.ifa.draw.framework.Connector connectorAt(int x,
                                                   int y)
Specified by:
connectorAt in interface CH.ifa.draw.framework.Figure
Overrides:
connectorAt in class AbstractTagFigure
See Also:
Figure.connectorAt(int x, int y)

canConnect

public boolean canConnect()
Specified by:
canConnect in interface CH.ifa.draw.framework.Figure
Overrides:
canConnect in class AbstractTagFigure
See Also:
Figure.canConnect()

containsPoint

public boolean containsPoint(int x,
                             int y)
Specified by:
containsPoint in interface CH.ifa.draw.framework.Figure
Overrides:
containsPoint in class AbstractTagFigure
See Also:
Figure.containsPoint(int, int)

displayBox

public java.awt.Rectangle displayBox()
Specified by:
displayBox in interface CH.ifa.draw.framework.Figure
Overrides:
displayBox in class AbstractTagFigure
See Also:
Figure.displayBox()

basicSetAngle

public void basicSetAngle(double angle)
Description copied from class: AbstractTagFigure
Sets the angle to the given one.

Overrides:
basicSetAngle in class StraightTagFigure
See Also:
AbstractTagFigure.basicSetAngle(double)

draw

public void draw(java.awt.Graphics g)
Description copied from class: AbstractTagFigure
Saves the transformation, draws the tag and restores the transformation.

Specified by:
draw in interface CH.ifa.draw.framework.Figure
Overrides:
draw in class AbstractTagFigure
See Also:
Figure.draw(java.awt.Graphics)

release

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

connectedTextLocator

public CH.ifa.draw.framework.Locator connectedTextLocator(CH.ifa.draw.framework.Figure text)
Specified by:
connectedTextLocator in interface CH.ifa.draw.framework.Figure
Overrides:
connectedTextLocator in class CH.ifa.draw.standard.AbstractFigure
See Also:
Figure.connectedTextLocator(CH.ifa.draw.framework.Figure)

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

textDisplayBox

public java.awt.Rectangle textDisplayBox()
Specified by:
textDisplayBox in interface CH.ifa.draw.standard.TextHolder

getText

public java.lang.String getText()
Specified by:
getText in interface CH.ifa.draw.standard.TextHolder

setText

public void setText(java.lang.String newText)
Specified by:
setText in interface CH.ifa.draw.standard.TextHolder

acceptsTyping

public boolean acceptsTyping()
Specified by:
acceptsTyping in interface CH.ifa.draw.standard.TextHolder

overlayColumns

public int overlayColumns()
Specified by:
overlayColumns in interface CH.ifa.draw.standard.TextHolder

connect

public void connect(CH.ifa.draw.framework.Figure connectedFigure)
Specified by:
connect in interface CH.ifa.draw.standard.TextHolder

disconnect

public void disconnect(CH.ifa.draw.framework.Figure disconnectFigure)
Specified by:
disconnect in interface CH.ifa.draw.standard.TextHolder

getFont

public java.awt.Font getFont()
Specified by:
getFont in interface CH.ifa.draw.standard.TextHolder

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

updateFigure

public void updateFigure()
Description copied from class: AbstractTagFigure
Causes all UpdatableFigure children to updateFigure.

Specified by:
updateFigure in interface UpdatableFigure
Overrides:
updateFigure in class AbstractTagFigure
See Also:
UpdatableFigure.updateFigure()

compactDisplayBox

public java.awt.Rectangle compactDisplayBox()
Returns the display box of the param icon.

Specified by:
compactDisplayBox in interface Expandable
Overrides:
compactDisplayBox in class AbstractTagFigure
See Also:
Expandable.compactDisplayBox()

decodeGeometry

public void decodeGeometry()
Decodes geometric information of the param.


decodeParameter

protected void decodeParameter(java.lang.String parameter)
Decodes a single parameter.

Parameters:
parameter - Parameter to decode

encodeGeometry

public void encodeGeometry()
Stores geometric information in the paramobject.


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
Overrides:
getDropRegions in class AbstractTagFigure
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.
See Also:
InteractionClient.getDropRegions(List, Transferable, MouseEvent)

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
Overrides:
importData in class AbstractTagFigure
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.
See Also:
InteractionClient.importData(Object, Transferable, Point)


Copyright © 2011. All Rights Reserved.