use of org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration in project knime-core by knime.
the class EditNumericDomainConfiguration method loadConfigurationInModel.
/**
* Loads the configuration for the model.
*
* @param settings the settings to load
* @throws InvalidSettingsException if the settings are invalid
*/
void loadConfigurationInModel(final NodeSettingsRO settings) throws InvalidSettingsException {
m_lowerBound = settings.getDouble(MIN_KEY);
m_upperBound = settings.getDouble(MAX_KEY);
m_domainOverflowPolicy = toDomainHandler(settings.getString(DOMAIN_OVERFLOW_POLICY_KEY));
DataColumnSpecFilterConfiguration dataColumnSpecFilterConfiguration = createDoubleSpecFilterConfig();
dataColumnSpecFilterConfiguration.loadConfigurationInModel(settings);
m_columnspecFilterConfig = dataColumnSpecFilterConfiguration;
}
use of org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration in project knime-core by knime.
the class ColCombine2NodeDialog method saveSettingsTo.
/**
* {@inheritDoc}
*/
@Override
protected void saveSettingsTo(final NodeSettingsWO settings) throws InvalidSettingsException {
DataColumnSpecFilterConfiguration conf = ColCombine2NodeModel.createDCSFilterConfiguration();
m_filterPanel.saveConfiguration(conf);
conf.saveConfiguration(settings);
String delimiter = m_delimTextField.getText();
settings.addString(ColCombine2NodeModel.CFG_DELIMITER_STRING, delimiter);
String newColName = m_appendColNameField.getText();
if (m_spec.containsName(newColName)) {
throw new InvalidSettingsException("Name of appended column already exists: " + newColName);
}
settings.addString(ColCombine2NodeModel.CFG_NEW_COLUMN_NAME, newColName);
boolean isQuoting = m_quoteCharRadioButton.isSelected();
settings.addBoolean(ColCombine2NodeModel.CFG_IS_QUOTING, isQuoting);
if (isQuoting) {
String quoteFieldText = (String) m_quoteCharField.getValue();
if (quoteFieldText == null || quoteFieldText.trim().length() == 0) {
throw new InvalidSettingsException("Quote field is empty");
}
if (quoteFieldText.length() > 1) {
throw new InvalidSettingsException("Quote field must only contain single character");
}
Character quote = quoteFieldText.charAt(0);
settings.addChar(ColCombine2NodeModel.CFG_QUOTE_CHAR, quote);
settings.addBoolean(ColCombine2NodeModel.CFG_IS_QUOTING_ALWAYS, m_quoteAlwaysChecker.isSelected());
} else {
String replace = m_replaceDelimStringField.getText();
settings.addString(ColCombine2NodeModel.CFG_REPLACE_DELIMITER_STRING, replace);
}
}
use of org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration in project knime-core by knime.
the class ColCombine2NodeModel method validateSettings.
/**
* {@inheritDoc}
*/
@Override
protected void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException {
DataColumnSpecFilterConfiguration conf = createDCSFilterConfiguration();
conf.loadConfigurationInModel(settings);
String newColName = settings.getString(CFG_NEW_COLUMN_NAME);
if (newColName == null || newColName.trim().length() == 0) {
throw new InvalidSettingsException("Name of new column must not be empty");
}
String delim = settings.getString(CFG_DELIMITER_STRING);
if (delim == null) {
throw new InvalidSettingsException("Delimiter must not be null");
}
delim = trimDelimString(delim);
boolean isQuote = settings.getBoolean(CFG_IS_QUOTING);
if (isQuote) {
char quote = settings.getChar(CFG_QUOTE_CHAR);
if (Character.isWhitespace(quote)) {
throw new InvalidSettingsException("Can't use white space as quote char");
}
if (delim.contains(Character.toString(quote))) {
throw new InvalidSettingsException("Delimiter String \"" + delim + "\" must not contain quote character ('" + quote + "')");
}
settings.getBoolean(CFG_IS_QUOTING_ALWAYS);
} else {
String replace = settings.getString(CFG_REPLACE_DELIMITER_STRING);
if ((delim.length() > 0) && (replace.contains(delim))) {
throw new InvalidSettingsException("Replacement string \"" + replace + "\" must not contain delimiter string \"" + delim + "\"");
}
}
}
use of org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration in project knime-core by knime.
the class CategoryToNumberNodeDialogPane method loadSettingsFrom.
/**
* {@inheritDoc}
*/
@Override
protected void loadSettingsFrom(final NodeSettingsRO settings, final PortObjectSpec[] specs) throws NotConfigurableException {
DataTableSpec spec = (DataTableSpec) specs[0];
m_settings.loadSettingsForDialog(settings, spec);
DataColumnSpecFilterConfiguration config = m_settings.getFilterConfiguration();
m_filterPanel.loadConfiguration(config, spec);
m_appendColums.setSelected(m_settings.getAppendColumns());
m_columnSuffix.setText(m_settings.getColumnSuffix());
m_columnSuffix.setEnabled(m_appendColums.isSelected());
m_startIndex.setValue(m_settings.getStartIndex());
m_increment.setValue(m_settings.getIncrement());
m_maxCategories.setValue(m_settings.getMaxCategories());
if (!m_settings.getDefaultValue().isMissing()) {
IntValue value = (IntValue) m_settings.getDefaultValue();
m_defaultValue.setText(Integer.toString(value.getIntValue()));
} else {
m_defaultValue.setText("");
}
if (!m_settings.getMapMissingTo().isMissing()) {
IntValue value = (IntValue) m_settings.getMapMissingTo();
m_mapMissingTo.setText(Integer.toString(value.getIntValue()));
} else {
m_mapMissingTo.setText("");
}
}
use of org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration in project knime-core by knime.
the class CategoryToNumberNodeDialogPane method saveSettingsTo.
/**
* {@inheritDoc}
*/
@Override
protected void saveSettingsTo(final NodeSettingsWO settings) throws InvalidSettingsException {
DataColumnSpecFilterConfiguration config = CategoryToNumberNodeModel.createDCSFilterConfiguration();
m_filterPanel.saveConfiguration(config);
m_settings.setFilterConfiguration(config);
m_settings.setAppendColumns(m_appendColums.isSelected());
m_settings.setColumnSuffix(m_columnSuffix.getText());
m_settings.setStartIndex((Integer) m_startIndex.getValue());
m_settings.setIncrement((Integer) m_increment.getValue());
m_settings.setMaxCategories((Integer) m_maxCategories.getValue());
if (!m_defaultValue.getText().trim().isEmpty()) {
int value = Integer.valueOf(m_defaultValue.getText());
m_settings.setDefaultValue(new IntCell(value));
} else {
m_settings.setDefaultValue(DataType.getMissingCell());
}
if (!m_mapMissingTo.getText().trim().isEmpty()) {
int value = Integer.valueOf(m_mapMissingTo.getText());
m_settings.setMapMissingTo(new IntCell(value));
} else {
m_settings.setMapMissingTo(DataType.getMissingCell());
}
m_settings.saveSettings(settings);
}
Aggregations