Search in sources :

Example 1 with EnforceOption

use of org.knime.core.node.util.filter.NameFilterConfiguration.EnforceOption 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 2 with EnforceOption

use of org.knime.core.node.util.filter.NameFilterConfiguration.EnforceOption 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 3 with EnforceOption

use of org.knime.core.node.util.filter.NameFilterConfiguration.EnforceOption 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 4 with EnforceOption

use of org.knime.core.node.util.filter.NameFilterConfiguration.EnforceOption 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)

Aggregations

ChangeEvent (javax.swing.event.ChangeEvent)4 ChangeListener (javax.swing.event.ChangeListener)4 DataTableSpec (org.knime.core.data.DataTableSpec)4 EnforceOption (org.knime.core.node.util.filter.NameFilterConfiguration.EnforceOption)4 DataColumnSpecFilterConfiguration (org.knime.core.node.util.filter.column.DataColumnSpecFilterConfiguration)4