Package ca.phon.script.scripttable
Class AbstractScriptTableModel
java.lang.Object
javax.swing.table.AbstractTableModel
ca.phon.script.scripttable.AbstractScriptTableModel
- All Implemented Interfaces:
ScriptTableModel
,Serializable
,TableModel
- Direct Known Subclasses:
ListScriptTableModel
,ResultListingDataSource
public abstract class AbstractScriptTableModel
extends AbstractTableModel
implements ScriptTableModel
Abstract implementation of ScriptTableModel
. The class include
method for reading and writing the table model to xml files.
- See Also:
-
Field Summary
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected org.mozilla.javascript.Scriptable
createCellScope
(PhonScriptContext ctx, int row, int col) Create a scope with all of the static mapping for a column setup.Class<?>
getColumnClass
(int col) Get the class for the specified columnint
Return the number of columnsgetColumnName
(int col) Uses the default column name or the name provided by a method 'getName' in the column script.getColumnScript
(int col) Get the script for the given column.getMappingsAt
(int row, int col) Variable mapping for the given cell.getValueAt
(int row, int col) Get value at given row,colvoid
readXML
(InputStream is) Read table schema from xmlvoid
Removes all columns.void
setColumnMappings
(int col, Map<String, Object> mappings) Static mappings for scripts can be set here.void
setColumnScript
(int col, PhonScript script) Setup script for specified column.void
setColumnScript
(int col, String script) Setup script for specified columnvoid
writeXML
(OutputStream os) Write the table model schema in xml to the given stream.Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface ca.phon.script.scripttable.ScriptTableModel
getRowCount
Methods inherited from interface javax.swing.table.TableModel
addTableModelListener, isCellEditable, removeTableModelListener, setValueAt
-
Constructor Details
-
AbstractScriptTableModel
public AbstractScriptTableModel()
-
-
Method Details
-
getColumnClass
Description copied from interface:ScriptTableModel
Get the class for the specified column- Specified by:
getColumnClass
in interfaceScriptTableModel
- Specified by:
getColumnClass
in interfaceTableModel
- Overrides:
getColumnClass
in classAbstractTableModel
- Parameters:
col
- the column index- Returns:
- the class for the specified column
-
getColumnName
Uses the default column name or the name provided by a method 'getName' in the column script.- Specified by:
getColumnName
in interfaceScriptTableModel
- Specified by:
getColumnName
in interfaceTableModel
- Overrides:
getColumnName
in classAbstractTableModel
- Parameters:
col
-- Returns:
- column name
-
getColumnScript
Description copied from interface:ScriptTableModel
Get the script for the given column.- Specified by:
getColumnScript
in interfaceScriptTableModel
- Returns:
- script for the specified column index
-
getColumnCount
public int getColumnCount()Description copied from interface:ScriptTableModel
Return the number of columns- Specified by:
getColumnCount
in interfaceScriptTableModel
- Specified by:
getColumnCount
in interfaceTableModel
- Returns:
- number of columns
-
setColumnScript
Setup script for specified column- Parameters:
col
-script
-- Throws:
ScriptException
PhonScriptException
-
setColumnScript
Setup script for specified column. Script is assumed to have mimetype 'text/javascript'- Parameters:
col
-script
-- Throws:
ScriptException
PhonScriptException
-
getValueAt
Description copied from interface:ScriptTableModel
Get value at given row,col- Specified by:
getValueAt
in interfaceScriptTableModel
- Specified by:
getValueAt
in interfaceTableModel
- Returns:
- value for the specified cell
-
setColumnMappings
Static mappings for scripts can be set here. These mappings will be returned forgetMappingsAt(int, int)
- Parameters:
col
-mappings
-
-
getMappingsAt
Description copied from interface:ScriptTableModel
Variable mapping for the given cell.- Specified by:
getMappingsAt
in interfaceScriptTableModel
- Returns:
- the column mapping for the specified cell
-
createCellScope
protected org.mozilla.javascript.Scriptable createCellScope(PhonScriptContext ctx, int row, int col) Create a scope with all of the static mapping for a column setup.- Parameters:
row
-col
-
-
removeAllColumns
public void removeAllColumns()Removes all columns. -
writeXML
Write the table model schema in xml to the given stream.- Parameters:
file
-- Throws:
IOException
-
readXML
Read table schema from xml- Parameters:
is
-- Throws:
IOException
-