001package jmri.jmrix.tmcc;
002
003import javax.swing.JMenu;
004
005/**
006 * Create a "Systems" menu containing the Jmri TMCC-specific tools
007 *
008 * @author Bob Jacobsen Copyright 2003, 2006
009 */
010public class TmccMenu extends JMenu {
011
012    public TmccMenu(String name, TmccSystemConnectionMemo memo) {
013        this(memo);
014        setText(name);
015    }
016
017    public TmccMenu(TmccSystemConnectionMemo memo) {
018        super();
019        if (memo != null) {
020            setText(memo.getUserName());
021        } else {
022            setText(Bundle.getMessage("MenuTMCC"));
023        }
024
025        if (memo != null) {
026            // do we have a TmccTrafficController?
027            setEnabled(memo.getTrafficController() != null); // disable menu, no connection, no tools!
028            add(new jmri.jmrix.tmcc.serialmon.SerialMonAction(Bundle.getMessage("MenuItemCommandMonitor"), memo));
029            add(new jmri.jmrix.tmcc.packetgen.SerialPacketGenAction(Bundle.getMessage("MenuItemSendCommand"), memo));
030        }
031    }
032
033}