jsky.timeline
Class DefaultTimeLineNode

java.lang.Object
  extended by jsky.timeline.DefaultTimeLineNode
All Implemented Interfaces:
java.beans.VetoableChangeListener, java.util.EventListener, TimeLineNode

public class DefaultTimeLineNode
extends java.lang.Object
implements TimeLineNode

An interface for a single node on the time line.

This code was developed by NASA, Goddard Space Flight Center, Code 588 for the Scientist's Expert Assistant (SEA) project.

Version:
04/27/99
Author:
M. Fishman

Field Summary
protected  java.beans.VetoableChangeSupport fChangeSupport
           
protected  java.awt.BasicStroke fDefaultStroke
           
protected  int fDragMode
           
protected  boolean fForceRecalculation
           
protected  float fHandleHeight
           
protected  float fHandleWidth
           
protected  java.awt.geom.Rectangle2D.Float fLeftHandle
           
protected  java.awt.geom.Line2D.Float fLHandleBottomShadowLine
           
protected  java.awt.geom.Line2D.Float fLHandleLeftShadowLine
           
protected  java.awt.geom.Line2D.Float fLHandleRightShadowLine
           
protected  java.awt.geom.Line2D.Float fLHandleTopShadowLine
           
protected  int fMode
           
protected  VetoableTimeLineNodeModel fModel
           
protected  java.beans.VetoableChangeListener fMyVetoListener
           
protected  java.awt.geom.Line2D.Float fRHandleBottomShadowLine
           
protected  java.awt.geom.Line2D.Float fRHandleLeftShadowLine
           
protected  java.awt.geom.Line2D.Float fRHandleRightShadowLine
           
protected  java.awt.geom.Line2D.Float fRHandleTopShadowLine
           
protected  java.awt.geom.Rectangle2D.Float fRightHandle
           
protected  java.awt.Color fSelectedColor
           
protected  java.awt.BasicStroke fShadowStroke
           
protected  java.awt.geom.Rectangle2D.Float fThumb
           
protected  float fThumbBegin
           
protected  float fThumbEnd
           
protected  float fThumbHeight
           
protected  java.awt.geom.Line2D.Float fThumbShadowLine
           
protected  java.awt.geom.Line2D.Float fThumbTopShadowLine
           
protected  TimeLine fTimeLine
           
protected  java.awt.Color fUnselectedColor
           
 
Fields inherited from interface jsky.timeline.TimeLineNode
BIC, DEFAULT_FONT, DEFAULT_LABEL_SPACE, END_TIME, HIT_LEFT_EDGE, HIT_RIGHT_EDGE, LEFT_HANDLE_SELECTED, MODE, MOVE_CURSOR, NAME, NODE, NODE_MAX_SIZE_EXCEEDED, NODE_MIN_SIZE_EXCEEDED, NODE_OVERLAP, NODE_SELECTED, REVERSE_ROTATED_FONT, RIGHT_HANDLE_SELECTED, ROTATED_FONT, SELECTED_COLOR, START_TIME, UNSELECTED, UNSELECTED_COLOR
 
Constructor Summary
DefaultTimeLineNode()
          constructor
DefaultTimeLineNode(Time start, Time end)
           
DefaultTimeLineNode(Time startTime, Time endTime, java.lang.String name)
           
DefaultTimeLineNode(VetoableTimeLineNodeModel model)
           
 
Method Summary
 void addVetoableChangeListener(java.beans.VetoableChangeListener listener)
          add a property change listener to the node
protected  void calculateNodeDimensions()
          calculate thumb's dimensions in pixels
 boolean containsPoint(java.awt.Point pt)
          returns whether the specified point is in the node
 int getAreaForPoint(java.awt.Point pt)
          returns what area of a time line node a point exists in
 java.awt.Point getCenterPoint()
          returns the center point for the time line node
 java.awt.Cursor getCursor(java.awt.event.MouseEvent evt)
          get the cursor for the specified point
 java.lang.String getDescription(java.awt.Point pt)
          returns a description for the area at the specified point
 Time getDuration()
          get the duration of the time line node
 Time getEndTime()
          get the time on the time line that this node ends
 TimeLineNodeModel getModel()
          get the node's underlying model
 TimeLine getParent()
          get the parent time line
 java.awt.Color getSelectedColor()
          get the the selected color the time line node
 int getSelectionMode()
          get the selection mode of the time line node
 Time getStartTime()
          get the time on the time line that this node starts
 java.lang.String getTimeLineNodeName()
          get the name of the time line node
 java.awt.Color getUnselectedColor()
          get the the unselected color the time line node
 void handleKeyEvent(java.awt.event.KeyEvent evt)
          handle key event
 void handleMouseDragEvent(java.awt.event.MouseEvent evt)
          handle mouse events
 void handleMouseEvent(java.awt.event.MouseEvent evt)
          handle mouse events
 void handleMouseMoveEvent(java.awt.event.MouseEvent evt)
          handle mouse events
protected  void init()
          initializes the object.
 boolean intersects(TimeLineNode node)
          returns whether the node intersects the passed in node
 boolean isDragging()
          returns whether the node is currently being dragged
 boolean isSelected()
          returns whther the node is currently selected.
 void moveTimeLineNodeBy(Time time)
          move node by specified amount
 void paintTimeLineNode(java.awt.Graphics2D graphics)
          paint the time line node
 void removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
          remove a propertyChangeListener to the node
 void revertToPrevious()
          revert the time line node to its previous position
 void setDuration(Time durationLength)
          set the duration of the time line node
 void setEndTime(Time time)
          set the time on the time line that this node ends
 void setModel(TimeLineNodeModel model)
          set the time line node's underlying model
 void setParent(TimeLine timeLine)
          set the parent time line
 void setSelectedColor(java.awt.Color color)
          set the selected color for the time line node
 void setSelectionMode(int mode)
          set the selection mode of the time linenode
 void setStartTime(Time time)
          set the time that this node starts
 void setTimeLineNode(Time start, Time end)
          move node to a specified location
 void setTimeLineNodeName(java.lang.String name)
          give the time line node a name
 void setUnselectedColor(java.awt.Color color)
          set the unselected color for the time line node
 java.lang.String toString()
           
 void vetoableChange(java.beans.PropertyChangeEvent evt)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

fThumbHeight

protected float fThumbHeight

fHandleHeight

protected float fHandleHeight

fHandleWidth

protected float fHandleWidth

fSelectedColor

protected java.awt.Color fSelectedColor

fUnselectedColor

protected java.awt.Color fUnselectedColor

fModel

protected VetoableTimeLineNodeModel fModel

fMode

protected int fMode

fDragMode

protected int fDragMode

fChangeSupport

protected java.beans.VetoableChangeSupport fChangeSupport

fThumbBegin

protected float fThumbBegin

fThumbEnd

protected float fThumbEnd

fDefaultStroke

protected java.awt.BasicStroke fDefaultStroke

fShadowStroke

protected java.awt.BasicStroke fShadowStroke

fThumbShadowLine

protected java.awt.geom.Line2D.Float fThumbShadowLine

fThumbTopShadowLine

protected java.awt.geom.Line2D.Float fThumbTopShadowLine

fLHandleTopShadowLine

protected java.awt.geom.Line2D.Float fLHandleTopShadowLine

fLHandleBottomShadowLine

protected java.awt.geom.Line2D.Float fLHandleBottomShadowLine

fLHandleRightShadowLine

protected java.awt.geom.Line2D.Float fLHandleRightShadowLine

fLHandleLeftShadowLine

protected java.awt.geom.Line2D.Float fLHandleLeftShadowLine

fRHandleTopShadowLine

protected java.awt.geom.Line2D.Float fRHandleTopShadowLine

fRHandleBottomShadowLine

protected java.awt.geom.Line2D.Float fRHandleBottomShadowLine

fRHandleRightShadowLine

protected java.awt.geom.Line2D.Float fRHandleRightShadowLine

fRHandleLeftShadowLine

protected java.awt.geom.Line2D.Float fRHandleLeftShadowLine

fThumb

protected java.awt.geom.Rectangle2D.Float fThumb

fLeftHandle

protected java.awt.geom.Rectangle2D.Float fLeftHandle

fRightHandle

protected java.awt.geom.Rectangle2D.Float fRightHandle

fTimeLine

protected TimeLine fTimeLine

fForceRecalculation

protected boolean fForceRecalculation

fMyVetoListener

protected java.beans.VetoableChangeListener fMyVetoListener
Constructor Detail

DefaultTimeLineNode

public DefaultTimeLineNode()
constructor


DefaultTimeLineNode

public DefaultTimeLineNode(Time start,
                           Time end)

DefaultTimeLineNode

public DefaultTimeLineNode(Time startTime,
                           Time endTime,
                           java.lang.String name)

DefaultTimeLineNode

public DefaultTimeLineNode(VetoableTimeLineNodeModel model)
Method Detail

init

protected void init()
initializes the object. Override at your own risk.


setSelectionMode

public void setSelectionMode(int mode)
set the selection mode of the time linenode

Specified by:
setSelectionMode in interface TimeLineNode

getSelectionMode

public int getSelectionMode()
get the selection mode of the time line node

Specified by:
getSelectionMode in interface TimeLineNode

setUnselectedColor

public void setUnselectedColor(java.awt.Color color)
set the unselected color for the time line node

Specified by:
setUnselectedColor in interface TimeLineNode

getUnselectedColor

public java.awt.Color getUnselectedColor()
get the the unselected color the time line node

Specified by:
getUnselectedColor in interface TimeLineNode

setSelectedColor

public void setSelectedColor(java.awt.Color color)
set the selected color for the time line node

Specified by:
setSelectedColor in interface TimeLineNode

getSelectedColor

public java.awt.Color getSelectedColor()
get the the selected color the time line node

Specified by:
getSelectedColor in interface TimeLineNode

getStartTime

public Time getStartTime()
get the time on the time line that this node starts

Specified by:
getStartTime in interface TimeLineNode

setStartTime

public void setStartTime(Time time)
                  throws DetailedPropertyVetoException
set the time that this node starts

Specified by:
setStartTime in interface TimeLineNode
Throws:
DetailedPropertyVetoException

moveTimeLineNodeBy

public void moveTimeLineNodeBy(Time time)
                        throws DetailedPropertyVetoException
move node by specified amount

Specified by:
moveTimeLineNodeBy in interface TimeLineNode
Throws:
DetailedPropertyVetoException

getEndTime

public Time getEndTime()
get the time on the time line that this node ends

Specified by:
getEndTime in interface TimeLineNode

setEndTime

public void setEndTime(Time time)
                throws DetailedPropertyVetoException
set the time on the time line that this node ends

Specified by:
setEndTime in interface TimeLineNode
Throws:
DetailedPropertyVetoException

getDuration

public Time getDuration()
get the duration of the time line node

Specified by:
getDuration in interface TimeLineNode

setDuration

public void setDuration(Time durationLength)
                 throws DetailedPropertyVetoException
set the duration of the time line node

Specified by:
setDuration in interface TimeLineNode
Throws:
DetailedPropertyVetoException

addVetoableChangeListener

public void addVetoableChangeListener(java.beans.VetoableChangeListener listener)
add a property change listener to the node

Specified by:
addVetoableChangeListener in interface TimeLineNode

removeVetoableChangeListener

public void removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
remove a propertyChangeListener to the node

Specified by:
removeVetoableChangeListener in interface TimeLineNode

paintTimeLineNode

public void paintTimeLineNode(java.awt.Graphics2D graphics)
paint the time line node

Specified by:
paintTimeLineNode in interface TimeLineNode
Parameters:
graphics - the graphics component to paint

handleMouseEvent

public void handleMouseEvent(java.awt.event.MouseEvent evt)
Description copied from interface: TimeLineNode
handle mouse events

Specified by:
handleMouseEvent in interface TimeLineNode

handleMouseDragEvent

public void handleMouseDragEvent(java.awt.event.MouseEvent evt)
handle mouse events

Specified by:
handleMouseDragEvent in interface TimeLineNode

handleMouseMoveEvent

public void handleMouseMoveEvent(java.awt.event.MouseEvent evt)
handle mouse events

Specified by:
handleMouseMoveEvent in interface TimeLineNode

handleKeyEvent

public void handleKeyEvent(java.awt.event.KeyEvent evt)
                    throws DetailedPropertyVetoException
handle key event

Specified by:
handleKeyEvent in interface TimeLineNode
Throws:
DetailedPropertyVetoException

setTimeLineNodeName

public void setTimeLineNodeName(java.lang.String name)
give the time line node a name

Specified by:
setTimeLineNodeName in interface TimeLineNode

getTimeLineNodeName

public java.lang.String getTimeLineNodeName()
get the name of the time line node

Specified by:
getTimeLineNodeName in interface TimeLineNode

setParent

public void setParent(TimeLine timeLine)
set the parent time line

Specified by:
setParent in interface TimeLineNode

getParent

public TimeLine getParent()
get the parent time line

Specified by:
getParent in interface TimeLineNode

calculateNodeDimensions

protected void calculateNodeDimensions()
calculate thumb's dimensions in pixels


isDragging

public boolean isDragging()
returns whether the node is currently being dragged

Specified by:
isDragging in interface TimeLineNode

isSelected

public boolean isSelected()
returns whther the node is currently selected. Note: This method will only return true if the whole node is selected.

Specified by:
isSelected in interface TimeLineNode

revertToPrevious

public void revertToPrevious()
revert the time line node to its previous position

Specified by:
revertToPrevious in interface TimeLineNode

vetoableChange

public void vetoableChange(java.beans.PropertyChangeEvent evt)
                    throws DetailedPropertyVetoException
Specified by:
vetoableChange in interface java.beans.VetoableChangeListener
Throws:
DetailedPropertyVetoException

getAreaForPoint

public int getAreaForPoint(java.awt.Point pt)
returns what area of a time line node a point exists in

Specified by:
getAreaForPoint in interface TimeLineNode

intersects

public boolean intersects(TimeLineNode node)
returns whether the node intersects the passed in node

Specified by:
intersects in interface TimeLineNode

getCenterPoint

public java.awt.Point getCenterPoint()
returns the center point for the time line node

Specified by:
getCenterPoint in interface TimeLineNode

setTimeLineNode

public void setTimeLineNode(Time start,
                            Time end)
                     throws DetailedPropertyVetoException
move node to a specified location

Specified by:
setTimeLineNode in interface TimeLineNode
Throws:
DetailedPropertyVetoException

containsPoint

public boolean containsPoint(java.awt.Point pt)
returns whether the specified point is in the node

Specified by:
containsPoint in interface TimeLineNode

getDescription

public java.lang.String getDescription(java.awt.Point pt)
returns a description for the area at the specified point

Specified by:
getDescription in interface TimeLineNode

getModel

public TimeLineNodeModel getModel()
get the node's underlying model

Specified by:
getModel in interface TimeLineNode

setModel

public void setModel(TimeLineNodeModel model)
set the time line node's underlying model

Specified by:
setModel in interface TimeLineNode

getCursor

public java.awt.Cursor getCursor(java.awt.event.MouseEvent evt)
get the cursor for the specified point

Specified by:
getCursor in interface TimeLineNode

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object