EspressReport 6.6

quadbase.util
Class SimpleSpreadSheet

java.lang.Object
  extended by quadbase.util.SimpleSpreadSheet
All Implemented Interfaces:
ISpreadSheetModel

public class SimpleSpreadSheet
extends java.lang.Object
implements 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:
ISpreadSheetModel

Constructor Summary
SimpleSpreadSheet()
          Default constructor
SimpleSpreadSheet(java.lang.Object[] rowVals, java.lang.Object[] columnVals, java.lang.Object[][] vals)
          A more Convenient constructor that can support almost any type
SimpleSpreadSheet(java.lang.String[] rowVals, java.lang.String[] columnVals, java.lang.Double[][] vals)
          Convenient constructor for strings and double spreadsheet
SimpleSpreadSheet(java.lang.String[] rowVals, java.lang.String[] columnVals, java.lang.Integer[][] vals)
          Convenient constructor for strings and integer spreadsheet
 
Method Summary
 void addSpreadSheetModelListener(ISpreadSheetModelListener l)
          Adds the given listener to the listener list
protected  void fireSpreadSheetChanged(SpreadSheetModelEvent e)
          Notifies all listeners of the given event
 int getColumnCount()
          Returns the number of columns (except the row labels)
 java.lang.Object getColumnLabel(int i)
          Get the label for the given column
 int getColumnLabelType()
          Returns the data type of the column labels
 int getRowCount()
          Returns the number of rows
 java.lang.Object getRowLabel(int i)
          Get the label for the given row
 int getRowLabelType()
          Returns the data type of the row labels
 java.lang.Object getValueAt(int i, int j)
          Get the value at a given row and column indexes (beginning at 1)
 int getValueType()
          Returns the data type of the values
 void removeSpreadSheetModelListener(ISpreadSheetModelListener l)
          Removes the given listener from the listener list
 void setCellValue(int i, int j, java.lang.Object x)
          Assign value to cell.
 void setColumnInfo(int sqlType, java.lang.Object[] columnVals)
          Set the column cell information Please use setColumnInfo(Object[] columnVals, Object[][] vals) if array size is changed
 void setColumnInfo(java.lang.Object[] columnVals, java.lang.Object[][] vals)
          Set column labels and value cells
 void setRowInfo(int sqlType, java.lang.Object[] rowVals)
          Set the row cell information.
 void setRowInfo(java.lang.Object[] rowVals, java.lang.Object[][] vals)
          Set row labels and value cells
 void setValueInfo(int sqlType, java.lang.Object[][] vals)
          Set the value cell information
 void setValueInfo(java.lang.Object[] rowVals, java.lang.Object[] columnVals, java.lang.Object[][] vals)
          Reset the whole spread sheet
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleSpreadSheet

public SimpleSpreadSheet()
Default constructor


SimpleSpreadSheet

public SimpleSpreadSheet(java.lang.String[] rowVals,
                         java.lang.String[] columnVals,
                         java.lang.Double[][] vals)
Convenient constructor for strings and double spreadsheet


SimpleSpreadSheet

public SimpleSpreadSheet(java.lang.String[] rowVals,
                         java.lang.String[] columnVals,
                         java.lang.Integer[][] vals)
Convenient constructor for strings and integer spreadsheet


SimpleSpreadSheet

public SimpleSpreadSheet(java.lang.Object[] rowVals,
                         java.lang.Object[] columnVals,
                         java.lang.Object[][] vals)
                  throws java.lang.IllegalArgumentException
A more Convenient constructor that can support almost any type

Throws:
java.lang.IllegalArgumentException
Method Detail

setRowInfo

public void setRowInfo(int sqlType,
                       java.lang.Object[] rowVals)
Set the row cell information. Please use setRowInfo(Object[] rowVals, Object[][] vals) if array size is changed


setRowInfo

public void setRowInfo(java.lang.Object[] rowVals,
                       java.lang.Object[][] vals)
                throws java.lang.IllegalArgumentException
Set row labels and value cells

Throws:
java.lang.IllegalArgumentException

setColumnInfo

public void setColumnInfo(int sqlType,
                          java.lang.Object[] columnVals)
Set the column cell information Please use setColumnInfo(Object[] columnVals, Object[][] vals) if array size is changed


setColumnInfo

public void setColumnInfo(java.lang.Object[] columnVals,
                          java.lang.Object[][] vals)
                   throws java.lang.IllegalArgumentException
Set column labels and value cells

Throws:
java.lang.IllegalArgumentException

setValueInfo

public void setValueInfo(int sqlType,
                         java.lang.Object[][] vals)
Set the value cell information


setValueInfo

public void setValueInfo(java.lang.Object[] rowVals,
                         java.lang.Object[] columnVals,
                         java.lang.Object[][] vals)
                  throws java.lang.IllegalArgumentException
Reset the whole spread sheet

Throws:
java.lang.IllegalArgumentException

setCellValue

public void setCellValue(int i,
                         int j,
                         java.lang.Object x)
Assign value to cell.


getColumnCount

public int getColumnCount()
Description copied from interface: ISpreadSheetModel
Returns the number of columns (except the row labels)

Specified by:
getColumnCount in interface ISpreadSheetModel

getRowCount

public int getRowCount()
Description copied from interface: ISpreadSheetModel
Returns the number of rows

Specified by:
getRowCount in interface ISpreadSheetModel

getColumnLabelType

public int getColumnLabelType()
Description copied from interface: ISpreadSheetModel
Returns the data type of the column labels

Specified by:
getColumnLabelType in interface ISpreadSheetModel

getRowLabelType

public int getRowLabelType()
Description copied from interface: ISpreadSheetModel
Returns the data type of the row labels

Specified by:
getRowLabelType in interface ISpreadSheetModel

getValueType

public int getValueType()
Description copied from interface: ISpreadSheetModel
Returns the data type of the values

Specified by:
getValueType in interface ISpreadSheetModel

getRowLabel

public java.lang.Object getRowLabel(int i)
Get the label for the given row

Specified by:
getRowLabel in interface ISpreadSheetModel
Parameters:
i - the row index (beginning at 1)

getColumnLabel

public java.lang.Object getColumnLabel(int i)
Get the label for the given column

Specified by:
getColumnLabel in interface ISpreadSheetModel

getValueAt

public java.lang.Object getValueAt(int i,
                                   int j)
Get the value at a given row and column indexes (beginning at 1)

Specified by:
getValueAt in interface ISpreadSheetModel
Parameters:
i - the row index (beginning at 1)

addSpreadSheetModelListener

public void addSpreadSheetModelListener(ISpreadSheetModelListener l)
Adds the given listener to the listener list

Specified by:
addSpreadSheetModelListener in interface ISpreadSheetModel

removeSpreadSheetModelListener

public void removeSpreadSheetModelListener(ISpreadSheetModelListener l)
Removes the given listener from the listener list

Specified by:
removeSpreadSheetModelListener in interface ISpreadSheetModel

fireSpreadSheetChanged

protected void fireSpreadSheetChanged(SpreadSheetModelEvent e)
Notifies all listeners of the given event


EspressReport 6.6