X-Git-Url: https://git.argeo.org/?p=gpl%2Fargeo-suite.git;a=blobdiff_plain;f=publishing%2Forg.argeo.publishing.ui%2Fsrc%2Forg%2Fargeo%2Fpublishing%2Fui%2FPublishingApp.java;h=f527d5b41132088cf22d1c7942c008333aa4f1c0;hp=00deae94af9ddc38ce3e044c5d48a5af987ad3a3;hb=70010c4afc5799622fcad5b075740d94da074798;hpb=147ada7da5bf6292569f17a53a77fca04c97f707 diff --git a/publishing/org.argeo.publishing.ui/src/org/argeo/publishing/ui/PublishingApp.java b/publishing/org.argeo.publishing.ui/src/org/argeo/publishing/ui/PublishingApp.java index 00deae9..f527d5b 100644 --- a/publishing/org.argeo.publishing.ui/src/org/argeo/publishing/ui/PublishingApp.java +++ b/publishing/org.argeo.publishing.ui/src/org/argeo/publishing/ui/PublishingApp.java @@ -1,5 +1,8 @@ package org.argeo.publishing.ui; +import static org.argeo.suite.ui.SuiteApp.DEFAULT_THEME_ID_PROPERTY; +import static org.argeo.suite.ui.SuiteApp.DEFAULT_UI_NAME_PROPERTY; + import java.util.HashSet; import java.util.Map; import java.util.Set; @@ -13,10 +16,12 @@ import org.apache.commons.logging.LogFactory; import org.argeo.api.NodeUtils; import org.argeo.cms.ui.AbstractCmsApp; import org.argeo.cms.ui.CmsApp; -import org.argeo.docbook.ui.DocBookTypes; +import org.argeo.cms.ui.CmsUiProvider; +import org.argeo.docbook.DbkType; import org.argeo.docbook.ui.DocumentPage; import org.argeo.jcr.Jcr; import org.argeo.jcr.JcrUtils; +import org.argeo.util.LangUtils; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; @@ -31,10 +36,17 @@ public class PublishingApp extends AbstractCmsApp { private String pid; private String defaultThemeId; + private String defaultUiName = ""; + + private CmsUiProvider landingPage; public void init(Map properties) { - defaultThemeId = properties.get("defaultThemeId"); + if (properties.containsKey(DEFAULT_UI_NAME_PROPERTY)) + defaultUiName = LangUtils.get(properties, DEFAULT_UI_NAME_PROPERTY); + if (properties.containsKey(DEFAULT_THEME_ID_PROPERTY)) + defaultThemeId = LangUtils.get(properties, DEFAULT_THEME_ID_PROPERTY); pid = properties.get(Constants.SERVICE_PID); + if (log.isDebugEnabled()) log.info("Publishing App " + pid + " started"); } @@ -48,7 +60,7 @@ public class PublishingApp extends AbstractCmsApp { @Override public Set getUiNames() { Set uiNames = new HashSet<>(); - uiNames.add(""); + uiNames.add(defaultUiName); return uiNames; } @@ -58,12 +70,18 @@ public class PublishingApp extends AbstractCmsApp { parent.setLayout(new GridLayout()); Node indexNode; try { - indexNode = JcrUtils.getOrAdd(Jcr.getRootNode(adminSession), DocumentPage.WWW, DocBookTypes.ARTICLE); + indexNode = JcrUtils.getOrAdd(Jcr.getRootNode(adminSession), DocumentPage.WWW, DbkType.article.get()); adminSession.save(); } catch (RepositoryException e) { throw new IllegalStateException(e); } - Control page = new DocumentPage().createUiPart(parent, indexNode); + + Control page; + if (landingPage != null) { + page = landingPage.createUiPart(parent, indexNode); + } else { + page = new DocumentPage().createUiPart(parent, indexNode); + } return (Composite) page; } @@ -82,4 +100,9 @@ public class PublishingApp extends AbstractCmsApp { protected String getThemeId(String uiName) { return defaultThemeId; } + + public void setLandingPage(CmsUiProvider landingPage) { + this.landingPage = landingPage; + } + }