biz.c24.io.api.presentation.stream
Class SpreadSheet.Locator

java.lang.Object
  extended by biz.c24.io.api.presentation.stream.SpreadSheet.Locator
All Implemented Interfaces:
Cloneable
Enclosing class:
SpreadSheet

public class SpreadSheet.Locator
extends Object
implements Cloneable

Helper class that represents the location of cell within the workbook.

Represents the SpreadSheet cell reference according to used style.


Field Summary
protected  int column
           
protected  int row
           
protected  int sheet
           
 
Constructor Summary
protected SpreadSheet.Locator(int sheet, int row, int column)
          Constructor with sheet index, row and column.
 
Method Summary
 SpreadSheet.Locator add(SpreadSheet.Locator other)
          Update the specified other location by the current, so to represent the movement on certain offset.
 Object clone()
          Returns the clone of this location.
 void extendBy(SpreadSheet.Locator other)
          Update the current location by the specified offset.
 void increaseRow()
           
protected  SpreadSheet.Locator parse(String address)
          Parses the Spreadsheet Cell address from textual form.
 String toExcelForm()
          Returns the textual representation of this location (non-zero based).
 String toString()
          Returns the textual representation of this location (zero based).
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sheet

protected int sheet

row

protected int row

column

protected int column
Constructor Detail

SpreadSheet.Locator

protected SpreadSheet.Locator(int sheet,
                              int row,
                              int column)
Constructor with sheet index, row and column.

Constructs the new location instance with specified sheet index, row and column. The sheet index is zero based index of sheets in current workbook. The negative (-1) value means that it is mean the current sheet and it should be resolved by sheet resolution procedure for correct representation.

Parameters:
sheet - The zero-based index of sheet within current workbook.
row - The zero based index of row withing current sheet.
column - the zero-based index of column within current row.
Method Detail

add

public SpreadSheet.Locator add(SpreadSheet.Locator other)
Update the specified other location by the current, so to represent the movement on certain offset.

Returns the updated location that is increased by this one if it is not null. Otherwise, the cloned current location is returned. Also, depends on nature of provided location, it will be updated or not. The absolute location (i.e. with specified sheet that is differ from current) is returned without any changes.

Parameters:
other - the location that is assumed as new location, updated by this one.
Returns:
The new location that is result of movement from current one on provided offset.

extendBy

public void extendBy(SpreadSheet.Locator other)
Update the current location by the specified offset.

Extends the current location by specified other one. So, this location will keep the maximal values of row and column withing current sheet. (I.e. if specified other located on other sheet the update will not happened.)

Parameters:
other - The location by which this location should be extend. May be null.

toString

public String toString()
Returns the textual representation of this location (zero based).

Used rather for debug purposes. Unlike the another textual representation returns the zero-based representation of row / column addressing.

Overrides:
toString in class Object
Returns:
The textual representation of this location (zero-based).

toExcelForm

public String toExcelForm()
Returns the textual representation of this location (non-zero based).

Used rather for debug purposes. Unlike the another textual representation returns the non-zero based representation of row / column addressing.

Returns:
The textual representation of this location (zero-based).

clone

public Object clone()
Returns the clone of this location.

This clone support implementation used the standard clone support contract but it is subject of change (In the JVM before 1.5 there was a problem with native clone implementation so construction of new was better.)

Overrides:
clone in class Object
Returns:
The cloned location instance.
Throws:
Error - if cloning failed to do.

parse

protected SpreadSheet.Locator parse(String address)
Parses the Spreadsheet Cell address from textual form.

Parameters:
address - The cell address to be parsed.
Returns:
The address instance that points on addressed cell.
Throws:
NullPointerException - If provided address is empty or null
IllegalArgumentException - If provided address is invalid.
IndexOutOfBoundsException - If provided address referred the absent sheet.

increaseRow

public void increaseRow()


C24 Technologies © 2002-2012: All Rights Reserved.