|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.swing.table.AbstractTableModel
com.bbn.openmap.dataAccess.shape.DbfTableModel
An implemention of TableModel that manages tabular data read from a dbf file and enables the user to stored data store herein to be saved to a file conforming to the DBF III file format specification. To create a three one column model:
DbfTableModel model = new DbfTableModel(1); model.setDecimalCount(0, (byte) 0); model.setLength(0, (byte) 10); model.setColumnName(0, "Column1"); model.setType(0, (byte) DbfTableModel.TYPE_CHARACTER); model.setDecimalCount(1, (byte) 0); model.setLength(1, (byte) 10); model.setColumnName(1, "Column1"); model.setType(1, (byte) DbfTableModel.TYPE_NUMERIC); model.setDecimalCount(2, (byte) 0); model.setLength(2, (byte) 10); model.setColumnName(2, "Column1"); model.setType(2, (byte) DbfTableModel.TYPE_CHARACTER); esriLayer.setModel(model);
Field Summary | |
protected int |
_columnCount
Class scope variable for the number of columns that exist in the model |
protected byte[] |
_decimalCounts
An array of bytes that contain the number of decimal places for each column |
protected int[] |
_lengths
An array of bytes that contain the character lengths for each column |
protected java.lang.String[] |
_names
An array of bytes that contain the names for each column |
protected java.util.ArrayList |
_records
Class scope reference to a list of data formatted by row |
protected byte[] |
_types
An array of bytes that contain the column types for each column |
protected boolean |
DEBUG
|
protected boolean |
dirty
|
static int |
DONE_MASK
Button mask to drop the frame quietly, with the modifications to the table complete. |
protected boolean |
exitOnClose
|
protected java.lang.StringBuffer |
filePath
|
protected javax.swing.JFrame |
frame
|
static int |
MODIFY_COLUMN_MASK
Edit button mask, to allow adding/removing columns in the attribute table. |
static int |
MODIFY_ROW_MASK
Edit button mask, to allow adding/removing rows. |
protected DbfTableModel |
parent
|
static int |
SAVE_MASK
Button mask to show a save button to write out any changes. |
protected javax.swing.JTable |
table
|
static int |
TYPE_CHARACTER
|
static int |
TYPE_DATE
|
static int |
TYPE_LOGICAL
|
static int |
TYPE_MEMO
|
static int |
TYPE_NUMERIC
|
protected boolean |
writable
|
Fields inherited from class javax.swing.table.AbstractTableModel |
listenerList |
Constructor Summary | |
protected |
DbfTableModel()
|
|
DbfTableModel(DbfInputStream is)
Creates a DbfTableModel based on an InputStream |
|
DbfTableModel(int columnCount)
Creates a blank DbfTableModel |
Method Summary | |
protected byte[] |
add(byte[] current,
byte nb)
|
protected int[] |
add(int[] current,
byte nb)
|
protected java.lang.String[] |
add(java.lang.String[] current,
java.lang.String string)
|
void |
addBlankRecord()
|
protected void |
addColumn(java.util.ArrayList recordColumn)
The types in the ArrayList are set - String, Byte, Integer, Integer - to match the format of the header. |
void |
addRecord(java.util.ArrayList columns)
Adds a row of data to the the model |
void |
cleanupChanges()
|
protected void |
commitEvents(DbfTableModel model)
|
protected void |
deleteColumn(int columnIndex)
Delete a column, iterating through all the records and deleting that part of each record. |
void |
exitWindowClosed()
|
java.lang.Class |
getColumnClass(int c)
Retrieves the column class for the passed in column index |
int |
getColumnCount()
Retrieves the number of columns that exist in the model |
int |
getColumnIndexForName(java.lang.String columnName)
Find the column index of the column with the given name. |
java.lang.String |
getColumnName(int column)
Retrieves the column name for the passed in column index |
static DbfTableModel |
getDbfTableModel(java.net.URL dbf)
Creates a DbfTableModel for a given .dbf file |
byte |
getDecimalCount(int column)
Retrieves the number of decimal places for the passed in column index |
java.lang.Object |
getEmptyDefaultForType(byte type)
|
java.awt.Component |
getGUI(java.lang.String filename,
int actionMask)
|
int |
getLength(int column)
Retrieves the character length for the passed in column index |
java.lang.Object |
getRecord(int recordnumber)
Retrieves the record array list for the passed record number |
java.util.Iterator |
getRecords()
Get an iterator over the records. |
int |
getRowCount()
Retrieves the number of columns that exist in the model |
protected javax.swing.JTable |
getTable()
|
javax.swing.JTable |
getTable(javax.swing.ListSelectionModel lsm)
Needs to be called before displaying the DbfTableModel. |
byte |
getType(int column)
Retrieves the column type for the passed in column index |
java.lang.Object |
getValueAt(int row,
int column)
Retrieves a value for a specific column and row index |
boolean |
getWritable()
|
DbfTableModel |
headerClone()
Create another DbfTableModel with the same structure as this one (number of columns, column names, lengths and decimal counts). |
void |
hideGUI()
|
boolean |
isCellEditable(int rowIndex,
int columnIndex)
|
static void |
main(java.lang.String[] args)
|
protected byte[] |
remove(byte[] current,
int index)
|
java.util.ArrayList |
remove(int index)
Remove the record at the index. |
protected int[] |
remove(int[] current,
int index)
|
protected java.lang.String[] |
remove(java.lang.String[] current,
int index)
|
void |
setColumnName(int column,
java.lang.String name)
Sets the column name for the passed-in field index |
void |
setDecimalCount(int column,
byte decimalCount)
Sets the decimal count for the passed in field index |
void |
setLength(int column,
int length)
Set the character length fro the passed-in field index |
void |
setType(int column,
byte type)
Sets the column type for the passed-in field index |
void |
setValueAt(java.lang.Object object,
int row,
int column)
|
void |
setWritable(boolean set)
|
void |
showGUI(java.lang.String filename,
int actionMask)
|
void |
tableChanged(javax.swing.event.TableModelEvent e)
|
Methods inherited from class javax.swing.table.AbstractTableModel |
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int TYPE_CHARACTER
public static final int TYPE_DATE
public static final int TYPE_NUMERIC
public static final int TYPE_LOGICAL
public static final int TYPE_MEMO
public static final int MODIFY_ROW_MASK
public static final int MODIFY_COLUMN_MASK
public static final int DONE_MASK
public static final int SAVE_MASK
protected int[] _lengths
protected byte[] _decimalCounts
protected byte[] _types
protected java.lang.String[] _names
protected java.util.ArrayList _records
protected int _columnCount
protected boolean writable
protected javax.swing.JTable table
protected final DbfTableModel parent
protected boolean dirty
protected boolean exitOnClose
protected boolean DEBUG
protected final java.lang.StringBuffer filePath
protected javax.swing.JFrame frame
Constructor Detail |
protected DbfTableModel()
public DbfTableModel(int columnCount)
columnCount
- The number of columns this model will managepublic DbfTableModel(DbfInputStream is)
is
- The dbf fileMethod Detail |
public void addRecord(java.util.ArrayList columns)
columns
- A collection of columns that comprise the row of data
An
- exception is thrown if the number of elements in the passed
in collection does not match the number of columns in the
modelpublic java.util.ArrayList remove(int index)
public void addBlankRecord()
public java.lang.Object getEmptyDefaultForType(byte type)
public java.lang.Object getRecord(int recordnumber)
recordnumber
- The record number
public java.util.Iterator getRecords()
public java.lang.Class getColumnClass(int c)
getColumnClass
in interface javax.swing.table.TableModel
c
- The column index
public int getColumnCount()
getColumnCount
in interface javax.swing.table.TableModel
public byte getDecimalCount(int column)
column
- The column index
public java.lang.String getColumnName(int column)
getColumnName
in interface javax.swing.table.TableModel
column
- The column index
public int getColumnIndexForName(java.lang.String columnName)
columnName
-
public int getLength(int column)
column
- The column index
public int getRowCount()
getRowCount
in interface javax.swing.table.TableModel
public byte getType(int column)
column
- The column index
public java.lang.Object getValueAt(int row, int column)
getValueAt
in interface javax.swing.table.TableModel
public void setColumnName(int column, java.lang.String name)
column
- The column indexname
- The name to assign for the passed-in column indexpublic void setDecimalCount(int column, byte decimalCount)
column
- The index to the columndecimalCount
- The number of decimals places to assign to the passed
in columnpublic void setLength(int column, int length)
column
- The column indexlength
- The character length to assign for the passed-in column
indexpublic void setType(int column, byte type)
column
- The column indextype
- The type of column to assign for the passed-in column indexpublic void setValueAt(java.lang.Object object, int row, int column)
setValueAt
in interface javax.swing.table.TableModel
public boolean isCellEditable(int rowIndex, int columnIndex)
isCellEditable
in interface javax.swing.table.TableModel
public void setWritable(boolean set)
public boolean getWritable()
public javax.swing.JTable getTable(javax.swing.ListSelectionModel lsm)
protected javax.swing.JTable getTable()
public java.awt.Component getGUI(java.lang.String filename, int actionMask)
public void hideGUI()
public void showGUI(java.lang.String filename, int actionMask)
public void exitWindowClosed()
public void tableChanged(javax.swing.event.TableModelEvent e)
tableChanged
in interface javax.swing.event.TableModelListener
protected void commitEvents(DbfTableModel model)
protected void deleteColumn(int columnIndex)
protected int[] remove(int[] current, int index)
protected byte[] remove(byte[] current, int index)
protected java.lang.String[] remove(java.lang.String[] current, int index)
protected void addColumn(java.util.ArrayList recordColumn)
protected int[] add(int[] current, byte nb)
protected byte[] add(byte[] current, byte nb)
protected java.lang.String[] add(java.lang.String[] current, java.lang.String string)
public void cleanupChanges()
public DbfTableModel headerClone()
public static DbfTableModel getDbfTableModel(java.net.URL dbf)
dbf
- The url of the file to retrieve.
public static void main(java.lang.String[] args)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |