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