Giter Club home page Giter Club logo

vaadin-combobox-multiselect's Introduction

ComboBoxMultiselect Add-on for Vaadin 8

The ComboBoxMultiselect component is a client-side Widget. As example was used the ComboBox from Vaadin and the VFilterSelect from Vaadin.

screenshot

Features:

  • multiselect with checkbox
  • clear selection button
  • ordering moves selected always to top

Online demo

http://bonprix.jelastic.servint.net/vaadin-combobox-multiselect-demo/

Usage

Maven

<dependency>
    <groupId>org.vaadin.addons</groupId>
	<artifactId>vaadin-combobox-multiselect</artifactId>
	<version>2.0</version>
</dependency>

<repository>
   <id>vaadin-addons</id>
   <url>http://maven.vaadin.com/vaadin-addons</url>
</repository>

No widgetset required.

Download release

Official releases of this add-on are available at Vaadin Directory. For Maven instructions, download and reviews, go to http://vaadin.com/addon/vaadin-combobox-multiselect

Building and running demo

git clone https://github.com/bonprix/vaadin-combobox-multiselect mvn clean install cd demo mvn jetty:run

To see the demo, navigate to http://localhost:8080/

Release notes

Version 2.0

  • Vaadin 8

Known issues

  • please report issues and help us to make this even better ;)

Roadmap

This component is developed as a part of a bonprix project with no public roadmap or any guarantees of upcoming releases. That said, the following features are planned for upcoming releases:

  • use scss

Issue tracking

The issues for this add-on are tracked on its github.com page. All bug reports and feature requests are appreciated.

Contributions

Contributions are welcome, but there are no guarantees that they are accepted as such. Process for contributing is the following:

  • Fork this project
  • Create an issue to this project about the contribution (bug or feature) if there is no such issue about it already. Try to keep the scope minimal.
  • Develop and test the fix or functionality carefully. Only include minimum amount of code needed to fix the issue.
  • Refer to the fixed issue in commit
  • Send a pull request for the original project
  • Comment on the original issue that you have implemented a fix for it

License & Author

Add-on is distributed under MIT License. For license terms, see LICENSE.txt.

vaadin-combobox-multiselect is written by members of Bonprix Handelsgesellschaft mbh:

Developer Guide

Getting started

Here is a simple example on how to try out the add-on component:

// Initialize a list with items
List<NamedObject> list = new ArrayList<NamedObject>();
NamedObject vaadin = new NamedObject(2L, "Vaadin");
list.add(new NamedObject(1L, "Java"));
list.add(vaadin);
list.add(new NamedObject(3L, "Bonprix"));
list.add(new NamedObject(4L, "Addon"));

// Initialize the ComboBoxMultiselect
final ComboBoxMultiselect<NamedObject> comboBoxMultiselect = new ComboBoxMultiselect<>();
comboBoxMultiselect.setPlaceholder("Type here");
comboBoxMultiselect.setCaption("ComboBoxMultiselect");
comboBoxMultiselect.setItems(list);
comboBoxMultiselect.setValue(new HashSet<>(Arrays.asList(vaadin)));

For a more comprehensive example, see src/test/java/org/vaadin/template/demo/DemoUI.java

vaadin-combobox-multiselect's People

Contributors

bonprixsystemuser avatar jonjacde avatar torbon avatar vagharshakustest avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vaadin-combobox-multiselect's Issues

rebel.xml still included in vaadin-combobox-multiselect-2.0.1

This issue isn't fixed yet, but there are two tickets already closed: #38, #32
The error which is produced: #38 (comment)

This should do the trick:

<build>
	<plugins>
		<plugin>
		<groupId>org.apache.maven.plugins</groupId>
		<artifactId>maven-jar-plugin</artifactId>
		<configuration>
			<excludes>
				<exclude>**/rebel.xml</exclude>
			</excludes>
		</configuration>
	</plugin>
</build>

Add option to open ja filter Dialog

Like 'clear' and 'select all' it would be nice to add an option to open a more detailed dialog (customer created).

The filter is filtering people, the display value is 'name, prename'. Now, I want to filter all, with an age over 18 or who lived in a country I choose. But, i dont want to show these attributes in the orignial table. What happens on 'selected on detail' should handled by a concred implementation.

Exclude cache from widgetset compilation in Jar

I get an exception with jrebel with this addon:

[2017-02-24 10:33:56] Invalid rebel.xml: Invalid 'dir' defined in class path of rebel.xml Directory 'C:/bpPrograms/Java/workspace/workspace_mars2/vaadin-combobox-multiselect-root/vaadin-combobox-multiselect/target/classes' does not exist

Searching in this repository let me find this file:

https://raw.githubusercontent.com/bonprix/vaadin-combobox-multiselect/e82e8d7618243587ea090824cbaf8b54e2f94317/vaadin-combobox-multiselect-demo/src/main/webapp/VAADIN/themes/demo/styles.scss.cache

In the first line there ist the string from above. Try to exclude this cache file in compilation.
This is from the single-application-archetype from vaadin:

<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.6</version> <configuration> <failOnMissingWebXml>false</failOnMissingWebXml> <!-- Exclude an unnecessary file generated by the GWT compiler. --> <packagingExcludes>WEB-INF/classes/VAADIN/widgetsets/WEB-INF/**</packagingExcludes> </configuration> </plugin>

Mybe this helps

Example code has errors

Hello,

example code on vaadin directory addon page has 2 errors: setInptuPrompt and addItems are undefined for ComboBoxMultiselect. There is setPlaceholder and setItems methods instead.

String.Join error

It would be great if the String.join use could be replaced in a way that work while executing Java 7.
In many cases (as my own) can be extremely difficult to replace java to version 8.

See error:

java.lang.NoSuchMethodError: java.lang.String.join(Ljava/lang/CharSequence;Ljava/lang/Iterable;)Ljava/lang/String; at org.vaadin.addons.comboboxmultiselect.ComboBoxMultiselect.paintContent(ComboBoxMultiselect.java:496) [vaadin-combobox-multiselect-1.1.14.jar:1.1.14]

Doesn't work with Vaadin 8.1.0

When adding version 2.0.1 to my POM dependencies I get the following error

[ERROR] Failed to execute goal com.vaadin:vaadin-maven-plugin:8.1.0:compile (default) on project supplierPortal: GWT Module com.vaadin.v7.Vaadin7WidgetSet not found in project sources or resources. -> [Help 1]

I'm not sure if some compatibility features were removed when Vaadin moved to 8.1.0

List disappears on item select

I have a problem when selecting/desecting item in list. When there is only one item slected it disappers after selection. I"ve attached a gif.

video

Select All option

HI,
It is a nice component, good work!
Do you think to add a "select all" option like clear option?

Error thrown when typing an invalid option

When you type in some text that doesn't exist as an option it throws multiple Javascript errors:

SEVERE: Index: 2, Size: 2
java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
	at Unknown.java_lang_Exception_Exception__Ljava_lang_String_2V(AppWidgetset-0.js)
	at Unknown.java_lang_RuntimeException_RuntimeException__Ljava_lang_String_2V(AppWidgetset-0.js)
	at Unknown.new java_lang_IndexOutOfBoundsException_IndexOutOfBoundsException__Ljava_lang_String_2V(AppWidgetset-0.js)
	at Unknown.javaemul_internal_InternalPreconditions_checkCriticalElementIndex__IIV(AppWidgetset-0.js)
	at Unknown.java_util_ArrayList_$get__Ljava_util_ArrayList_2ILjava_lang_Object_2(AppWidgetset-0.js)
	at Unknown.org_vaadin_addons_client_VComboBoxMultiselect$SuggestionPopup_$selectFirstItem__Lorg_vaadin_addons_client_VComboBoxMultiselect$SuggestionPopup_2V(AppWidgetset-0.js)
	at Unknown.org_vaadin_addons_client_VComboBoxMultiselect$SuggestionMenu_$setSuggestions__Lorg_vaadin_addons_client_VComboBoxMultiselect$SuggestionMenu_2Ljava_util_Collection_2V(AppWidgetset-0.js)
	at Unknown.org_vaadin_addons_client_VComboBoxMultiselect$DataReceivedHandler_$dataReceived__Lorg_vaadin_addons_client_VComboBoxMultiselect$DataReceivedHandler_2V(AppWidgetset-0.js)
	at Unknown.org_vaadin_addons_client_ComboBoxMultiselectConnector_$refreshData__Lorg_vaadin_addons_client_ComboBoxMultiselectConnector_2V(AppWidgetset-0.js)
	at Unknown.org_vaadin_addons_client_ComboBoxMultiselectConnector$PagedDataChangeHandler_dataAvailable__IIV(AppWidgetset-0.js)

erratic behaviour selecting/desececting item at a page other than 0

This one is tricky. I spotted it in my project and confirmed it in the included demo.
Steps to reproduce:
In the first 'Normal' ComboBoxMultiselect move to page 51-60 or a higher range and select an item.
Suggestions will clear for some reason.
It does not happen in previous pages.

.

Classpath error during runtime - NoClassDefFoundError

Multiselect combobox is missing some needed dependencies by default. An attempt to add and use it in simple vaadin application results in runtime error.

Relevant piece of runtime error stack trace (full stack trace is on the bottom):

Caused by: java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils
	at org.vaadin.addons.comboboxmultiselect.ComboBoxMultiselect.paintContent(ComboBoxMultiselect.java:491)
	at com.vaadin.server.LegacyPaint.paint(LegacyPaint.java:65)

Workaround

Add following into pom.xml:

<dependency>
	<groupId>org.apache.commons</groupId>
	<artifactId>commons-lang3</artifactId>
	<version>3.0</version>
</dependency>

Steps to reproduce:

  1. Create new project using vaadin 7.7.8 archetype:
    mvn -B archetype:generate -DarchetypeGroupId=com.vaadin -DarchetypeArtifactId=vaadin-archetype-application -DarchetypeVersion=7.7.8 -DgroupId=org.test -DartifactId=vaadin-app -Dversion=1.0-SNAPSHOT

  2. Build and run the app: mvn clean package jetty:run

  3. Default application at `http://localhost:8080/' works correctly

  4. Add vaadin-combobox-multiselect dependency

<dependency>
	<groupId>org.vaadin.addons</groupId>
	<artifactId>vaadin-combobox-multiselect</artifactId>
	<version>1.2.2</version>
</dependency>
  1. Build and run the app: mvn clean package jetty:run - build is successful and app still runs ok.

  2. Change init method in generated MyUI class and add NamedObject class

    @Override
    protected void init(VaadinRequest vaadinRequest) {
        final VerticalLayout layout = new VerticalLayout();
        
     // Initialize a list with items
        List<NamedObject> list = new ArrayList<NamedObject>();
        NamedObject vaadin = new NamedObject(2L, "Vaadin");
        list.add(new NamedObject(1L, "Java"));
        list.add(vaadin);
        list.add(new NamedObject(3L, "Bonprix"));
        list.add(new NamedObject(4L, "Addon"));

        // Initialize the ComboBoxMultiselect
        final ComboBoxMultiselect comboBoxMultiselect = new ComboBoxMultiselect();
        comboBoxMultiselect.setInputPrompt("Type here");
        comboBoxMultiselect.setCaption("ComboBoxMultiselect");
        comboBoxMultiselect.addItems(list);
        comboBoxMultiselect.select(vaadin);
        
        layout.addComponents(comboBoxMultiselect);
        layout.setMargin(true);
        layout.setSpacing(true);
        
        setContent(layout);
    }
  1. Build and run the app: mvn clean package jetty:run

  2. App does not load and returns an error:

HTTP ERROR 500
Problem accessing /. Reason:
    Server Error

javax.servlet.ServletException: com.vaadin.server.ServiceException: java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils
	at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:382)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
	
       [... a lot more]

Full error:

HTTP ERROR 500
Problem accessing /. Reason:
    Server Error

javax.servlet.ServletException: com.vaadin.server.ServiceException: java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils
	at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:382)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
	at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:845)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1689)
	at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:225)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1676)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:581)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1174)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1106)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
	at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213)
	at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:119)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
	at org.eclipse.jetty.server.Server.handle(Server.java:524)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:319)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:253)
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
	at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
	at java.lang.Thread.run(Thread.java:745)
Caused by: com.vaadin.server.ServiceException: java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils
	at com.vaadin.server.VaadinService.handleExceptionDuringRequest(VaadinService.java:1474)
	at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1434)
	at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:380)
	... 29 more
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils
	at org.vaadin.addons.comboboxmultiselect.ComboBoxMultiselect.paintContent(ComboBoxMultiselect.java:491)
	at com.vaadin.server.LegacyPaint.paint(LegacyPaint.java:65)
	at com.vaadin.server.communication.LegacyUidlWriter.write(LegacyUidlWriter.java:82)
	at com.vaadin.server.communication.UidlWriter.write(UidlWriter.java:143)
	at com.vaadin.server.communication.UIInitHandler.getInitialUidl(UIInitHandler.java:291)
	at com.vaadin.server.communication.UIInitHandler.synchronizedHandleRequest(UIInitHandler.java:80)
	at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:41)
	at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1422)
	... 30 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang3.StringUtils
	at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
	at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)
	at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)
	at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)
	at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:487)
	at org.eclipse.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:428)
	... 38 more

Possibility to set customized "selectedCaption"

Hello,

Great addon. Very useful! I have a question:
Is it possible to define a customized "selectedCaption". Currently the following is used per default:

            if (selectedCaption.size() > 0) {
                target.addAttribute("selectedCaption",
                        "(" + selectedCaption.size() + ") " + String.join("; ", selectedCaption));
            }

Thanks in advance!

Best Regards!

clearAll does not update client side VCheckBoxes

Congrats on updating this add-on without compatibility classes. I have been waiting for this, since this add-on was the one single reason I still was using compatibility jars.
Allow me to report a couple of issues:

The clear command, while it does update the selection server side,
it still leaves the checkboxes checked.

Selection does not work

Hello!

I receive always the following error:

java.lang.NoSuchFieldException: selection
	at java.lang.Class.getDeclaredField(Class.java:2070)
	at org.vaadin.addons.ComboBoxMultiselect.updateSelection(ComboBoxMultiselect.java:866)
	at org.vaadin.addons.ComboBoxMultiselect.updateSelection(ComboBoxMultiselect.java:848)
	at org.vaadin.addons.ComboBoxMultiselect$1.updateSelection(ComboBoxMultiselect.java:176)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:155)
	at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:116)
	at com.vaadin.server.communication.ServerRpcHandler.handleInvocation(ServerRpcHandler.java:445)
	at com.vaadin.server.communication.ServerRpcHandler.handleInvocations(ServerRpcHandler.java:410)
	at com.vaadin.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:274)
	at com.vaadin.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:90)
	at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:40)
	at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1601)
	at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:445)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
	at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:105)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
	at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:474)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:783)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:798)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1434)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:748)java.lang.NoSuchFieldException: selection
	at java.lang.Class.getDeclaredField(Class.java:2070)
	at org.vaadin.addons.ComboBoxMultiselect.updateSelection(ComboBoxMultiselect.java:866)
	at org.vaadin.addons.ComboBoxMultiselect.updateSelection(ComboBoxMultiselect.java:848)
	at org.vaadin.addons.ComboBoxMultiselect.updateSelection(ComboBoxMultiselect.java:825)
	at com.vaadin.ui.AbstractMultiSelect.updateSelection(AbstractMultiSelect.java:306)
	at com.vaadin.ui.AbstractMultiSelect.setValue(AbstractMultiSelect.java:216)
	at

The combobox is filled with my data, but the selection by clicking on the values and also the selecting via my software causes this issue. Does anyone have an idea?

One further question: Is there a possiblity to order the entries in the combobox like I added the items to it?

Thanks in advance!

Best Regards,
Thomas

NULL Option (nullSelectionAllowed)

It seems you removed the NULL selection.

Is it possible to get them back? NULL is in normal Grids a valid value. The Side-Effects missing it are hugh

NoClassDefFoundError

hi,

in version 1.2 & 1.2.1 I encountered the following problem by selecting entries in the comboBox:

13:32:48,687 SEVERE [com.vaadin.server.DefaultErrorHandler] (default task-32) : java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils
at org.vaadin.addons.comboboxmultiselect.ComboBoxMultiselect.paintContent(ComboBoxMultiselect.java:491)
at com.vaadin.server.LegacyPaint.paint(LegacyPaint.java:65)
at com.vaadin.server.communication.LegacyUidlWriter.write(LegacyUidlWriter.java:82)

I run it on vaadin 7.7.3, a Wildfly 10 and Java 8.

Reading the issue tracker, this error should have been resolved in version 1.2.1 but well I still get it.

Using setValue() progamatically is not refreshing the UI

I did the following test, using version 1.1.11 and Vaadin 7.6.8:

    BeanItemContainer<Office> testContainer = new BeanItemContainer<>(Office.class);
    Office o1 = new Office();
    o1.setName("Office 1");
    testContainer.addBean(o1);
    Office o2 = new Office();
    o2.setName("Office 2");
    testContainer.addBean(o2);

    ComboBoxMultiselect c = new ComboBoxMultiselect(null, testContainer);
    c.setWidth("300");
    addComponent(c);

    Button but = new Button("setValueToO1", e -> c.setValue(new HashSet<>(Arrays.asList( o1 ))));
    addComponent(but);

Office is just a simple bean with a property name, and equals() and hashcode() using this property.

The steps I did were:

  1. Open ComboBoxMultiselect and select Office 2
  2. Click anywhere outside
  3. ComboBoxMultiselect shows "(1) Office 2" correclty
  4. Click "setValueToO1" button
  5. ComboBoxMultiselect keeps showing "(1) Office 2", and if I open it, "Office 2" is checked instead of "Office 1".

I debugged com.vaadin.ui.AbstractField.setValue(T, boolean, boolean) and it seems to set the internal value correctly, but it is not reflected on the UI, it behaves like "Office 2" is still checked.

Any ideas?

I'm trying to understand things on the server side, but when it flows beyond markAsDirty(), I get lost because I don't know how Vaadin works on this matter.

Reindeer Theme error

If we try to add ComboBoxMultiselect using Reindeer theme, the component freezes and is not possible click in the checkbox, only via caption text works to select the checkbox.

See code:

        BeanItemContainer<NamedObject> beanContainer = new BeanItemContainer<NamedObject>(NamedObject.class);
        beanContainer.addBean(new NamedObject(2L, "Bonprix"));
        beanContainer.addBean(new NamedObject(3L, "ComboBox"));
        beanContainer.addBean(new NamedObject(4L, "Multiselect"));

        final ComboBoxMultiselect beanComboBox = new ComboBoxMultiselect("beanItemContainer", beanContainer);

        final VerticalLayout vertical = new VerticalLayout();
        vertical.addComponent(beanComboBox);

Make "showing selected items first" optional

I need this for 2 reasons:

  1. I need to keep alphabetical order, regardless of the selection
  2. I have a container that cannot order for "synthetic" fields like 'selected'

I'm planning to work on this and provide a PR. Would you review and accept that?

Show the latest version on docs

I had some very weird bugs trying to use this component, til I realized that I was trying version 1.1.0 and there were a lot of releases after that.
I think it is important to keep the latest version on maven snippet. This great component may have lost some users/contributors because of this.

Extended ComboBoxMultiselect wont work

Method getSelectionBaseClass gets class super class.
You need to search for the right super class.

Class clazz = this.getClass();
while (!(clazz is The right class)){
clazz = clazz.getSuperClass()
}
return class;

Needs to be something like this.
I did
@OverRide
protected Class<?> getSelectionBaseClass() {
return super.getSelectionBaseClass().getSuperclass();
}

rebel.xml part of artifact

JRebel is showing me the warning Invalid 'dir' defined in class path of rebel.xml.

The reason is the presence of rebel.xml in vaadin-combobox-multiselect-1.1.7.jar. I guess this file, which refers to a directory under /Users/thorbenvh8/Documents/, was added unintentionally.

Exclude rebel.xml from the jar

It would be great if the rebel.xml could be excluded from the jar.

When I use this Vaadin Add-on in my project, I get repeatedly an error notification:
Invalid 'dir' defined in class path of rebel.xml (jar:file:.../WEB-INF/lib/vaadin-combobox-multiselect-1.1.14.jar!/rebel.xml): Directory '/Users/thorbenvh8/Documents/workspace/vaadin-combobox-multiselect/vaadin-combobox-multiselect/target/classes' does not exist

Paging not enabled for BeanItemContainer

This is due to returning null when container is an instance of BeanItemContainer in the implementation of method (line 563) :
protected List<?> getOptionsWithFilter(boolean needNullSelectOption)

I don't know why it is necessary to return null for BeanItemContainer.

Problem when i trying to download

When i try download with ivy i get this error:

unresolved dependency: org.vaadin.addons#vaadin-combobox-multiselect;1.1.7: not found

Publish Latest Maven Artifacts

First of all, thanks for this component! Awesome!

I'm currently using version 1.1.0 which has issues with BeanItemContainer

I saw that you have already fixed it in the current master branch so could you please publish latest maven artifacts with the BeanItemContainer fix?

Regards

select all

Hi,

I'm happily using the new features of combobox-multiselect, specially the "select all" button and function.

I have three of them on my UI, with many items (>1000), I need every item selected by default, but it took relatively a long time. Timetests showed, that
ComboBoxMultiselect#selectAll()
caused the slowness. I've noticed, that this method selects the items one-by-one. I've changed it to
cbms.setValue(cbms.getItemIds());
it makes the selection all at once, and it solved my problem.

Just a suggestion, take it if you like.

Zsu

Combobox Elements are not selectable

Hello,

I've tried to use the ComboBoxMultiselect and could not consistently get it to work:

In our project, when the underlying DTO has an id field, the multiselect works (every dto has hashCode and equals methods). When the underlying DTO has no id field the multiselect refuses to select an item on click, instead the selection highlight flickers and nothing happens.

I've created a test vaadin single module project and tried to play around but could not get anything to work at all - I could not even get it to work with plain strings or integer objects. Could you look into it?

I've attached the example projeect.
multiselecttest.zip

Lack of accessibility

The standard ComboBox from Vaadin works as follows:

  1. When the textbox is focused, it's content is selected. A screenreader reads the selected text
  2. When an element from the suggestion popup is selected (highlighted), the textbox's content is immediately updated with the selected element. A screenreader observes the change and reads it.

As the ComboBoxMulitselect works different by design, a screenreader is stranded. I find the following behaviour useful:

  1. When the user navigates using the arrow keys, the screenreader should read the element form the suggetion popup and it's activation state
  2. The screenreader reads the element's position in the suggention popup ("entry 4 of 20").

Unfortunately, Jaws reads aria-setsize and aria-posinset only if they are set in an element with role="listitem", whereas the aria specs allows role="option", too. And I have to use the latter role in order to use aria-checked on the td element. Setting aria-activedescendant to the checkbox instead of the td element is not an option, as this leads to focused checkboxes and a broken styling.

I've done some first work in my branch Barrierefreiheit. What do you think?

NPE thrown by the compare function

A user sent me a screen of an ERROR 500 caused by the component.

I checked the logs server side (Tomcat 8) and I found the following stack:

Jan 26, 2016 10:45:56 AM com.vaadin.server.DefaultErrorHandler doDefault
SEVERE:
java.lang.NullPointerException
at org.vaadin.addons.comboboxmultiselect.ComboBoxMultiselect$1.compare(ComboBoxMultiselect.java:415)
at org.vaadin.addons.comboboxmultiselect.ComboBoxMultiselect$1.compare(ComboBoxMultiselect.java:411)
at java.util.Arrays.mergeSort(Unknown Source)
at java.util.Arrays.mergeSort(Unknown Source)
at java.util.Arrays.legacyMergeSort(Unknown Source)
at java.util.Arrays.sort(Unknown Source)
at java.util.ArrayList.sort(Unknown Source)
at org.vaadin.addons.comboboxmultiselect.ComboBoxMultiselect.paintContent(ComboBoxMultiselect.java:411)
at com.vaadin.server.LegacyPaint.paint(LegacyPaint.java:65)
at com.vaadin.server.communication.LegacyUidlWriter.write(LegacyUidlWriter.java:82)
at com.vaadin.server.communication.UidlWriter.write(UidlWriter.java:145)
at com.vaadin.server.communication.UidlRequestHandler.writeUidl(UidlRequestHandler.java:113)
at com.vaadin.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:81)
at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:41)
at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1409)
at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:364)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:521)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1096)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:674)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)

It seems the cause is from the source where one of the two compared objects is null

I can't seem to reproduce it at my side. Maybe it should be best to add some checks to avoid the NPE.

ivy.xml installation

we can install with maven in some our projects. we need to install our other ivy project but we can't. can someone help me for that ivy installation ?

Make "selectedCaption" overridable (v1.2.2)

Hi, is it possible, that you change painting method in a manor, that parts of it are overridable? Especially I'd like to have the ability to override the part where the "selectedCaption" of the element is assembled.
I think it woul be sufficient to offer a protected method, that takes the list of selected options and the single/multi selection flag and returns an assembled String.

DataProvider only ListDataProvider?

This component should support multiple data provider types like AbstractBackEndDataProvider and so on.
I need it to be possible to fetch items with offset and limit, because there will be more than 100 000 data rows and fetching them all at once would take couple minutes.
This would be great feature and it is critical for my project.

filtering values

Seems that while filtering works when there is some value for items to be filtered with; it breaks when you put something and then delete it.
The full list of items will not be presented again.

Problem with caption

Hello,
I am using your comopnent as a filter in a grid column

final ComboBoxMultiselect selectionBox = new ComboBoxMultiselect(new ComboBoxMultiselectCaptions("nothing selected", "multiple selection"));
selectionBox.setClearButtonCaption("clear");
selectionBox.addItems(currencyCodes);
selectionBox.select(currencyCodes);
selectionBox.setWidth(100, Sizeable.Unit.PIXELS);

Grid.HeaderCell statusHeaderCell = mainGrid.getHeaderRow(1).getCell(COLUMN_3);
statusHeaderCell.setComponent(selectionBox);

I've added a blur listener to filter my grid:

selectionBox.addBlurListener(new FieldEvents.BlurListener() {
    @Override
    public void blur(FieldEvents.BlurEvent event) {
          filterMyGrid(myGrid, (Set) selectionBox.getValue());
});

The problem is when I select multiple items caption doesn't change to "multiple selections". Instead it looks like that: "(count) item1, item2, item3, ..."
combomultibadcaption

I've managed to change it by adding setInputPrompt() in blur listener:

public void blur(FieldEvents.BlurEvent event) {
        if (((Set) selectionBox.getValue()).size() == 0)
            selectionBox.setInputPrompt("nothing selected");
        else if (((Set) selectionBox.getValue()).size() > 1)
            selectionBox.setInputPrompt("multiple selection");
        else
            selectionBox.setInputPrompt(selectionBox.getCaption());

       filterMyGrid(myGrid, (Set) selectionBox.getValue());
}

Although it doesn't work 100% right. After the component loses focus caption still displays as "(count) item1, item2, item3, ..." and changes to correct one after the grid is refreshed.

I've also noticed that when I put a breakpoint in my blurlistener and click somewhere else in my app the caption changes to "(count) item1, item2, item3, ...", so it it works like a focus listener.

I've looked everywhere in your code and I don't think that your component makes that problem. Do you have any idea what is causing this?

When i close DropDown TextField is empty

Hello,
I have ComboBoxMultiselect component with disabled TextInput. When i close dropdown by clicking on the component, TextField is empty, but if i click somewhere to focus out from component TextField is filled with values. It is necessary that after clicking on component to close drop down, text field was filled with selected items.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.