https://github.com/vaadin-component-factory/lookup-field-flow
Java API for a Lookup Field in Vaadin
https://github.com/vaadin-component-factory/lookup-field-flow
vaadin
Last synced: 3 months ago
JSON representation
Java API for a Lookup Field in Vaadin
- Host: GitHub
- URL: https://github.com/vaadin-component-factory/lookup-field-flow
- Owner: vaadin-component-factory
- License: apache-2.0
- Created: 2020-11-23T14:46:29.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-11-11T15:53:45.000Z (6 months ago)
- Last Synced: 2025-01-10T00:36:01.553Z (4 months ago)
- Topics: vaadin
- Language: Java
- Homepage: https://componentfactory.app.fi/lookup-field-flow-demo/
- Size: 187 KB
- Stars: 1
- Watchers: 9
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Lookup Field Flow
## Description
The Lookup field component allows you to search a specific record with:
* a combobox
* a dialog and a grid that can contains all the fields## Important information about versioning
**Component versions 23.x and 24.x were deprecated in order to follow Semanting Versioning practices. Please use latest version 3.x for Vaadin 23 and version 4/5.x for Vaadin 24.**## Compatibility
- Version 1.x.x -> Up to Vaadin 17.x.x
- Version 2.x.x -> Vaadin 17+
- Version 3.x.x -> Vaadin 23.x
- Version 4.x.x -> Vaadin 24.x
- Version 5.x.x -> Vaadin 24.x.x (improved accessibility)## Development instructions
Build the project and install the add-on locally:
```
mvn clean install
```
Starting the demo server:Go to lookup-field-flow-demo and run:
```
mvn jetty:run
```This deploys demo at http://localhost:8080
## How to use it
Create a new component LookupField and use it like a Field.
The API is quite similar to a Vaadin Combobox.## Examples
### Basic example with String
```
public SimpleView() {
LookupField lookupField = new LookupField<>();
List items = Arrays.asList("item1","item2", "item3");
lookupField.setDataProvider(DataProvider.ofCollection(items));
lookupField.getGrid().addColumn(s -> s).setHeader("item");
lookupField.setLabel("Item selector");
add(lookupField);
}
```### Basic example with an Object
```
public PersonView() {
LookupField lookupField = new LookupField<>(Person.class);
List items = getItems();
lookupField.setDataProvider(DataProvider.ofCollection(items));
lookupField.setGridWidth("900px");
lookupField.setHeader("Person Search");
add(lookupField);
}private List getItems() {
PersonService personService = new PersonService();
return personService.fetchAll();
}
```### Internationalization
You can change the captions of the buttons, dialog header, serach label.
```
public I18nView() {
LookupField lookupField = new LookupField<>();
List items = Arrays.asList("item1","item2", "item3");
lookupField.setDataProvider(DataProvider.ofCollection(items));
lookupField.getGrid().addColumn(s -> s).setHeader("item");
// set the label of the field
lookupField.setLabel("Item selector");
//set the header text of the dialog
lookupField.setHeader("utilisateurs");
// translate the cpations of the component
lookupField.setI18n(new LookupField.LookupFieldI18n()
.setSearcharialabel("Cliquer pour ouvrir la fenêtre de recherche")
.setSelect("Sélectionner")
.setHeaderprefix("Recherche:")
.setSearch("Recherche")
.setHeaderpostfix("")
.setCancel("Annuler"));
add(lookupField);
}
```## Demo
You can check the demo here: https://componentfactory.app.fi/lookup-field-flow-demo/
## Missing features or bugs
You can report any issue or missing feature on github: https://github.com/vaadin-component-factory/lookup-field-flow