Class DataTableModel

java.lang.Object
javax.swing.table.AbstractTableModel
mgui.interfaces.tables.InterfaceTableModel
mgui.interfaces.datasources.DataTableModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel, AttributeObject, InterfaceObject, NamedObject, TreeObject, CleanableObject

public class DataTableModel
extends InterfaceTableModel
Class extending AbstractTableModel to act as a model for JTable, and in particular for use by InterfaceDataTable. Thus acts as a bridge between a DataRecordSet and an InterfaceDataTable object. TODO: Allow table sort only if cached; otherwise use DB sort TODO: Sort table (not query) columns alpha-numerically
Since:
1.0
Version:
1.0
Author:
Andrew Reid
See Also:
Serialized Form
  • Field Details

    • ds_item

      protected DataSourceItem ds_item
    • recordSet

      protected DataRecordSet recordSet
    • isFiltered

      public boolean isFiltered
    • filter

      public java.util.ArrayList<java.lang.Integer> filter
    • is_cached

      protected boolean is_cached
    • cache

      protected volatile java.util.ArrayList<java.util.ArrayList<java.lang.Object>> cache
    • is_thread_caching

      protected volatile boolean is_thread_caching
    • is_new_record

      protected boolean is_new_record
  • Constructor Details

  • Method Details

    • getRecordSet

      public DataRecordSet getRecordSet()
    • getSource

      public java.lang.Object getSource()
      Description copied from class: InterfaceTableModel
      Returns the source of data for this table.
      Specified by:
      getSource in class InterfaceTableModel
      Returns:
    • setDataSourceItem

      public void setDataSourceItem​(DataSourceItem item) throws DataSourceException
      Throws:
      DataSourceException
    • setProgressUpdater

      public void setProgressUpdater​(ProgressUpdater updater)
    • applyFilter

      public boolean applyFilter​(java.util.ArrayList<? extends java.lang.Comparable> list, java.lang.String filter_field) throws DataSourceException
      Throws:
      DataSourceException
    • addNewRecord

      public boolean addNewRecord()
      Adds a new record to the model and allows the user to enter input into it. The record is not actually appended to the data source until updateRecordSet is called.
    • updateRecordSet

      public boolean updateRecordSet()
      Instructs the record set to update its values
      Returns:
    • cancelUpdate

      public boolean cancelUpdate()
      Cancels the current update
      Returns:
    • removeFilter

      public void removeFilter()
    • setIsCached

      public void setIsCached​(boolean b)
    • getIsCached

      public boolean getIsCached()
    • resetCache

      protected void resetCache()
    • getColumnCount

      public int getColumnCount()
    • getRowCount

      public int getRowCount()
    • fillCache

      protected void fillCache​(int row) throws DataSourceException
      Throws:
      DataSourceException
    • fillCacheBlocking

      protected void fillCacheBlocking​(int row, int start) throws DataSourceException
      Throws:
      DataSourceException
    • getCached

      protected java.lang.Object getCached​(int row, int col) throws java.sql.SQLException, DataSourceException
      Throws:
      java.sql.SQLException
      DataSourceException
    • prefillCache

      public void prefillCache() throws DataSourceException
      Throws:
      DataSourceException
    • getValueAt

      public java.lang.Object getValueAt​(int row, int col)
    • getValueFromRecordSetAt

      protected java.lang.Object getValueFromRecordSetAt​(int row, int col)
    • setValueAt

      public void setValueAt​(java.lang.Object value, int row, int column)
      Specified by:
      setValueAt in interface javax.swing.table.TableModel
      Overrides:
      setValueAt in class javax.swing.table.AbstractTableModel
    • setCacheValue

      protected void setCacheValue​(java.lang.Object value, int row, int column)
    • getColumnName

      public java.lang.String getColumnName​(int c)
      Specified by:
      getColumnName in interface javax.swing.table.TableModel
      Overrides:
      getColumnName in class javax.swing.table.AbstractTableModel
    • getColumnClass

      public java.lang.Class getColumnClass​(int col)
      Specified by:
      getColumnClass in interface javax.swing.table.TableModel
      Overrides:
      getColumnClass in class javax.swing.table.AbstractTableModel
    • isCellEditable

      public boolean isCellEditable​(int row, int col)
      Specified by:
      isCellEditable in interface javax.swing.table.TableModel
      Overrides:
      isCellEditable in class javax.swing.table.AbstractTableModel
    • deleteRows

      public boolean deleteRows​(int[] rows)
      Attempts to delete the specified rows from the underlying data source item
      Parameters:
      rows -
      Returns: