projects
/
lgpl
/
argeo-commons.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ed21871
)
Improve single sourcing.
author
Mathieu Baudier <mbaudier@argeo.org>
Wed, 14 Oct 2020 08:18:30 +0000
(10:18 +0200)
committer
Mathieu Baudier <mbaudier@argeo.org>
Wed, 14 Oct 2020 08:18:30 +0000
(10:18 +0200)
org.argeo.cms.ui/src/org/argeo/cms/ui/CmsConstants.java
patch
|
blob
|
history
org.argeo.cms.ui/src/org/argeo/cms/ui/CmsView.java
patch
|
blob
|
history
org.argeo.cms.ui/src/org/argeo/cms/ui/util/CmsUiUtils.java
patch
|
blob
|
history
org.argeo.eclipse.ui.rap/src/org/argeo/eclipse/ui/specific/EclipseUiConstants.java
[new file with mode: 0644]
patch
|
blob
diff --git
a/org.argeo.cms.ui/src/org/argeo/cms/ui/CmsConstants.java
b/org.argeo.cms.ui/src/org/argeo/cms/ui/CmsConstants.java
index 53e2aee6c8d137ae6e70c649650491b0263e744a..15716850842fc6d63e7705ac50760b4b1415cc0a 100644
(file)
--- a/
org.argeo.cms.ui/src/org/argeo/cms/ui/CmsConstants.java
+++ b/
org.argeo.cms.ui/src/org/argeo/cms/ui/CmsConstants.java
@@
-1,17
+1,21
@@
package org.argeo.cms.ui;
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
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
// 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";
// STANDARD RESOURCES
public final static String LOADING_IMAGE = "icons/loading.gif";
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 9f5e4f7973f9e35f29b37dca5199ca9b88814e2d..b403a2088d33fbfcb703c49c1bdf11762eca4b6d 100644
(file)
--- a/
org.argeo.cms.ui/src/org/argeo/cms/ui/CmsView.java
+++ b/
org.argeo.cms.ui/src/org/argeo/cms/ui/CmsView.java
@@
-51,6
+51,10
@@
public interface CmsView {
properties.put(param, value);
sendEvent(topic, properties);
}
properties.put(param, value);
sendEvent(topic, properties);
}
+
+ default void applyStyles(Object widget) {
+
+ }
static CmsView getCmsView(Composite parent) {
// find parent shell
static CmsView getCmsView(Composite parent) {
// find parent shell
diff --git
a/org.argeo.cms.ui/src/org/argeo/cms/ui/util/CmsUiUtils.java
b/org.argeo.cms.ui/src/org/argeo/cms/ui/util/CmsUiUtils.java
index 915b033365d8adab08ab6ab538e088fd946ca183..4e5572dbde6f19cf9bb9e84f683b45bd9100ac73 100644
(file)
--- a/
org.argeo.cms.ui/src/org/argeo/cms/ui/util/CmsUiUtils.java
+++ b/
org.argeo.cms.ui/src/org/argeo/cms/ui/util/CmsUiUtils.java
@@
-181,18
+181,20
@@
public class CmsUiUtils implements CmsConstants {
if (style == null)
return widget;// does nothing
widget.setData(CmsConstants.STYLE, style);
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) {
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) {
}
/** 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 widget;
}
@@
-232,6
+234,7
@@
public class CmsUiUtils implements CmsConstants {
return text(new Text(parent, SWT.NONE), txt);
}
return text(new Text(parent, SWT.NONE), txt);
}
+ @Deprecated
public static void setItemHeight(Table table, int height) {
table.setData(CmsConstants.ITEM_HEIGHT, height);
}
public static void setItemHeight(Table table, int height) {
table.setData(CmsConstants.ITEM_HEIGHT, height);
}
diff --git a/org.argeo.eclipse.ui.rap/src/org/argeo/eclipse/ui/specific/EclipseUiConstants.java
b/org.argeo.eclipse.ui.rap/src/org/argeo/eclipse/ui/specific/EclipseUiConstants.java
new file mode 100644
(file)
index 0000000..
76ad973
--- /dev/null
+++ b/
org.argeo.eclipse.ui.rap/src/org/argeo/eclipse/ui/specific/EclipseUiConstants.java
@@ -0,0
+1,9
@@
+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;
+}