X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=org.argeo.cms.ui%2Fsrc%2Forg%2Fargeo%2Fcms%2Fui%2Futil%2FCmsUiUtils.java;h=5d6030ec4b72aa6de533281405ef7fff89eacd91;hb=4ccc02902dad75faebe4aaa9b0b9880e2785c298;hp=33377b6ca365f1db0c3e57c258d733071d7fec67;hpb=ed889869ecd572e9699260306c346b64f4439e3b;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 33377b6ca..5d6030ec4 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 @@ -13,10 +13,10 @@ import javax.servlet.http.HttpServletRequest; import org.argeo.api.NodeConstants; import org.argeo.api.NodeUtils; -import org.argeo.cms.CmsException; 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; @@ -89,7 +89,7 @@ public class CmsUiUtils implements CmsConstants { buf.append(':').append(url.getPort()); return buf; } catch (MalformedURLException e) { - throw new CmsException("Cannot extract server base URL from " + request.getRequestURL(), e); + throw new IllegalArgumentException("Cannot extract server base URL from " + request.getRequestURL(), e); } } @@ -100,7 +100,7 @@ public class CmsUiUtils implements CmsConstants { buf.append(getDataPath(node)); return new URL(buf.toString()).toString(); } catch (MalformedURLException e) { - throw new CmsException("Cannot build data URL for " + node, e); + throw new IllegalArgumentException("Cannot build data URL for " + node, e); } } @@ -136,15 +136,6 @@ public class CmsUiUtils implements CmsConstants { return layout; } - public static GridLayout standardSpaceGridLayout(GridLayout layout) { - layout.horizontalSpacing = 16; - layout.verticalSpacing = 16; - layout.marginWidth = 16; - layout.marginHeight = 16; - return layout; - } - - public static GridData fillAll() { return new GridData(SWT.FILL, SWT.FILL, true, true); } @@ -188,19 +179,22 @@ public class CmsUiUtils implements CmsConstants { /** Style widget */ public static T style(T widget, String style) { - widget.setData(CmsConstants.STYLE, style); + if (style == null) + return widget;// does nothing + EclipseUiSpecificUtils.setStyleData(widget, style); + if (widget instanceof Control) + CmsView.getCmsView(((Control) widget).getParent()).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; } @@ -240,6 +234,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); }