use of org.knime.base.node.preproc.autobinner3.AutoBinnerLearnSettings.OutputFormat in project knime-core by knime.
the class AutoBinnerLearnNodeDialogPane method createNumberFormatSettingsTab.
private JPanel createNumberFormatSettingsTab() {
JPanel p = new JPanel(new GridBagLayout());
m_defaultFormatting = new JRadioButton("Default formatting");
m_advancedFormatting = new JRadioButton("Advanced formatting");
ButtonGroup formatting = new ButtonGroup();
formatting.add(m_defaultFormatting);
formatting.add(m_advancedFormatting);
m_outputFormat = new JComboBox<OutputFormat>(OutputFormat.values());
m_precision = new JSpinner(new SpinnerNumberModel(3, 0, Integer.MAX_VALUE, 1));
m_precisionMode = new JComboBox<PrecisionMode>(PrecisionMode.values());
m_roundingMode = new JComboBox<RoundingMode>(getRoundingModes());
ActionListener formattingListener = new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
m_outputFormat.setEnabled(m_advancedFormatting.isSelected());
m_precision.setEnabled(m_advancedFormatting.isSelected());
m_precisionMode.setEnabled(m_advancedFormatting.isSelected());
m_roundingMode.setEnabled(m_advancedFormatting.isSelected());
}
};
m_defaultFormatting.addActionListener(formattingListener);
m_advancedFormatting.addActionListener(formattingListener);
GridBagConstraints gbc = new GridBagConstraints();
Insets indentedInsets = new Insets(5, 15, 5, 5);
Insets normalInsets = new Insets(5, 5, 5, 5);
gbc.insets = normalInsets;
gbc.anchor = GridBagConstraints.NORTHWEST;
gbc.fill = GridBagConstraints.BOTH;
gbc.weightx = 0;
gbc.weighty = 0;
gbc.gridx = 0;
gbc.gridy = 0;
gbc.gridwidth = 2;
p.add(m_defaultFormatting, gbc);
gbc.gridy++;
p.add(m_advancedFormatting, gbc);
gbc.gridwidth = 1;
gbc.gridy++;
gbc.insets = indentedInsets;
p.add(new JLabel("Output format"), gbc);
gbc.gridx++;
gbc.insets = normalInsets;
p.add(m_outputFormat, gbc);
gbc.gridx = 0;
gbc.gridy++;
gbc.insets = indentedInsets;
p.add(new JLabel("Precision"), gbc);
gbc.gridx++;
gbc.insets = normalInsets;
p.add(m_precision, gbc);
gbc.gridx = 0;
gbc.gridy++;
gbc.insets = indentedInsets;
p.add(new JLabel("Precision mode"), gbc);
gbc.gridx++;
gbc.insets = normalInsets;
p.add(m_precisionMode, gbc);
gbc.gridx = 0;
gbc.gridy++;
gbc.insets = indentedInsets;
p.add(new JLabel("Rounding mode"), gbc);
gbc.gridx++;
gbc.insets = normalInsets;
p.add(m_roundingMode, gbc);
gbc.gridx++;
gbc.gridy++;
gbc.weightx = 1;
gbc.weighty = 1;
gbc.insets = new Insets(0, 0, 0, 0);
p.add(new JLabel(), gbc);
return p;
}
use of org.knime.base.node.preproc.autobinner3.AutoBinnerLearnSettings.OutputFormat in project knime-core by knime.
the class AutoBinnerLearnNodeDialogPane method saveSettingsTo.
/**
* @param settings write intervals to
* @throws InvalidSettingsException if a bin name is empty
* @see NodeDialogPane#saveSettingsTo(NodeSettingsWO)
*/
@Override
protected void saveSettingsTo(final NodeSettingsWO settings) throws InvalidSettingsException {
DataColumnSpecFilterConfiguration config = AutoBinnerLearnNodeModel.createDCSFilterConfiguration();
m_filterPanel.saveConfiguration(config);
m_settings.setFilterConfiguration(config);
Method method = m_methodFixedNumber.isSelected() ? Method.fixedNumber : Method.sampleQuantiles;
m_settings.setMethod(method);
m_settings.setBinCount(((Number) m_numBins.getValue()).intValue());
m_settings.setEqualityMethod((EqualityMethod) m_equalityMethod.getSelectedItem());
try {
List<Double> sampleQuantiles = explode(m_sampleQuantiles.getText());
double[] sq = normalizeSampleQuantiles(sampleQuantiles);
m_settings.setSampleQuantiles(sq);
} catch (NumberFormatException e) {
throw new InvalidSettingsException("Cannot parse the list of quantiles. Changes are " + "not applied.");
}
BinNaming binNaming = null;
if (m_binNamingNumbered.isSelected()) {
binNaming = BinNaming.numbered;
}
if (m_binNamingEdges.isSelected()) {
binNaming = BinNaming.edges;
}
if (m_binNamingMidpoints.isSelected()) {
binNaming = BinNaming.midpoints;
}
m_settings.setBinNaming(binNaming);
m_settings.setReplaceColumn(m_replaceColumn.isSelected());
m_settings.setIntegerBounds(m_integerBounds.isSelected());
m_settings.setAdvancedFormatting(m_advancedFormatting.isSelected());
m_settings.setOutputFormat((OutputFormat) m_outputFormat.getSelectedItem());
m_settings.setPrecision(((Number) m_precision.getValue()).intValue());
m_settings.setPrecisionMode((PrecisionMode) m_precisionMode.getSelectedItem());
m_settings.setRoundingMode((RoundingMode) m_roundingMode.getSelectedItem());
m_settings.saveSettings(settings);
}
use of org.knime.base.node.preproc.autobinner3.AutoBinnerLearnSettings.OutputFormat in project knime-core by knime.
the class AutoBinnerLearnNodeDialogPane method createNumberFormatSettingsTab.
private JPanel createNumberFormatSettingsTab() {
JPanel p = new JPanel(new GridBagLayout());
m_defaultFormatting = new JRadioButton("Default formatting");
m_advancedFormatting = new JRadioButton("Advanced formatting");
ButtonGroup formatting = new ButtonGroup();
formatting.add(m_defaultFormatting);
formatting.add(m_advancedFormatting);
m_outputFormat = new JComboBox<OutputFormat>(OutputFormat.values());
m_precision = new JSpinner(new SpinnerNumberModel(3, 0, Integer.MAX_VALUE, 1));
m_precisionMode = new JComboBox<PrecisionMode>(PrecisionMode.values());
m_roundingMode = new JComboBox<RoundingMode>(getRoundingModes());
ActionListener formattingListener = new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
m_outputFormat.setEnabled(m_advancedFormatting.isSelected());
m_precision.setEnabled(m_advancedFormatting.isSelected());
m_precisionMode.setEnabled(m_advancedFormatting.isSelected());
m_roundingMode.setEnabled(m_advancedFormatting.isSelected());
}
};
m_defaultFormatting.addActionListener(formattingListener);
m_advancedFormatting.addActionListener(formattingListener);
GridBagConstraints gbc = new GridBagConstraints();
Insets indentedInsets = new Insets(5, 15, 5, 5);
Insets normalInsets = new Insets(5, 5, 5, 5);
gbc.insets = normalInsets;
gbc.anchor = GridBagConstraints.NORTHWEST;
gbc.fill = GridBagConstraints.BOTH;
gbc.weightx = 0;
gbc.weighty = 0;
gbc.gridx = 0;
gbc.gridy = 0;
gbc.gridwidth = 2;
p.add(m_defaultFormatting, gbc);
gbc.gridy++;
p.add(m_advancedFormatting, gbc);
gbc.gridwidth = 1;
gbc.gridy++;
gbc.insets = indentedInsets;
p.add(new JLabel("Output format"), gbc);
gbc.gridx++;
gbc.insets = normalInsets;
p.add(m_outputFormat, gbc);
gbc.gridx = 0;
gbc.gridy++;
gbc.insets = indentedInsets;
p.add(new JLabel("Precision"), gbc);
gbc.gridx++;
gbc.insets = normalInsets;
p.add(m_precision, gbc);
gbc.gridx = 0;
gbc.gridy++;
gbc.insets = indentedInsets;
p.add(new JLabel("Precision mode"), gbc);
gbc.gridx++;
gbc.insets = normalInsets;
p.add(m_precisionMode, gbc);
gbc.gridx = 0;
gbc.gridy++;
gbc.insets = indentedInsets;
p.add(new JLabel("Rounding mode"), gbc);
gbc.gridx++;
gbc.insets = normalInsets;
p.add(m_roundingMode, gbc);
gbc.gridx++;
gbc.gridy++;
gbc.weightx = 1;
gbc.weighty = 1;
gbc.insets = new Insets(0, 0, 0, 0);
p.add(new JLabel(), gbc);
return p;
}
Aggregations