001package jmri.jmrix.grapevine; 002 003import javax.swing.JMenu; 004 005/** 006 * Create a "Systems" menu containing the Jmri Grapevine-specific tools. 007 * 008 * @author Bob Jacobsen Copyright 2003, 2006, 2007 009 */ 010public class GrapevineMenu extends JMenu { 011 012 private GrapevineSystemConnectionMemo memo = null; 013 014 public GrapevineMenu(String name, GrapevineSystemConnectionMemo _memo) { 015 this(_memo); 016 setText(name); 017 } 018 019 public GrapevineMenu(GrapevineSystemConnectionMemo _memo) { 020 021 super(); 022 memo = _memo; 023 024 if (memo != null) { 025 setText(memo.getUserName()); 026 } else { 027 setText(Bundle.getMessage("MenuSystem")); 028 } 029 030 if (memo != null) { 031 // do we have a GrapevineTrafficController? 032 setEnabled(memo.getTrafficController() != null); // disable menu, no connection, no tools! 033 add(new jmri.jmrix.grapevine.serialmon.SerialMonAction(Bundle.getMessage("MenuItemCommandMonitor"), memo)); 034 add(new jmri.jmrix.grapevine.packetgen.SerialPacketGenAction(Bundle.getMessage("MenuItemSendCommand"), memo)); 035 add(new jmri.jmrix.grapevine.nodeconfig.NodeConfigAction(Bundle.getMessage("ConfigNodesTitle"), memo)); 036 add(new jmri.jmrix.grapevine.nodetable.NodeTableAction(Bundle.getMessage("MenuItemNodeTable"), memo)); 037 } 038 } 039 040}