001package jmri.jmrix.dccpp.swing;
002
003import java.util.ResourceBundle;
004import javax.swing.JMenu;
005
006/**
007 * Create a menu containing the DCC++ specific tools.
008 *
009 * @author Paul Bender Copyright 2003,2010
010 * @author Mark Underwood Copyright 2015
011 *
012 * Based on XNetMenu by Paul Bender
013 */
014public class DCCppMenu extends JMenu {
015
016
017    public DCCppMenu(String name, jmri.jmrix.dccpp.DCCppSystemConnectionMemo memo) {
018        this(memo);
019        setText(name);
020    }
021
022    public DCCppMenu(jmri.jmrix.dccpp.DCCppSystemConnectionMemo memo) {
023
024        super();
025        ResourceBundle rb = ResourceBundle.getBundle("jmri.jmrix.dccpp.swing.DCCppSwingBundle");
026
027        if (memo != null) {
028            setText(memo.getUserName());
029        } else {
030            setText(rb.getString("MenuDCC++"));
031        }
032
033        if (memo != null) {
034            add(new jmri.jmrix.dccpp.swing.mon.DCCppMonAction(rb.getString("DCCppMonFrameTitle"), memo));
035            add(new jmri.jmrix.dccpp.swing.packetgen.PacketGenAction(rb.getString("MenuItemSendDCCppCommand"), memo));
036            add(new jmri.jmrix.dccpp.swing.ConfigBaseStationAction(rb.getString("MenuItemConfigBaseStation"), memo));
037            add(new jmri.jmrix.dccpp.swing.virtuallcd.VirtualLCDAction(rb.getString("MenuItemVirtualLCDDisplay"), memo));
038        }
039        add(new jmri.jmrit.swing.meter.MeterAction());
040        add(new jmri.jmrix.dccpp.swing.DCCppRosterExportAction(rb.getString("DCCppRosterExportTitle")));
041        add(new javax.swing.JSeparator());
042        add(new jmri.jmrix.dccpp.dccppovertcp.ServerAction(rb.getString("MenuItemDCCppOverTCPServer")));
043    }
044
045}