Search in sources :

Example 6 with DataColumnSpecFilterConfiguration

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);
    }
}
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 7 with DataColumnSpecFilterConfiguration

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);
    }
}
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 8 with DataColumnSpecFilterConfiguration

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

Example 9 with DataColumnSpecFilterConfiguration

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);
    }
}
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 10 with DataColumnSpecFilterConfiguration

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

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