use of org.knime.core.node.NotConfigurableException in project knime-core by knime.
the class RegressionPredictorNodeDialogPane method loadSettingsFrom.
/**
* {@inheritDoc}
*/
@Override
protected void loadSettingsFrom(final NodeSettingsRO settings, final PortObjectSpec[] specs) throws NotConfigurableException {
RegressionPredictorSettings s = new RegressionPredictorSettings(m_showProbOptions);
s.loadSettingsForDialog(settings);
m_hasCustomPredictionName.setSelected(s.getHasCustomPredictionName());
PMMLPortObjectSpec portSpec = (PMMLPortObjectSpec) specs[0];
DataTableSpec tableSpec = (DataTableSpec) specs[1];
// check if the model has the correct target type
try {
RegressionPredictorNodeModel.checkModelTargetType(portSpec, m_showProbOptions);
} catch (InvalidSettingsException e1) {
throw new NotConfigurableException(e1.getMessage());
}
if (s.getCustomPredictionName() != null) {
m_customPredictionName.setText(s.getCustomPredictionName());
} else {
try {
DataColumnSpec[] outSpec = RegressionPredictorCellFactory.createColumnSpec(portSpec, tableSpec, new RegressionPredictorSettings(m_showProbOptions));
m_customPredictionName.setText(outSpec[outSpec.length - 1].getName());
} catch (InvalidSettingsException e) {
// Open dialog and give a chance define settings
}
}
if (m_showProbOptions) {
m_includeProbs.setSelected(s.getIncludeProbabilities());
m_probColumnSuffix.setText(s.getPropColumnSuffix());
}
updateEnableState();
}
use of org.knime.core.node.NotConfigurableException in project knime-core by knime.
the class SotaHierarchicalFuzzySettings method loadSettingsFrom.
/**
* Method loadSettingsFrom.
*
* @param settings the NodeSettings object of the containing NodeDialogPane
* @param specs the DataTableSpec[] of the containing NodeDialogPane
*
* @throws NotConfigurableException If components could not load the
* settings from the given settings instance.
*/
public void loadSettingsFrom(final NodeSettingsRO settings, final DataTableSpec[] specs) throws NotConfigurableException {
assert (settings != null && specs != null);
try {
m_jchbUseHierarchicalFuzzyData.setSelected(settings.getBoolean(SotaConfigKeys.CFGKEY_HIERARCHICAL_FUZZY_DATA));
} catch (InvalidSettingsException e7) {
m_logger.debug("Invalid Settings", e7);
}
boolean containsPotentialFuzzyLevelColumn = false;
for (DataColumnSpec cs : specs[0]) {
if (cs.getType().isCompatible(IntValue.class)) {
containsPotentialFuzzyLevelColumn = true;
break;
}
}
if (containsPotentialFuzzyLevelColumn) {
try {
m_columnSelectionPanel.update(specs[SotaNodeModel.INPORT], settings.getString(SotaConfigKeys.CFGKEY_HIERARCHICAL_FUZZY_LEVEL));
} catch (InvalidSettingsException e) {
m_logger.debug("Invalid Settings", e);
} catch (NotConfigurableException e) {
m_logger.debug("No IntVal in DataTableSpec");
}
m_jchbUseHierarchicalFuzzyData.setEnabled(true);
m_columnSelectionPanel.setVisible(true);
} else {
m_jchbUseHierarchicalFuzzyData.setSelected(false);
m_jchbUseHierarchicalFuzzyData.setEnabled(false);
m_columnSelectionPanel.setVisible(false);
}
enableComboBox();
boolean containsPotentialClassColumn = false;
for (DataColumnSpec cs : specs[0]) {
if (cs.getType().isCompatible(StringValue.class)) {
containsPotentialClassColumn = true;
break;
}
}
if (containsPotentialClassColumn) {
m_classColumn.loadSettingsFrom(settings, specs);
m_useOutData.loadSettingsFrom(settings, specs);
m_classColumnBorderPanel.setVisible(true);
} else {
m_useOutDataModel.setBooleanValue(false);
m_useOutDataModel.setEnabled(false);
m_classColumnModel.setEnabled(false);
m_classColumnBorderPanel.setVisible(false);
}
}
use of org.knime.core.node.NotConfigurableException in project knime-core by knime.
the class SotaNodeDialog method loadSettingsFrom.
/**
* {@inheritDoc}
*/
@Override
protected void loadSettingsFrom(final NodeSettingsRO settings, final DataTableSpec[] specs) throws NotConfigurableException {
assert (settings != null && specs != null);
int numberCells = 0;
int fuzzyCells = 0;
for (int i = 0; i < specs[SotaNodeModel.INPORT].getNumColumns(); i++) {
DataType type = specs[SotaNodeModel.INPORT].getColumnSpec(i).getType();
if (SotaUtil.isNumberType(type)) {
numberCells++;
} else if (SotaUtil.isFuzzyIntervalType(type)) {
fuzzyCells++;
}
}
StringBuffer buffer = new StringBuffer();
if (numberCells <= 0 && fuzzyCells <= 0) {
buffer.append("No FuzzyIntervalCells or NumberCells found !" + " Is the node fully connected ?");
}
// if buffer throw exception
if (buffer.length() > 0) {
throw new NotConfigurableException(buffer.toString());
}
m_settings.loadSettingsFrom(settings, specs);
m_hierarchicalFuzzyDataSettings.loadSettingsFrom(settings, specs);
}
use of org.knime.core.node.NotConfigurableException in project knime-core by knime.
the class PolyRegLineScatterPlotter method modelChanged.
/**
* This method must be called if the model has changed. It updates the
* plotter to show the new model's values.
*/
public void modelChanged() {
m_viewData = m_model.getViewData();
DataTable data = m_viewData.getRowContainer();
if (data != null) {
final DataTableSpec origSpec = data.getDataTableSpec();
final MyProperties props = (MyProperties) getProperties();
DataColumnSpec[] colSpecs = new DataColumnSpec[origSpec.getNumColumns() - 1];
int i = 0;
for (DataColumnSpec cs : origSpec) {
if (!m_viewData.targetColumn.equals(cs.getName())) {
colSpecs[i++] = cs;
} else {
m_yColumnSpec = cs;
getYAxis().setCoordinate(Coordinate.createCoordinate(cs));
}
}
m_xColumnSpec = colSpecs[0];
getXAxis().setCoordinate(Coordinate.createCoordinate(colSpecs[0]));
m_filteredSpec = new DataTableSpec(colSpecs);
try {
props.m_xColumn.update(m_filteredSpec, colSpecs[0].getName());
} catch (NotConfigurableException ex) {
// cannot happen
assert false : ex.getMessage();
}
reset();
updatePaintModel();
}
}
use of org.knime.core.node.NotConfigurableException in project knime-core by knime.
the class ColCombine2NodeDialog method loadSettingsFrom.
/**
* {@inheritDoc}
*/
@Override
protected void loadSettingsFrom(final NodeSettingsRO settings, final DataTableSpec[] specs) throws NotConfigurableException {
m_spec = specs[0];
if (m_spec.getNumColumns() == 0) {
throw new NotConfigurableException("No input data available");
}
DataColumnSpecFilterConfiguration conf = ColCombine2NodeModel.createDCSFilterConfiguration();
conf.loadConfigurationInDialog(settings, m_spec);
m_filterPanel.loadConfiguration(conf, m_spec);
String delimiter = settings.getString(ColCombine2NodeModel.CFG_DELIMITER_STRING, ",");
boolean isQuoting = settings.getBoolean(ColCombine2NodeModel.CFG_IS_QUOTING, true);
char quote = settings.getChar(ColCombine2NodeModel.CFG_QUOTE_CHAR, '"');
String replaceDelim = "";
if (!isQuoting) {
replaceDelim = settings.getString(ColCombine2NodeModel.CFG_REPLACE_DELIMITER_STRING, replaceDelim);
}
String newColBase = "combined string";
String newColName = newColBase;
newColName = DataTableSpec.getUniqueColumnName(m_spec, newColName);
newColName = settings.getString(ColCombine2NodeModel.CFG_NEW_COLUMN_NAME, newColName);
m_delimTextField.setText(delimiter);
m_appendColNameField.setText(newColName);
if (isQuoting) {
m_quoteCharRadioButton.doClick();
m_quoteCharField.setValue(Character.valueOf(quote));
boolean isQuotingAlways = settings.getBoolean(ColCombine2NodeModel.CFG_IS_QUOTING_ALWAYS, true);
m_quoteAlwaysChecker.setSelected(isQuotingAlways);
} else {
m_replaceDelimRadioButton.doClick();
m_replaceDelimStringField.setText(replaceDelim);
}
}
Aggregations