[MGNLUI-4558] Implement pop-up form dialog support with new UI APIs Created: 15/Jun/18  Updated: 18/Apr/19  Resolved: 18/Apr/19

Status: Closed
Project: Magnolia UI
Component/s: None
Affects Version/s: None
Fix Version/s: 6.1

Type: Task Priority: Neutral
Reporter: Aleksandr Pchelintcev Assignee: Roman Kovařík
Resolution: Fixed Votes: 0
Labels: v8-essentials
Remaining Estimate: 0d
Time Spent: 2d 7h 19m
Original Estimate: Not Specified

Template:
Acceptance criteria:
Empty
Task DoR:
Empty
Epic Link: UI framework: forms, dialogs, content editing
Sprint: Foundation 6, Foundation 8, Foundation 9
Story Points: 5

 Description   

Thanks to the view-contexts and view improvements it is probably possible to make a form dialog implementation that shares most of the code with the detail sub-app.



 Comments   
Comment by Aleksandr Pchelintcev [ 03/Apr/19 ]

Re-opening due to some suggestions/observations:

  DialogDefinition dialogDefinition = dialogDefinitionRegistry.getProvider(getDefinition().getDialogId()).get();
            if (dialogDefinition instanceof FormDialogDefinition) {
                EditorView<T> form = viewProvider.create(((FormDialogDefinition) dialogDefinition).getForm());
                valueContext.getSingle().ifPresent(form::populate);

                DialogComponent dialogComponent = DialogWrapper.builder()
                        .actions(dialogDefinition.getActions())
                        .form(form.asVaadinComponent())
                        .caption(dialogDefinition.getLabel())
                        .componentProvider(form.getComponentProvider())
                        .localeContext(localeContext)
                        .build()
                        .create();

                localeContext.current().observeNullable(locale -> dialogComponent.setContent(form.getLayout(locale)));

                Window window = new Window();
                window.setCaption(dialogDefinition.getLabel());
                window.addStyleNames("dialog");
                window.setWidth(95, PERCENTAGE);
                window.setDraggable(false);
                window.setResizable(true);
                window.center();
                window.setContent(dialogComponent);
                Responsive.makeResponsive(window);
                UI.getCurrent().addWindow(window);

                form.bindInstance(CloseHandler.class, window::close);

Looks a bit too heavy and complicated for the user, who opens a dialog. We could at least consider concealing the Window component operations from the user (like we do with legacy dialogs at the moment, with necessary refactroring applied if needed).

Another point:
I would also question reason behind having the CommittinBinder class due to a) it's naming - it really doesn't differ from the normal binder except for it saves the JCR session, b) - doesn't look to good that the default binder we use for forms references JCR, even indirectly

Generated at Mon Feb 12 09:17:49 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.