Class DBaseAttributeStore

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

public class DBaseAttributeStore extends AttributeStore
This class implements a DBase and FoxPro data file reader. This reader supports data types F, N, C, I, L and D. Indexes are not supported. Deleted records are not supported (they will be read as though they are null records).
See Also:
Serialized Form
  • Constructor Details

    • DBaseAttributeStore

      public DBaseAttributeStore(String filename) throws IOException
      Create a new DBase file reader in readonly mode.
      Parameters:
      filename - The name of the DBase file to read. Do not include the '.dbf' extension, this class will automatically add that on.
      Throws:
      IOException
    • DBaseAttributeStore

      public DBaseAttributeStore(String filename, boolean readonly) throws IOException
      Create a new DBase file reader.
      Parameters:
      filename - The name of the DBase file to read. Do not include the '.dbf' extension, this class will automatically add that on.
      readonly - If true then the file is opened readonly. If false then the file is opened for reading and writing.
      Throws:
      IOException
    • DBaseAttributeStore

      public DBaseAttributeStore(String filename, boolean readonly, String charset) throws IOException
      Create a new DBase file reader.
      Parameters:
      filename - The name of the DBase file to read. Do not include the '.dbf' extension, this class will automatically add that on.
      charset - The name of the character encoding set (code page) to use to interpret the character data in this file. If null will try to read the CPG file or use the default charset.
      readonly - If true then the file is opened readonly. If false then the file is opened for reading and writing.
      Throws:
      IOException
  • Method Details

    • getFilename

      public String getFilename()
    • getReadonly

      public boolean getReadonly()
    • getCharset

      public String getCharset()
    • 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
    • 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
    • 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
    • getValueAt

      public Object getValueAt(int row, int column, int period)
      Retrieve an object from the DBase file.
      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.
    • 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