001package jmri.jmrix.can.nmranet.swing;
002
003import javax.swing.JMenu;
004import jmri.jmrix.can.CanSystemConnectionMemo;
005import jmri.jmrix.can.swing.CanNamedPaneAction;
006
007/**
008 * Create a menu containing the Jmri CAN- and CBUS-specific tools for NMRAnet
009 *
010 * @author Bob Jacobsen Copyright 2003, 2008, 2009
011 * @author Andrew Crosland 2008
012 */
013public class NmraNetMenu extends JMenu {
014
015    public NmraNetMenu(CanSystemConnectionMemo memo) {
016        super();
017
018        if (memo != null) {
019            setText(memo.getUserName());
020        } else {
021            setText(Bundle.getMessage("NMRAnet"));
022        }
023
024        jmri.util.swing.WindowInterface wi = new jmri.util.swing.sdi.JmriJFrameInterface();
025
026        for (Item item : panelItems) {
027            if (item == null) {
028                add(new javax.swing.JSeparator());
029            } else {
030                add(new CanNamedPaneAction(Bundle.getMessage(item.name), wi, item.load, memo));
031            }
032        }
033    }
034
035    Item[] panelItems = new Item[]{
036        new Item("MenuItemConsole", "jmri.jmrix.can.swing.monitor.MonitorPane"),
037        new Item("MenuItemSendFrame", "jmri.jmrix.can.swing.send.CanSendPane"),};
038
039    static class Item {
040
041        Item(String name, String load) {
042            this.name = name;
043            this.load = load;
044        }
045
046        String name;
047        String load;
048    }
049
050}