use of com.vaadin.flow.component.textfield.TextField in project iesi by metadew.
the class ConnectionView method createTopBar.
public HorizontalLayout createTopBar() {
filter = new TextField();
filter.setPlaceholder("Filter name or description");
// Apply the filter to grid's data provider. TextField value is never null
filter.addValueChangeListener(event -> dataProvider.setFilter(event.getValue()));
filter.addFocusShortcut(Key.KEY_F, KeyModifier.CONTROL);
newConnection = new Button("New Connection");
newConnection.addThemeVariants(ButtonVariant.LUMO_PRIMARY);
newConnection.setIcon(VaadinIcon.PLUS_CIRCLE.create());
newConnection.addClickListener(click -> viewLogic.newConnection());
// CTRL+N will create a new window which is unavoidable
newConnection.addClickShortcut(Key.KEY_N, KeyModifier.ALT);
HorizontalLayout topLayout = new HorizontalLayout();
topLayout.setWidth("100%");
topLayout.add(filter);
topLayout.add(newConnection);
topLayout.setVerticalComponentAlignment(Alignment.START, filter);
topLayout.expand(filter);
return topLayout;
}
use of com.vaadin.flow.component.textfield.TextField in project iesi by metadew.
the class EnvironmentView method createTopBar.
public HorizontalLayout createTopBar() {
filter = new TextField();
filter.setPlaceholder("Filter name or description");
// Apply the filter to grid's data provider. TextField value is never null
filter.addValueChangeListener(event -> dataProvider.setFilter(event.getValue()));
filter.addFocusShortcut(Key.KEY_F, KeyModifier.CONTROL);
newEnvironment = new Button("New Environment");
newEnvironment.addThemeVariants(ButtonVariant.LUMO_PRIMARY);
newEnvironment.setIcon(VaadinIcon.PLUS_CIRCLE.create());
newEnvironment.addClickListener(click -> viewLogic.newEnvironment());
// CTRL+N will create a new window which is unavoidable
newEnvironment.addClickShortcut(Key.KEY_N, KeyModifier.ALT);
HorizontalLayout topLayout = new HorizontalLayout();
topLayout.setWidth("100%");
topLayout.add(filter);
topLayout.add(newEnvironment);
topLayout.setVerticalComponentAlignment(Alignment.START, filter);
topLayout.expand(filter);
return topLayout;
}
use of com.vaadin.flow.component.textfield.TextField in project iesi by metadew.
the class AdminView method createCategoryEditor.
private Component createCategoryEditor(Category category) {
TextField nameField = new TextField();
if (category.getId() < 0) {
nameField.focus();
}
Button deleteButton = new Button(VaadinIcon.MINUS_CIRCLE_O.create(), event -> {
DataService.get().deleteCategory(category.getId());
dataProvider.getItems().remove(category);
dataProvider.refreshAll();
Notification.show("Category Deleted.");
});
deleteButton.addThemeVariants(ButtonVariant.LUMO_ERROR);
BeanValidationBinder<Category> binder = new BeanValidationBinder<>(Category.class);
binder.forField(nameField).bind("name");
binder.setBean(category);
binder.addValueChangeListener(event -> {
if (binder.isValid()) {
DataService.get().updateCategory(category);
deleteButton.setEnabled(true);
newCategoryButton.setEnabled(true);
Notification.show("Category Saved.");
}
});
deleteButton.setEnabled(category.getId() > 0);
HorizontalLayout layout = new HorizontalLayout(nameField, deleteButton);
layout.setFlexGrow(1);
return layout;
}
use of com.vaadin.flow.component.textfield.TextField in project bookstore-example by vaadin.
the class InventoryView method createTopBar.
public HorizontalLayout createTopBar() {
filter = new TextField();
filter.setPlaceholder("Filter name, availability or category");
// Apply the filter to grid's data provider. TextField value is never
filter.addValueChangeListener(event -> dataProvider.setFilter(event.getValue()));
// A shortcut to focus on the textField by pressing ctrl + F
filter.addFocusShortcut(Key.KEY_F, KeyModifier.CONTROL);
newProduct = new Button("New product");
// Setting theme variant of new production button to LUMO_PRIMARY that
// changes its background color to blue and its text color to white
newProduct.addThemeVariants(ButtonVariant.LUMO_PRIMARY);
newProduct.setIcon(VaadinIcon.PLUS_CIRCLE.create());
newProduct.addClickListener(click -> viewLogic.newProduct());
// A shortcut to click the new product button by pressing ALT + N
newProduct.addClickShortcut(Key.KEY_N, KeyModifier.ALT);
final HorizontalLayout topLayout = new HorizontalLayout();
topLayout.setWidth("100%");
topLayout.add(filter);
topLayout.add(newProduct);
topLayout.setVerticalComponentAlignment(Alignment.START, filter);
topLayout.expand(filter);
return topLayout;
}
use of com.vaadin.flow.component.textfield.TextField in project furms by unity-idm.
the class ProjectsView method createSearchFilterLayout.
private HorizontalLayout createSearchFilterLayout(Grid<ProjectViewGridModel> grid, Button addButton) {
TextField textField = new TextField();
textField.setPlaceholder(getTranslation("view.community-admin.projects.field.search"));
textField.setPrefixComponent(SEARCH.create());
textField.setValueChangeMode(ValueChangeMode.EAGER);
textField.setClearButtonVisible(true);
textField.addValueChangeListener(event -> {
String value = textField.getValue().toLowerCase();
List<ProjectViewGridModel> filteredUsers = projectsViewDataSnapshot.projectViewGridModels.stream().filter(project -> project.matches(value)).collect(toList());
grid.setItems(filteredUsers);
// TODO This is a work around to fix disappearing text cursor
addButton.focus();
textField.focus();
});
HorizontalLayout search = new HorizontalLayout(textField);
search.setJustifyContentMode(FlexComponent.JustifyContentMode.END);
return search;
}
Aggregations