public class PTF_Record_Table_Model
extends javax.swing.table.AbstractTableModel
extends
the base PTF_Record
by including a line number to display.
It also maintains non-displayed data indicating whether a particular row
should be hidden by a viewer and data indicating whether a particular row is
a duplicate of another row. It is up to the viewer to take action on these
attributes, however.
This model is designed primarily for PTF_Viewer
's table, which does
handle the aforementioned extended attributes.
Note that all row and col (column) indexes are model indexes, not view indexes.
PTF_Record_Table_Model.ExtendedPtfRecord
,
isDuplicateRow(int)
,
isHiddenRow(int)
,
Serialized FormModifier and Type | Class and Description |
---|---|
static class |
PTF_Record_Table_Model.Column |
static class |
PTF_Record_Table_Model.ColumnType
An enumeration of the types of data that may be contained in columns of the
PTF record table model.
|
static class |
PTF_Record_Table_Model.ExtendedPtfRecord
A PTF record with extended attributes.
|
static class |
PTF_Record_Table_Model.TransferFormat |
static class |
PTF_Record_Table_Model.Uniqueness
A measure of uniqueness for a PTF record.
|
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ID
Class identification name with source code version and date.
|
Constructor and Description |
---|
PTF_Record_Table_Model()
Creates an empty table model.
|
PTF_Record_Table_Model(java.util.List<PTF_Record_Table_Model.ExtendedPtfRecord> ptfRecords)
Creates a new table model from a set of extended attribute PTF records.
|
Modifier and Type | Method and Description |
---|---|
void |
addPtfRecords(java.util.List<PTF_Record_Table_Model.ExtendedPtfRecord> ptfRecords)
Adds to the set of extended PTF records currently held by the table model.
|
static java.lang.String |
getColHeader(java.util.List<PTF_Record_Table_Model.Column> columns,
PTF_Record_Table_Model.TransferFormat format) |
java.lang.Class |
getColumnClass(int col)
Gets the specific class for all the cell values in the column.
|
int |
getColumnCount()
Gets the number of columns in the table model.
|
java.lang.String |
getColumnName(int col)
Gets the name of the column at the indicated column index.
|
PTF_Record_Table_Model.ExtendedPtfRecord |
getPtfRecord(int row)
Gets the extended attribute PTF record at the indicated row.
|
java.util.List<PTF_Record_Table_Model.ExtendedPtfRecord> |
getPtfRecords()
Gets the set of extended PTF records currently held by the table model.
|
java.lang.String |
getReport(PTF_Record_Table_Model.ExtendedPtfRecord ptfRecord,
java.util.List<PTF_Record_Table_Model.Column> columns,
PTF_Record_Table_Model.TransferFormat format) |
int |
getRowCount()
Gets the number of rows in the table model.
|
java.lang.Object |
getValueAt(int row,
int col)
Returns the value for the cell at the indicated row and column.
|
boolean |
hasNonHiriseRecords()
Indicates whether the model contains non-HiRISE records.
|
void |
hideRow(int row)
Sets the 'hidden' attribute of the PTF record at the indicated model row.
|
boolean |
isDuplicateRow(int row)
Identifies whether the indicated model row contains a duplicate record.
|
boolean |
isHiddenRow(int row)
Determines whether the PTF record at the indicated row is marked as hidden.
|
boolean |
isHiriseRow(int row)
Determines whether the PTF record at the indicated row is a HiRISE record.
|
void |
recomputeUniqueness(boolean usePointingModeInUniqueness)
Recomputes the uniqueness measure for each record in the model.
|
void |
setPtfRecords(java.util.List<PTF_Record_Table_Model.ExtendedPtfRecord> ptfRecords)
Sets the set of extended PTF records currently held by the table model.
|
void |
showRow(int row)
Unsets the 'hidden' attribute of the PTF record at the indicated model row.
|
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
public static final java.lang.String ID
public PTF_Record_Table_Model()
public PTF_Record_Table_Model(java.util.List<PTF_Record_Table_Model.ExtendedPtfRecord> ptfRecords)
uniqueness
measure, and those found to be duplicates are so marked.ptfRecords
- the collection of PTF records for the new model.setPtfRecords(List)
public java.util.List<PTF_Record_Table_Model.ExtendedPtfRecord> getPtfRecords()
public void setPtfRecords(java.util.List<PTF_Record_Table_Model.ExtendedPtfRecord> ptfRecords)
uniqueness
measure, and those found to be duplicates are so marked.
This method notifies all listeners that all cell values in the table's rows may have changed, as may have the number of rows.
ptfRecords
- the new set of extended PTF records; may be null.AbstractTableModel.fireTableDataChanged()
public void addPtfRecords(java.util.List<PTF_Record_Table_Model.ExtendedPtfRecord> ptfRecords)
uniqueness
measure, and those found to be duplicates are so
marked.
This method notifies all listeners that all cell values in the table's rows may have changed, as may have the number of rows.
ptfRecords
- the set of extended PTF records to be added; may be
null.AbstractTableModel.fireTableDataChanged()
public int getRowCount()
public int getColumnCount()
PTF_Record_Table_Model.Column
public java.lang.Object getValueAt(int row, int col)
For the instrument spare 1, 2, and 3 columns, the returned object's class is
either as defined in the PTF SIS (Double
, Double
, and Integer
, respectively) or String
. The returned object's class is
String if any PTF record in the model contains a non-number in that
column.
row
- the model row whose value is to be queried.col
- the model column whose value is to be queried.public java.lang.Class getColumnClass(int col)
For the instrument spare 1, 2, and 3 columns, the column class is either as
defined in the PTF SIS (Double
, Double
, and Integer
,
respectively) or String
. The column class is String if any
PTF record contains a non-number in that column.
getColumnClass
in interface javax.swing.table.TableModel
getColumnClass
in class javax.swing.table.AbstractTableModel
col
- the model index of the column in question.public java.lang.String getColumnName(int col)
getColumnName
in interface javax.swing.table.TableModel
getColumnName
in class javax.swing.table.AbstractTableModel
col
- the model index of the column.PTF_Record_Table_Model.Column
public PTF_Record_Table_Model.ExtendedPtfRecord getPtfRecord(int row)
row
- the model row number in question.public void recomputeUniqueness(boolean usePointingModeInUniqueness)
This method notifies all listeners that all cell values in the table's rows may have changed, as may have the number of rows.
usePointingModeInUniqueness
- if true, the uniqueness measure
will include whether the observation is nadir or off-nadir pointed;
if false, it will not.PTF_Record_Table_Model.Uniqueness
,
AbstractTableModel.fireTableDataChanged()
public boolean isDuplicateRow(int row)
This method identifies a row in this model as being a duplicate of another
row in this model via the uniqueness
values of the rows.
It is distinct from the isDuplicate()
property of the individual extended
attribute PTF records
that comprise those rows, which is simply a hint.
Although the two properties are related, as a row is hidden
and shown
, its isDuplicate()
property is toggled
false (when hidden) and true (when shown)—as is the
isDuplicate()
property of its
counterparts.
row
- the model row index of the record in question.public void hideRow(int row)
If the record is identified in this model as a duplicate row
and its isDuplicate()
extended property is true, it is set to false. If there is
only one other non-hidden member of this record's duplicate set (with the
same uniqueness
) whose isDuplicate()
property is also
true, it too is set to false. This check ensures that
tables that mark records as duplicates correctly stop marking such records
when only one record of a set is still visible.
It is up to a table with this model to handle the actual hiding of a record and the decorating of any duplicate records.
This method notifies all listeners that all cell values in the table's rows may have changed, as may have the number of rows.
row
- the model row index of the record to be marked as hidden.PTF_Record_Table_Model.ExtendedPtfRecord.isHidden()
,
AbstractTableModel.fireTableDataChanged()
public void showRow(int row)
If the record is identified in this model as a duplicate row
and its isDuplicate()
extended property is false, it is set to true.
Furthermore, any other non-hidden member of this record's duplicate set
(with the same uniqueness
) whose isDuplicate()
property is false is
set to true.
It is up to a table with this model to handle the actual unhiding of a record and the decorating of any duplicate records.
This method notifies all listeners that all cell values in the table's rows may have changed, as may have the number of rows.
row
- the model row index of the record to be marked as unhidden.PTF_Record_Table_Model.ExtendedPtfRecord.isHidden()
,
AbstractTableModel.fireTableDataChanged()
public boolean isHiddenRow(int row)
row
- the model row index of the record in question.PTF_Record_Table_Model.ExtendedPtfRecord.isHidden()
public boolean isHiriseRow(int row)
instrument set field
starts with a capital
"H."row
- the model row index of the record in question.public boolean hasNonHiriseRecords()
instrument set field
does not start with a capital "H."public static java.lang.String getColHeader(java.util.List<PTF_Record_Table_Model.Column> columns, PTF_Record_Table_Model.TransferFormat format)
public java.lang.String getReport(PTF_Record_Table_Model.ExtendedPtfRecord ptfRecord, java.util.List<PTF_Record_Table_Model.Column> columns, PTF_Record_Table_Model.TransferFormat format)
Copyright \ (C) Arizona Board of Regents on behalf of the \ Planetary Image Research Laboratory, Lunar and \ Planetary Laboratory at the University of Arizona