Class TableFrames

  • All Implemented Interfaces:
    java.util.EventListener, javax.swing.event.InternalFrameListener, Disposable

    public class TableFrames
    extends java.lang.Object
    implements javax.swing.event.InternalFrameListener, Disposable
    GUI to define OBlocks.

    Core code can be used with two interfaces:

    • original "desktop" InternalFrames (displays as InternalJFrames inside a JmriJFrame)
    • JMRI standard Tabbed tables (displays as Js inside a ListedTableFrame)
    The _tabbed field decides, it is set in prefs (restart required). TableFrames itself has no UI.
    This file is part of JMRI.

    JMRI is free software; you can redistribute it and/or modify it under the terms of version 2 of the GNU General Public License as published by the Free Software Foundation. See the "COPYING" file for a copy of this license.

    JMRI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

    • Method Detail

      • addMenus

        public javax.swing.JMenuBar addMenus​(javax.swing.JMenuBar mBar)
      • getPrintMenuItems

        public javax.swing.JMenu getPrintMenuItems​(javax.swing.JTable oBlockTable,
                                                   javax.swing.JTable portalTable,
                                                   javax.swing.JTable signalTable,
                                                   javax.swing.JTable blockPortalTable)
      • getDesktopFrame

        protected JmriJFrame getDesktopFrame()
        Get the JFrame containig all UI windows.
        Returns:
        the contentframe
      • importBlocks

        protected void importBlocks()
                             throws java.lang.IllegalArgumentException
        Convert a copy of your current JMRI Blocks to OBlocks and connect them with Portals and Paths. Accessed from the Options menu.
        Throws:
        java.lang.IllegalArgumentException - exception
      • setShowWarnings

        protected void setShowWarnings​(java.lang.String cmd)
      • updateOBlockTablesMenu

        protected void updateOBlockTablesMenu()
        Fill in the Open/Hide Tables menu on tablesMenu.
      • buildFrame

        protected javax.swing.JInternalFrame buildFrame​(javax.swing.table.AbstractTableModel tableModel,
                                                        java.lang.String title,
                                                        java.lang.String prompt)
        Wrapper for shared code around each Table in a JInternal window on _desktop interface.
        Parameters:
        tableModel - underlying model for the table
        title - text displayed as title of frame
        prompt - text below bottom line
        Returns:
        iframe to put on _desktop interface
      • openOBlockEditor

        protected boolean openOBlockEditor​(java.lang.String blockSystemName,
                                           java.lang.String tabname)
      • openPathEditor

        protected boolean openPathEditor​(@Nonnull
                                         java.lang.String blockName,
                                         @CheckForNull
                                         java.lang.String pathName,
                                         BlockPathTableModel bpmodel)
        Open the Edit Path panel for _tabbed. Compare with openOBlockEditor(block, selectedtabname) and OBlockTableAction.
        Parameters:
        blockName - system or user name of the owning oblock
        pathName - name of the path under edit, or null to create a new path
        bpmodel - blockpathtablemodel that should be informed about changes
        Returns:
        true if successful
      • openBlockPathPane

        public void openBlockPathPane​(java.lang.String blockSystemName,
                                      java.lang.String editorTabName)
      • openBlockPathFrame

        protected void openBlockPathFrame​(java.lang.String blockSystemName)
        Open a block-specific Block-Path table in _desktop interface.
        Parameters:
        blockSystemName - of the OBlock
      • setPathEdit

        protected void setPathEdit​(boolean edit)
      • dispose

        public void dispose()
        Description copied from interface: Disposable
        Called when disposing of a disposable.

        Note there are no assurances this method will not be called multiple times against a single instance of this Disposable. It is the responsibility of this Disposable to protect itself and the application from ensuring that calling this method multiple times has no unwanted side effects.

        Specified by:
        dispose in interface Disposable
      • makePathTurnoutName

        protected java.lang.String makePathTurnoutName​(java.lang.String blockSysName,
                                                       java.lang.String pathName)
        Create a coded id for a path turnout.
        Parameters:
        blockSysName - oblock system name
        pathName - the path through the oblock for which to display turnouts set
        Returns:
        name of the pathTurnout, example "%path 1-3&block-1"
      • openPathTurnoutFrame

        protected void openPathTurnoutFrame​(java.lang.String pathTurnoutName)
        Open a block-specific PathTurnouts table as a JInternalFrame for _desktop from BlockPathTableModel
        Parameters:
        pathTurnoutName - name of turnout configured on Path
      • openPathTurnoutEditor

        protected void openPathTurnoutEditor​(java.lang.String pathTurnoutName)
        Open a block-specific PathTurnouts edit pane as a JmriJFrame for _tabbed from menu. TODO fix menu access to pathturnouts on _tabbed in ListedTableView, single table menus OK
        Parameters:
        pathTurnoutName - name of turnout configured on Path
      • addTurnoutPane

        protected void addTurnoutPane​(OPath path,
                                      PathTurnoutTableModel pathTurnoutModel)
        Add new Turnout pane, called from makePathTurnoutPanel on _tabbed interface.
        Parameters:
        path - to link this turnout setting to
        pathTurnoutModel - displayed table of turnouts currently set on this path
      • verifyWarning

        protected int verifyWarning​(java.lang.String message)
      • internalFrameClosing

        public void internalFrameClosing​(javax.swing.event.InternalFrameEvent e)
        Specified by:
        internalFrameClosing in interface javax.swing.event.InternalFrameListener
      • internalFrameClosed

        public void internalFrameClosed​(javax.swing.event.InternalFrameEvent e)
        Specified by:
        internalFrameClosed in interface javax.swing.event.InternalFrameListener
      • internalFrameOpened

        public void internalFrameOpened​(javax.swing.event.InternalFrameEvent e)
        Specified by:
        internalFrameOpened in interface javax.swing.event.InternalFrameListener
      • internalFrameIconified

        public void internalFrameIconified​(javax.swing.event.InternalFrameEvent e)
        Specified by:
        internalFrameIconified in interface javax.swing.event.InternalFrameListener
      • internalFrameDeiconified

        public void internalFrameDeiconified​(javax.swing.event.InternalFrameEvent e)
        Specified by:
        internalFrameDeiconified in interface javax.swing.event.InternalFrameListener
      • internalFrameActivated

        public void internalFrameActivated​(javax.swing.event.InternalFrameEvent e)
        Specified by:
        internalFrameActivated in interface javax.swing.event.InternalFrameListener
      • internalFrameDeactivated

        public void internalFrameDeactivated​(javax.swing.event.InternalFrameEvent e)
        Specified by:
        internalFrameDeactivated in interface javax.swing.event.InternalFrameListener