001package jmri.jmrix.qsi;
002
003import javax.swing.JMenu;
004
005/**
006 * Create a "Systems" menu containing the Jmri QSI-specific tools.
007 *
008 * @author Bob Jacobsen Copyright 2007
009 */
010public class QSIMenu extends JMenu {
011
012    public QSIMenu(String name, QsiSystemConnectionMemo memo) {
013        this(memo);
014
015        setText(name);
016    }
017
018    public QSIMenu(QsiSystemConnectionMemo memo) {
019        super();
020
021        if (memo != null) {
022            setText(memo.getUserName());
023        } else {
024            setText("QSI");
025        }
026
027        if (memo != null) {
028            // do we have a QsiTrafficController?
029            setEnabled(memo.getQsiTrafficController() != null); // disable menu, no connection, no tools!
030            add(new jmri.jmrix.qsi.qsimon.QsiMonAction(memo));
031            add(new jmri.jmrix.qsi.packetgen.PacketGenAction(memo));
032        }
033    }
034
035}