Search in sources :

Example 71 with DataColumnSpecFilterConfiguration

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);
    }
}
Also used : DataTableSpec(org.knime.core.data.DataTableSpec) ChangeEvent(javax.swing.event.ChangeEvent) DataColumnSpecFilterConfiguration(org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration) EnforceOption(org.knime.core.node.util.filter.NameFilterConfiguration.EnforceOption) ChangeListener(javax.swing.event.ChangeListener)

Example 72 with DataColumnSpecFilterConfiguration

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());
}
Also used : DataColumnSpec(org.knime.core.data.DataColumnSpec) DataColumnSpecFilterConfiguration(org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration)

Example 73 with DataColumnSpecFilterConfiguration

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());
}
Also used : DataColumnSpecFilterConfiguration(org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration)

Example 74 with DataColumnSpecFilterConfiguration

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();
    }
}
Also used : DataColumnSpecFilterConfiguration(org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration)

Example 75 with DataColumnSpecFilterConfiguration

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]);
}
Also used : DataColumnSpecFilterConfiguration(org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration) SettingsModelString(org.knime.core.node.defaultnodesettings.SettingsModelString)

Aggregations

DataColumnSpecFilterConfiguration (org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration)75 DataTableSpec (org.knime.core.data.DataTableSpec)15 InvalidSettingsException (org.knime.core.node.InvalidSettingsException)14 NotConfigurableException (org.knime.core.node.NotConfigurableException)9 ChangeEvent (javax.swing.event.ChangeEvent)4 ChangeListener (javax.swing.event.ChangeListener)4 DataColumnSpec (org.knime.core.data.DataColumnSpec)4 SettingsModelString (org.knime.core.node.defaultnodesettings.SettingsModelString)4 DatabaseConnectionSettings (org.knime.core.node.port.database.DatabaseConnectionSettings)4 EnforceOption (org.knime.core.node.util.filter.NameFilterConfiguration.EnforceOption)4 DatabaseConnectionPortObjectSpec (org.knime.core.node.port.database.DatabaseConnectionPortObjectSpec)2 SimpleDateFormat (java.text.SimpleDateFormat)1 ArrayList (java.util.ArrayList)1 LinkedHashSet (java.util.LinkedHashSet)1 Solver (org.knime.base.node.mine.regression.logistic.learner4.LogRegLearnerSettings.Solver)1 BinNaming (org.knime.base.node.preproc.autobinner3.AutoBinnerLearnSettings.BinNaming)1 EqualityMethod (org.knime.base.node.preproc.autobinner3.AutoBinnerLearnSettings.EqualityMethod)1 Method (org.knime.base.node.preproc.autobinner3.AutoBinnerLearnSettings.Method)1 DoubleValue (org.knime.core.data.DoubleValue)1 IntValue (org.knime.core.data.IntValue)1