com.ibm.as400.vaccess

Class RecordListTableModel

  • java.lang.Object
    • javax.swing.table.AbstractTableModel
      • com.ibm.as400.vaccess.RecordListTableModel
  • All Implemented Interfaces:
    java.io.Serializable, javax.swing.table.TableModel

    Deprecated. 
    Use Java Swing instead, along with the classes in package com.ibm.as400.access

    public class RecordListTableModel
    extends javax.swing.table.AbstractTableModel
    implements java.io.Serializable
    The RecordListTableModel class represents a table that contains the records of a file using record-level access. This model can be used to create a table of the results.

    This class should be used by users who wish to change the default interface for the table. When the default look and behavior is sufficient, RecordListTablePane can be used.

    Users must call close() to ensure that the system resources are properly freed when this model is no longer needed.

    The data in the model is retrieved from the system when load() is called. If load() is not called, the model will contain no data. Not all data is retrieved at once, rather data is retrieved as needed (in chunks), to improve performance.

    The data in this model is not editable. The individual cell values cannot be changed.

    Most errors are reported by firing ErrorEvents, rather than throwing exceptions. Users should listen for ErrorEvents in order to diagnose and recover from error conditions.

    RecordListTableModel objects generate the following events:

    • ErrorEvent
    • PropertyChangeEvent
    • TableModelEvent
    • WorkingEvent
     // Set up table for file contents.
    AS400 system = new AS400("MySystem", "Userid", "Password");
    String file = "/QSYS.LIB/QGPL.LIB/MyFile.FILE";
    final RecordListTableModel model = new RecordListTableModel(system, file);
    
     // Set up window to hold table
    JFrame frame = new JFrame ("My Window");
    WindowListener l = new WindowAdapter()
    {
         // Close the model when window is closed.
        public void windowClosing(WindowEvent e)
        {
            model.close();
        }
    };
    frame.addWindowListener(l);
    
    // Set up the error dialog adapter.
    model.addErrorListener (new ErrorDialogAdapter (frame));
    
    // Add the component and get data from system.
    model.load();
    JTable table = new JTable(model);
    frame.getContentPane().add(new JScrollPane(table));
    
     // Display the window
    frame.setVisible(true)
    
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static int KEY_EQ
      Deprecated. 
      Constant indicating search type of equal.
      static int KEY_GE
      Deprecated. 
      Constant indicating search type of greater than or equal.
      static int KEY_GT
      Deprecated. 
      Constant indicating search type of greater than.
      static int KEY_LE
      Deprecated. 
      Constant indicating search type of less than or equal.
      static int KEY_LT
      Deprecated. 
      Constant indicating search type of less than.
      • Fields inherited from class javax.swing.table.AbstractTableModel

        listenerList
    • Constructor Summary

      Constructors 
      Constructor and Description
      RecordListTableModel()
      Deprecated. 
      Constructs a RecordListTableModel object.
      RecordListTableModel(AS400 system, java.lang.String fileName)
      Deprecated. 
      Constructs a RecordListTableModel object.
      RecordListTableModel(AS400 system, java.lang.String fileName, java.lang.Object[] key, int searchType)
      Deprecated. 
      Constructs a RecordListTableModel object.
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      void addErrorListener(ErrorListener listener)
      Deprecated. 
      Adds a listener to be notified when an error occurs.
      void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
      Deprecated. 
      Adds a listener to be notified when the value of any bound property is changed.
      void addVetoableChangeListener(java.beans.VetoableChangeListener listener)
      Deprecated. 
      Adds a listener to be notified when the value of any constrained property is changed.
      void addWorkingListener(WorkingListener listener)
      Deprecated. 
      Adds a listener to be notified when work starts and stops on potentially long-running operations.
      void close()
      Deprecated. 
      Closes the file this model represents.
      java.lang.Class getColumnClass(int columnIndex)
      Deprecated. 
      Returns the class of the values in the column.
      int getColumnCount()
      Deprecated. 
      Returns the number of columns in the table.
      java.lang.String getColumnID(int columnIndex)
      Deprecated. 
      Returns the identifier of the column.
      java.lang.String getColumnName(int columnIndex)
      Deprecated. 
      Returns the name of the column for use in a table heading.
      int getColumnWidth(int columnIndex)
      Deprecated. 
      Returns the width of a column as a character count.
      java.lang.String getFileName()
      Deprecated. 
      Returns the file name.
      java.lang.Object[] getKey()
      Deprecated. 
      Returns the key.
      boolean getKeyed()
      Deprecated. 
      Returns whether the file will be accessed in key or sequential order.
      int getRowCount()
      Deprecated. 
      Returns the number of rows in the table.
      int getSearchType()
      Deprecated. 
      Returns the search type.
      AS400 getSystem()
      Deprecated. 
      Returns the system where the file is located.
      java.lang.Object getValueAt(int rowIndex, int columnIndex)
      Deprecated. 
      Returns the value at the specifed column and row.
      void load()
      Deprecated. 
      Loads the table based on the state of the system.
      void removeErrorListener(ErrorListener listener)
      Deprecated. 
      Removes a listener from being notified when an error occurs.
      void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
      Deprecated. 
      Removes a listener from being notified when the value of any bound property is changed.
      void removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
      Deprecated. 
      Removes a listener from being notified when the value of any constrained property is changed.
      void removeWorkingListener(WorkingListener listener)
      Deprecated. 
      Removes a listener from being notified when work starts and stops on potentially long-running operations.
      void setFileName(java.lang.String fileName)
      Deprecated. 
      Sets the name of the file.
      void setKey(java.lang.Object[] key)
      Deprecated. 
      Sets the key.
      void setKeyed(boolean keyed)
      Deprecated. 
      Sets whether the file will be accessed in key or sequential order.
      void setSearchType(int searchType)
      Deprecated. 
      Sets the search type.
      void setSystem(AS400 system)
      Deprecated. 
      Sets the system where the file is located.
      • 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
    • Field Detail

      • KEY_EQ

        public static final int KEY_EQ
        Deprecated. 
        Constant indicating search type of equal.
        See Also:
        Constant Field Values
      • KEY_GT

        public static final int KEY_GT
        Deprecated. 
        Constant indicating search type of greater than.
        See Also:
        Constant Field Values
      • KEY_GE

        public static final int KEY_GE
        Deprecated. 
        Constant indicating search type of greater than or equal.
        See Also:
        Constant Field Values
      • KEY_LT

        public static final int KEY_LT
        Deprecated. 
        Constant indicating search type of less than.
        See Also:
        Constant Field Values
      • KEY_LE

        public static final int KEY_LE
        Deprecated. 
        Constant indicating search type of less than or equal.
        See Also:
        Constant Field Values
    • Constructor Detail

      • RecordListTableModel

        public RecordListTableModel()
        Deprecated. 
        Constructs a RecordListTableModel object. This constructor sets the keyed property to false.
      • RecordListTableModel

        public RecordListTableModel(AS400 system,
                            java.lang.String fileName)
        Deprecated. 
        Constructs a RecordListTableModel object. This constructor sets the keyed property to false.
        Parameters:
        system - The system where the file is located.
        fileName - The file name. The name is specified as a fully qualified path name in the library file system.
      • RecordListTableModel

        public RecordListTableModel(AS400 system,
                            java.lang.String fileName,
                            java.lang.Object[] key,
                            int searchType)
        Deprecated. 
        Constructs a RecordListTableModel object. This constructor sets the keyed property to true.
        Parameters:
        system - The system where the file is located.
        fileName - The keyed file name. The name is specified as a fully qualified path name in the library file system.
        key - The values which make up the key with which to find the record. This value may be null.
        searchType - Constant indicating the type of match required.
    • Method Detail

      • addErrorListener

        public void addErrorListener(ErrorListener listener)
        Deprecated. 
        Adds a listener to be notified when an error occurs. The listener's errorOccurred() method will be called.
        Parameters:
        listener - The listener.
      • addPropertyChangeListener

        public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
        Deprecated. 
        Adds a listener to be notified when the value of any bound property is changed. The listener's propertyChange() method will be called.
        Parameters:
        listener - The listener.
      • addVetoableChangeListener

        public void addVetoableChangeListener(java.beans.VetoableChangeListener listener)
        Deprecated. 
        Adds a listener to be notified when the value of any constrained property is changed. The listener's vetoableChange() method will be called.
        Parameters:
        listener - The listener.
      • addWorkingListener

        public void addWorkingListener(WorkingListener listener)
        Deprecated. 
        Adds a listener to be notified when work starts and stops on potentially long-running operations.
        Parameters:
        listener - The listener.
      • close

        public void close()
        Deprecated. 
        Closes the file this model represents.
      • getColumnClass

        public java.lang.Class getColumnClass(int columnIndex)
        Deprecated. 
        Returns the class of the values in the column. If an error occurs, null is returned.
        Specified by:
        getColumnClass in interface javax.swing.table.TableModel
        Overrides:
        getColumnClass in class javax.swing.table.AbstractTableModel
        Parameters:
        columnIndex - The index of the column. Indices start at 0.
        Returns:
        The class of the column values.
      • getColumnCount

        public int getColumnCount()
        Deprecated. 
        Returns the number of columns in the table.
        Specified by:
        getColumnCount in interface javax.swing.table.TableModel
        Returns:
        The number of columns in the table.
      • getColumnID

        public java.lang.String getColumnID(int columnIndex)
        Deprecated. 
        Returns the identifier of the column. This is the field name in the database. If an error occurs, null is returned.
        Parameters:
        columnIndex - The index of the column. Indices start at 0.
        Returns:
        The column identifier.
      • getColumnName

        public java.lang.String getColumnName(int columnIndex)
        Deprecated. 
        Returns the name of the column for use in a table heading. If an error occurs, null is returned.
        Specified by:
        getColumnName in interface javax.swing.table.TableModel
        Overrides:
        getColumnName in class javax.swing.table.AbstractTableModel
        Parameters:
        columnIndex - The index of the column. Indices start at 0.
        Returns:
        The column name.
      • getColumnWidth

        public int getColumnWidth(int columnIndex)
        Deprecated. 
        Returns the width of a column as a character count. If an error occurs, 0 is returned.
        Parameters:
        columnIndex - The index of the column. Indices start at 0.
        Returns:
        The width of the column expressed as a character count.
      • getFileName

        public java.lang.String getFileName()
        Deprecated. 
        Returns the file name. The name is formatted as a fully qualified path name in the library file system.
        Returns:
        The file name.
      • getKey

        public java.lang.Object[] getKey()
        Deprecated. 
        Returns the key. The key is only used if the keyed property is true.
        Returns:
        The key.
      • getKeyed

        public boolean getKeyed()
        Deprecated. 
        Returns whether the file will be accessed in key or sequential order.
        Returns:
        true if the file will be accessed in key order; false if the file will be accessed in sequential order.
      • getRowCount

        public int getRowCount()
        Deprecated. 
        Returns the number of rows in the table. Because of incremental data retrieval, this value may not be accurate.
        Specified by:
        getRowCount in interface javax.swing.table.TableModel
        Returns:
        The number of rows in the table.
      • getSearchType

        public int getSearchType()
        Deprecated. 
        Returns the search type. The search type is only used if the keyed property is true and the key property is not null.
        Returns:
        The search type.
      • getSystem

        public AS400 getSystem()
        Deprecated. 
        Returns the system where the file is located.
        Returns:
        The system where the file is located.
      • getValueAt

        public java.lang.Object getValueAt(int rowIndex,
                                  int columnIndex)
        Deprecated. 
        Returns the value at the specifed column and row. If an error occurs, null is returned.
        Specified by:
        getValueAt in interface javax.swing.table.TableModel
        Parameters:
        rowIndex - The row index. Values start at 0.
        columnIndex - The column index. Values start at 0.
        Returns:
        The value at the specified column and row.
      • load

        public void load()
        Deprecated. 
        Loads the table based on the state of the system. The system and fileName properties must be set before this method is called.
      • removeErrorListener

        public void removeErrorListener(ErrorListener listener)
        Deprecated. 
        Removes a listener from being notified when an error occurs.
        Parameters:
        listener - The listener.
      • removePropertyChangeListener

        public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
        Deprecated. 
        Removes a listener from being notified when the value of any bound property is changed.
        Parameters:
        listener - The listener.
      • removeVetoableChangeListener

        public void removeVetoableChangeListener(java.beans.VetoableChangeListener listener)
        Deprecated. 
        Removes a listener from being notified when the value of any constrained property is changed.
        Parameters:
        listener - The listener.
      • removeWorkingListener

        public void removeWorkingListener(WorkingListener listener)
        Deprecated. 
        Removes a listener from being notified when work starts and stops on potentially long-running operations.
        Parameters:
        listener - The listener.
      • setFileName

        public void setFileName(java.lang.String fileName)
                         throws java.beans.PropertyVetoException
        Deprecated. 
        Sets the name of the file. This property is bound and constrained. Note that the data will not change until a load() is done.
        Parameters:
        fileName - The file name. The name is specified as a fully qualified path name in the library file system.
        Throws:
        java.beans.PropertyVetoException - If the change is vetoed.
      • setKey

        public void setKey(java.lang.Object[] key)
                    throws java.beans.PropertyVetoException
        Deprecated. 
        Sets the key. This property is bound and constrained. Note that the data will not change until a load() is done. The key is only used if the keyed property is true.
        Parameters:
        key - The values which make up the key with which to find the record. This value may be null.
        Throws:
        java.beans.PropertyVetoException - If the change is vetoed.
      • setKeyed

        public void setKeyed(boolean keyed)
                      throws java.beans.PropertyVetoException
        Deprecated. 
        Sets whether the file will be accessed in key or sequential order. This property is bound and constrained. Note that the data in will not change until a load() is done.
        Parameters:
        keyed - true if the file will be accessed in key order; false if the file will be accessed in sequential order.
        Throws:
        java.beans.PropertyVetoException - If the change is vetoed.
      • setSearchType

        public void setSearchType(int searchType)
                           throws java.beans.PropertyVetoException
        Deprecated. 
        Sets the search type. This property is bound and constrained. Note that the data will not change until a load() is done. The default is KEY_EQ. The search type is only used if the keyed property is true and the key property is not null.
        Parameters:
        searchType - Constant indicating the type of match required.
        Throws:
        java.beans.PropertyVetoException - If the change is vetoed.
      • setSystem

        public void setSystem(AS400 system)
                       throws java.beans.PropertyVetoException
        Deprecated. 
        Sets the system where the file is located. This property is bound and constrained. Note that the data will not change until a load() is done.
        Parameters:
        system - The system where the file is located.
        Throws:
        java.beans.PropertyVetoException - If the change is vetoed.