BlueSpray - Help
© SchoonerTurtles, Inc. 2012-2015

Introduction
Contents
Getting Started
Download
Navigating
Tutorials
Scripting
Advanced
About

Class STTable

Extends STContent

Create a table of columns and rows for the user
The STTable can be saved and loaded from a text file
The STTable can also be presented in a jTable in a window. To facilitate this,
there is the traditional set of java calls which add an extra column on the left
for a "Row" index. This index will show where each row is when they are sorted

This table sits between the Java GUI code (STTableFrame) and the ProjectTree and thus
implmenets the TableModel functions and is a TableModelListener in it's own right.
@EndUser
STTable represets a table of rows and columns of data. The columns have a
title in the header and can be one of the following types:


  • String

  • Double - floating point value

  • Integer - numeric value without a decimal point and fractional digits

  • Date - a date in the Gregoian (western) calender


Tables are used for the attributes of features in layers.

This class implements TableModel so that it can be directly edited within a TableFrame.


Copyright, SchoonerTurtles LLP, 2009
@author Jim Graham

Object Functions

ReturnsFunctionThrows
DeleteColumn(int Index) Exception
DeleteRow(int Row) Exception
STColumn GetColumn(int Index)  
int GetColumnIndexByName(String Heading)  
GregorianCalendar GetDateCell(int RowIndex,int ColumnIndex) Exception
Double GetDoubleCell(int RowIndex,int ColumnIndex) Exception
String GetHeading(int ColumnIndex)  
long GetLongCell(int RowIndex,int ColumnIndex) Exception
int GetNumColumns()  
int GetNumRows()  
Object GetObjectCell(int RowIndex,int ColumnIndex) Exception
String GetStringCell(int RowIndex,int ColumnIndex) Exception
int InsertColumn(int Index,COLUMN_TYPE Type,String Heading) Exception
int InsertRow(int Row) Exception
SetCell(int RowIndex,int ColumnIndex,Double Value) Exception
SetCell(int RowIndex,int ColumnIndex,GregorianCalendar Value) Exception
SetCell(int RowIndex,int ColumnIndex,String Value) Exception
SetCell(int RowIndex,int ColumnIndex,int Value) Exception
SetColumnType(int Index,COLUMN_TYPE New) Exception
SetHeading(int ColumnIndex,String Name) Exception
SetNumRows(int NewNumRows) Exception
SetSort(int ColumnIndex,boolean NewAscending) Exception
SetSortToSelected()  

Object Functions


DeleteColumn(int Index) Exception

Deletes the specified column from the table.

Parameters:
    Index
Throws: Exception


DeleteRow(int Row) Exception

Delete the specified row. If this table is an attribute table within a
layer this function will also delete the feature associated with the row.

Parameters:
    Row - Row index to delete.
Throws: Exception


STColumn GetColumn(int Index)  

Return the specified column from the table.

Parameters:
    Index
Returns:


int GetColumnIndexByName(String Heading)  

Return the first column that has a matching heading

Parameters:
    Index
Returns:


GregorianCalendar GetDateCell(int RowIndex,int ColumnIndex) Exception

Returns the value of the specified cell. Note that this is one of the few
places where the "y" value (the RowIndex) is specified before the "x"
index. This is the standard for spreadsheets and is followed here.

Parameters:
    RowIndex - Row of the cell to update
    ColumnIndex - Column of the cell to update
Returns: - The current value in the cell if it is a String. Otherwise


Double GetDoubleCell(int RowIndex,int ColumnIndex) Exception

Returns the value of the specified cell. Note that this is one of the few
places where the "y" value (the RowIndex) is specified before the "x"
index. This is the standard for spreadsheets and is followed here.

Parameters:
    RowIndex - Row of the cell to update
    ColumnIndex - Column of the cell to update
Returns: - The current value in the cell if it is a String. Otherwise


String GetHeading(int ColumnIndex)  

Return the heading for the specified column index.

Parameters:
    ColumnIndex
Returns:


long GetLongCell(int RowIndex,int ColumnIndex) Exception

Returns the value of the specified cell. Note that this is one of the few
places where the "y" value (the RowIndex) is specified before the "x"
index. This is the standard for spreadsheets and is followed here.

Parameters:
    RowIndex - Row of the cell to update
    ColumnIndex - Column of the cell to update
Returns: - The current value in the cell if it is a String. Otherwise


int GetNumColumns()  

Return the number of columns in the table.

Returns:


int GetNumRows()  

Return the number of rows in the table.

Returns:


Object GetObjectCell(int RowIndex,int ColumnIndex) Exception

Returns the value of the specified cell. Note that this is one of the few
places where the "y" value (the RowIndex) is specified before the "x"
index. This is the standard for spreadsheets and is followed here.

Parameters:
    RowIndex - Row of the cell to update
    ColumnIndex - Column of the cell to update
Returns: - The current value in the cell if it is a String. Otherwise


String GetStringCell(int RowIndex,int ColumnIndex) Exception

Returns the value of the specified cell. Note that this is one of the few
places where the "y" value (the RowIndex) is specified before the "x"
index. This is the standard for spreadsheets and is followed here.

Parameters:
    RowIndex - Row of the cell to update
    ColumnIndex - Column of the cell to update
Returns: - The current value in the cell if it is a String. Otherwise


int InsertColumn(int Index,COLUMN_TYPE Type,String Heading) Exception

Inserts a column of the specified type into the table. The column will
contain blanks for strings, 0s for numeric values.

Parameters:
    Heading - heading for the column
    Index column index, -1 for the end
    Type - One of the standard STColumn.TYPE values: STRING,DOUBLE,INTEGER,DATE,BLOB
Returns:


int InsertRow(int Row) Exception

Inserts a new row at the specified index.

Parameters:
    Row - Location to insert the new row. 0 will insert a row at the


SetCell(int RowIndex,int ColumnIndex,Double Value) Exception

Set the cell to the specified value. Note that this is one of the few
places where the "y" value (the RowIndex) is specified before the "x"
index. This is the standard for spreadsheets and is followed here.

Parameters:
    RowIndex - Row of the cell to update
    ColumnIndex - Column of the cell to update
    Value - Value to place in the cell.
Throws: Exception


SetCell(int RowIndex,int ColumnIndex,GregorianCalendar Value) Exception

Set the cell to the specified value. Note that this is one of the few
places where the "y" value (the RowIndex) is specified before the "x"
index. This is the standard for spreadsheets and is followed here.

Parameters:
    RowIndex - Row of the cell to update
    ColumnIndex - Column of the cell to update
    Value - Value to place in the cell.
Throws: Exception


SetCell(int RowIndex,int ColumnIndex,String Value) Exception

Set the cell to the specified value. Note that this is one of the few
places where the "y" value (the RowIndex) is specified before the "x"
index. This is the standard for spreadsheets and is followed here.

Parameters:
    RowIndex - Row of the cell to update
    ColumnIndex - Column of the cell to update
    Value - Value to place in the cell.
Throws: Exception


SetCell(int RowIndex,int ColumnIndex,int Value) Exception

Set the cell to the specified value. Note that this is one of the few
places where the "y" value (the RowIndex) is specified before the "x"
index. This is the standard for spreadsheets and is followed here.

Parameters:
    RowIndex - Row of the cell to update
    ColumnIndex - Column of the cell to update
    Value - Value to place in the cell.
Throws: Exception


SetColumnType(int Index,COLUMN_TYPE New) Exception

Set the type of column. This can be used to convert the data from one
type to another. It is recommended to maintain large tables in their
native type (e.g. floating point values as DOUBLEs instead of STRINGs).
This will improve the performance of the program for large datasets.

Parameters:
    Index
    New
Throws: Exception


SetHeading(int ColumnIndex,String Name) Exception

Sets the heading for a column in the table.

Parameters:
    ColumnIndex
    Name -


SetNumRows(int NewNumRows) Exception

Sets the number of rows to the specified value.

Parameters:
    NewNumRows -


SetSort(int ColumnIndex,boolean NewAscending) Exception

Adds a sort to the table.

Parameters:
    ColumnIndex - column index to sort on or -1 to cancel the sort
    NewAscending


SetSortToSelected()  

Sorts the table to have selected items on top