-
Notifications
You must be signed in to change notification settings - Fork 2
Home
Tapestry-tagselect is a select component for Tapestry 5 with modes similar to the version selector in recent JIRA-versions as well as the language selector on Facebook.
Add a dependency to your POM (for Tapestry 5.2.6 use version 1.4 instead of 1.4.1 which is for Tapestry 5.3.2):
<dependency>
<groupId>se.unbound</groupId>
<artifactId>tapestry-tagselect</artifactId>
<version>1.4.1</version>
</dependency>
Add the component to your template:
<div t:type="tag/tagselect" t:id="tags" t:value="tags" t:encoder="encoder" />
In your page you need a property for the currently selected tags. If the property is a Collection the component allows multi-select, otherwise it's single-select.
If the tags are strings, no encoder is necessary, otherwise a LabelAwareValueEncoder need to be provided via the encoder-attribute. The LabelAwareValueEncoder is a special extension of the standard Tapestry ValueEncoder with the small addition of being able to get a label for the value.
The component uses an Ajax.Autocompleter when retrieving the possible tag-values so a method for the provideCompletions-event that return a SelectModel is necessary in the page-class as well.
You can choose to not show the dropdown-arrow (using t:dropdown="false" in the template) as well as having each tag be presented as a separate input-field similar to the Facebook language-selection using t:vertical="true" in the template.