001package jmri.jmrix.bidib.swing; 002 003import javax.swing.JMenu; 004import javax.swing.JSeparator; 005import jmri.jmrix.bidib.BiDiBSystemConnectionMemo; 006import jmri.util.swing.WindowInterface; 007import jmri.util.swing.sdi.JmriJFrameInterface; 008 009/** 010 * Create a "Systems" menu containing the Jmri BiDiB-specific tools. 011 * 012 * @author Bob Jacobsen Copyright 2003, 2006, 2007, 2008 013 * @author Matthew Harris Copyright 2011 014 * @since 2.11.4 015 * @author Eckart Meyer Copyright (C) 2020-2023 016 */ 017public class BiDiBMenu extends JMenu { 018 019// @SuppressWarnings("OverridableMethodCallInConstructor") 020 public BiDiBMenu(BiDiBSystemConnectionMemo memo) { 021 022 super(); 023 024 if (memo != null) { 025 setText(memo.getUserName()); 026 } else { 027 setText(Bundle.getMessage("MenuBiDiB")); 028 } 029 030 WindowInterface wi = new JmriJFrameInterface(); 031 032 for (Item item : panelItems) { 033 if (item == null || memo == null) { 034 add(new JSeparator()); 035 } else { 036 add(new BiDiBNamedPaneAction(item.name, wi, item.load, memo)); // NOI18N 037 } 038 } 039 add(new javax.swing.JSeparator()); 040 add(new jmri.jmrix.bidib.tcpserver.TcpServerAction(memo, Bundle.getMessage("MenuItemStartBiDiBOverTCPServer"), Bundle.getMessage("MenuItemStopBiDiBOverTCPServer"))); 041 } 042 043 Item[] panelItems = new Item[]{ 044 new Item(Bundle.getMessage("BiDiBMonPaneTitle"), "jmri.jmrix.bidib.swing.mon.BiDiBMonPane") 045 }; 046 047 static class Item { 048 049 String name; 050 String load; 051 052 Item(String name, String load) { 053 this.name = name; 054 this.load = load; 055 } 056 } 057 058}