X-Git-Url: http://git.argeo.org/?a=blobdiff_plain;f=org.argeo.cms.ui%2Fsrc%2Forg%2Fargeo%2Fcms%2Fui%2Futil%2FCmsUiUtils.java;h=2bfeb43cfb593e7f62e6686acfe3cc55d308576c;hb=03f646fd0d7e7ce393694c836c779bc67a4eef55;hp=edf1ba3ef10e18d5d32482fdb106bfa59bb5801b;hpb=3793394f225a1d3b36382f5b50bd2e3c8214ff0d;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 edf1ba3ef..2bfeb43cf 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 @@ -15,11 +15,12 @@ import javax.jcr.RepositoryException; import javax.servlet.http.HttpServletRequest; import org.argeo.api.NodeConstants; -import org.argeo.api.NodeUtils; +import org.argeo.cms.jcr.CmsJcrUtils; 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.JcrException; import org.argeo.jcr.JcrUtils; import org.eclipse.rap.rwt.RWT; import org.eclipse.rap.rwt.service.ResourceManager; @@ -114,7 +115,7 @@ public class CmsUiUtils implements CmsConstants { } public static String getDataPath(String cn, Node node) throws RepositoryException { - return NodeUtils.getDataPath(cn, node); + return CmsJcrUtils.getDataPath(cn, node); } /** Clean reserved URL characters for use in HTTP links. */ @@ -183,18 +184,17 @@ public class CmsUiUtils implements CmsConstants { /* * ROW LAYOUT */ - /** @return the same layout, with space and margins removed. */ - public static RowLayout noSpaceRowLayout(RowLayout rowLayout) { + /** @return the same layout, with margins removed. */ + public static RowLayout noMarginsRowLayout(RowLayout rowLayout) { rowLayout.marginTop = 0; rowLayout.marginBottom = 0; rowLayout.marginLeft = 0; rowLayout.marginRight = 0; - rowLayout.spacing = 0; return rowLayout; } - public static RowLayout noSpaceRowLayout(int type) { - return noSpaceRowLayout(new RowLayout(type)); + public static RowLayout noMarginsRowLayout(int type) { + return noMarginsRowLayout(new RowLayout(type)); } public static RowData rowData16px() { @@ -224,7 +224,9 @@ public class CmsUiUtils implements CmsConstants { return widget;// does nothing EclipseUiSpecificUtils.setStyleData(widget, style); if (widget instanceof Control) { - CmsView.getCmsView((Control) widget).applyStyles(widget); + CmsView cmsView = CmsView.getCmsView((Control) widget); + if (cmsView != null) + cmsView.applyStyles(widget); } return widget; } @@ -331,7 +333,13 @@ public class CmsUiUtils implements CmsConstants { } public static String img(String serverBase, Node fileNode, String width, String height) { - String src = (serverBase != null ? serverBase : "") + NodeUtils.getDataPath(fileNode); +// String src = (serverBase != null ? serverBase : "") + NodeUtils.getDataPath(fileNode); + String src; + try { + src = (serverBase != null ? serverBase : "") + getDataPathForUrl(fileNode); + } catch (RepositoryException e) { + throw new JcrException("Cannot get URL data path for " + fileNode, e); + } return imgBuilder(src, width, height).append("/>").toString(); }