1 package org
.argeo
.cms
.ui
;
3 import javax
.security
.auth
.login
.LoginContext
;
5 import org
.eclipse
.swt
.widgets
.Composite
;
6 import org
.eclipse
.swt
.widgets
.Shell
;
8 /** Provides interaction with the CMS system. */
9 public interface CmsView
{
10 //String KEY = "org.argeo.cms.ui.view";
12 UxContext
getUxContext();
15 void navigateTo(String state
);
18 void authChange(LoginContext loginContext
);
22 // void registerCallbackHandler(CallbackHandler callbackHandler);
25 void exception(Throwable e
);
27 CmsImageManager
getImageManager();
29 boolean isAnonymous();
31 static CmsView
getCmsView(Composite parent
) {
33 Shell topShell
= parent
.getShell();
34 while (topShell
.getParent() != null)
35 topShell
= (Shell
) topShell
.getParent();
36 return (CmsView
) topShell
.getData(CmsView
.class.getName());
39 static void registerCmsView(Shell shell
, CmsView view
) {
41 Shell topShell
= shell
;
42 while (topShell
.getParent() != null)
43 topShell
= (Shell
) topShell
.getParent();
44 // check if already set
45 if (topShell
.getData(CmsView
.class.getName()) != null) {
46 CmsView registeredView
= (CmsView
) topShell
.getData(CmsView
.class.getName());
47 throw new IllegalArgumentException(
48 "Cms view " + registeredView
+ " already registered in this shell");
50 shell
.setData(CmsView
.class.getName(), view
);