use of org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration in project knime-core by knime.
the class AttributeSelectionPanel 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 loadSettingsFrom.
/**
* {@inheritDoc}
*/
@Override
protected void loadSettingsFrom(final NodeSettingsRO s, final PortObjectSpec[] specs) throws NotConfigurableException {
final LogRegLearnerSettings settings = new LogRegLearnerSettings();
m_inSpec = (DataTableSpec) specs[0];
settings.loadSettingsForDialog(s, m_inSpec);
final DataColumnSpecFilterConfiguration config = settings.getIncludedColumns();
// config.loadConfigurationInDialog(s, m_inSpec);
m_filterPanel.loadConfiguration(config, m_inSpec);
String target = settings.getTargetColumn();
m_selectionPanel.update(m_inSpec, target);
// m_filterPanel.updateWithNewConfiguration(config); is not enough, we have to reload things as selection update might change the UI
m_filterPanel.loadConfiguration(config, m_inSpec);
// must hide the target from filter panel
// updating m_filterPanel first does not work as the first
// element in the spec will always be in the exclude list.
String selected = m_selectionPanel.getSelectedColumn();
if (null == selected) {
for (DataColumnSpec colSpec : m_inSpec) {
if (colSpec.getType().isCompatible(NominalValue.class)) {
selected = colSpec.getName();
break;
}
}
}
if (selected != null) {
DataColumnSpec colSpec = m_inSpec.getColumnSpec(selected);
m_filterPanel.hideNames(colSpec);
}
updateTargetCategories(settings.getTargetReferenceCategory());
m_notSortTarget.setSelected(!settings.getSortTargetCategories());
m_notSortIncludes.setSelected(!settings.getSortIncludesCategories());
}
use of org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration in project knime-core by knime.
the class DialogComponentColumnFilter2 method updateComponent.
/**
* {@inheritDoc}
*/
@Override
protected void updateComponent() {
SettingsModelColumnFilter2 model = (SettingsModelColumnFilter2) getModel();
DataColumnSpecFilterConfiguration modelConfig = model.getFilterConfiguration();
DataColumnSpecFilterConfiguration panelConfig = modelConfig.clone();
m_colFilterPanel.saveConfiguration(panelConfig);
// bug 4681, we always load since the specs could have changed
m_componentUpdateOngoing = true;
try {
// causes events to be fired and recursive calls, prevent updates
m_colFilterPanel.loadConfiguration(modelConfig, (DataTableSpec) getLastTableSpec(m_inPortIdx));
} finally {
m_componentUpdateOngoing = false;
}
m_colFilterPanel.setEnabled(model.isEnabled());
}
use of org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration in project knime-core by knime.
the class SettingsModelColumnFilter2 method loadSettingsForModel.
/**
* {@inheritDoc}
*/
@Override
protected void loadSettingsForModel(final NodeSettingsRO settings) throws InvalidSettingsException {
DataColumnSpecFilterConfiguration clone = m_filterConfiguration.clone();
m_filterConfiguration.loadConfigurationInModel(settings);
if (!clone.equals(m_filterConfiguration)) {
notifyChangeListeners();
}
}
use of org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration in project knime-core by knime.
the class ModifyDateNodeDialog method loadSettingsFrom.
/**
* {@inheritDoc}
*/
@Override
protected void loadSettingsFrom(final NodeSettingsRO settings, final DataTableSpec[] specs) throws NotConfigurableException {
m_spec = specs[0];
m_dialogCompReplaceOrAppend.loadSettingsFrom(settings, specs);
m_dialogCompSuffix.loadSettingsFrom(settings, specs);
m_dialogCompDate.loadSettingsFrom(settings, specs);
m_dialogCompTimeZone.loadSettingsFrom(settings, specs);
m_dialogCompModifySelect.loadSettingsFrom(settings, specs);
m_filterOnlyLocalDate = ((SettingsModelString) m_dialogCompModifySelect.getModel()).getStringValue().equals(ModifyDateNodeModel.MODIFY_OPTION_APPEND);
final DataColumnSpecFilterConfiguration filterConfiguration = ModifyDateNodeModel.createDCFilterConfiguration(m_filterOnlyLocalDate ? ModifyDateNodeModel.LOCAL_TIME_FILTER : ModifyDateNodeModel.DATE_TIME_FILTER);
filterConfiguration.loadConfigurationInDialog(settings, specs[0]);
m_dialogCompColFilter.loadConfiguration(filterConfiguration, specs[0]);
}
Aggregations