use of org.knime.core.node.defaultnodesettings.SettingsModelBoolean in project knime-core by knime.
the class CreateBitVectorNodeModel method createMSCHasWildcardsModel.
/**
*@return the multi string column has wild card model
*/
static SettingsModelBoolean createMSCHasWildcardsModel() {
final SettingsModelBoolean m = new SettingsModelBoolean("multiStringColumnHasWildcards", false);
m.setEnabled(false);
return m;
}
use of org.knime.core.node.defaultnodesettings.SettingsModelBoolean in project knime-core by knime.
the class CreateBitVectorNodeModel method createMSCRegexModel.
/**
*@return the multi string column is regex model
*/
static SettingsModelBoolean createMSCRegexModel() {
final SettingsModelBoolean m = new SettingsModelBoolean("multiStringColumnIsRegex", false);
m.setEnabled(false);
return m;
}
use of org.knime.core.node.defaultnodesettings.SettingsModelBoolean in project knime-core by knime.
the class CreateBitVectorNodeModel method createMSCCaseSensitiveModel.
/**
*@return the multi string column case sensitive model
*/
static SettingsModelBoolean createMSCCaseSensitiveModel() {
final SettingsModelBoolean m = new SettingsModelBoolean("multiStringColumnCaseSensitive", false);
m.setEnabled(false);
return m;
}
use of org.knime.core.node.defaultnodesettings.SettingsModelBoolean in project knime-core by knime.
the class AbstractHistogramNodeModel method validateSettings.
/**
* {@inheritDoc}
*/
@Override
protected void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException {
final SettingsModelBoolean model = m_allRows.createCloneWithValidatedValue(settings);
if (!model.getBooleanValue()) {
// read the spinner value only if the user hasn't selected to
// retrieve all values
m_noOfRows.validateSettings(settings);
final SettingsModelInteger copy = m_noOfRows.createCloneWithValidatedValue(settings);
if (copy.getIntValue() <= 0) {
throw new InvalidSettingsException("No of rows must be greater zero");
}
}
try {
m_xColName.validateSettings(settings);
} catch (final Throwable e) {
// It's an older node which hasn't stored the aggregation column
final String xCol = settings.getString("xColumn");
if (xCol == null || xCol.length() < 1) {
throw new InvalidSettingsException("Invalid binning column");
}
}
try {
m_aggrColName.validateSettings(settings);
} catch (final Throwable e) {
// It's an older node which hasn't stored the aggregation column
LOGGER.debug("Exception while validating settings: " + e.getMessage());
}
}
use of org.knime.core.node.defaultnodesettings.SettingsModelBoolean in project knime-core by knime.
the class RoundDoubleNodeModel method validateSettings.
/**
* {@inheritDoc}
*/
@Override
protected void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException {
m_filterDoubleColModel.validateSettings(settings);
m_numberPrecisionModel.validateSettings(settings);
m_appendColumnsModel.validateSettings(settings);
m_columnSuffixModel.validateSettings(settings);
m_roundingModeModel.validateSettings(settings);
try {
// added in 2.8
m_outputTypeModel.validateSettings(settings);
} catch (InvalidSettingsException ise) {
RoundDoubleNodeDialog.getOutputAsStringModel().validateSettings(settings);
}
m_numberModeModel.validateSettings(settings);
// additional sanity checks
StringBuffer errMsgBuffer = new StringBuffer();
boolean err = false;
// precision number has to be between 0 and inf
int precision = ((SettingsModelIntegerBounded) m_numberPrecisionModel.createCloneWithValidatedValue(settings)).getIntValue();
if (precision < MIN_PRECISION || precision > MAX_PRECISION) {
errMsgBuffer.append("Rounding precision has to be between " + MIN_PRECISION + " and " + MAX_PRECISION + "\n");
err = true;
}
// if rounded values have to be appended, check for valid column suffix
boolean append = ((SettingsModelBoolean) m_appendColumnsModel.createCloneWithValidatedValue(settings)).getBooleanValue();
if (append) {
String suffix = ((SettingsModelString) m_columnSuffixModel.createCloneWithValidatedValue(settings)).getStringValue();
if (suffix.length() <= 0) {
errMsgBuffer.append("Column suffix may not be empty if append " + "columns is set!\n");
err = true;
}
}
// rounding mode string needs to be a valid round mode
String roundingModeString = ((SettingsModelString) m_roundingModeModel.createCloneWithValidatedValue(settings)).getStringValue();
try {
RoundingMode.valueOf(roundingModeString);
} catch (Exception e) {
errMsgBuffer.append("Specified round mode is not valid!\n");
err = true;
}
// number mode string needs to be a valid number mode
String numberModeString = ((SettingsModelString) m_numberModeModel.createCloneWithValidatedValue(settings)).getStringValue();
try {
NumberMode.valueByDescription(numberModeString);
} catch (Exception e) {
errMsgBuffer.append("Specified number mode is not valid!\n");
err = true;
// throw exception when at least one settings is invalid
} finally {
if (err) {
throw new InvalidSettingsException(errMsgBuffer.toString());
}
}
}
Aggregations