Package ui.repl

Class TableManager


  • final class TableManager
    extends java.lang.Object
    The TableManager class is used manage the TableView representing the Symbols contained within the SymbolTable.
    Since:
    1.0
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  TableManager.SymbolElement
      The SymbolElement class is used store Symbols as rows within a TableView
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addColumn​(javafx.scene.control.TableColumn<TableManager.SymbolElement,​java.lang.String> column, java.lang.String fieldName)
      Adds a column to be displayed in the table.
      void clear()
      Clears the TableView, removing all TableColumn objects.
      void refresh()
      Refreshes the table to reflect the contents of the SymbolTable.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TableManager

        public TableManager​(javafx.scene.control.TableView<TableManager.SymbolElement> table,
                            SymbolTable symbolTable)
        Constructs a TableManager object for storing a TableView and SymbolTable.

        The TableView is used to store each SymbolElement object as rows, whilst the SymbolTable is used to retrieve the Symbols.

        Parameters:
        table - The TableView for storing the Symbols
        symbolTable - The SymbolTable for retrieving the Symbols
    • Method Detail

      • addColumn

        public void addColumn​(javafx.scene.control.TableColumn<TableManager.SymbolElement,​java.lang.String> column,
                              java.lang.String fieldName)
        Adds a column to be displayed in the table.

        Each TableColumn must accept a SymbolElement and a String, and also provide a name for the column.

        Parameters:
        column - A TableColumn The TableColumn to be added to the table
        fieldName - The name of the column
      • refresh

        public void refresh()
        Refreshes the table to reflect the contents of the SymbolTable.

        This method is called every time the SymbolTable is updated in some way, whether a Symbol is added, removed, or updated.

      • clear

        public void clear()
        Clears the TableView, removing all TableColumn objects.