use of org.knime.core.node.defaultnodesettings.SettingsModelString in project knime-core by knime.
the class CrossJoinerNodeModel method createSecondRowIdsNameSettingsModel.
/**
* @param showSecondRowIdsSettingsModel the enable checker model.
* @return the column name for the second tables rowids
*/
static SettingsModelString createSecondRowIdsNameSettingsModel(final SettingsModelBoolean showSecondRowIdsSettingsModel) {
final SettingsModelString settingsModel = new SettingsModelString("CFG_SECOND_COLUMNNAME", "SecondRowIDs");
showSecondRowIdsSettingsModel.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(final ChangeEvent e) {
settingsModel.setEnabled(showSecondRowIdsSettingsModel.getBooleanValue());
}
});
settingsModel.setEnabled(showSecondRowIdsSettingsModel.getBooleanValue());
return settingsModel;
}
use of org.knime.core.node.defaultnodesettings.SettingsModelString in project knime-core by knime.
the class CellSplitterByPosNodeModel method validateSettings.
/**
* {@inheritDoc}
*/
@Override
protected void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException {
SettingsModelString tmpSplits = m_splitPoints.createCloneWithValidatedValue(settings);
SettingsModelString tmpColNames = m_newColNames.createCloneWithValidatedValue(settings);
// null or empty string is invalid for split points or colNames
if ((tmpSplits.getStringValue() == null) || tmpSplits.getStringValue().equals("")) {
throw new InvalidSettingsException("Please specify split points");
}
if ((tmpColNames.getStringValue() == null) || tmpColNames.getStringValue().equals("")) {
throw new InvalidSettingsException("Please specify new column names");
}
int[] points = convertSplitPointsToInts(tmpSplits.getStringValue());
String[] colNames = convertNewColumnNames(tmpColNames.getStringValue(), null);
// make sure enough (and not too many) col names are specified
if (points.length + 1 != colNames.length) {
throw new InvalidSettingsException("Number of new column names is not as " + "required for the specified splits " + "(no. of new columns: " + (points.length + 1) + ")");
}
m_splitPoints.validateSettings(settings);
m_newColNames.validateSettings(settings);
m_selColumn.validateSettings(settings);
}
use of org.knime.core.node.defaultnodesettings.SettingsModelString in project knime-core by knime.
the class ColumnComparatorNodeDialogPane method createMatchValue.
/**
* @return settings model for replacement value
*/
static SettingsModelString createMatchValue() {
SettingsModelString model = new SettingsModelString("match_value", "TRUE");
model.setEnabled(false);
return model;
}
use of org.knime.core.node.defaultnodesettings.SettingsModelString in project knime-core by knime.
the class ColumnComparatorNodeModel method validateSettings.
/**
* {@inheritDoc}
*/
@Override
protected void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException {
SettingsModelString first = m_firstColumn.createCloneWithValidatedValue(settings);
SettingsModelString second = m_secondColumn.createCloneWithValidatedValue(settings);
if (first.getStringValue() == null || second.getStringValue() == null) {
throw new InvalidSettingsException("No column is selected for comparison.");
}
if (first.getStringValue().equals(second.getStringValue())) {
throw new InvalidSettingsException("Left and right column are the same: " + first.getStringValue());
}
SettingsModelString matchOption = m_matchOption.createCloneWithValidatedValue(settings);
SettingsModelString mismatchOption = m_mismatchOption.createCloneWithValidatedValue(settings);
if (!matchOption.getStringValue().equals(REPL_OPTIONS[3]) && !mismatchOption.getStringValue().equals(REPL_OPTIONS[3])) {
if (matchOption.getStringValue().equals(mismatchOption.getStringValue())) {
throw new InvalidSettingsException("Replacement options are the same for true/false!");
}
}
m_firstColumn.validateSettings(settings);
m_secondColumn.validateSettings(settings);
m_matchOption.validateSettings(settings);
m_mismatchOption.validateSettings(settings);
m_operator.validateSettings(settings);
m_matchValue.validateSettings(settings);
m_mismatchValue.validateSettings(settings);
m_newColumn.validateSettings(settings);
}
use of org.knime.core.node.defaultnodesettings.SettingsModelString in project knime-core by knime.
the class ColumnHeaderExtractorNodeModel method createUnifyHeaderPrefix.
/**
* @param replaceColHeader column header model (enable/disable listener)
* @return new settings model for prefix of new header
*/
static SettingsModelString createUnifyHeaderPrefix(final SettingsModelBoolean replaceColHeader) {
final SettingsModelString result = new SettingsModelString("unifyHeaderPrefix", "Column ");
replaceColHeader.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(final ChangeEvent chEvent) {
result.setEnabled(replaceColHeader.getBooleanValue());
}
});
return result;
}
Aggregations