I just put my
AutocompleteField in the Vaadin directory. It’s a text input that displays suggestions in a popup while the user is typing. The query is tipically run against some search service, and you can be notified when the user selects an option, or can later read the text when processing another event.
It’s kind of a ComboBox, but without a backing Container because options are retrieved dynamically.
@Kim, screenshot attached. The code sample can be seen on
GitHub , and if you need any advice on how to use it, don’t hesitate to ask. At the moment the API is experimental, so I don’t want to spread snippets that will be out-of-date in the next few hours around the world. As soon as possible I’ll put the demo on GAE.
If anyone is interested in reviewing the code or participating in the development, please let me know.
Widgetset ‘com.vaadin.DefaultWidgetSet’ does not contain implementation for com.zybnet.autocomplete.server.AutocompleteField. Check its component connector’s @Connect mapping, widgetsets GWT module description file and re-compile your widgetset. In case you have downloaded a vaadin add-on package, you might want to refer to add-on instructions.
You have to declare and compile a custom widgetset for your project.
Create a .gwt.xml File in your project as explained here:
https://vaadin.com/book/vaadin6/-/page/gwt.widgetset.html (You mainly need the inherit from the DefaultWidgetset not the set-property or anything else).
Then you have to define the widgetset inside your web.xml or ServletAnnotation and compile it (described here
https://vaadin.com/book/vaadin6/-/page/addons.compiling.html in case you have the annotations it would be something like widgetset=com…yourwidgetset).
There should be enough information on the web if you get stuck. It’s pretty much the same process for all addons which have client side coding.
The input is a
VTextField , and it has the required API, but currently neither the client nor the server side of the component expose it. I’m not sure I want to add these APIs because Vaadin widgets don’t do it and I guess there is a reason (maybe it’s simply to prevent blocking the UI for the time of the round trip in the case of such a lightweight and recurring event). May I ask why you need it?
Is this the first time you try to use a client-side component from the Vaadin directory in this project? I see you use Maven to compile the widgetset, but I have not put the addon on Central yet, so you may have troubles in actually adding the JAR to the path searched by the GWT compiler. Can you make a
gist of your pom.xml? If your project is on GitHub or any other public repository, please link to it, so we can run the command in the same environment as you
I want to register a shortcutListener to the autocompleteField while it has focus.
So I add the Shortcut when the component got focus and remove it when it loses focus.
What I meant was, what’s wrong if you simply use
AutocompleteField.addShortcutListener (inherited from AbstractComponent) instead of adding/removing the listener when the text box is focused?
We have several components like ComboBox, TextField, AutocompleteField,… on a panel. Every component has a shortcut (the same keys for all components) to open a helptext. So, the shortcut should only work if the cursor is in the component so that we know which component is on focus and that we can display the right text for each component.
After looking at the APIs for TextField and ComboBox, I realized my assumptions were wrong: both expose the API to add focus and blur listeners, so the AutocompleteField should do the same
It should be really easy to add this functionality: you can fork the project on GH and send me a pull request to speed things up.
In the meanwhile, I added this stuff to me queue and will address it in the next few days