001package jmri.jmrix.openlcb; 002 003import java.util.ResourceBundle; 004import javax.swing.JMenu; 005import jmri.jmrix.can.swing.CanNamedPaneAction; 006 007/** 008 * Create a menu containing the JMRI OpenLCB-specific tools. 009 * 010 * @author Bob Jacobsen Copyright 2010 011 */ 012public class OpenLcbMenu extends JMenu { 013 014 public OpenLcbMenu(jmri.jmrix.can.CanSystemConnectionMemo memo) { 015 super(); 016 017 ResourceBundle rb = ResourceBundle.getBundle("jmri.jmrix.JmrixSystemsBundle"); 018 019 if (memo != null) { 020 setText(memo.getUserName()); 021 } else { 022 setText(rb.getString("MenuItemCAN")); // would expect this to be called MenuItemOpenLCB 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 CanNamedPaneAction(rb.getString(item.name), wi, item.load, memo)); 032 } 033 } 034 } 035 036 final Item[] panelItems = new Item[]{ 037 new Item("MenuItemTrafficMonitor", "jmri.jmrix.openlcb.swing.monitor.MonitorPane"), // NOI18N 038 new Item("MenuItemConfigNodes", "jmri.jmrix.openlcb.swing.networktree.NetworkTreePane"), // NOI18N 039 new Item("MenuItemStartHub", "jmri.jmrix.openlcb.swing.hub.HubPane"), // NOI18N 040 new Item("MenuItemFirmwareUpdate", "jmri.jmrix.openlcb.swing.downloader.LoaderPane"), // NOI18N 041 new Item("MenuItemEventTable", "jmri.jmrix.openlcb.swing.eventtable.EventTablePane"), // NOI18N 042 new Item("MenuItemSendFrame", "jmri.jmrix.openlcb.swing.send.OpenLcbCanSendPane"), // NOI18N 043 new Item("MenuItemMemoryTool", "jmri.jmrix.openlcb.swing.memtool.MemoryToolPane"), // NOI18N 044 new Item("MenuItemIdTool", "jmri.jmrix.openlcb.swing.idtool.IdToolPane"), // NOI18N 045 new Item("MenuItemSTLEditor", "jmri.jmrix.openlcb.swing.stleditor.StlEditorPane"), // NOI18N 046 }; 047 048 static class Item { 049 050 Item(String name, String load) { 051 this.name = name; 052 this.load = load; 053 } 054 055 final String name; 056 final String load; 057 } 058 059}