Search in sources :

Example 26 with TextArea

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

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

the class RuleCreatorView method initializeLayout.

private void initializeLayout(Optional<String> ruleString) {
    subject = new SubjectComponent();
    subject.addListener(RelationListUpdateRequestedEvent.class, this::fireEvent);
    subject.addListener(ConceptListUpdateRequestedEvent.class, this::fireEvent);
    subject.addListener(DetermineStatementComponentEvent.class, event -> verb.determineVerbComponent(event.getSource().getFirstModifierValue()));
    verb = new StatementComponent();
    verb.addListener(RelationListUpdateRequestedEvent.class, this::fireEvent);
    verb.addListener(ConceptListUpdateRequestedEvent.class, this::fireEvent);
    buttonsLayout = new HorizontalLayout();
    saveButton = new Button("Save Rule", e -> saveRule());
    cancelButton = new Button("Cancel", click -> fireEvent(new RulesWidgetRequestedEvent(this, true)));
    expertmodeCheckbox = new Checkbox("Activate Expertmode");
    expertmodeCheckbox.addClickListener(e -> activateExpertMode(expertmodeCheckbox.getValue()));
    buttonsLayout.setVerticalComponentAlignment(Alignment.CENTER, expertmodeCheckbox);
    buttonsLayout.setPadding(true);
    buttonsLayout.add(saveButton, cancelButton, expertmodeCheckbox);
    archRuleTextArea = new TextArea("Create new architecture rule");
    archRuleTextArea.setWidthFull();
    add(subject, verb, buttonsLayout);
    ruleString.ifPresent(rule -> {
        archRuleTextArea.setValue(rule);
        expertmodeCheckbox.setValue(true);
        activateExpertMode(true);
    });
}
Also used : ComponentEventListener(com.vaadin.flow.component.ComponentEventListener) ConceptListUpdateRequestedEvent(org.archcnl.ui.common.andtriplets.triplet.events.ConceptListUpdateRequestedEvent) RulesWidgetRequestedEvent(org.archcnl.ui.inputview.rulesormappingeditorview.events.RulesWidgetRequestedEvent) TextArea(com.vaadin.flow.component.textfield.TextArea) Registration(com.vaadin.flow.shared.Registration) HorizontalLayout(com.vaadin.flow.component.orderedlayout.HorizontalLayout) StatementComponent(org.archcnl.ui.inputview.rulesormappingeditorview.architectureruleeditor.components.verbcomponents.StatementComponent) SubjectComponent(org.archcnl.ui.inputview.rulesormappingeditorview.architectureruleeditor.components.subjectcomponents.SubjectComponent) ComponentEvent(com.vaadin.flow.component.ComponentEvent) RelationListUpdateRequestedEvent(org.archcnl.ui.common.andtriplets.triplet.events.RelationListUpdateRequestedEvent) Checkbox(com.vaadin.flow.component.checkbox.Checkbox) Button(com.vaadin.flow.component.button.Button) DetermineStatementComponentEvent(org.archcnl.ui.inputview.rulesormappingeditorview.architectureruleeditor.events.DetermineStatementComponentEvent) SaveRuleButtonPressedEvent(org.archcnl.ui.inputview.rulesormappingeditorview.architectureruleeditor.events.SaveRuleButtonPressedEvent) RulesOrMappingEditorView(org.archcnl.ui.inputview.rulesormappingeditorview.RulesOrMappingEditorView) Optional(java.util.Optional) Button(com.vaadin.flow.component.button.Button) TextArea(com.vaadin.flow.component.textfield.TextArea) Checkbox(com.vaadin.flow.component.checkbox.Checkbox) SubjectComponent(org.archcnl.ui.inputview.rulesormappingeditorview.architectureruleeditor.components.subjectcomponents.SubjectComponent) RulesWidgetRequestedEvent(org.archcnl.ui.inputview.rulesormappingeditorview.events.RulesWidgetRequestedEvent) StatementComponent(org.archcnl.ui.inputview.rulesormappingeditorview.architectureruleeditor.components.verbcomponents.StatementComponent) HorizontalLayout(com.vaadin.flow.component.orderedlayout.HorizontalLayout)

Example 28 with TextArea

use of com.vaadin.flow.component.textfield.TextArea in project docs by vaadin.

the class DialogDraggable method createDialogLayout.

private static VerticalLayout createDialogLayout() {
    TextField titleField = new TextField("Title");
    TextArea descriptionArea = new TextArea("Description");
    VerticalLayout fieldLayout = new VerticalLayout(titleField, descriptionArea);
    fieldLayout.setSpacing(false);
    fieldLayout.setPadding(false);
    fieldLayout.setAlignItems(FlexComponent.Alignment.STRETCH);
    fieldLayout.getStyle().set("width", "300px").set("max-width", "100%");
    return fieldLayout;
}
Also used : TextArea(com.vaadin.flow.component.textfield.TextArea) TextField(com.vaadin.flow.component.textfield.TextField) VerticalLayout(com.vaadin.flow.component.orderedlayout.VerticalLayout)

Example 29 with TextArea

use of com.vaadin.flow.component.textfield.TextArea in project SODevelopment by syampillai.

the class MailForm method buildFields.

@Override
protected void buildFields() {
    String userEmail = getTransactionManager().getUser().getPerson().getContact("email");
    senderField = new ObjectField<>("From", SenderGroup.class, ObjectField.Type.CHOICE);
    senderField.setValue((Id) null);
    senderField.setFilter(g -> {
        for (Sender s : StoredObject.list(Sender.class, "SenderGroup=" + g.getId(), true)) {
            if (s.getFromAddress().equalsIgnoreCase(userEmail) || s.getReplyToAddress().equalsIgnoreCase(userEmail)) {
                senderGroup = g;
                return true;
            }
        }
        return false;
    });
    addField(senderField);
    if (senderGroup != null) {
        senderField.setValue(senderGroup);
        senderGroup = null;
    }
    addressField = new TokensField<>("To");
    addField(addressField);
    ccField = new TokensField<>("CC");
    addField(ccField);
    subjectField = new TextField("Subject");
    addField(subjectField);
    setAllowAttachments(allowAttachments);
    contentField = new TextArea("Content");
    addField(contentField);
}
Also used : Sender(com.storedobject.mail.Sender) SenderGroup(com.storedobject.mail.SenderGroup) TextArea(com.vaadin.flow.component.textfield.TextArea)

Example 30 with TextArea

use of com.vaadin.flow.component.textfield.TextArea in project SODevelopment by syampillai.

the class ChangePassword method buildFields.

@Override
protected void buildFields() {
    String voice;
    if (expired) {
        voice = "You password has expired, please change it now!";
        speak(voice);
        add(new ELabel(voice, "red"));
    }
    TextField user;
    addField(user = new TextField("User Name"));
    user.setReadOnly(true);
    user.setTabIndex(-1);
    user.setValue(su.getId() + ":" + su.getLogin());
    password = createPasswordField("Current Password");
    if (!forgot) {
        addField(password);
    }
    addField(newPassword = createPasswordField("New Password"));
    addField(repeatNewPassword = createPasswordField("Repeat New Password"));
    TextArea condition = new TextArea();
    voice = PasswordPolicy.getForClass(SystemUser.class).describe();
    condition.setValue(voice);
    condition.setReadOnly(true);
    condition.setTabIndex(-1);
    add(condition);
    speak(voice);
}
Also used : ELabel(com.storedobject.ui.ELabel) TextArea(com.vaadin.flow.component.textfield.TextArea) TextField(com.vaadin.flow.component.textfield.TextField)

Aggregations

TextArea (com.vaadin.flow.component.textfield.TextArea)52 TextField (com.vaadin.flow.component.textfield.TextField)14 Test (org.junit.jupiter.api.Test)13 Div (com.vaadin.flow.component.html.Div)8 VerticalLayout (com.vaadin.flow.component.orderedlayout.VerticalLayout)6 Test (org.junit.Test)6 Button (com.vaadin.flow.component.button.Button)5 HorizontalLayout (com.vaadin.flow.component.orderedlayout.HorizontalLayout)5 Checkbox (com.vaadin.flow.component.checkbox.Checkbox)4 FormLayout (com.vaadin.flow.component.formlayout.FormLayout)4 H3 (com.vaadin.flow.component.html.H3)3 EmailField (com.vaadin.flow.component.textfield.EmailField)3 NumberField (com.vaadin.flow.component.textfield.NumberField)3 ValueChangeEvent (com.vaadin.flow.component.HasValue.ValueChangeEvent)2 ResponsiveStep (com.vaadin.flow.component.formlayout.FormLayout.ResponsiveStep)2 H2 (com.vaadin.flow.component.html.H2)2 NativeButton (com.vaadin.flow.component.html.NativeButton)2 StringLengthValidator (com.vaadin.flow.data.validator.StringLengthValidator)2 Route (com.vaadin.flow.router.Route)2 EFieldTypeDefinition (ch.akros.marketplace.administration.constants.EFieldTypeDefinition)1