001package jmri.jmrix.grapevine.nodetable;
002
003import java.awt.Container;
004import javax.swing.BoxLayout;
005import jmri.jmrix.grapevine.GrapevineSystemConnectionMemo;
006import jmri.util.JmriJFrame;
007
008/**
009 * Frame for user configuration of serial nodes.
010 *
011 * @author Bob Jacobsen Copyright (C) 2004, 2007
012 * @author Dave Duchamp Copyright (C) 2004, 2006
013 */
014public class NodeTableFrame extends JmriJFrame {
015
016    private GrapevineSystemConnectionMemo memo = null;
017
018    /**
019     * Create a new NodeTableFrame.
020     *
021     * @param _memo the {@link jmri.jmrix.grapevine.GrapevineSystemConnectionMemo} for this table
022     */
023    public NodeTableFrame(GrapevineSystemConnectionMemo _memo) {
024        super();
025        memo = _memo;
026    }
027
028    NodeTablePane p;
029
030    /**
031     * {@inheritDoc}
032     * Initialize the NodeTableFrame window.
033     */
034    @Override
035    public void initComponents() {
036        setTitle(Bundle.getMessage("WindowTitle"));
037
038        Container contentPane = getContentPane();
039        contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
040
041        // add table
042        p = new NodeTablePane(memo);
043        p.initComponents();
044        contentPane.add(p);
045
046        // add help menu to window
047        addHelpMenu("package.jmri.jmrix.grapevine.nodetable.NodeTableFrame", true);
048
049        // register
050        memo.getTrafficController().addSerialListener(p);
051        // pack for display
052        pack();
053    }
054
055    /**
056     * {@inheritDoc}
057     */
058    @Override
059    public void dispose() {
060        memo.getTrafficController().removeSerialListener(p);
061        super.dispose();
062    }
063
064}