use of org.knime.core.node.util.ColumnSelectionPanel in project knime-core by knime.
the class RuleEngine2PortsNodeDialog method initControls.
/**
* Creates and adds most of the controls to the dialog.
*/
private void initControls() {
m_pmml = new JCheckBox("Enable PMML RuleSet generation (fails when result would not be a valid PMML RuleSet)");
m_ruleSelectionMethod = new JComboBox<>(new Vector<>(RuleEngine2PortsSettings.POSSIBLE_RULE_SELECTION_METHODS));
m_hasDefaultScore = new JCheckBox("Default value (when nothing matches): ");
m_defaultScore = Util.createTextFieldWithWatermark(RuleEngine2PortsSettings.DEFAULT_DEFAULT_SCORE, 22, "Default score/value when nothing matches");
m_hasDefaultConfidence = new JCheckBox("Default confidence value (when not specified in the confidence column): ");
m_defaultConfidence = new JSpinner(new SpinnerNumberModel(RuleEngine2PortsSettings.DEFAULT_DEFAULT_CONFIDENCE, 0d, 1d, .1));
@SuppressWarnings("unchecked") DataValueColumnFilter doubleValueFilter = new DataValueColumnFilter(DoubleValue.class);
m_ruleConfidenceColumn = new ColumnSelectionPanel((Border) null, doubleValueFilter, true);
m_hasDefaultWeight = new JCheckBox("Default weight value (when not specified in the weight column): ");
m_defaultWeight = new JSpinner(new SpinnerNumberModel(RuleEngine2PortsSettings.DEFAULT_DEFAULT_WEIGHT, 0d, 1e6, .1));
m_ruleWeightColumn = new ColumnSelectionPanel((Border) null, doubleValueFilter, true);
m_computeConfidence = new JCheckBox("Confidence column name: ");
m_predictionConfidenceColumn = Util.createTextFieldWithWatermark(RuleEngine2PortsSettings.DEFAULT_PREDICTION_CONFIDENCE_COLUMN, 22, "Computed confidence column name");
m_provideStatistics = new JCheckBox("Provide statistics");
@SuppressWarnings("unchecked") DataValueColumnFilter validationColumnFilter = new DataValueColumnFilter(StringValue.class, BooleanValue.class, DoubleValue.class);
m_validationColumn = new ColumnSelectionPanel(null, validationColumnFilter, true);
m_pmmlLabels = new ArrayList<>();
m_pmmlBorders = new ArrayList<>();
m_validateLabel = new JLabel("Validation column");
}
use of org.knime.core.node.util.ColumnSelectionPanel in project knime-core by knime.
the class RulePanel method createNewColumnTextFieldWithReplace.
private Component createNewColumnTextFieldWithReplace(final String watermark, final int colWidth, final String label) {
Box ret = Box.createVerticalBox();
JPanel addColumnPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
JPanel replaceColumnPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
m_outputGroup = new ButtonGroup();
final JRadioButton newColumn = new JRadioButton(label);
m_replaceColRadio = new JRadioButton("Replace Column:");
addColumnPanel.add(newColumn);
JTextField comp = Util.createTextFieldWithWatermark(watermark, colWidth, /*label*/
null);
m_newColumnName = comp;
addColumnPanel.add(comp);
ActionListener actionListener = new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
m_newColumnName.setEnabled(newColumn.isSelected());
m_replaceColumn.setEnabled(m_replaceColRadio.isSelected());
m_replaceColumn.setRequired(m_replaceColRadio.isSelected());
}
};
newColumn.addActionListener(actionListener);
m_replaceColRadio.addActionListener(actionListener);
m_outputGroup.add(newColumn);
m_outputGroup.add(m_replaceColRadio);
@SuppressWarnings("unchecked") ColumnSelectionPanel colSelectionPanel = new ColumnSelectionPanel((Border) null, DoubleValue.class, IntValue.class, StringValue.class, BooleanValue.class);
m_replaceColumn = colSelectionPanel;
m_outputType = new JLabel(DataValue.UTILITY.getIcon());
addColumnPanel.add(m_outputType);
replaceColumnPanel.add(m_replaceColRadio);
replaceColumnPanel.add(m_replaceColumn);
ret.add(addColumnPanel);
ret.add(replaceColumnPanel);
return ret;
}
use of org.knime.core.node.util.ColumnSelectionPanel in project knime-core by knime.
the class StringManipulationNodeDialog method createStringManipulationPanel.
/**
* @return the controls for the string manipulation node
* @since 3.3
*/
public Component createStringManipulationPanel() {
m_snippetPanel = new JSnippetPanel(StringManipulatorProvider.getDefault(), createCompletionProvider(), !m_isOnlyVariables);
m_newNameField = new JTextField(10);
String radioButtonName;
String radioButtonToolTip;
radioButtonName = "Append " + WordUtils.capitalize(m_columnOrVariable) + ": ";
radioButtonToolTip = "Appends a new " + m_columnOrVariable + " to the input with a given name.";
m_appendRadio = new JRadioButton(radioButtonName);
m_appendRadio.setToolTipText(radioButtonToolTip);
radioButtonName = "Replace " + WordUtils.capitalize(m_columnOrVariable) + ": ";
if (m_isOnlyVariables) {
radioButtonToolTip = "Replaces the " + m_columnOrVariable + " if the type stays the same.";
} else {
radioButtonToolTip = "Replaces the " + m_columnOrVariable + " and changes the " + m_columnOrVariable + " type accordingly.";
}
m_replaceRadio = new JRadioButton(radioButtonName);
m_replaceRadio.setToolTipText(radioButtonToolTip);
if (m_isOnlyVariables) {
// show all variables
m_replaceVariableCombo = new JComboBox<FlowVariable>(new DefaultComboBoxModel<FlowVariable>());
m_replaceVariableCombo.setRenderer(new FlowVariableListCellRenderer());
} else {
// show all columns
m_replaceColumnCombo = new ColumnSelectionPanel((Border) null, DataValue.class);
m_replaceColumnCombo.setRequired(false);
}
ButtonGroup buttonGroup = new ButtonGroup();
buttonGroup.add(m_appendRadio);
buttonGroup.add(m_replaceRadio);
ActionListener actionListener = new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
if (m_isOnlyVariables) {
m_replaceVariableCombo.setEnabled(m_replaceRadio.isSelected());
} else {
m_replaceColumnCombo.setEnabled(m_replaceRadio.isSelected());
}
m_newNameField.setEnabled(m_appendRadio.isSelected());
}
};
m_appendRadio.addActionListener(actionListener);
m_replaceRadio.addActionListener(actionListener);
m_compileOnCloseChecker = new JCheckBox("Syntax check on close");
m_compileOnCloseChecker.setToolTipText("Checks the syntax of the expression on close.");
m_insertMissingAsNullChecker = new JCheckBox("Insert Missing As Null");
m_insertMissingAsNullChecker.setToolTipText("If unselected, missing values in the input will produce a missing cell result");
return createPanel();
}
use of org.knime.core.node.util.ColumnSelectionPanel in project knime-core by knime.
the class LogRegLearnerNodeDialogPane method createTargetOptionsPanel.
/**
* Create options panel for the target.
*/
private JPanel createTargetOptionsPanel() {
JPanel p = new JPanel(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.HORIZONTAL;
c.weightx = 0;
c.weighty = 0;
c.gridx = 0;
c.gridy = 0;
c.anchor = GridBagConstraints.BASELINE_LEADING;
c.insets = new Insets(5, 5, 0, 0);
p.add(new JLabel("Target Column:"), c);
c.gridx++;
m_selectionPanel = new ColumnSelectionPanel(new EmptyBorder(0, 0, 0, 0), NominalValue.class);
m_selectionPanel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
updateTargetCategories((DataCell) m_targetReferenceCategory.getSelectedItem());
}
});
p.add(m_selectionPanel, c);
c.gridx = 0;
c.gridy++;
p.add(new JLabel("Reference Category:"), c);
c.gridx++;
m_targetReferenceCategory = new JComboBox();
p.add(m_targetReferenceCategory, c);
c.gridx = 0;
c.gridy++;
c.gridwidth = 3;
c.weightx = 1;
m_notSortTarget = new JCheckBox("Use order from target column domain (only relevant for output representation)");
p.add(m_notSortTarget, c);
m_selectionPanel.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(final ItemEvent e) {
Object selected = e.getItem();
if (selected instanceof DataColumnSpec) {
m_filterPanel.resetHiding();
m_filterPanel.hideColumns((DataColumnSpec) selected);
}
}
});
return p;
}
use of org.knime.core.node.util.ColumnSelectionPanel in project knime-core by knime.
the class LogRegLearnerNodeDialogPane method createTargetOptionsPanel.
/**
* Create options panel for the target.
*/
private JPanel createTargetOptionsPanel() {
JPanel p = new JPanel(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.HORIZONTAL;
c.weightx = 0;
c.weighty = 0;
c.gridx = 0;
c.gridy = 0;
c.anchor = GridBagConstraints.BASELINE_LEADING;
c.insets = new Insets(5, 5, 0, 0);
p.add(new JLabel("Target Column:"), c);
c.gridx++;
@SuppressWarnings("unchecked") final ColumnSelectionPanel columnSelectionPanel = new ColumnSelectionPanel(new EmptyBorder(0, 0, 0, 0), NominalValue.class);
m_selectionPanel = columnSelectionPanel;
m_selectionPanel.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
updateTargetCategories((DataCell) m_targetReferenceCategory.getSelectedItem());
}
});
p.add(m_selectionPanel, c);
c.gridx = 0;
c.gridy++;
p.add(new JLabel("Reference Category:"), c);
c.gridx++;
m_targetReferenceCategory = new JComboBox<>();
p.add(m_targetReferenceCategory, c);
c.gridx = 0;
c.gridy++;
c.gridwidth = 3;
c.weightx = 1;
m_notSortTarget = new JCheckBox("Use order from target column domain (only relevant for output representation)");
p.add(m_notSortTarget, c);
m_selectionPanel.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(final ItemEvent e) {
Object selected = e.getItem();
if (selected instanceof DataColumnSpec) {
m_filterPanel.resetHiding();
m_filterPanel.hideNames((DataColumnSpec) selected);
}
}
});
return p;
}
Aggregations