Search in sources :

Example 91 with TextField

use of com.vaadin.flow.component.textfield.TextField in project sapl-demos by heutelbeck.

the class SingleAndMultisubscriptionPage method crateMultisubscriptionLayout.

private VerticalLayout crateMultisubscriptionLayout(PepBuilderService pepBuilderService) {
    H3 multiSubscriptionH3 = new H3("Multisubscription");
    var buttonResource = JsonNodeFactory.instance.objectNode().put("object", "button").put("page", "SingleAndMultisubscription");
    var textfieldResource = JsonNodeFactory.instance.objectNode().put("object", "textfield").put("page", "SingleAndMultisubscription");
    Button button1 = new Button("access enforced by multisubscription");
    Button button2 = new Button("visibility enforced by multisubscription");
    TextField textField1 = new TextField("access enforced by multisubscription");
    // @formatter:off
    pepBuilderService.getMultiBuilder().subject("dummy").with(button1).action("view_component").resource(buttonResource).onDecisionEnableOrDisable().and(button2).action("view_component").resource(buttonResource).onDecisionVisibleOrHidden().and().with(textField1).action("view_component").resource(textfieldResource).onDecisionEnableOrDisable().build();
    // @formatter:on
    VerticalLayout multisubscriptionLayout = new VerticalLayout();
    multisubscriptionLayout.setMaxWidth("600px");
    multisubscriptionLayout.add(multiSubscriptionH3);
    // add info
    multisubscriptionLayout.add(Utilities.getInfoText("access to buttons is granted/revoked in a 5 seconds interval " + "by the policy \"grant_access_to_buttons_on_singleAndMultisubscription_page\"\n" + "- decision is enforced on the 1. Button by disabling/enabling the button\n" + "- decision is enforced on the 2. Button by hiding/showing the button"), Utilities.getInfoText("access to textbox is granted/revoked in a 6 seconds interval " + "by the policy \"grant_access_to_textfields_on_singleAndMultisubscription_page\".\n" + "- decision is enforced on the TextField by disabling/enabling the TextField"));
    // add and format components
    multisubscriptionLayout.add(button1);
    button1.setWidth("100%");
    multisubscriptionLayout.add(button2);
    button2.setWidth("100%");
    multisubscriptionLayout.add(textField1);
    textField1.setWidth("100%");
    return multisubscriptionLayout;
}
Also used : Button(com.vaadin.flow.component.button.Button) TextField(com.vaadin.flow.component.textfield.TextField) VerticalLayout(com.vaadin.flow.component.orderedlayout.VerticalLayout) H3(com.vaadin.flow.component.html.H3)

Example 92 with TextField

use of com.vaadin.flow.component.textfield.TextField 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 93 with TextField

use of com.vaadin.flow.component.textfield.TextField 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 94 with TextField

use of com.vaadin.flow.component.textfield.TextField 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)

Example 95 with TextField

use of com.vaadin.flow.component.textfield.TextField in project ArchCNL by Mari-Wie.

the class ConceptEditorView method addThenTripletView.

@Override
protected void addThenTripletView() {
    subjectComponent = new VariableSelectionComponent();
    subjectComponent.setLabel("Subject");
    addListenersToSubjectComponent();
    TextField predicateField = new TextField("Predicate");
    predicateField.setValue("is-of-type");
    predicateField.setReadOnly(true);
    conceptNameField = new TextField("Object");
    conceptNameField.setReadOnly(true);
    HorizontalLayout thenTriplet = new HorizontalLayout();
    thenTriplet.add(subjectComponent, predicateField, conceptNameField);
    add(thenTriplet);
}
Also used : TextField(com.vaadin.flow.component.textfield.TextField) VariableSelectionComponent(org.archcnl.ui.common.andtriplets.triplet.VariableSelectionComponent) HorizontalLayout(com.vaadin.flow.component.orderedlayout.HorizontalLayout)

Aggregations

TextField (com.vaadin.flow.component.textfield.TextField)227 Test (org.junit.jupiter.api.Test)61 Button (com.vaadin.flow.component.button.Button)54 Div (com.vaadin.flow.component.html.Div)38 HorizontalLayout (com.vaadin.flow.component.orderedlayout.HorizontalLayout)32 FormLayout (com.vaadin.flow.component.formlayout.FormLayout)29 Binder (com.vaadin.flow.data.binder.Binder)29 GeneratedVaadinTextField (com.vaadin.flow.component.textfield.GeneratedVaadinTextField)28 Element (com.vaadin.flow.dom.Element)26 VerticalLayout (com.vaadin.flow.component.orderedlayout.VerticalLayout)23 Route (com.vaadin.flow.router.Route)21 Component (com.vaadin.flow.component.Component)16 Checkbox (com.vaadin.flow.component.checkbox.Checkbox)15 BinderCrudEditor (com.vaadin.flow.component.crud.BinderCrudEditor)15 Grid (com.vaadin.flow.component.grid.Grid)15 Span (com.vaadin.flow.component.html.Span)15 List (java.util.List)15 EmailField (com.vaadin.flow.component.textfield.EmailField)14 TextArea (com.vaadin.flow.component.textfield.TextArea)14 Test (org.junit.Test)14