001package jmri.jmrit.signalling;
002
003import javax.swing.BoxLayout;
004import javax.swing.JButton;
005
006/**
007 * Frame for Signal Logic Source Mast status.
008 *
009 * @author Kevin Dickerson Copyright (C) 2011
010 */
011public class SignallingSourceFrame extends jmri.util.JmriJFrame {
012
013    public SignallingSourceFrame() {
014        super(false, true);
015    }
016
017    JButton sendButton;
018    SignallingSourcePanel sigPanel;
019    // boolean inEditMode = false; // to warn and prevent opening more than 1 editing session
020    // cannot determine finishing of Edit session (cf. SignalGroupTableAction#addPressed(e)
021
022    public void initComponents(jmri.SignalMast source) {
023        // the following code sets the frame's initial state
024        sigPanel = new SignallingSourcePanel(source);
025        sigPanel.initComponents();
026
027        setTitle(Bundle.getMessage("SignallingPairs") + ": " + source.getDisplayName());  // NOI18N
028        getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
029
030        getContentPane().add(sigPanel);
031
032        addHelpMenu("package.jmri.jmrit.signalling.SignallingSourceFrame", true);  // NOI18N
033
034        // pack for display
035        pack();
036
037        // setup window closing listener
038        this.addWindowListener(new java.awt.event.WindowAdapter() {
039            @Override
040            public void windowClosing(java.awt.event.WindowEvent e) {
041                // remove property change listeners
042                if (sigPanel != null) {
043                    sigPanel.dispose();
044                }
045            }
046        });
047    }
048}