1 package org
.argeo
.cms
.ui
;
5 import javax
.security
.auth
.login
.LoginContext
;
7 import org
.eclipse
.swt
.widgets
.Composite
;
8 import org
.eclipse
.swt
.widgets
.Shell
;
10 /** Provides interaction with the CMS system. */
11 public interface CmsView
{
12 final static String CMS_VIEW_UID_PROPERTY
= "argeo.cms.view.uid";
13 // String KEY = "org.argeo.cms.ui.view";
17 UxContext
getUxContext();
20 void navigateTo(String state
);
23 void authChange(LoginContext loginContext
);
27 // void registerCallbackHandler(CallbackHandler callbackHandler);
30 void exception(Throwable e
);
32 CmsImageManager
getImageManager();
34 boolean isAnonymous();
37 * Send an event to this topic. Does noothing by default., but if implemented it
38 * MUST set the {@link #CMS_VIEW_UID_PROPERTY} in the properties.
40 default void sendEvent(String topic
, Map
<String
, Object
> properties
) {
44 static CmsView
getCmsView(Composite parent
) {
46 Shell topShell
= parent
.getShell();
47 while (topShell
.getParent() != null)
48 topShell
= (Shell
) topShell
.getParent();
49 return (CmsView
) topShell
.getData(CmsView
.class.getName());
52 static void registerCmsView(Shell shell
, CmsView view
) {
54 Shell topShell
= shell
;
55 while (topShell
.getParent() != null)
56 topShell
= (Shell
) topShell
.getParent();
57 // check if already set
58 if (topShell
.getData(CmsView
.class.getName()) != null) {
59 CmsView registeredView
= (CmsView
) topShell
.getData(CmsView
.class.getName());
60 throw new IllegalArgumentException("Cms view " + registeredView
+ " already registered in this shell");
62 shell
.setData(CmsView
.class.getName(), view
);