use of org.knime.core.node.NotConfigurableException in project knime-core by knime.
the class ReadPNGFromURLConfig method loadInDialog.
/**
* Load config in dialog.
* @param settings To load from
* @param in Current input spec
* @throws NotConfigurableException If no configuration possible, e.g.
*/
void loadInDialog(final NodeSettingsRO settings, final DataTableSpec in) throws NotConfigurableException {
m_urlColName = settings.getString("urlColumn", null);
DataColumnSpec col = in.getColumnSpec(m_urlColName);
if (col == null || !col.getType().isCompatible(StringValue.class)) {
try {
guessDefaults(in);
} catch (InvalidSettingsException e) {
throw new NotConfigurableException("No valid input column available");
}
}
// guessDefaults inits default values, so we can use them as fallback
m_failOnInvalid = settings.getBoolean("failIfInvalid", m_failOnInvalid);
m_newColumnName = settings.getString("newColumnName", m_newColumnName);
}
use of org.knime.core.node.NotConfigurableException in project knime-core by knime.
the class DBGroupByNodeDialog method loadSettingsFrom.
/**
* {@inheritDoc}
*/
@Override
protected void loadSettingsFrom(final NodeSettingsRO settings, final PortObjectSpec[] specs) throws NotConfigurableException {
if (specs == null || specs.length < 1 || specs[0] == null) {
throw new NotConfigurableException("No input spec available");
}
final DatabasePortObjectSpec dbspec = (DatabasePortObjectSpec) specs[0];
final DataTableSpec spec = dbspec.getDataTableSpec();
try {
m_columnNamePolicy.loadSettingsFrom(settings);
} catch (final InvalidSettingsException e) {
throw new NotConfigurableException(e.getMessage());
}
m_aggregationPanel.loadSettingsFrom(settings, dbspec, spec);
m_groupCol.loadSettingsFrom(settings, new DataTableSpec[] { spec });
columnsChanged();
}
use of org.knime.core.node.NotConfigurableException in project knime-core by knime.
the class DBGroupByAggregationPanel method loadSettingsFrom.
/**
* @param settings The settings to load from
* @param dbspec {@link DatabasePortObjectSpec} with the database information e.g. the supported
* {@link DBAggregationFunction}s
* @param spec The spec containing the available columns
* @throws NotConfigurableException if the connection settings cannot retrieved from the
* {@link DatabasePortObjectSpec}.
*/
void loadSettingsFrom(final NodeSettingsRO settings, final DatabasePortObjectSpec dbspec, final DataTableSpec spec) throws NotConfigurableException {
m_dbspec = dbspec;
try {
final DatabaseUtility utility = m_dbspec.getConnectionSettings(null).getUtility();
final Collection<DBAggregationFunction> aggregationFunctions = utility.getAggregationFunctions();
setSupportedAggregationFunctions(aggregationFunctions);
} catch (final InvalidSettingsException e) {
throw new NotConfigurableException(e.getMessage());
}
m_spec = spec;
m_aggregatedColumnsModel.setRowCount(0);
String[] columns = settings.getStringArray(DBGroupByNodeModel.CFG_AGGREGATED_COLUMNS, new String[0]);
String[] methods = settings.getStringArray(DBGroupByNodeModel.CFG_AGGREGATION_METHODS, new String[0]);
for (int i = 0; i < columns.length; i++) {
m_aggregatedColumnsModel.addRow(new Object[] { columns[i], methods[i] });
}
refreshAvailableColumns();
}
use of org.knime.core.node.NotConfigurableException in project knime-core by knime.
the class LinRegLearnerNodeDialogPane method loadSettingsFrom.
/**
* {@inheritDoc}
*/
@Override
protected void loadSettingsFrom(final NodeSettingsRO settings, final PortObjectSpec[] specs) throws NotConfigurableException {
// must check if there are at least two numeric columns
int numColsCount = 0;
DataTableSpec dts = (DataTableSpec) specs[0];
for (DataColumnSpec c : dts) {
if (c.getType().isCompatible(DoubleValue.class)) {
numColsCount++;
if (numColsCount >= 2) {
break;
}
}
}
if (numColsCount < 2) {
throw new NotConfigurableException("Too few numeric columns " + "(need at least 2): " + numColsCount);
}
boolean includeAll = settings.getBoolean(LinRegLearnerNodeModel.CFG_VARIATES_USE_ALL, false);
String[] includes = settings.getStringArray(LinRegLearnerNodeModel.CFG_VARIATES, new String[0]);
String target = settings.getString(LinRegLearnerNodeModel.CFG_TARGET, null);
boolean isCalcError = settings.getBoolean(LinRegLearnerNodeModel.CFG_CALC_ERROR, true);
int first = settings.getInt(LinRegLearnerNodeModel.CFG_FROMROW, 1);
int count = settings.getInt(LinRegLearnerNodeModel.CFG_ROWCNT, 10000);
m_selectionPanel.update(dts, target);
m_filterPanel.setKeepAllSelected(includeAll);
// if includes list is empty, put everything into the include list
m_filterPanel.update(dts, includes.length == 0, includes);
// must hide the target from filter panel
// updating m_filterPanel first does not work as the first
// element in the spec will always be in the exclude list.
String selected = m_selectionPanel.getSelectedColumn();
if (selected != null) {
DataColumnSpec colSpec = dts.getColumnSpec(selected);
m_filterPanel.hideColumns(colSpec);
}
m_isCalcErrorChecker.setSelected(isCalcError);
m_firstSpinner.setValue(first);
m_countSpinner.setValue(count);
}
use of org.knime.core.node.NotConfigurableException in project knime-core by knime.
the class CategoryToNumberNodeDialogPane method loadSettingsFrom.
/**
* {@inheritDoc}
*/
@Override
protected void loadSettingsFrom(final NodeSettingsRO settings, final PortObjectSpec[] specs) throws NotConfigurableException {
m_settings.loadSettingsForDialog(settings);
String[] included = null != m_settings.getIncludedColumns() ? m_settings.getIncludedColumns() : new String[0];
m_includedColumns.update((DataTableSpec) specs[0], false, included);
if (m_includedColumns.getExcludedColumnSet().size() + m_includedColumns.getIncludedColumnSet().size() == 0) {
throw new NotConfigurableException("No column in " + "the input compatible to \"StringValue\".");
}
m_includedColumns.setKeepAllSelected(m_settings.getIncludeAll());
m_appendColums.setSelected(m_settings.getAppendColumns());
m_columnSuffix.setText(m_settings.getColumnSuffix());
m_columnSuffix.setEnabled(m_appendColums.isSelected());
m_startIndex.setValue(m_settings.getStartIndex());
m_increment.setValue(m_settings.getIncrement());
m_maxCategories.setValue(m_settings.getMaxCategories());
if (!m_settings.getDefaultValue().isMissing()) {
IntValue value = (IntValue) m_settings.getDefaultValue();
m_defaultValue.setText(Integer.toString(value.getIntValue()));
} else {
m_defaultValue.setText("");
}
if (!m_settings.getMapMissingTo().isMissing()) {
IntValue value = (IntValue) m_settings.getMapMissingTo();
m_mapMissingTo.setText(Integer.toString(value.getIntValue()));
} else {
m_mapMissingTo.setText("");
}
}
Aggregations