use of com.vaadin.flow.component.textfield.TextField in project flow-components by vaadin.
the class TreeGridComponentHierarchyColumnPage method createTextField.
private TextField createTextField(String value) {
TextField textField = new TextField();
textField.setReadOnly(true);
textField.setValue(value);
return textField;
}
use of com.vaadin.flow.component.textfield.TextField in project flow-components by vaadin.
the class FormLayoutView method createResponsiveLayout.
private void createResponsiveLayout() {
FormLayout nameLayout = new FormLayout();
TextField titleField = new TextField();
titleField.setLabel("Title");
titleField.setPlaceholder("Sir");
TextField firstNameField = new TextField();
firstNameField.setLabel("First name");
firstNameField.setPlaceholder("John");
TextField lastNameField = new TextField();
lastNameField.setLabel("Last name");
lastNameField.setPlaceholder("Doe");
nameLayout.add(titleField, firstNameField, lastNameField);
// Default number of columns in a FormLayout is 2. By setting the
// responsive steps we specify different numbers for columns with
// breakpoints at “40em” “32em” and “25em”. Now by changing the size of
// the browser horizontally, you can notice that the number of the
// columns in the FormLayout changes.
nameLayout.setResponsiveSteps(new ResponsiveStep("1px", 1), new ResponsiveStep("600px", 2), new ResponsiveStep("700px", 3));
addCard("A form layout with custom responsive layouting", nameLayout);
}
use of com.vaadin.flow.component.textfield.TextField in project DoodleVerse by davidemarcoli.
the class CitizenManagementView method createEditor.
/**
* Create the CRUD Editor
* @return the CrudEditor
*/
private CrudEditor<Person> createEditor() {
TextField firstName = new TextField("First name");
TextField lastName = new TextField("Last name");
NumberField money = new NumberField("Money");
money.setReadOnly(true);
Double randomMoneyAmount = rand.nextDouble(100000 + 1 - 10000) + 10000;
money.setValue(randomMoneyAmount);
FormLayout form = new FormLayout(firstName, lastName, money);
form.setColspan(money, 2);
form.setMaxWidth("480px");
form.setResponsiveSteps(new FormLayout.ResponsiveStep("0", 1), new FormLayout.ResponsiveStep("30em", 2));
Binder<Person> binder = new Binder<>(Person.class);
binder.forField(firstName).asRequired().bind(Person::getFirstName, Person::setFirstName);
binder.forField(lastName).asRequired().bind(Person::getLastName, Person::setLastName);
binder.forField(money).asRequired().bind(Person::getMoney, Person::setMoney).setReadOnly(true);
return new BinderCrudEditor<>(binder, form);
}
use of com.vaadin.flow.component.textfield.TextField in project iesi by metadew.
the class TemplateView 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);
newRequestTemplate = new Button("New Template");
newRequestTemplate.addThemeVariants(ButtonVariant.LUMO_PRIMARY);
newRequestTemplate.setIcon(VaadinIcon.PLUS_CIRCLE.create());
newRequestTemplate.addClickListener(click -> viewLogic.newRequestTemplate());
// CTRL+N will create a new window which is unavoidable
newRequestTemplate.addClickShortcut(Key.KEY_N, KeyModifier.ALT);
HorizontalLayout topLayout = new HorizontalLayout();
topLayout.setWidth("100%");
topLayout.add(filter);
topLayout.add(newRequestTemplate);
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 ComponentView 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);
newComponent = new Button("New Component");
newComponent.addThemeVariants(ButtonVariant.LUMO_PRIMARY);
newComponent.setIcon(VaadinIcon.PLUS_CIRCLE.create());
newComponent.addClickListener(click -> viewLogic.newComponent());
// CTRL+N will create a new window which is unavoidable
newComponent.addClickShortcut(Key.KEY_N, KeyModifier.ALT);
HorizontalLayout topLayout = new HorizontalLayout();
topLayout.setWidth("100%");
topLayout.add(filter);
topLayout.add(newComponent);
topLayout.setVerticalComponentAlignment(Alignment.START, filter);
topLayout.expand(filter);
return topLayout;
}
Aggregations