public class SpreadsheetImpl extends Object implements Spreadsheet
Spreadsheet
interface.Modifier and Type | Field and Description |
---|---|
static String |
BASE_TITLE
The base of the titles of new spreadsheets
|
Constructor and Description |
---|
SpreadsheetImpl(Workbook workbook,
String title)
Creates a new spreadsheet.
|
SpreadsheetImpl(Workbook workbook,
String title,
String[][] content)
Creates a new spreadsheet, in which cells are initialized with data from
the given content matrix.
|
Modifier and Type | Method and Description |
---|---|
void |
addCellListener(CellListener listener)
Registers the given listener to receive events from all cells in the
spreadsheet.
|
Cell |
getCell(Address address)
Returns the cell at the given address.
|
Cell |
getCell(int column,
int row)
Returns the cell at the given column and row in the spreadsheet.
|
CellListener[] |
getCellListeners()
Returns the cell listeners that have been registered on the spreadsheet.
|
SortedSet<Cell> |
getCells(Address address1,
Address address2)
Returns the cells in the range between the given addresses.
|
Cell[] |
getColumn(int index)
Returns the cells in the given column.
|
int |
getColumnCount()
Returns the number of columns in the spreadsheet.
|
Spreadsheet |
getExtension(String name)
Returns the extension with the given key.
|
Cell[] |
getRow(int index)
Returns the cells in the given row.
|
int |
getRowCount()
Returns the number of rows in the spreadsheet.
|
String |
getTitle()
Returns the title of the spreadsheet.
|
Workbook |
getWorkbook()
Returns the workbook to which the spreadsheet belongs.
|
Iterator<Cell> |
iterator() |
void |
removeCellListener(CellListener listener)
Deregisters the given listener from receiving events from all cells in
the spreadsheet.
|
void |
setTitle(String title)
Sets the title of the spreadsheet.
|
public static final String BASE_TITLE
SpreadsheetImpl(Workbook workbook, String title)
workbook
- the workbook to which the spreadsheet belongstitle
- the title of the spreadsheetSpreadsheetImpl(Workbook workbook, String title, String[][] content)
workbook
- the workbook to which the spreadsheet belongstitle
- the title of the spreadsheetcontent
- the contents of the cells in the spreadsheetpublic Workbook getWorkbook()
Spreadsheet
getWorkbook
in interface Spreadsheet
public String getTitle()
Spreadsheet
getTitle
in interface Spreadsheet
public void setTitle(String title)
Spreadsheet
setTitle
in interface Spreadsheet
title
- the title of the spreadsheet.public int getColumnCount()
Spreadsheet
getColumnCount
in interface Spreadsheet
public int getRowCount()
Spreadsheet
getRowCount
in interface Spreadsheet
public Cell getCell(Address address)
Spreadsheet
getCell
in interface Spreadsheet
address
- the address of the cellpublic Cell getCell(int column, int row)
Spreadsheet
getCell
in interface Spreadsheet
column
- the column index of the cell's locationrow
- the row index of the cell's locationpublic SortedSet<Cell> getCells(Address address1, Address address2)
Spreadsheet
getCells
in interface Spreadsheet
address1
- the address of the cell in one end of the rangeaddress2
- the address of the cell in the other end of the rangepublic Cell[] getColumn(int index)
Spreadsheet
getColumn
in interface Spreadsheet
index
- the index of the columnpublic Cell[] getRow(int index)
Spreadsheet
getRow
in interface Spreadsheet
index
- the index of the rowpublic void addCellListener(CellListener listener)
Spreadsheet
addCellListener
in interface Spreadsheet
listener
- the listener to be addedpublic void removeCellListener(CellListener listener)
Spreadsheet
removeCellListener
in interface Spreadsheet
listener
- the listener to be removedpublic CellListener[] getCellListeners()
Spreadsheet
getCellListeners
in interface Spreadsheet
public Spreadsheet getExtension(String name)
Extensible
getExtension
in interface Extensible<Spreadsheet>
name
- the name of the extension (case-insensitive)