HiRISE

HiRISE.HiPlan.Data_Slacker
Class SsrStateTableModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by HiRISE.HiPlan.Data_Slacker.SsrStateTableModel
All Implemented Interfaces:
Serializable, TableModel

public class SsrStateTableModel
extends AbstractTableModel

A table model for SSR state records. The model includes an enumeration of its columns.

Values for raw and framed partition allocations are used for reporting the percent raw and percent framed values in the table.

Version:
1.2
Author:
Christian Schaller - UA/PIRL
See Also:
Serialized Form

Nested Class Summary
static class SsrStateTableModel.Column
          An enumeration of the table model's columns.
 
Field Summary
static String ID
          Class identification name with source code version and date.
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
SsrStateTableModel()
          Creates a new SSR state table model with an empty list of SSR states and default values for the raw and framed partition allocations.
SsrStateTableModel(List<SsrState> records, double rawPartitionMegabits, double framedPartitionMegabits)
          Creates a new SSR state table model from a list of SSR states and raw and framed partition allocations.
 
Method Summary
 Class getColumnClass(int col)
          Gets the class of the indicated column.
 int getColumnCount()
          Gets the total number of columns in this table model.
 String getColumnName(int col)
          Gets the name of the indicated column.
 double getFramedPartitionMegabits()
          Gets the current value of this table model's framed partition allocation in base-2 megabits.
 double getRawPartitionMegabits()
          Gets the current value of this table model's raw partition allocation in base-2 megabits.
 SsrState getRecord(int row)
          Gets the data record for the indicated model row.
 List<SsrState> getRecords()
          Gets a copy of this table model's SSR state records.
 int getRowCount()
          Gets the total number of rows in this table model.
 Object getValueAt(int row, int col)
          Gets the value for the cell at the indicated row and column.
 void setFramedPartitionMegabits(double framedPartitionMegabits)
          Sets the value of this table model's framed partition allocation in base-2 megabits.
 void setRawPartitionMegabits(double rawPartitionMegabits)
          Sets the value of this table model's raw partition allocation in base-2 megabits.
 void setRecords(List<SsrState> records)
          Replaces this table model's current list of records with a new list.
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID

public static final String ID
Class identification name with source code version and date.

See Also:
Constant Field Values
Constructor Detail

SsrStateTableModel

public SsrStateTableModel(List<SsrState> records,
                          double rawPartitionMegabits,
                          double framedPartitionMegabits)
Creates a new SSR state table model from a list of SSR states and raw and framed partition allocations. The allocation values, in megabits, are used for reporting the percent full columns (percent raw and percent framed).

The list of records may be null, in which case the model is empty.

Parameters:
records - the list of SSR state records for the new table model; may be null.
rawPartitionMegabits - the number of base-2 megabits allocated to the raw partition for this model's SSR states.
framedPartitionMegabits - the number of base-2 megabits allocated to the framed partition for this model's SSR states.

SsrStateTableModel

public SsrStateTableModel()
Creates a new SSR state table model with an empty list of SSR states and default values for the raw and framed partition allocations.

See Also:
Data_Slacker.DEFAULT_RAW_PARTITION_MEGABITS, Data_Slacker.DEFAULT_FRAMED_PARTITION_MEGABITS
Method Detail

setRecords

public void setRecords(List<SsrState> records)
Replaces this table model's current list of records with a new list. The new list may be null or empty; the current list will then simply be removed.

This method invokes the model's fireTableDataChanged() method.

Parameters:
records - the new list of SSR states; may be null.

getRecords

public List<SsrState> getRecords()
Gets a copy of this table model's SSR state records. The list may be empty, but it will not be null.

Returns:
a copy of the table model's SSR states.

getRawPartitionMegabits

public double getRawPartitionMegabits()
Gets the current value of this table model's raw partition allocation in base-2 megabits.

Returns:
the raw partition allocation in base-2 megabits.

setRawPartitionMegabits

public void setRawPartitionMegabits(double rawPartitionMegabits)
Sets the value of this table model's raw partition allocation in base-2 megabits.

This method invokes the model's fireTableDataChanged() method.

Parameters:
rawPartitionMegabits - the new value for the raw partition allocation.

getFramedPartitionMegabits

public double getFramedPartitionMegabits()
Gets the current value of this table model's framed partition allocation in base-2 megabits.

Returns:
the framed partition allocation in base-2 megabits.

setFramedPartitionMegabits

public void setFramedPartitionMegabits(double framedPartitionMegabits)
Sets the value of this table model's framed partition allocation in base-2 megabits.

This method invokes the model's fireTableDataChanged() method.

Parameters:
framedPartitionMegabits - the new value for the framed partition allocation.

getRowCount

public int getRowCount()
Gets the total number of rows in this table model.

Returns:
the total number of rows in this table model.

getColumnCount

public int getColumnCount()
Gets the total number of columns in this table model. This value is equal to the number of members of the SsrStateTableModel.Column enumeration.

Returns:
the total number of columns in this table model.

getValueAt

public Object getValueAt(int row,
                         int col)
Gets the value for the cell at the indicated row and column. The class of the object returned may be obtained from the getColumnClass(int) method.

Parameters:
row - the table model row index.
col - the table model column index.
Returns:
the value object at the specified cell.

getColumnClass

public Class getColumnClass(int col)
Gets the class of the indicated column.

Specified by:
getColumnClass in interface TableModel
Overrides:
getColumnClass in class AbstractTableModel
Parameters:
col - the table model column index.
Returns:
the class of the column.

getColumnName

public String getColumnName(int col)
Gets the name of the indicated column.

Specified by:
getColumnName in interface TableModel
Overrides:
getColumnName in class AbstractTableModel
Parameters:
col - the table model column index.
Returns:
the name of the column.

getRecord

public SsrState getRecord(int row)
Gets the data record for the indicated model row.

Parameters:
row - the model row.
Returns:
the data record.

HiRISE

Copyright (C) Arizona Board of Regents on behalf of the Planetary Image Research Laboratory, Lunar and Planetary Laboratory at the University of Arizona