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