Class KeyValuePairTableModel

    • Field Detail

      • m_ColumnNames

        protected String[] m_ColumnNames
        the names of the columns.
      • m_Data

        protected Object[][] m_Data
        the data to display.
      • m_Editable

        protected boolean m_Editable
        whether the values can be edited.
      • m_Modified

        protected boolean m_Modified
        whether the values were modified.
    • Constructor Detail

      • KeyValuePairTableModel

        public KeyValuePairTableModel​(Object[][] data)
        Initializes the table model. The key is always assumed to be of type string.
        Parameters:
        data - the key-value pairs to display
      • KeyValuePairTableModel

        public KeyValuePairTableModel​(Object[][] data,
                                      String[] colNames)
        Initializes the table model with custom column names. The key is always assumed to be of type string.
        Parameters:
        data - the key-value pairs to display
        colNames - the names of the columns (only 2 entries!)
    • Method Detail

      • setEditable

        public void setEditable​(boolean value)
        Sets whether the values will be editable or not.
        Parameters:
        value - if true the values will be editable
      • isEditable

        public boolean isEditable()
        Returns whether the values are editable or not.
        Returns:
        true if the value are editable
      • setModified

        public void setModified​(boolean value)
        Sets whether the values will were modified.
        Parameters:
        value - if true the values were modified
      • isModified

        public boolean isModified()
        Returns whether the values were modified.
        Returns:
        true if the values were modified
      • getRowCount

        public int getRowCount()
        Returns the number of rows.
        Specified by:
        getRowCount in interface TableModel
        Returns:
        the number of rows
      • getColumnCount

        public int getColumnCount()
        Returns the number of columns in the table.
        Specified by:
        getColumnCount in interface TableModel
        Returns:
        always 2
      • getValueAt

        public Object getValueAt​(int row,
                                 int column)
        Returns the value at the given position. Multi-line content gets shortened.
        Specified by:
        getValueAt in interface TableModel
        Parameters:
        row - the row in the table
        column - the column in the table
        Returns:
        the value
        See Also:
        getValueAt(int, int)
      • getKeyAt

        public String getKeyAt​(int row)
        Returns the key at the given position.
        Parameters:
        row - the row in the table
        Returns:
        the key
      • getValueAt

        public Object getValueAt​(int row)
        Returns the value at the given position.
        Parameters:
        row - the row in the table
        Returns:
        the value
      • isCellEditable

        public boolean isCellEditable​(int rowIndex,
                                      int columnIndex)
        Returns whether the values are editable.
        Specified by:
        isCellEditable in interface TableModel
        Overrides:
        isCellEditable in class AbstractTableModel
        Parameters:
        rowIndex - the row being queried
        columnIndex - the column being queried
        Returns:
        true if editable
      • setValueAt

        public void setValueAt​(Object aValue,
                               int rowIndex,
                               int columnIndex)
        Updates the value.
        Specified by:
        setValueAt in interface TableModel
        Overrides:
        setValueAt in class AbstractTableModel
        Parameters:
        aValue - value to assign to cell
        rowIndex - row of cell
        columnIndex - column of cell
      • isSearchMatch

        public boolean isSearchMatch​(SearchParameters params,
                                     int row)
        Tests whether the search matches the specified row.
        Specified by:
        isSearchMatch in interface CustomSearchTableModel
        Parameters:
        params - the search parameters
        row - the row of the underlying, unsorted model
        Returns:
        true if the search matches this row