Init issue with MultipleSelect component

Hello,

Using MultipleSelect component causes error in browser for me. Can you instruct how to fix this, or would this be bug?
Please see attachment about details. End result is that list contents (text) come up to screen Ok, but component does not work.
Tested with Vaadin 14.4.2 (compability mode), Chrome 87.0.4280.66

Br., Janne

Sample Java code:

        final ReportParam<List<DomainBase>> reportParam = new ReportParam<List<DomainBase>>(null, param);
        final MultipleSelect<ListValue<DomainBase>> multipleSelect = new MultipleSelect<ListValue<DomainBase>>();
        multipleSelect.setSizeFull();
        multipleSelect.setId(param.getIdentifier());
        multipleSelect.setItems(values);
        multipleSelect.addSelectionListener(event -> {
            final Set<ListValue<DomainBase>> list = event.getAllSelectedItems();
            if (list != null && list.size() > 0) {
                final List<DomainBase> tmp = new ArrayList<DomainBase>();
                for (final ListValue<DomainBase> value : list) {
                    tmp.add(value.getValue());
                }
                reportParam.setValue(tmp);
            } else {
                reportParam.setValue(null);
            }
        });
        multipleSelect.setLabel(resourceUtils.getText(param.getTextKey()));
        multipleSelect.setEmptySelectionAllowed(false);
	

18482404.png

Just add, Combobox used in similar manner works without problems.
And component version is:

		<dependency>
			<groupId>com.vaadin.componentfactory</groupId>
			<artifactId>multiple-select</artifactId>
			<version>1.0.1</version>
			<type>jar</type>
			<scope>compile</scope>
		</dependency>

    final ReportParam<DomainBase> reportParam = new ReportParam<DomainBase>(null, param);
    final ComboBox<ListValue<DomainBase>> comboBox = new ComboBox<ListValue<DomainBase>>();
    comboBox.setSizeFull();
    comboBox.setId(param.getIdentifier());
    comboBox.setItems(values);
    comboBox.addValueChangeListener(event -> {
        final ListValue<DomainBase> value = comboBox.getValue();
        if (value != null) {
            reportParam.setValue(value.getValue());
        } else {
            reportParam.setValue(null);
        }
    });
    comboBox.setLabel(resourceUtils.getText(param.getTextKey()));
    comboBox.setAllowCustomValue(false);

Seems that 1st post code was messy. Here is sample attached again.

    final ReportParam<List<DomainBase>> reportParam = new ReportParam<List<DomainBase>>(null, param);
    final MultipleSelect<ListValue<DomainBase>> multipleSelect = new MultipleSelect<ListValue<DomainBase>>();
    multipleSelect.setSizeFull();
    multipleSelect.setId(param.getIdentifier());
    multipleSelect.setItems(values);
    multipleSelect.addSelectionListener(event -> {
        final Set<ListValue<DomainBase>> list = event.getAllSelectedItems();
        if (list != null && list.size() > 0) {
            final List<DomainBase> tmp = new ArrayList<DomainBase>();
            for (final ListValue<DomainBase> value : list) {
                tmp.add(value.getValue());
            }
            reportParam.setValue(tmp);
        } else {
            reportParam.setValue(null);
        }
    });
    multipleSelect.setLabel(resourceUtils.getText(param.getTextKey()));
    multipleSelect.setEmptySelectionAllowed(false);

Hello, I couldn’t reproduce the error in version 1.0.1 of the addon. Could you please provide a complete, minimal example that reproduces the issue?

Hello,

Thank you for prompt response. I’ll try produce sample app as soon as possible, but will be probably delayed to next week.

Br., Janne

Hello,

I was able to reproduce error with attached sample application.
Screenshot about error included.

Tested with Jetty / development build.

Br., Janne
18490067.png
18490070.zip (28.7 KB)

Thanks for the code! I saw the error when running your project. But when I copied your classes to a standard Vaadin project, the MultipleSelect component was rendered without a problem. This leads me to believe that the error has something to do with the specific setup of the project (not the component iteslf).

And to clarify, by “a standard Vaadin project”, I mean a fresh starter project downloaded from vaadin.com/start

I guess Vaadin starters are using latest spearhead versions.

I did use Vaadin 14.x LTS with compability mode

Just to add to previous comment, we are not planning to move away nearby from 14.x LTS

Could this be fixed?

I was already trying it with a Vaadin 14.4.3 starter, and it worked

I also now updated sample application to Vaadin 14.4.3 (/pom.xml: changed <vaadin.version>14.4.3</vaadin.version>)
Same error persist

Could you please try running the attached project? It is a freshly downloaded 14.4.4 starter project to which I copy-pasted your classes. As you can see, if you run the project, the MultipleSelect component is rendered normally, which to my mind indicates that the issue has something to do with the specific setup of the project you are running (not the component iteslf).
18492600.zip (122 KB)

Hello,

Yes, I confirm that works - but it’s not using compability mode.
I enabled compability mode for my-starter-project1, and found out that then error persists again.
Issue is that we would need compability mode for our product.

I attached modified pom.xml here for reference. Nothing else was changed.

Br., Janne

18492916.original (10.4 KB)
18492919.xml (9.9 KB)

The Multiple select component is not working in compatibility mode.

Unfortunately it’s not in the description of the component and should be added.

I’ve updated the description of the component with this limitations.

Unfortunately the Java component is based on a Polymer 3 component which is not working in Vaadin 14 compatibility mode and there is no Polymer 2 version of the component.