use of org.knime.core.node.NotConfigurableException in project knime-core by knime.
the class ParameterizedDBQueryNodeDialog method loadSettingsFrom.
/**
* {@inheritDoc}
*/
@Override
protected void loadSettingsFrom(final NodeSettingsRO settings, final PortObjectSpec[] specs) throws NotConfigurableException {
final DataTableSpec inSpec = (DataTableSpec) specs[0];
if (inSpec.getNumColumns() < 1) {
throw new NotConfigurableException("No column spec available");
}
if (specs[1] == null) {
throw new NotConfigurableException("No valid database connection available.");
}
m_panel.loadSettingsFrom(settings, specs, getAvailableFlowVariables().values());
}
use of org.knime.core.node.NotConfigurableException in project knime-core by knime.
the class BitVectorGeneratorNodeDialog method loadSettingsFrom.
/**
* {@inheritDoc}
*/
@Override
protected void loadSettingsFrom(final NodeSettingsRO settings, final DataTableSpec[] specs) throws NotConfigurableException {
if ((specs[0] == null) || (specs[0].getNumColumns() < 1)) {
throw new NotConfigurableException("Need DataTableSpec at input " + "port. Connect node and/or execute predecessor");
}
for (DataColumnSpec spec : specs[0]) {
if (spec.getType().isCompatible(StringValue.class)) {
m_hasStringCol = true;
break;
}
}
if (!m_hasStringCol) {
m_stringRadio.setEnabled(false);
} else {
m_stringRadio.setEnabled(true);
}
m_stringRadio.setSelected(settings.getBoolean(BitVectorGeneratorNodeModel.CFG_FROM_STRING, false));
m_numericRadio.setSelected(!m_stringRadio.isSelected());
String typeString = settings.getString(BitVectorGeneratorNodeModel.CFG_STRING_TYPE, BitVectorGeneratorNodeModel.STRING_TYPES.BIT.name());
BitVectorGeneratorNodeModel.STRING_TYPES type = BitVectorGeneratorNodeModel.STRING_TYPES.valueOf(typeString);
m_stringType.setSelectedItem(type);
m_useMean.setSelected(settings.getBoolean(BitVectorGeneratorNodeModel.CFG_USE_MEAN, false));
m_threshold.setValue(settings.getDouble(BitVectorGeneratorNodeModel.CFG_THRESHOLD, 1.0));
m_meanPercentage.setValue(settings.getInt(BitVectorGeneratorNodeModel.CFG_MEAN_THRESHOLD, 100));
m_replaceBox.setSelected(settings.getBoolean(BitVectorGeneratorNodeModel.CFG_REPLACE, false));
m_stringColumn.loadSettingsFrom(settings, specs);
m_includeColumns.loadSettingsFrom(settings, specs);
}
use of org.knime.core.node.NotConfigurableException in project knime-core by knime.
the class ColCombineNodeDialog method loadSettingsFrom.
/**
* {@inheritDoc}
*/
@Override
protected void loadSettingsFrom(final NodeSettingsRO settings, final DataTableSpec[] specs) throws NotConfigurableException {
DataTableSpec in = specs[0];
if (in.getNumColumns() == 0) {
throw new NotConfigurableException("No input data available");
}
List<String> defIncludes = new ArrayList<String>();
for (DataColumnSpec s : in) {
if (s.getType().isCompatible(StringValue.class)) {
defIncludes.add(s.getName());
}
}
String[] includes = settings.getStringArray(ColCombineNodeModel.CFG_COLUMNS, defIncludes.toArray(new String[defIncludes.size()]));
String delimiter = settings.getString(ColCombineNodeModel.CFG_DELIMITER_STRING, ",");
boolean isQuoting = settings.getBoolean(ColCombineNodeModel.CFG_IS_QUOTING, true);
char quote = settings.getChar(ColCombineNodeModel.CFG_QUOTE_CHAR, '"');
String replaceDelim = "";
if (!isQuoting) {
replaceDelim = settings.getString(ColCombineNodeModel.CFG_REPLACE_DELIMITER_STRING, replaceDelim);
}
String newColBase = "combined string";
String newColName = newColBase;
for (int i = 1; in.containsName(newColName); i++) {
newColName = newColBase + " #" + i;
}
newColName = settings.getString(ColCombineNodeModel.CFG_NEW_COLUMN_NAME, newColName);
m_colFilterPanel.update(in, false, includes);
m_delimTextField.setText(delimiter);
m_appendColNameField.setText(newColName);
if (isQuoting) {
m_quoteCharRadioButton.doClick();
m_quoteCharField.setValue(Character.valueOf(quote));
boolean isQuotingAlways = settings.getBoolean(ColCombineNodeModel.CFG_IS_QUOTING_ALWAYS, true);
m_quoteAlwaysChecker.setSelected(isQuotingAlways);
} else {
m_replaceDelimRadioButton.doClick();
m_replaceDelimStringField.setText(replaceDelim);
}
}
use of org.knime.core.node.NotConfigurableException in project knime-core by knime.
the class SleepNodeDialog method loadSettingsFrom.
/**
* {@inheritDoc}
*/
@Override
protected void loadSettingsFrom(final NodeSettingsRO settings, final PortObjectSpec[] specs) {
Calendar c = Calendar.getInstance();
c.set(Calendar.MILLISECOND, 0);
c.set(Calendar.HOUR_OF_DAY, settings.getInt(SleepNodeModel.CFGKEY_FORHOURS, 0));
c.set(Calendar.MINUTE, settings.getInt(SleepNodeModel.CFGKEY_FORMINUTES, 0));
c.set(Calendar.SECOND, settings.getInt(SleepNodeModel.CFGKEY_FORSECONDS, 0));
m_waitForSpinnerModel.setValue(c.getTime());
c.set(Calendar.HOUR_OF_DAY, settings.getInt(SleepNodeModel.CFGKEY_TOHOURS, 0));
c.set(Calendar.MINUTE, settings.getInt(SleepNodeModel.CFGKEY_TOMINUTES, 0));
c.set(Calendar.SECOND, settings.getInt(SleepNodeModel.CFGKEY_TOSECONDS, 0));
m_waitToSpinnerModel.setValue(c.getTime());
m_fileChooser.setSelectedFile(settings.getString(SleepNodeModel.CFGKEY_FILEPATH, ""));
try {
m_events.loadSettingsFrom(settings, specs);
m_fileRB.doClick();
} catch (NotConfigurableException e) {
// nothing
}
m_selection = settings.getInt(SleepNodeModel.CFGKEY_WAITOPTION, 0);
if (m_selection == 0) {
m_forRB.doClick();
} else if (m_selection == 1) {
m_toRB.doClick();
} else {
m_fileRB.doClick();
}
}
use of org.knime.core.node.NotConfigurableException in project knime-core by knime.
the class SettingsModelAggregationMethod method loadSettingsForDialog.
/**
* {@inheritDoc}
*/
@Override
protected void loadSettingsForDialog(final NodeSettingsRO settings, final PortObjectSpec[] specs) throws NotConfigurableException {
try {
DataTableSpec spec;
if (m_inputPortIndex < 0 || specs == null || specs.length < m_inputPortIndex || specs[m_inputPortIndex] == null) {
// we do not have a data table spec available this might be the reason if
// the dialog component is used in a node that does not aggregate an input
// data table
spec = new DataTableSpec();
} else {
spec = (DataTableSpec) specs[m_inputPortIndex];
}
final NodeSettingsRO subSettings = settings.getNodeSettings(m_configName);
final String methodId = subSettings.getString(CFG_METHOD_ID);
final AggregationOperator method = (AggregationOperator) AggregationMethods.getMethod4Id(methodId);
final boolean includeMissing = subSettings.getBoolean(CFG_INCL_MISSING, method.inclMissingCells());
// update the missing value option in the method based on the settings
method.getOperatorColumnSettings().setInclMissing(includeMissing);
if (method.hasOptionalSettings()) {
final NodeSettingsRO methodSettings = subSettings.getNodeSettings(CFG_METHOD_SETTINGS);
method.loadSettingsFrom(methodSettings, spec);
}
// no default value, throw an exception instead
setValues(method, subSettings.getString(CFG_VALUE_SEPARATOR), subSettings.getInt(CFG_MAX_UNIQUE_VALUES));
} catch (final Exception iae) {
throw new NotConfigurableException(iae.getMessage());
}
}
Aggregations