com.jstatcom.table
Class JSCAbstractTableModel
- java.lang.Object
-
- javax.swing.table.AbstractTableModel
-
- com.jstatcom.table.JSCAbstractTableModel
-
- All Implemented Interfaces:
- java.io.Serializable, javax.swing.table.TableModel
- Direct Known Subclasses:
- JSCNArrayTableModel, JSCSArrayTableModel
public abstract class JSCAbstractTableModel extends javax.swing.table.AbstractTableModelA table model to be used withJSCAbstractDataTableinstances. It implements a listener to the underlying symbol that translates symbol events to table model events. Subclasses can reference the current symbol viagetCurrentSymbol. Implementations of the methodsgetRowCount,getColumnCountandgetValueAtshould take thetransposedproperty into account to provide a transposed view to the underlying data without changin it.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description JSCAbstractTableModel(Symbol symbol)Creates a table model for a symbol.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description java.util.Map<java.lang.Integer,java.lang.Boolean>getColIndexEditableMap()Gets the current mapping from column indices to editable properties.JSCDatagetJSCData()Gets theJSCDataobject represented by this model.java.util.Map<java.lang.Integer,java.lang.Boolean>getRowIndexEditableMap()Gets the current mapping from row indices to editable properties.booleanisCellEditable(int rowIndex, int columnIndex)Overwrites default implementation to returnisEditablefor all cells.booleanisEditable()Gets whether all cells are editable.voidsetColEditableMap(java.util.Map<java.lang.Integer,java.lang.Boolean> colIndexEditableMap)Sets the editable properties for each column.voidsetEditable(boolean isEditable)Sets whether all cells are editable.voidsetRowEditableMap(java.util.Map<java.lang.Integer,java.lang.Boolean> rowIndexEditableMap)Sets the editable properties for each row.-
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getColumnName, getListeners, getTableModelListeners, removeTableModelListener, setValueAt
-
-
-
-
Constructor Detail
-
JSCAbstractTableModel
public JSCAbstractTableModel(Symbol symbol)
Creates a table model for a symbol. It installs a symbol listenerif symbol != nullthat translates symbol events into table model events.Subclasses should provide a type check for the symbol.
- Parameters:
symbol- the symbol to represent data for the model
-
-
Method Detail
-
getJSCData
public final JSCData getJSCData()
Gets theJSCDataobject represented by this model. The type of the data depends on the implementation.Usage note:
The returned data is a reference to the underlyingJSCDataobject only until a new data object has been set. It should be used read only. Changes that should not affect this model must be made on a copy of the returned object.- Returns:
JSCDatarepresented by this model
-
isEditable
public final boolean isEditable()
Gets whether all cells are editable. The default istrue.- Returns:
trueif editable
-
setEditable
public final void setEditable(boolean isEditable)
Sets whether all cells are editable.- Parameters:
isEditable-trueif editable
-
setColEditableMap
public void setColEditableMap(java.util.Map<java.lang.Integer,java.lang.Boolean> colIndexEditableMap)
Sets the editable properties for each column. This overwrites the overall editable settings.- Parameters:
colIndexEditableMap-
-
setRowEditableMap
public void setRowEditableMap(java.util.Map<java.lang.Integer,java.lang.Boolean> rowIndexEditableMap)
Sets the editable properties for each row. This overwrites the overall editable settings.- Parameters:
rowIndexEditableMap-
-
getColIndexEditableMap
public java.util.Map<java.lang.Integer,java.lang.Boolean> getColIndexEditableMap()
Gets the current mapping from column indices to editable properties.- Returns:
- editable map
-
getRowIndexEditableMap
public java.util.Map<java.lang.Integer,java.lang.Boolean> getRowIndexEditableMap()
Gets the current mapping from row indices to editable properties.- Returns:
- editable map
-
isCellEditable
public boolean isCellEditable(int rowIndex, int columnIndex)Overwrites default implementation to returnisEditablefor all cells. The row index map overwrites all other settings for all row indices with non-null elements.- Specified by:
isCellEditablein interfacejavax.swing.table.TableModel- Overrides:
isCellEditablein classjavax.swing.table.AbstractTableModel- Parameters:
rowIndex- used if(getRowIndexEditableMap() != null), row settings overwrite overall editable property,nullelements fall back to global editable propertycolumnIndex- used if(getColIndexEditableMap() != null), column settings overwrite overall editable property,nullelements fall back to global editable property
-
-
DMelt 3.0 © DataMelt by jWork.ORG