Search in sources :

Example 11 with IntegerField

use of com.vaadin.flow.component.textfield.IntegerField in project flow-components by vaadin.

the class AbstractItemCountComboBoxPage method initEstimateOptions.

private void initEstimateOptions() {
    menuBar.add("Item Count Estimate Configuration");
    itemCountEstimateInput = new IntegerField("setItemCountEstimate", event -> comboBox.getLazyDataView().setItemCountEstimate(event.getValue()));
    itemCountEstimateInput.setId(ITEM_COUNT_ESTIMATE_INPUT);
    itemCountEstimateInput.setWidthFull();
    itemCountEstimateIncreaseInput = new IntegerField("setItemCountEstimateIncrease", event -> comboBox.getLazyDataView().setItemCountEstimateIncrease(event.getValue()));
    itemCountEstimateIncreaseInput.setId(ITEM_COUNT_ESTIMATE_INCREASE_INPUT);
    itemCountEstimateIncreaseInput.setWidthFull();
    menuBar.add(itemCountEstimateInput, itemCountEstimateIncreaseInput);
}
Also used : IntStream(java.util.stream.IntStream) Query(com.vaadin.flow.data.provider.Query) BeforeEnterEvent(com.vaadin.flow.router.BeforeEnterEvent) VerticalLayout(com.vaadin.flow.component.orderedlayout.VerticalLayout) Div(com.vaadin.flow.component.html.Div) NativeButton(com.vaadin.flow.component.html.NativeButton) AbstractBackEndDataProvider(com.vaadin.flow.data.provider.AbstractBackEndDataProvider) Hr(com.vaadin.flow.component.html.Hr) Logger(java.util.logging.Logger) ComboBox(com.vaadin.flow.component.combobox.ComboBox) Checkbox(com.vaadin.flow.component.checkbox.Checkbox) Stream(java.util.stream.Stream) FlexLayout(com.vaadin.flow.component.orderedlayout.FlexLayout) IntegerField(com.vaadin.flow.component.textfield.IntegerField) RouterLink(com.vaadin.flow.router.RouterLink) BeforeEnterObserver(com.vaadin.flow.router.BeforeEnterObserver) Range(com.vaadin.flow.internal.Range) IntegerField(com.vaadin.flow.component.textfield.IntegerField)

Example 12 with IntegerField

use of com.vaadin.flow.component.textfield.IntegerField in project testbench by vaadin.

the class ComponentQueryTest method withValue_matchingValue_findsComponent.

@Test
void withValue_matchingValue_findsComponent() {
    Element rootElement = getCurrentView().getElement();
    TextField targetField = new TextField();
    String targetValue = "expected value";
    targetField.setValue(targetValue);
    rootElement.appendChild(targetField.getElement());
    TextField otherField = new TextField();
    otherField.setValue("Another value");
    int targetNumericValue = 33;
    IntegerField numericField = new IntegerField();
    numericField.setValue(targetNumericValue);
    rootElement.appendChild(otherField.getElement());
    rootElement.appendChild(numericField.getElement());
    rootElement.appendChild(new TextField().getElement());
    Assertions.assertSame(targetField, $(Component.class).withValue(targetValue).first().getComponent());
    Assertions.assertSame(numericField, $(Component.class).withValue(targetNumericValue).first().getComponent());
}
Also used : Element(com.vaadin.flow.dom.Element) GeneratedVaadinTextField(com.vaadin.flow.component.textfield.GeneratedVaadinTextField) TextField(com.vaadin.flow.component.textfield.TextField) IntegerField(com.vaadin.flow.component.textfield.IntegerField) Test(org.junit.jupiter.api.Test)

Aggregations

IntegerField (com.vaadin.flow.component.textfield.IntegerField)12 Div (com.vaadin.flow.component.html.Div)7 Checkbox (com.vaadin.flow.component.checkbox.Checkbox)6 ComboBox (com.vaadin.flow.component.combobox.ComboBox)5 FlexLayout (com.vaadin.flow.component.orderedlayout.FlexLayout)5 VerticalLayout (com.vaadin.flow.component.orderedlayout.VerticalLayout)5 Button (com.vaadin.flow.component.button.Button)4 Hr (com.vaadin.flow.component.html.Hr)4 TextField (com.vaadin.flow.component.textfield.TextField)4 AbstractBackEndDataProvider (com.vaadin.flow.data.provider.AbstractBackEndDataProvider)4 Query (com.vaadin.flow.data.provider.Query)4 Range (com.vaadin.flow.internal.Range)4 BeforeEnterObserver (com.vaadin.flow.router.BeforeEnterObserver)4 RouterLink (com.vaadin.flow.router.RouterLink)4 Logger (java.util.logging.Logger)4 IntStream (java.util.stream.IntStream)4 Stream (java.util.stream.Stream)4 FormLayout (com.vaadin.flow.component.formlayout.FormLayout)2 Grid (com.vaadin.flow.component.grid.Grid)2 NativeButton (com.vaadin.flow.component.html.NativeButton)2