at.tuwien.ifs.somtoolbox.apps.viewer
Class ArrowPNode

java.lang.Object
  extended by edu.umd.cs.piccolo.PNode
      extended by at.tuwien.ifs.somtoolbox.apps.viewer.ArrowPNode
All Implemented Interfaces:
Printable, Serializable, Cloneable

public class ArrowPNode
extends edu.umd.cs.piccolo.PNode

Class for arrows on the SOM Visualization (that indicate shifts in a SOM)

Version:
$Id: ArrowPNode.java 3589 2010-05-21 10:42:01Z mayer $
Author:
Doris Baum
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class edu.umd.cs.piccolo.PNode
edu.umd.cs.piccolo.PNode.PSceneGraphDelegate
 
Field Summary
static int ADJACENT
           
private static Color ADJACENTCOLOR
           
private  Line2D.Double arrow
           
private  double arrowHeadLength
           
private  float arrowHeadScale
           
private  double arrowHeadWidth
           
static int CLUSTER
           
private static Color CLUSTERCOLOR
           
private  Color color
           
private  InputCorrections.CreationType creationType
           
private  Polygon endHead
           
static int MAXARROWWIDTH
           
static int OUTLIER
           
private static Color OUTLIERCOLOR
           
private  boolean selectionVisibility
           
private static long serialVersionUID
           
private  boolean showEndHead
           
private  boolean showStartHead
           
static int STABLE
           
private static Color STABLECOLOR
           
private  Polygon startHead
           
private  BasicStroke stroke
           
private  edu.umd.cs.piccolo.PNode tooltipNode
           
private  int type
           
private  boolean typeVisibility
           
private  double x1
           
private  double x2
           
private  double y1
           
private  double y2
           
 
Fields inherited from class edu.umd.cs.piccolo.PNode
PROPERTY_BOUNDS, PROPERTY_CHILDREN, PROPERTY_CHILDREN_PICKABLE, PROPERTY_CLIENT_PROPERTIES, PROPERTY_CODE_BOUNDS, PROPERTY_CODE_CHILDREN, PROPERTY_CODE_CHILDREN_PICKABLE, PROPERTY_CODE_CLIENT_PROPERTIES, PROPERTY_CODE_FULL_BOUNDS, PROPERTY_CODE_PAINT, PROPERTY_CODE_PARENT, PROPERTY_CODE_PICKABLE, PROPERTY_CODE_TRANSFORM, PROPERTY_CODE_TRANSPARENCY, PROPERTY_CODE_VISIBLE, PROPERTY_FULL_BOUNDS, PROPERTY_PAINT, PROPERTY_PARENT, PROPERTY_PICKABLE, PROPERTY_TRANSFORM, PROPERTY_TRANSPARENCY, PROPERTY_VISIBLE, SCENE_GRAPH_DELEGATE
 
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
 
Constructor Summary
ArrowPNode(double x1, double y1, double x2, double y2)
          Constructor that takes arrow coordinates
ArrowPNode(InputCorrections.CreationType creationType, String[][] attributes, String tooltip, Color color, double width, double height, Point pointBegin, Point pointEnd)
           
ArrowPNode(Point start, Point end, double offsetX, double offsetY)
           
 
Method Summary
private  void calculateArrow()
          Calculate the coordinates for the 3 points defining each arrowhead (the arrowhead is a triangle) and generate polygon objects with these points.
static ArrowPNode createInputCorrectionArrow(InputCorrections.InputCorrection c, InputCorrections.CreationType creationType, GeneralUnitPNode sourceUnitNode, GeneralUnitPNode targetUnitNode)
           
 InputCorrections.CreationType getCreationType()
           
 int getType()
           
 boolean getVisible()
          Is the visibility of this ArrowPNode currently set to true?
protected  void paint(edu.umd.cs.piccolo.util.PPaintContext paintContext)
          Paints the arrow line with given color and stroke, adding arrowheads as applicable
 void setArrow(double x1, double y1, double x2, double y2)
          (Re)sets the coordinates of the arrow to (x1, y1) (x2, y2); produces a line and appropriate arrowheads and resets the Node's bounding box to hold the new arrow
 void setArrowHeadScale(float scale)
           
 boolean setBounds(double x, double y, double w, double h)
          Set the bounds of this PNode object.
 void setColor(Color color)
           
 void setLineWidth(double width)
           
 void setProportionalWidth(double propWidth)
           
 void setSelectionVisibility(boolean selectionVisibility)
           
 void setType(int type)
           
 void setTypeVisibility(boolean typeVisibility)
           
 void setVisible(boolean visibility)
           
 void showEndArrowHead(boolean state)
          Show the arrowhead at the (x2,y2)-end of the line?
 void showStartArrowHead(boolean state)
          Show the arrowhead at the (x1,y1)-end of the line?
 
Methods inherited from class edu.umd.cs.piccolo.PNode
addActivity, addAttribute, addChild, addChild, addChildren, addClientProperty, addInputEventListener, addPropertyChangeListener, addPropertyChangeListener, animateToBounds, animateToColor, animateToPositionScaleRotation, animateToTransform, animateToTransparency, animateTransformToBounds, centerBoundsOnPoint, centerFullBoundsOnPoint, clone, computeFullBounds, endResizeBounds, findIntersectingNodes, fireChildPropertyChange, firePropertyChange, fullIntersects, fullPaint, fullPick, getAllNodes, getAllNodes, getAttribute, getAttribute, getBooleanAttribute, getBounds, getBoundsChanged, getBoundsReference, getBoundsVolatile, getChild, getChildBoundsInvalid, getChildBoundsVolatile, getChildPaintInvalid, getChildrenCount, getChildrenIterator, getChildrenPickable, getChildrenReference, getClientProperties, getClientProperty, getClientPropertyKeysEnumeration, getClientPropertyKeysIterator, getDoubleAttribute, getFullBounds, getFullBoundsInvalid, getFullBoundsReference, getGlobalBounds, getGlobalFullBounds, getGlobalRotation, getGlobalScale, getGlobalToLocalTransform, getGlobalTranslation, getHeight, getIntegerAttribute, getInverseTransform, getListenerList, getLocalToGlobalTransform, getOccluded, getOffset, getPaint, getPaintInvalid, getParent, getPickable, getPropertyChangeParentMask, getRoot, getRotation, getScale, getTransform, getTransformReference, getTransparency, getUnionOfChildrenBounds, getWidth, getX, getXOffset, getY, getYOffset, globalToLocal, globalToLocal, globalToLocal, indexOfChild, internalUpdateBounds, intersects, invalidateFullBounds, invalidateLayout, invalidatePaint, isAncestorOf, isDescendentOf, isDescendentOfRoot, isOpaque, layoutChildren, lerp, localToGlobal, localToGlobal, localToGlobal, localToParent, localToParent, localToParent, moveInBackOf, moveInFrontOf, moveToBack, moveToFront, offset, paintAfterChildren, paramString, parentBoundsChanged, parentToLocal, parentToLocal, parentToLocal, pick, pickAfterChildren, position, print, print, removeAllChildren, removeChild, removeChild, removeChildren, removeFromParent, removeInputEventListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaintFrom, reparent, replaceWith, resetBounds, rotate, rotateAboutPoint, rotateAboutPoint, rotateInPlace, scale, scaleAboutPoint, scaleAboutPoint, setBounds, setBoundsChanged, setChildBoundsInvalid, setChildBoundsVolatile, setChildPaintInvalid, setChildrenPickable, setFullBoundsInvalid, setGlobalRotation, setGlobalScale, setGlobalTranslation, setHeight, setOccluded, setOffset, setOffset, setPaint, setPaintInvalid, setParent, setPickable, setPropertyChangeParentMask, setRotation, setScale, setTransform, setTransparency, setWidth, setX, setY, signalBoundsChanged, startResizeBounds, toImage, toImage, toImage, toString, transformBy, translate, validateFullBounds, validateFullPaint
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

x1

private double x1

y1

private double y1

x2

private double x2

y2

private double y2

arrow

private Line2D.Double arrow

typeVisibility

private boolean typeVisibility

selectionVisibility

private boolean selectionVisibility

showStartHead

private boolean showStartHead

showEndHead

private boolean showEndHead

tooltipNode

private edu.umd.cs.piccolo.PNode tooltipNode

arrowHeadLength

private double arrowHeadLength

arrowHeadWidth

private double arrowHeadWidth

startHead

private Polygon startHead

endHead

private Polygon endHead

color

private Color color

OUTLIERCOLOR

private static final Color OUTLIERCOLOR

STABLECOLOR

private static final Color STABLECOLOR

ADJACENTCOLOR

private static final Color ADJACENTCOLOR

CLUSTERCOLOR

private static final Color CLUSTERCOLOR

stroke

private BasicStroke stroke

type

private int type

creationType

private InputCorrections.CreationType creationType

arrowHeadScale

private float arrowHeadScale

OUTLIER

public static final int OUTLIER
See Also:
Constant Field Values

STABLE

public static final int STABLE
See Also:
Constant Field Values

ADJACENT

public static final int ADJACENT
See Also:
Constant Field Values

CLUSTER

public static final int CLUSTER
See Also:
Constant Field Values

MAXARROWWIDTH

public static final int MAXARROWWIDTH
See Also:
Constant Field Values
Constructor Detail

ArrowPNode

public ArrowPNode(Point start,
                  Point end,
                  double offsetX,
                  double offsetY)

ArrowPNode

public ArrowPNode(double x1,
                  double y1,
                  double x2,
                  double y2)
Constructor that takes arrow coordinates


ArrowPNode

public ArrowPNode(InputCorrections.CreationType creationType,
                  String[][] attributes,
                  String tooltip,
                  Color color,
                  double width,
                  double height,
                  Point pointBegin,
                  Point pointEnd)
Method Detail

showStartArrowHead

public void showStartArrowHead(boolean state)
Show the arrowhead at the (x1,y1)-end of the line?

Parameters:
state - arrowhead "on" or "off"?

setArrowHeadScale

public void setArrowHeadScale(float scale)

showEndArrowHead

public void showEndArrowHead(boolean state)
Show the arrowhead at the (x2,y2)-end of the line?

Parameters:
state - arrowhead "on" or "off"?

calculateArrow

private void calculateArrow()
Calculate the coordinates for the 3 points defining each arrowhead (the arrowhead is a triangle) and generate polygon objects with these points. The polygon objects are then held in attributes startHead and endHead. The lenght of the arrow line is adjusted so that it doesn't overlap with the arrowheds


setArrow

public void setArrow(double x1,
                     double y1,
                     double x2,
                     double y2)
(Re)sets the coordinates of the arrow to (x1, y1) (x2, y2); produces a line and appropriate arrowheads and resets the Node's bounding box to hold the new arrow


setBounds

public boolean setBounds(double x,
                         double y,
                         double w,
                         double h)
Set the bounds of this PNode object.

Overrides:
setBounds in class edu.umd.cs.piccolo.PNode
See Also:
PNode.setBounds(double, double, double, double)

paint

protected void paint(edu.umd.cs.piccolo.util.PPaintContext paintContext)
Paints the arrow line with given color and stroke, adding arrowheads as applicable

Overrides:
paint in class edu.umd.cs.piccolo.PNode
See Also:
PNode.paint(edu.umd.cs.piccolo.util.PPaintContext)

getVisible

public boolean getVisible()
Is the visibility of this ArrowPNode currently set to true?

Overrides:
getVisible in class edu.umd.cs.piccolo.PNode

getType

public int getType()

getCreationType

public InputCorrections.CreationType getCreationType()

setType

public void setType(int type)

setLineWidth

public void setLineWidth(double width)

setProportionalWidth

public void setProportionalWidth(double propWidth)

setSelectionVisibility

public void setSelectionVisibility(boolean selectionVisibility)

setTypeVisibility

public void setTypeVisibility(boolean typeVisibility)

setVisible

public void setVisible(boolean visibility)
Overrides:
setVisible in class edu.umd.cs.piccolo.PNode

setColor

public void setColor(Color color)

createInputCorrectionArrow

public static ArrowPNode createInputCorrectionArrow(InputCorrections.InputCorrection c,
                                                    InputCorrections.CreationType creationType,
                                                    GeneralUnitPNode sourceUnitNode,
                                                    GeneralUnitPNode targetUnitNode)