Search in sources :

Example 6 with NumberField

use of com.vaadin.flow.component.textfield.NumberField in project karnak by OsiriX-Foundation.

the class CSVDialog method setElement.

private void setElement() {
    divTitle = new Div();
    divTitle.setText(TITLE);
    divTitle.getStyle().set("font-size", "large").set("font-weight", "bolder").set("padding-bottom", "10px");
    divGridContent = new Div();
    errorMsg = new Div();
    errorMsg.getStyle().set("font-weight", "bolder").set("padding-bottom", "10px").set("color", "red");
    fromLineField = new NumberField("From line ");
    fromLineField.setValue(1d);
    fromLineField.setHasControls(true);
    fromLineField.setMin(1);
    fromLineField.setMax((double) allRows.size() + 1);
    readCSVButton = new Button("Upload CSV", event -> {
        if (selectValuesPositionHashMap.get(EXTERNAL_PSEUDONYM).equals(-1) || selectValuesPositionHashMap.get(PATIENT_ID).equals(-1) || selectValuesPositionHashMap.get(PATIENT_FIRST_NAME).equals(-1) || selectValuesPositionHashMap.get(PATIENT_LAST_NAME).equals(-1)) {
            generateErrorMsg();
        } else {
            readCSVPatients();
            close();
        }
    });
    readCSVButton.addThemeVariants(ButtonVariant.LUMO_PRIMARY);
    readCSVButton.setIcon(VaadinIcon.PLUS_CIRCLE.create());
    cancelButton = new Button("Cancel", event -> close());
}
Also used : Div(com.vaadin.flow.component.html.Div) Grid(com.vaadin.flow.component.grid.Grid) CachedPatient(org.karnak.backend.cache.CachedPatient) Logger(org.slf4j.Logger) ButtonVariant(com.vaadin.flow.component.button.ButtonVariant) Select(com.vaadin.flow.component.select.Select) NumberField(com.vaadin.flow.component.textfield.NumberField) HorizontalLayout(com.vaadin.flow.component.orderedlayout.HorizontalLayout) LoggerFactory(org.slf4j.LoggerFactory) Div(com.vaadin.flow.component.html.Div) VaadinIcon(com.vaadin.flow.component.icon.VaadinIcon) CSVReader(liquibase.util.csv.opencsv.CSVReader) IOException(java.io.IOException) HashMap(java.util.HashMap) InputStreamReader(java.io.InputStreamReader) Collectors(java.util.stream.Collectors) ArrayList(java.util.ArrayList) Button(com.vaadin.flow.component.button.Button) List(java.util.List) Stream(java.util.stream.Stream) Map(java.util.Map) ProjectEntity(org.karnak.backend.data.entity.ProjectEntity) Dialog(com.vaadin.flow.component.dialog.Dialog) InputStream(java.io.InputStream) Button(com.vaadin.flow.component.button.Button) NumberField(com.vaadin.flow.component.textfield.NumberField)

Example 7 with NumberField

use of com.vaadin.flow.component.textfield.NumberField in project karnak by OsiriX-Foundation.

the class PseudonymInDicomTagComponent method setElements.

public void setElements() {
    delimiter = new TextField("Delimiter");
    tag = new TextField("Tag");
    position = new NumberField("Position");
    position.setHasControls(true);
    position.setMin(0);
    position.setStep(1);
    savePseudonym = new Checkbox("Save pseudonym in Mainzelliste");
    savePseudonym.getStyle().set("margin-top", "30px");
    savePseudonym.setValue(true);
}
Also used : Checkbox(com.vaadin.flow.component.checkbox.Checkbox) TextField(com.vaadin.flow.component.textfield.TextField) NumberField(com.vaadin.flow.component.textfield.NumberField)

Example 8 with NumberField

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

the class HasLabelTest method numberField.

@Test
public void numberField() {
    NumberField c = new NumberField();
    Assert.assertTrue(c instanceof HasLabel);
}
Also used : HasLabel(com.vaadin.flow.component.HasLabel) NumberField(com.vaadin.flow.component.textfield.NumberField) Test(org.junit.Test)

Example 9 with NumberField

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

the class NumberFieldTest method testValuePropertyFormatting.

private void testValuePropertyFormatting(double value, String expected) {
    final NumberField numberField = new NumberField();
    numberField.setValue(value);
    assertEquals(expected, numberField.getElement().getProperty("value"));
}
Also used : NumberField(com.vaadin.flow.component.textfield.NumberField)

Example 10 with NumberField

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

the class NumberFieldPage method addNumberFields.

private void addNumberFields() {
    NumberField dollarField = new NumberField("Dollars");
    dollarField.setPrefixComponent(new Span("$"));
    NumberField euroField = new NumberField("Euros");
    euroField.setSuffixComponent(new Span("€"));
    NumberField stepperField = new NumberField("Stepper");
    stepperField.setValue(1d);
    stepperField.setMin(0);
    stepperField.setMax(10);
    stepperField.setHasControls(true);
    euroField.setSuffixComponent(new Span("€"));
    dollarField.setId("dollar-field");
    euroField.setId("euro-field");
    stepperField.setId("step-number-field");
    add(dollarField, euroField, stepperField);
}
Also used : Span(com.vaadin.flow.component.html.Span) NumberField(com.vaadin.flow.component.textfield.NumberField)

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