Search in sources :

Example 1 with NAME_MAX_LENGTH

use of io.imunity.furms.ui.utils.FormSettings.NAME_MAX_LENGTH in project furms by unity-idm.

the class SitesView method addEditForm.

private Component addEditForm(Editor<SiteGridItem> siteEditor) {
    TextField siteNameField = new TextField();
    siteNameField.setMaxLength(NAME_MAX_LENGTH);
    siteNameField.setWidthFull();
    siteNameField.setValueChangeMode(EAGER);
    siteEditor.getBinder().forField(siteNameField).withValidator(getNotEmptyStringValidator(), getTranslation("view.sites.form.error.validation.field.name.required")).withValidator(siteName -> !siteService.isNamePresentIgnoringRecord(siteName, siteEditor.getItem().getId()), getTranslation("view.sites.form.error.validation.field.name.unique")).bind(SiteGridItem::getName, SiteGridItem::setName);
    return new Div(siteNameField);
}
Also used : DuplicatedNameValidationError(io.imunity.furms.api.validation.exceptions.DuplicatedNameValidationError) Component(com.vaadin.flow.component.Component) LoggerFactory(org.slf4j.LoggerFactory) MenuButton(io.imunity.furms.ui.components.MenuButton) PageTitle(io.imunity.furms.ui.components.PageTitle) Route(com.vaadin.flow.router.Route) FlexLayout(com.vaadin.flow.component.orderedlayout.FlexLayout) DenseGrid(io.imunity.furms.ui.components.DenseGrid) Key(com.vaadin.flow.component.Key) UI(com.vaadin.flow.component.UI) TextField(com.vaadin.flow.component.textfield.TextField) USERS(com.vaadin.flow.component.icon.VaadinIcon.USERS) MethodHandles(java.lang.invoke.MethodHandles) Editor(com.vaadin.flow.component.grid.editor.Editor) RouterGridLink(io.imunity.furms.ui.components.RouterGridLink) END(com.vaadin.flow.component.grid.ColumnTextAlign.END) Objects(java.util.Objects) List(java.util.List) Optional(java.util.Optional) NotificationUtils.showSuccessNotification(io.imunity.furms.ui.utils.NotificationUtils.showSuccessNotification) ViewHeaderLayout(io.imunity.furms.ui.components.ViewHeaderLayout) EditorOpenEvent(com.vaadin.flow.component.grid.editor.EditorOpenEvent) NotificationUtils.showErrorNotification(io.imunity.furms.ui.utils.NotificationUtils.showErrorNotification) SiteHasResourceCreditsRemoveValidationError(io.imunity.furms.api.validation.exceptions.SiteHasResourceCreditsRemoveValidationError) Binder(com.vaadin.flow.data.binder.Binder) Div(com.vaadin.flow.component.html.Div) FurmsDialog(io.imunity.furms.ui.components.FurmsDialog) PLUS_CIRCLE(com.vaadin.flow.component.icon.VaadinIcon.PLUS_CIRCLE) LUMO_TERTIARY(com.vaadin.flow.component.button.ButtonVariant.LUMO_TERTIARY) FurmsViewComponent(io.imunity.furms.ui.components.FurmsViewComponent) RouterLink(com.vaadin.flow.router.RouterLink) SiteService(io.imunity.furms.api.sites.SiteService) Icon(com.vaadin.flow.component.icon.Icon) EAGER(com.vaadin.flow.data.value.ValueChangeMode.EAGER) Logger(org.slf4j.Logger) Grid(com.vaadin.flow.component.grid.Grid) TRASH(com.vaadin.flow.component.icon.VaadinIcon.TRASH) FENIX_ADMIN_SITES(io.imunity.furms.domain.constant.RoutesConst.FENIX_ADMIN_SITES) EDIT(com.vaadin.flow.component.icon.VaadinIcon.EDIT) GridActionMenu(io.imunity.furms.ui.components.GridActionMenu) GridActionsButtonLayout(io.imunity.furms.ui.components.GridActionsButtonLayout) ClickEvent(com.vaadin.flow.component.ClickEvent) Site(io.imunity.furms.domain.sites.Site) FenixAdminMenu(io.imunity.furms.ui.views.fenix.menu.FenixAdminMenu) Collectors.toList(java.util.stream.Collectors.toList) Button(com.vaadin.flow.component.button.Button) SitesAdminsView(io.imunity.furms.ui.views.fenix.sites.admins.SitesAdminsView) Comparator(java.util.Comparator) SitesAddView(io.imunity.furms.ui.views.fenix.sites.add.SitesAddView) NAME_MAX_LENGTH(io.imunity.furms.ui.utils.FormSettings.NAME_MAX_LENGTH) Div(com.vaadin.flow.component.html.Div) TextField(com.vaadin.flow.component.textfield.TextField)

Aggregations

ClickEvent (com.vaadin.flow.component.ClickEvent)1 Component (com.vaadin.flow.component.Component)1 Key (com.vaadin.flow.component.Key)1 UI (com.vaadin.flow.component.UI)1 Button (com.vaadin.flow.component.button.Button)1 LUMO_TERTIARY (com.vaadin.flow.component.button.ButtonVariant.LUMO_TERTIARY)1 END (com.vaadin.flow.component.grid.ColumnTextAlign.END)1 Grid (com.vaadin.flow.component.grid.Grid)1 Editor (com.vaadin.flow.component.grid.editor.Editor)1 EditorOpenEvent (com.vaadin.flow.component.grid.editor.EditorOpenEvent)1 Div (com.vaadin.flow.component.html.Div)1 Icon (com.vaadin.flow.component.icon.Icon)1 EDIT (com.vaadin.flow.component.icon.VaadinIcon.EDIT)1 PLUS_CIRCLE (com.vaadin.flow.component.icon.VaadinIcon.PLUS_CIRCLE)1 TRASH (com.vaadin.flow.component.icon.VaadinIcon.TRASH)1 USERS (com.vaadin.flow.component.icon.VaadinIcon.USERS)1 FlexLayout (com.vaadin.flow.component.orderedlayout.FlexLayout)1 TextField (com.vaadin.flow.component.textfield.TextField)1 Binder (com.vaadin.flow.data.binder.Binder)1 EAGER (com.vaadin.flow.data.value.ValueChangeMode.EAGER)1