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
026        setTitle(Bundle.getMessage("SignallingPairs") + ": " + source.getDisplayName());  // NOI18N
027        getContentPane().setLayout(new BoxLayout(getContentPane(), BoxLayout.Y_AXIS));
028
029        getContentPane().add(sigPanel);
030
031        addHelpMenu("package.jmri.jmrit.signalling.SignallingSourceFrame", true);  // NOI18N
032
033        // pack for display
034        pack();
035
036        // setup window closing listener
037        this.addWindowListener(new java.awt.event.WindowAdapter() {
038            @Override
039            public void windowClosing(java.awt.event.WindowEvent e) {
040                // remove property change listeners
041                if (sigPanel != null) {
042                    sigPanel.dispose();
043                }
044            }
045        });
046    }
047}