OpenAPI 1.0

com.aquafold.openapi.data
Interface AQDataSet


public interface AQDataSet

Collection of AQDataRows stored in memory. An instance of this object can be constructed by calling one of the aqua.data.newDataSet() methods.

Sorting

This data set object supports sorting. In order to sort the set, sorting criteria must be established by calling setSorting*** method for a desired column, followed by sort() method. The sorting criteria can be set for more than one column, in which case the sorting priority will be determined by the order of setSorting*** calls.
Sorting re-orders data rows within the data set.


Method Summary
 void add(AQDataRow row)
          Append a new row at the end of the data set.
 AQDataRow addRow()
          Add a new row to the end of the list of rows.
 AQDataRow addRowWithValues(Object... values)
          Add a new row with the specified column values at the end of the data set.
 void append(AQDataSet data)
          Appends another data set.
 void clear()
          Removes all of the elements from this list.
 void clearSorting()
          Clears the sorting criteria set on the columns previously with setSortingXXX() methods.
 AQDataRow get(int index)
          Returns the data row at the specified position.
 byte[] getAsExcel2003()
          Returns the data set as a byte array representing an Excel 2003 file.
 byte[] getAsExcel2003(AQDataSetSettings settings, AQChart chart)
          Returns the data set, with chart enabled, as a byte array representing an Excel 2003 file.
 byte[] getAsExcel2007()
          Returns the data set as a byte array representing an Excel 2007 file.
 byte[] getAsExcel2007(AQDataSetSettings settings, AQChart chart)
          Returns the data set, with chart enabled, as a byte array representing an Excel 2007 file.
 int getColumnCount()
          Returns number of columns in this data set.
 String[] getColumnNames()
          Returns an array of column names.
 AQColumnStructure getColumnStructure()
          Returns column structure information.
 AQDataReader getReader()
          Creates a new reader (with its own cursor) suitable for sequential access.
 int getRowCount()
          Returns the number of rows in this data set.
 Object getValueAt(int rowIndex, int columnIndex)
          Returns the data value at columnIndex and rowIndex.
 void importData(AQDataReader in)
          Imports data row by row, performing necessary structural conversion.
 void insert(int index, AQDataRow row)
          Insert row at the specified index.
 AQDataRow insertRow(int index)
          Insert a new row at specified index.
 AQDataRow insertRowWithValues(int index, Object... values)
          Insert a new row at specified index with the specified column values.
 boolean isSortingAscending(int column)
          Returns true if the specified column has been configured for sorting in ascending direction.
 boolean isSortingAscending(String column)
          Returns true if the specified column has been configured for sorting in ascending direction.
 boolean isSortingDescending(int column)
          Returns true if the specified column has been configured for sorting in descending direction.
 boolean isSortingDescending(String column)
          Returns true if the specified column has been configured for sorting in descending direction.
 boolean isSortingNone(int column)
          Returns true if the specified column has no sorting configured.
 boolean isSortingNone(String column)
          Returns true if the specified column has no sorting configured.
 void read(AQDataReader in)
          Reads in data from a data stream.
 AQDataRow remove(int index)
          Removes the element at the specified position in the data set.
 String renderHtml()
          Converts the data set to a HTML document using the default grid settings.
 String renderHtml(AQDataSetSettings settings)
          Converts the data set to a HTML document using the specified grid settings.
 String renderHtml(AQDataSetSettings settings, AQChart chart)
          Converts the data set to a HTML document, with chart enabled, using the specified grid settings.
 String renderText()
          Converts the data set to a formatted plain text grid using the default grid settings.
 String renderText(AQDataSetSettings settings)
          Converts the data set to a formatted plain text grid using the specified grid settings.
 String renderText(int lineCount)
          Converts the data set, up to lineCount rows, to a formatted plain text grid using the default grid settings.
 void saveAsExcel2003(String filename)
          Saves the data set to an Excel2003 file.
 void saveAsExcel2003(String fileName, AQDataSetSettings settings, AQChart chart)
          Saves the data set, with chart enabled, as an Excel 2003 file.
 void saveAsExcel2007(String filename)
          Saves the data set to an Excel2007 file.
 void saveAsExcel2007(String fileName, AQDataSetSettings settings, AQChart chart)
          Saves the data set, with chart enabled, as an Excel 2007 file.
 void setColumnNames(String[] columnNames)
          Sets column names.
 void setSortingAscending(int column)
          Sets ascending sorting direction for the specified column.
 void setSortingAscending(String column)
          Sets ascending sorting direction for the specified column.
 void setSortingCollator(int column, Collator collator)
          Sets collator for the specified column.
 void setSortingCollator(String column, Collator collator)
          Sets collator for the specified column.
 void setSortingDescending(int column)
          Sets descending sorting direction for the specified column.
 void setSortingDescending(String column)
          Sets descending sorting direction for the specified column.
 void setSortingNone(int column)
          Sets no sorting for the specified column, discarding any sorting options set for that column.
 void setSortingNone(String column)
          Sets no sorting for the specified column, discarding any sorting options set for that column.
 void setSortingUseToString(int column, boolean useToString)
          Sets whether sorting should use binary value or toString() representation.
 void setSortingUseToString(String column, boolean useToString)
          Sets whether sorting should use binary value or toString() representation.
 void sort()
          Sorts data set using sorting criteria configured previously by calls to setSortingXXX() methods.
 void sort(int column, boolean ascending)
          Sorts the data set using natural ordering.
 void sort(int column, boolean ascending, Comparator comparator)
          Sorts the data set using specified comparator.
 void sort(String column, boolean ascending)
          Sorts the data set using natural ordering.
 void sort(String column, boolean ascending, Comparator comparator)
          Sorts the data set using specified comparator.
 

Method Detail

read

void read(AQDataReader in)
          throws Exception
Reads in data from a data stream. The column specification will be set to that of the specified input. This method should not be used when column specification of the input reader is different. Please use importData(com.aquafold.openapi.io.AQDataReader) instead.

Parameters:
in - Source data reader.
Throws:
Exception

getReader

AQDataReader getReader()
Creates a new reader (with its own cursor) suitable for sequential access.


getColumnStructure

AQColumnStructure getColumnStructure()
Returns column structure information.


setColumnNames

void setColumnNames(String[] columnNames)
Sets column names. This method will fail if column names have already been set.

Parameters:
columnNames - Column names.

getColumnNames

String[] getColumnNames()
Returns an array of column names.


add

void add(AQDataRow row)
Append a new row at the end of the data set. This method does not change the column structure of the set.

Parameters:
row - Source data row.

insert

void insert(int index,
            AQDataRow row)
Insert row at the specified index. This method does not change the column structure of the set.

Parameters:
index - 0-based row index.
row - Source data row.

addRow

AQDataRow addRow()
Add a new row to the end of the list of rows. This method does not change the column structure of the set.

Returns:
AQDataRow The newly added row

insertRow

AQDataRow insertRow(int index)
Insert a new row at specified index. This method does not change the column structure of the set.

Parameters:
index - 0-based index at which new row is inserted.
Returns:
AQDataRow The newly added row.

addRowWithValues

AQDataRow addRowWithValues(Object... values)
Add a new row with the specified column values at the end of the data set. This method does not change the column structure of the set.

Parameters:
values - Vararg sequence of column values for the new row.
Returns:
AQDataRow The newly added row.

insertRowWithValues

AQDataRow insertRowWithValues(int index,
                              Object... values)
Insert a new row at specified index with the specified column values. This method does not change the column structure of the set.

Parameters:
index - 0-based index at which new row is inserted.
values - Vararg sequence of column values for the new row.
Returns:
AQDataRow The newly added row.

get

AQDataRow get(int index)
Returns the data row at the specified position.

Parameters:
index - 0-based row index.

remove

AQDataRow remove(int index)
Removes the element at the specified position in the data set.

Parameters:
index - 0-based row index.

clear

void clear()
Removes all of the elements from this list.


getRowCount

int getRowCount()
Returns the number of rows in this data set.


getColumnCount

int getColumnCount()
Returns number of columns in this data set. Returns 0 when the column structure is not yet set.


importData

void importData(AQDataReader in)
                throws Exception
Imports data row by row, performing necessary structural conversion.

Parameters:
in - Source data reader.
Throws:
Exception

append

void append(AQDataSet data)
            throws Exception
Appends another data set. This operation ignores column structure of the second data set: adding values by column index. When the second data set has smaller number of columns, rows are padded with nulls, and if the second data set has more columns, the data is ignored.

Parameters:
data - Source data set.
Throws:
Exception

sort

void sort(String column,
          boolean ascending)
Sorts the data set using natural ordering.

Parameters:
column - Column name.
ascending - Sort order.

sort

void sort(int column,
          boolean ascending)
Sorts the data set using natural ordering.

Parameters:
column - Column index.
ascending - Sort order.

sort

void sort(String column,
          boolean ascending,
          Comparator comparator)
Sorts the data set using specified comparator.

Parameters:
column - Column name.
ascending - Sort order.
comparator - Comparator to use.

sort

void sort(int column,
          boolean ascending,
          Comparator comparator)
Sorts the data set using specified comparator.

Parameters:
column - Column index.
ascending - Sort order.
comparator - Comparator to use.

setSortingAscending

void setSortingAscending(String column)
Sets ascending sorting direction for the specified column. This method performs no sorting, call sort() to actually sort the data.

Parameters:
column - Column name.

setSortingAscending

void setSortingAscending(int column)
Sets ascending sorting direction for the specified column. This method performs no sorting, call sort() to actually sort the data.

Parameters:
column - Column index.

setSortingDescending

void setSortingDescending(String column)
Sets descending sorting direction for the specified column. This method performs no sorting, call sort() to actually sort the data.

Parameters:
column - Column name.

setSortingDescending

void setSortingDescending(int column)
Sets descending sorting direction for the specified column. This method performs no sorting, call sort() to actually sort the data.

Parameters:
column - Column index.

setSortingNone

void setSortingNone(String column)
Sets no sorting for the specified column, discarding any sorting options set for that column. This method performs no sorting, call sort() to actually sort the data.

Parameters:
column - Column name.

setSortingNone

void setSortingNone(int column)
Sets no sorting for the specified column, discarding any sorting options set for that column. This method performs no sorting, call sort() to actually sort the data.

Parameters:
column - Column index.

isSortingAscending

boolean isSortingAscending(String column)
Returns true if the specified column has been configured for sorting in ascending direction.

Parameters:
column - Column name.

isSortingAscending

boolean isSortingAscending(int column)
Returns true if the specified column has been configured for sorting in ascending direction.

Parameters:
column - Column index.

isSortingDescending

boolean isSortingDescending(String column)
Returns true if the specified column has been configured for sorting in descending direction.

Parameters:
column - Column name.

isSortingDescending

boolean isSortingDescending(int column)
Returns true if the specified column has been configured for sorting in descending direction.

Parameters:
column - Column index.

isSortingNone

boolean isSortingNone(String column)
Returns true if the specified column has no sorting configured.

Parameters:
column - Column name.

isSortingNone

boolean isSortingNone(int column)
Returns true if the specified column has no sorting configured.

Parameters:
column - Column index.

setSortingCollator

void setSortingCollator(String column,
                        Collator collator)
Sets collator for the specified column. When collator is set, the value is always converted to its toString() representation.

Parameters:
column - Column name.
collator -

setSortingCollator

void setSortingCollator(int column,
                        Collator collator)
Sets collator for the specified column. When collator is set, the value is always converted to its toString() representation.

Parameters:
column - Column index.
collator -

setSortingUseToString

void setSortingUseToString(String column,
                           boolean useToString)
Sets whether sorting should use binary value or toString() representation. Default value is true (use toString()). This method performs no sorting, call sort() to actually sort the data.

Parameters:
column - Column name.
useToString -

setSortingUseToString

void setSortingUseToString(int column,
                           boolean useToString)
Sets whether sorting should use binary value or toString() representation. Default value is true (use toString()). This method performs no sorting, call sort() to actually sort the data.

Parameters:
column - Column index.
useToString -

clearSorting

void clearSorting()
Clears the sorting criteria set on the columns previously with setSortingXXX() methods. Calling this method does not clear a previously sorted dataset.


sort

void sort()
Sorts data set using sorting criteria configured previously by calls to setSortingXXX() methods. No sorting is done if sorting criteria have not been set or clearSorting() has been called. This method allows sorting using multiple columns.


saveAsExcel2003

void saveAsExcel2003(String filename)
                     throws Exception
Saves the data set to an Excel2003 file.

Parameters:
filename - File name.
Throws:
Exception

saveAsExcel2003

void saveAsExcel2003(String fileName,
                     AQDataSetSettings settings,
                     AQChart chart)
                     throws Exception
Saves the data set, with chart enabled, as an Excel 2003 file. If the specified file already exists, it will be overridden.

Parameters:
fileName - the name of the file where the data set to be saved
settings - a data set settings, default settings are used if null
chart - an object that describes how chart to be presented; ignored if null
Throws:
Exception

getAsExcel2003

byte[] getAsExcel2003()
                      throws Exception
Returns the data set as a byte array representing an Excel 2003 file.

Throws:
Exception

getAsExcel2003

byte[] getAsExcel2003(AQDataSetSettings settings,
                      AQChart chart)
                      throws Exception
Returns the data set, with chart enabled, as a byte array representing an Excel 2003 file.

Parameters:
settings - a data set settings, default settings are used if null
chart - an object that describes how chart to be presented; ignored if null
Throws:
Exception

saveAsExcel2007

void saveAsExcel2007(String filename)
                     throws Exception
Saves the data set to an Excel2007 file.

Parameters:
filename - File name.
Throws:
Exception

saveAsExcel2007

void saveAsExcel2007(String fileName,
                     AQDataSetSettings settings,
                     AQChart chart)
                     throws Exception
Saves the data set, with chart enabled, as an Excel 2007 file. If the specified file already exists, it will be overridden.

Parameters:
fileName - the name of the file where the data set to be saved
settings - a data set settings, default settings are used if null
chart - an object that describes how chart to be presented; ignored if null
Throws:
Exception

getAsExcel2007

byte[] getAsExcel2007()
                      throws Exception
Returns the data set as a byte array representing an Excel 2007 file.

Throws:
Exception

getAsExcel2007

byte[] getAsExcel2007(AQDataSetSettings settings,
                      AQChart chart)
                      throws Exception
Returns the data set, with chart enabled, as a byte array representing an Excel 2007 file.

Parameters:
settings - a data set settings, default settings are used if null
chart - an object that describes how chart to be presented; ignored if null
Throws:
Exception

getValueAt

Object getValueAt(int rowIndex,
                  int columnIndex)
Returns the data value at columnIndex and rowIndex. This method returns null instead of throwing an exception when row or column index are outside of the data set range.

Parameters:
rowIndex - 0-based row index.
columnIndex - 0-based column index.

renderText

String renderText()
Converts the data set to a formatted plain text grid using the default grid settings.

Returns:
a String containing the formatted grid

renderText

String renderText(int lineCount)
Converts the data set, up to lineCount rows, to a formatted plain text grid using the default grid settings.

Parameters:
lineCount - the maximum number of rows to display
Returns:
a String containing the formatted grid

renderText

String renderText(AQDataSetSettings settings)
Converts the data set to a formatted plain text grid using the specified grid settings.

Parameters:
settings - a grid settings
Returns:
a String containing the formatted grid

renderHtml

String renderHtml()
Converts the data set to a HTML document using the default grid settings.

Returns:
a String containing the generated HTML document

renderHtml

String renderHtml(AQDataSetSettings settings)
Converts the data set to a HTML document using the specified grid settings.

Parameters:
settings - a grid settings
Returns:
a String containing the generated HTML document

renderHtml

String renderHtml(AQDataSetSettings settings,
                  AQChart chart)
Converts the data set to a HTML document, with chart enabled, using the specified grid settings.

Parameters:
settings - a grid settings
chart - an object that describes how chart to be presented; ignored if null
Returns:
a String containing the generated HTML document

OpenAPI 1.0


Copyright © 2010 AquaFold, Inc. All Rights Reserved. Use is subject to license terms.