DialogComponentColumnNameSelection - column filter

Hello,

I'd like to create a DialogComponentColumnNameSelection which allows the user either to choose a column of a certain type (I've used a column filter) or <none>.
The configuration is like this:

SettingsModelString refColumnSM = AbstractNormNodeModel.createRefColumnSM();

ColumnFilter filterNominalColumn = new ColumnFilter() {
            @Override
            public boolean includeColumn(DataColumnSpec dataColumnSpec) {
                return dataColumnSpec.getType().isCompatible(NominalValue.class) && dataColumnSpec.getDomain().hasValues();
            }

            @Override
            public String allFilteredMsg() {
                return "No nominal column with domain values available.";
            }
        };

        return new DialogComponentColumnNameSelection(refColumnSM, "Column with reference label", 0,
                true, true, filterNominalColumn);

As long as I have a column which passes the filter, everyhting is fine. But if the table does not contain such a column, I cannot configure the dialog (though I want to allow the user to select <none> in this case). Is there anything wrong or is it simply not possible?

Hi niederle,

 

the fourth parameter of the DialogComponentColumnNameSelection must be false.

(Here is the javadoc)

@param isRequired true, if the component should throw an exception in case of no available compatible column, false otherwise.

 

Greetings from cloudy Konstanz, Iris

Thanks a lot! I guess, I misunderstood this flag by its name. I thought, the selection of an entry "is required" - even if it is the <none> entry...

I should read documentation more carefully instead of guessing what a parameter is supposed to do.

Have an nice weekend!

Antje