1 package org
.argeo
.cms
.e4
.rap
;
3 import java
.util
.HashMap
;
6 import org
.apache
.commons
.logging
.Log
;
7 import org
.apache
.commons
.logging
.LogFactory
;
8 import org
.argeo
.cms
.ui
.dialogs
.CmsFeedback
;
9 import org
.eclipse
.rap
.e4
.E4ApplicationConfig
;
10 import org
.eclipse
.rap
.rwt
.application
.Application
;
11 import org
.eclipse
.rap
.rwt
.application
.Application
.OperationMode
;
12 import org
.eclipse
.rap
.rwt
.application
.ApplicationConfiguration
;
13 import org
.eclipse
.rap
.rwt
.application
.ExceptionHandler
;
14 import org
.eclipse
.rap
.rwt
.client
.WebClient
;
15 import org
.osgi
.framework
.BundleContext
;
16 import org
.osgi
.framework
.FrameworkUtil
;
18 public abstract class AbstractRapE4App
implements ApplicationConfiguration
{
19 private final static Log log
= LogFactory
.getLog(AbstractRapE4App
.class);
21 private final BundleContext bc
= FrameworkUtil
.getBundle(AbstractRapE4App
.class).getBundleContext();
23 private String pageTitle
;
27 public void configure(Application application
) {
28 application
.setExceptionHandler(new ExceptionHandler() {
31 public void handleException(Throwable throwable
) {
32 CmsFeedback
.show("Unexpected RWT exception", throwable
);
33 // log.error("Unexpected RWT exception", throwable);
38 String lifeCycleUri
= "bundleclass://" + bc
.getBundle().getSymbolicName() + "/"
39 + CmsLoginLifecycle
.class.getName();
41 Map
<String
, String
> properties
= new HashMap
<String
, String
>();
42 properties
.put(WebClient
.PAGE_TITLE
, pageTitle
);
43 E4ApplicationConfig config
= new E4ApplicationConfig(e4Xmi
, lifeCycleUri
, null, false, true, true);
44 addEntryPoint(application
, config
, properties
);
45 // config.isClearPersistedState();
46 // E4EntryPointFactory entryPointFactory = new E4EntryPointFactory(config) {
49 // public EntryPoint create() {
50 // Subject subject = new Subject();
51 // EntryPoint ep = createEntryPoint();
52 // EntryPoint authEp = new EntryPoint() {
55 // public int createUI() {
56 // return Subject.doAs(subject, new PrivilegedAction<Integer>() {
59 // public Integer run() {
60 // return ep.createUI();
69 // protected EntryPoint createEntryPoint() {
70 // return super.create();
76 protected void addEntryPoint(Application application
, E4ApplicationConfig config
, Map
<String
, String
> properties
) {
77 CmsE4EntryPointFactory entryPointFactory
= new CmsE4EntryPointFactory(config
);
78 application
.addEntryPoint(path
, entryPointFactory
, properties
);
79 application
.setOperationMode(OperationMode
.SWT_COMPATIBILITY
);
82 public void setPageTitle(String pageTitle
) {
83 this.pageTitle
= pageTitle
;
86 public void setE4Xmi(String e4Xmi
) {
90 public void setPath(String path
) {