|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.zfqjava.swing.AbstractDataGridModel | +--com.zfqjava.swing.DefaultDataGridModel
DefaultDataGridModel
provides a default data grid model.
Note:All methods with Cell
parameter pass null value will
throws java.lang.NullPointerException
.
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,
java.util.List[] l)
Adds column from firstColumn to lastColumn
use the specified list data. |
void |
addColumn(int columnIndex,
java.util.List l)
Adds a column at the columnIndex of the model use the specified list. |
void |
addColumn(java.util.List l)
Adds a column at the end of the model use the specified list. |
void |
addRow(int firstRow,
int lastRow,
java.util.List[] l)
Adds row from firstRow to lastRow use
the specified list. |
void |
addRow(int rowIndex,
java.util.List l)
Adds a row at the rowIndex of the model use the specified list. |
void |
addRow(java.util.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(java.lang.Object o)
|
boolean |
fillCellAttributes(Cell c,
java.util.List[] l)
Fills the cell attributes of the cell area c use the specified data. |
boolean |
fillCellClass(Cell c,
java.util.List[] l)
Fills the cell class of the cell area c use the specified data. |
boolean |
fillCellEditable(Cell c,
java.util.List[] l)
Fills the cell editable of the cell area c use the specified data. |
boolean |
fillValue(Cell c,
java.util.List[] l)
Fills the value of the cell area c use the specified data. |
javax.swing.text.AttributeSet |
getCellAttributes(int rowIndex,
int columnIndex)
Returns the cell attributes. |
java.lang.Class |
getCellClass(int rowIndex,
int columnIndex)
Returns the cell class. |
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. |
java.lang.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. |
java.lang.String |
getColumnName(int columnIndex)
Returns the name of the column at columnIndex . |
int |
getRowCount()
Returns the number of rows in the model. |
Cell[] |
getSpannedCells()
Returns all spanned cells. |
java.lang.Object |
getValueAt(int rowIndex,
int columnIndex)
Returns the value for the cell at columnIndex and
rowIndex . |
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. |
int |
hashCode()
|
boolean |
isCellEditable(int rowIndex,
int columnIndex)
Returns true if the cell at rowIndex and
columnIndex
is editable. |
boolean |
isSpannedCell(Cell c)
Determines whether the cell is spanned cell. |
boolean |
merge(Cell c)
Merges the cell. |
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(javax.swing.text.AttributeSet attributes,
Cell c)
Sets the cell attributes. |
void |
setCellAttributes(javax.swing.text.AttributeSet attributes,
int rowIndex,
int columnIndex)
Sets the cell attributes. |
void |
setCellClass(java.lang.Class cc,
Cell c)
Sets the cell class. |
void |
setCellClass(java.lang.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(java.lang.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(java.lang.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(java.lang.Object aValue,
Cell c)
Sets the cell value. |
void |
setValueAt(java.lang.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 |
split(Cell c)
Splits the cell. |
java.lang.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(java.util.List l)
l
- the specified listaddRow(int,List)
,
removeRow(int)
public void addRow(int rowIndex, java.util.List l)
rowIndex
- the rowIndexl
- the specified listaddRow(List)
,
removeRow(int)
public void addRow(int firstRow, int lastRow, java.util.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
- Parameters:
firstRow
- the first row indexlastRow
- the last row index- Since:
- JDataGrid 1.1
public void addColumn(java.util.List l)
l
- the specified listaddColumn(int,List)
,
removeColumn(int)
public void addColumn(int columnIndex, java.util.List l)
columnIndex
- the column indexl
- the specified listaddColumn(List)
,
removeColumn(int)
public void addColumn(int firstColumn, int lastColumn, java.util.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.getColumnCount()
,
setColumnCount(int)
,
getColumnCount()
public void setRowCount(int rowCount)
rowCount
- 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.getRowCount()
,
setRowCount(int)
,
setColumnCount(int)
public void setColumnCount(int columnCount)
columnCount
- the number of columns in the modelgetRowCount()
,
setRowCount(int)
,
getColumnCount()
public java.lang.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 class AbstractDataGridModel
columnIndex
- the index of the columnsetColumnName(String,int)
public void setColumnName(java.lang.String name, int columnIndex)
columnIndex
.name
- the column namecolumnIndex
- the specified columnIndex
getColumnName(int)
public java.lang.Class getColumnClass(int columnIndex)
JTable
to set up a
default renderer and editor for the column.getColumnClass
in class AbstractDataGridModel
columnIndex
- the index of the columnsetColumnClass(Class,int)
public void setColumnClass(java.lang.Class c, int columnIndex)
columnIndex
.c
- the column classcolumnIndex
- the specified columnIndex
getColumnClass(int)
public boolean hasCellSpans(int rowIndex, int columnIndex)
rowIndex
and columnIndex
.rowIndex
- the row index of the specified cellcolumnIndex
- the column index of the specified cellgetCellSpans(int,int)
public Cell getCellSpans(int rowIndex, int columnIndex)
rowIndex
and columnIndex
.rowIndex
- the row index of the specified cellcolumnIndex
- the column index of the specified cellhasCellSpans(int,int)
public boolean hasCellSpans(int firstRow, int lastRow, int firstColumn, int lastColumn)
Note:Some cell spans the area can have row and column index out of the area index.
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 areagetCellSpans(int,int,int,int)
public Cell[] getCellSpans(int firstRow, int lastRow, int firstColumn, int lastColumn)
Note:Some cell spans the area can have row and column index out of the area index.
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 areahasCellSpans(int,int,int,int)
public boolean isSpannedCell(Cell c)
c
- the cellmerge(Cell)
.public Cell[] getSpannedCells()
merge(Cell)
.public boolean merge(Cell c)
true
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.)c
- the cellsplit(com.zfqjava.swing.cell.Cell)
public boolean split(Cell c)
true
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.)c
- the cellmerge(com.zfqjava.swing.cell.Cell)
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 directionpublic boolean move(Cell from, Cell to)
from
to to
.
The from
cell area will clear.from
- the from
cell areato
- the to
cell areajava.lang.IllegalArgumentException
- if the cell area is not same
width and height or out of the model row and column countpublic boolean fillCellAttributes(Cell c, java.util.List[] l)
c
use the specified data.c
- the cell areal
- the cell datajava.lang.IllegalArgumentException
- if the cell area
out of the model row and column count or list data is not enoughpublic boolean fillCellClass(Cell c, java.util.List[] l)
c
use the specified data.c
- the cell areal
- the cell datajava.lang.IllegalArgumentException
- if the cell area
out of the model row and column count or list data is not enoughpublic boolean fillCellEditable(Cell c, java.util.List[] l)
c
use the specified data.c
- the cell areal
- the cell datajava.lang.IllegalArgumentException
- if the cell area
out of the model row and column count or list data is not enoughpublic boolean fillValue(Cell c, java.util.List[] l)
c
use the specified data.c
- the cell areal
- the cell datajava.lang.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 areapublic boolean clearCellAttributes(Cell c)
c
.c
- the cell areapublic boolean clearCellClass(Cell c)
c
.c
- the cell areapublic boolean clearCellEditable(Cell c)
c
.c
- the cell areapublic boolean clearValue(Cell c)
c
.c
- the cell areapublic void setCellAttributes(javax.swing.text.AttributeSet attributes, Cell c)
attributes
- the cell attributesc
- the cell areagetCellAttributes(int, int)
public void setCellClass(java.lang.Class cc, Cell c)
class
- 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(java.lang.Object aValue, Cell c)
aValue
- the cell valuec
- the cell area#getValutAt
public javax.swing.text.AttributeSet getCellAttributes(int rowIndex, int columnIndex)
rowIndex
- the index of the rowcolumnIndex
- the index of the columnsetCellAttributes(javax.swing.text.AttributeSet, com.zfqjava.swing.cell.Cell)
public void setCellAttributes(javax.swing.text.AttributeSet attributes, int rowIndex, int columnIndex)
attributes
- the cell attributesrowIndex
- the index of the rowcolumnIndex
- the index of the columngetCellAttributes(int, int)
public java.lang.Class getCellClass(int rowIndex, int columnIndex)
rowIndex
- the index of the rowcolumnIndex
- the index of the columnsetCellClass(java.lang.Class, com.zfqjava.swing.cell.Cell)
public void setCellClass(java.lang.Class c, int rowIndex, int columnIndex)
c
- 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.rowIndex
- the row whose value to be queriedcolumnIndex
- the column whose value to be queriedsetValueAt(java.lang.Object, com.zfqjava.swing.cell.Cell)
,
setCellEditable(boolean,int,int)
public void setCellEditable(boolean editable, int rowIndex, int columnIndex)
rowIndex
and
columnIndex
.editable
- 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 java.lang.Object getValueAt(int rowIndex, int columnIndex)
columnIndex
and
rowIndex
.rowIndex
- the row whose value is to be queriedcolumnIndex
- the column whose value is to be queriedsetValueAt(java.lang.Object, com.zfqjava.swing.cell.Cell)
,
isCellEditable(int, int)
,
setCellEditable(boolean,int,int)
public void setValueAt(java.lang.Object aValue, int rowIndex, int columnIndex)
columnIndex
and
rowIndex
to aValue
.aValue
- 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(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |