public class Observation_Timeline_Table_Model
extends javax.swing.table.AbstractTableModel
Observation_Timeline
. The model allows
an observation's start time and duration to be editable.Modifier and Type | Class and Description |
---|---|
static class |
Observation_Timeline_Table_Model.DateRenderer
A date cell render suitable for the predict time.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String[] |
COLUMN_NAMES |
static java.lang.String |
ID
Class identification name with source code version and date.
|
Constructor and Description |
---|
Observation_Timeline_Table_Model()
Creates an empty table model.
|
Observation_Timeline_Table_Model(Observation_Timeline timeline)
Creates a table model for the specified
Observation_Timeline . |
Modifier and Type | Method and Description |
---|---|
void |
addObservation(Observation_Event event)
Adds an observation event to the underlying timeline.
|
void |
addObservation(java.lang.String identifier,
double startTime,
double duration)
Adds an observation event to the underlying timeline.
|
double |
getAutoDuration()
Gets a nice duration for the underlying timeline.
|
java.lang.Class |
getColumnClass(int column)
Gets the specific superclass for all the cell values in the column.
|
int |
getColumnCount()
Gets the number of columns in the table model.
|
java.lang.String |
getColumnName(int column)
Gets the name of the column at column.
|
double |
getDuration()
Gets the duration of the underlying timeline.
|
int |
getIndexForDate(java.util.Date date)
Gets the row index of the the observation whose start time is nearest to,
but not greater than, the indicated date.
|
Observation_Event |
getObservationEvent(int row)
Gets the observation event at the indicated row.
|
Observation_Event |
getObservationEvent(java.lang.String id)
Gets the observation event with the indicated ID.
|
java.util.List<java.lang.String> |
getObservationIds(boolean includeArbitrary)
Gets the set of observation IDs in the underlying observation timeline.
|
Observation_Timeline |
getObservationTimeline()
Gets the
Observation_Timeline data from the table model. |
int |
getRowCount()
Gets the number of rows in the table model.
|
double |
getStartTime()
Gets the start time of the underlying timeline.
|
double |
getStopTime()
Gets the stop time of the underlying timeline.
|
java.lang.Object |
getValueAt(int row,
int column)
Returns the value for the cell at column and
row.
|
boolean |
isCellEditable(int row,
int column)
Returns true if the cell at row and
column is editable.
|
void |
removeObservation(java.lang.String identifier)
Removes an observation from the timeline.
|
void |
setObservationTimeline(Observation_Timeline timeline)
Sets the
Observation_Timeline data for the table model. |
void |
setValueAt(java.lang.Object value,
int row,
int column)
Sets the value in the cell at column and
row to value.
|
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
public static final java.lang.String ID
public static final java.lang.String[] COLUMN_NAMES
public Observation_Timeline_Table_Model()
public Observation_Timeline_Table_Model(Observation_Timeline timeline)
Observation_Timeline
.timeline
- the timeline from which to create the table model.public Observation_Timeline getObservationTimeline()
Observation_Timeline
data from the table model.public void setObservationTimeline(Observation_Timeline timeline)
Observation_Timeline
data for the table model. This
method notifies all listeners that all cell values in the table's rows
may have changed, as may have the number of rows.timeline
- the new timeline data.AbstractTableModel.fireTableDataChanged()
public java.util.List<java.lang.String> getObservationIds(boolean includeArbitrary)
includeArbitrary
- if true, all arbitrary observations are
included; otherwise they are not.Observation_Event.isArbitrary()
public double getStartTime()
Observation_Timeline.getStartTime()
public double getStopTime()
Observation_Timeline.getStopTime()
public double getDuration()
Observation_Timeline.getDuration()
public double getAutoDuration()
Observation_Timeline.getAutoDuration()
public int getIndexForDate(java.util.Date date)
date
- the date of interest.public int getRowCount()
Observation_Event
s in the timeline.Observation_Timeline.getSize()
public int getColumnCount()
public java.lang.Object getValueAt(int row, int column)
row
- the row whose value is to be queried.column
- the column whose value is to be queried.public java.lang.Class getColumnClass(int column)
String
. The remaining
columns are Double
s.getColumnClass
in interface javax.swing.table.TableModel
getColumnClass
in class javax.swing.table.AbstractTableModel
column
- the index of the column.public java.lang.String getColumnName(int column)
getColumnName
in interface javax.swing.table.TableModel
getColumnName
in class javax.swing.table.AbstractTableModel
column
- the index of the column.public boolean isCellEditable(int row, int column)
setValueAt(Object,int,int)
will not change the value of that cell.
This implementation returns false for all cells.
isCellEditable
in interface javax.swing.table.TableModel
isCellEditable
in class javax.swing.table.AbstractTableModel
row
- the row whose value is to be queried.column
- the column whose value is to be queried.public void setValueAt(java.lang.Object value, int row, int column)
setValueAt
in interface javax.swing.table.TableModel
setValueAt
in class javax.swing.table.AbstractTableModel
value
- the new value.row
- the row whose value is to be changed.column
- the column whose value is to be changed.public Observation_Event getObservationEvent(int row)
row
- the row number in question.public Observation_Event getObservationEvent(java.lang.String id)
id
- the observation ID in question.public void addObservation(Observation_Event event)
This method invokes Observation_Timeline.addObservation(Observation_Event)
, which sorts the
data according to their natural sort order, which is start time, and which
will overwrite a pre-existing observation with the same identifier.
event
- the observation event to be added.Observation_Timeline.addObservation(Observation_Event)
public void addObservation(java.lang.String identifier, double startTime, double duration)
This method invokes Observation_Timeline.addObservation(String,double,double)
, which sorts the
data according to their natural sort order, which is start time, and which
will overwrite a pre-existing observation with the same identifier.
identifier
- the unique identifier of the new observation. Typically
this identifier will be the string form of the observation ID associated
with this observation, but it is not required to be so.startTime
- the start time of the new observation.duration
- the duration of the new observation.public void removeObservation(java.lang.String identifier)
This method invokes Observation_Timeline.removeObservation(String)
.
identifier
- the unique identifier of the observation to remove.Copyright \ (C) Arizona Board of Regents on behalf of the \ Planetary Image Research Laboratory, Lunar and \ Planetary Laboratory at the University of Arizona