001package jmri.jmrix.rfid.swing;
002
003import javax.swing.JMenu;
004import javax.swing.JSeparator;
005import jmri.jmrix.rfid.RfidSystemConnectionMemo;
006import jmri.util.swing.WindowInterface;
007import jmri.util.swing.sdi.JmriJFrameInterface;
008
009/**
010 * Create a "Systems" menu containing the Jmri RFID-specific tools.
011 *
012 * @author Bob Jacobsen Copyright 2003, 2006, 2007, 2008
013 * @author Matthew Harris Copyright 2011
014 * @since 2.11.4
015 */
016public class RfidMenu extends JMenu {
017
018//    @SuppressWarnings("OverridableMethodCallInConstructor")
019    public RfidMenu(RfidSystemConnectionMemo memo) {
020
021        super();
022
023        if (memo != null) {
024            setText(memo.getUserName());
025        } else {
026            setText(Bundle.getMessage("MenuSystem"));
027        }
028
029        WindowInterface wi = new JmriJFrameInterface();
030
031        for (Item item : panelItems) {
032            if (item == null) {
033                add(new JSeparator());
034            } else {
035                add(new RfidNamedPaneAction(item.name, wi, item.load, memo)); // NOI18N
036            }
037        }
038    }
039
040    Item[] panelItems = new Item[]{
041        new Item(Bundle.getMessage("MonitorXTitle", "RFID"), "jmri.jmrix.rfid.swing.serialmon.SerialMonPane"),
042        new Item(Bundle.getMessage("MonitorRFIDTagCars", "RFID"), "jmri.jmrix.rfid.swing.tagcarwin.TagMonitorPane")
043    };
044
045    static class Item {
046
047        String name;
048        String load;
049
050        Item(String name, String load) {
051            this.name = name;
052            this.load = load;
053        }
054    }
055
056}