jsky.catalog.skycat
Class SkycatTable

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by javax.swing.table.DefaultTableModel
          extended by jsky.catalog.MemoryCatalog
              extended by jsky.catalog.skycat.SkycatTable
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, javax.swing.table.TableModel, Catalog, QueryResult, TableQueryResult, Saveable, SaveableAsHTML
Direct Known Subclasses:
NavigatorFITSTable

public class SkycatTable
extends MemoryCatalog

Used to read and write Skycat style tab separated catalog data and manage the rows and columns in memory. This class extends the MemoryCatalog class, which supports searching and working with a JTable widget.

Version:
$Revision: 1.1 $ $Date: 2004/02/03 16:21:31 $
Author:
Allan Brighton
See Also:
Serialized Form

Field Summary
 
Fields inherited from class jsky.catalog.MemoryCatalog
DEC_COL, EQUINOX, ID_COL, RA_COL, SYMBOL, X_COL, Y_COL
 
Fields inherited from class javax.swing.table.DefaultTableModel
columnIdentifiers, dataVector
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Fields inherited from interface jsky.catalog.Catalog
ARCHIVE, CATALOG, DIRECTORY, IMAGE_SERVER, LOCAL, NAME_SERVER
 
Constructor Summary
protected SkycatTable()
          Construct a new SkycatTable with no header or data (For use only by derived classes).
  SkycatTable(SkycatCatalog catalog, java.io.InputStream in)
          Initialize the table from the given stream.
  SkycatTable(SkycatCatalog catalog, java.io.InputStream in, int maxRows)
          Initialize the table from the given stream by reading up to maxRows of the data.
  SkycatTable(SkycatCatalog catalog, java.io.InputStream in, QueryArgs queryArgs)
          Initialize the table from the given stream by reading up to maxRows of the data.
  SkycatTable(SkycatCatalog catalog, java.lang.String filename)
          Initialize the table from the given file.
  SkycatTable(SkycatConfigEntry configEntry, java.util.Vector dataRows, FieldDesc[] fields)
          Construct a new SkycatTable with the given data.
  SkycatTable(SkycatConfigFile cf, java.lang.String filename)
          Initialize the table from the given file
protected SkycatTable(SkycatTable table, FieldDesc[] fields, java.util.Vector dataRows)
          Construct a new SkycatTable with the given column fields and data rows (For internal use only).
  SkycatTable(java.lang.String filename)
          Initialize the table from the given file
 
Method Summary
protected  void _saveProperties(java.io.PrintStream out)
          Save the table header (part before the column headings) to the given PrintStream.
protected  void checkProperties()
          If no properties were defined in the header, add the default settings
 Catalog getCatalog()
          Return the catalog used to create this table, or a dummy, generated catalog object, if not known.
 SkycatConfigEntry getConfigEntry()
          Return the object used to manage the configuration info for this catalog
static void main(java.lang.String[] args)
          Test cases
protected  MemoryCatalog makeQueryResult(FieldDesc[] fields, java.util.Vector dataRows)
          Return a new MemoryCatalog with the given column fields and data rows.
 void setConfigEntry(SkycatConfigEntry entry)
          Set the object used to manage the configuration info for this catalog.
 
Methods inherited from class jsky.catalog.MemoryCatalog
_checkColumnClass, _init, _initColumnClasses, _initFields, _parseHeading, _parseItem, _parseProperty, _parseRow, _saveHeader, clone, compareRow, getColumnClass, getColumnDesc, getColumnIdentifiers, getColumnIndex, getColumnName, getCoordinates, getDescription, getDocURL, getFields, getFilename, getId, getName, getNumColumns, getNumParams, getParamDesc, getParamDesc, getParent, getPath, getProperties, getProperty, getQueryArgs, getRowCoordinates, getTitle, getType, getValueAt, getWCSCenter, hasCol, hasCoordinates, isCellEditable, isImageServer, isLocal, isMore, isReadOnly, makeColumnIdentifiers, print, query, saveAs, saveAs, saveAsHTML, setCatalog, setColumnClasses, setColumnClasses, setColumnIdentifiers, setDescription, setDocURL, setFields, setFilename, setId, setMore, setName, setParent, setProperties, setProperty, setQueryArgs, setReadOnly, setRegionArgs, setRowCoordinates, setTitle, sort, toString
 
Methods inherited from class javax.swing.table.DefaultTableModel
addColumn, addColumn, addColumn, addRow, addRow, convertToVector, convertToVector, getColumnCount, getDataVector, getRowCount, getValueAt, insertRow, insertRow, moveRow, newDataAvailable, newRowsAdded, removeRow, rowsRemoved, setColumnCount, setColumnIdentifiers, setDataVector, setDataVector, setNumRows, setRowCount, setValueAt
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getListeners, getTableModelListeners, removeTableModelListener
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jsky.catalog.TableQueryResult
getDataVector
 
Methods inherited from interface javax.swing.table.TableModel
addTableModelListener, getColumnCount, getRowCount, getValueAt, removeTableModelListener, setValueAt
 

Constructor Detail

SkycatTable

public SkycatTable(SkycatCatalog catalog,
                   java.io.InputStream in,
                   int maxRows)
            throws java.io.IOException
Initialize the table from the given stream by reading up to maxRows of the data.

Parameters:
catalog - the catalog where the data originated, if known
in - the stream to read the catalog data from
maxRows - the maximum number of data rows to read
Throws:
java.io.IOException

SkycatTable

public SkycatTable(SkycatCatalog catalog,
                   java.io.InputStream in,
                   QueryArgs queryArgs)
            throws java.io.IOException
Initialize the table from the given stream by reading up to maxRows of the data.

Parameters:
catalog - the catalog where the data originated, if known
in - the stream to read the catalog data from
queryArgs - represents the arguments to the query that resulted in this table
Throws:
java.io.IOException

SkycatTable

public SkycatTable(SkycatCatalog catalog,
                   java.io.InputStream in)
            throws java.io.IOException
Initialize the table from the given stream.

Parameters:
catalog - the catalog where the data originated, if known
in - the stream to read the catalog data from
Throws:
java.io.IOException

SkycatTable

public SkycatTable(SkycatCatalog catalog,
                   java.lang.String filename)
            throws java.io.IOException
Initialize the table from the given file.

Parameters:
catalog - the catalog where the data originated, if known
filename - the name of the catalog file
Throws:
java.io.IOException

SkycatTable

public SkycatTable(SkycatConfigFile cf,
                   java.lang.String filename)
            throws java.io.IOException
Initialize the table from the given file

Parameters:
cf - a reference to a skycat config file object (may be used later to search for a name server)
filename - the name of the catalog file
Throws:
java.io.IOException

SkycatTable

public SkycatTable(java.lang.String filename)
            throws java.io.IOException
Initialize the table from the given file

Throws:
java.io.IOException

SkycatTable

public SkycatTable(SkycatConfigEntry configEntry,
                   java.util.Vector dataRows,
                   FieldDesc[] fields)
Construct a new SkycatTable with the given data.

Parameters:
configEntry - a config entry describing the table
dataRows - a vector of data rows, each of which is a vector of column values.
fields - an array of objects describing the table columns

SkycatTable

protected SkycatTable(SkycatTable table,
                      FieldDesc[] fields,
                      java.util.Vector dataRows)
Construct a new SkycatTable with the given column fields and data rows (For internal use only).

Parameters:
table - the source catalog table
fields - an array of objects describing the table columns
dataRows - a vector of data rows, each of which is a vector of column values.

SkycatTable

protected SkycatTable()
Construct a new SkycatTable with no header or data (For use only by derived classes).

Method Detail

getCatalog

public Catalog getCatalog()
Return the catalog used to create this table, or a dummy, generated catalog object, if not known.

Specified by:
getCatalog in interface TableQueryResult
Overrides:
getCatalog in class MemoryCatalog

getConfigEntry

public SkycatConfigEntry getConfigEntry()
Return the object used to manage the configuration info for this catalog


setConfigEntry

public void setConfigEntry(SkycatConfigEntry entry)
Set the object used to manage the configuration info for this catalog. The argument may also be the configuration entry for the catalog where the table data originated, in which case a new local catalog entry is created.


checkProperties

protected void checkProperties()
If no properties were defined in the header, add the default settings


makeQueryResult

protected MemoryCatalog makeQueryResult(FieldDesc[] fields,
                                        java.util.Vector dataRows)
Return a new MemoryCatalog with the given column fields and data rows.

Overrides:
makeQueryResult in class MemoryCatalog
Parameters:
fields - an array of objects describing the table columns
dataRows - a vector of data rows, each of which is a vector of column values.

_saveProperties

protected void _saveProperties(java.io.PrintStream out)
Save the table header (part before the column headings) to the given PrintStream. (redefined from the parent class to leave out some properties)

Overrides:
_saveProperties in class MemoryCatalog

main

public static void main(java.lang.String[] args)
Test cases