com.ibm.jdg2e.msseditor.core
Class MiniSS

java.lang.Object
  extended bycom.ibm.jdg2e.msseditor.core.MiniSS

public class MiniSS
extends java.lang.Object

Simple model for a "mini-spreadsheet" containing text/integer cell values.

See Also:
MiniSSRow, IMiniSSListener

Field Summary
static int DEFAULT_COLUMN_COUNT
           
static int DEFAULT_ROW_COUNT
           
static int MAX_COLUMN_COUNT
           
static int MAX_DEFAULT_ROW_COUNT
           
 
Constructor Summary
MiniSS(java.io.InputStream is)
          Set the rows based on the content of the provided semi-colon delimited input stream.
MiniSS(int rowCount, int columnCount)
          Return a mini-spreadsheet having dimensions [rows,columns].
 
Method Summary
 void addMiniSpreadsheetListener(IMiniSSListener listener)
          Add the listener.
 void appendRow(int afterIndex)
          Insert a new row at the end.
 void clearAll()
          Set all rows/columns to an empty string.
protected  void fireCellChanged(int row, int column, java.lang.String value)
          Notify interested parties that the mini-spreadsheet has changed.
 int getColumnCount()
          Returns the number of columns.
 int getInt(int row, int column)
          Get the value at [row,column] as an integer or zero if not a value integer format.
 int getRowCount()
          Return the number of rows.
 MiniSSRow[] getRows()
          Return the rows.
 java.lang.String getString(int row, int column)
          Get the value at [row,column] as a string.
 int getTotal()
          Return the total of all integer cells.
 void load(java.io.InputStream is)
          Set the rows based on the content of the provided semi-colon delimited input stream.
 void removeMiniSpreadsheetListener(IMiniSSListener listener)
          Remove the listener.
protected  void removeRow(MiniSSRow msr)
          Remove the given row and notify listeners.
 void save(java.lang.StringBuffer sb)
          Save the current contents in a semi-colon delimited text file.
 void setData(int row, int column, java.lang.String newValue)
          Set the value at [row,column] to a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_COLUMN_COUNT

public static final int DEFAULT_COLUMN_COUNT
See Also:
Constant Field Values

DEFAULT_ROW_COUNT

public static final int DEFAULT_ROW_COUNT
See Also:
Constant Field Values

MAX_COLUMN_COUNT

public static final int MAX_COLUMN_COUNT
See Also:
Constant Field Values

MAX_DEFAULT_ROW_COUNT

public static final int MAX_DEFAULT_ROW_COUNT
See Also:
Constant Field Values
Constructor Detail

MiniSS

public MiniSS(java.io.InputStream is)
       throws org.eclipse.core.runtime.CoreException
Set the rows based on the content of the provided semi-colon delimited input stream.


MiniSS

public MiniSS(int rowCount,
              int columnCount)
Return a mini-spreadsheet having dimensions [rows,columns].

Method Detail

addMiniSpreadsheetListener

public void addMiniSpreadsheetListener(IMiniSSListener listener)
Add the listener.

See Also:
IMiniSSListener

appendRow

public void appendRow(int afterIndex)
Insert a new row at the end.


clearAll

public void clearAll()
Set all rows/columns to an empty string.


fireCellChanged

protected void fireCellChanged(int row,
                               int column,
                               java.lang.String value)
Notify interested parties that the mini-spreadsheet has changed.

See Also:
IMiniSSListener

getColumnCount

public int getColumnCount()
Returns the number of columns.


getInt

public int getInt(int row,
                  int column)
Get the value at [row,column] as an integer or zero if not a value integer format.


getRowCount

public int getRowCount()
Return the number of rows.


getRows

public MiniSSRow[] getRows()
Return the rows.


getString

public java.lang.String getString(int row,
                                  int column)
Get the value at [row,column] as a string.


getTotal

public int getTotal()
Return the total of all integer cells. Invalid cells are treated as zero.


load

public void load(java.io.InputStream is)
          throws org.eclipse.core.runtime.CoreException
Set the rows based on the content of the provided semi-colon delimited input stream.

Throws:
org.eclipse.core.runtime.CoreException

removeMiniSpreadsheetListener

public void removeMiniSpreadsheetListener(IMiniSSListener listener)
Remove the listener.

See Also:
IMiniSSListener

removeRow

protected void removeRow(MiniSSRow msr)
Remove the given row and notify listeners.


save

public void save(java.lang.StringBuffer sb)
Save the current contents in a semi-colon delimited text file.


setData

public void setData(int row,
                    int column,
                    java.lang.String newValue)
Set the value at [row,column] to a string.