001package jmri.jmrix.direct;
002
003import javax.swing.JMenu;
004import javax.swing.JMenuItem;
005
006/**
007 * Create a "Systems" menu containing the Jmri direct-drive-specific tools (none at present).
008 *
009 * @author Bob Jacobsen Copyright 2003
010 */
011public class DirectMenu extends JMenu {
012
013    public DirectMenu(String name, DirectSystemConnectionMemo memo) {
014        this(memo);
015        setText(name);
016    }
017
018    public DirectMenu(DirectSystemConnectionMemo memo) {
019        super();
020
021        if (memo != null) {
022            setText(memo.getUserName());
023        } else {
024            setText(Bundle.getMessage("MenuItemDirect"));
025        }
026
027        // no items
028        if (memo != null) {
029            // do we have a TrafficController?
030            setEnabled(false); // memo.getTrafficController() != null); // disable menu, no connection, no tools!
031            add(new JMenuItem(Bundle.getMessage("MenuNoOptions")));
032        }
033    }
034
035}