Search in sources :

Example 46 with JSplitPane

use of javax.swing.JSplitPane in project MassBank-web by MassBank.

the class PackageViewPanel method initComponentLayout.

/**
 * �R���|�[�l���g�z�u
 * �R���|�[�l���g�̃��C�A�E�g���w�肵�Ĕz�u����B
 */
private void initComponentLayout() {
    // �}�E�X�J�[�\���ݒ�
    PackageViewPanel.this.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
    // ���C�A�E�g�w��
    setLayout(new BorderLayout());
    GridBagLayout gbl = new GridBagLayout();
    // �X�y�N�g���\���y�C��
    SpectrumPlotPane plotPane = new SpectrumPlotPane();
    plotPane.setMinimumSize(new Dimension(0, 180));
    plotPane.repaint();
    // ���C�A�E�g���񏉊���
    gbc = new GridBagConstraints();
    // �����A�����T�C�Y�̕ύX������
    gbc.fill = GridBagConstraints.BOTH;
    // �]���̐����X�y�[�X�𕪔z
    gbc.weightx = 1;
    // �]���̐����X�y�[�X�𕪔z
    gbc.weighty = 1;
    // ��Ō�̃R���|�[�l���g�Ɏw��
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbl.setConstraints(plotPane, gbc);
    // �{�^���y�C��
    ButtonPane btnPane = new ButtonPane();
    btnPane.setMinimumSize(new Dimension(0, 44));
    btnPane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
    // ���C�A�E�g���񏉊���
    gbc = new GridBagConstraints();
    // �����T�C�Y�̕ύX�݂̂�����
    gbc.fill = GridBagConstraints.HORIZONTAL;
    // �]���̐����X�y�[�X�𕪔z
    gbc.weightx = 1;
    // �]���̐����X�y�[�X�𕪔z���Ȃ�
    gbc.weighty = 0;
    // ��Ō�̃R���|�[�l���g�Ɏw��
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbl.setConstraints(btnPane, gbc);
    // �X�e�[�^�X���x��
    statusKeyLbl = new JLabel(" ");
    // ���C�A�E�g���񏉊���
    gbc = new GridBagConstraints();
    // �����T�C�Y�̕ύX�݂̂�����
    gbc.fill = GridBagConstraints.HORIZONTAL;
    // �]���̐����X�y�[�X�𕪔z���Ȃ�
    gbc.weightx = 0;
    // �]���̐����X�y�[�X�𕪔z���Ȃ�
    gbc.weighty = 0;
    // �s�Ō�̃R���|�[�l���g�Ɏw��
    gbc.gridheight = GridBagConstraints.REMAINDER;
    // �O���p�f�B���O�w��
    gbc.insets = new Insets(4, 4, 4, 4);
    gbl.setConstraints(statusKeyLbl, gbc);
    statusValLbl = new JLabel(" ");
    statusValLbl.setForeground(new Color(0, 139, 139));
    // ���C�A�E�g���񏉊���
    gbc = new GridBagConstraints();
    // �����T�C�Y�̕ύX�݂̂�����
    gbc.fill = GridBagConstraints.HORIZONTAL;
    // �]���̐����X�y�[�X�𕪔z
    gbc.weightx = 1;
    // �]���̐����X�y�[�X�𕪔z���Ȃ�
    gbc.weighty = 0;
    // ��Ō�̃R���|�[�l���g�Ɏw��
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    // �s�Ō�̃R���|�[�l���g�Ɏw��
    gbc.gridheight = GridBagConstraints.REMAINDER;
    // �O���p�f�B���O�w��
    gbc.insets = new Insets(4, 4, 4, 4);
    gbl.setConstraints(statusValLbl, gbc);
    // �\���p�l���lj�
    JPanel dispPanel = new JPanel();
    dispPanel.setLayout(gbl);
    dispPanel.add(plotPane);
    dispPanel.add(btnPane);
    dispPanel.add(statusKeyLbl);
    dispPanel.add(statusValLbl);
    add(dispPanel);
    // ���R�[�h���X�g�y�C���lj�
    recTable = createRecListTable();
    JScrollPane recListPane = new JScrollPane(recTable);
    recListPane.addMouseListener(new PaneMouseListener());
    recListPane.setMinimumSize(new Dimension(0, 100));
    // PackageViewPanel�y�C���lj�
    JSplitPane pkgPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, dispPanel, recListPane);
    pkgPane.setMinimumSize(new Dimension(350, 0));
    pkgPane.setDividerLocation((int) (SearchPage.initAppletHight * 0.7));
    pkgPane.setOneTouchExpandable(true);
    add(pkgPane, BorderLayout.CENTER);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) FlowLayout(java.awt.FlowLayout) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) Color(java.awt.Color) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) Cursor(java.awt.Cursor) BorderLayout(java.awt.BorderLayout) JSplitPane(javax.swing.JSplitPane)

Example 47 with JSplitPane

use of javax.swing.JSplitPane in project MassBank-web by MassBank.

the class SearchPage method createWindow.

/**
 * �E�C���h�E����
 */
private void createWindow() {
    // �c�[���`�b�v�}�l�[�W���[�ݒ�
    ToolTipManager ttm = ToolTipManager.sharedInstance();
    ttm.setInitialDelay(50);
    ttm.setDismissDelay(8000);
    // Search�p�l��
    JPanel mainPanel = new JPanel();
    mainPanel.setLayout(new BorderLayout());
    Border border = BorderFactory.createCompoundBorder(BorderFactory.createEtchedBorder(), new EmptyBorder(1, 1, 1, 1));
    mainPanel.setBorder(border);
    // *********************************************************************
    // User File Query�^�u
    // *********************************************************************
    DefaultTableModel fileDm = new DefaultTableModel();
    fileSorter = new TableSorter(fileDm, TABLE_QUERY_FILE);
    queryFileTable = new JTable(fileSorter) {

        @Override
        public boolean isCellEditable(int row, int column) {
            // �I�[�o�[���C�h�ŃZ���ҏW��s�‚Ƃ���
            return false;
        }
    };
    queryFileTable.addMouseListener(new TblMouseListener());
    fileSorter.setTableHeader(queryFileTable.getTableHeader());
    queryFileTable.setRowSelectionAllowed(true);
    queryFileTable.setColumnSelectionAllowed(false);
    queryFileTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    String[] col = { COL_LABEL_NO, COL_LABEL_NAME, COL_LABEL_ID };
    ((DefaultTableModel) fileSorter.getTableModel()).setColumnIdentifiers(col);
    (queryFileTable.getColumn(queryFileTable.getColumnName(0))).setPreferredWidth(44);
    (queryFileTable.getColumn(queryFileTable.getColumnName(1))).setPreferredWidth(LEFT_PANEL_WIDTH - 44);
    (queryFileTable.getColumn(queryFileTable.getColumnName(2))).setPreferredWidth(70);
    ListSelectionModel lm = queryFileTable.getSelectionModel();
    lm.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    lm.addListSelectionListener(new LmFileListener());
    queryFilePane = new JScrollPane(queryFileTable);
    queryFilePane.addMouseListener(new PaneMouseListener());
    queryFilePane.setPreferredSize(new Dimension(300, 300));
    // *********************************************************************
    // Result�^�u
    // *********************************************************************
    DefaultTableModel resultDm = new DefaultTableModel();
    resultSorter = new TableSorter(resultDm, TABLE_RESULT);
    resultTable = new JTable(resultSorter) {

        @Override
        public String getToolTipText(MouseEvent me) {
            // super.getToolTipText(me);
            // �I�[�o�[���C�h�Ńc�[���`�b�v�̕������Ԃ�
            Point pt = me.getPoint();
            int row = rowAtPoint(pt);
            if (row < 0) {
                return null;
            } else {
                int nameCol = getColumnModel().getColumnIndex(COL_LABEL_NAME);
                return " " + getValueAt(row, nameCol) + " ";
            }
        }

        @Override
        public boolean isCellEditable(int row, int column) {
            // �I�[�o�[���C�h�ŃZ���ҏW��s�‚Ƃ���
            return false;
        }
    };
    resultTable.addMouseListener(new TblMouseListener());
    resultSorter.setTableHeader(resultTable.getTableHeader());
    JPanel dbPanel = new JPanel();
    dbPanel.setLayout(new BorderLayout());
    resultPane = new JScrollPane(resultTable);
    resultPane.addMouseListener(new PaneMouseListener());
    resultTable.setRowSelectionAllowed(true);
    resultTable.setColumnSelectionAllowed(false);
    resultTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    String[] col2 = { COL_LABEL_NAME, COL_LABEL_SCORE, COL_LABEL_HIT, COL_LABEL_ID, COL_LABEL_ION, COL_LABEL_CONTRIBUTOR, COL_LABEL_NO };
    resultDm.setColumnIdentifiers(col2);
    (resultTable.getColumn(resultTable.getColumnName(0))).setPreferredWidth(LEFT_PANEL_WIDTH - 180);
    (resultTable.getColumn(resultTable.getColumnName(1))).setPreferredWidth(70);
    (resultTable.getColumn(resultTable.getColumnName(2))).setPreferredWidth(20);
    (resultTable.getColumn(resultTable.getColumnName(3))).setPreferredWidth(70);
    (resultTable.getColumn(resultTable.getColumnName(4))).setPreferredWidth(20);
    (resultTable.getColumn(resultTable.getColumnName(5))).setPreferredWidth(70);
    (resultTable.getColumn(resultTable.getColumnName(6))).setPreferredWidth(50);
    ListSelectionModel lm2 = resultTable.getSelectionModel();
    lm2.addListSelectionListener(new LmResultListener());
    resultPane.setPreferredSize(new Dimension(LEFT_PANEL_WIDTH, 200));
    dbPanel.add(resultPane, BorderLayout.CENTER);
    // *********************************************************************
    // DB Query�^�u
    // *********************************************************************
    DefaultTableModel dbDm = new DefaultTableModel();
    querySorter = new TableSorter(dbDm, TABLE_QUERY_DB);
    queryDbTable = new JTable(querySorter) {

        @Override
        public boolean isCellEditable(int row, int column) {
            // �I�[�o�[���C�h�ŃZ���ҏW��s�‚Ƃ���
            return false;
        }
    };
    queryDbTable.addMouseListener(new TblMouseListener());
    querySorter.setTableHeader(queryDbTable.getTableHeader());
    queryDbPane = new JScrollPane(queryDbTable);
    queryDbPane.addMouseListener(new PaneMouseListener());
    int h = (int) Toolkit.getDefaultToolkit().getScreenSize().getHeight();
    queryDbPane.setPreferredSize(new Dimension(LEFT_PANEL_WIDTH, h));
    queryDbTable.setRowSelectionAllowed(true);
    queryDbTable.setColumnSelectionAllowed(false);
    queryDbTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    String[] col3 = { COL_LABEL_ID, COL_LABEL_NAME, COL_LABEL_CONTRIBUTOR, COL_LABEL_NO };
    DefaultTableModel model = (DefaultTableModel) querySorter.getTableModel();
    model.setColumnIdentifiers(col3);
    // �񕝃Z�b�g
    queryDbTable.getColumn(queryDbTable.getColumnName(0)).setPreferredWidth(70);
    queryDbTable.getColumn(queryDbTable.getColumnName(1)).setPreferredWidth(LEFT_PANEL_WIDTH - 70);
    queryDbTable.getColumn(queryDbTable.getColumnName(2)).setPreferredWidth(70);
    queryDbTable.getColumn(queryDbTable.getColumnName(3)).setPreferredWidth(50);
    ListSelectionModel lm3 = queryDbTable.getSelectionModel();
    lm3.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    lm3.addListSelectionListener(new LmQueryDbListener());
    // �{�^���p�l��
    JPanel btnPanel = new JPanel();
    btnName.addActionListener(new BtnSearchNameListener());
    btnAll.addActionListener(new BtnAllListener());
    btnPanel.add(btnName);
    btnPanel.add(btnAll);
    parentPanel2 = new JPanel();
    parentPanel2.setLayout(new BoxLayout(parentPanel2, BoxLayout.PAGE_AXIS));
    parentPanel2.add(btnPanel);
    parentPanel2.add(queryDbPane);
    // �I�v�V�����p�l��
    JPanel dispModePanel = new JPanel();
    isDispSelected = dispSelected.isSelected();
    isDispRelated = dispRelated.isSelected();
    if (isDispSelected) {
        resultTable.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    } else if (isDispRelated) {
        resultTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    }
    Object[] retRadio = new Object[] { dispSelected, dispRelated };
    for (int i = 0; i < retRadio.length; i++) {
        ((JRadioButton) retRadio[i]).addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent arg0) {
                if (isDispSelected != dispSelected.isSelected() || isDispRelated != dispRelated.isSelected()) {
                    isDispSelected = dispSelected.isSelected();
                    isDispRelated = dispRelated.isSelected();
                    // ���ʃ��R�[�h�I����Ԃ�����
                    resultTable.clearSelection();
                    resultPlot.clear();
                    compPlot.setPeaks(null, 1);
                    resultPlot.setPeaks(null, 0);
                    setAllPlotAreaRange();
                    pkgView.initResultRecInfo();
                    if (isDispSelected) {
                        resultTable.getSelectionModel().setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
                    } else if (isDispRelated) {
                        resultTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
                    }
                }
            }
        });
    }
    ButtonGroup disGroup = new ButtonGroup();
    disGroup.add(dispSelected);
    disGroup.add(dispRelated);
    dispModePanel.add(lbl2);
    dispModePanel.add(dispSelected);
    dispModePanel.add(dispRelated);
    JPanel paramPanel = new JPanel();
    paramPanel.add(etcPropertyButton);
    etcPropertyButton.setMargin(new Insets(0, 10, 0, 10));
    etcPropertyButton.addActionListener(new ActionListener() {

        private ParameterSetWindow ps = null;

        public void actionPerformed(ActionEvent e) {
            // �q��ʂ��J���Ă��Ȃ���ΐ���
            if (!isSubWindow) {
                ps = new ParameterSetWindow();
            } else {
                ps.requestFocus();
            }
        }
    });
    JPanel optionPanel = new JPanel();
    optionPanel.setLayout(new BoxLayout(optionPanel, BoxLayout.Y_AXIS));
    optionPanel.add(dispModePanel);
    optionPanel.add(paramPanel);
    // PackageView�����y�сA������
    pkgView = new PackageViewPanel();
    pkgView.initAllRecInfo();
    queryTabPane.addTab("DB", parentPanel2);
    queryTabPane.setToolTipTextAt(TAB_ORDER_DB, "Query from DB.");
    queryTabPane.addTab("File", queryFilePane);
    queryTabPane.setToolTipTextAt(TAB_ORDER_FILE, "Query from user file.");
    queryTabPane.setSelectedIndex(TAB_ORDER_DB);
    queryTabPane.setFocusable(false);
    queryTabPane.addChangeListener(new ChangeListener() {

        public void stateChanged(ChangeEvent e) {
            // �v���b�g�y�C��������
            queryPlot.clear();
            compPlot.clear();
            resultPlot.clear();
            queryPlot.setPeaks(null, 0);
            compPlot.setPeaks(null, 1);
            resultPlot.setPeaks(null, 0);
            // PackageView������
            pkgView.initAllRecInfo();
            // DB Hit�^�u�֘A������
            if (resultTabPane.getTabCount() > 0) {
                resultTabPane.setSelectedIndex(0);
            }
            DefaultTableModel dataModel = (DefaultTableModel) resultSorter.getTableModel();
            dataModel.setRowCount(0);
            hitLabel.setText(" ");
            // DB�^�u�AUser File�^�u�̑I���ς݃��R�[�h���f����
            queryTabPane.update(queryTabPane.getGraphics());
            if (queryTabPane.getSelectedIndex() == TAB_ORDER_DB) {
                parentPanel2.update(parentPanel2.getGraphics());
                updateSelectQueryTable(queryDbTable);
            } else if (queryTabPane.getSelectedIndex() == TAB_ORDER_FILE) {
                queryFilePane.update(queryFilePane.getGraphics());
                updateSelectQueryTable(queryFileTable);
            }
        }
    });
    // ���C�A�E�g
    JPanel queryPanel = new JPanel();
    queryPanel.setLayout(new BorderLayout());
    queryPanel.add(queryTabPane, BorderLayout.CENTER);
    queryPanel.add(optionPanel, BorderLayout.SOUTH);
    queryPanel.setMinimumSize(new Dimension(0, 170));
    JPanel jtp2Panel = new JPanel();
    jtp2Panel.setLayout(new BorderLayout());
    jtp2Panel.add(dbPanel, BorderLayout.CENTER);
    jtp2Panel.add(hitLabel, BorderLayout.SOUTH);
    jtp2Panel.setMinimumSize(new Dimension(0, 70));
    Color colorGreen = new Color(0, 128, 0);
    hitLabel.setForeground(colorGreen);
    resultTabPane.addTab("Result", jtp2Panel);
    resultTabPane.setToolTipTextAt(TAB_RESULT_DB, "Result of DB hit.");
    resultTabPane.setFocusable(false);
    queryPlot.setMinimumSize(new Dimension(0, 100));
    compPlot.setMinimumSize(new Dimension(0, 120));
    resultPlot.setMinimumSize(new Dimension(0, 100));
    int height = initAppletHight / 3;
    JSplitPane jsp_cmp2db = new JSplitPane(JSplitPane.VERTICAL_SPLIT, compPlot, resultPlot);
    JSplitPane jsp_qry2cmp = new JSplitPane(JSplitPane.VERTICAL_SPLIT, queryPlot, jsp_cmp2db);
    jsp_cmp2db.setDividerLocation(height);
    jsp_qry2cmp.setDividerLocation(height - 25);
    jsp_qry2cmp.setMinimumSize(new Dimension(190, 0));
    viewTabPane.addTab("Compare View", jsp_qry2cmp);
    viewTabPane.addTab("Package View", pkgView);
    viewTabPane.setToolTipTextAt(TAB_VIEW_COMPARE, "Comparison of query and result spectrum.");
    viewTabPane.setToolTipTextAt(TAB_VIEW_PACKAGE, "Package comparison of query and result spectrum.");
    viewTabPane.setSelectedIndex(TAB_VIEW_COMPARE);
    viewTabPane.setFocusable(false);
    JSplitPane jsp = new JSplitPane(JSplitPane.VERTICAL_SPLIT, queryPanel, resultTabPane);
    jsp.setDividerLocation(310);
    jsp.setMinimumSize(new Dimension(180, 0));
    jsp.setOneTouchExpandable(true);
    JSplitPane jsp2 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, jsp, viewTabPane);
    int divideSize = (int) (initAppletWidth * 0.4);
    divideSize = (divideSize >= 180) ? divideSize : 180;
    jsp2.setDividerLocation(divideSize);
    jsp2.setOneTouchExpandable(true);
    mainPanel.add(jsp2, BorderLayout.CENTER);
    add(mainPanel);
    queryPlot.setSearchPage(this);
    compPlot.setSearchPage(this);
    resultPlot.setSearchPage(this);
}
Also used : JPanel(javax.swing.JPanel) JRadioButton(javax.swing.JRadioButton) Insets(java.awt.Insets) ActionEvent(java.awt.event.ActionEvent) DefaultTableModel(javax.swing.table.DefaultTableModel) BoxLayout(javax.swing.BoxLayout) BorderLayout(java.awt.BorderLayout) ChangeListener(javax.swing.event.ChangeListener) EmptyBorder(javax.swing.border.EmptyBorder) JScrollPane(javax.swing.JScrollPane) ToolTipManager(javax.swing.ToolTipManager) MouseEvent(java.awt.event.MouseEvent) Color(java.awt.Color) ListSelectionModel(javax.swing.ListSelectionModel) Dimension(java.awt.Dimension) Point(java.awt.Point) Point(java.awt.Point) ActionListener(java.awt.event.ActionListener) ChangeEvent(javax.swing.event.ChangeEvent) ButtonGroup(javax.swing.ButtonGroup) JTable(javax.swing.JTable) JSplitPane(javax.swing.JSplitPane) Border(javax.swing.border.Border) EmptyBorder(javax.swing.border.EmptyBorder)

Example 48 with JSplitPane

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

the class JSnippetPanel method layoutLeftComponent.

/**
 * Subclasses can override this method to customize the left side layout of the main split pain.
 * If the subclass uses self-defined components make sure that these are already created and
 * initialized during the call of {@link #initSubComponents()}.
 *
 * @return the component for the left side of the main split-panel
 * @since 2.10
 */
protected JComponent layoutLeftComponent() {
    JComponent leftComponent;
    if (m_showColumns && m_showFlowVariables) {
        final JSplitPane varSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
        leftComponent = varSplitPane;
        JScrollPane colListPane = new JScrollPane(m_colList);
        colListPane.setBorder(createEmptyTitledBorder("Column List"));
        varSplitPane.setTopComponent(colListPane);
        // set variable panel
        JScrollPane pane = new JScrollPane(m_flowVarsList);
        pane.setBorder(createEmptyTitledBorder("Flow Variable List"));
        varSplitPane.setBottomComponent(pane);
        varSplitPane.setOneTouchExpandable(true);
        varSplitPane.setResizeWeight(0.9);
    } else if (m_showColumns && !m_showFlowVariables) {
        leftComponent = new JScrollPane(m_colList);
        leftComponent.setBorder(createEmptyTitledBorder("Column List"));
    } else if (m_showFlowVariables) {
        leftComponent = new JScrollPane(m_flowVarsList);
        leftComponent.setBorder(createEmptyTitledBorder("Flow Variable List"));
    } else {
        leftComponent = new JPanel();
    }
    return leftComponent;
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) JComponent(javax.swing.JComponent) JSplitPane(javax.swing.JSplitPane)

Example 49 with JSplitPane

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

the class RuleEngineNodeDialog method createTopPart.

/*
     * top part (from left to right) = variable list, operator list, editor box
     */
private Box createTopPart() {
    /*
         * Variable list (column names)
         */
    m_variableModel = new DefaultListModel();
    m_variableList = new JList(m_variableModel);
    m_variableList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    m_variableList.setCellRenderer(new DataColumnSpecListCellRenderer());
    m_variableList.addListSelectionListener(new ListSelectionListener() {

        @Override
        public void valueChanged(final ListSelectionEvent arg0) {
            if (arg0.getValueIsAdjusting()) {
                return;
            }
            if (m_lastUsedTextfield != null) {
                String existingText = m_lastUsedTextfield.getText();
                if (existingText.equals(RULE_LABEL)) {
                    existingText = "";
                }
                if (!m_variableList.isSelectionEmpty()) {
                    String newText = ((DataColumnSpec) m_variableList.getSelectedValue()).getName();
                    m_lastUsedTextfield.setText((existingText + " $" + newText + "$").trim());
                    m_lastUsedTextfield.requestFocusInWindow();
                    if (m_lastUsedTextfield == m_ruleLabelEditor) {
                        m_outcomeIsColumn.setSelected(true);
                    }
                }
            }
            m_variableList.clearSelection();
        }
    });
    /*
         * Operators (<, >, <=, >=, =, AND, OR, etc)
         */
    m_operatorModel = new DefaultListModel();
    m_operatorList = new JList(m_operatorModel);
    m_operatorList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    m_operatorList.addListSelectionListener(new ListSelectionListener() {

        @Override
        public void valueChanged(final ListSelectionEvent arg0) {
            if (!arg0.getValueIsAdjusting() && !m_operatorList.isSelectionEmpty()) {
                String existingText = m_ruleEditor.getText();
                if (existingText.equals(RULE_LABEL)) {
                    existingText = "";
                }
                String newText = (String) m_operatorList.getSelectedValue();
                m_ruleEditor.setText(existingText + " " + newText);
                m_ruleEditor.requestFocusInWindow();
                m_operatorList.clearSelection();
            }
        }
    });
    Box editorBox = createEditorPart();
    Box listBox = Box.createHorizontalBox();
    JScrollPane variableScroller = new JScrollPane(m_variableList);
    variableScroller.setBorder(BorderFactory.createTitledBorder("Columns"));
    JScrollPane operatorScroller = new JScrollPane(m_operatorList);
    operatorScroller.setBorder(BorderFactory.createTitledBorder("Operators"));
    listBox.add(variableScroller);
    listBox.add(operatorScroller);
    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, listBox, editorBox);
    Dimension minimumSize = new Dimension(200, 50);
    listBox.setMinimumSize(minimumSize);
    editorBox.setMinimumSize(minimumSize);
    Box topBox = Box.createHorizontalBox();
    topBox.add(splitPane);
    topBox.add(Box.createHorizontalGlue());
    return topBox;
}
Also used : JScrollPane(javax.swing.JScrollPane) DataColumnSpecListCellRenderer(org.knime.core.node.util.DataColumnSpecListCellRenderer) ListSelectionEvent(javax.swing.event.ListSelectionEvent) DefaultListModel(javax.swing.DefaultListModel) Box(javax.swing.Box) JCheckBox(javax.swing.JCheckBox) Dimension(java.awt.Dimension) JSplitPane(javax.swing.JSplitPane) JList(javax.swing.JList) ListSelectionListener(javax.swing.event.ListSelectionListener)

Example 50 with JSplitPane

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

the class RuleEngineNodeDialog method initializeComponent.

private void initializeComponent() {
    JSplitPane horizontalSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, createTopPart(), createBottomPart());
    addTab("Rule Editor", horizontalSplit);
}
Also used : 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