001package jmri.jmrix.openlcb.swing.tie;
002
003import java.awt.Container;
004import java.awt.FlowLayout;
005import java.util.ResourceBundle;
006import javax.swing.BorderFactory;
007import javax.swing.BoxLayout;
008import javax.swing.JButton;
009import javax.swing.JMenu;
010import javax.swing.JMenuBar;
011import javax.swing.JPanel;
012import javax.swing.JSplitPane;
013import javax.swing.border.Border;
014
015/**
016 * Frame for running assignment list.
017 *
018 * For historical reasons, this refers to Events as Ties.
019 * That really has to change sometime soon
020 *
021 * @author Bob Jacobsen 2008
022 * @since 2.3.7
023 */
024public class TieToolFrame extends jmri.util.JmriJFrame {
025
026    static final ResourceBundle rb = ResourceBundle.getBundle("jmri.jmrix.openlcb.swing.tie.TieBundle");
027
028    /** 
029     * {@inheritDoc}
030     */
031    @Override
032    public void initComponents() {
033
034        // set the frame's initial state
035        setTitle(rb.getString("WindowTitle"));
036
037        Container contentPane = getContentPane();
038        contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
039
040        ProducerTablePane producerPane = new ProducerTablePane();
041        producerPane.initComponents();
042        Border producerBorder = BorderFactory.createEtchedBorder();
043        Border producerTitled = BorderFactory.createTitledBorder(producerBorder, "Producers");
044        producerPane.setBorder(producerTitled);
045
046        ConsumerTablePane consumerPane = new ConsumerTablePane();
047        consumerPane.initComponents();
048        Border consumerBorder = BorderFactory.createEtchedBorder();
049        Border consumerTitled = BorderFactory.createTitledBorder(consumerBorder, "Consumers");
050        consumerPane.setBorder(consumerTitled);
051
052        TieTablePane tiePane = new TieTablePane();
053        tiePane.initComponents();
054        Border tieBorder = BorderFactory.createEtchedBorder();
055        Border tieTitled = BorderFactory.createTitledBorder(tieBorder, "Events");
056        tiePane.setBorder(tieTitled);
057
058        JSplitPane upperSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, producerPane, consumerPane);
059
060        JSplitPane wholeSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, upperSplit, tiePane);
061
062        JPanel p1 = new JPanel();
063        p1.add(wholeSplit);
064        contentPane.add(p1);
065
066        JPanel p2 = new JPanel();
067        p2.setLayout(new FlowLayout());
068        p2.add(new JButton("Add"));
069        p2.add(new JButton("Update"));
070        p2.add(new JButton("Delete"));
071        contentPane.add(p2);
072
073        // initialize menu bar
074        JMenuBar menuBar = new JMenuBar();
075        // set up File menu
076        JMenu fileMenu = new JMenu("File");
077        menuBar.add(fileMenu);
078        // fileMenu.add(...);
079        setJMenuBar(menuBar);
080
081        addHelpMenu("package.jmri.jmrix.openlcb.swing.tie.TieToolFrame", true);
082
083        // pack for display
084        pack();
085    }
086
087}