RecordListTablePane and RecordListTableModel classes

RecordListTablePane is implemented using the model-view-controller paradigm, in which the data and the user interface are separated into different classes. The implementation integrates RecordListTableModel with Java™ Foundation Classes' (JFC) JTable. The RecordListTableModel class retrieves and manages the contents of the file and JTable displays the file contents graphically and handles user interaction.

RecordListTablePane provides enough functionality for most requirements. However, if a caller needs more control of the JFC component, then the caller can use RecordListTableModel directly and provide customized integration with a different graphical user interface component.

To use a RecordListTableModel, set the system and fileName properties. Set these properties by using the constructor or the setSystem() and setFileName() methods. Use load() to retrieve the file contents. When the file contents are no longer needed, call close() to ensure that the file is closed.

The following example creates a RecordListTableModel object and presents it with a JTable:

                       // Create a RecordListTableModel
                       // object. Assume that "system" is
                       // an AS400 object that is created
                       // and initialized elsewhere. 
     RecordListTableModel tableModel = new RecordListTableModel (system, "/QSYS.LIB/QIWS.LIB/QCUSTCDT.FILE");

                       // Load the file contents.
     tableModel.load ();
            
                       // Create a JTable for the model.
     JTable table = new JTable (tableModel);

                       // Add the table to a frame. Assume
                       // that "frame" is a JFrame
                       // created elsewhere.
     frame.getContentPane ().add (table);