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