Class CubeStore

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

public class CubeStore extends AttributeStore implements TableModelListener
This class wraps an existing AttributeStore object. This provides a mechanism to change the default period of interest in the wrapper object iwthout changing the default period in the original table.

Principal uses of this class are to wrap an AttributeStore object before displaying it in a TableViewer. The TableViewer object may independently scroll through time periods without altering the time period view of other users of the data source.

The implementation of this class is very lightweight, with almost all functions being delegated to the original object.

See Also:
Serialized Form
  • Constructor Details

    • CubeStore

      public CubeStore(AttributeStore store)
      Wrap an attribute store so that changes to the default period do not effect the underlying table.
      Parameters:
      store - The AttributeStore that should be wrapped.
  • Method Details

    • 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.
    • 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
    • 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
    • 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
    • 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
    • setValueAt

      public void setValueAt(Object aValue, int row, int column, int period)
      Description copied from class: AttributeStore
      Set the value in a cell and notify listeners that the value has changed.

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

      Overrides:
      setValueAt in class AttributeStore
      Parameters:
      aValue - The value to be set.
      row - The row containing the cell
      column - The column containing the cell
      period - The period of interest
    • getValueAt

      public Object getValueAt(int row, int column, int period)
      Description copied from class: AttributeStore
      Get a cell value
      Specified by:
      getValueAt in class AttributeStore
      Parameters:
      row - The row containing the cell
      column - The column containing the cell
      period - The period of interest
      Returns:
      An object containing the cell value.
    • 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
    • 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
    • buildIndex

      public void buildIndex(int column)
      Description copied from class: AttributeStore
      Build an index on the column. The index can then be used for speedy lookups. See AttributeStore.lookupRow(java.lang.Object, int).
      Overrides:
      buildIndex in class AttributeStore
      Parameters:
      column - the column of interest
    • getShortName

      public String getShortName()
      Description copied from class: AttributeStore
      Get the short name for this table. This value can be used in column lookups to differentiate similarly named columns from different joined tables.
      Overrides:
      getShortName in class AttributeStore
    • getFullColumnName

      public FullColumnName getFullColumnName(int column)
      Description copied from class: AttributeStore
      Return the full name of a column at a given position, including the short name of the table.
      Overrides:
      getFullColumnName in class AttributeStore
      Parameters:
      column - the column number of interest
      Returns:
      the name of the column
    • setShortName

      public AttributeStore setShortName(String name)
      Description copied from class: AttributeStore
      Set the short name for this table. This value can be used in column lookups to differentiate similarly named columns from different joined tables.
      Overrides:
      setShortName in class AttributeStore
    • findColumn

      public int findColumn(String field, String shortName)
      Description copied from class: AttributeStore
      Get the column number of the given field in the given table. If the column is not found then return -1.
      Overrides:
      findColumn in class AttributeStore
      Parameters:
      field - The name of the field to look up
      shortName - The short name of the table to look up the the column in. If this attribute store has related tables, the column from the related table with the matching short name will be returned. If there is no table with a matching short name an exception will be thrown.
    • addCellEditors

      public void addCellEditors(JTable t, int offset)
      Description copied from class: AttributeStore
      This method will be called by components that want to set up custom cell editors on JTables. If your table has custom editing behaviour then you can hook it in using this method.
      Overrides:
      addCellEditors in class AttributeStore
      Parameters:
      t - A JTable
      offset - the column number in the store that will have a custom cell editor
    • tableChanged

      public void tableChanged(TableModelEvent e)
      Specified by:
      tableChanged in interface TableModelListener