use of org.knime.core.node.defaultnodesettings.SettingsModelString in project knime-core by knime.
the class SleepNodeDialog method waitForFile.
private void waitForFile() {
m_events = new DialogComponentButtonGroup(new SettingsModelString(SleepNodeModel.CFGKEY_FILESTATUS, "Modification"), false, null, "Creation", "Modification", "Deletion");
FlowVariableModel fvm = createFlowVariableModel(SleepNodeModel.CFGKEY_FILEPATH, Type.STRING);
m_fileChooser = new FilesHistoryPanel(fvm, SleepNodeModel.CFGKEY_FILEPATH, LocationValidation.None);
m_fileRB = new JRadioButton("Wait for file.. ");
m_fileRB.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(final ItemEvent e) {
if (m_fileRB.isSelected()) {
m_selection = 2;
}
m_fileChooser.setEnabled(m_fileRB.isSelected());
m_events.getModel().setEnabled(m_fileRB.isSelected());
}
});
}
use of org.knime.core.node.defaultnodesettings.SettingsModelString in project knime-core by knime.
the class SleepNodeModel method validateSettings.
/**
* {@inheritDoc}
*/
@Override
protected void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException {
int selection = settings.getInt(CFGKEY_WAITOPTION);
if (!(0 <= selection && selection <= 2)) {
throw new InvalidSettingsException("Selected wait option is not available. Please reconfigure.");
}
int h = 0;
int m = 0;
int s = 0;
if (selection == 0) {
h = settings.getInt(CFGKEY_FORHOURS);
m = settings.getInt(CFGKEY_FORMINUTES);
s = settings.getInt(CFGKEY_FORSECONDS);
} else if (selection == 1) {
h = settings.getInt(CFGKEY_TOHOURS);
m = settings.getInt(CFGKEY_TOMINUTES);
s = settings.getInt(CFGKEY_TOSECONDS);
}
if (!(0 <= h) && !(h <= 23)) {
throw new InvalidSettingsException("Number of hours must be between 0 and 23. Hours = " + h + ".");
} else if (!(0 <= m) && !(m <= 59)) {
throw new InvalidSettingsException("Number of minutes must be between 0 and 59. Minutes = " + m + ".");
} else if (!(0 <= s) && !(s <= 59)) {
throw new InvalidSettingsException("Number of seconds must be between 0 and 59. Secondss = " + s + ".");
}
if (selection == 2) {
SettingsModelString sms = new SettingsModelString(CFGKEY_FILESTATUS, null);
sms.loadSettingsFrom(settings);
}
}
use of org.knime.core.node.defaultnodesettings.SettingsModelString in project knime-core by knime.
the class SleepNodeModel method loadValidatedSettingsFrom.
/**
* {@inheritDoc}
*/
@Override
protected void loadValidatedSettingsFrom(final NodeSettingsRO settings) throws InvalidSettingsException {
m_selection = settings.getInt(CFGKEY_WAITOPTION);
if (m_selection == 0) {
m_forHours = settings.getInt(CFGKEY_FORHOURS);
m_forMin = settings.getInt(CFGKEY_FORMINUTES);
m_forSec = settings.getInt(CFGKEY_FORSECONDS);
} else if (m_selection == 1) {
m_toHours = settings.getInt(CFGKEY_TOHOURS);
m_toMin = settings.getInt(CFGKEY_TOMINUTES);
m_toSec = settings.getInt(CFGKEY_TOSECONDS);
} else if (m_selection == 2) {
m_filePath = settings.getString(CFGKEY_FILEPATH);
SettingsModelString sms = new SettingsModelString(CFGKEY_FILESTATUS, null);
sms.loadSettingsFrom(settings);
m_fileStatus = sms.getStringValue();
}
}
use of org.knime.core.node.defaultnodesettings.SettingsModelString in project knime-core by knime.
the class CaseEndNodeModel method validateSettings.
/**
* {@inheritDoc}
*/
@Override
protected void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException {
if (settings.containsKey(m_multipleActiveHandlingSettingsModel.getKey())) {
SettingsModelString c = (SettingsModelString) m_multipleActiveHandlingSettingsModel.createCloneWithValidatedValue(settings);
String value = c.getStringValue();
try {
MultipleActiveHandling.valueOf(value);
} catch (Exception e) {
throw new InvalidSettingsException("invalid constant for multiple-active handling policy: " + value);
}
}
}
use of org.knime.core.node.defaultnodesettings.SettingsModelString in project knime-core by knime.
the class PieNodeModel method validateSettings.
/**
* {@inheritDoc}
*/
@Override
protected void validateSettings(final NodeSettingsRO settings) throws InvalidSettingsException {
m_allRows.validateSettings(settings);
m_noOfRows.validateSettings(settings);
m_pieColumn.validateSettings(settings);
m_aggrMethod.validateSettings(settings);
final String aggrMethod = ((SettingsModelString) m_aggrMethod.createCloneWithValidatedValue(settings)).getStringValue();
final AggregationMethod method = AggregationMethod.getMethod4Command(aggrMethod);
m_aggrColumn.validateSettings(settings);
if (!AggregationMethod.COUNT.equals(method)) {
final String value = ((SettingsModelString) m_aggrColumn.createCloneWithValidatedValue(settings)).getStringValue();
if (value == null) {
throw new InvalidSettingsException("No aggregation column only valid for method count");
}
}
}
Aggregations