X-Git-Url: https://git.argeo.org/?p=gpl%2Fargeo-suite.git;a=blobdiff_plain;f=org.argeo.suite.ui%2Fsrc%2Forg%2Fargeo%2Fsuite%2Fui%2FSuiteUi.java;h=b245762cc7d8f27220d7ee6bfef5f5eff82246d8;hp=cad5a9b994e093dce57c08c18dc147e630f54686;hb=70010c4afc5799622fcad5b075740d94da074798;hpb=25ed06d42600a81063515220c51ac2d93fefa27a diff --git a/org.argeo.suite.ui/src/org/argeo/suite/ui/SuiteUi.java b/org.argeo.suite.ui/src/org/argeo/suite/ui/SuiteUi.java index cad5a9b..b245762 100644 --- a/org.argeo.suite.ui/src/org/argeo/suite/ui/SuiteUi.java +++ b/org.argeo.suite.ui/src/org/argeo/suite/ui/SuiteUi.java @@ -43,6 +43,7 @@ class SuiteUi extends Composite { this.setLayout(CmsUiUtils.noSpaceGridLayout()); header = new Composite(this, SWT.NONE); + header.setLayout(CmsUiUtils.noSpaceGridLayout()); CmsUiUtils.style(header, SuiteStyle.header); header.setLayoutData(CmsUiUtils.fillWidth()); @@ -64,9 +65,10 @@ class SuiteUi extends Composite { dynamicArea = new Composite(belowHeader, SWT.NONE); } leadPane.setLayoutData(CmsUiUtils.fillHeight()); + leadPane.setLayout(CmsUiUtils.noSpaceGridLayout()); CmsUiUtils.style(leadPane, SuiteStyle.leadPane); - dynamicArea.setLayoutData(CmsUiUtils.fillAll()); + dynamicArea.setLayoutData(CmsUiUtils.fillAll()); dynamicArea.setLayout(new FormLayout()); } else { @@ -90,15 +92,16 @@ class SuiteUi extends Composite { private Composite getLayer(String id, Node context) { if (!layers.containsKey(id)) - throw new IllegalArgumentException("No layer " + id + " is available."); + return null; if (!workAreas.containsKey(id)) initLayer(id, layers.get(id), context); return workAreas.get(id); } Composite switchToLayer(String layerId, Node context) { + Composite current = null; if (currentLayerId != null) { - Composite current = getCurrentWorkArea(); + current = getCurrentWorkArea(); if (currentLayerId.equals(layerId)) return current; } @@ -107,16 +110,24 @@ class SuiteUi extends Composite { context = userDir; } Composite toShow = getLayer(layerId, context); - currentLayerId = layerId; - if (!isDisposed()) - getDisplay().syncExec(() -> { - if (!toShow.isDisposed()) + if (toShow != null) { + currentLayerId = layerId; + if (!isDisposed()) { +// getDisplay().syncExec(() -> { + if (!toShow.isDisposed()) { toShow.moveAbove(null); - else + } else { log.warn("Cannot show work area because it is disposed."); + toShow = initLayer(layerId, layers.get(layerId), context); + toShow.moveAbove(null); + } dynamicArea.layout(true, true); - }); - return toShow; +// }); + } + return toShow; + } else { + return current; + } } Composite switchToLayer(SuiteLayer layer, Node context) { @@ -145,6 +156,7 @@ class SuiteUi extends Composite { protected Composite initLayer(String id, SuiteLayer layer, Node context) { Composite workArea = cmsView.doAs(() -> (Composite) layer.createUiPart(dynamicArea, context)); + CmsUiUtils.style(workArea, SuiteStyle.workArea); workArea.setLayoutData(CmsUiUtils.coverAll()); workAreas.put(id, workArea); return workArea;