UC Berkeley Group for User Interface Research
Updated November 17, 2000

edu.berkeley.guir.lib.satin.objects
Class LineArrow

java.lang.Object
  |
  +--edu.berkeley.guir.lib.satin.objects.GraphicalObjectImpl
        |
        +--edu.berkeley.guir.lib.satin.stroke.TimedStroke
              |
              +--edu.berkeley.guir.lib.satin.objects.LineArrow
All Implemented Interfaces:
Cloneable, EventListener, GraphicalObject, SatinConstants, Serializable, Shape, StrokeListener, Watchable, Watcher

public class LineArrow
extends TimedStroke
implements Watcher

A simple straight-line arrow.

This software is distributed under the Berkeley Software License.

 Revisions:  - SATIN-v2.1-1.0.0, Nov 02 2000, JH
               Created.
 

Since:
JDK 1.2
Version:
SATIN-v2.1-1.0.0, Nov 02 2000
Author:
Jason Hong ( jasonh@cs.berkeley.edu )
See Also:
Serialized Form

Inner classes inherited from class edu.berkeley.guir.lib.satin.SatinConstants
SatinConstants.ObjectPoolAffineTransform, SatinConstants.ObjectPoolPoint2D, SatinConstants.ObjectPoolPolygon2D, SatinConstants.ObjectPoolRectangle2D, SatinConstants.ObjectPoolStringBuffer, SatinConstants.UniqueAffineTransform, SatinConstants.UniquePoint2D, SatinConstants.UniquePolygon2D, SatinConstants.UniqueRectangle2D
 
Field Summary
static String ARROW_STYLE_FILE
           
 
Fields inherited from class edu.berkeley.guir.lib.satin.stroke.TimedStroke
TIMEDSTROKE_STYLE_FILE
 
Fields inherited from interface edu.berkeley.guir.lib.satin.SatinConstants
ABOVE, ALL, BAR, BELOW, clipboard, clprops, cmdqueue, cmdsubsys, CONTAINEDBY, CONTAINS, COORD_ABS, COORD_LOCAL, COORD_REL, DAMAGE_LATER, DAMAGE_NOW, DEBUG_GRAPHICS_OFFSET, DEBUG_STYLE_FILE, DEBUG_STYLE_GPROPERTY, DEEP, DEFAULT_POINT2D_POOL_SIZE, DEFAULT_POLYGON2D_POOL_SIZE, DEFAULT_RECTANGLE_POOL_SIZE, DEFAULT_REPAINT_THRESHOLD, DEFAULT_SELECT_THRESHOLD, DEFAULT_STRINGBUFFER_POOL_SIZE, DEFAULT_TRANSFORM_POOL_SIZE, DIR_CENTER, DIR_DOWN, DIR_DOWN_LEFT, DIR_DOWN_RIGHT, DIR_LEFT, DIR_RIGHT, DIR_UP, DIR_UP_LEFT, DIR_UP_RIGHT, FILTER_THRESHOLD, FIRST, FLOATING_PT_TOLERANCE, glprops, INTERSECTS, KEY_STYLE_DASHARRAY, KEY_STYLE_DASHPHASE, KEY_STYLE_DRAWCOLOR, KEY_STYLE_DRAWFONT, KEY_STYLE_DRAWTRANSPARENCY, KEY_STYLE_ENDCAP, KEY_STYLE_FILLCOLOR, KEY_STYLE_FILLTRANSPARENCY, KEY_STYLE_LINEJOIN, KEY_STYLE_LINEWIDTH, KEY_STYLE_MITERLIMIT, NEAR, NOTIFY_BOUNDS, NOTIFY_LAYER, NOTIFY_LOCATION, NOTIFY_STYLE, NOTIFY_TRANSFORM, poolPoints, poolPolys, poolRects, poolStrbuf, poolTx, rand, SATIN_DATA_DIRECTORY_DEFAULT, SATIN_DATA_DIRECTORY_GPROPERTY, SATIN_PROPERTIES_FILENAME, SHALLOW
 
Fields inherited from interface edu.berkeley.guir.lib.satin.objects.GraphicalObject
GESTUREINTRP_CLPROPERTY, INKINTRP_CLPROPERTY, STYLE_CLPROPERTY, VIEW_CLPROPERTY
 
Constructor Summary
LineArrow()
           
LineArrow(float x1, float y1, float x2, float y2)
           
LineArrow(GraphicalObject gobStart, GraphicalObject gobEnd)
           
LineArrow(Point2D ptStart, Point2D ptEnd)
           
 
Method Summary
protected  LineArrow clone(LineArrow newArrow)
          For clone chaining purposes.
protected  LineArrow deepClone(LineArrow newArrow)
          For deep-clone chaining.
protected  void defaultRender(SatinGraphics g)
          The default method for rendering.
protected  void drawArrowHead(SatinGraphics g)
          Draw the arrowhead portion of the arrow.
protected  void drawArrowLine(SatinGraphics g)
          Draw the line portion of the arrow.
 GraphicalObject getEndGraphicalObject()
           
 Point2D getEndPoint(int cdsys)
          Get either the center of the bounding box of the end graphical object if it was defined through setEndGraphicalObject(GraphicalObject), or the fixed point that was set through setEndPoint(Point2D).
 GraphicalObject getStartGraphicalObject()
           
 Point2D getStartPoint(int cdsys)
          Get either the center of the bounding box of the start graphical object if it was defined through setStartGraphicalObject(GraphicalObject), or the fixed point that was set through setStartPoint(Point2D).
protected  boolean lineContains(Point2D pt)
           
static void main(String[] argv)
           
 void onDelete(Watchable w)
          Callback method for notifications of deletions, that is this Graphical Object has been deleted and you should remove it.
 void onNotify(Watchable w, Object arg)
          Callback method for generic notifications.
 void onUpdate(Watchable w, Object arg)
          Callback method for notifications.
 void onUpdate(Watchable w, String strProperty, Object oldVal, Object newVal)
          Callback method for notifications.
 void setArrowHeadVector(double x, double y)
           
 void setArrowHeadVector(float x, float y)
           
 void setArrowHeadVector(Point2D pt)
          Set the direction the arrowhead should point, where (0,0) is where you are now.
 void setDirty(boolean flag)
           
 void setEndGraphicalObject(GraphicalObject gob)
          Set the graphical object that we end at (and the arrowhead points to).
 void setEndPoint(double x, double y)
           
 void setEndPoint(float x, float y)
           
 void setEndPoint(Point2D pt)
          Copies the values in the point.
 void setStartGraphicalObject(GraphicalObject gob)
          Set the graphical object that we start from.
 void setStartPoint(double x, double y)
           
 void setStartPoint(float x, float y)
           
 void setStartPoint(Point2D pt)
          Copies the values in the point.
protected  boolean shapeContainsInternal(Point2D pt)
          Here in case we ever want to override and deal with arrow heads.
protected  boolean shapeContainsInternal(Shape s)
          Here in case we ever want to override and deal with arrow heads.
protected  boolean shapeIntersectsInternal(Shape s)
          Here in case we ever want to override and deal with arrow heads.
protected  void updateArrowHeadAngle()
          Update the angle for the arrow head.
protected  void updateBounds()
           
 
Methods inherited from class edu.berkeley.guir.lib.satin.stroke.TimedStroke
addPoint, addPoint, addPoint, addPoint, addPoint, addPoint, changePoint, clearPoints, clone, clone, doneAddingPoints, getButtonString, getEndPoint2D, getEndPoint2D, getEndTime, getLength2D, getNumPoints, getPolygon2D, getPolygon2D, getStartPoint2D, getStartPoint2D, getStartTime, getSubstroke, isLeftButton, isMiddleButton, isRightButton, renderSelected, setDrawFix, setLeftButton, setMiddleButton, setRightButton, toDebugString
 
Methods inherited from class edu.berkeley.guir.lib.satin.objects.GraphicalObjectImpl
addIndexedProperty, addWatcher, applyTransform, bringDownALayer, bringDownNLayers, bringToBottomLayer, bringToTopLayer, bringUpALayer, bringUpNLayers, clearIndexedProperty, clearWatchers, clone, contains, contains, contains, contains, countWatchers, createNewInteractionHandler, createNewViewHandler, damage, damage, damage, damage, deepClone, deepClone, delete, disableDamage, disableNotify, enableDamage, enableNotify, equals, getAbsoluteLayer, getBoundingPoints2D, getBoundingPoints2D, getBoundingPoints2DRef, getBounds, getBounds2D, getBounds2D, getBounds2D, getClassDebugProperty, getClassProperty, getClassPropertyGestureInterpreter, getClassPropertyInkInterpreter, getClassPropertyStyle, getClassPropertyView, getGestureInterpreter, getHeight2D, getIndexedProperty, getIndexedProperty, getInkInterpreter, getInteractionHandler, getInverseTransform, getInverseTransform, getLocalBoundingPoints2DRef, getLocation2D, getLocation2D, getParentGroup, getPathIterator, getPathIterator, getPresentationName, getProperty, getPropertyNames, getRelativeLayer, getSheet, getStyle, getStyleRef, getTransform, getTransform, getTransformRef, getUniqueID, getView, getViewHandler, getWidth2D, handleNewStroke, handleSingleStroke, handleUpdateStroke, hasClosedBoundingPoints, hasDamageEnabled, hasNotifyEnabled, intersects, intersects, isClippedToBounds, isDirty, isSelectable, isVisible, minDistance, minDistance, minLocalDistance, moveBy, moveBy, moveTo, moveTo, notifyWatchers, notifyWatchers, notifyWatchersDelete, notifyWatchersUpdate, notifyWatchersUpdate, onNewStroke, onSingleStroke, onUpdateStroke, postProcessNewStroke, postProcessSingleStroke, postProcessUpdateStroke, preProcessNewStroke, preProcessSingleStroke, preProcessUpdateStroke, redispatchNewStroke, redispatchSingleStroke, redispatchUpdateStroke, removeIndexedProperty, removeIndexedProperty, removeProperty, removeWatcher, render, renderAllCoordBounds, renderBoundingBox, renderDebug, renderDimensions, renderSelectionHandle, setBoundingPoints2D, setClassDebugProperty, setClassProperty, setClassPropertyGestureInterpreter, setClassPropertyInkInterpreter, setClassPropertyStyle, setClassPropertyView, setClipToBounds, setDirty, setGestureInterpreter, setHasClosedBoundingPoints, setIndexedProperty, setInkInterpreter, setInteractionHandler, setLocalBoundingPoints2DRef, setParentGroup, setProperty, setRelativeLayer, setSelectable, setStyle, setTransform, setTransformInternal, setUniqueID, setView, setViewHandler, setVisible, shapeContains, shapeContains, shapeContains, shapeContains, shapeIntersects, shapeIntersects, toString, updateBoundingPoints
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.berkeley.guir.lib.satin.watch.Watcher
clone
 

Field Detail

ARROW_STYLE_FILE

public static final String ARROW_STYLE_FILE
Constructor Detail

LineArrow

public LineArrow()

LineArrow

public LineArrow(Point2D ptStart,
                 Point2D ptEnd)

LineArrow

public LineArrow(float x1,
                 float y1,
                 float x2,
                 float y2)

LineArrow

public LineArrow(GraphicalObject gobStart,
                 GraphicalObject gobEnd)
Method Detail

setDirty

public void setDirty(boolean flag)

setStartPoint

public void setStartPoint(Point2D pt)
Copies the values in the point.

setStartPoint

public void setStartPoint(float x,
                          float y)

setStartPoint

public void setStartPoint(double x,
                          double y)

setStartGraphicalObject

public void setStartGraphicalObject(GraphicalObject gob)
Set the graphical object that we start from.

getStartPoint

public Point2D getStartPoint(int cdsys)
Get either the center of the bounding box of the start graphical object if it was defined through setStartGraphicalObject(GraphicalObject), or the fixed point that was set through setStartPoint(Point2D).
Parameters:
cdsys - is the coordinate system to return in.

getStartGraphicalObject

public GraphicalObject getStartGraphicalObject()

setEndPoint

public void setEndPoint(Point2D pt)
Copies the values in the point.

setEndPoint

public void setEndPoint(float x,
                        float y)

setEndPoint

public void setEndPoint(double x,
                        double y)

setEndGraphicalObject

public void setEndGraphicalObject(GraphicalObject gob)
Set the graphical object that we end at (and the arrowhead points to).

getEndPoint

public Point2D getEndPoint(int cdsys)
Get either the center of the bounding box of the end graphical object if it was defined through setEndGraphicalObject(GraphicalObject), or the fixed point that was set through setEndPoint(Point2D).
Parameters:
cdsys - is the coordinate system to return in.

getEndGraphicalObject

public GraphicalObject getEndGraphicalObject()

setArrowHeadVector

public void setArrowHeadVector(Point2D pt)
Set the direction the arrowhead should point, where (0,0) is where you are now. Normalized so that the distance is 1.

setArrowHeadVector

public void setArrowHeadVector(float x,
                               float y)

setArrowHeadVector

public void setArrowHeadVector(double x,
                               double y)

updateArrowHeadAngle

protected void updateArrowHeadAngle()
Update the angle for the arrow head.

updateBounds

protected void updateBounds()

shapeContainsInternal

protected final boolean shapeContainsInternal(Point2D pt)
Here in case we ever want to override and deal with arrow heads.
Overrides:
shapeContainsInternal in class GraphicalObjectImpl

shapeContainsInternal

protected final boolean shapeContainsInternal(Shape s)
Here in case we ever want to override and deal with arrow heads.
Overrides:
shapeContainsInternal in class GraphicalObjectImpl

shapeIntersectsInternal

protected final boolean shapeIntersectsInternal(Shape s)
Here in case we ever want to override and deal with arrow heads.
Overrides:
shapeIntersectsInternal in class GraphicalObjectImpl

lineContains

protected boolean lineContains(Point2D pt)

defaultRender

protected void defaultRender(SatinGraphics g)
Description copied from class: GraphicalObjectImpl
The default method for rendering. This method is used by the DefaultView to render. Override this method in subclasses.
Overrides:
defaultRender in class TimedStroke

drawArrowHead

protected void drawArrowHead(SatinGraphics g)
Draw the arrowhead portion of the arrow.

drawArrowLine

protected void drawArrowLine(SatinGraphics g)
Draw the line portion of the arrow.

onNotify

public void onNotify(Watchable w,
                     Object arg)
Description copied from interface: Watcher
Callback method for generic notifications. This typically won't be used.
Specified by:
onNotify in interface Watcher
Following copied from interface: edu.berkeley.guir.lib.satin.watch.Watcher
Parameters:
w - is the Watchable object notifying you.
arg - is some agreed upon argument.
See Also:
Watchable.notifyWatchers(), Watchable.notifyWatchers(java.lang.Object)

onUpdate

public void onUpdate(Watchable w,
                     Object arg)
Description copied from interface: Watcher
Callback method for notifications.
Specified by:
onUpdate in interface Watcher
Following copied from interface: edu.berkeley.guir.lib.satin.watch.Watcher
Parameters:
w - is the Watchable object that has been updated.
arg - is some agreed upon argument.
See Also:
Watchable.notifyWatchersUpdate(Object)

onUpdate

public void onUpdate(Watchable w,
                     String strProperty,
                     Object oldVal,
                     Object newVal)
Description copied from interface: Watcher
Callback method for notifications.
Specified by:
onUpdate in interface Watcher
Following copied from interface: edu.berkeley.guir.lib.satin.watch.Watcher
Parameters:
w - is the Watchable object that has been updated.
strProperty - is the name of the property to update.
oldVal - is the old value of the property. This should usually be a clone of the old value, so that modifying this value should have no effect. Whether this is a copy or a reference should be defined in the SatinConstants file.
newVal - is the new value of the property. This should usually be a clone of the old value, so that modifying this value should have no effect. However, don't clone if it is prohibitively expensive to do so. Whether this is a copy or a reference should be defined in the SatinConstants file.
See Also:
SatinConstants, Watchable.notifyWatchersUpdate(String, Object, Object)

onDelete

public void onDelete(Watchable w)
Description copied from interface: Watcher
Callback method for notifications of deletions, that is this Graphical Object has been deleted and you should remove it.
Specified by:
onDelete in interface Watcher
Following copied from interface: edu.berkeley.guir.lib.satin.watch.Watcher
Parameters:
w - is the Watchable object to be deleted.
See Also:
Watchable.notifyWatchersDelete()

clone

protected LineArrow clone(LineArrow newArrow)
For clone chaining purposes.
See Also:
GraphicalObjectImpl.clone(GraphicalObjectImpl)

deepClone

protected LineArrow deepClone(LineArrow newArrow)
For deep-clone chaining. If you override this method in a subclass, be sure to call this method, just as you would have to for normal clone chaining.
See Also:
TimedStroke.clone(), GraphicalObjectImpl.deepClone()

main

public static void main(String[] argv)

Copyright Information