jsky.timeline
Class DefaultTimeLineModel

java.lang.Object
  extended by jsky.timeline.DefaultTimeLineModel
All Implemented Interfaces:
TimeLineModel

public class DefaultTimeLineModel
extends java.lang.Object
implements TimeLineModel

The default model of a time line.

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

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

Field Summary
protected  java.util.List _changeListeners
           
protected  java.util.Comparator _comparator
           
protected  java.util.TreeSet _nodes
           
protected  java.beans.PropertyChangeListener fMyChildListener
           
 
Fields inherited from interface jsky.timeline.TimeLineModel
ALL_NODES_REMOVED, NODE_ADDED, NODE_REMOVED
 
Constructor Summary
DefaultTimeLineModel(int interval)
          constructor
DefaultTimeLineModel(int start, int end, int intervals)
          constructor
DefaultTimeLineModel(Time start, Time end, int intervals)
          constructor
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          add a property change listener to the time line.
 void addTimeLineNode(TimeLineNodeModel node)
          add a time line node to the time line without checking its legality
 boolean contains(TimeLineNodeModel model)
          returns whether or not the model contains the specified node
protected  void firePropertyChange(java.beans.PropertyChangeEvent evt)
          fires a change event to all listeners of the timeline
 java.util.Date getDateForTime(Time time)
          takes a time and converts it into a date where the new date is equal to the start date + the time
 Time getEndTime()
          get the ending value of the timeline
 int getIntervalCount()
          get the number of intervals in the time line
 java.util.Date getStartDate()
          get the start date
 Time getStartTime()
          get the starting value in the timeline
 Time getTimeForDate(java.util.Date date)
          takes a date and convert it to a time where the new time is equal to the date - start date
 java.util.Iterator getTimeLineNodesIterator()
          get an iterator for the time line node models
 void removeAllTimeLineNodes()
          remove all time line nodes from time line
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          remove a property change listener from the time line
 void removeTimeLineNode(TimeLineNodeModel node)
          remove a time line node from the time line
 void setStartDate(java.util.Date date)
          set the date from which the timeline should start Note: if the date is not null then all time values are considered offsets from it
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_comparator

protected java.util.Comparator _comparator

_nodes

protected java.util.TreeSet _nodes

_changeListeners

protected java.util.List _changeListeners

fMyChildListener

protected java.beans.PropertyChangeListener fMyChildListener
Constructor Detail

DefaultTimeLineModel

public DefaultTimeLineModel(int interval)
constructor

Parameters:
interval - the number of intervals in a 50 minute time line

DefaultTimeLineModel

public DefaultTimeLineModel(int start,
                            int end,
                            int intervals)
constructor

Parameters:
start - the starting minute of the timeline
end - the ending minute of the timeline
intervals - the number of intervals on the timeline

DefaultTimeLineModel

public DefaultTimeLineModel(Time start,
                            Time end,
                            int intervals)
constructor

Parameters:
start - the starting time of the timeline
end - the ending time of the timeline
intervals - the number of intervals on the timeline
Method Detail

addTimeLineNode

public void addTimeLineNode(TimeLineNodeModel node)
add a time line node to the time line without checking its legality

Specified by:
addTimeLineNode in interface TimeLineModel

removeTimeLineNode

public void removeTimeLineNode(TimeLineNodeModel node)
remove a time line node from the time line

Specified by:
removeTimeLineNode in interface TimeLineModel

removeAllTimeLineNodes

public void removeAllTimeLineNodes()
remove all time line nodes from time line

Specified by:
removeAllTimeLineNodes in interface TimeLineModel

getIntervalCount

public int getIntervalCount()
get the number of intervals in the time line

Specified by:
getIntervalCount in interface TimeLineModel

getTimeLineNodesIterator

public java.util.Iterator getTimeLineNodesIterator()
get an iterator for the time line node models

Specified by:
getTimeLineNodesIterator in interface TimeLineModel

addPropertyChangeListener

public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
add a property change listener to the time line.

Specified by:
addPropertyChangeListener in interface TimeLineModel

removePropertyChangeListener

public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
remove a property change listener from the time line

Specified by:
removePropertyChangeListener in interface TimeLineModel

getDateForTime

public java.util.Date getDateForTime(Time time)
takes a time and converts it into a date where the new date is equal to the start date + the time

Specified by:
getDateForTime in interface TimeLineModel

getTimeForDate

public Time getTimeForDate(java.util.Date date)
takes a date and convert it to a time where the new time is equal to the date - start date

Specified by:
getTimeForDate in interface TimeLineModel

setStartDate

public void setStartDate(java.util.Date date)
set the date from which the timeline should start Note: if the date is not null then all time values are considered offsets from it

Specified by:
setStartDate in interface TimeLineModel

getStartDate

public java.util.Date getStartDate()
get the start date

Specified by:
getStartDate in interface TimeLineModel

getStartTime

public Time getStartTime()
get the starting value in the timeline

Specified by:
getStartTime in interface TimeLineModel

getEndTime

public Time getEndTime()
get the ending value of the timeline

Specified by:
getEndTime in interface TimeLineModel

firePropertyChange

protected void firePropertyChange(java.beans.PropertyChangeEvent evt)
fires a change event to all listeners of the timeline


contains

public boolean contains(TimeLineNodeModel model)
returns whether or not the model contains the specified node

Specified by:
contains in interface TimeLineModel