Search in sources :

Example 1 with NumberField

use of com.vaadin.flow.component.textfield.NumberField 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);
}
Also used : Div(com.vaadin.flow.component.html.Div) TextArea(com.vaadin.flow.component.textfield.TextArea) EmailField(com.vaadin.flow.component.textfield.EmailField) TextField(com.vaadin.flow.component.textfield.TextField) IntegerField(com.vaadin.flow.component.textfield.IntegerField) PasswordField(com.vaadin.flow.component.textfield.PasswordField) NumberField(com.vaadin.flow.component.textfield.NumberField) BigDecimalField(com.vaadin.flow.component.textfield.BigDecimalField)

Example 2 with NumberField

use of com.vaadin.flow.component.textfield.NumberField 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);
}
Also used : FormLayout(com.vaadin.flow.component.formlayout.FormLayout) Binder(com.vaadin.flow.data.binder.Binder) TextField(com.vaadin.flow.component.textfield.TextField) BinderCrudEditor(com.vaadin.flow.component.crud.BinderCrudEditor) Person(com.dala.data.person.Person) NumberField(com.vaadin.flow.component.textfield.NumberField)

Example 3 with NumberField

use of com.vaadin.flow.component.textfield.NumberField in project Akros-Marketplace by AkrosAG.

the class CategoryView method createEditorFormComponents.

private Component createEditorFormComponents() {
    Div div = new Div();
    FormLayout formLayout = new FormLayout();
    formLayout.setResponsiveSteps(new ResponsiveStep("0", 1, LabelsPosition.TOP));
    txtCategoryId = new NumberField("categoryId (Column: CATEGORY_ID)");
    txtCategoryId.setReadOnly(true);
    ValueChangeListener<ValueChangeEvent<?>> listener = getUpdateSaveButtonValueChangeListener();
    txtDescription = new TextArea("description (Column: DESCRIPTION)");
    txtDescription.setId(TEXT_CONTROL_DESCRIPTION);
    txtDescription.setClassName("full-width");
    txtDescription.setRequired(true);
    txtDescription.setHeightFull();
    txtDescription.setValueChangeMode(ValueChangeMode.LAZY);
    txtDescription.addValueChangeListener(listener);
    txtShortDescription = new TextField("shortDescription (Column: SHORT_DESCRIPTON)");
    txtShortDescription.setClassName("full-width");
    txtShortDescription.setRequired(true);
    txtShortDescription.setValueChangeMode(ValueChangeMode.LAZY);
    txtShortDescription.addValueChangeListener(listener);
    formLayout.add(txtCategoryId, txtDescription, txtShortDescription);
    div.add(formLayout);
    return div;
}
Also used : Div(com.vaadin.flow.component.html.Div) FormLayout(com.vaadin.flow.component.formlayout.FormLayout) ValueChangeEvent(com.vaadin.flow.component.HasValue.ValueChangeEvent) TextArea(com.vaadin.flow.component.textfield.TextArea) TextField(com.vaadin.flow.component.textfield.TextField) NumberField(com.vaadin.flow.component.textfield.NumberField) ResponsiveStep(com.vaadin.flow.component.formlayout.FormLayout.ResponsiveStep)

Example 4 with NumberField

use of com.vaadin.flow.component.textfield.NumberField in project Akros-Marketplace by AkrosAG.

the class FieldTypeChooserView method createEditorFormComponents.

private Component createEditorFormComponents() {
    Div div = new Div();
    FormLayout formLayout = new FormLayout();
    formLayout.setResponsiveSteps(new ResponsiveStep("0", 1, LabelsPosition.TOP));
    txtFieldTypeChooseId = new NumberField("fieldTypeChooseId (Column: FIELD_TYPE_CHOOSE_ID)");
    txtFieldTypeChooseId.setReadOnly(true);
    ValueChangeListener<ValueChangeEvent<?>> listener = getUpdateSaveButtonValueChangeListener();
    txtDescription = new TextField("description (Column: DESCRIPTION)");
    txtDescription.setClassName("full-width");
    txtDescription.setRequired(true);
    txtDescription.addValueChangeListener(listener);
    txtDescription.setValueChangeMode(ValueChangeMode.LAZY);
    txtDescription.setId(TEXT_CONTROL_DESCRIPTION);
    txtSortNumber = new NumberField("sortNumber (Column: SORT_NUMBER)");
    txtSortNumber.setClassName("full-width");
    txtSortNumber.setRequiredIndicatorVisible(true);
    txtSortNumber.setValueChangeMode(ValueChangeMode.LAZY);
    txtSortNumber.addValueChangeListener(listener);
    formLayout.add(txtFieldTypeChooseId, txtDescription, txtSortNumber);
    div.add(formLayout);
    return div;
}
Also used : Div(com.vaadin.flow.component.html.Div) FormLayout(com.vaadin.flow.component.formlayout.FormLayout) ValueChangeEvent(com.vaadin.flow.component.HasValue.ValueChangeEvent) TextField(com.vaadin.flow.component.textfield.TextField) NumberField(com.vaadin.flow.component.textfield.NumberField) ResponsiveStep(com.vaadin.flow.component.formlayout.FormLayout.ResponsiveStep)

Example 5 with NumberField

use of com.vaadin.flow.component.textfield.NumberField in project Akros-Marketplace by AkrosAG.

the class FieldTypeView method createEditorFormComponents.

private Component createEditorFormComponents() {
    Div div = new Div();
    FormLayout formLayout = new FormLayout();
    formLayout.setResponsiveSteps(new ResponsiveStep("0", 1, LabelsPosition.TOP));
    ValueChangeListener<ValueChangeEvent<?>> listener = getUpdateSaveButtonValueChangeListener();
    txtFieldTypeId = new NumberField("fieldTypeId (Column: FIELD_TYPE_ID)");
    txtFieldTypeId.setReadOnly(true);
    txtDescription = new TextArea("description (Column: DESCRIPTION)");
    txtDescription.setClassName("full-width");
    txtDescription.setRequired(true);
    txtDescription.setHeightFull();
    txtDescription.setValueChangeMode(ValueChangeMode.LAZY);
    txtDescription.addValueChangeListener(listener);
    txtDescription.setId(TEXT_CONTROL_DESCRIPTION);
    txtShortDescription = new TextField("shortDescription (Column: SHORT_DESCRIPTON)");
    txtShortDescription.setClassName("full-width");
    txtShortDescription.setRequired(true);
    txtShortDescription.setValueChangeMode(ValueChangeMode.LAZY);
    txtShortDescription.addValueChangeListener(listener);
    comboFieldTypeDefinitions = new ComboBox<FieldTypeDefinition>("fieldTypeDefinitionId (Column: FIELD_TYPE_DEFINITION_ID)", fieldTypeDefinitionService.list());
    comboFieldTypeDefinitions.setItemLabelGenerator(e -> String.format("%d: %s", e.getFieldTypeDefinitionId(), e.getDescription()));
    comboFieldTypeDefinitions.setRequired(true);
    comboFieldTypeDefinitions.addValueChangeListener(listener);
    txtMinValue = new NumberField("minValue (Column: MIN_VALUE)");
    txtMinValue.setClassName("full-width");
    txtMinValue.setRequiredIndicatorVisible(true);
    txtMinValue.setValueChangeMode(ValueChangeMode.LAZY);
    txtMinValue.addValueChangeListener(listener);
    txtMaxValue = new NumberField("maxValue (Column: MAX_VALUE)");
    txtMaxValue.setClassName("full-width");
    txtMaxValue.setRequiredIndicatorVisible(true);
    txtMaxValue.setValueChangeMode(ValueChangeMode.LAZY);
    txtMaxValue.addValueChangeListener(listener);
    chkOffer = new Checkbox("offer (Column: OFFER)");
    chkOffer.setClassName("full-width");
    chkSearch = new Checkbox("search (Column: SEARCH)");
    chkSearch.setClassName("full-width");
    chkRequired = new Checkbox("required (Column: REQUIRED)");
    chkRequired.setClassName("full-width");
    chkSearchable = new Checkbox("searchable (Column: SEARCHABLE)");
    chkSearchable.setClassName("full-width");
    txtSortNumber = new NumberField("sortNumber (Column: SORT_NUMBER)");
    txtSortNumber.setClassName("full-width");
    txtSortNumber.setRequiredIndicatorVisible(true);
    txtSortNumber.setValueChangeMode(ValueChangeMode.LAZY);
    txtSortNumber.addValueChangeListener(listener);
    formLayout.add(txtFieldTypeId, txtDescription, txtShortDescription, comboFieldTypeDefinitions, txtMinValue, txtMaxValue, chkOffer, chkSearch, chkRequired, chkSearchable, txtSortNumber);
    div.add(formLayout);
    return div;
}
Also used : Div(com.vaadin.flow.component.html.Div) FormLayout(com.vaadin.flow.component.formlayout.FormLayout) ValueChangeEvent(com.vaadin.flow.component.HasValue.ValueChangeEvent) TextArea(com.vaadin.flow.component.textfield.TextArea) FieldTypeDefinition(ch.akros.marketplace.administration.dataservice.entity.FieldTypeDefinition) EFieldTypeDefinition(ch.akros.marketplace.administration.constants.EFieldTypeDefinition) Checkbox(com.vaadin.flow.component.checkbox.Checkbox) TextField(com.vaadin.flow.component.textfield.TextField) NumberField(com.vaadin.flow.component.textfield.NumberField) ResponsiveStep(com.vaadin.flow.component.formlayout.FormLayout.ResponsiveStep)

Aggregations

NumberField (com.vaadin.flow.component.textfield.NumberField)10 TextField (com.vaadin.flow.component.textfield.TextField)6 Div (com.vaadin.flow.component.html.Div)5 FormLayout (com.vaadin.flow.component.formlayout.FormLayout)4 ValueChangeEvent (com.vaadin.flow.component.HasValue.ValueChangeEvent)3 ResponsiveStep (com.vaadin.flow.component.formlayout.FormLayout.ResponsiveStep)3 TextArea (com.vaadin.flow.component.textfield.TextArea)3 Checkbox (com.vaadin.flow.component.checkbox.Checkbox)2 EFieldTypeDefinition (ch.akros.marketplace.administration.constants.EFieldTypeDefinition)1 FieldTypeDefinition (ch.akros.marketplace.administration.dataservice.entity.FieldTypeDefinition)1 Person (com.dala.data.person.Person)1 HasLabel (com.vaadin.flow.component.HasLabel)1 Button (com.vaadin.flow.component.button.Button)1 ButtonVariant (com.vaadin.flow.component.button.ButtonVariant)1 BinderCrudEditor (com.vaadin.flow.component.crud.BinderCrudEditor)1 Dialog (com.vaadin.flow.component.dialog.Dialog)1 Grid (com.vaadin.flow.component.grid.Grid)1 Span (com.vaadin.flow.component.html.Span)1 VaadinIcon (com.vaadin.flow.component.icon.VaadinIcon)1 HorizontalLayout (com.vaadin.flow.component.orderedlayout.HorizontalLayout)1