001package jmri.jmrix.can.cbus.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
009 *
010 * @author Bob Jacobsen Copyright 2003, 2008, 2009
011 * @author Andrew Crosland 2008, 2020
012 */
013public class CbusMenu extends JMenu {
014
015    public CbusMenu(CanSystemConnectionMemo memo) {
016        super();
017
018        if (memo != null) {
019            setText(memo.getUserName());
020        } else {
021            setText(Bundle.getMessage("MenuItemCBUS"));
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        // Added tools that can normally only be found in PanelPro tools menu so that they are available from DP3
035        add(new javax.swing.JSeparator());
036        add(new jmri.jmrit.swing.meter.MeterAction());
037
038    }
039
040    Item[] panelItems = new Item[]{
041        new Item("MenuItemConsole", "jmri.jmrix.can.cbus.swing.console.CbusConsolePane"),
042        new Item("MenuItemSendFrame", "jmri.jmrix.can.swing.send.CanSendPane"),
043        new Item("MenuItemEventCapture", "jmri.jmrix.can.cbus.swing.configtool.ConfigToolPane"),
044        new Item("MenuItemEventTable", "jmri.jmrix.can.cbus.swing.eventtable.CbusEventTablePane"),
045        new Item("MenuItemNodeConfig", "jmri.jmrix.can.cbus.swing.nodeconfig.NodeConfigToolPane"),
046        new Item("MenuItemCbusSlotMonitor", "jmri.jmrix.can.cbus.swing.cbusslotmonitor.CbusSlotMonitorPane"),
047        new Item("MenuItemEvRequestMon", "jmri.jmrix.can.cbus.swing.eventrequestmonitor.CbusEventRequestTablePane"),
048        new Item("MenuItemNetworkSim", "jmri.jmrix.can.cbus.swing.simulator.SimulatorPane"),
049        new Item("MenuItemBootloader", "jmri.jmrix.can.cbus.swing.bootloader.CbusBootloaderPane"),
050        new Item("MenuItemCbusHub", "jmri.jmrix.can.cbus.swing.hubpane.CbusHubPane")
051    };
052
053    static class Item {
054
055        Item(String name, String load) {
056            this.name = name;
057            this.load = load;
058        }
059
060        String name;
061        String load;
062    }
063
064}