PIRL.Conductor

Class Procedures_Table_Model

    • Field Detail

      • Editable

        public boolean Editable
        Flag that determines if the table cells are editable.
      • Current_Row

        public int Current_Row
        The row designated as the currently active procedure definitiion of the table.
    • Constructor Detail

      • Procedures_Table_Model

        public Procedures_Table_Model()
        Construct an empty Procedures_Table_Model.
      • Procedures_Table_Model

        public Procedures_Table_Model(Vector records,
                              Vector field_names)
        Construct a Procedures_Table_Model from a Vector of data record Vectors and a Vector of field names.

        Parameters:
        records - A Vector of records; each record is a Vector of field value Strings any of which may be null.
        field_names - A Vector of field_name Strings.
        See Also:
        setDataVector(Vector, Vector)
      • Procedures_Table_Model

        public Procedures_Table_Model(String[][] records,
                              String[] field_names)
        Construct a Procedures_Table_Model from an array of data record arrays and an array of field names.

        Parameters:
        records - An array of records; each record is an array of field value Strings any of which may be null.
        field_names - An array of field_name Strings.
        See Also:
        setDataVector(Vector, Vector)
      • Procedures_Table_Model

        public Procedures_Table_Model(Vector field_names)
        Construct a Procedures_Table_Model from a Vector of field names but no table data.

        A snapshot of the model is taken.

        Parameters:
        field_names - A Vector of field_name Strings.
      • Procedures_Table_Model

        public Procedures_Table_Model(String[] field_names)
        Construct a Procedures_Table_Model from a Vector of field names but no table data.

        A snapshot of the model is taken.

        Parameters:
        field_names - An array of field_name Strings.
    • Method Detail

      • getColumnClass

        public Class getColumnClass(int column)
        Get the Class for a table column.

        Specified by:
        getColumnClass in interface TableModel
        Overrides:
        getColumnClass in class AbstractTableModel
        Parameters:
        column - A table column index.
        Returns:
        String.class; except if the column is not a valid value Object.class is returned.
      • getValueAt

        public Object getValueAt(int row,
                        int column)
        Get a table cell value.

        Specified by:
        getValueAt in interface TableModel
        Overrides:
        getValueAt in class DefaultTableModel
        Parameters:
        row - A table row index.
        column - A table column index.
        Returns:
        The Object at the row and column cell location of the table data. This will be null if either the row or column value is invalid.
      • isCellEditable

        public boolean isCellEditable(int row,
                             int column)
        Test if a table cell is editable.

        Specified by:
        isCellEditable in interface TableModel
        Overrides:
        isCellEditable in class DefaultTableModel
        Parameters:
        row - A table row index.
        column - A table column index.
        Returns:
        The value of the Editable flag.
      • setDataVector

        public void setDataVector(Vector records,
                         Vector field_names)
        Replace the table data content.

        Both the field names and procedure records are replaced.

        A snapshot of the model is taken.

        Overrides:
        setDataVector in class DefaultTableModel
        Parameters:
        records - A Vector of records; each record is a Vector of field value Strings any of which may be null.
        field_names - A Vector of field_name Strings.
      • insertRow

        public void insertRow(int row,
                     Vector record)
        Insert a procedure definition record in the table.

        The table snapshot data is updated with the new record.

        Overrides:
        insertRow in class DefaultTableModel
        Parameters:
        row - A table row index. This must be in the range zero to the total number of records in the table, inclusive. If the row equals the total number of records in the table the record is appended to the table.
        record - A procedure definition record Vector. It's size must be the same as the table's column count.
      • Record

        public Vector Record(int row)
        Get the procedure definition record at a table row index.

        Parameters:
        row - A table row index. This must be in the range zero to the total number of records in the table, exclusive.
        Returns:
        A procedure definition record Vector.
      • Record

        public Procedures_Table_Model Record(int row,
                                    Vector record)
        Set the procedure definition record at a table row index.

        If a new row is added to the table the table snapshot data is updated with the new record.

        Notification of the row record being updated or added will be generated.

        Parameters:
        row - A table row index. This must be in the range zero to the total number of records in the table, inclusive. If the row equals the total number of records in the table the record is appended to the table. Otherwise the record replaces the existing record at the row index.
        record - A procedure definition record Vector. It's size must be the same as the table's column count.
        Returns:
        This Procedures_Table_Model.
        Throws:
        ArrayIndexOutOfBoundsException - If the row index is invalid or the record size is not the same as the number of columns in the table.
      • Restore

        public void Restore()
        Restore the table content from the last snapshot.

        The table records are restored from a copy of the last snapshot table data. If the number of table columns has changed since the last snapshot the field names are also restored from a copy of the last snapshot column names. N.B.: No check is made if the field names have changed; full table content can be forced by:

            setDataVector
              (Table (Snapshot_Table_Data ()),
              Record (Snapshot_Column_Names ()));
        

        Notification of the change to the table contents will be generated.

        See Also:
        Snapshot()
      • Snapshot_Table_Data

        public Vector Snapshot_Table_Data()
        The last table data records snapshot.

        Returns:
        A Vector containing a copy of each record Vector in the table at the time of the last snapshot was taken. N.B.: The returned Vector is the snapshot data, not a copy.
      • Snapshot_Column_Names

        public Vector Snapshot_Column_Names()
        The last table field names snapshot.

        Returns:
        A Vector containing a copy of the field names for the table at the time of the last snapshot was taken. N.B.: The returned Vector is the snapshot data, not a copy.
      • Column_Names

        public Vector Column_Names()
        The table field names.

        Returns:
        A Vector containing the field names for the table. N.B.: The returned Vector is not a copy.
      • Table

        public static Vector Table(Vector records)
        Copy table data.

        The table is a Vector of row record Vectors. The table is expected to be square: the size of the first row record determines the size of all other rows; no attempt is made to compensenate for an irregular table.

        The data elements are not copied; the reference to each element Object is copied. For the expected case where the data elements are Strings, which are immutable, there is no concern that changes in the copied data will affect the copy, or vice versa.

        Parameters:
        records - A Vector of records; each record is a Vector of field value Strings any of which may be null.
        Returns:
        A Vector containing a copy of each record Vector in the table. This will be null if the table is null.
      • Record

        public static Vector Record(Vector record)
        Copy record data.

        Parameters:
        record - A Vector of field value Strings any of which may be null.
        Returns:
        A Vector containing a copy of the record. Must not be null.