Search in sources :

Example 1 with FormButtons

use of io.imunity.furms.ui.components.FormButtons in project furms by unity-idm.

the class SitesAddView method addForm.

private void addForm() {
    FormLayout formLayout = new FurmsFormLayout();
    formLayout.setSizeFull();
    SiteCreationParam formData = new SiteCreationParam();
    Binder<SiteCreationParam> binder = new Binder<>(SiteCreationParam.class);
    binder.setBean(formData);
    name.setPlaceholder(getTranslation("view.sites.add.form.name.placeholder"));
    name.setRequiredIndicatorVisible(true);
    name.setValueChangeMode(EAGER);
    name.setMaxLength(NAME_MAX_LENGTH);
    Button cancel = new Button(getTranslation("view.sites.add.form.button.cancel"), e -> doCancelAction());
    cancel.addThemeVariants(LUMO_TERTIARY);
    Button save = new Button(getTranslation("view.sites.add.form.button.save"), e -> doSaveAction(formData, binder));
    save.addThemeVariants(LUMO_PRIMARY);
    save.addClickShortcut(Key.ENTER);
    FormButtons buttons = new FormButtons(cancel, save);
    binder.addStatusChangeListener(status -> save.setEnabled(!isBlank(name.getValue()) && !status.hasValidationErrors()));
    binder.forField(name).withValidator(getNotEmptyStringValidator(), getTranslation("view.sites.form.error.validation.field.name.required")).withValidator(siteService::isNamePresent, getTranslation("view.sites.form.error.validation.field.name.unique")).bind(SiteCreationParam::getName, SiteCreationParam::setName);
    formLayout.addFormItem(name, getTranslation("view.sites.add.form.name"));
    getContent().add(formLayout, buttons);
}
Also used : FurmsFormLayout(io.imunity.furms.ui.components.FurmsFormLayout) FormLayout(com.vaadin.flow.component.formlayout.FormLayout) Binder(com.vaadin.flow.data.binder.Binder) FurmsFormLayout(io.imunity.furms.ui.components.FurmsFormLayout) Button(com.vaadin.flow.component.button.Button) FormButtons(io.imunity.furms.ui.components.FormButtons)

Example 2 with FormButtons

use of io.imunity.furms.ui.components.FormButtons in project furms by unity-idm.

the class AlarmFormView method addCreateButtons.

private void addCreateButtons() {
    FormButtons buttons = new FormButtons(createCloseButton(), createSaveButton(getTranslation("view.project-admin.alarms.form.button.save")));
    buttonLayout.removeAll();
    buttonLayout.add(buttons);
}
Also used : FormButtons(io.imunity.furms.ui.components.FormButtons)

Example 3 with FormButtons

use of io.imunity.furms.ui.components.FormButtons in project furms by unity-idm.

the class DashboardResourceAllocateFormView method addButtons.

private void addButtons() {
    final Button cancel = new Button(getTranslation("view.fenix-admin.resource-credits-allocation.form.button.cancel"));
    cancel.addThemeVariants(LUMO_TERTIARY);
    cancel.addClickShortcut(Key.ESCAPE);
    cancel.addClickListener(event -> UI.getCurrent().navigate(DashboardView.class));
    final Button save = new Button(getTranslation("view.fenix-admin.resource-credits-allocation.form.button.save"));
    save.addThemeVariants(LUMO_PRIMARY);
    save.addClickListener(event -> {
        binder.validate();
        if (binder.isValid()) {
            saveCommunityAllocation();
        }
    });
    binder.addStatusChangeListener(status -> save.setEnabled(binder.isValid()));
    getContent().add(new FormButtons(cancel, save));
}
Also used : Button(com.vaadin.flow.component.button.Button) FormButtons(io.imunity.furms.ui.components.FormButtons)

Example 4 with FormButtons

use of io.imunity.furms.ui.components.FormButtons in project furms by unity-idm.

the class PolicyDocumentFormView method addCreateButtons.

private void addCreateButtons() {
    FormButtons buttons = new FormButtons(createCloseButton(), createSaveButton(getTranslation("view.site-admin.policy-documents.form.button.save"), false));
    buttonLayout.removeAll();
    buttonLayout.add(buttons);
}
Also used : FormButtons(io.imunity.furms.ui.components.FormButtons)

Example 5 with FormButtons

use of io.imunity.furms.ui.components.FormButtons in project furms by unity-idm.

the class PolicyDocumentFormView method addUpdateButtons.

private void addUpdateButtons() {
    FormButtons buttons = new FormButtons(createCloseButton(), createSaveButton(getTranslation("view.site-admin.policy-documents.form.button.save"), true));
    buttonLayout.removeAll();
    buttonLayout.add(buttons);
}
Also used : FormButtons(io.imunity.furms.ui.components.FormButtons)

Aggregations

FormButtons (io.imunity.furms.ui.components.FormButtons)9 Button (com.vaadin.flow.component.button.Button)4 FormLayout (com.vaadin.flow.component.formlayout.FormLayout)1 Binder (com.vaadin.flow.data.binder.Binder)1 FurmsFormLayout (io.imunity.furms.ui.components.FurmsFormLayout)1 DashboardView (io.imunity.furms.ui.views.community.DashboardView)1