Config Dialog for Int AND Double values

Hello,

I want to provide a default dialog component to allow the user to enter a number (no matter if integer or double).

I used SettingsModelDouble to create a DialogComponentNumberEdit but entered numbers are red as long as they don't have double style ("4" = red, "4.0" = black).

Though it does not harm the functionality of the node, the red number looks like the user made a configuration mistake and I was wondering whether I could improve anything.

And there are two other questions coming along with my current development:

1:

I have a column filter panel defined like this:

addDialogComponent(new DialogComponentColumnFilter(RangeFilterV2NodeModel.createParameterFilterSetting(), 0, true, new Class[]{DoubleValue.class}));

If I execute the node, I'll also get columns of type boolean, integer and long. I'm fine with this, but I could not find a constructor for BooleanCell. I would need it to compare the column values with a setting value (which is a double but I could convert it to boolean). So I get an error like this:

Execute failed: org.knime.core.data.def.DoubleCell cannot be cast to org.knime.core.data.BooleanValue

Is there any way to exclude boolean columns (as it does not make much sense anyhow for my node)?

Why is there no constructor for BooleanCell?

Hi

 

for the first question, you can use a DialogComponentNumber which additionally has the arrows to in and decrease the value.

 

for the second question. Take a look into the DoubleToIntNodeDialog. There we use a ColumnFilter to exclude intvalues.

So for boolean values it works as follows

        ColumnFilter filter = new ColumnFilter() {
            /**
             * @return true, if the given column type is compatible with double
             *         but not with boolean values
             */
            @Override
            public boolean includeColumn(final DataColumnSpec cspec) {
                final DataType type = cspec.getType();
                return (type.isCompatible(DoubleValue.class) && !type
                        .isCompatible(BooleanValue.class));
            }

            /** {@inheritDoc} */
            @Override
            public String allFilteredMsg() {
                return "No double-type columns available.";
            }
        };
        addDialogComponent(new DialogComponentColumnFilter(

          RangeFilterV2NodeModel.createParameterFilterSetting()

                     , 0, true,
                        filter)
                        );

Hope this does the job, Iris

Thanks a lot for your help.

Unfortunately, the DialogComponentNumber has the disadvantage that one cannot insert plus or minus Infinity (except if you copy and paste the character for infinity) or even leave it completely empty.

With DialogComponentNumberEdit one can write at least Infinity or -Infinity.

I guess, I won't be able to use the KNIME dialog components to improve usability in this case? The only idea coming to my mind is to add a checkbox if the value should be used or not.

To explain the background idea: I need to be able to configure a double range but still allow to not set the lower or upper range (as it is in the Row Filter for example). Not settings one of the bounds would result in minus -Infinity or +Infinity.