Class AbstractTableAction<E extends NamedBean>

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected BeanTableFrame<E> f  
      protected boolean includeAddButton  
      protected BeanTableDataModel<E> m  
      • Fields inherited from class javax.swing.AbstractAction

        changeSupport, enabled
      • Fields inherited from interface javax.swing.Action

        ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, DISPLAYED_MNEMONIC_INDEX_KEY, LARGE_ICON_KEY, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SELECTED_KEY, SHORT_DESCRIPTION, SMALL_ICON
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractTableAction​(java.lang.String actionName)  
      AbstractTableAction​(java.lang.String actionName, java.lang.Object option)  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void actionPerformed​(java.awt.event.ActionEvent e)  
      protected void addBottomButtons​(BeanTableFrame<E> ata, javax.swing.JTable dataTable)  
      protected abstract void addPressed​(java.awt.event.ActionEvent e)  
      void addToFrame​(BeanTableFrame<E> f)
      Allow subclasses to add to the frame without having to actually subclass the BeanTableDataFrame.
      void addToFrame​(ListedTableFrame.TabbedTableItem<E> tti)
      Allow subclasses to add to the frame without having to actually subclass the BeanTableDataFrame.
      void addToPanel​(AbstractTableTabAction<E> f)
      If the subClass is being included in a greater tabbed frame, then this method is used to add the details to the tabbed frame.
      protected void columnsVisibleUpdated​(boolean[] colsVisible)
      Notification that column visibility for the JTable has updated.
      protected void configureManagerComboBox​(ManagerComboBox<E> comboBox, Manager<E> manager, java.lang.Class<? extends Manager<E>> managerClass)
      Configure the combo box listing managers.
      protected void configureTable​(javax.swing.JTable table)
      Perform configuration of the JTable as required by a specific TableAction.
      protected abstract void createModel()
      Create the JTable DataModel, along with the changes for the specific NamedBean type.
      protected void displayHwError​(java.lang.String curAddress, java.lang.Exception ex)
      Display a warning to user about invalid entry.
      void dispose()
      Dispose of the BeanTableDataModel ( if present ), which removes the DataModel property change listeners from Beans.
      java.lang.String getClassDescription()  
      protected abstract java.lang.String getClassName()  
      BeanTableDataModel<E> getDataModel()
      Get the relevant data model for the current table.
      BeanTableFrame<E> getFrame()  
      protected Manager<E> getManager()
      Get the Bean Manager in use by the TableAction.
      javax.swing.JComponent getPanel()  
      BeanTableDataModel<E> getTableDataModel()  
      protected java.lang.String helpTarget()
      Specify the JavaHelp target for this specific panel.
      boolean includeAddButton()
      Test if to include an Add New Button.
      protected java.lang.String nextName​(java.lang.String name)
      Increments trailing digits of a system/user name (string) I.E.
      void print​(javax.swing.JTable.PrintMode mode, java.text.MessageFormat headerFormat, java.text.MessageFormat footerFormat)
      Used with the Tabbed instances of table action, so that the print option is handled via that on the appropriate tab.
      protected void removePrefixBoxListener​(ManagerComboBox<E> prefixBox)
      Remove the Add panel prefixBox listener before disposal.
      void setFrame​(BeanTableFrame<E> frame)  
      protected void setManager​(Manager<E> man)
      If the subClass is being included in a greater tabbed frame, then this is used to specify which manager the subclass should be using.
      void setMenuBar​(BeanTableFrame<E> f)
      Allow subclasses to alter the frame's Menubar without having to actually subclass the BeanTableDataFrame.
      void setMessagePreferencesDetails()  
      protected abstract void setTitle()
      Include the correct title.
      • Methods inherited from class javax.swing.AbstractAction

        addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface javax.swing.Action

        accept
    • Constructor Detail

      • AbstractTableAction

        public AbstractTableAction​(java.lang.String actionName,
                                   java.lang.Object option)
    • Method Detail

      • createModel

        protected abstract void createModel()
        Create the JTable DataModel, along with the changes for the specific NamedBean type.
      • setTitle

        protected abstract void setTitle()
        Include the correct title.
      • actionPerformed

        public void actionPerformed​(java.awt.event.ActionEvent e)
      • columnsVisibleUpdated

        protected void columnsVisibleUpdated​(boolean[] colsVisible)
        Notification that column visibility for the JTable has updated.

        This is overridden by classes which have column visibility Checkboxes on bottom bar.

        Called on table startup and whenever a column goes hidden / visible.

        Parameters:
        colsVisible - array of ALL table columns and their visibility status in order of main Table Model, NOT XTableColumnModel.
      • getDataModel

        public BeanTableDataModel<EgetDataModel()
        Get the relevant data model for the current table.

        This is overridden in the tabbed-table classes to return their own local data model.

        Unlike getTableDataModel(), this therefore doesn't attempt to (re)-create the model.

      • addToFrame

        public void addToFrame​(@Nonnull
                               BeanTableFrame<E> f)
        Allow subclasses to add to the frame without having to actually subclass the BeanTableDataFrame.
        Parameters:
        f - the Frame to add to
      • addToPanel

        public void addToPanel​(AbstractTableTabAction<E> f)
        If the subClass is being included in a greater tabbed frame, then this method is used to add the details to the tabbed frame.
        Parameters:
        f - AbstractTableTabAction for the containing frame containing these and other tabs
      • setManager

        protected void setManager​(@Nonnull
                                  Manager<E> man)
        If the subClass is being included in a greater tabbed frame, then this is used to specify which manager the subclass should be using.
        Parameters:
        man - Manager for this table tab
      • getManager

        @CheckForNull
        protected Manager<EgetManager()
        Get the Bean Manager in use by the TableAction.
        Returns:
        Bean Manager, could be Proxy or normal Manager, may be null.
      • setMenuBar

        public void setMenuBar​(BeanTableFrame<E> f)
        Allow subclasses to alter the frame's Menubar without having to actually subclass the BeanTableDataFrame.
        Parameters:
        f - the Frame to attach the menubar to
      • getPanel

        public javax.swing.JComponent getPanel()
      • configureTable

        protected void configureTable​(javax.swing.JTable table)
        Perform configuration of the JTable as required by a specific TableAction.
        Parameters:
        table - The table to configure.
      • dispose

        public void dispose()
        Dispose of the BeanTableDataModel ( if present ), which removes the DataModel property change listeners from Beans.
      • nextName

        @Nonnull
        protected java.lang.String nextName​(@Nonnull
                                            java.lang.String name)
        Increments trailing digits of a system/user name (string) I.E. "Geo7" returns "Geo8" Note: preserves leading zeros: "Geo007" returns "Geo008" Also, if no trailing digits, appends "1": "Geo" returns "Geo1"
        Parameters:
        name - the system or user name string
        Returns:
        the same name with trailing digits incremented by one
      • helpTarget

        protected java.lang.String helpTarget()
        Specify the JavaHelp target for this specific panel.
        Returns:
        a fixed default string "index" pointing to to highest level in JMRI Help
      • getClassName

        protected abstract java.lang.String getClassName()
      • includeAddButton

        public boolean includeAddButton()
        Test if to include an Add New Button.
        Returns:
        true to include, else false.
      • print

        public void print​(javax.swing.JTable.PrintMode mode,
                          java.text.MessageFormat headerFormat,
                          java.text.MessageFormat footerFormat)
        Used with the Tabbed instances of table action, so that the print option is handled via that on the appropriate tab.
        Parameters:
        mode - table print mode
        headerFormat - messageFormat for header
        footerFormat - messageFormat for footer
      • addPressed

        protected abstract void addPressed​(java.awt.event.ActionEvent e)
      • configureManagerComboBox

        protected void configureManagerComboBox​(ManagerComboBox<E> comboBox,
                                                Manager<E> manager,
                                                java.lang.Class<? extends Manager<E>> managerClass)
        Configure the combo box listing managers. Can be placed on Add New pane to select a connection for the new item.
        Parameters:
        comboBox - the combo box to configure
        manager - the current manager
        managerClass - the implemented manager class for the current manager; this is the class used by InstanceManager.getDefault(Class) to get the default manager, which may or may not be the current manager
      • removePrefixBoxListener

        protected void removePrefixBoxListener​(ManagerComboBox<E> prefixBox)
        Remove the Add panel prefixBox listener before disposal. The listener is created when the Add panel is defined. It persists after the the Add panel has been disposed. When the next Add is created, AbstractTableAction sets the default connection as the current selection. This triggers validation before the new Add panel is created.

        The listener is removed by the controlling table action before disposing of the Add panel after Close or Create.

        Parameters:
        prefixBox - The prefix combobox that might contain the listener.
      • displayHwError

        protected void displayHwError​(java.lang.String curAddress,
                                      java.lang.Exception ex)
        Display a warning to user about invalid entry. Needed as entry validation does not disable the Create button when full system name eg "LT1" is entered.
        Parameters:
        curAddress - address as entered in Add new... pane address field
        ex - the exception that occurred