001package jmri.jmrix.marklin.swing;
002
003import javax.swing.JMenu;
004import jmri.jmrix.marklin.MarklinSystemConnectionMemo;
005
006/**
007 * Create a "Systems" menu containing the JMRI Marklin-specific tools.
008 *
009 * @author Kevin Dickerson
010 */
011public class MarklinMenu extends JMenu {
012
013    public MarklinMenu(MarklinSystemConnectionMemo memo) {
014        super();
015
016        if (memo != null) {
017            setText(memo.getUserName());
018        } else {
019            setText(Bundle.getMessage("MenuMarklin"));
020        }
021
022        jmri.util.swing.WindowInterface wi = new jmri.util.swing.sdi.JmriJFrameInterface();
023
024        for (Item item : panelItems) {
025            if (item == null) {
026                add(new javax.swing.JSeparator());
027            } else {
028                add(new MarklinNamedPaneAction(Bundle.getMessage(item.name), wi, item.load, memo));
029            }
030        }
031
032    }
033
034    private static final Item[] panelItems = new Item[]{
035        new Item("MenuItemMarklinMonitor", "jmri.jmrix.marklin.swing.monitor.MarklinMonPane"),
036        new Item("MenuItemSendPacket", "jmri.jmrix.marklin.swing.packetgen.PacketGenPanel"),};
037
038    private static class Item {
039
040        Item(String name, String load) {
041            this.name = name;
042            this.load = load;
043        }
044
045        String name;
046        String load;
047    }
048
049    // private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(MarklinMenu.class);
050
051}