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);
}
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);
}
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));
}
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);
}
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);
}
Aggregations