Search in sources :

Example 1 with DataValueColumnFilter

use of org.knime.core.node.util.DataValueColumnFilter in project knime-core by knime.

the class RuleEngine2PortsNodeDialog method initControls.

/**
 * Creates and adds most of the controls to the dialog.
 */
private void initControls() {
    m_pmml = new JCheckBox("Enable PMML RuleSet generation (fails when result would not be a valid PMML RuleSet)");
    m_ruleSelectionMethod = new JComboBox<>(new Vector<>(RuleEngine2PortsSettings.POSSIBLE_RULE_SELECTION_METHODS));
    m_hasDefaultScore = new JCheckBox("Default value (when nothing matches): ");
    m_defaultScore = Util.createTextFieldWithWatermark(RuleEngine2PortsSettings.DEFAULT_DEFAULT_SCORE, 22, "Default score/value when nothing matches");
    m_hasDefaultConfidence = new JCheckBox("Default confidence value (when not specified in the confidence column): ");
    m_defaultConfidence = new JSpinner(new SpinnerNumberModel(RuleEngine2PortsSettings.DEFAULT_DEFAULT_CONFIDENCE, 0d, 1d, .1));
    @SuppressWarnings("unchecked") DataValueColumnFilter doubleValueFilter = new DataValueColumnFilter(DoubleValue.class);
    m_ruleConfidenceColumn = new ColumnSelectionPanel((Border) null, doubleValueFilter, true);
    m_hasDefaultWeight = new JCheckBox("Default weight value (when not specified in the weight column): ");
    m_defaultWeight = new JSpinner(new SpinnerNumberModel(RuleEngine2PortsSettings.DEFAULT_DEFAULT_WEIGHT, 0d, 1e6, .1));
    m_ruleWeightColumn = new ColumnSelectionPanel((Border) null, doubleValueFilter, true);
    m_computeConfidence = new JCheckBox("Confidence column name: ");
    m_predictionConfidenceColumn = Util.createTextFieldWithWatermark(RuleEngine2PortsSettings.DEFAULT_PREDICTION_CONFIDENCE_COLUMN, 22, "Computed confidence column name");
    m_provideStatistics = new JCheckBox("Provide statistics");
    @SuppressWarnings("unchecked") DataValueColumnFilter validationColumnFilter = new DataValueColumnFilter(StringValue.class, BooleanValue.class, DoubleValue.class);
    m_validationColumn = new ColumnSelectionPanel(null, validationColumnFilter, true);
    m_pmmlLabels = new ArrayList<>();
    m_pmmlBorders = new ArrayList<>();
    m_validateLabel = new JLabel("Validation column");
}
Also used : JCheckBox(javax.swing.JCheckBox) SpinnerNumberModel(javax.swing.SpinnerNumberModel) JSpinner(javax.swing.JSpinner) JLabel(javax.swing.JLabel) ColumnSelectionPanel(org.knime.core.node.util.ColumnSelectionPanel) DataValueColumnFilter(org.knime.core.node.util.DataValueColumnFilter) Vector(java.util.Vector) Border(javax.swing.border.Border) TitledBorder(javax.swing.border.TitledBorder)

Example 2 with DataValueColumnFilter

use of org.knime.core.node.util.DataValueColumnFilter in project knime-core by knime.

the class DateTimeDifferenceNodeDialog method updateDateTimeComponents.

@SuppressWarnings("unchecked")
private void updateDateTimeComponents(final SettingsModelDateTime dateTimeModel) {
    if (m_dialogComp1stColSelect.getSelectedAsSpec() != null) {
        final DataType type = m_dialogComp1stColSelect.getSelectedAsSpec().getType();
        // adapt column filter of column selection for 2nd column
        try {
            final List<Class<? extends DataValue>> valueClasses = type.getValueClasses();
            if (valueClasses.contains(ZonedDateTimeValue.class)) {
                m_dialogComp2ndColSelect.setColumnFilter(new DataValueColumnFilter(ZonedDateTimeValue.class));
            } else if (valueClasses.contains(LocalDateTimeValue.class)) {
                m_dialogComp2ndColSelect.setColumnFilter(new DataValueColumnFilter(LocalDateTimeValue.class));
            } else if (valueClasses.contains(LocalDateValue.class)) {
                m_dialogComp2ndColSelect.setColumnFilter(new DataValueColumnFilter(LocalDateValue.class));
            } else if (valueClasses.contains(LocalTimeValue.class)) {
                m_dialogComp2ndColSelect.setColumnFilter(new DataValueColumnFilter(LocalTimeValue.class));
            }
        } catch (NotConfigurableException ex) {
        // will never happen, because there is always at least the selected 1st column available
        }
        // adapt date&time component
        dateTimeModel.setUseDate(!type.isCompatible(LocalTimeValue.class));
        dateTimeModel.setUseTime(!type.isCompatible(LocalDateValue.class));
        dateTimeModel.setUseZone(type.isCompatible(ZonedDateTimeValue.class));
    }
    updateWarningLabel();
}
Also used : NotConfigurableException(org.knime.core.node.NotConfigurableException) LocalTimeValue(org.knime.core.data.time.localtime.LocalTimeValue) DataValue(org.knime.core.data.DataValue) DataType(org.knime.core.data.DataType) LocalDateValue(org.knime.core.data.time.localdate.LocalDateValue) DataValueColumnFilter(org.knime.core.node.util.DataValueColumnFilter) ZonedDateTimeValue(org.knime.core.data.time.zoneddatetime.ZonedDateTimeValue) LocalDateTimeValue(org.knime.core.data.time.localdatetime.LocalDateTimeValue)

Example 3 with DataValueColumnFilter

use of org.knime.core.node.util.DataValueColumnFilter in project knime-core by knime.

the class CrosstabNodeDialog method createSettingsPanel.

@SuppressWarnings("unchecked")
private JPanel createSettingsPanel() {
    JPanel p = new JPanel(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.BOTH;
    c.anchor = GridBagConstraints.WEST;
    c.insets = new Insets(8, 3, 3, 3);
    c.gridx = 0;
    c.gridy = 0;
    c.gridwidth = 1;
    c.weightx = 0;
    c.weighty = 0;
    c.fill = GridBagConstraints.BOTH;
    p.add(new JLabel("Row variable:"), c);
    c.gridx++;
    c.weightx = 1;
    m_rowVarColumn = new ColumnSelectionComboxBox(StringValue.class, DoubleValue.class);
    m_rowVarColumn.setBorder(null);
    p.add(m_rowVarColumn, c);
    c.insets = new Insets(3, 3, 3, 3);
    c.gridx = 0;
    c.gridy++;
    c.weightx = 0;
    p.add(new JLabel("Column variable:"), c);
    c.gridx++;
    c.weightx = 1;
    m_colVarColumn = new ColumnSelectionComboxBox(StringValue.class, DoubleValue.class);
    m_colVarColumn.setBorder(null);
    p.add(m_colVarColumn, c);
    c.gridx = 0;
    c.gridy++;
    c.weightx = 0;
    p.add(new JLabel("Weight column:"), c);
    c.gridx++;
    c.weightx = 1;
    m_weightColumn = new ColumnSelectionPanel((Border) null, new DataValueColumnFilter(DoubleValue.class), true);
    m_weightColumn.setBorder(null);
    p.add(m_weightColumn, c);
    c.gridx = 0;
    c.gridy++;
    c.gridwidth = 2;
    m_enableHiliting = new JCheckBox("Enable hiliting");
    p.add(m_enableHiliting, c);
    c.gridy++;
    c.gridx = 0;
    c.weighty = 1;
    p.add(new JPanel(), c);
    return p;
}
Also used : JCheckBox(javax.swing.JCheckBox) JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) DoubleValue(org.knime.core.data.DoubleValue) JLabel(javax.swing.JLabel) ColumnSelectionComboxBox(org.knime.core.node.util.ColumnSelectionComboxBox) ColumnSelectionPanel(org.knime.core.node.util.ColumnSelectionPanel) StringValue(org.knime.core.data.StringValue) DataValueColumnFilter(org.knime.core.node.util.DataValueColumnFilter) Border(javax.swing.border.Border)

Aggregations

DataValueColumnFilter (org.knime.core.node.util.DataValueColumnFilter)3 JCheckBox (javax.swing.JCheckBox)2 JLabel (javax.swing.JLabel)2 Border (javax.swing.border.Border)2 ColumnSelectionPanel (org.knime.core.node.util.ColumnSelectionPanel)2 GridBagConstraints (java.awt.GridBagConstraints)1 GridBagLayout (java.awt.GridBagLayout)1 Insets (java.awt.Insets)1 Vector (java.util.Vector)1 JPanel (javax.swing.JPanel)1 JSpinner (javax.swing.JSpinner)1 SpinnerNumberModel (javax.swing.SpinnerNumberModel)1 TitledBorder (javax.swing.border.TitledBorder)1 DataType (org.knime.core.data.DataType)1 DataValue (org.knime.core.data.DataValue)1 DoubleValue (org.knime.core.data.DoubleValue)1 StringValue (org.knime.core.data.StringValue)1 LocalDateValue (org.knime.core.data.time.localdate.LocalDateValue)1 LocalDateTimeValue (org.knime.core.data.time.localdatetime.LocalDateTimeValue)1 LocalTimeValue (org.knime.core.data.time.localtime.LocalTimeValue)1