001package jmri.jmrit.operations.locations;
002
003import java.awt.Dimension;
004
005import javax.swing.*;
006
007import jmri.jmrit.operations.OperationsFrame;
008import jmri.jmrit.operations.locations.tools.PrintSwitchListAction;
009import jmri.jmrit.operations.setup.Control;
010import jmri.jmrit.operations.setup.Setup;
011
012/**
013 * Yardmaster Frame. Shows work at one location.
014 *
015 * @author Dan Boudreau Copyright (C) 2013
016 */
017public class YardmasterFrame extends OperationsFrame {
018
019    public YardmasterFrame(Location location) {
020        super(Bundle.getMessage("Yardmaster"), new YardmasterPanel(location));
021        this.initComponents(location);
022    }
023
024    private void initComponents(Location location) {
025        super.initComponents();
026
027        if (location != null) {
028            // build menu
029            JMenuBar menuBar = new JMenuBar();
030            JMenu toolMenu = new JMenu(Bundle.getMessage("MenuTools"));
031            toolMenu.add(new YardmasterByTrackAction(location));
032            JMenuItem print = toolMenu.add(new PrintSwitchListAction(location, false));
033            JMenuItem preview = toolMenu.add(new PrintSwitchListAction(location, true));
034            menuBar.add(toolMenu);
035            setJMenuBar(menuBar);
036
037            // add tool tip if in consolidation mode: "Disabled when switch list
038            // is in consolidation mode"
039            if (!Setup.isSwitchListRealTime()) {
040                print.setToolTipText(Bundle.getMessage("TipDisabled"));
041                preview.setToolTipText(Bundle.getMessage("TipDisabled"));
042            }
043            setTitle(Bundle.getMessage("Yardmaster") + " " + location.getName());
044        }
045
046        addHelpMenu("package.jmri.jmrit.operations.Operations_Yardmaster", true); // NOI18N
047
048        initMinimumSize(new Dimension(Control.panelWidth500, Control.panelHeight500));
049    }
050
051    // private static final Logger log =
052    // LoggerFactory.getLogger(YardmasterFrame.class);
053}