use of org.knime.base.node.preproc.pmml.missingval.MVSettings in project knime-core by knime.
the class MissingValueHandlerNodeDialog method saveSettingsTo.
/**
* {@inheritDoc}
*/
@Override
protected void saveSettingsTo(final NodeSettingsWO settings) throws InvalidSettingsException {
MVSettings mvSettings = createEmptySettings();
for (DataType type : m_types.keySet()) {
MissingValueHandlerFactorySelectionPanel panel = m_types.get(type);
mvSettings.setSettingsForDataType(type, panel.getSettings());
}
for (Component panel : m_individualsPanel.getComponents()) {
mvSettings.getColumnSettings().add(((ColumnHandlingFactorySelectionPanel) panel).getUpdatedSettings());
}
mvSettings.saveToSettings(settings);
}
use of org.knime.base.node.preproc.pmml.missingval.MVSettings in project knime-core by knime.
the class MissingValueHandlerNodeDialog method loadSettingsFrom.
/**
* {@inheritDoc}
*/
@Override
protected void loadSettingsFrom(final NodeSettingsRO settings, final PortObjectSpec[] specs) throws NotConfigurableException {
MVSettings mvSettings = createEmptySettings();
m_specs = specs;
DataTableSpec spec = (DataTableSpec) specs[0];
StringBuffer warning = new StringBuffer();
if (spec.getNumColumns() == 0) {
throw new NotConfigurableException("There are no columns for missing value replacement available.");
}
m_searchableListModifier = m_searchableListPanel.update(spec);
try {
mvSettings.loadSettings(settings, true);
} catch (Exception e) {
if (warning.length() > 0) {
warning.append("\n");
}
warning.append("The settings are malformed and had to be reset");
mvSettings = new MVSettings(spec);
}
m_warnings.setText(warning.toString());
m_types = new LinkedHashMap<DataType, MissingValueHandlerFactorySelectionPanel>();
for (int i = 0; i < spec.getNumColumns(); i++) {
m_types.put(spec.getColumnSpec(i).getType(), null);
}
m_individualsPanel.removeAll();
for (MVColumnSettings colSetting : mvSettings.getColumnSettings()) {
ColumnHandlingFactorySelectionPanel p = new ColumnHandlingFactorySelectionPanel(colSetting, specs, 0, getHandlerFactoryManager());
addToIndividualPanel(p);
}
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridy = 0;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.weightx = 1.0;
m_typeSettingsPanel.removeAll();
for (DataType type : m_types.keySet()) {
gbc.gridx = 0;
gbc.ipadx = 10;
JLabel l = new JLabel(type.toPrettyString());
m_typeSettingsPanel.add(l, gbc);
gbc.gridx = 1;
gbc.ipadx = 0;
MVIndividualSettings s = mvSettings.getSettingsForDataType(type);
// but check anyways and fall back to do nothing factory
if (s == null) {
s = new MVIndividualSettings(getHandlerFactoryManager());
}
MissingValueHandlerFactorySelectionPanel p = new MissingValueHandlerFactorySelectionPanel(type, s, getHandlerFactoryManager(), specs);
p.setBorder(BorderFactory.createBevelBorder(1));
p.addPropertyChangeListener(new FactoryChangedListener());
m_typeSettingsPanel.add(p, gbc);
m_types.put(type, p);
gbc.gridy++;
}
m_scrollPane.setPreferredSize(new Dimension(m_defaultsPanel.getPreferredSize().width + 20, 500));
updatePMMLLabelColor();
}
Aggregations