|
JComponentPack 1.5.0 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.zfqjava.swing.AbstractDataGridModel
public abstract class AbstractDataGridModel
| Field Summary | |
|---|---|
protected EventListenerList |
listenerList
List of listeners |
| Constructor Summary | |
|---|---|
AbstractDataGridModel()
|
|
| Method Summary | |
|---|---|
void |
addCellSpanListener(CellSpanListener l)
Adds a listener to the list that is notified each time a change to the cell span model occurs. |
void |
addDataGridModelListener(DataGridModelListener l)
Adds a listener to the list that is notified each time a change to the data model occurs. |
void |
addTableModelListener(TableModelListener l)
Adds a listener to the list that's notified each time a change to the data model occurs. |
void |
addUndoableEditListener(UndoableEditListener l)
Registers the given observer to begin receiving notifications when undoable edits are made to the model. |
void |
calculateFormula()
Calculate the formula cells. |
boolean |
clear(Cell c)
Clears the cell data for the specified cell area c. |
void |
endUndoableEdit()
Ends the undoable edit.All undoable edit before this edit will be fired to the UndoableEditListener. |
boolean |
fill(Cell c,
TableModel model)
Fills the cell area c use the specified data. |
boolean |
fillCellAttributes(Cell c,
List[] l)
Fills the cell attributes of the cell area c use the specified data. |
protected void |
fireCellAttributesChanged(Cell c)
Notifies all listeners that cell attributes have been changed. |
protected void |
fireCellAttributesChanged(int rowIndex,
int columnIndex)
Notifies all listeners that cell attributes have been changed. |
protected void |
fireCellChanged(Cell c)
Notifies all listeners that all cell object have been changed. |
protected void |
fireCellChanged(DataGridModelEvent e)
Notifies all listeners that cell have been changed. |
protected void |
fireCellChanged(int rowIndex,
int columnIndex)
Notifies all listeners that cell have been changed. |
protected void |
fireCellClassChanged(Cell c)
Notifies all listeners that cell class have been changed. |
protected void |
fireCellClassChanged(int rowIndex,
int columnIndex)
Notifies all listeners that cell class have been changed. |
protected void |
fireCellEditableChanged(Cell c)
Notifies all listeners that cell editable have been changed. |
protected void |
fireCellEditableChanged(int rowIndex,
int columnIndex)
Notifies all listeners that cell editable have been changed. |
protected void |
fireCellMerged(Cell c)
Forwards the given notification event to all CellSpanListeners that registered
themselves as listeners for this cell span model. |
protected void |
fireCellSpanChanged(Cell c)
Notifies all listeners that cell span have been changed. |
protected void |
fireCellSpanChanged(int firstRow,
int lastRow,
int firstColumn,
int lastColumn)
Notifies all listeners that cell span have been changed. |
protected void |
fireCellSplitted(Cell c)
Forwards the given notification event to all CellSpanListeners that registered
themselves as listeners for this cell span model. |
protected void |
fireCellValueChanged(Cell c)
Notifies all listeners that cell value have been changed. |
protected void |
fireCellValueChanged(int rowIndex,
int columnIndex)
Notifies all listeners that cell value have been changed. |
protected void |
fireTableCellUpdated(int row,
int column)
Notifies all listeners that the value of the cell at [row, column] has been updated. |
protected void |
fireTableChanged(TableModelEvent e)
Forwards the given notification event to all TableModelListeners that registered
themselves as listeners for this table model. |
protected void |
fireTableColumnsDeleted(int firstColumn,
int lastColumn)
Notifies all listeners that columns in the range [firstColumn, lastColumn], inclusive, have been deleted. |
protected void |
fireTableColumnsInserted(int firstColumn,
int lastColumn)
Notifies all listeners that columns in the range [firstColumn, lastColumn], inclusive, have been inserted. |
protected void |
fireTableColumnsUpdated(int firstColumn,
int lastColumn)
Notifies all listeners that columns in the range [firstColumn, lastColumn], inclusive, have been updated. |
protected void |
fireTableColumnUpdated(int column)
Notifies all listeners that the value of the colum at column has been updated. |
protected void |
fireTableDataChanged()
Notifies all listeners that all cell values in the table's rows may have changed. |
protected void |
fireTableRowsDeleted(int firstRow,
int lastRow)
Notifies all listeners that rows in the range [firstRow, lastRow], inclusive, have been deleted. |
protected void |
fireTableRowsInserted(int firstRow,
int lastRow)
Notifies all listeners that rows in the range [firstRow, lastRow], inclusive, have been inserted. |
protected void |
fireTableRowsUpdated(int firstRow,
int lastRow)
Notifies all listeners that rows in the range [firstRow, lastRow], inclusive, have been updated. |
protected void |
fireTableRowUpdated(int row)
Notifies all listeners that the value of the row at row has been updated. |
protected void |
fireTableStructureChanged()
Notifies all listeners that the table's structure has changed. |
protected void |
fireUndoableEditHappened(UndoableEdit edit)
Notifies all listeners that have registered interest for notification on this event type. |
boolean |
getAutoCalculateFormula()
Returns the auot calculate formula property, default is true. |
boolean |
getAutoSetsCellClass()
Returns the auto sets cell class property. |
boolean |
getAutoSetsCellValue()
Returns the auto sets cell value property. |
Boolean |
getCellEditable(int rowIndex,
int columnIndex)
Returns the editable property for the specified cell at rowIndex and
columnIndex. |
CellSpanListener[] |
getCellSpanListeners()
Returns an array of all the table model listeners registered on this model. |
Cell |
getCellSpans(int rowIndex,
int columnIndex)
Returns the cell that spans the specified cell at rowIndex and columnIndex. |
Cell[] |
getCellSpans(int firstRow,
int lastRow,
int firstColumn,
int lastColumn)
Returns the cells that spans the specified cell area. |
AttributeSet |
getColumnAttributes(int column)
Returns the attributes for the specified column index. |
Class |
getColumnClass(int columnIndex)
Returns Object.class regardless of columnIndex. |
Boolean |
getColumnEditable(int column)
Returns the editable for the specified column index. |
AttributeSet |
getColumnHeaderAttributes(int column)
Returns the attributes for the specified column index. |
String |
getColumnName(int column)
Returns a default name for the column using spreadsheet conventions: A, B, C, ... |
DataGridModelListener[] |
getDataGridModelListeners()
Returns an array of all the data grid model listeners registered on this model. |
Cell[] |
getFormulaCells()
Returns all formula cells. |
FormulaContext |
getFormulaContext(int row,
int column)
Returns the FormulaContext in use. |
EventListener[] |
getListeners(Class listenerType)
Returns an array of all the objects currently registered as FooListeners
upon this AbstractTableModel. |
AttributeSet |
getRowAttributes(int row)
Returns the attributes for the specified row index. |
Boolean |
getRowEditable(int row)
Returns the editable for the specified row index. |
AttributeSet |
getRowHeaderAttributes(int row)
Returns the attributes for the specified row index. |
Cell[] |
getSpannedCells()
Returns all spanned cells. |
char |
getStringEscapeChar()
Returns the string escape char. |
TableModelListener[] |
getTableModelListeners()
Returns an array of all the table model listeners registered on this model. |
UndoableEditListener[] |
getUndoableEditListeners()
Returns an array of all the undoable edit listeners registered on this model. |
boolean |
hasCellSpans(int rowIndex,
int columnIndex)
Returns true if has cell spans the specified cell at rowIndex and columnIndex. |
boolean |
hasCellSpans(int firstRow,
int lastRow,
int firstColumn,
int lastColumn)
Returns true if has some cells spans the specified cell area. |
boolean |
isColumnEditable(int column)
Returns the editable for the specified column index. |
boolean |
isRowEditable(int row)
Returns the editable for the specified row index. |
boolean |
isSpannedCell(Cell c)
Determines whether the cell is spanned cell. |
boolean |
merge(Cell c)
Merges the cell. |
void |
removeCellSpanListener(CellSpanListener l)
Removes a listener from the list that is notified each time a change to the cell span model occurs. |
void |
removeDataGridModelListener(DataGridModelListener l)
Removes a listener from the list that is notified each time a change to the data model occurs. |
void |
removeTableModelListener(TableModelListener l)
Removes a listener from the list that's notified each time a change to the data model occurs. |
void |
removeUndoableEditListener(UndoableEditListener l)
Unregisters the given observer from the notification list so it will no longer receive updates. |
void |
setAutoCalculateFormula(boolean b)
Sets the auot calculate formula property, default is true. |
void |
setAutoSetsCellClass(boolean setsClass)
Sets the auto sets cell class property. |
void |
setAutoSetsCellValue(boolean setsValue)
Sets the auto sets cell value property. |
void |
setCellAttributes(AttributeSet attributes,
Cell c)
Sets the cell attributes. |
void |
setCellClass(Class cc,
Cell c)
Sets the cell class. |
void |
setColumnAttributes(AttributeSet attributes,
int column)
Sets the attributes for the specified column index. |
void |
setColumnEditable(boolean editable,
int column)
Sets the editable for the specified column index. |
void |
setColumnHeaderAttributes(AttributeSet attributes,
int column)
Sets the attributes for the specified column header index. |
void |
setRowAttributes(AttributeSet attributes,
int row)
Sets the attributes for the specified row index. |
void |
setRowEditable(boolean editable,
int row)
Sets the editable for the specified row index. |
void |
setRowHeaderAttributes(AttributeSet attributes,
int row)
Sets the attributes for the specified row header index. |
void |
setStringEscapeChar(char c)
Sets the string escape char. |
boolean |
split(Cell c)
Splits the cell. |
void |
startUndoableEdit(Cell undoCell,
Cell redoCell)
Starts the undoable edit. |
DataGridModel |
toModel(Cell c)
Converts the cell area to the model. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.zfqjava.swing.DataGridModel |
|---|
getCellAttributes, getCellClass, setCellAttributes, setCellClass, setCellEditable, setColumnClass, setColumnCount, setColumnName, setRowCount |
| Methods inherited from interface javax.swing.table.TableModel |
|---|
getColumnCount, getRowCount, getValueAt, isCellEditable, setValueAt |
| Field Detail |
|---|
protected transient EventListenerList listenerList
| Constructor Detail |
|---|
public AbstractDataGridModel()
| Method Detail |
|---|
public void setAutoSetsCellClass(boolean setsClass)
setsClass - the auto sets cell class propertygetAutoSetsCellClass()public boolean getAutoSetsCellClass()
setAutoSetsCellClass(boolean)public void setAutoSetsCellValue(boolean setsValue)
setsValue - the auto sets cell value propertygetAutoSetsCellValue()public boolean getAutoSetsCellValue()
setAutoSetsCellValue(boolean)public void setStringEscapeChar(char c)
c - the string escape chargetStringEscapeChar()public char getStringEscapeChar()
setStringEscapeChar(char)public void setAutoCalculateFormula(boolean b)
b - true if auto calculate formula enabledgetAutoCalculateFormula()public boolean getAutoCalculateFormula()
setAutoCalculateFormula(boolean)public void calculateFormula()
public final void startUndoableEdit(Cell undoCell,
Cell redoCell)
try {
startUndoableEdit(edit);
// do something
} finally {
endUndoableEdit();
}
undoCell - the compound edit undo cellredoCell - the compound edit redo cellendUndoableEdit()public final void endUndoableEdit()
try {
startUndoableEdit(edit);
// do something
} finally {
endUndoableEdit();
}
startUndoableEdit()
public boolean hasCellSpans(int rowIndex,
int columnIndex)
DataGridModelrowIndex and columnIndex.
hasCellSpans in interface CellSpanModelhasCellSpans in interface DataGridModelrowIndex - the row index of the specified cellcolumnIndex - the column index of the specified cellDataGridModel.getCellSpans(int,int)
public Cell getCellSpans(int rowIndex,
int columnIndex)
DataGridModelrowIndex and columnIndex.
getCellSpans in interface CellSpanModelgetCellSpans in interface DataGridModelrowIndex - the row index of the specified cellcolumnIndex - the column index of the specified cell
DataGridModel.hasCellSpans(int,int)
public boolean hasCellSpans(int firstRow,
int lastRow,
int firstColumn,
int lastColumn)
DataGridModelNote:Some cell spans the area can have row and column index out of the area index.
hasCellSpans in interface CellSpanModelhasCellSpans in interface DataGridModelfirstRow - the first row index of the specified cell arealastRow - the last row index of the specified cell areafirstColumn - the first column index of the specified cell arealastColumn - the last column index of the specified cell area
DataGridModel.getCellSpans(int,int,int,int)
public Cell[] getCellSpans(int firstRow,
int lastRow,
int firstColumn,
int lastColumn)
DataGridModelNote:Some cell spans the area can have row and column index out of the area index.
getCellSpans in interface CellSpanModelgetCellSpans in interface DataGridModelfirstRow - the first row index of the specified cell arealastRow - the last row index of the specified cell areafirstColumn - the first column index of the specified cell arealastColumn - the last column index of the specified cell area
DataGridModel.hasCellSpans(int,int,int,int)public boolean isSpannedCell(Cell c)
DataGridModel
isSpannedCell in interface CellSpanModelisSpannedCell in interface DataGridModelc - the cell
DataGridModel.merge(com.zfqjava.swing.cell.Cell).public Cell[] getSpannedCells()
DataGridModel
getSpannedCells in interface CellSpanModelgetSpannedCells in interface DataGridModelDataGridModel.merge(com.zfqjava.swing.cell.Cell).public boolean merge(Cell c)
DataGridModeltrue if this model changes
as a result of the call. (Returns false if this model
already contains such spanned cell c or does not permit
such operation.)
merge in interface CellSpanModelmerge in interface DataGridModelc - the cell
DataGridModel.split(com.zfqjava.swing.cell.Cell)public boolean split(Cell c)
DataGridModeltrue if this model changes
as a result of the call. (Returns false if this model
have not such spanned cell or does not permit such operation.)
split in interface CellSpanModelsplit in interface DataGridModelc - the cell
DataGridModel.merge(com.zfqjava.swing.cell.Cell)
public void setCellAttributes(AttributeSet attributes,
Cell c)
attributes - the cell attributesc - the cell areaDataGridModel.getCellAttributes(int, int)
public void setCellClass(Class cc,
Cell c)
cc - the cell classc - the cell areaDataGridModel.getCellClass(int, int)
public boolean fillCellAttributes(Cell c,
List[] l)
c use the specified data.
c - the cell areal - the cell data
IllegalArgumentException - if the cell area
out of the model row and column count or list data is not enoughpublic boolean clear(Cell c)
c.
c - the cell area
public boolean fill(Cell c,
TableModel model)
c use the specified data.
c - the cell areamodel - the cell data
public DataGridModel toModel(Cell c)
c - the cell area
public Cell[] getFormulaCells()
public void setRowAttributes(AttributeSet attributes,
int row)
attributes - the row attributespublic AttributeSet getRowAttributes(int row)
row - the specified row index
public void setRowEditable(boolean editable,
int row)
editable - the row editablepublic boolean isRowEditable(int row)
row - the specified row index
public Boolean getRowEditable(int row)
row - the specified row index
public void setRowHeaderAttributes(AttributeSet attributes,
int row)
attributes - the row header attributespublic AttributeSet getRowHeaderAttributes(int row)
row - the specified row index
public void setColumnAttributes(AttributeSet attributes,
int column)
attributes - the column attributespublic AttributeSet getColumnAttributes(int column)
column - the specified column index
public void setColumnEditable(boolean editable,
int column)
editable - the column editablepublic boolean isColumnEditable(int column)
column - the specified column index
public Boolean getColumnEditable(int column)
column - the specified column index
public Boolean getCellEditable(int rowIndex,
int columnIndex)
rowIndex and
columnIndex.
rowIndex - the row whose value to be queriedcolumnIndex - the column whose value to be queried
TableModel.setValueAt(java.lang.Object, int, int),
DataGridModel.setCellEditable(boolean,int,int)
public void setColumnHeaderAttributes(AttributeSet attributes,
int column)
attributes - the column header attributespublic AttributeSet getColumnHeaderAttributes(int column)
column - the specified column index
public String getColumnName(int column)
column cannot be found,
returns an empty string.
getColumnName in interface TableModelcolumn - the column being queried
columnpublic Class getColumnClass(int columnIndex)
Object.class regardless of columnIndex.
getColumnClass in interface TableModelcolumnIndex - the column being queried
public void addTableModelListener(TableModelListener l)
addTableModelListener in interface TableModell - the TableModelListenerpublic void removeTableModelListener(TableModelListener l)
removeTableModelListener in interface TableModell - the TableModelListenerpublic TableModelListener[] getTableModelListeners()
TableModelListeners
or an empty
array if no table model listeners are currently registeredaddTableModelListener(javax.swing.event.TableModelListener),
removeTableModelListener(javax.swing.event.TableModelListener)protected void fireTableDataChanged()
JTable should redraw the
table from scratch. The structure of the table (as in the order of the
columns) is assumed to be the same.
TableModelEvent,
EventListenerList,
JTable.tableChanged(TableModelEvent)protected void fireTableStructureChanged()
JTable receives this event and its
autoCreateColumnsFromModel
flag 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 calling setModel(TableModel) on the
JTable.
TableModelEvent,
EventListenerList
protected void fireTableRowsInserted(int firstRow,
int lastRow)
[firstRow, lastRow], inclusive, have been inserted.
firstRow - the first rowlastRow - the last rowTableModelEvent,
EventListenerList
protected void fireTableRowsUpdated(int firstRow,
int lastRow)
[firstRow, lastRow], inclusive, have been updated.
firstRow - the first rowlastRow - the last rowTableModelEvent,
EventListenerList
protected void fireTableRowsDeleted(int firstRow,
int lastRow)
[firstRow, lastRow], inclusive, have been deleted.
firstRow - the first rowlastRow - the last rowTableModelEvent,
EventListenerList
protected void fireTableColumnsInserted(int firstColumn,
int lastColumn)
[firstColumn, lastColumn], inclusive, have been inserted.
firstColumn - the first columnlastColumn - the last columnTableModelEvent,
EventListenerList
protected void fireTableColumnsUpdated(int firstColumn,
int lastColumn)
[firstColumn, lastColumn], inclusive, have been updated.
firstColumn - the first columnlastColumn - the last columnTableModelEvent,
EventListenerList
protected void fireTableColumnsDeleted(int firstColumn,
int lastColumn)
[firstColumn, lastColumn], inclusive, have been deleted.
firstColumn - the first columnlastColumn - the last columnTableModelEvent,
EventListenerListprotected void fireTableColumnUpdated(int column)
column has been updated.
column - column which has been updatedTableModelEvent,
EventListenerListprotected void fireTableRowUpdated(int row)
row has been updated.
row - row which has been updatedTableModelEvent,
EventListenerList
protected void fireTableCellUpdated(int row,
int column)
[row, column] has been updated.
row - row of cell which has been updatedcolumn - column of cell which has been updatedTableModelEvent,
EventListenerListprotected void fireTableChanged(TableModelEvent e)
TableModelListeners that registered
themselves as listeners for this table model.
e - the event to be forwardedaddTableModelListener(javax.swing.event.TableModelListener),
TableModelEvent,
EventListenerListpublic void addDataGridModelListener(DataGridModelListener l)
addDataGridModelListener in interface DataGridModell - the DataGridModelListenerpublic void removeDataGridModelListener(DataGridModelListener l)
removeDataGridModelListener in interface DataGridModell - the DataGridModelListenerpublic DataGridModelListener[] getDataGridModelListeners()
DataGridModelListeners
or an empty
array if no data grid model listeners are currently registeredaddDataGridModelListener(com.zfqjava.swing.event.DataGridModelListener),
removeDataGridModelListener(com.zfqjava.swing.event.DataGridModelListener)
protected void fireCellAttributesChanged(int rowIndex,
int columnIndex)
rowIndex - the row index of the cellcolumnIndex - the column index of the cellfireCellChanged(int, int)protected void fireCellAttributesChanged(Cell c)
c - the specified cellfireCellChanged(int, int)
protected void fireCellClassChanged(int rowIndex,
int columnIndex)
rowIndex - the row index of the cellcolumnIndex - the column index of the cellfireCellChanged(int, int)protected void fireCellClassChanged(Cell c)
c - the specified cellfireCellChanged(int, int)
protected void fireCellEditableChanged(int rowIndex,
int columnIndex)
rowIndex - the row index of the cellcolumnIndex - the column index of the cellfireCellChanged(int, int)protected void fireCellEditableChanged(Cell c)
c - the specified cellfireCellChanged(int, int)protected void fireCellSpanChanged(Cell c)
c - the spanned cellfireCellChanged(int, int)
protected void fireCellSpanChanged(int firstRow,
int lastRow,
int firstColumn,
int lastColumn)
firstRow - the first row index of the specified cell arealastRow - the last row index of the specified cell areafirstColumn - the first column index of the specified cell arealastColumn - the last column index of the specified cell areaprotected void fireCellValueChanged(Cell c)
c - the specified cellfireCellChanged(int, int)
protected void fireCellValueChanged(int rowIndex,
int columnIndex)
rowIndex - the specified cell row indexcolumnIndex - the specified cell column indexfireCellChanged(int, int)
protected void fireCellChanged(int rowIndex,
int columnIndex)
rowIndex - the specified cell row indexcolumnIndex - the specified cell column indexfireCellChanged(int, int)protected void fireCellChanged(Cell c)
c - the specified cellfireCellChanged(int, int)protected void fireCellChanged(DataGridModelEvent e)
public void addUndoableEditListener(UndoableEditListener l)
addUndoableEditListener in interface DataGridModell - the observer to registerUndoableEditEventpublic void removeUndoableEditListener(UndoableEditListener l)
removeUndoableEditListener in interface DataGridModell - the observer to registerUndoableEditEventpublic UndoableEditListener[] getUndoableEditListeners()
UndoableEditListeners
or an empty array if no undoable edit listeners are
currently registeredaddUndoableEditListener(javax.swing.event.UndoableEditListener),
removeUndoableEditListener(javax.swing.event.UndoableEditListener)protected void fireUndoableEditHappened(UndoableEdit edit)
edit - the undoable editEventListenerListpublic void addCellSpanListener(CellSpanListener l)
CellSpanModel
addCellSpanListener in interface CellSpanModell - the CellSpanListenerpublic void removeCellSpanListener(CellSpanListener l)
CellSpanModel
removeCellSpanListener in interface CellSpanModell - the CellSpanListenerpublic CellSpanListener[] getCellSpanListeners()
CellSpanListeners
or an empty
array if no table model listeners are currently registeredaddCellSpanListener(com.zfqjava.swing.event.CellSpanListener),
removeCellSpanListener(com.zfqjava.swing.event.CellSpanListener)protected void fireCellMerged(Cell c)
CellSpanListeners that registered
themselves as listeners for this cell span model.
e - the event to be forwardedaddCellSpanListener(com.zfqjava.swing.event.CellSpanListener),
EventListenerListprotected void fireCellSplitted(Cell c)
CellSpanListeners that registered
themselves as listeners for this cell span model.
e - the event to be forwardedaddCellSpanListener(com.zfqjava.swing.event.CellSpanListener),
EventListenerListpublic EventListener[] getListeners(Class listenerType)
FooListeners
upon this AbstractTableModel.
FooListeners are registered using the
addFooListener method.
You can specify the listenerType argument
with a class literal,
such as
FooListener.class.
For example, you can query a
model m
for its table model listeners with the following code:
TableModelListener[] tmls = (TableModelListener[])(m.getListeners(TableModelListener.class));If no such listeners exist, this method returns an empty array.
listenerType - the type of listeners requested; this parameter
should specify an interface that descends from
java.util.EventListener
FooListeners on this component,
or an empty array if no such
listeners have been added
ClassCastException - if listenerType
doesn't specify a class or interface that implements
java.util.EventListenergetTableModelListeners()
public FormulaContext getFormulaContext(int row,
int column)
row - the row index for the specified cellcolumn - the column index for the specified cell
|
JComponentPack 1.5.0 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||