001package jmri.jmrix.openlcb;
002
003import java.util.ResourceBundle;
004import javax.swing.JMenu;
005import jmri.jmrix.can.swing.CanNamedPaneAction;
006
007/**
008 * Create a menu containing the JMRI OpenLCB-specific tools.
009 *
010 * @author Bob Jacobsen Copyright 2010
011 */
012public class OpenLcbMenu extends JMenu {
013
014    public OpenLcbMenu(jmri.jmrix.can.CanSystemConnectionMemo memo) {
015        super();
016
017        ResourceBundle rb = ResourceBundle.getBundle("jmri.jmrix.JmrixSystemsBundle");
018
019        if (memo != null) {
020            setText(memo.getUserName());
021        } else {
022            setText(rb.getString("MenuItemCAN")); // would expect this to be called MenuItemOpenLCB
023        }
024
025        jmri.util.swing.WindowInterface wi = new jmri.util.swing.sdi.JmriJFrameInterface();
026
027        // LccPro is a self-contained frame, so it has to be added separately
028        add(new jmri.jmrix.openlcb.swing.lccpro.LccProFrameAction());
029
030        for (Item item : panelItems) {
031            if (item == null) {
032                add(new javax.swing.JSeparator());
033            } else {
034                add(new CanNamedPaneAction(rb.getString(item.name), wi, item.load, memo));
035            }
036        }
037        
038    }
039
040    final Item[] panelItems = new Item[]{
041        new Item("MenuItemStartHub", "jmri.jmrix.openlcb.swing.hub.HubPane"), // NOI18N
042        null,
043        new Item("MenuItemEventTable", "jmri.jmrix.openlcb.swing.eventtable.EventTablePane"), // NOI18N
044        new Item("MenuItemConfigNodes", "jmri.jmrix.openlcb.swing.networktree.NetworkTreePane"), // NOI18N
045        new Item("MenuItemFirmwareUpdate", "jmri.jmrix.openlcb.swing.downloader.LoaderPane"), // NOI18N
046        new Item("MenuItemIdTool", "jmri.jmrix.openlcb.swing.idtool.IdToolPane"), // NOI18N
047        null,
048        new Item("MenuItemTrafficMonitor", "jmri.jmrix.openlcb.swing.monitor.MonitorPane"), // NOI18N
049        new Item("MenuItemMemoryTool", "jmri.jmrix.openlcb.swing.memtool.MemoryToolPane"), // NOI18N
050        new Item("MenuItemSTLEditor", "jmri.jmrix.openlcb.swing.stleditor.StlEditorPane"), // NOI18N
051        new Item("MenuItemSendFrame", "jmri.jmrix.openlcb.swing.send.OpenLcbCanSendPane"), // NOI18N
052
053    };
054
055    static class Item {
056
057        Item(String name, String load) {
058            this.name = name;
059            this.load = load;
060        }
061
062        final String name;
063        final String load;
064    }
065
066}