Make RAP application more customisable.
authorMathieu Baudier <mbaudier@argeo.org>
Thu, 24 Oct 2019 07:56:31 +0000 (09:56 +0200)
committerMathieu Baudier <mbaudier@argeo.org>
Thu, 24 Oct 2019 07:56:31 +0000 (09:56 +0200)
org.argeo.cms.e4.rap/src/org/argeo/cms/e4/rap/AbstractRapE4App.java

index 1d70044b3e5d4edb800721dc311ad811aa1cec7f..c293f1ab02524b4516a5f9ca00c9935aeef6b9eb 100644 (file)
@@ -54,21 +54,41 @@ public abstract class AbstractRapE4App implements ApplicationConfiguration {
 //     }
 
        protected void addE4EntryPoint(Application application, String path, String e4Xmi, Map<String, String> properties) {
-               E4ApplicationConfig config = new E4ApplicationConfig(e4Xmi, lifeCycleUri, null, null, false, true, true);
+               E4ApplicationConfig config = createE4ApplicationConfig(e4Xmi);
                CmsE4EntryPointFactory entryPointFactory = new CmsE4EntryPointFactory(config);
                application.addEntryPoint(path, entryPointFactory, properties);
                application.setOperationMode(OperationMode.SWT_COMPATIBILITY);
        }
 
+       /**
+        * To be overridden for further configuration.
+        * 
+        * @see E4ApplicationConfig
+        */
+       protected E4ApplicationConfig createE4ApplicationConfig(String e4Xmi) {
+               return new E4ApplicationConfig(e4Xmi, lifeCycleUri, null, null, false, true, true);
+       }
+
+       @Deprecated
        public void setPageTitle(String pageTitle) {
                if (pageTitle != null)
                        baseProperties.put(WebClient.PAGE_TITLE, pageTitle);
        }
 
+       /** Returns a new map used to customise and entry point. */
+       public Map<String, String> customise(String pageTitle) {
+               Map<String, String> custom = new HashMap<>(getBaseProperties());
+               if (pageTitle != null)
+                       custom.put(WebClient.PAGE_TITLE, pageTitle);
+               return custom;
+       }
+
+       @Deprecated
        public void setE4Xmi(String e4Xmi) {
                this.e4Xmi = e4Xmi;
        }
 
+       @Deprecated
        public void setPath(String path) {
                this.path = path;
        }
@@ -84,4 +104,8 @@ public abstract class AbstractRapE4App implements ApplicationConfiguration {
                                baseProperties.put(key, value.toString());
                }
        }
+
+       public void destroy(Map<String, Object> properties) {
+
+       }
 }