use of com.vaadin.flow.component.textfield.IntegerField in project flow-components by vaadin.
the class ValueChangeModePage method initView.
private void initView() {
message = new Div();
message.setId("message");
add(message);
Stream.of(new TextField(), new TextArea(), new PasswordField(), new NumberField(), new EmailField(), new IntegerField(), new BigDecimalField()).forEach(this::setupTestComponent);
}
use of com.vaadin.flow.component.textfield.IntegerField in project flow-components by vaadin.
the class HasLabelTest method integerField.
@Test
public void integerField() {
IntegerField c = new IntegerField();
Assert.assertTrue(c instanceof HasLabel);
}
use of com.vaadin.flow.component.textfield.IntegerField in project flow-components by vaadin.
the class ComboBoxView method filteringAndSortingWithDataView.
private void filteringAndSortingWithDataView() {
// PersonService can be found:
// https://github.com/vaadin/vaadin-combo-box-flow/tree/master/vaadin-combo-box-flow-demo/src/main/java/com/vaadin/flow/component/combobox/demo/service/PersonService.java
ComboBox<Person> comboBox = new ComboBox<>("Persons");
PersonService personService = new PersonService();
// We fetch the items to the memory and bind the obtained collection
// to the combo box
Collection<Person> persons = personService.fetchAll();
ComboBoxListDataView<Person> dataView = comboBox.setItems(persons);
/*
* Providing a predicate item filter allows filtering by any field of
* the business entity and apply a combo box's text filter independently
*/
IntegerField personAgeFilter = new IntegerField(event -> dataView.setFilter(person -> event.getValue() == null || person.getAge() > event.getValue()));
/*
* Providing a value provider or comparator allows sorting combo box's
* items by custom field, or combination of fields
*/
Button sortPersons = new Button("Sort Persons by Name", event -> dataView.setSortOrder(Person::toString, SortDirection.ASCENDING));
personAgeFilter.setLabel("Filter Persons with age more than:");
personAgeFilter.setWidth(WIDTH_STRING);
addCard("Filtering", "Filtering and Sorting with Data View", comboBox, personAgeFilter, sortPersons);
}
use of com.vaadin.flow.component.textfield.IntegerField in project flow-components by vaadin.
the class AbstractItemCountGridPage method initDataCommunicatorOptions.
private void initDataCommunicatorOptions() {
IntegerField pageSizeInput = new IntegerField("Page Size", event -> {
grid.setPageSize(event.getValue());
});
pageSizeInput.setValue(grid.getPageSize());
pageSizeInput.setWidthFull();
menuBar.add("DataCommunicator Configuration");
menuBar.add(pageSizeInput);
}
use of com.vaadin.flow.component.textfield.IntegerField in project furms by unity-idm.
the class AlarmFormView method prepareValidator.
private void prepareValidator(TextField nameField, ComboBox<String> allocationComboBox, IntegerField thresholdField, Checkbox checkbox, MultiselectComboBox<String> multiselectComboBox) {
binder.forField(nameField).withValidator(value -> Objects.nonNull(value) && !value.isBlank(), getTranslation("view.project-admin.alarms.form.error.name")).bind(model -> model.name, (model, name) -> model.name = name);
binder.forField(allocationComboBox).withValidator(Objects::nonNull, getTranslation("view.project-admin.alarms.form.error.allocation")).bind(model -> model.allocationId, (model, id) -> model.allocationId = id);
binder.forField(thresholdField).withValidator(threshold -> threshold >= 1.0 && threshold <= 100.0, getTranslation("view.project-admin.alarms.form.error.threshold")).bind(model -> model.threshold, (model, threshold) -> model.threshold = threshold);
binder.forField(checkbox).bind(model -> model.allUsers, (model, value) -> model.allUsers = value);
binder.forField(multiselectComboBox).withValidator(emails -> emails.stream().noneMatch(email -> emailValidator.apply(email, new ValueContext()).isError()), getTranslation("view.project-admin.alarms.form.error.emails")).bind(model -> model.users, (model, policyFile) -> model.users = multiselectComboBox.getSelectedItems());
}
Aggregations