001package jmri.jmrix.acela;
002
003import javax.swing.JMenu;
004
005/**
006 * Create a "Systems" menu containing the Jmri Acela-specific tools
007 * Based on CMRI serial example, modified to establish Acela support.
008 *
009 * @author Bob Jacobsen Copyright 2003
010 * @author Bob Coleman, Copyright (C) 2007, 2008
011 */
012public class AcelaMenu extends JMenu {
013
014    public AcelaMenu(String name, AcelaSystemConnectionMemo memo) {
015        this(memo);
016        setText(name);
017    }
018
019    public AcelaMenu(AcelaSystemConnectionMemo memo) {
020        super();
021
022        if (memo != null) {
023            setText(memo.getUserName());
024        } else {
025            setText("Acela");
026        }
027
028        if (memo != null) {
029            // do we have an AcelaTrafficController?
030            setEnabled(memo.getTrafficController() != null); // disable menu, no connection, no tools!
031            add(new jmri.jmrix.acela.acelamon.AcelaMonAction(Bundle.getMessage("AcelaMonitorTitle"), memo));
032            add(new jmri.jmrix.acela.packetgen.AcelaPacketGenAction(Bundle.getMessage("MenuItemSendCommand"), memo));
033            add(new jmri.jmrix.acela.nodeconfig.NodeConfigAction(Bundle.getMessage("ConfigNodesTitle"), memo));
034        }
035    }
036
037}