Class PeriodFlattenedStore

All Implemented Interfaces:
PopupActivationListener, Serializable, Comparable, EventListener, ListSelectionListener, TableModel

public class PeriodFlattenedStore extends AttributeStore
This class provides an adapter to convert multi-period data stores in to a flat single period store having an initial column named "Period". If the input table is not multi-period then this wrapper does not add the "Period" column.
See Also:
Serialized Form
  • Constructor Details

    • PeriodFlattenedStore

      public PeriodFlattenedStore(AttributeStore base)
      Create the wrapper around the base table
      Parameters:
      base - the parent table to be flattened
  • Method Details

    • getColumnCount

      public int getColumnCount()
      Description copied from class: AttributeStore
      Get the number of columns in this store
      Specified by:
      getColumnCount in interface TableModel
      Overrides:
      getColumnCount in class AttributeStore
      Returns:
      the number of columns in this store
    • getRowCount

      public int getRowCount()
      Description copied from class: AttributeStore
      Get the number of rows in this store
      Specified by:
      getRowCount in interface TableModel
      Specified by:
      getRowCount in class AttributeStore
      Returns:
      the number of rows in this store
    • getPeriodCount

      public int getPeriodCount()
      Description copied from class: AttributeStore
      Get the total number of periods that this store supports
      Specified by:
      getPeriodCount in class AttributeStore
      Returns:
      The number of periods in this store
    • getYearForPeriod

      public int getYearForPeriod(int period)
      Description copied from class: AttributeStore
      Get the ending year for a given period.
      Specified by:
      getYearForPeriod in class AttributeStore
      Parameters:
      period - The period of interest
      Returns:
      the year for a given period
    • getColumnName

      public String getColumnName(int fieldIndex)
      Description copied from class: AttributeStore
      Return the name of a column at a given position.
      Specified by:
      getColumnName in interface TableModel
      Overrides:
      getColumnName in class AttributeStore
      Parameters:
      fieldIndex - the column number of interest
      Returns:
      the name of the column
    • findColumn

      public int findColumn(String field)
      Description copied from class: AttributeStore
      Get the column number of the given field in the table. The first matching column is returned. If the column is not found then return -1.
      Overrides:
      findColumn in class AttributeStore
      Parameters:
      field - The name of the field to look up
    • getColumnClass

      public Class getColumnClass(int fieldIndex)
      Description copied from class: AttributeStore
      Get the class of the column if interest. This returns types that the JTable will use for renderers and editors.
      Specified by:
      getColumnClass in interface TableModel
      Overrides:
      getColumnClass in class AttributeStore
      Parameters:
      fieldIndex - the column of interest
      Returns:
      the Class of the data held in this column
    • getAttributeFormat

      public AttributeFormat getAttributeFormat(int field)
      Description copied from class: AttributeStore
      Get the format descriptor for a given column.
      Overrides:
      getAttributeFormat in class AttributeStore
      Parameters:
      field - The column of interest
      Returns:
      The AttributeFormat for this field
    • getValueAt

      public Object getValueAt(int rowIndex, int fieldIndex, int period)
      Description copied from class: AttributeStore
      Get a cell value
      Specified by:
      getValueAt in class AttributeStore
      Parameters:
      rowIndex - The row containing the cell
      fieldIndex - The column containing the cell
      period - The period of interest
      Returns:
      An object containing the cell value.
    • getValueAt

      public Object getValueAt(int rowIndex, int fieldIndex)
      Description copied from class: AttributeStore
      Get a cell value using the default period for the table.
      Specified by:
      getValueAt in interface TableModel
      Overrides:
      getValueAt in class AttributeStore
      Parameters:
      rowIndex - The row containing the cell
      fieldIndex - The column containing the cell
      Returns:
      An object containing the cell value.
    • setValueAt

      public void setValueAt(Object value, int rowIndex, int fieldIndex)
      Description copied from class: AttributeStore
      Set the value in a cell using the default period for the table.

      Implementing classes that override must call this method to ensure that joins are properly maintained.

      Specified by:
      setValueAt in interface TableModel
      Overrides:
      setValueAt in class AttributeStore
      Parameters:
      value - The value to be set.
      rowIndex - The row containing the cell
      fieldIndex - The column containing the cell
    • getCacheParent

      public AttributeStore getCacheParent()
      Description copied from class: AttributeStore
      Return the parent data source from within a caching layer. In case the data source is not being cached then this will simply return itself.
      Overrides:
      getCacheParent in class AttributeStore
    • close

      public void close()
      Description copied from class: AttributeStore
      Close the table and release resources. The table should be used again after this method has been called.

      In many cases you do not need to call this method when you are finished using a table. Most tables will close automatically when they are no longer referenced.

      It is possible that this method will be deprecated or removed in a future release.

      Overrides:
      close in class AttributeStore
    • getCanonicalName

      public String getCanonicalName()
      Description copied from class: AttributeStore
      Return a string that uniquely identifies this table and provides information can be used to reconstruct the table. This handle can be passed to the AttributeStore.openOrReuse(java.lang.String) method to get an existing or new instance of the table.
      Overrides:
      getCanonicalName in class AttributeStore
      Returns:
      The canonical name of this store.
    • getSynchronizer

      public Suspendable getSynchronizer()
      Description copied from class: AttributeStore
      Get the synchronizer object for this table. This object can be used to suspend the scheduling task as a set of calculations are carried out. Most tables will not have a synchronizer object. The only tables that will are tables that provide simulation results.
      Overrides:
      getSynchronizer in class AttributeStore
    • allowsEditing

      public boolean allowsEditing()
      Description copied from class: AttributeStore
      Query if this layer supports extended editing of features. Extended editing usually means that values can be written out to disk.
      Overrides:
      allowsEditing in class AttributeStore
      Returns:
      true if the store allows editing
    • setEditMode

      public void setEditMode(boolean mode) throws IOException
      Description copied from class: AttributeStore
      Enable or disable the extended editing mode.
      Overrides:
      setEditMode in class AttributeStore
      Parameters:
      mode - the editing mode to use
      Throws:
      IOException - if an error occurs while trying to change the edit mode.
    • getEditMode

      public boolean getEditMode()
      Description copied from class: AttributeStore
      Get the status of the extended editing mode.
      Overrides:
      getEditMode in class AttributeStore
      Returns:
      the editing mode in use
    • getSnapshot

      public AttributeStore getSnapshot(boolean useSelected, Observer progress)
      Get a snapshot of this table definition. This will request a snapshot of the input data store, in case any of those are crosstabs. The results will be contained in the snapshot and will not change even if the underlying data set changes.
      Overrides:
      getSnapshot in class AttributeStore
      Parameters:
      useSelected - The calculations will only be computed on the selected records.
      progress - A reference to a progress widget that will be updated with the progress of the calculations.
      Returns:
      This method will return a new shapshot that captures the state of the table definition for the input current data sets.