jsky.catalog.irsa
Class IRSATable

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by javax.swing.table.DefaultTableModel
          extended by jsky.catalog.MemoryCatalog
              extended by jsky.catalog.irsa.IRSATable
All Implemented Interfaces:
Serializable, Cloneable, TableModel, Catalog, QueryResult, TableQueryResult, Saveable, SaveableAsHTML

public class IRSATable
extends MemoryCatalog

Used to read and write IRSA style catalog tables 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.2 $
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 IRSATable()
          Construct a new IRSATable with no header or data (For use only by derived classes).
  IRSATable(IRSACatalog catalog, InputStream in)
          Initialize the table from the given stream.
  IRSATable(IRSACatalog catalog, InputStream in, int maxRows)
          Initialize the table from the given stream by reading up to maxRows of the data.
  IRSATable(IRSACatalog catalog, InputStream in, QueryArgs queryArgs)
          Initialize the table from the given stream by reading up to maxRows of the data.
  IRSATable(IRSACatalog catalog, String filename)
          Initialize the table from the given file.
  IRSATable(String filename)
          Initialize the table from the given file
 
Method Summary
protected  void _init(InputStream in, int maxRows)
          Initialize the table from the given stream, reading at most maxRows data rows (Redefined from the parent class to accept the input in teh IRSA format).
protected  void _initFields()
          Initialize the fields array, which describes the table columns
protected  Vector _parseHeading(String s)
          Parse the given line and return a vector containing the strings.
protected  Vector _parseRow(String lineStr)
          Parse the given table row and return a vector of objects for it.
 Catalog getCatalog()
          Return the catalog used to create this table, or a dummy, generated catalog object, if not known.
static void main(String[] args)
          Test cases
protected  MemoryCatalog makeQueryResult(FieldDesc[] fields, Vector dataRows)
          Return a new MemoryCatalog with the given column fields and data rows.
 void saveAsIRSA(OutputStream os)
          Save the table to the given stream
 void saveAsIRSA(String filename)
          Save the table to the given filename
 
Methods inherited from class jsky.catalog.MemoryCatalog
_checkColumnClass, _initColumnClasses, _parseItem, _parseProperty, _saveHeader, _saveProperties, addRow, clone, compareRow, getColumnClass, getColumnClasses, 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, 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, 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

IRSATable

public IRSATable(IRSACatalog catalog,
                 InputStream in,
                 int maxRows)
          throws 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:
IOException

IRSATable

public IRSATable(IRSACatalog catalog,
                 InputStream in,
                 QueryArgs queryArgs)
          throws 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:
IOException

IRSATable

public IRSATable(IRSACatalog catalog,
                 InputStream in)
          throws 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:
IOException

IRSATable

public IRSATable(IRSACatalog catalog,
                 String filename)
          throws 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:
IOException

IRSATable

public IRSATable(String filename)
          throws IOException
Initialize the table from the given file

Parameters:
filename - the name of the catalog file
Throws:
IOException

IRSATable

protected IRSATable()
Construct a new IRSATable 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

_init

protected void _init(InputStream in,
                     int maxRows)
              throws IOException
Initialize the table from the given stream, reading at most maxRows data rows (Redefined from the parent class to accept the input in teh IRSA format).

Overrides:
_init in class MemoryCatalog
Throws:
IOException

makeQueryResult

protected MemoryCatalog makeQueryResult(FieldDesc[] fields,
                                        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
dataVector - a vector of data rows, each of which is a vector of column values.

_parseHeading

protected Vector _parseHeading(String s)
Parse the given line and return a vector containing the strings.

Overrides:
_parseHeading in class MemoryCatalog
Parameters:
s - A line containing strings separated by "|" and spaces
Returns:
A vector of Strings.

_initFields

protected void _initFields()
Initialize the fields array, which describes the table columns

Overrides:
_initFields in class MemoryCatalog

_parseRow

protected Vector _parseRow(String lineStr)
Parse the given table row and return a vector of objects for it.

Overrides:
_parseRow in class MemoryCatalog
Parameters:
lineStr - A string containing a line from the table.
Returns:
A Vector containing the items in the row.

saveAsIRSA

public void saveAsIRSA(String filename)
                throws IOException
Save the table to the given filename

Throws:
IOException

saveAsIRSA

public void saveAsIRSA(OutputStream os)
Save the table to the given stream


main

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



Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.