X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.cms.ui%2Fsrc%2Forg%2Fargeo%2Fcms%2Fui%2Futil%2FCmsUiUtils.java;h=428c910e54133dee353aa8d034ffc388fb8f30a5;hb=94ec9b5a0282c8119ee9831688124bc96f3a62b8;hp=915b033365d8adab08ab6ab538e088fd946ca183;hpb=32315b6eea1e2284e4269536b5fb7fee8cc03b8d;p=lgpl%2Fargeo-commons.git 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 915b03336..428c910e5 100644 --- 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 @@ -16,6 +16,7 @@ import org.argeo.api.NodeUtils; import org.argeo.cms.ui.CmsConstants; import org.argeo.cms.ui.CmsView; import org.argeo.eclipse.ui.Selected; +import org.argeo.eclipse.ui.specific.EclipseUiSpecificUtils; import org.argeo.jcr.JcrUtils; import org.eclipse.rap.rwt.RWT; import org.eclipse.rap.rwt.service.ResourceManager; @@ -155,6 +156,9 @@ public class CmsUiUtils implements CmsConstants { return new GridData(horizontalAlignment, horizontalAlignment, false, true); } + /* + * ROW LAYOUT + */ public static RowData rowData16px() { return new RowData(16, 16); } @@ -163,7 +167,7 @@ public class CmsUiUtils implements CmsConstants { * FORM LAYOUT */ - public static FormData coversAll() { + public static FormData coverAll() { FormData fdLabel = new FormData(); fdLabel.top = new FormAttachment(0, 0); fdLabel.left = new FormAttachment(0, 0); @@ -180,19 +184,21 @@ public class CmsUiUtils implements CmsConstants { public static T style(T widget, String style) { if (style == null) return widget;// does nothing - widget.setData(CmsConstants.STYLE, style); + EclipseUiSpecificUtils.setStyleData(widget, style); + if (widget instanceof Control) { + CmsView.getCmsView((Control) widget).applyStyles(widget); + } return widget; } /** Style widget */ public static 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 markup(T widget) { - widget.setData(CmsConstants.MARKUP, true); + EclipseUiSpecificUtils.setMarkupData(widget); return widget; } @@ -232,6 +238,7 @@ public class CmsUiUtils implements CmsConstants { return text(new Text(parent, SWT.NONE), txt); } + @Deprecated public static void setItemHeight(Table table, int height) { table.setData(CmsConstants.ITEM_HEIGHT, height); } @@ -273,6 +280,15 @@ public class CmsUiUtils implements CmsConstants { } // IMAGES + public static String img(Node fileNode, String width, String height) { + return img(null, fileNode, width, height); + } + + public static String img(String serverBase, Node fileNode, String width, String height) { + String src = (serverBase != null ? serverBase : "") + NodeUtils.getDataPath(fileNode); + return imgBuilder(src, width, height).append("/>").toString(); + } + public static String img(String src, String width, String height) { return imgBuilder(src, width, height).append("/>").toString(); }