use of org.knime.core.node.NotConfigurableException in project knime-core by knime.
the class EqualSizeSamplingConfiguration method loadConfigurationInDialog.
void loadConfigurationInDialog(final NodeSettingsRO settings, final DataTableSpec spec) throws NotConfigurableException {
String defClassColumn = null;
for (DataColumnSpec c : spec) {
if (c.getType().isCompatible(NominalValue.class)) {
defClassColumn = c.getName();
}
}
if (defClassColumn == null) {
throw new NotConfigurableException("No nominal attribute column in input");
}
m_classColumn = settings.getString("classColumn", defClassColumn);
String seedS = settings.getString("seed", null);
if (seedS == null) {
m_seed = null;
} else {
try {
m_seed = Long.parseLong(seedS);
} catch (NumberFormatException nfe) {
m_seed = null;
}
}
String sMethod = settings.getString("samplingMethod", SamplingMethod.Exact.name());
try {
m_samplingMethod = SamplingMethod.valueOf(sMethod);
} catch (Exception e) {
m_samplingMethod = SamplingMethod.Exact;
}
}
use of org.knime.core.node.NotConfigurableException in project knime-core by knime.
the class DataColumnSpecFilterNodeDialogPane method loadSettingsFrom.
/**
* Calls the update method of the underlying filter panel.
* @param settings the node settings to read from
* @param specs the input specs
* @throws NotConfigurableException if no columns are available for
* filtering
*/
@Override
protected void loadSettingsFrom(final NodeSettingsRO settings, final DataTableSpec[] specs) throws NotConfigurableException {
final DataTableSpec spec = specs[0];
if (spec == null || spec.getNumColumns() == 0) {
throw new NotConfigurableException("No columns available for " + "selection.");
}
DataColumnSpecFilterConfiguration config = DataColumnSpecFilterNodeModel.createDCSFilterConfiguration();
config.loadConfigurationInDialog(settings, specs[0]);
m_filterPanel.loadConfiguration(config, specs[0]);
}
use of org.knime.core.node.NotConfigurableException in project knime-core by knime.
the class EqualSizeSamplingNodeModel method configure.
/**
* {@inheritDoc}
*/
@Override
protected DataTableSpec[] configure(final DataTableSpec[] inSpecs) throws InvalidSettingsException {
if (m_configuration == null) {
EqualSizeSamplingConfiguration c = new EqualSizeSamplingConfiguration();
try {
c.loadConfigurationInDialog(new NodeSettings("empty"), inSpecs[0]);
} catch (NotConfigurableException e) {
throw new InvalidSettingsException("Can't auto-guess settings: " + "No nominal column in input");
}
m_configuration = c;
setWarningMessage("Auto-guessing \"" + c.getClassColumn() + "\" as selected nominal class column");
}
String classColumn = m_configuration.getClassColumn();
DataColumnSpec col = inSpecs[0].getColumnSpec(classColumn);
if (col == null) {
throw new InvalidSettingsException("No column \"" + classColumn + "\" in input data");
}
if (!col.getType().isCompatible(NominalValue.class)) {
throw new InvalidSettingsException("Class column \"" + classColumn + "\" is not a nominal attribute");
}
return new DataTableSpec[] { inSpecs[0] };
}
use of org.knime.core.node.NotConfigurableException in project knime-core by knime.
the class CorrelationFilterNodeDialogPane method loadSettingsFrom.
/**
* {@inheritDoc}
*/
@Override
protected void loadSettingsFrom(final NodeSettingsRO settings, final PortObjectSpec[] specs) throws NotConfigurableException {
m_model = (PMCCPortObjectAndSpec) specs[0];
DataTableSpec spec = getTableSpec(specs);
if (m_model == null || spec == null) {
throw new NotConfigurableException("No input available");
}
// check if all columns in the model are also present in the spec
HashSet<String> allColsInModel = new HashSet<>(Arrays.asList(m_model.getColNames()));
double d = settings.getDouble(CorrelationFilterNodeModel.CFG_THRESHOLD, 1.0);
m_textField.setValue(d);
DefaultListModel m = (DefaultListModel) m_list.getModel();
m.removeAllElements();
int totalCount = 0;
for (DataColumnSpec s : spec) {
if (s.getType().isCompatible(NominalValue.class) || s.getType().isCompatible(DoubleValue.class)) {
if (allColsInModel.remove(s.getName())) {
totalCount++;
m.addElement(s);
}
}
}
if (!allColsInModel.isEmpty()) {
throw new NotConfigurableException("Some columns in the model are " + "not contained in the input table or incompatible: " + allColsInModel.iterator().next());
}
m_lastCommittedValue = -1.0;
if (m_model.hasData()) {
m_errorLabel.setText(" ");
m_calcButton.setEnabled(true);
} else {
m_errorLabel.setText("No correlation in input available");
m_calcButton.setEnabled(false);
}
setLabels(-1, totalCount);
}
use of org.knime.core.node.NotConfigurableException in project knime-core by knime.
the class DBPivotNodeDialog 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 connection found.");
}
final DatabasePortObjectSpec dbspec = (DatabasePortObjectSpec) specs[0];
final DataTableSpec spec = dbspec.getDataTableSpec();
try {
final DatabaseQueryConnectionSettings connectionSettings = dbspec.getConnectionSettings(null);
m_columnNamePolicy.loadSettingsFrom(settings);
final String dbIdentifier = connectionSettings.getDatabaseIdentifier();
m_aggregationPanel.loadSettingsFrom(settings, dbIdentifier, spec);
final DBAggregationFunctionProvider functionProvider = new DBAggregationFunctionProvider(connectionSettings.getUtility());
m_descriptionTab.removeAll();
final GridBagConstraints c = new GridBagConstraints();
c.anchor = GridBagConstraints.CENTER;
c.fill = GridBagConstraints.BOTH;
c.weightx = 1;
c.weighty = 1;
m_descriptionTab.add(functionProvider.getDescriptionPane(), c);
} catch (final InvalidSettingsException e) {
throw new NotConfigurableException(e.getMessage());
}
m_groupCol.loadSettingsFrom(settings, new DataTableSpec[] { spec });
m_pivotCol.loadSettingsFrom(settings, new DataTableSpec[] { spec });
columnsChanged();
}
Aggregations