Search in sources :

Example 51 with JSplitPane

use of javax.swing.JSplitPane in project knime-core by knime.

the class DataValidatorNodeDialogPane method updateDataTableSpecComparison.

private void updateDataTableSpecComparison() {
    m_refTableSpecTab.removeAll();
    JPanel northern = new JPanel(new GridLayout(0, 1));
    DataTableSpecView refTableSpecView = new DataTableSpecView(m_referenceDataTableSpec);
    refTableSpecView.setPreferredSize(new Dimension(-1, 150));
    northern.add(new JScrollPane(refTableSpecView, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED));
    northern.setBorder(BorderFactory.createTitledBorder("Reference Table Spec"));
    if (!m_referenceDataTableSpec.equals(m_inputDataTableSpec)) {
        m_refTableSpecTab.add(northern);
        JPanel southern = new JPanel(new GridLayout(0, 1));
        southern.setBorder(BorderFactory.createTitledBorder("Input Table Spec"));
        DataTableSpecView inputTableSpec = new DataTableSpecView(m_inputDataTableSpec);
        inputTableSpec.setPreferredSize(new Dimension(-1, 150));
        southern.add(new JScrollPane(inputTableSpec, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED));
        m_refTableSpecTab.add(new JSplitPane(JSplitPane.VERTICAL_SPLIT, northern, southern));
    } else {
        m_refTableSpecTab.add(northern);
    }
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) GridLayout(java.awt.GridLayout) DataTableSpecView(org.knime.core.node.workflow.DataTableSpecView) Dimension(java.awt.Dimension) JSplitPane(javax.swing.JSplitPane)

Example 52 with JSplitPane

use of javax.swing.JSplitPane in project knime-core by knime.

the class ParameterizedDBQueryPanel method createColumnsAndVariablesPanel.

private JComponent createColumnsAndVariablesPanel() {
    /* Create database column list */
    final JPanel dbColumnsPanel = new JPanel(new BorderLayout());
    dbColumnsPanel.setPreferredSize(new Dimension(200, 150));
    final JLabel dbColumnsLabel = new JLabel("Database Column List");
    dbColumnsLabel.setBorder(new EmptyBorder(5, 5, 5, 5));
    dbColumnsPanel.add(dbColumnsLabel, BorderLayout.NORTH);
    dbColumnsPanel.add(new JScrollPane(m_dbColumnsList), BorderLayout.CENTER);
    m_dbColumnsList.setCellRenderer(new DataColumnSpecListCellRenderer());
    m_dbColumnsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    m_dbColumnsList.addKeyListener(new KeyAdapter() {

        /**
         * {@inheritDoc}
         */
        @Override
        public void keyTyped(final KeyEvent evt) {
            if (evt.getKeyChar() == KeyEvent.VK_ENTER) {
                onSelectionInDatabaseList();
            }
        }
    });
    m_dbColumnsList.addMouseListener(new MouseAdapter() {

        /**
         * {@inheritDoc}
         */
        @Override
        public void mouseClicked(final MouseEvent evt) {
            if (evt.getClickCount() == 2) {
                onSelectionInDatabaseList();
            }
        }
    });
    /* Create Knime column list */
    final JPanel knimeColumnsPanel = new JPanel(new BorderLayout());
    knimeColumnsPanel.setPreferredSize(new Dimension(200, 150));
    final JLabel knimeColumnsLabel = new JLabel("Column List");
    knimeColumnsLabel.setBorder(new EmptyBorder(5, 5, 5, 5));
    knimeColumnsPanel.add(knimeColumnsLabel, BorderLayout.NORTH);
    knimeColumnsPanel.add(new JScrollPane(m_knimeColumnsList), BorderLayout.CENTER);
    m_knimeColumnsList.setCellRenderer(new DataColumnSpecListCellRenderer());
    m_knimeColumnsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    m_knimeColumnsList.addKeyListener(new KeyAdapter() {

        /**
         * {@inheritDoc}
         */
        @Override
        public void keyTyped(final KeyEvent evt) {
            if (evt.getKeyChar() == KeyEvent.VK_ENTER) {
                onSelectionInColumnList();
            }
        }
    });
    m_knimeColumnsList.addMouseListener(new MouseAdapter() {

        /**
         * {@inheritDoc}
         */
        @Override
        public void mouseClicked(final MouseEvent evt) {
            if (evt.getClickCount() == 2) {
                onSelectionInColumnList();
            }
        }
    });
    final JSplitPane columnsSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    columnsSplitPane.setResizeWeight(0.5);
    columnsSplitPane.setOneTouchExpandable(true);
    columnsSplitPane.setDividerSize(8);
    columnsSplitPane.setTopComponent(dbColumnsPanel);
    columnsSplitPane.setBottomComponent(knimeColumnsPanel);
    columnsSplitPane.setDividerLocation(150);
    /* Create flow variables list*/
    final JPanel variablesPanel = new JPanel(new BorderLayout());
    variablesPanel.setPreferredSize(new Dimension(200, 150));
    final JLabel variablesLabel = new JLabel("Flow Variable List");
    variablesLabel.setBorder(new EmptyBorder(5, 5, 5, 5));
    variablesPanel.add(variablesLabel, BorderLayout.NORTH);
    variablesPanel.add(new JScrollPane(m_flowVariablesList), BorderLayout.CENTER);
    m_flowVariablesList.setCellRenderer(new FlowVariableListCellRenderer());
    m_flowVariablesList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    m_flowVariablesList.addKeyListener(new KeyAdapter() {

        /**
         * {@inheritDoc}
         */
        @Override
        public void keyTyped(final KeyEvent evt) {
            if (evt.getKeyChar() == KeyEvent.VK_ENTER) {
                onSelectionInFlowVariableList();
            }
        }
    });
    m_flowVariablesList.addMouseListener(new MouseAdapter() {

        /**
         * {@inheritDoc}
         */
        @Override
        public void mouseClicked(final MouseEvent evt) {
            if (evt.getClickCount() == 2) {
                onSelectionInFlowVariableList();
            }
        }
    });
    final JSplitPane columnsVariableSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    columnsVariableSplitPane.setResizeWeight(0.5);
    columnsVariableSplitPane.setOneTouchExpandable(true);
    columnsVariableSplitPane.setDividerSize(8);
    columnsVariableSplitPane.setTopComponent(columnsSplitPane);
    columnsVariableSplitPane.setBottomComponent(variablesPanel);
    columnsVariableSplitPane.setDividerLocation(300);
    return columnsVariableSplitPane;
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) DataColumnSpecListCellRenderer(org.knime.core.node.util.DataColumnSpecListCellRenderer) MouseEvent(java.awt.event.MouseEvent) KeyAdapter(java.awt.event.KeyAdapter) MouseAdapter(java.awt.event.MouseAdapter) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) KeyEvent(java.awt.event.KeyEvent) FlowVariableListCellRenderer(org.knime.core.node.util.FlowVariableListCellRenderer) BorderLayout(java.awt.BorderLayout) EmptyBorder(javax.swing.border.EmptyBorder) JSplitPane(javax.swing.JSplitPane)

Example 53 with JSplitPane

use of javax.swing.JSplitPane in project knime-core by knime.

the class JavaScriptingPanel method createEditorPanel.

private JComponent createEditorPanel() {
    final JSplitPane split = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    split.setOneTouchExpandable(true);
    if (m_customizer.getShowGlobalDeclarationList()) {
        JScrollPane headerScroller = new JScrollPane(m_headerEdit);
        String borderTitle = "Global Variable Declaration";
        headerScroller.setBorder(createEmptyTitledBorder(borderTitle));
        split.setTopComponent(headerScroller);
    }
    JScrollPane bodyScroller = new JScrollPane(m_expEdit);
    String borderTitle = "Method Body";
    bodyScroller.setBorder(createEmptyTitledBorder(borderTitle));
    split.setBottomComponent(bodyScroller);
    split.setResizeWeight(0.2);
    return split;
}
Also used : JScrollPane(javax.swing.JScrollPane) JSplitPane(javax.swing.JSplitPane)

Example 54 with JSplitPane

use of javax.swing.JSplitPane in project knime-core by knime.

the class JavaSnippetNodeDialog method createColsAndVarsPanel.

/**
 * The panel at the left with the column and variables at the input. Override this method when the columns are
 * variables should not be displayed.
 *
 * @return the panel at the left with the column and variables at the input.
 */
protected JComponent createColsAndVarsPanel() {
    final JSplitPane varSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    m_colList = new ColumnList();
    final JScrollPane colListScroller = new JScrollPane(m_colList);
    colListScroller.setBorder(createEmptyTitledBorder("Column List"));
    varSplitPane.setTopComponent(colListScroller);
    // set variable panel
    m_flowVarsList = new FlowVariableList();
    final JScrollPane flowVarScroller = new JScrollPane(m_flowVarsList);
    flowVarScroller.setBorder(createEmptyTitledBorder("Flow Variable List"));
    varSplitPane.setBottomComponent(flowVarScroller);
    varSplitPane.setOneTouchExpandable(true);
    varSplitPane.setResizeWeight(0.9);
    return varSplitPane;
}
Also used : JScrollPane(javax.swing.JScrollPane) ColumnList(org.knime.base.node.jsnippet.ui.ColumnList) JSplitPane(javax.swing.JSplitPane) FlowVariableList(org.knime.base.node.jsnippet.ui.FlowVariableList)

Example 55 with JSplitPane

use of javax.swing.JSplitPane in project knime-core by knime.

the class JavaSnippetNodeDialog method createPanel.

private JPanel createPanel(final boolean isPreview) {
    final JPanel p = new JPanel(new BorderLayout());
    final JComponent snippet = createSnippetPanel();
    final JComponent colsAndVars = createColsAndVarsPanel();
    final JPanel centerPanel = new JPanel(new GridLayout(0, 1));
    final JSplitPane centerSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    centerSplitPane.setLeftComponent(colsAndVars);
    centerSplitPane.setRightComponent(snippet);
    // colsAndVars expands to 0.3, the snippet to 0.7
    centerSplitPane.setResizeWeight(0.3);
    m_inFieldsTable = createInFieldsTable();
    m_outFieldsTable = createOutFieldsTable();
    final TableModelListener tableModelListener = e -> {
        if (e.getType() != TableModelEvent.DELETE) {
            // Updating completion can result in a small delay,
            // so we don't update when fields are removed.
            updateAutocompletion();
        }
    };
    m_inFieldsTable.getTable().getModel().addTableModelListener(tableModelListener);
    m_outFieldsTable.getTable().getModel().addTableModelListener(tableModelListener);
    // use split pane for fields
    m_inFieldsTable.setBorder(BorderFactory.createTitledBorder("Input"));
    m_outFieldsTable.setBorder(BorderFactory.createTitledBorder("Output"));
    final JSplitPane fieldsPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    fieldsPane.setTopComponent(m_inFieldsTable);
    fieldsPane.setBottomComponent(m_outFieldsTable);
    fieldsPane.setOneTouchExpandable(true);
    final JSplitPane mainSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    mainSplitPane.setTopComponent(centerSplitPane);
    // minimize size of tables at the bottom
    fieldsPane.setPreferredSize(fieldsPane.getMinimumSize());
    mainSplitPane.setBottomComponent(fieldsPane);
    mainSplitPane.setOneTouchExpandable(true);
    // snippet gets more space, table with in/out gets less extra space
    mainSplitPane.setResizeWeight(0.7);
    centerPanel.add(mainSplitPane);
    p.add(centerPanel, BorderLayout.CENTER);
    final JPanel templateInfoPanel = createTemplateInfoPanel(isPreview);
    p.add(templateInfoPanel, BorderLayout.NORTH);
    final JPanel optionsPanel = createOptionsPanel();
    if (optionsPanel != null) {
        p.add(optionsPanel, BorderLayout.SOUTH);
    }
    return p;
}
Also used : Arrays(java.util.Arrays) NodeSettingsRO(org.knime.core.node.NodeSettingsRO) InvalidSettingsException(org.knime.core.node.InvalidSettingsException) JavaSnippetSettings(org.knime.base.node.jsnippet.util.JavaSnippetSettings) FieldsTableModel(org.knime.base.node.jsnippet.ui.FieldsTableModel) JavaSnippetDocument(org.knime.base.node.jsnippet.guarded.JavaSnippetDocument) Border(javax.swing.border.Border) NodeDialogPane(org.knime.core.node.NodeDialogPane) ErrorStrip(org.fife.ui.rsyntaxtextarea.ErrorStrip) JarListPanel(org.knime.base.node.jsnippet.ui.JarListPanel) ByteArrayInputStream(java.io.ByteArrayInputStream) JSnippetTextArea(org.knime.base.node.jsnippet.ui.JSnippetTextArea) Map(java.util.Map) ListDataEvent(javax.swing.event.ListDataEvent) TitledBorder(javax.swing.border.TitledBorder) BorderLayout(java.awt.BorderLayout) DefaultTemplateController(org.knime.base.node.jsnippet.template.DefaultTemplateController) TableModelEvent(javax.swing.event.TableModelEvent) Frame(java.awt.Frame) TemplateNodeDialog(org.knime.base.node.jsnippet.template.TemplateNodeDialog) BorderFactory(javax.swing.BorderFactory) FlowVariableList(org.knime.base.node.jsnippet.ui.FlowVariableList) UUID(java.util.UUID) BadLocationException(javax.swing.text.BadLocationException) TemplatesPanel(org.knime.base.node.jsnippet.template.TemplatesPanel) InFieldsTable(org.knime.base.node.jsnippet.ui.InFieldsTable) TemplateProvider(org.knime.base.node.jsnippet.template.TemplateProvider) Dimension(java.awt.Dimension) LanguageSupportFactory(org.fife.rsta.ac.LanguageSupportFactory) JPanel(javax.swing.JPanel) JavaLanguageSupport(org.fife.rsta.ac.java.JavaLanguageSupport) JavaSnippetTemplateProvider(org.knime.base.node.jsnippet.template.JavaSnippetTemplateProvider) LanguageSupport(org.fife.rsta.ac.LanguageSupport) JSplitPane(javax.swing.JSplitPane) ByteArrayOutputStream(java.io.ByteArrayOutputStream) TableColumnModel(javax.swing.table.TableColumnModel) JarManager(org.fife.rsta.ac.java.JarManager) DataTableSpec(org.knime.core.data.DataTableSpec) SyntaxConstants(org.fife.ui.rsyntaxtextarea.SyntaxConstants) FlowVariable(org.knime.core.node.workflow.FlowVariable) NodeSettings(org.knime.core.node.NodeSettings) TableModelListener(javax.swing.event.TableModelListener) JSnippetFieldsController(org.knime.base.node.jsnippet.ui.JSnippetFieldsController) GridLayout(java.awt.GridLayout) NotConfigurableException(org.knime.core.node.NotConfigurableException) SwingUtilities(javax.swing.SwingUtilities) OutFieldsTableModel(org.knime.base.node.jsnippet.ui.OutFieldsTableModel) NodeLogger(org.knime.core.node.NodeLogger) BundleListPanel(org.knime.base.node.jsnippet.ui.BundleListPanel) ViewUtils(org.knime.core.node.util.ViewUtils) AddTemplateDialog(org.knime.base.node.jsnippet.template.AddTemplateDialog) JComponent(javax.swing.JComponent) Column(org.knime.base.node.jsnippet.ui.FieldsTableModel.Column) JavaSnippetTemplate(org.knime.base.node.jsnippet.template.JavaSnippetTemplate) JButton(javax.swing.JButton) Fold(org.fife.ui.rsyntaxtextarea.folding.Fold) ColumnList(org.knime.base.node.jsnippet.ui.ColumnList) IOException(java.io.IOException) File(java.io.File) FoldManager(org.fife.ui.rsyntaxtextarea.folding.FoldManager) NodeSettingsWO(org.knime.core.node.NodeSettingsWO) JScrollPane(javax.swing.JScrollPane) ListDataListener(javax.swing.event.ListDataListener) RTextScrollPane(org.fife.ui.rtextarea.RTextScrollPane) OutFieldsTable(org.knime.base.node.jsnippet.ui.OutFieldsTable) JLabel(javax.swing.JLabel) GuardedDocument(org.knime.base.node.jsnippet.guarded.GuardedDocument) Collections(java.util.Collections) JPanel(javax.swing.JPanel) GridLayout(java.awt.GridLayout) BorderLayout(java.awt.BorderLayout) TableModelListener(javax.swing.event.TableModelListener) JComponent(javax.swing.JComponent) JSplitPane(javax.swing.JSplitPane)

Aggregations

JSplitPane (javax.swing.JSplitPane)109 BorderLayout (java.awt.BorderLayout)69 JPanel (javax.swing.JPanel)64 JScrollPane (javax.swing.JScrollPane)54 Dimension (java.awt.Dimension)40 JLabel (javax.swing.JLabel)31 JButton (javax.swing.JButton)17 JTextArea (javax.swing.JTextArea)16 FlowLayout (java.awt.FlowLayout)15 Insets (java.awt.Insets)15 GridBagLayout (java.awt.GridBagLayout)14 GridBagConstraints (java.awt.GridBagConstraints)13 JTable (javax.swing.JTable)13 Container (java.awt.Container)10 GridLayout (java.awt.GridLayout)10 ArrayList (java.util.ArrayList)10 BoxLayout (javax.swing.BoxLayout)10 JComponent (javax.swing.JComponent)10 JTabbedPane (javax.swing.JTabbedPane)10 EmptyBorder (javax.swing.border.EmptyBorder)10