lejos.pc.tools
Class NXTConnectionModel

java.lang.Object
  extended by javax.swing.table.AbstractTableModel
      extended by lejos.pc.tools.NXTConnectionModel
All Implemented Interfaces:
java.io.Serializable, javax.swing.table.TableModel

public class NXTConnectionModel
extends javax.swing.table.AbstractTableModel

A table model for PC GUI programs. This is used by NXJBrowser and NXJMonitor to allow the user to choose which NXT to connect to.

Author:
Lawrie Griffiths
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
NXTConnectionModel(NXTInfo[] nxts, int numNXTs)
          Create the model from an array of NXTInfo.
 
Method Summary
 java.lang.Class<?> getColumnClass(int column)
          Get the class of the object held in the column cells
 int getColumnCount()
          Return the number of columns
 java.lang.String getColumnName(int column)
          Get the column name
 int getRowCount()
          Return the number of rows
 java.lang.Object getValueAt(int row, int column)
          Get the data in a specific cell
 void setConnected(int row, NXTConnectionState state)
           
 void setData(NXTInfo[] nxts, int numNXTs)
          Update the data in the model.
 
Methods inherited from class javax.swing.table.AbstractTableModel
addTableModelListener, findColumn, fireTableCellUpdated, fireTableChanged, fireTableDataChanged, fireTableRowsDeleted, fireTableRowsInserted, fireTableRowsUpdated, fireTableStructureChanged, 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

NXTConnectionModel

public NXTConnectionModel(NXTInfo[] nxts,
                          int numNXTs)
Create the model from an array of NXTInfo.

Parameters:
nxts - the NXTInfo array
numNXTs - the number of NXTs in the array
Method Detail

setData

public void setData(NXTInfo[] nxts,
                    int numNXTs)
Update the data in the model.

Parameters:
nxts - the NXTInfo array
numNXTs - the number of NXTs

setConnected

public void setConnected(int row,
                         NXTConnectionState state)

getRowCount

public int getRowCount()
Return the number of rows

Returns:
the number of rows

getColumnCount

public int getColumnCount()
Return the number of columns

Returns:
the number of columns

getValueAt

public java.lang.Object getValueAt(int row,
                                   int column)
Get the data in a specific cell

Returns:
the Object from the specific cell

getColumnName

public java.lang.String getColumnName(int column)
Get the column name

Specified by:
getColumnName in interface javax.swing.table.TableModel
Overrides:
getColumnName in class javax.swing.table.AbstractTableModel
Parameters:
column - the column index
Returns:
the column name

getColumnClass

public java.lang.Class<?> getColumnClass(int column)
Get the class of the object held in the column cells

Specified by:
getColumnClass in interface javax.swing.table.TableModel
Overrides:
getColumnClass in class javax.swing.table.AbstractTableModel
Parameters:
column - the column index
Returns:
the class