Class InspectorTable

    • Field Detail

      • editorClass

        private Class<?> editorClass
        The Class type for the current editing cell
    • Constructor Detail

      • InspectorTable

        public InspectorTable​(TableModel tm)
        The constructor
        Parameters:
        tm - the table model
    • Method Detail

      • getCellEditor

        public TableCellEditor getCellEditor​(int row,
                                             int col)
        get the editor according to the Class type of each cell
        Overrides:
        getCellEditor in class JTable
        Parameters:
        row - row number
        col - column number
        Returns:
        the cell editor
      • prepareEditor

        public Component prepareEditor​(TableCellEditor editor,
                                       int row,
                                       int column)
        use this method to let each row have different cell editor. Set the editorClass as the class type of the given cell before calling the super's method because in the super's method, JTable.prepareEditor(TableCellEditor, int, int), it will call getColumnClass(int) to determine the cell's editor type. By default, the JTable does not have the function to set the class type for each row.
        Overrides:
        prepareEditor in class JTable
        Parameters:
        editor - the TableCellEditor to set up
        row - the row of the cell to edit, where 0 is the first row
        column - the column of the cell to edit, where 0 is the first column
        Returns:
        the Component being edited
        See Also:
        getColumnClass(int)
      • getCellRenderer

        public TableCellRenderer getCellRenderer​(int row,
                                                 int col)
        get the renderer according to the Class type of each cell
        Overrides:
        getCellRenderer in class JTable
        Parameters:
        row - row number
        col - column number
        Returns:
        the cell renderer
      • getColumnClass

        public Class<?> getColumnClass​(int col)
        return the class type. return editorClass when it is not null. otherwise return super
        Overrides:
        getColumnClass in class JTable
        Parameters:
        col - the column number
        Returns:
        the class type
      • resetTable

        public void resetTable()
        clear the data of the table
      • rearrangeValues

        public void rearrangeValues​(AttributeMapI currAttr)
        update the values to the inspector table
        Parameters:
        currAttr - the attribute to be inspected