use of org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration in project knime-core by knime.
the class OptionsPanel method newTargetSelected.
/**
* @param item
*/
private void newTargetSelected(final DataColumnSpec item) {
String col = m_targetColumnBox.getSelectedColumn();
if (m_lastTableSpec == null || col == null) {
return;
}
DataTableSpec filtered = getCurrentAttributeSpec();
// Set<String> prevIn = m_includeColumnsFilterPanel.getIncludedColumnSet();
// m_includeColumnsFilterPanel.update(filtered, false, prevIn);
Set<String> prevIn = m_includeColumnsFilterPanel2.getIncludedNamesAsSet();
String[] prevInArray = prevIn.toArray(new String[prevIn.size()]);
Set<String> prevEx = m_includeColumnsFilterPanel2.getExcludedNamesAsSet();
String[] prevExArray = prevEx.toArray(new String[prevEx.size()]);
DataColumnSpecFilterConfiguration conf = TreeEnsembleLearnerConfiguration.createColSpecFilterConfig();
m_includeColumnsFilterPanel2.saveConfiguration(conf);
EnforceOption prevEnforceOption = conf.isEnforceInclusion() ? EnforceOption.EnforceInclusion : EnforceOption.EnforceExclusion;
String[] prevExWithFormerTarget = Arrays.copyOf(prevExArray, prevEx.size() + 1);
prevExWithFormerTarget[prevEx.size()] = getMissingColSpecName(filtered, prevInArray, prevExArray);
conf.loadDefaults(prevInArray, prevExWithFormerTarget, prevEnforceOption);
m_includeColumnsFilterPanel2.loadConfiguration(conf, filtered);
ChangeEvent e = new ChangeEvent(this);
for (ChangeListener l : m_changeListenerList) {
l.stateChanged(e);
}
}
use of org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration in project knime-core by knime.
the class OptionsPanel method newTargetSelected.
/**
* @param item
*/
private void newTargetSelected(final DataColumnSpec item) {
String col = m_targetColumnBox.getSelectedColumn();
if (m_lastTableSpec == null || col == null) {
return;
}
DataTableSpec filtered = getCurrentAttributeSpec();
// Set<String> prevIn = m_includeColumnsFilterPanel.getIncludedColumnSet();
// m_includeColumnsFilterPanel.update(filtered, false, prevIn);
Set<String> prevIn = m_includeColumnsFilterPanel2.getIncludedNamesAsSet();
String[] prevInArray = prevIn.toArray(new String[prevIn.size()]);
Set<String> prevEx = m_includeColumnsFilterPanel2.getExcludedNamesAsSet();
String[] prevExArray = prevEx.toArray(new String[prevEx.size()]);
DataColumnSpecFilterConfiguration conf = TreeEnsembleLearnerConfiguration.createColSpecFilterConfig();
m_includeColumnsFilterPanel2.saveConfiguration(conf);
EnforceOption prevEnforceOption = conf.isEnforceInclusion() ? EnforceOption.EnforceInclusion : EnforceOption.EnforceExclusion;
String[] prevExWithFormerTarget = Arrays.copyOf(prevExArray, prevEx.size() + 1);
prevExWithFormerTarget[prevEx.size()] = getMissingColSpecName(filtered, prevInArray, prevExArray);
conf.loadDefaults(prevInArray, prevExWithFormerTarget, prevEnforceOption);
m_includeColumnsFilterPanel2.loadConfiguration(conf, filtered);
ChangeEvent e = new ChangeEvent(this);
for (ChangeListener l : m_changeListenerList) {
l.stateChanged(e);
}
}
use of org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration in project knime-core by knime.
the class LogRegLearnerNodeDialogPane method saveSettingsTo.
/**
* {@inheritDoc}
*/
@Override
protected void saveSettingsTo(final NodeSettingsWO s) throws InvalidSettingsException {
final LogRegLearnerSettings settings = new LogRegLearnerSettings();
final DataColumnSpecFilterConfiguration config = LogRegLearnerNodeModel.createDCSFilterConfiguration();
m_filterPanel.saveConfiguration(config);
// config.saveConfiguration(s);
settings.setIncludedColumns(config);
settings.setTargetColumn(m_selectionPanel.getSelectedColumn());
settings.setTargetReferenceCategory((DataCell) m_targetReferenceCategory.getSelectedItem());
settings.setSortTargetCategories(!m_notSortTarget.isSelected());
settings.setSortIncludesCategories(!m_notSortIncludes.isSelected());
settings.saveSettings(s);
}
use of org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration in project knime-core by knime.
the class OptionsPanel method newTargetSelected.
/**
* @param item
*/
private void newTargetSelected(final DataColumnSpec item) {
String col = m_targetColumnBox.getSelectedColumn();
if (m_lastTableSpec == null || col == null) {
return;
}
DataTableSpec filtered = getCurrentAttributeSpec();
// Set<String> prevIn = m_includeColumnsFilterPanel.getIncludedColumnSet();
// m_includeColumnsFilterPanel.update(filtered, false, prevIn);
Set<String> prevIn = m_includeColumnsFilterPanel2.getIncludedNamesAsSet();
String[] prevInArray = prevIn.toArray(new String[prevIn.size()]);
Set<String> prevEx = m_includeColumnsFilterPanel2.getExcludedNamesAsSet();
String[] prevExArray = prevEx.toArray(new String[prevEx.size()]);
DataColumnSpecFilterConfiguration conf = TreeEnsembleLearnerConfiguration.createColSpecFilterConfig();
m_includeColumnsFilterPanel2.saveConfiguration(conf);
EnforceOption prevEnforceOption = conf.isEnforceInclusion() ? EnforceOption.EnforceInclusion : EnforceOption.EnforceExclusion;
String[] prevExWithFormerTarget = Arrays.copyOf(prevExArray, prevEx.size() + 1);
prevExWithFormerTarget[prevEx.size()] = getMissingColSpecName(filtered, prevInArray, prevExArray);
conf.loadDefaults(prevInArray, prevExWithFormerTarget, prevEnforceOption);
m_includeColumnsFilterPanel2.loadConfiguration(conf, filtered);
ChangeEvent e = new ChangeEvent(this);
for (ChangeListener l : m_changeListenerList) {
l.stateChanged(e);
}
}
use of org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration in project knime-core by knime.
the class SettingsModelColumnFilter2 method loadSettingsForDialog.
/**
* {@inheritDoc}
*/
@Override
protected void loadSettingsForDialog(final NodeSettingsRO settings, final PortObjectSpec[] specs) throws NotConfigurableException {
// must be set by associated the component
assert m_inputPortIndex >= 0;
if (m_inputPortIndex >= specs.length) {
String msg = "Specified port index is out of bounds";
NodeLogger.getLogger(SettingsModelColumnFilter2.class).coding(msg);
throw new NotConfigurableException(msg);
}
DataColumnSpecFilterConfiguration clone = m_filterConfiguration.clone();
m_filterConfiguration.loadConfigurationInDialog(settings, (DataTableSpec) specs[m_inputPortIndex]);
if (!clone.equals(m_filterConfiguration)) {
notifyChangeListeners();
}
}
Aggregations