com.f1j.data
Interface DataRangeCollection


public interface DataRangeCollection

This interface defines the API to a collection of data ranges.

See Also:
DataRange, DataSourceCollection

Method Summary
 void delete(DataRange range)
          Deletes a data range from this collection.
 DataRange factory(java.lang.String name, int row, int column)
          Creates a data range and adds it to this collection of data ranges.
 DataRange factory(java.lang.String name, int startRow, int startColumn, int endRow, int endColumn)
          Creates a data range and adds it to this collection of data ranges.
 DataRange find(int row, int column)
          Finds the data range at the intersection of the specified row and column.
 DataRange find(java.lang.String name)
          Finds the data range with the specified name.
 DataRange[] get()
          Returns a list of all the data ranges in the current workbook.
 DataRange getDataRange(int index)
          Returns a specific data range by its index in the collection.
 java.lang.String[] getNames()
          Returns a list of all the data range names in this collection.
 int getSize()
          Returns the number of data ranges in the collection.
 void move(DataQuery query, DataRange range, Sheet sheet, int row, int column)
          Moves a data range to the specified sheet/location and attaches it to the specified data query.
 void move(Source source, DataRange range, Sheet sheet, int row, int column)
          Moves a data range to the specified sheet/location and attaches it to the specified data source.
 void setDataQuery(DataRange range, DataQuery query)
          Associates a data range with a data query.
 void setDataSource(DataRange range, Source source)
          Associates a data range with a data source.
 

Method Detail

delete

public void delete(DataRange range)
            throws F1Exception
Deletes a data range from this collection.
Parameters:
range - the range to delete.
Throws:
F1Exception - if the parameter is invalid
See Also:
DataSourceCollection.delete(com.f1j.data.source.Source)

factory

public DataRange factory(java.lang.String name,
                         int row,
                         int column)
                  throws F1Exception
Creates a data range and adds it to this collection of data ranges. A defined name is created on the sheet using the same name.
Parameters:
name - the symbolic name of the data range being created.
row - an integer specifying the first row of the data range on the worksheet. Rows and columns are indexed beginning with 0.
column - an integer specifying the first column of the data range on the worksheet. Rows and columns are indexed beginning with 0.
Returns:
a DataRange object.
Throws:
F1Exception - if a parameter is invalid
See Also:
DataSourceCollection.factory(java.lang.String, int)

factory

public DataRange factory(java.lang.String name,
                         int startRow,
                         int startColumn,
                         int endRow,
                         int endColumn)
                  throws F1Exception
Creates a data range and adds it to this collection of data ranges. A defined name is created on the sheet using the same name.
Parameters:
name - the symbolic name of the data range being created.
startRow - an integer specifying the first row of the data range on the worksheet. Rows and columns are indexed beginning with 0.
startColumn - an integer specifying the first column of the data range on the worksheet. Rows and columns are indexed beginning with 0.
endRow - an integer specifying the last row of the data range on the worksheet, inclusive. Must be greater than startRow. Rows and columns are indexed beginning with 0.
endColumn - an integer specifying the last column of the data range on the worksheet, inclusive. Must be greater than startColumn. Rows and columns are indexed beginning with 0.
Returns:
a DataRange object.
Throws:
F1Exception - if a parameter is invalid
See Also:
DataSourceCollection.factory(java.lang.String, int)

find

public DataRange find(int row,
                      int column)
Finds the data range at the intersection of the specified row and column.
Parameters:
row - an integer specifying the row. Rows and columns are indexed beginning with 0.
column - an integer specifying the column. Rows and columns are indexed beginning with 0.
Returns:
a DataRange object.
See Also:
find(String name)

find

public DataRange find(java.lang.String name)
Finds the data range with the specified name.
Parameters:
name - range the name to find.
Returns:
a DataRange object.
See Also:
find(int, int), DataRange.setName(java.lang.String)

get

public DataRange[] get()
Returns a list of all the data ranges in the current workbook.
Returns:
an integer array of data range index numbers.
See Also:
getDataRange(int), getNames()

getDataRange

public DataRange getDataRange(int index)
Returns a specific data range by its index in the collection.
Parameters:
index - an integer indicating the index of the data range.
Returns:
a DataRange object.
See Also:
JDBC.setDatabase(java.lang.String), getSize()

getNames

public java.lang.String[] getNames()
Returns a list of all the data range names in this collection.
Returns:
a string array of the data range names.
See Also:
DataSourceCollection.getNames(), DataRange.setName(java.lang.String)

getSize

public int getSize()
Returns the number of data ranges in the collection.
Returns:
an integer indicating the number of data ranges.
See Also:
getDataRange(int)

move

public void move(Source source,
                 DataRange range,
                 Sheet sheet,
                 int row,
                 int column)
          throws F1Exception
Moves a data range to the specified sheet/location and attaches it to the specified data source.
Parameters:
source - the name of the data source (e.g., j_Source) the specified range is attached to.
range - the default or defined object name of the current range of the data source to move (e.g., Sheet1!Query or a defined object name).
sheet - the sheet to contain the target range (may be same as current sheet).
row - an integer indicating the first row of the target range.
column - an integer indicating the first column of the target range.
Throws:
F1Exception - if a parameter is invalid.
See Also:
DataRange.move(int, int)

move

public void move(DataQuery query,
                 DataRange range,
                 Sheet sheet,
                 int row,
                 int column)
          throws F1Exception
Moves a data range to the specified sheet/location and attaches it to the specified data query. Data queries are only used when working with JDBC data sources.
Parameters:
query - a DataQuery object.
range - the default or defined object name of the current range of the data source to move (e.g., Sheet1!Query or a defined object name).
sheet - the sheet to contain the target range (may be same as current sheet).
row - an integer indicating the first row of the target range.
column - an integer indicating the first column of the target range.
Throws:
F1Exception - if a parameter is invalid.
See Also:
move(com.f1j.data.source.Source, com.f1j.data.DataRange, com.f1j.ss.Sheet, int, int)

setDataQuery

public void setDataQuery(DataRange range,
                         DataQuery query)
                  throws F1Exception
Associates a data range with a data query. Note: Attempts to associate multiple ranges with a single query where the ranges have the same name will result in a DUPLICATE_NAME exception.
Parameters:
range - DataRange object to associate with the specified query.
query - the DataQuery object that the range will listen to.
Throws:
F1Exception - if a range with the same name is already attached to the query.
See Also:
DataQuery, DataRangeCollectionImpl.setDataQuery(com.f1j.data.DataRange, com.f1j.data.query.DataQuery)

setDataSource

public void setDataSource(DataRange range,
                          Source source)
Associates a data range with a data source. Note: Attempting to associate multiple ranges with a single query where the ranges have the same name will silently fail.
Parameters:
range - the DataRange object to associate with specified source.
source - the Source object to contain the specified range.
See Also:
DataQueryCollection.getDataSource(), BookModel.getDataSourceCollection()