Class TableEditorModel
java.lang.Object
javax.swing.table.AbstractTableModel
org.pentaho.reporting.ui.datasources.table.TableEditorModel
- All Implemented Interfaces:
Serializable,TableModel
- See Also:
-
Field Summary
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a defaultDefaultTableModelwhich is a table of zero columns and zero rows. -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidaddRow()voidaddRow(int idx) voidclear()voidcopyInto(TableModel model) voidfireTableCellUpdated(int row, int column) Notifies all listeners that the value of the cell at[row, column]has been updated.voidForwards the given notification event to allTableModelListenersthat registered themselves as listeners for this table model.voidNotifies all listeners that all cell values in the table's rows may have changed.voidfireTableRowsDeleted(int firstRow, int lastRow) Notifies all listeners that rows in the range[firstRow, lastRow], inclusive, have been deleted.voidfireTableRowsInserted(int firstRow, int lastRow) Notifies all listeners that rows in the range[firstRow, lastRow], inclusive, have been inserted.voidfireTableRowsUpdated(int firstRow, int lastRow) Notifies all listeners that rows in the range[firstRow, lastRow], inclusive, have been updated.voidNotifies all listeners that the table's structure has changed.Class<?>getColumnClass(int columnIndex) ReturnsObject.classregardless ofcolumnIndex.intReturns the number of columns in the model.getColumnName(int column) Returns a default name for the column using spreadsheet conventions: A, B, C, ...intReturns the number of rows in the model.getValueAt(int rowIndex, int columnIndex) Returns the value for the cell atcolumnIndexandrowIndex.booleanisCellEditable(int rowIndex, int columnIndex) Returns false.booleanvoidremoveColumn(int column) voidremoveRow(int row) voidsetColumnClass(int index, Class type) voidsetColumnName(int index, String identifier) voidsetSuspendEvents(boolean suspendEvents) voidsetValueAt(Object aValue, int rowIndex, int columnIndex) This empty implementation is provided so users don't have to implement this method if their data model is not editable.Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, getListeners, getTableModelListeners, removeTableModelListener
-
Constructor Details
-
TableEditorModel
public TableEditorModel()Constructs a defaultDefaultTableModelwhich is a table of zero columns and zero rows.
-
-
Method Details
-
setColumnName
-
removeColumn
public void removeColumn(int column) -
removeRow
public void removeRow(int row) -
addColumn
-
addRow
public void addRow() -
addRow
public void addRow(int idx) -
getColumnName
Returns a default name for the column using spreadsheet conventions: A, B, C, ... Z, AA, AB, etc. Ifcolumncannot be found, returns an empty string.- Specified by:
getColumnNamein interfaceTableModel- Overrides:
getColumnNamein classAbstractTableModel- Parameters:
column- the column being queried- Returns:
- a string containing the default name of
column
-
getColumnClass
ReturnsObject.classregardless ofcolumnIndex.- Specified by:
getColumnClassin interfaceTableModel- Overrides:
getColumnClassin classAbstractTableModel- Parameters:
columnIndex- the column being queried- Returns:
- the Object.class
-
getRowCount
public int getRowCount()Returns the number of rows in the model. AJTableuses this method to determine how many rows it should display. This method should be quick, as it is called frequently during rendering.- Returns:
- the number of rows in the model
- See Also:
-
getColumnCount
public int getColumnCount()Returns the number of columns in the model. AJTableuses this method to determine how many columns it should create and display by default.- Returns:
- the number of columns in the model
- See Also:
-
getValueAt
Returns the value for the cell atcolumnIndexandrowIndex.- Parameters:
rowIndex- the row whose value is to be queriedcolumnIndex- the column whose value is to be queried- Returns:
- the value Object at the specified cell
-
isCellEditable
public boolean isCellEditable(int rowIndex, int columnIndex) Returns false. This is the default implementation for all cells.- Specified by:
isCellEditablein interfaceTableModel- Overrides:
isCellEditablein classAbstractTableModel- Parameters:
rowIndex- the row being queriedcolumnIndex- the column being queried- Returns:
- false
-
setValueAt
This empty implementation is provided so users don't have to implement this method if their data model is not editable.- Specified by:
setValueAtin interfaceTableModel- Overrides:
setValueAtin classAbstractTableModel- Parameters:
aValue- value to assign to cellrowIndex- row of cellcolumnIndex- column of cell
-
clear
public void clear() -
setColumnClass
-
fireTableDataChanged
public void fireTableDataChanged()Notifies all listeners that all cell values in the table's rows may have changed. The number of rows may also have changed and theJTableshould redraw the table from scratch. The structure of the table (as in the order of the columns) is assumed to be the same.- Overrides:
fireTableDataChangedin classAbstractTableModel- See Also:
-
fireTableStructureChanged
public void fireTableStructureChanged()Notifies all listeners that the table's structure has changed. The number of columns in the table, and the names and types of the new columns may be different from the previous state. If theJTablereceives this event and itsautoCreateColumnsFromModelflag is set it discards any table columns that it had and reallocates default columns in the order they appear in the model. This is the same as callingsetModel(TableModel)on theJTable.- Overrides:
fireTableStructureChangedin classAbstractTableModel- See Also:
-
fireTableRowsInserted
public void fireTableRowsInserted(int firstRow, int lastRow) Notifies all listeners that rows in the range[firstRow, lastRow], inclusive, have been inserted.- Overrides:
fireTableRowsInsertedin classAbstractTableModel- Parameters:
firstRow- the first rowlastRow- the last row- See Also:
-
fireTableRowsUpdated
public void fireTableRowsUpdated(int firstRow, int lastRow) Notifies all listeners that rows in the range[firstRow, lastRow], inclusive, have been updated.- Overrides:
fireTableRowsUpdatedin classAbstractTableModel- Parameters:
firstRow- the first rowlastRow- the last row- See Also:
-
fireTableRowsDeleted
public void fireTableRowsDeleted(int firstRow, int lastRow) Notifies all listeners that rows in the range[firstRow, lastRow], inclusive, have been deleted.- Overrides:
fireTableRowsDeletedin classAbstractTableModel- Parameters:
firstRow- the first rowlastRow- the last row- See Also:
-
fireTableCellUpdated
public void fireTableCellUpdated(int row, int column) Notifies all listeners that the value of the cell at[row, column]has been updated.- Overrides:
fireTableCellUpdatedin classAbstractTableModel- Parameters:
row- row of cell which has been updatedcolumn- column of cell which has been updated- See Also:
-
fireTableChanged
Forwards the given notification event to allTableModelListenersthat registered themselves as listeners for this table model.- Overrides:
fireTableChangedin classAbstractTableModel- Parameters:
e- the event to be forwarded- See Also:
-
isSuspendEvents
public boolean isSuspendEvents() -
setSuspendEvents
public void setSuspendEvents(boolean suspendEvents) -
copyInto
-
createModel
-