S-PLUS Connect/Java v1.0

com.insightful.splus.util
Class StringMatrixTableModel

java.lang.Object
  extended byjavax.swing.table.AbstractTableModel
      extended bycom.insightful.splus.util.StringMatrixTableModel
All Implemented Interfaces:
Serializable, TableModel

public class StringMatrixTableModel
extends AbstractTableModel

Contains a String representation of an S-PLUS data.frame or matrix. It requires an S-PLUS expression which produces a String vector giving: number of rows, number of columns, row names, column names, and values by column.

For an existing data.frame or matrix, use:

      javaGuiStringMatrix(dataName)
 
This class does no error checking of the format of the result. The result must have at least one row and column, and must have consistent lengths for the row & column numbers, row & column names, and data values.

This class implements the AbstractTableModel methods. It also provides methods for obtaining row and column names. The column names can be used in a JTableHeader, while the row names can be used with a JScrollPane as is done in the NamedTableScrollPane class to prevent the row names from scrolling.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
StringMatrixTableModel(String expression)
          Create the table model based on an S-PLUS expression.
 
Method Summary
 int getColumnCount()
          Get the number of columns.
 String getColumnName(int column)
          Get the column name for a particular column.
 String[] getColumnNames()
          Get all column names.
 int getRowCount()
          Get the number of rows.
 String getRowName(int row)
          Get the row name for a particular row.
 String[] getRowNames()
          Get all row names.
 Object getValueAt(int row, int column)
          Get the value at a particular row/column location.
 void refresh()
          Query the engine to get the table information.
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, getColumnClass, getListeners, getTableModelListeners, isCellEditable, removeTableModelListener, setValueAt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringMatrixTableModel

public StringMatrixTableModel(String expression)
Create the table model based on an S-PLUS expression.

Method Detail

getRowCount

public int getRowCount()
Get the number of rows.


getColumnCount

public int getColumnCount()
Get the number of columns.


getValueAt

public Object getValueAt(int row,
                         int column)
Get the value at a particular row/column location.


getRowName

public String getRowName(int row)
Get the row name for a particular row.


getColumnName

public String getColumnName(int column)
Get the column name for a particular column.


getRowNames

public String[] getRowNames()
Get all row names.


getColumnNames

public String[] getColumnNames()
Get all column names.


refresh

public void refresh()
Query the engine to get the table information. Refresh the stashed information and call fireTableStructureChanged().


S-PLUS Connect/Java v1.0

Copyright © 2000, 2002 Insightful Corporation
Warning: Classes not documented in the S-PLUS Programmer's Guide may change in future releases.