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