|
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
com.zfqjava.swing.DefaultDataGridModel
public class DefaultDataGridModel
DefaultDataGridModel provides a default data grid model.
Note:All methods with Cell parameter pass null value will
throws java.lang.NullPointerException.
| Field Summary |
|---|
| Fields inherited from class com.zfqjava.swing.AbstractDataGridModel |
|---|
listenerList |
| Constructor Summary | |
|---|---|
DefaultDataGridModel()
Constructs a data grid model with 0 rows and 0 cols. |
|
DefaultDataGridModel(int rowCount,
int columnCount)
Constructs a data grid model with rowCount rows
and columnCount columns. |
|
| Method Summary | |
|---|---|
void |
addColumn(int firstColumn,
int lastColumn,
List[] l)
Adds column from firstColumn to lastColumn
use the specified list data. |
void |
addColumn(int columnIndex,
List l)
Adds a column at the columnIndex of the model use the specified list. |
void |
addColumn(List l)
Adds a column at the end of the model use the specified list. |
void |
addRow(int firstRow,
int lastRow,
List[] l)
Adds row from firstRow to lastRow use
the specified list. |
void |
addRow(int rowIndex,
List l)
Adds a row at the rowIndex of the model use the specified list. |
void |
addRow(List l)
Adds a row to the end of the model use the specified list. |
boolean |
clear(Cell c)
Clears the cell data for the specified cell area c. |
boolean |
clearCellAttributes(Cell c)
Clears the cell attributes for the specified cell area c. |
boolean |
clearCellClass(Cell c)
Clears the cell class for the specified cell area c. |
boolean |
clearCellEditable(Cell c)
Clears the cell editable for the specified cell area c. |
boolean |
clearValue(Cell c)
Clears the cell value for the specified cell area c. |
boolean |
equals(Object o)
|
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. |
boolean |
fillCellClass(Cell c,
List[] l)
Fills the cell class of the cell area c use the specified data. |
boolean |
fillCellEditable(Cell c,
List[] l)
Fills the cell editable of the cell area c use the specified data. |
boolean |
fillValue(Cell c,
List[] l)
Fills the value of the cell area c use the specified data. |
AttributeSet |
getCellAttributes(int rowIndex,
int columnIndex)
Returns the cell attributes. |
Class |
getCellClass(int rowIndex,
int columnIndex)
Returns the cell class. |
Boolean |
getCellEditable(int rowIndex,
int columnIndex)
Returns the editable property for the specified cell at rowIndex and
columnIndex. |
Class |
getColumnClass(int columnIndex)
Returns the most specific superclass for all the cell values in the column. |
int |
getColumnCount()
Returns the number of columns in the model. |
String |
getColumnName(int columnIndex)
Returns the name of the column at columnIndex. |
Cell[] |
getFormulaCells()
Returns all formula cells. |
int |
getRowCount()
Returns the number of rows in the model. |
Object |
getValueAt(int rowIndex,
int columnIndex)
Returns the value for the cell at columnIndex and
rowIndex. |
int |
hashCode()
|
boolean |
isCellEditable(int rowIndex,
int columnIndex)
Returns true if the cell at rowIndex and
columnIndex
is editable. |
boolean |
move(Cell from,
Cell to)
Moves the cell area from to to. |
void |
removeColumn(int columnIndex)
Removes a column at the columnIndex of the model. |
void |
removeColumn(int firstColumn,
int lastColumn)
Removes column from firstColumn to lastColumn. |
void |
removeRow(int rowIndex)
Removes a row at the rowIndex of the model. |
void |
removeRow(int firstRow,
int lastRow)
Removes row from firstRow to lastRow |
void |
setCellAttributes(AttributeSet attributes,
Cell c)
Sets the cell attributes. |
void |
setCellAttributes(AttributeSet attributes,
int rowIndex,
int columnIndex)
Sets the cell attributes. |
void |
setCellClass(Class cc,
Cell c)
Sets the cell class. |
void |
setCellClass(Class c,
int rowIndex,
int columnIndex)
Sets the cell class. |
void |
setCellEditable(boolean editable,
Cell c)
Sets the cell editable. |
void |
setCellEditable(boolean editable,
int rowIndex,
int columnIndex)
Sets the editable value for the specified cell at rowIndex and
columnIndex. |
void |
setColumnClass(Class c,
int columnIndex)
Sets the column class for the specified columnIndex. |
void |
setColumnCount(int columnCount)
Sets the number of columns in the model. |
void |
setColumnName(String name,
int columnIndex)
Sets the column name for the specified columnIndex. |
void |
setRowCount(int rowCount)
Sets the number of rows in the model. |
void |
setValueAt(Object aValue,
Cell c)
Sets the cell value. |
void |
setValueAt(Object aValue,
int rowIndex,
int columnIndex)
Sets the value in the cell at columnIndex and
rowIndex to aValue. |
boolean |
sort(Cell c,
boolean ascending)
Sorts the cell area.Returns true if this model changes
as a result of the call. |
boolean |
sort(Cell c,
boolean[] orders,
int[] keys,
boolean byColumn)
Sorts the cell area. |
boolean |
sort(Cell c,
boolean[] orders,
int[] keys,
boolean byColumn,
boolean ignoreBlank)
Sorts the cell area. |
boolean |
sort(Cell c,
boolean ascending,
int index,
boolean byColumn)
Sorts the cell area. |
boolean |
sort(Cell c,
boolean ascending,
int index,
boolean byColumn,
boolean ignoreBlank)
Sorts the cell area. |
DataGridModel |
toModel(Cell c)
Converts the cell area to the model. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultDataGridModel()
public DefaultDataGridModel(int rowCount,
int columnCount)
rowCount rows
and columnCount columns.
| Method Detail |
|---|
public void addRow(List l)
l - the specified listaddRow(int,List),
removeRow(int)
public void addRow(int rowIndex,
List l)
rowIndex - the rowIndexl - the specified listaddRow(List),
removeRow(int)
public void addRow(int firstRow,
int lastRow,
List[] l)
firstRow to lastRow use
the specified list.
firstRow - the first row indexlastRow - the last row indexl - the specified list datapublic void removeRow(int rowIndex)
rowIndex - the rowIndexaddRow(List),
addRow(int,List)
public void removeRow(int firstRow,
int lastRow)
firstRow to lastRow
firstRow - the first row indexlastRow - the last row indexpublic void addColumn(List l)
l - the specified listaddColumn(int,List),
removeColumn(int)
public void addColumn(int columnIndex,
List l)
columnIndex - the column indexl - the specified listaddColumn(List),
removeColumn(int)
public void addColumn(int firstColumn,
int lastColumn,
List[] l)
firstColumn to lastColumn
use the specified list data.
firstColumn - the first column indexlastColumn - the last column indexl - the specified list datapublic void removeColumn(int columnIndex)
columnIndex - the column indexaddColumn(List),
addColumn(int,List)
public void removeColumn(int firstColumn,
int lastColumn)
firstColumn to lastColumn.
firstColumn - the first column indexlastColumn - the last column indexpublic int getRowCount()
JTable uses this method to determine how many rows it
should display. This method should be quick, as it
is called frequently during rendering.
getRowCount in interface TableModelgetColumnCount(),
setColumnCount(int),
getColumnCount()public void setRowCount(int rowCount)
setRowCount in interface DataGridModelrowCount - the number of rows in the modelgetRowCount(),
setColumnCount(int),
getColumnCount()public int getColumnCount()
JTable uses this method to determine how many columns it
should create and display by default.
getColumnCount in interface TableModelgetRowCount(),
setRowCount(int),
setColumnCount(int)public void setColumnCount(int columnCount)
setColumnCount in interface DataGridModelcolumnCount - the number of columns in the modelgetRowCount(),
setRowCount(int),
getColumnCount()public String getColumnName(int columnIndex)
columnIndex. This is used
to initialize the table's column header name. Note: this name does
not need to be unique; two columns in a table can have the same name.
getColumnName in interface TableModelgetColumnName in class AbstractDataGridModelcolumnIndex - the index of the column
setColumnName(String,int)
public void setColumnName(String name,
int columnIndex)
columnIndex.
setColumnName in interface DataGridModelname - the column namecolumnIndex - the specified columnIndexgetColumnName(int)public Class getColumnClass(int columnIndex)
JTable to set up a
default renderer and editor for the column.
getColumnClass in interface TableModelgetColumnClass in class AbstractDataGridModelcolumnIndex - the index of the column
setColumnClass(Class,int)
public void setColumnClass(Class c,
int columnIndex)
columnIndex.
setColumnClass in interface DataGridModelc - the column classcolumnIndex - the specified columnIndexgetColumnClass(int)public Cell[] getFormulaCells()
getFormulaCells in class AbstractDataGridModel
public boolean sort(Cell c,
boolean ascending)
true if this model changes
as a result of the call. (Returns false if this model
does not permit such operation.)
Note:Current only support single column or row sorting. Multiple cell sorting may be supported in the future.
c - the cell areaascending - the sort direction
public boolean sort(Cell c,
boolean ascending,
int index,
boolean byColumn)
true if this model changes
as a result of the call. (Returns false if this model
does not change.)
Note:The index is in cell coordinate
c - the cell areaascending - the sort directionindex - the sort lead indexbyColumn - the sort orientation
public boolean sort(Cell c,
boolean ascending,
int index,
boolean byColumn,
boolean ignoreBlank)
true if this model changes
as a result of the call. (Returns false if this model
does not change.)
Note:The index is in cell coordinate
c - the cell areaascending - the sort directionindex - the sort lead indexbyColumn - the sort orientationignoreBlank - true if ignore the blank cell when sorting
public boolean sort(Cell c,
boolean[] orders,
int[] keys,
boolean byColumn)
true if this model changes
as a result of the call. (Returns false if this model
does not change.)
Note:The index is in cell coordinate
c - the cell areaorders - the sort directionkeys - the sort key indexbyColumn - the sort orientation
public boolean sort(Cell c,
boolean[] orders,
int[] keys,
boolean byColumn,
boolean ignoreBlank)
true if this model changes
as a result of the call. (Returns false if this model
does not change.)
Note:The index is in cell coordinate
c - the cell areaorders - the sort directionkeys - the sort key indexbyColumn - the sort orientationignoreBlank - true if ignore the blank cell when sorting
public boolean move(Cell from,
Cell to)
from to to.
The from cell area will clear.
from - the from cell areato - the to cell area
IllegalArgumentException - if the cell area is not same
width and height or out of the model row and column count
public boolean fillCellAttributes(Cell c,
List[] l)
c use the specified data.
fillCellAttributes in class AbstractDataGridModelc - the cell areal - the cell data
IllegalArgumentException - if the cell area
out of the model row and column count or list data is not enough
public boolean fillCellClass(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 enough
public boolean fillCellEditable(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 enough
public boolean fillValue(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 enough
public boolean fill(Cell c,
TableModel model)
c use the specified data.
fill in class AbstractDataGridModelc - the cell areamodel - the cell data
public DataGridModel toModel(Cell c)
toModel in class AbstractDataGridModelc - the cell area
public boolean clear(Cell c)
c.
clear in class AbstractDataGridModelc - the cell area
public boolean clearCellAttributes(Cell c)
c.
c - the cell area
public boolean clearCellClass(Cell c)
c.
c - the cell area
public boolean clearCellEditable(Cell c)
c.
c - the cell area
public boolean clearValue(Cell c)
c.
c - the cell area
public void setCellAttributes(AttributeSet attributes,
Cell c)
setCellAttributes in class AbstractDataGridModelattributes - the cell attributesc - the cell areagetCellAttributes(int, int)
public void setCellClass(Class cc,
Cell c)
setCellClass in class AbstractDataGridModelcc - the cell classc - the cell areagetCellClass(int, int)
public void setCellEditable(boolean editable,
Cell c)
editable - the cell editablec - the cell areaisCellEditable(int, int)
public void setValueAt(Object aValue,
Cell c)
aValue - the cell valuec - the cell areagetValueAt(int, int)
public AttributeSet getCellAttributes(int rowIndex,
int columnIndex)
getCellAttributes in interface DataGridModelrowIndex - the index of the rowcolumnIndex - the index of the column
setCellAttributes(javax.swing.text.AttributeSet, com.zfqjava.swing.cell.Cell)
public void setCellAttributes(AttributeSet attributes,
int rowIndex,
int columnIndex)
setCellAttributes in interface DataGridModelattributes - the cell attributesrowIndex - the index of the rowcolumnIndex - the index of the columngetCellAttributes(int, int)
public Class getCellClass(int rowIndex,
int columnIndex)
getCellClass in interface DataGridModelrowIndex - the index of the rowcolumnIndex - the index of the column
setCellClass(java.lang.Class, com.zfqjava.swing.cell.Cell)
public void setCellClass(Class c,
int rowIndex,
int columnIndex)
setCellClass in interface DataGridModelc - the class for the specified cellrowIndex - the index of the rowcolumnIndex - the index of the columngetCellClass(int, int)
public boolean isCellEditable(int rowIndex,
int columnIndex)
rowIndex and
columnIndex
is editable. Otherwise, setValueAt on the cell will not
change the value of that cell.
isCellEditable in interface TableModelrowIndex - the row whose value to be queriedcolumnIndex - the column whose value to be queried
setValueAt(java.lang.Object, com.zfqjava.swing.cell.Cell),
setCellEditable(boolean,int,int)
public Boolean getCellEditable(int rowIndex,
int columnIndex)
AbstractDataGridModelrowIndex and
columnIndex.
getCellEditable in class AbstractDataGridModelrowIndex - 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 setCellEditable(boolean editable,
int rowIndex,
int columnIndex)
rowIndex and
columnIndex.
setCellEditable in interface DataGridModeleditable - the cell editable valuerowIndex - the row whose value to be queriedcolumnIndex - the column whose value to be queriedsetValueAt(java.lang.Object, com.zfqjava.swing.cell.Cell),
isCellEditable(int,int)
public Object getValueAt(int rowIndex,
int columnIndex)
columnIndex and
rowIndex.
getValueAt in interface TableModelrowIndex - the row whose value is to be queriedcolumnIndex - the column whose value is to be queried
setValueAt(java.lang.Object, com.zfqjava.swing.cell.Cell),
isCellEditable(int, int),
setCellEditable(boolean,int,int)
public void setValueAt(Object aValue,
int rowIndex,
int columnIndex)
columnIndex and
rowIndex to aValue.
setValueAt in interface TableModelaValue - the new valuerowIndex - the row whose value is to be changedcolumnIndex - the column whose value is to be changedgetValueAt(int, int),
isCellEditable(int, int),
setCellEditable(boolean,int,int)public boolean equals(Object o)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic String toString()
toString in class Object
|
JComponentPack 1.5.0 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||