Package quadbase.util
Class SimpleSpreadSheet
java.lang.Object
quadbase.util.SimpleSpreadSheet
- All Implemented Interfaces:
ISpreadSheetModel
This class provides a simple implementation for the ISpreadSheetModel interface. Data is read
from arrays and maintained in memory.
Note : the row and column label array lengths always determine the size of the spreadsheet. The cell values are adjusted accordingly. The cells are initially default to null, and are later assigned as provided in the cell array.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructorSimpleSpreadSheet(Object[] rowVals, Object[] columnVals, Object[][] vals) A more Convenient constructor that can support almost any typeSimpleSpreadSheet(String[] rowVals, String[] columnVals, Double[][] vals) Convenient constructor for strings and double spreadsheetSimpleSpreadSheet(String[] rowVals, String[] columnVals, Integer[][] vals) Convenient constructor for strings and integer spreadsheet -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds the given listener to the listener listprotected voidNotifies all listeners of the given eventintReturns the number of columns (except the row labels)getColumnLabel(int i) Get the label for the given columnintReturns the data type of the column labelsintReturns the number of rowsgetRowLabel(int i) Get the label for the given rowintReturns the data type of the row labelsgetValueAt(int i, int j) Get the value at a given row and column indexes (beginning at 1)intReturns the data type of the valuesvoidRemoves the given listener from the listener listvoidsetCellValue(int i, int j, Object x) Assign value to cell.voidsetColumnInfo(int sqlType, Object[] columnVals) Set the column cell information Please use setColumnInfo(Object[] columnVals, Object[][] vals) if array size is changedvoidsetColumnInfo(Object[] columnVals, Object[][] vals) Set column labels and value cellsvoidsetRowInfo(int sqlType, Object[] rowVals) Set the row cell information.voidsetRowInfo(Object[] rowVals, Object[][] vals) Set row labels and value cellsvoidsetValueInfo(int sqlType, Object[][] vals) Set the value cell informationvoidsetValueInfo(Object[] rowVals, Object[] columnVals, Object[][] vals) Reset the whole spread sheet
-
Constructor Details
-
SimpleSpreadSheet
public SimpleSpreadSheet()Default constructor -
SimpleSpreadSheet
Convenient constructor for strings and double spreadsheet -
SimpleSpreadSheet
Convenient constructor for strings and integer spreadsheet -
SimpleSpreadSheet
public SimpleSpreadSheet(Object[] rowVals, Object[] columnVals, Object[][] vals) throws IllegalArgumentException A more Convenient constructor that can support almost any type- Throws:
IllegalArgumentException
-
-
Method Details
-
setRowInfo
Set the row cell information. Please use setRowInfo(Object[] rowVals, Object[][] vals) if array size is changed -
setRowInfo
Set row labels and value cells- Throws:
IllegalArgumentException
-
setColumnInfo
Set the column cell information Please use setColumnInfo(Object[] columnVals, Object[][] vals) if array size is changed -
setColumnInfo
Set column labels and value cells- Throws:
IllegalArgumentException
-
setValueInfo
Set the value cell information -
setValueInfo
public void setValueInfo(Object[] rowVals, Object[] columnVals, Object[][] vals) throws IllegalArgumentException Reset the whole spread sheet- Throws:
IllegalArgumentException
-
setCellValue
Assign value to cell. -
getColumnCount
public int getColumnCount()Description copied from interface:ISpreadSheetModelReturns the number of columns (except the row labels)- Specified by:
getColumnCountin interfaceISpreadSheetModel
-
getRowCount
public int getRowCount()Description copied from interface:ISpreadSheetModelReturns the number of rows- Specified by:
getRowCountin interfaceISpreadSheetModel
-
getColumnLabelType
public int getColumnLabelType()Description copied from interface:ISpreadSheetModelReturns the data type of the column labels- Specified by:
getColumnLabelTypein interfaceISpreadSheetModel
-
getRowLabelType
public int getRowLabelType()Description copied from interface:ISpreadSheetModelReturns the data type of the row labels- Specified by:
getRowLabelTypein interfaceISpreadSheetModel
-
getValueType
public int getValueType()Description copied from interface:ISpreadSheetModelReturns the data type of the values- Specified by:
getValueTypein interfaceISpreadSheetModel
-
getRowLabel
Get the label for the given row- Specified by:
getRowLabelin interfaceISpreadSheetModel- Parameters:
i- the row index (beginning at 1)
-
getColumnLabel
Get the label for the given column- Specified by:
getColumnLabelin interfaceISpreadSheetModel
-
getValueAt
Get the value at a given row and column indexes (beginning at 1)- Specified by:
getValueAtin interfaceISpreadSheetModel- Parameters:
i- the row index (beginning at 1)
-
addSpreadSheetModelListener
Adds the given listener to the listener list- Specified by:
addSpreadSheetModelListenerin interfaceISpreadSheetModel
-
removeSpreadSheetModelListener
Removes the given listener from the listener list- Specified by:
removeSpreadSheetModelListenerin interfaceISpreadSheetModel
-
fireSpreadSheetChanged
Notifies all listeners of the given event
-