package org.argeo.cms.ui;
-import org.eclipse.rap.rwt.RWT;
+import org.argeo.eclipse.ui.specific.EclipseUiConstants;
import org.eclipse.swt.graphics.Point;
/** Commons constants */
public interface CmsConstants {
// DATAKEYS
- public final static String STYLE = RWT.CUSTOM_VARIANT;
- public final static String MARKUP = RWT.MARKUP_ENABLED;
- public final static String ITEM_HEIGHT = RWT.CUSTOM_ITEM_HEIGHT;
+ public final static String STYLE = EclipseUiConstants.CSS_CLASS;
+ public final static String MARKUP = EclipseUiConstants.MARKUP_SUPPORT;
+ @Deprecated
+ /* RWT.CUSTOM_ITEM_HEIGHT */
+ public final static String ITEM_HEIGHT = "org.eclipse.rap.rwt.customItemHeight";
// EVENT DETAILS
- public final static int HYPERLINK = RWT.HYPERLINK;
+ @Deprecated
+ /* RWT.HYPERLINK */
+ public final static int HYPERLINK = 1 << 26;
// STANDARD RESOURCES
public final static String LOADING_IMAGE = "icons/loading.gif";
properties.put(param, value);
sendEvent(topic, properties);
}
+
+ default void applyStyles(Object widget) {
+
+ }
static CmsView getCmsView(Composite parent) {
// find parent shell
if (style == null)
return widget;// does nothing
widget.setData(CmsConstants.STYLE, style);
+ if (widget instanceof Control)
+ CmsView.getCmsView(((Control) widget).getParent()).applyStyles(widget);
return widget;
}
/** Style widget */
public static <T extends Widget> T style(T widget, CmsStyle style) {
- widget.setData(CmsConstants.STYLE, style.toStyleClass());
- return widget;
+ return style(widget, style.toStyleClass());
}
/** Enable markups on widget */
public static <T extends Widget> T markup(T widget) {
- widget.setData(CmsConstants.MARKUP, true);
+ if (CmsConstants.MARKUP != null)
+ widget.setData(CmsConstants.MARKUP, true);
return widget;
}
return text(new Text(parent, SWT.NONE), txt);
}
+ @Deprecated
public static void setItemHeight(Table table, int height) {
table.setData(CmsConstants.ITEM_HEIGHT, height);
}
--- /dev/null
+package org.argeo.eclipse.ui.specific;
+
+import org.eclipse.rap.rwt.RWT;
+
+/** Constants which are specific to RWT.*/
+public interface EclipseUiConstants {
+ final static String CSS_CLASS = RWT.CUSTOM_VARIANT;
+ final static String MARKUP_SUPPORT = RWT.MARKUP_ENABLED;
+}