Package ca.spatial.table
Class DBaseAttributeStore
java.lang.Object
javax.swing.table.AbstractTableModel
ca.spatial.table.AttributeStore
ca.spatial.table.DBaseAttributeStore
- All Implemented Interfaces:
PopupActivationListener
,Serializable
,Comparable
,EventListener
,ListSelectionListener
,TableModel
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
-
Field Summary
Fields inherited from class ca.spatial.table.AttributeStore
SELECT_ADD, SELECT_FROM, SELECT_NEW
-
Constructor Summary
ConstructorsConstructorDescriptionDBaseAttributeStore(String filename)
Create a new DBase file reader in readonly mode.DBaseAttributeStore(String filename, boolean readonly)
Create a new DBase file reader.DBaseAttributeStore(String filename, boolean readonly, String charset)
Create a new DBase file reader. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Query if this layer supports extended editing of features.void
close()
Close the table and release resources.int
Get the number of columns in this storeboolean
Get the status of the extended editing mode.int
Get the total number of periods that this store supportsboolean
int
Get the number of rows in this storegetValueAt(int row, int column, int period)
Retrieve an object from the DBase file.int
getYearForPeriod(int period)
Get the ending year for a given period.void
setEditMode(boolean mode)
Enable or disable the extended editing mode.void
setValueAt(Object aValue, int row, int column, int period)
Set the value in a cell and notify listeners that the value has changed.Methods inherited from class ca.spatial.table.AttributeStore
absoluteFile, absoluteFile, absolutePath, absolutePath, addCellEditors, addMenuItems, addPopupActivationListener, addRelate, addRelate, addTableModelListener, addToGlobalStoreList, booleanValue, booleanValue, buildIndex, calculate, calculateField, calculateField, canIndex, changeSelection, clearSelection, compareTo, decodeCharset, doubleValue, doubleValue, exportCSV, exportCSV, exportCSV, exportCSV, exportCSV, exportCSV, exportDBF, exportDBF, exportDBF, exportDBF, exportDBF, findColumn, findColumn, findSimilarColumnNames, getAttributeFormat, getCacheParent, getCachingLayer, getCachingLayer, getCanonicalName, getColumnClass, getColumnName, getColumnNames, getContextPeriods, getCwd, getFullColumnName, getListSelectionModel, getMinMax, getMinMax, getMinMax, getMinMax, getMinMax, getOpenStore, getOpenStore, getOpenStore, getOpenStores, getPeriod, getPeriodWidth, getRowNodeRemap, getSelectedRowCount, getSelection, getSelection, getSelection, getShortName, getSnapshot, getSnapshot, getStoreByShortName, getStoreByTitle, getSynchronizer, getTableName, getTableSpec, getTitle, getValueAt, hasIndex, identifyRecords, integerValue, integerValue, isCellEditable, isSelectedIndex, isSelectionEmpty, listify, listValue, listValue, lookupRow, makeLu, maybePopup, notifyPopupActivationListeners, openOrReuse, openOrReuse, queryTable, queryTable, quoteIfRequired, relativePath, removeFromGlobalStoreList, removePopupActivationListener, removeTableModelListener, select, select, selectAdd, selectFrom, selectNew, setCwd, setCwd, setListSelectionModel, setPeriod, setRowNodeRemap, setShortName, setTableSpec, setTitle, setValueAt, showCube, showTable, toString, uniqueValues, uniqueValues, uniqueValues, uniqueValues, uniqueValues, uniqueValues, uniqueValues, uniqueValues, valueChanged
Methods inherited from class javax.swing.table.AbstractTableModel
fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners
-
Constructor Details
-
DBaseAttributeStore
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
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
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
-
getReadonly
public boolean getReadonly() -
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 classAttributeStore
-
getColumnCount
public int getColumnCount()Description copied from class:AttributeStore
Get the number of columns in this store- Specified by:
getColumnCount
in interfaceTableModel
- Overrides:
getColumnCount
in classAttributeStore
- 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 interfaceTableModel
- Specified by:
getRowCount
in classAttributeStore
- 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 classAttributeStore
- 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 classAttributeStore
- 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 classAttributeStore
- Returns:
- true if the store allows editing
-
setEditMode
Description copied from class:AttributeStore
Enable or disable the extended editing mode.- Overrides:
setEditMode
in classAttributeStore
- 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 classAttributeStore
- Returns:
- the editing mode in use
-
getValueAt
Retrieve an object from the DBase file.- Specified by:
getValueAt
in classAttributeStore
- Parameters:
row
- The row containing the cellcolumn
- The column containing the cellperiod
- The period of interest- Returns:
- An object containing the cell value.
-
setValueAt
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 classAttributeStore
- Parameters:
aValue
- The value to be set.row
- The row containing the cellcolumn
- The column containing the cellperiod
- The period of interest
-