001package jmri.jmrix.dcc4pc.swing;
002
003import java.util.ResourceBundle;
004import javax.swing.JMenu;
005import jmri.jmrix.dcc4pc.Dcc4PcSystemConnectionMemo;
006
007/**
008 * Create a "Systems" menu containing the Jmri DCC4PC-specific tools
009 *
010 * @author Kevin Dickerson
011 */
012public class Dcc4PcMenu extends JMenu {
013
014    public Dcc4PcMenu(Dcc4PcSystemConnectionMemo memo) {
015        super();
016
017        ResourceBundle rb = ResourceBundle.getBundle("jmri.jmrix.dcc4pc.Dcc4PcBundle");
018
019        if (memo != null) {
020            setText(memo.getUserName());
021        } else {
022            setText(rb.getString("MenuDcc4Pc"));
023        }
024
025        jmri.util.swing.WindowInterface wi = new jmri.util.swing.sdi.JmriJFrameInterface();
026
027        for (Item item : panelItems) {
028            if (item == null) {
029                add(new javax.swing.JSeparator());
030            } else {
031                add(new Dcc4PcNamedPaneAction(rb.getString(item.name), wi, item.load, memo));
032            }
033        }
034
035        if (jmri.InstanceManager.getNullableDefault(jmri.jmrit.beantable.ListedTableFrame.class) == null) {
036            new jmri.jmrit.beantable.ListedTableFrame<jmri.Turnout>();
037        }
038    }
039
040    Item[] panelItems = new Item[]{
041        new Item("MenuItemDcc4PcMonitor", "jmri.jmrix.dcc4pc.swing.monitor.Dcc4PcMonPane"),
042        new Item("MenuItemSendPacket", "jmri.jmrix.dcc4pc.swing.packetgen.PacketGenPanel"),
043        new Item("MenuItemInfo", "jmri.jmrix.dcc4pc.swing.StatusPanel"),
044        new Item("MenuItemBoardList", "jmri.jmrix.dcc4pc.swing.boardlists.BoardListPanel")
045
046    };
047
048    static class Item {
049
050        Item(String name, String load) {
051            this.name = name;
052            this.load = load;
053        }
054
055        String name;
056        String load;
057    }
058
059}