001package jmri.jmrit.beantable;
002
003import jmri.jmrit.logix.OBlock;
004
005import javax.swing.*;
006
007/**
008 * Override to place the four OBlock tables in tabbed interface.
009 * @see jmri.jmrit.beantable.oblock.TableFrames
010 *
011 * @author Bob Jacobsen Copyright (C) 2003
012 * @author Matthew Harris copyright (c) 2009
013 * @author Egbert Broerse copyright (c) 2020
014 */
015public class OBlockTableFrame extends BeanTableFrame<OBlock> {
016
017    OBlockTablePanel oblockPanel;
018
019    public OBlockTableFrame(OBlockTablePanel panel, String helpTarget) {
020
021        super();
022
023        oblockPanel = panel;
024
025        // general GUI config
026        getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
027
028        // add save menu item
029        JMenuBar menuBar = new JMenuBar();
030        JMenu fileMenu = new JMenu(Bundle.getMessage("MenuFile"));
031        menuBar.add(fileMenu);
032        fileMenu.add(new jmri.configurexml.StoreMenu());
033        fileMenu.add(panel.getPrintItem());
034
035        menuBar.add(panel.getOptionMenu()); // configure to show up on oblock.TableFrames when called from Tools menu
036        menuBar.add(panel.getTablesMenu());
037
038        setJMenuBar(menuBar); // this menubar shows when table opened as unlisted/startup action
039
040        addHelpMenu(helpTarget, true);
041
042        // install items in GUI
043        getContentPane().add(oblockPanel);
044        bottomBox = Box.createHorizontalBox();
045        bottomBox.add(Box.createHorizontalGlue()); // stays at end of box
046        bottomBoxIndex = 0;
047
048        getContentPane().add(bottomBox);
049
050        // add extras, if desired by subclass
051        extras();
052    }
053
054    @Override
055    public void dispose() {
056        if (oblockPanel != null) {
057            oblockPanel.dispose();
058        }
059        super.dispose();
060    }
061
062}