use of org.knime.core.node.NotConfigurableException in project knime-core by knime.
the class FilterColumnNodeDialog method loadSettingsFrom.
/**
* Calls the update method of the underlying filter panel using the input
* data table spec from this {@link FilterColumnNodeModel}.
*
* @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 {
assert (settings != null && specs.length == 1);
if (specs[FilterColumnNodeModel.INPORT] == null || specs[FilterColumnNodeModel.INPORT].getNumColumns() == 0) {
throw new NotConfigurableException("No columns available for " + "selection.");
}
String[] columns = settings.getStringArray(FilterColumnNodeModel.KEY, new String[0]);
HashSet<String> list = new HashSet<String>();
for (int i = 0; i < columns.length; i++) {
if (specs[FilterColumnNodeModel.INPORT].containsName(columns[i])) {
list.add(columns[i]);
}
}
String selOptionS = settings.getString(FilterColumnNodeModel.CFG_KEY_SELECTIONOPTION, SelectionOption.EnforceExclusion.toString());
SelectionOption selectionOption = SelectionOption.parse(selOptionS, SelectionOption.EnforceExclusion);
// set exclusion list on the panel
FilterColumnPanel p = (FilterColumnPanel) getTab(TAB);
p.update(specs[FilterColumnNodeModel.INPORT], selectionOption, list);
}
use of org.knime.core.node.NotConfigurableException in project knime-core by knime.
the class PMCCFilterNodeDialogPane method loadSettingsFrom.
/**
* {@inheritDoc}
*/
@Override
protected void loadSettingsFrom(final NodeSettingsRO settings, final PortObjectSpec[] specs) throws NotConfigurableException {
m_model = (PMCCPortObjectAndSpec) specs[0];
DataTableSpec spec = (DataTableSpec) specs[1];
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<String>(Arrays.asList(m_model.getColNames()));
double d = settings.getDouble(PMCCFilterNodeModel.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 HiliteScorerNodeDialog method loadSettingsFrom.
// ScorerNodeDialog(NodeModel)
/**
* Fills the two combo boxes with all column names retrieved from the input
* table spec. The second and last column will be selected by default unless
* the settings object contains others.
*
* {@inheritDoc}
*/
@Override
protected void loadSettingsFrom(final NodeSettingsRO settings, final DataTableSpec[] specs) throws NotConfigurableException {
assert (settings != null && specs != null);
m_firstColumns.removeAllItems();
m_secondColumns.removeAllItems();
DataTableSpec spec = specs[HiliteScorerNodeModel.INPORT];
if ((spec == null) || (spec.getNumColumns() < 2)) {
throw new NotConfigurableException("Scorer needs an input table " + "with at least two columns");
}
int numCols = spec.getNumColumns();
for (int i = 0; i < numCols; i++) {
DataColumnSpec c = spec.getColumnSpec(i);
m_firstColumns.addItem(c);
m_secondColumns.addItem(c);
}
// if at least two columns available
DataColumnSpec col2 = (numCols > 0) ? spec.getColumnSpec(numCols - 1) : null;
DataColumnSpec col1 = (numCols > 1) ? spec.getColumnSpec(numCols - 2) : col2;
col1 = spec.getColumnSpec(settings.getString(HiliteScorerNodeModel.FIRST_COMP_ID, col1.getName()));
col2 = spec.getColumnSpec(settings.getString(HiliteScorerNodeModel.SECOND_COMP_ID, col2.getName()));
m_firstColumns.setSelectedItem(col1);
m_secondColumns.setSelectedItem(col2);
}
use of org.knime.core.node.NotConfigurableException in project knime-core by knime.
the class DBJoinerNodeDialog method loadSettingsFrom.
/**
* {@inheritDoc}
*/
@Override
protected void loadSettingsFrom(final NodeSettingsRO settings, final PortObjectSpec[] specs) throws NotConfigurableException {
if (specs == null || specs.length < 2 || specs[0] == null || specs[1] == null) {
throw new NotConfigurableException("No input specification available.");
}
DataTableSpec tableSpec1 = ((DatabasePortObjectSpec) specs[0]).getDataTableSpec();
DataTableSpec tableSpec2 = ((DatabasePortObjectSpec) specs[1]).getDataTableSpec();
DBJoinerSettings joinerSettings = new DBJoinerSettings();
joinerSettings.loadSettingsInDialog(settings);
m_joinMode.setSelectedItem(joinerSettings.getJoinMode());
m_matchAllButton.setSelected(joinerSettings.getAndComposition());
m_matchAnyButton.setSelected(!joinerSettings.getAndComposition());
m_columnPairs.updateData(new DataTableSpec[] { tableSpec1, tableSpec2 }, joinerSettings.getLeftJoinOnColumns(), joinerSettings.getRightJoinOnColumns());
m_leftFilterPanel.update(tableSpec1, false, joinerSettings.getLeftColumns());
m_rightFilterPanel.update(tableSpec2, false, joinerSettings.getRightColumns());
m_leftFilterPanel.setKeepAllSelected(joinerSettings.getAllLeftColumns());
m_rightFilterPanel.setKeepAllSelected(joinerSettings.getAllRightColumns());
m_removeLeftJoinCols.setSelected(joinerSettings.getFilterLeftJoinOnColumns());
m_removeRightJoinCols.setSelected(joinerSettings.getFilterRightJoinOnColumns());
m_suffix.setText(joinerSettings.getCustomSuffix());
m_filterDuplicates.setSelected(joinerSettings.getDuplicateHandling().equals(DuplicateHandling.Filter));
m_dontExecute.setSelected(joinerSettings.getDuplicateHandling().equals(DuplicateHandling.DontExecute));
m_appendSuffixAutomatic.setSelected(joinerSettings.getDuplicateHandling().equals(DuplicateHandling.AppendSuffixAutomatic));
m_appendSuffix.setSelected(joinerSettings.getDuplicateHandling().equals(DuplicateHandling.AppendSuffix));
m_suffix.setEnabled(joinerSettings.getDuplicateHandling().equals(DuplicateHandling.AppendSuffix));
}
use of org.knime.core.node.NotConfigurableException in project knime-core by knime.
the class DBGroupByNodeDialog2 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);
m_patternPanel.loadSettingsFrom(settings, dbIdentifier, spec);
m_typePanel.loadSettingsFrom(settings, dbIdentifier, spec);
m_addCountStar.loadSettingsFrom(settings);
m_countStarColName.loadSettingsFrom(settings);
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 });
columnsChanged();
}
Aggregations