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

java.lang.Object
  extended by CH.ifa.draw.standard.AbstractFigure
      extended by org.openbp.cockpit.modeler.figures.process.LineFigure
All Implemented Interfaces:
CH.ifa.draw.framework.Figure, CH.ifa.draw.util.Storable, java.io.Serializable, java.lang.Cloneable, VisualElement, InteractionClient
Direct Known Subclasses:
HLineFigure, VLineFigure

public abstract class LineFigure
extends CH.ifa.draw.standard.AbstractFigure
implements VisualElement

Abstract line figure.

Author:
Heiko Erhardt
See Also:
Serialized Form

Field Summary
protected  int xPos
          Position of the line (x coordinate)
protected  int yPos
          Position of the line (y coordinate)
 
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
LineFigure(ProcessDrawing drawing)
          Default constructor.
 
Method Summary
 void basicDisplayBox(java.awt.Point origin, java.awt.Point corner)
           
protected  void basicMoveBy(int x, int y)
           
 boolean containsPoint(int x, int y)
           
 void decodeGeometry(java.lang.String geometry)
          Decodes enclosed geometry information.
 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 figure in the given graphics.
 java.lang.String encodeGeometry()
          Encodes the figure geometry in a string.
 VisualElement findVisualElement(int x, int y)
          Gets the visual element that is a child of this element and matches the given coordinates.
 VisualElement findVisualElementInside(int x, int y)
          Gets the visual element that is a child of this element and matches the given coordinates (recursively).
 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.
 java.awt.Color getColor()
          Gets the color.
 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.
 java.awt.Stroke getStroke()
          Gets the stroke.
 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()
          We display a single font size handle in the top left corner only.
 boolean importData(java.lang.Object regionId, java.awt.datatransfer.Transferable data, java.awt.Point p)
          Imports the given transferable into the given region.
 java.awt.Rectangle infiniteDisplayBox()
          Returns the display box of the figure that extends until infinity (or at least up to a very high value).
 void invalidate()
           
 boolean isVerticalLine()
          Gets the vertical line.
 boolean isVisible()
          Gets the flag if the element is currently visible.
 void setColor(java.awt.Color color)
          Sets the color.
 void setDrawing(ProcessDrawing drawing)
          Sets the drawing the element is a part of.
 void setStroke(java.awt.Stroke stroke)
          Sets the stroke.
 void setVerticalLine(boolean verticalLine)
          Sets the vertical line.
 void setVisible(boolean visible)
          Sets the flag if the element is currently visible.
 void updatePresentationFigure()
          Updates (reinitializes) the presentation figure.
 
Methods inherited from class CH.ifa.draw.standard.AbstractFigure
addFigureChangeListener, addToContainer, canConnect, center, changed, clone, connectedTextLocator, connectionInsets, connectorAt, connectorVisibility, decompose, displayBox, displayBox, figures, findFigureInside, getAttribute, getZValue, includes, isEmpty, listener, moveBy, read, release, removeFigureChangeListener, removeFromContainer, setAttribute, setZValue, size, willChange, write
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface CH.ifa.draw.framework.Figure
addFigureChangeListener, addToContainer, canConnect, center, changed, clone, connectedTextLocator, connectionInsets, connectorAt, connectorVisibility, decompose, displayBox, displayBox, figures, findFigureInside, getAttribute, getZValue, includes, isEmpty, listener, moveBy, release, removeFigureChangeListener, removeFromContainer, setAttribute, setZValue, size, willChange
 
Methods inherited from interface CH.ifa.draw.util.Storable
read, write
 

Field Detail

xPos

protected int xPos
Position of the line (x coordinate)


yPos

protected int yPos
Position of the line (y coordinate)

Constructor Detail

LineFigure

public LineFigure(ProcessDrawing drawing)
Default constructor.

Parameters:
drawing - Process drawing we belong to
Method Detail

isVerticalLine

public boolean isVerticalLine()
Gets the vertical line.


setVerticalLine

public void setVerticalLine(boolean verticalLine)
Sets the vertical line.


getStroke

public java.awt.Stroke getStroke()
Gets the stroke.


setStroke

public void setStroke(java.awt.Stroke stroke)
Sets the stroke.


getColor

public java.awt.Color getColor()
Gets the color.


setColor

public void setColor(java.awt.Color color)
Sets the color.


handles

public java.util.Vector handles()
We display a single font size handle in the top left corner only.

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

basicDisplayBox

public void basicDisplayBox(java.awt.Point origin,
                            java.awt.Point corner)
Specified by:
basicDisplayBox in interface CH.ifa.draw.framework.Figure
Specified by:
basicDisplayBox in class CH.ifa.draw.standard.AbstractFigure
See Also:
AbstractFigure.basicDisplayBox(Point origin, Point corner)

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
See Also:
AbstractFigure.displayBox()

invalidate

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

basicMoveBy

protected void basicMoveBy(int x,
                           int y)
Specified by:
basicMoveBy in class CH.ifa.draw.standard.AbstractFigure
See Also:
AbstractFigure.basicMoveBy(int x, int y)

infiniteDisplayBox

public java.awt.Rectangle infiniteDisplayBox()
Returns the display box of the figure that extends until infinity (or at least up to a very high value).

Returns:
The display box

containsPoint

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

draw

public void draw(java.awt.Graphics g)
Draws the figure in the given graphics.

Specified by:
draw in interface CH.ifa.draw.framework.Figure
Specified by:
draw in class CH.ifa.draw.standard.AbstractFigure
Parameters:
g - Graphics to draw to
See Also:
AbstractFigure.draw(Graphics g)

decodeGeometry

public void decodeGeometry(java.lang.String geometry)
Decodes enclosed geometry information.

Parameters:
geometry - Geometry string to decode or null

encodeGeometry

public java.lang.String encodeGeometry()
Encodes the figure geometry in a string.

Returns:
Geometry string containing "|" and ":" separated tokens

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
See Also:
VisualElement.setDrawing(ProcessDrawing)

getDrawing

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

Specified by:
getDrawing in interface VisualElement
See Also:
VisualElement.getDrawing()

getParentElement

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

Specified by:
getParentElement in interface VisualElement
See Also:
VisualElement.getParentElement()

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
See Also:
VisualElement.getPresentationFigure()

updatePresentationFigure

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

Specified by:
updatePresentationFigure in interface VisualElement
See Also:
VisualElement.updatePresentationFigure()

isVisible

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

Specified by:
isVisible in interface VisualElement
See Also:
VisualElement.isVisible()

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
See Also:
VisualElement.setVisible(boolean)

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.
See Also:
VisualElement.handleEvent(VisualElementEvent event)

findVisualElement

public VisualElement findVisualElement(int x,
                                       int y)
Description copied from interface: VisualElement
Gets the visual element that is a child of this element and matches the given coordinates.

Specified by:
findVisualElement in interface VisualElement
Parameters:
x - World coordinates of the point to search
y - World coordinates of the point to search
Returns:
The element or null if no child element is located at the given position
See Also:
VisualElement.findVisualElement(int, int)

findVisualElementInside

public VisualElement findVisualElementInside(int x,
                                             int y)
Description copied from interface: VisualElement
Gets the visual element that is a child of this element and matches the given coordinates (recursively).

Specified by:
findVisualElementInside in interface VisualElement
Parameters:
x - World coordinates of the point to search
y - World coordinates of the point to search
Returns:
The element or null if no child element is located at the given position
See Also:
VisualElement.findVisualElementInside(int, int)

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
See Also:
InteractionClient.dragActionTriggered(Object, Point)

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
See Also:
InteractionClient.dragEnded(Transferable)

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
See Also:
InteractionClient.dragStarted(Transferable)

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
See Also:
InteractionClient.getAllDropRegions(List, Transferable, MouseEvent)

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

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
See Also:
InteractionClient.getImportersAt(Point)

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
See Also:
InteractionClient.getAllImportersAt(Point)

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
See Also:
InteractionClient.getSubClients()

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


Copyright © 2011. All Rights Reserved.