lejos.pc.tools
Class ExtendedFileModel

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

public class ExtendedFileModel
extends AbstractTableModel

Swing Table Model for manipulating NXT files.

See Also:
Serialized Form
Rating red

Field Summary
static int MAX_FILES
           
 
Fields inherited from class javax.swing.table.AbstractTableModel
listenerList
 
Constructor Summary
ExtendedFileModel(NXTCommand nxtCommand)
          Fetch files from the NXT and create the model
 
Method Summary
 void delete(String fileName, int row)
          Delete a file on the NXT and update the model
 String fetchFiles()
          Fetch the files from the NXT
 Class<?> getColumnClass(int column)
          Get the class of a specific column
 int getColumnCount()
          Get the number of columns in the mode
 String getColumnName(int column)
          Get the name of a column
 FileInfo getFile(int i)
          Get the FileInfo object for a specific file
 int getRowCount()
          Get the number of rows in the model
 Object getValueAt(int row, int column)
          Get the object at the specified location
 boolean isCellEditable(int row, int column)
          Check if a cell is editable
 int numFiles()
          Return the number of files
 void setValueAt(Object value, int row, int column)
          Set the value of a cell
 
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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_FILES

public static final int MAX_FILES
See Also:
Constant Field Values
Constructor Detail

ExtendedFileModel

public ExtendedFileModel(NXTCommand nxtCommand)
Fetch files from the NXT and create the model

Parameters:
nxtCommand - used to send LCP commands to the NXT
Method Detail

delete

public void delete(String fileName,
                   int row)
            throws IOException
Delete a file on the NXT and update the model

Parameters:
fileName - the file to delete
row - the row in the file model
Throws:
IOException

getRowCount

public int getRowCount()
Get the number of rows in the model

Returns:
the number of files in the model

getColumnCount

public int getColumnCount()
Get the number of columns in the mode

Returns:
the column count

getValueAt

public Object getValueAt(int row,
                         int column)
Get the object at the specified location

Returns:
the object at the specified location

setValueAt

public void setValueAt(Object value,
                       int row,
                       int column)
Set the value of a cell

Specified by:
setValueAt in interface TableModel
Overrides:
setValueAt in class AbstractTableModel

getColumnName

public String getColumnName(int column)
Get the name of a column

Specified by:
getColumnName in interface TableModel
Overrides:
getColumnName in class AbstractTableModel
Returns:
the column name

getColumnClass

public Class<?> getColumnClass(int column)
Get the class of a specific column

Specified by:
getColumnClass in interface TableModel
Overrides:
getColumnClass in class AbstractTableModel
Returns:
the class of the column

isCellEditable

public boolean isCellEditable(int row,
                              int column)
Check if a cell is editable

Specified by:
isCellEditable in interface TableModel
Overrides:
isCellEditable in class AbstractTableModel
Returns:
true iff the cell is editable

fetchFiles

public String fetchFiles()
Fetch the files from the NXT

Returns:
null for success or the error message

getFile

public FileInfo getFile(int i)
Get the FileInfo object for a specific file

Parameters:
i - the row number of the file
Returns:
the FileInfo object

numFiles

public int numFiles()
Return the number of files

Returns:
the number of files