use of org.knime.core.node.util.ColumnPairsSelectionPanel in project knime-core by knime.
the class Joiner2NodeDialog method createJoinPredicateUIControls.
/**
* @param includeRowId <code>true</code> if the user can select the row id as a potential matching column
* @param showMatchModes <code>true</code> if the AND and OR match mode option should available
* @return the column pair panel
* @since 2.12
* @noreference This method is not intended to be referenced by clients.
*/
protected JPanel createJoinPredicateUIControls(final boolean includeRowId, final boolean showMatchModes) {
JPanel p = new JPanel(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.HORIZONTAL;
c.anchor = GridBagConstraints.NORTHWEST;
c.insets = new Insets(2, 2, 2, 2);
c.gridx = 0;
c.gridy = 0;
if (showMatchModes) {
JPanel matchButtonPanel = new JPanel(new FlowLayout());
matchButtonPanel.add(m_matchAllButton);
matchButtonPanel.add(m_matchAnyButton);
p.add(matchButtonPanel, c);
ButtonGroup group = new ButtonGroup();
group.add(m_matchAllButton);
group.add(m_matchAnyButton);
c.gridx = 0;
c.gridy++;
}
c.gridwidth = 3;
c.weightx = 1;
c.weighty = 1;
m_columnPairs = new ColumnPairsSelectionPanel(includeRowId) {
private static final long serialVersionUID = 1L;
/**
* {@inheritDoc}
*/
@Override
protected void initComboBox(final DataTableSpec spec, final JComboBox comboBox, final String selected) {
super.initComboBox(spec, comboBox, selected);
// the first entry is the row id, set as default.
if (selected == null) {
comboBox.setSelectedIndex(0);
}
}
};
m_columnPairs.setRowKeyIdentifier(Joiner2Settings.ROW_KEY_IDENTIFIER);
JScrollPane scrollPane = new JScrollPane(m_columnPairs);
m_columnPairs.setBackground(Color.white);
Component header = m_columnPairs.getHeaderView();
header.setPreferredSize(new Dimension(300, 20));
scrollPane.setColumnHeaderView(header);
scrollPane.setPreferredSize(new Dimension(300, 200));
scrollPane.setMinimumSize(new Dimension(300, 100));
p.add(scrollPane, c);
p.setBorder(BorderFactory.createTitledBorder("Joining Columns"));
return p;
}
use of org.knime.core.node.util.ColumnPairsSelectionPanel in project knime-core by knime.
the class DBJoinerNodeDialog method createJoinPredicateUIControls.
private JPanel createJoinPredicateUIControls() {
JPanel p = new JPanel(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.HORIZONTAL;
c.anchor = GridBagConstraints.NORTHWEST;
c.insets = new Insets(2, 2, 2, 2);
c.gridx = 0;
c.gridy = 0;
JPanel matchButtonPanel = new JPanel(new FlowLayout());
matchButtonPanel.add(m_matchAllButton);
matchButtonPanel.add(m_matchAnyButton);
p.add(matchButtonPanel, c);
ButtonGroup group = new ButtonGroup();
group.add(m_matchAllButton);
group.add(m_matchAnyButton);
c.gridx = 0;
c.gridy++;
c.gridwidth = 3;
c.weightx = 1;
c.weighty = 1;
m_columnPairs = new ColumnPairsSelectionPanel(false) {
private static final long serialVersionUID = 1738914698074362596L;
@SuppressWarnings("rawtypes")
@Override
protected void initComboBox(final DataTableSpec spec, final JComboBox comboBox, final String selected) {
super.initComboBox(spec, comboBox, selected);
if (selected == null && comboBox.getModel().getSize() > 0) {
comboBox.setSelectedIndex(0);
}
}
};
JScrollPane scrollPane = new JScrollPane(m_columnPairs);
m_columnPairs.setBackground(Color.white);
Component header = m_columnPairs.getHeaderView();
header.setPreferredSize(new Dimension(300, 20));
scrollPane.setColumnHeaderView(header);
scrollPane.setPreferredSize(new Dimension(300, 200));
scrollPane.setMinimumSize(new Dimension(300, 100));
p.add(scrollPane, c);
p.setBorder(BorderFactory.createTitledBorder("Joining Columns"));
return p;
}
use of org.knime.core.node.util.ColumnPairsSelectionPanel in project knime-core by knime.
the class PairedTTestNodeDialog method createPanel.
/**
* Create the configuration panel.
*/
@SuppressWarnings({ "unchecked", "serial" })
private Component createPanel() {
JPanel p = new JPanel(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.BOTH;
c.anchor = GridBagConstraints.BASELINE;
c.insets = new Insets(2, 2, 2, 2);
c.gridx = 0;
c.gridy = 0;
c.gridwidth = 1;
c.weightx = 0;
c.weighty = 0;
Insets leftInsets = new Insets(3, 8, 3, 8);
Insets rightInsets = new Insets(3, 0, 3, 8);
Insets leftCategoryInsets = new Insets(11, 8, 3, 8);
c.gridx = 0;
c.insets = leftCategoryInsets;
c.gridwidth = 2;
c.weightx = 1;
c.weighty = 1;
m_columnPairs = new ColumnPairsSelectionPanel() {
@Override
protected void initComboBox(final DataTableSpec spec, final JComboBox comboBox, final String selected) {
DefaultComboBoxModel comboBoxModel = (DefaultComboBoxModel) comboBox.getModel();
comboBoxModel.removeAllElements();
for (DataColumnSpec colSpec : spec) {
if (colSpec.getType().isCompatible(DoubleValue.class)) {
comboBoxModel.addElement(colSpec);
if (null != selected && colSpec.getName().equals(selected)) {
comboBoxModel.setSelectedItem(colSpec);
}
}
}
}
};
JScrollPane scrollPane = new JScrollPane(m_columnPairs);
m_columnPairs.setBackground(Color.white);
Component header = m_columnPairs.getHeaderView("Left Column", "Right Column");
header.setPreferredSize(new Dimension(300, 20));
scrollPane.setColumnHeaderView(header);
scrollPane.setPreferredSize(new Dimension(300, 200));
scrollPane.setMinimumSize(new Dimension(300, 100));
p.add(scrollPane, c);
c.gridwidth = 1;
c.weightx = 0;
c.weighty = 0;
c.gridx = 0;
c.gridy++;
c.insets = leftInsets;
p.add(new JLabel("Confidence Interval (in %):"), c);
c.gridx++;
c.insets = rightInsets;
m_confidenceIntervalProb = new JTextField("95");
p.add(m_confidenceIntervalProb, c);
return p;
}
Aggregations