Search in sources :

Example 1 with PickListModel

use of jmri.jmrit.picker.PickListModel in project JMRI by JMRI.

the class DetectionPanel method openPickList.

void openPickList() {
    _pickFrame = new JFrame();
    JPanel content = new JPanel();
    content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS));
    JPanel blurb = new JPanel();
    blurb.setLayout(new BoxLayout(blurb, BoxLayout.Y_AXIS));
    blurb.add(Box.createVerticalStrut(ItemPalette.STRUT_SIZE));
    blurb.add(new JLabel(Bundle.getMessage("DragOccupancyName", Bundle.getMessage("DetectionSensor"))));
    blurb.add(new JLabel(Bundle.getMessage("DragErrorName", Bundle.getMessage("ErrorSensor"))));
    blurb.add(Box.createVerticalStrut(ItemPalette.STRUT_SIZE));
    JPanel panel = new JPanel();
    panel.add(blurb);
    content.add(panel);
    PickListModel[] models = { PickListModel.oBlockPickModelInstance(), PickListModel.sensorPickModelInstance() };
    content.add(new PickPanel(models));
    _pickFrame.setContentPane(content);
    _pickFrame.addWindowListener(new java.awt.event.WindowAdapter() {

        @Override
        public void windowClosing(java.awt.event.WindowEvent e) {
            closePickList();
        }
    });
    _pickFrame.setLocationRelativeTo(this);
    _pickFrame.toFront();
    _pickFrame.setVisible(true);
    _pickFrame.pack();
    _openPicklistButton.setText(Bundle.getMessage("ClosePicklist"));
}
Also used : JPanel(javax.swing.JPanel) PickPanel(jmri.jmrit.picker.PickPanel) PickListModel(jmri.jmrit.picker.PickListModel) JFrame(javax.swing.JFrame) BoxLayout(javax.swing.BoxLayout) JLabel(javax.swing.JLabel)

Example 2 with PickListModel

use of jmri.jmrit.picker.PickListModel in project JMRI by JMRI.

the class WarrantFrame method makeFindRouteTabPanel.

private JPanel makeFindRouteTabPanel() {
    JPanel tab1 = new JPanel();
    tab1.setLayout(new BoxLayout(tab1, BoxLayout.LINE_AXIS));
    tab1.add(Box.createHorizontalStrut(STRUT_SIZE));
    JPanel topLeft = new JPanel();
    topLeft.setLayout(new BoxLayout(topLeft, BoxLayout.PAGE_AXIS));
    topLeft.add(makeBlockPanels());
    topLeft.add(Box.createVerticalStrut(2 * STRUT_SIZE));
    tab1.add(topLeft);
    tab1.add(Box.createHorizontalStrut(STRUT_SIZE));
    JPanel topRight = new JPanel();
    topRight.setLayout(new BoxLayout(topRight, BoxLayout.LINE_AXIS));
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
    panel.add(Box.createVerticalStrut(2 * STRUT_SIZE));
    _calculateButton = new JButton(Bundle.getMessage("Calculate"));
    _calculateButton.setMaximumSize(_calculateButton.getPreferredSize());
    _calculateButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            calculate();
        }
    });
    JPanel p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.PAGE_AXIS));
    JPanel pp = new JPanel();
    pp.setLayout(new FlowLayout(FlowLayout.CENTER));
    pp.add(new JLabel(Bundle.getMessage("CalculateRoute")));
    p.add(pp);
    pp = new JPanel();
    pp.setLayout(new FlowLayout(FlowLayout.CENTER));
    pp.add(_calculateButton);
    p.add(pp);
    panel.add(p);
    panel.add(Box.createVerticalStrut(2 * STRUT_SIZE));
    _stopButton = new JButton(Bundle.getMessage("Stop"));
    _stopButton.setMaximumSize(_stopButton.getPreferredSize());
    _stopButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            stopRouteFinder();
        }
    });
    int numBlocks = InstanceManager.getDefault(OBlockManager.class).getSystemNameList().size();
    if (numBlocks / 6 > getDepth()) {
        setDepth(numBlocks / 6);
    }
    panel.add(searchDepthPanel(true));
    p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.PAGE_AXIS));
    p.add(makeTextBoxPanel(true, _searchStatus, "SearchRoute", null));
    _searchStatus.setEditable(false);
    p.add(Box.createVerticalGlue());
    panel.add(p);
    _searchStatus.setBackground(Color.white);
    _searchStatus.setEditable(false);
    p = new JPanel();
    pp = new JPanel();
    pp.setLayout(new FlowLayout(FlowLayout.CENTER));
    pp.add(_stopButton);
    p.add(pp, BorderLayout.SOUTH);
    panel.add(p);
    panel.add(Box.createRigidArea(new Dimension(10, topLeft.getPreferredSize().height - panel.getPreferredSize().height)));
    panel.add(Box.createVerticalStrut(STRUT_SIZE));
    panel.add(Box.createVerticalGlue());
    topRight.add(panel);
    topRight.add(Box.createHorizontalStrut(STRUT_SIZE));
    PickListModel pickListModel = PickListModel.oBlockPickModelInstance();
    topRight.add(new JScrollPane(pickListModel.makePickTable()));
    Dimension dim = topRight.getPreferredSize();
    topRight.setMinimumSize(dim);
    tab1.add(topRight);
    tab1.add(Box.createHorizontalStrut(STRUT_SIZE));
    return tab1;
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) FlowLayout(java.awt.FlowLayout) ActionListener(java.awt.event.ActionListener) PickListModel(jmri.jmrit.picker.PickListModel) ActionEvent(java.awt.event.ActionEvent) BoxLayout(javax.swing.BoxLayout) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension)

Example 3 with PickListModel

use of jmri.jmrit.picker.PickListModel in project JMRI by JMRI.

the class EditCircuitFrame method openPickList.

void openPickList() {
    _pickFrame = new JFrame();
    JPanel content = new JPanel();
    content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS));
    JPanel blurb = new JPanel();
    blurb.setLayout(new BoxLayout(blurb, BoxLayout.Y_AXIS));
    blurb.add(Box.createVerticalStrut(ItemPalette.STRUT_SIZE));
    blurb.add(new JLabel(Bundle.getMessage("DragOccupancyName", Bundle.getMessage("DetectionSensor"))));
    blurb.add(new JLabel(Bundle.getMessage("DragErrorName", Bundle.getMessage("ErrorSensor"))));
    blurb.add(Box.createVerticalStrut(ItemPalette.STRUT_SIZE));
    JPanel panel = new JPanel();
    panel.add(blurb);
    content.add(panel);
    PickListModel[] models = { PickListModel.sensorPickModelInstance() };
    content.add(new PickPanel(models));
    _pickFrame.setContentPane(content);
    _pickFrame.addWindowListener(new java.awt.event.WindowAdapter() {

        @Override
        public void windowClosing(java.awt.event.WindowEvent e) {
            closePickList();
        }
    });
    _pickFrame.setLocationRelativeTo(this);
    _pickFrame.toFront();
    _pickFrame.setVisible(true);
    _pickFrame.pack();
    _openPicklistButton.setText(Bundle.getMessage("ClosePicklist"));
}
Also used : JPanel(javax.swing.JPanel) PickPanel(jmri.jmrit.picker.PickPanel) PickListModel(jmri.jmrit.picker.PickListModel) JFrame(javax.swing.JFrame) BoxLayout(javax.swing.BoxLayout) JLabel(javax.swing.JLabel)

Aggregations

BoxLayout (javax.swing.BoxLayout)3 JLabel (javax.swing.JLabel)3 JPanel (javax.swing.JPanel)3 PickListModel (jmri.jmrit.picker.PickListModel)3 JFrame (javax.swing.JFrame)2 PickPanel (jmri.jmrit.picker.PickPanel)2 Dimension (java.awt.Dimension)1 FlowLayout (java.awt.FlowLayout)1 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 JButton (javax.swing.JButton)1 JScrollPane (javax.swing.JScrollPane)1