use of org.knime.core.node.defaultnodesettings.SettingsModelBoolean in project knime-core by knime.
the class RowKeyNodeModel method validateSettings.
/**
* {@inheritDoc}
*/
@Override
protected void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException {
assert (settings != null);
final SettingsModelBoolean replaceRowKeyModel = m_replaceKey.createCloneWithValidatedValue(settings);
final SettingsModelBoolean appendRowKeyModel = m_appendRowKey.createCloneWithValidatedValue(settings);
final SettingsModelString newRowKeyModel = m_newRowKeyColumn.createCloneWithValidatedValue(settings);
final SettingsModelString newColNameModel = m_newColumnName.createCloneWithValidatedValue(settings);
validateInput(null, appendRowKeyModel.getBooleanValue(), newColNameModel.getStringValue(), replaceRowKeyModel.getBooleanValue(), newRowKeyModel.getStringValue(), appendRowKeyModel.getBooleanValue());
}
use of org.knime.core.node.defaultnodesettings.SettingsModelBoolean in project knime-core by knime.
the class DBGroupByNodeModel2 method validateSettings.
/**
* {@inheritDoc}
*/
@Override
protected void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException {
super.validateSettings(settings);
m_groupByCols.validateSettings(settings);
final boolean addCountStar = ((SettingsModelBoolean) m_addCountStar.createCloneWithValidatedValue(settings)).getBooleanValue();
final String colName = ((SettingsModelString) m_countStarColName.createCloneWithValidatedValue(settings)).getStringValue();
if (addCountStar && (colName == null || colName.isEmpty())) {
throw new IllegalArgumentException("Please specify the count(*) column name");
}
if (ColumnNamePolicy.getPolicy4Label(((SettingsModelString) m_columnNamePolicy.createCloneWithValidatedValue(settings)).getStringValue()) == null) {
throw new InvalidSettingsException("Invalid column name policy");
}
}
use of org.knime.core.node.defaultnodesettings.SettingsModelBoolean in project knime-core by knime.
the class AutoHiLiteNodeFactory method createNodeModel.
/**
* {@inheritDoc}
*/
@Override
public NodeModel createNodeModel() {
return new NodeModel(1, 1) {
private SettingsModelBoolean m_smClearHiLites = createClearHilitesModel();
/**
* {@inheritDoc}
*/
@Override
protected DataTableSpec[] configure(final DataTableSpec[] inSpecs) throws InvalidSettingsException {
return inSpecs;
}
/**
* {@inheritDoc}
*/
@Override
protected BufferedDataTable[] execute(final BufferedDataTable[] inData, final ExecutionContext exec) throws Exception {
if (m_smClearHiLites.getBooleanValue()) {
getInHiLiteHandler(0).fireClearHiLiteEvent();
}
final Set<RowKey> keys = new HashSet<RowKey>();
final HiLiteHandler hlh = getInHiLiteHandler(0);
long counter = 0;
long numOfRows = inData[0].size();
for (final DataRow row : inData[0]) {
keys.add(row.getKey());
if (keys.size() == NUMBER_OF_ROWS_HILITED_AT_ONCE) {
exec.setProgress(++counter * NUMBER_OF_ROWS_HILITED_AT_ONCE / (double) numOfRows, "HiLiting all rows...");
hlh.fireHiLiteEvent(keys);
keys.clear();
}
}
hlh.fireHiLiteEvent(keys);
// wait for hilite to propagate
ViewUtils.invokeAndWaitInEDT(() -> {
});
return inData;
}
@Override
protected void loadInternals(final File nodeInternDir, final ExecutionMonitor exec) throws IOException, CanceledExecutionException {
}
@Override
protected void saveInternals(final File nodeInternDir, final ExecutionMonitor exec) throws IOException, CanceledExecutionException {
}
@Override
protected void saveSettingsTo(final NodeSettingsWO settings) {
m_smClearHiLites.saveSettingsTo(settings);
}
@Override
protected void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException {
m_smClearHiLites.validateSettings(settings);
}
@Override
protected void loadValidatedSettingsFrom(final NodeSettingsRO settings) throws InvalidSettingsException {
m_smClearHiLites.loadSettingsFrom(settings);
}
@Override
protected void reset() {
// no op
}
};
}
use of org.knime.core.node.defaultnodesettings.SettingsModelBoolean in project knime-core by knime.
the class DecisionTreeLearnerNodeDialog2 method createSettingsSkipNominalColumnsWithoutDomain.
/**
* @return binary nominal split mode
*/
static SettingsModelBoolean createSettingsSkipNominalColumnsWithoutDomain() {
SettingsModelBoolean setting = new SettingsModelBoolean(DecisionTreeLearnerNodeModel2.KEY_SKIP_COLUMNS, DecisionTreeLearnerNodeModel2.DEFAULT_BINARY_NOMINAL_SPLIT_MODE);
setting.setBooleanValue(true);
return setting;
}
use of org.knime.core.node.defaultnodesettings.SettingsModelBoolean in project knime-core by knime.
the class DecisionTreeLearnerNodeDialog2 method createSettingsFirstSplitColumn.
/**
* @return name of column to perform first split on
*/
static SettingsModelString createSettingsFirstSplitColumn(final SettingsModelBoolean useFirstSplitCol) {
SettingsModelString firstSplitCol = new SettingsModelString(DecisionTreeLearnerNodeModel2.KEY_FIRST_SPLIT_COL, null);
useFirstSplitCol.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(final ChangeEvent e) {
firstSplitCol.setEnabled(((SettingsModelBoolean) e.getSource()).getBooleanValue());
}
});
firstSplitCol.setEnabled(useFirstSplitCol.getBooleanValue());
return firstSplitCol;
}
Aggregations