Search in sources :

Example 6 with FlowVariableListCellRenderer

use of org.knime.core.node.util.FlowVariableListCellRenderer in project knime-core by knime.

the class VariableFileReaderNodeDialog method createFileNamePanel.

private JPanel createFileNamePanel() {
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    panel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Select variable holding file location: (press 'Enter' to " + "update preview)"));
    Box fileBox = Box.createHorizontalBox();
    // Creating the brows button here in order to get its preferred height
    int buttonHeight = 20;
    m_urlCombo = new JComboBox();
    m_urlCombo.setEditable(false);
    m_urlCombo.setRenderer(new FlowVariableListCellRenderer());
    m_urlCombo.setMaximumSize(new Dimension(PANEL_WIDTH, buttonHeight));
    m_urlCombo.setMinimumSize(new Dimension(350, buttonHeight));
    m_urlCombo.setPreferredSize(new Dimension(350, buttonHeight));
    fileBox.add(Box.createHorizontalGlue());
    fileBox.add(new JLabel("Flow Variable Name:"));
    fileBox.add(Box.createHorizontalStrut(HORIZ_SPACE));
    fileBox.add(m_urlCombo);
    fileBox.add(Box.createVerticalStrut(50));
    fileBox.add(Box.createHorizontalGlue());
    // the checkbox for preserving the current settings on file change
    Box preserveBox = Box.createHorizontalBox();
    m_preserveSettings = new JCheckBox("Preserve user settings for new location");
    m_preserveSettings.setToolTipText("if not checked, the settings you" + " have set are reset, if a new location is entered");
    m_preserveSettings.setSelected(false);
    m_preserveSettings.setEnabled(true);
    preserveBox.add(Box.createHorizontalGlue());
    preserveBox.add(m_preserveSettings);
    preserveBox.add(Box.createHorizontalGlue());
    panel.add(fileBox);
    panel.add(preserveBox);
    panel.setMaximumSize(new Dimension(PANEL_WIDTH, 70));
    panel.setMinimumSize(new Dimension(PANEL_WIDTH, 70));
    m_urlCombo.addItemListener(this);
    /* install action listeners */
    // set stuff to update preview when file location changes
    m_urlCombo.addFocusListener(new FocusAdapter() {

        @Override
        public void focusLost(final FocusEvent e) {
            fileLocationChanged();
        }
    });
    return panel;
}
Also used : JCheckBox(javax.swing.JCheckBox) JPanel(javax.swing.JPanel) FlowVariableListCellRenderer(org.knime.core.node.util.FlowVariableListCellRenderer) FocusAdapter(java.awt.event.FocusAdapter) JComboBox(javax.swing.JComboBox) BoxLayout(javax.swing.BoxLayout) JLabel(javax.swing.JLabel) JComboBox(javax.swing.JComboBox) Box(javax.swing.Box) JCheckBox(javax.swing.JCheckBox) Dimension(java.awt.Dimension) FocusEvent(java.awt.event.FocusEvent)

Aggregations

FlowVariableListCellRenderer (org.knime.core.node.util.FlowVariableListCellRenderer)6 DataColumnSpecListCellRenderer (org.knime.core.node.util.DataColumnSpecListCellRenderer)3 FlowVariable (org.knime.core.node.workflow.FlowVariable)3 Dimension (java.awt.Dimension)2 ActionEvent (java.awt.event.ActionEvent)2 ActionListener (java.awt.event.ActionListener)2 KeyAdapter (java.awt.event.KeyAdapter)2 KeyEvent (java.awt.event.KeyEvent)2 MouseAdapter (java.awt.event.MouseAdapter)2 MouseEvent (java.awt.event.MouseEvent)2 JCheckBox (javax.swing.JCheckBox)2 JComboBox (javax.swing.JComboBox)2 JLabel (javax.swing.JLabel)2 JPanel (javax.swing.JPanel)2 DataColumnSpec (org.knime.core.data.DataColumnSpec)2 BorderLayout (java.awt.BorderLayout)1 FocusAdapter (java.awt.event.FocusAdapter)1 FocusEvent (java.awt.event.FocusEvent)1 Box (javax.swing.Box)1 BoxLayout (javax.swing.BoxLayout)1