001package jmri.jmrix.tams.swing;
002
003import javax.swing.JMenu;
004import jmri.jmrix.tams.TamsSystemConnectionMemo;
005
006/**
007 * Create a "Systems" menu containing the Tams-specific tools.
008 *
009 * Based on work by Bob Jacobsen
010 * @author Kevin Dickerson Copyright (C) 2012
011 */
012public class TamsMenu extends JMenu {
013
014    public TamsMenu(TamsSystemConnectionMemo memo) {
015        super();
016
017        if (memo != null) {
018            setText(memo.getUserName());
019        } else {
020            setText(Bundle.getMessage("MenuTams"));
021        }
022
023        jmri.util.swing.WindowInterface wi = new jmri.util.swing.sdi.JmriJFrameInterface();
024
025        for (Item item : panelItems) {
026            if (item == null) {
027                add(new javax.swing.JSeparator());
028            } else {
029                add(new TamsNamedPaneAction(Bundle.getMessage(item.name), wi, item.load, memo));
030            }
031        }
032
033    }
034
035    Item[] panelItems = new Item[]{
036        new Item("MenuItemTamsMonitor", "jmri.jmrix.tams.swing.monitor.TamsMonPane"),
037        new Item("MenuItemSendPacket", "jmri.jmrix.tams.swing.packetgen.PacketGenPanel"),
038        new Item("MenuItemInfo", "jmri.jmrix.tams.swing.statusframe.StatusPanel"),
039        new Item("MenuItemLocoData", "jmri.jmrix.tams.swing.locodatabase.LocoDataPane"),};
040
041    static class Item {
042
043        Item(String name, String load) {
044            this.name = name;
045            this.load = load;
046        }
047
048        String name;
049        String load;
050    }
051
052    // private static final org.slf4j.Logger log = org.slf4j.LoggerFactory.getLogger(TamsMenu.class);
053
054}