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 // Add separator and MCAN BOOT menu item 033 if (memo != null) { 034 add(new javax.swing.JSeparator()); 035 add(new MarklinSendBootAction(Bundle.getMessage("MenuItemSendMCanBoot"), memo)); 036 } 037 038 } 039 040 private static final Item[] panelItems = new Item[]{ 041 new Item("MenuItemMarklinMonitor", "jmri.jmrix.marklin.swing.monitor.MarklinMonPane"), 042 new Item("MenuItemSendPacket", "jmri.jmrix.marklin.swing.packetgen.PacketGenPanel"),}; 043 044 private static class Item { 045 046 Item(String name, String load) { 047 this.name = name; 048 this.load = load; 049 } 050 051 String name; 052 String load; 053 } 054 055}