]> git.argeo.org Git - lgpl/argeo-commons.git/blob - org.argeo.cms.ui/src/org/argeo/cms/ui/CmsView.java
Introduce ranking key.
[lgpl/argeo-commons.git] / org.argeo.cms.ui / src / org / argeo / cms / ui / CmsView.java
1 package org.argeo.cms.ui;
2
3 import javax.security.auth.login.LoginContext;
4
5 import org.eclipse.swt.widgets.Composite;
6 import org.eclipse.swt.widgets.Shell;
7
8 /** Provides interaction with the CMS system. */
9 public interface CmsView {
10 //String KEY = "org.argeo.cms.ui.view";
11
12 UxContext getUxContext();
13
14 // NAVIGATION
15 void navigateTo(String state);
16
17 // SECURITY
18 void authChange(LoginContext loginContext);
19
20 void logout();
21
22 // void registerCallbackHandler(CallbackHandler callbackHandler);
23
24 // SERVICES
25 void exception(Throwable e);
26
27 CmsImageManager getImageManager();
28
29 boolean isAnonymous();
30
31 static CmsView getCmsView(Composite parent) {
32 // find parent shell
33 Shell topShell = parent.getShell();
34 while (topShell.getParent() != null)
35 topShell = (Shell) topShell.getParent();
36 return (CmsView) topShell.getData(CmsView.class.getName());
37 }
38
39 static void registerCmsView(Shell shell, CmsView view) {
40 // find parent shell
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");
49 }
50 shell.setData(CmsView.class.getName(), view);
51 }
52
53 }