Vaadin 7 wrapper for the Selectize.js jquery plugin. https://github.com/selectize/selectize.js
- Easy fluent api
- Annotations to figure out value, label, sorting and search properties
- @SelectizeOptionLabel
- @SelectizeOptionSearch
- @SelectizeOptionSort
- @SelectizeOptionValue
- Typed fields for both multi and single select
- SelectizeDropDownField ... Single select
- SelectizeTokenField ... Multi select, Token field
- Both fields are fitting nicely into Valo themed form layout with light styles
- Readonly supported
- Buildin themes
If you want to run the demo application locally, see the Contribution Section
Get the addon from https://vaadin.com/directory#!addon/selectize-add-on.
You can download the addon there as well, but you will need to create a free vaadin account first. For Maven style dependencies please use below settings.
Repository
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>bintray</name>
<url>http://jcenter.bintray.com</url>
</repository>
</repositories>
Dependency
<dependencies>
<dependency>
<groupId>com.byteowls</groupId>
<artifactId>vaadin-selectize</artifactId>
<version>0.2.0</version>
</dependency>
</dependencies>
Repository
repositories {
jcenter()
}
Dependency
dependencies {
compile ("com.byteowls:vaadin-selectize:0.2.0")
}
For more examples please see the demo app
public void buildField() {
SelectizeTokenField<PersonEntity> tokenField = new SelectizeTokenField<>(PersonEntity.class, "Tokens");
tokenField.config()
.plugins(Plugin.REMOVE_BUTTON)
.placeholder("Choose multiple items")
.optionLabelGenerator(c -> { return c.getFirstname() + " (" + c.getEmail() + ")"; })
.options(getRandomOptions(10));
}
public abstract class AbstractIdEntity {
@SelectizeOptionValue
private String id;
public AbstractIdEntity(String id) {
super();
this.id = id;
}
public String getId() {
return id;
}
}
public class PersonEntity extends AbstractIdEntity {
@SelectizeOptionSearch
@SelectizeOptionSort(order = 2)
private String firstname;
@SelectizeOptionSort(asc = false, order = 1)
private String lastname;
@SelectizeOptionLabel
private String email;
public PersonEntity(String id, String firstname, String lastname, String email) {
super(id);
this.firstname = firstname;
this.lastname = lastname;
this.email = email;
}
public String getFirstname() {
return firstname;
}
public String getLastname() {
return lastname;
}
public String getEmail() {
return email;
}
@Override
public String toString() {
return "PersonEntity [firstname=" + firstname + ", lastname=" + lastname + ", email=" + email + "]";
}
}
You will see that every fluent api method under selectize.config()
has a counterpart in the javascript json config. The javadoc is basically the description of those options.
- JDK 8
- Vaadin 7.4 or higher
- JDK 8
- Vaadin 7.7.+
This addon is only a wrapper. So if you have any feature requests or found any bugs in the javascript lib please use Selectize.js's issue tracker https://github.com/selectize/selectize.js/issues
In all other cases please create a issue at https://github.com/moberwasserlechner/vaadin-selectize/issues or contribute to the project yourself. For contribution see the next section.
- Fork repo
- Open command line
- Clone your fork
git@github.com:USERNAME/vaadin-selectize.git
cd vaadin-selectize
- Build eclipse meta data
./gradlew cleanEclipse eclipse
- Open Eclipse
- File -> Import... -> General -> Existing Projects into Workspace
- Browse to your git repository
- Check the option "Search for nested projects"
- Check all 3 projects
- Press finish
This should take not more than 1-2 minutes. You does not need to use any gradle eclipse plugins.
Please do not mix more than one issue in a feature branch. Each feature/bugfix should have its own branch and its own Pull Request (PR).
- Create a issue and describe what you want to do at Issue Tracker
- Create your feature branch (
git checkout -b feature/my-feature
orgit checkout -b bugfix/my-bugfix
) - Test your changes to the best of your ability.
- Add a demo view to the demo application
- Commit your changes (
git commit -m 'Describe feature or bug'
) - Push to the branch (
git push origin feature/my-feature
) - Create a Github Pull Request
The demo application is based on Spring Boot. So its possible to run the Demo as Java Application right out of Eclipse, there is not servlet container needed as Spring Boot has a embedded Tomcat 8 included.
- Open "Debug Configurations..." dialog
- Create a new "Java Application"
- Choose the "vaadin-selectize-demo" project
- Use "com.byteowls.vaadin.selectize.demo.AddonDemoApplication" as Main class
- Set
-Dprofile=dev
as VM argument. This ensures that source code panel in the demo is correctly filled while developing. - Browse to
http://localhost:8080/
Please use the sun coding convention. Please do not use tabs at all!
Apache-2.0. Please see LICENSE.
Please see Releases.