Class AbstractTableAction<E extends NamedBean>

java.lang.Object
javax.swing.AbstractAction
jmri.jmrit.beantable.AbstractTableAction<E>
Type Parameters:
E - type of NamedBean supported in this table
All Implemented Interfaces:
ActionListener, Serializable, Cloneable, EventListener, Action
Direct Known Subclasses:
AbstractLogixNGTableAction, AbstractTableTabAction, AudioTableAction, BlockTableAction, EcosLocoTableAction, IdTagTableAction, LightTableAction, LogixTableAction, LRouteTableAction, MemoryTableAction, OBlockTableAction, RailComTableAction, ReporterTableAction, RouteTableAction, SectionTableAction, SensorTableAction, SignalGroupTableAction, SignalHeadTableAction, SignalMastLogicTableAction, SignalMastTableAction, StringIOTableAction, TransitTableAction, TurnoutTableAction

public abstract class AbstractTableAction<E extends NamedBean> extends AbstractAction
Swing action to create and register a NamedBeanTable GUI.
See Also:
  • Field Details

  • Constructor Details

  • Method Details

    • 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(ActionEvent e)
    • addBottomButtons

      protected void addBottomButtons(BeanTableFrame<E> ata, JTable dataTable)
    • 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.
    • setFrame

      public void setFrame(@Nonnull BeanTableFrame<E> frame)
    • getFrame

    • getDataModel

      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.

    • getTableDataModel

    • 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
    • addToFrame

      Allow subclasses to add to the frame without having to actually subclass the BeanTableDataFrame.
      Parameters:
      tti - the TabbedTableItem to add to
    • addToPanel

      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

      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 JComponent getPanel()
    • configureTable

      protected void configureTable(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

      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 String helpTarget()
      Specify the JavaHelp target for this specific panel.
      Returns:
      a fixed default string "index" pointing to to highest level in JMRI Help
    • getClassDescription

    • setMessagePreferencesDetails

    • getClassName

      protected abstract String getClassName()
    • includeAddButton

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

      public void print(JTable.PrintMode mode, MessageFormat headerFormat, 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(ActionEvent e)
    • configureManagerComboBox

      protected void configureManagerComboBox(ManagerComboBox<E> comboBox, Manager<E> manager, 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(String curAddress, 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