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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.mozilla.javascript.ScriptablecreateCellScope(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 columnintReturn 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,colvoidreadXML(InputStream is) Read table schema from xmlvoidRemoves all columns.voidsetColumnMappings(int col, Map<String, Object> mappings) Static mappings for scripts can be set here.voidsetColumnScript(int col, PhonScript script) Setup script for specified column.voidsetColumnScript(int col, String script) Setup script for specified columnvoidwriteXML(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, setValueAtMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ca.phon.script.scripttable.ScriptTableModel
getRowCountMethods inherited from interface javax.swing.table.TableModel
addTableModelListener, isCellEditable, removeTableModelListener, setValueAt
-
Constructor Details
-
AbstractScriptTableModel
public AbstractScriptTableModel()
-
-
Method Details
-
getColumnClass
Description copied from interface:ScriptTableModelGet the class for the specified column- Specified by:
getColumnClassin interfaceScriptTableModel- Specified by:
getColumnClassin interfaceTableModel- Overrides:
getColumnClassin 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:
getColumnNamein interfaceScriptTableModel- Specified by:
getColumnNamein interfaceTableModel- Overrides:
getColumnNamein classAbstractTableModel- Parameters:
col-- Returns:
- column name
-
getColumnScript
Description copied from interface:ScriptTableModelGet the script for the given column.- Specified by:
getColumnScriptin interfaceScriptTableModel- Parameters:
col-- Returns:
- script for the specified column index
-
getColumnCount
public int getColumnCount()Description copied from interface:ScriptTableModelReturn the number of columns- Specified by:
getColumnCountin interfaceScriptTableModel- Specified by:
getColumnCountin interfaceTableModel- Returns:
- number of columns
-
setColumnScript
Setup script for specified column- Parameters:
col-script-- Throws:
ScriptExceptionPhonScriptException
-
setColumnScript
Setup script for specified column. Script is assumed to have mimetype 'text/javascript'- Parameters:
col-script-- Throws:
ScriptExceptionPhonScriptException
-
getValueAt
Description copied from interface:ScriptTableModelGet value at given row,col- Specified by:
getValueAtin interfaceScriptTableModel- Specified by:
getValueAtin interfaceTableModel- Parameters:
row-col-- 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:ScriptTableModelVariable mapping for the given cell.- Specified by:
getMappingsAtin interfaceScriptTableModel- Parameters:
row-col-- 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
-