Log out home session.
[gpl/argeo-suite.git] / core / org.argeo.suite.ui / src / org / argeo / suite / ui / SuiteUi.java
index b245762cc7d8f27220d7ee6bfef5f5eff82246d8..187888e55e0190d4b5a2cd8b2998627622d46ddb 100644 (file)
@@ -11,6 +11,7 @@ import javax.jcr.Session;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.argeo.api.NodeConstants;
+import org.argeo.cms.Localized;
 import org.argeo.cms.ui.CmsView;
 import org.argeo.cms.ui.util.CmsUiUtils;
 import org.argeo.jcr.Jcr;
@@ -22,13 +23,16 @@ import org.eclipse.swt.widgets.Composite;
 class SuiteUi extends Composite {
        private static final long serialVersionUID = 6207018859086689108L;
        private final static Log log = LogFactory.getLog(SuiteUi.class);
+
+       private Localized title;
        private Composite header;
+       private Composite footer;
        private Composite belowHeader;
        private Composite leadPane;
        private Composite dynamicArea;
 
        private Session sysSession;
-//     private Session homeSession;
+       private Session homeSession;
        private Node userDir;
 
        private Map<String, SuiteLayer> layers = new HashMap<>();
@@ -49,6 +53,11 @@ class SuiteUi extends Composite {
 
                belowHeader = new Composite(this, SWT.NONE);
                belowHeader.setLayoutData(CmsUiUtils.fillAll());
+
+               footer = new Composite(this, SWT.NONE);
+               footer.setLayout(CmsUiUtils.noSpaceGridLayout());
+               CmsUiUtils.style(footer, SuiteStyle.footer);
+               footer.setLayoutData(CmsUiUtils.fillWidth());
        }
 
        public void refreshBelowHeader(boolean initApp) {
@@ -140,6 +149,7 @@ class SuiteUi extends Composite {
                }
                throw new IllegalArgumentException("Layer is not registered.");
        }
+       
 
        void addLayer(String id, SuiteLayer layer) {
                layers.put(id, layer);
@@ -165,7 +175,7 @@ class SuiteUi extends Composite {
        synchronized void logout() {
                userDir = null;
                Jcr.logout(sysSession);
-//             Jcr.logout(homeSession);
+               Jcr.logout(homeSession);
                currentLayerId = null;
                workAreas.clear();
        }
@@ -178,6 +188,10 @@ class SuiteUi extends Composite {
                return header;
        }
 
+       Composite getFooter() {
+               return footer;
+       }
+
        Composite getLeadPane() {
                return leadPane;
        }
@@ -192,11 +206,11 @@ class SuiteUi extends Composite {
 //
        synchronized void initSessions(Repository repository, String userDirPath) throws RepositoryException {
                this.sysSession = repository.login();
-//             this.homeSession = repository.login(NodeConstants.HOME_WORKSPACE);
+               this.homeSession = repository.login(NodeConstants.HOME_WORKSPACE);
                userDir = sysSession.getNode(userDirPath);
                addDisposeListener((e) -> {
                        Jcr.logout(sysSession);
-//                     Jcr.logout(homeSession);
+                       Jcr.logout(homeSession);
                });
        }
 
@@ -213,8 +227,8 @@ class SuiteUi extends Composite {
                        return sysSession;
                if (NodeConstants.SYS_WORKSPACE.equals(workspaceName))
                        return sysSession;
-//             else if (NodeConstants.HOME_WORKSPACE.equals(workspaceName))
-//                     return homeSession;
+               else if (NodeConstants.HOME_WORKSPACE.equals(workspaceName))
+                       return homeSession;
                else
                        throw new IllegalArgumentException("Unknown workspace " + workspaceName);
        }
@@ -223,4 +237,12 @@ class SuiteUi extends Composite {
                return cmsView;
        }
 
+       public Localized getTitle() {
+               return title;
+       }
+
+       public void setTitle(Localized title) {
+               this.title = title;
+       }
+
 }