X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.cms.ui%2Fsrc%2Forg%2Fargeo%2Fcms%2Fui%2FCmsView.java;h=f8ab3a6821cf09860bdb052e6b118c377d3053ed;hb=94ec9b5a0282c8119ee9831688124bc96f3a62b8;hp=e18d4b4330d3098a6c8178fa71f1cda29382497b;hpb=d88053118372f24ad180c88084f74f4ff683701d;p=lgpl%2Fargeo-commons.git diff --git a/org.argeo.cms.ui/src/org/argeo/cms/ui/CmsView.java b/org.argeo.cms.ui/src/org/argeo/cms/ui/CmsView.java index e18d4b433..f8ab3a682 100644 --- a/org.argeo.cms.ui/src/org/argeo/cms/ui/CmsView.java +++ b/org.argeo.cms.ui/src/org/argeo/cms/ui/CmsView.java @@ -37,7 +37,7 @@ public interface CmsView { boolean isAnonymous(); /** - * Send an event to this topic. Does noothing by default., but if implemented it + * Send an event to this topic. Does nothing by default., but if implemented it * MUST set the {@link #CMS_VIEW_UID_PROPERTY} in the properties. */ default void sendEvent(String topic, Map properties) { @@ -81,6 +81,23 @@ public interface CmsView { throw new UnsupportedOperationException(); } + default Object getData(String key) { + throw new UnsupportedOperationException(); + } + + @SuppressWarnings("unchecked") + default T getUiContext(Class clss) { + return (T) getData(clss.getName()); + } + + default void setUiContext(Class clss, T instance) { + setData(clss.getName(), instance); + } + + default void setData(String key, Object value) { + throw new UnsupportedOperationException(); + } + static CmsView getCmsView(Control parent) { // find parent shell Shell topShell = parent.getShell();