Class PacketDataModel

  • All Implemented Interfaces:
    java.io.Serializable, javax.swing.table.TableModel

    public class PacketDataModel
    extends javax.swing.table.AbstractTableModel
    Table data model for display of DCC packet contents
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int ADDRESSCOLUMN  
      (package private) java.util.Vector<java.lang.String> addresses  
      static int DETAILCOLUMN  
      (package private) java.util.Vector<java.lang.String> details  
      (package private) static java.lang.Boolean False  
      (package private) java.util.Vector<java.lang.String> keys  
      static int MONITORBUTTONCOLUMN  
      static int NUMCOLUMN  
      (package private) DataSource source  
      (package private) static java.lang.Boolean True  
      static int TYPECOLUMN  
      (package private) java.util.Vector<java.lang.String> types  
      • Fields inherited from class javax.swing.table.AbstractTableModel

        listenerList
    • Constructor Summary

      Constructors 
      Constructor Description
      PacketDataModel()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void asciiFormattedMessage​(java.lang.String m)  
      void configureTable​(javax.swing.JTable slotTable)
      Configure a table to have our standard rows and columns.
      void dispose()  
      java.lang.Class<?> getColumnClass​(int col)  
      int getColumnCount()  
      java.lang.String getColumnName​(int col)  
      (package private) java.lang.String getDetails​(java.lang.String s)
      Find the message arguments (3rd column) from the current input line.
      (package private) java.lang.String getKey​(java.lang.String s)
      Find the display key from the current input line.
      int getPreferredWidth​(int col)  
      (package private) java.lang.String getPrefix​(java.lang.String s)
      Find the address (1st column) from the current input line
      int getRowCount()
      Returns the number of rows to be displayed.
      (package private) java.lang.String getType​(java.lang.String s)
      Find the message type (2nd column) from the current input line.
      java.lang.Object getValueAt​(int row, int col)  
      boolean isCellEditable​(int row, int col)  
      void reset()  
      (package private) void setColumnToHoldButton​(javax.swing.JTable slotTable, int column)  
      void setSource​(DataSource d)  
      void setValueAt​(java.lang.Object value, int row, int col)  
      • 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
    • Method Detail

      • getRowCount

        public int getRowCount()
        Returns the number of rows to be displayed. This can vary depending on what has been seen
        Returns:
        number of rows
      • getColumnName

        public java.lang.String getColumnName​(int col)
        Specified by:
        getColumnName in interface javax.swing.table.TableModel
        Overrides:
        getColumnName in class javax.swing.table.AbstractTableModel
      • getColumnClass

        public java.lang.Class<?> getColumnClass​(int col)
        Specified by:
        getColumnClass in interface javax.swing.table.TableModel
        Overrides:
        getColumnClass in class javax.swing.table.AbstractTableModel
      • isCellEditable

        public boolean isCellEditable​(int row,
                                      int col)
        Specified by:
        isCellEditable in interface javax.swing.table.TableModel
        Overrides:
        isCellEditable in class javax.swing.table.AbstractTableModel
      • getValueAt

        public java.lang.Object getValueAt​(int row,
                                           int col)
      • setValueAt

        public void setValueAt​(java.lang.Object value,
                               int row,
                               int col)
        Specified by:
        setValueAt in interface javax.swing.table.TableModel
        Overrides:
        setValueAt in class javax.swing.table.AbstractTableModel
      • configureTable

        public void configureTable​(javax.swing.JTable slotTable)
        Configure a table to have our standard rows and columns. This is optional, in that other table formats can use this table model. But we put it here to help keep it consistent.
        Parameters:
        slotTable - the table to configure.
      • reset

        public void reset()
      • getKey

        java.lang.String getKey​(java.lang.String s)
        Find the display key from the current input line. A later input line that maps to the same key will overwrite the earlier line.

        The current implementation is address+type, so that separate lines will be used for each type sent to the same address.

        Parameters:
        s - Current line of input
        Returns:
        null if not to be displayed, e.g. no address
      • getPrefix

        java.lang.String getPrefix​(java.lang.String s)
        Find the address (1st column) from the current input line
        Parameters:
        s - Current line of input
        Returns:
        address
      • getType

        java.lang.String getType​(java.lang.String s)
        Find the message type (2nd column) from the current input line. Should not be called if getPrefix has returned null.
        Parameters:
        s - Current line of input
        Returns:
        null if not to be displayed, e.g. too short
      • getDetails

        java.lang.String getDetails​(java.lang.String s)
        Find the message arguments (3rd column) from the current input line. Should not be called if getPrefix has returned null.
        Parameters:
        s - Current line of input
        Returns:
        null if not to be displayed, e.g. too short