[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: |