|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectjavax.swing.table.AbstractTableModel
com.ricebridge.xmlman.in.XmlTableModel
Implementation of a TableModel to hold XML record data.
This TableModel can be used directly with a JTable.
Data is represented by String objects, and can be editable.
Missing data is represented by an empty String in the table cell. You may subclass this class to provide
more functionality.
The Source Code of this Java class is available under a BSD-style license.
| Field Summary | |
protected ArrayList |
iData
Table data as a List of String[] arrays. |
protected boolean |
iDataHasHeaders
The first line of the CSV file may contain headers. |
protected boolean |
iEditable
The table may be editable. |
protected List |
iHeaders
List of headers as Strings. |
protected boolean |
iHeadersStored
Flag to indicate that headers have been loaded. |
protected int |
iMaxNumFields
Maximum number of fields encountered. |
| Fields inherited from class javax.swing.table.AbstractTableModel |
listenerList |
| Constructor Summary | |
XmlTableModel()
Support Class.newInstance() object instantiation. |
|
XmlTableModel(List pData)
Create a new TableModel with specified a List of String[] arrays. |
|
| Method Summary | |
void |
addRecord(String[] pRecord)
Add a record to the internal data containers for this TableModel. |
void |
clear()
Clear all data from table. |
int |
getColumnCount()
Get number of columns in table. |
String |
getColumnName(int pIndex)
Get the name of the column. |
int |
getRowCount()
Get number of rows in table. |
Object |
getValueAt(int pRow,
int pColumn)
Get the value of a table cell. |
void |
init()
Initialise the internal data containers before loading new XML record data. |
boolean |
isCellEditable(int pRow,
int pColumn)
Indicate that table cell value can be changed. |
void |
setDataHasHeaders(boolean pDataHasHeaders)
The data provided via addRecord(java.lang.String[]) includes column headers. |
void |
setEditable(boolean pEditable)
You can use this setting to make your JTable editable. |
void |
setHeaders(String[] pHeaders)
|
void |
setValueAt(Object pValue,
int pRow,
int pColumn)
Set the value of a table cell. |
String |
toString()
String description of object instance. |
| Methods inherited from class javax.swing.table.AbstractTableModel |
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getListeners, getTableModelListeners, removeTableModelListener |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface javax.swing.table.TableModel |
addTableModelListener, getColumnClass, removeTableModelListener |
| Field Detail |
protected boolean iEditable
protected boolean iDataHasHeaders
protected boolean iHeadersStored
protected List iHeaders
Strings.
protected ArrayList iData
List of String[] arrays.
protected int iMaxNumFields
| Constructor Detail |
public XmlTableModel()
Class.newInstance() object instantiation.
public XmlTableModel(List pData)
TableModel with specified a List of String[] arrays.
| Method Detail |
public void init()
public void addRecord(String[] pRecord)
TableModel.
pRecord - data fieldspublic void setDataHasHeaders(boolean pDataHasHeaders)
addRecord(java.lang.String[]) includes column headers.
When true, the first call to addRecord is assumed to be the list of column headers.
When false, the table has no headers.
You can access this setting like so:
XmlSpec xmlspec = xmlManager.getXmlSpec(); xmlSpec.setProperty( "TableModel.dataDataHasHeaders", true );
pDataHasHeaders - data has headersXmlManager.loadTableModel(File,RecordSpec)public void setHeaders(String[] pHeaders)
public void setEditable(boolean pEditable)
When true, the table cells can be edited.
When false, the table cell cannot be edited.
You can access this setting like so:
XmlSpec xmlspec = xmlManager.getXmlSpec(); xmlSpec.setProperty( "TableModel.editable", true );
pEditable - editable tablepublic void clear()
public String getColumnName(int pIndex)
getColumnName in interface TableModelpIndex - index of column (from zero)public int getRowCount()
getRowCount in interface TableModelpublic int getColumnCount()
getColumnCount in interface TableModel
public Object getValueAt(int pRow,
int pColumn)
getValueAt in interface TableModelpRow - index of row (from zero)pColumn - index of column (from zero)
public boolean isCellEditable(int pRow,
int pColumn)
isCellEditable in interface TableModelpRow - index of row (from zero)pColumn - index of column (from zero)
public void setValueAt(Object pValue,
int pRow,
int pColumn)
setValueAt in interface TableModelpValue - new value of cellpRow - index of row (from zero)pColumn - index of column (from zero)public String toString()
String description of object instance.
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||