Adapt to changes in Argeo Commons
authorMathieu Baudier <mbaudier@argeo.org>
Sun, 25 Jun 2023 08:38:18 +0000 (10:38 +0200)
committerMathieu Baudier <mbaudier@argeo.org>
Sun, 25 Jun 2023 08:38:18 +0000 (10:38 +0200)
org.argeo.cms.jcr/src/org/argeo/cms/jcr/acr/JcrContent.java
swt/org.argeo.cms.jcr.ui/src/org/argeo/cms/ui/forms/FormPageViewer.java
swt/org.argeo.cms.jcr.ui/src/org/argeo/cms/ui/util/DefaultImageManager.java
swt/org.argeo.cms.jcr.ui/src/org/argeo/cms/ui/widgets/EditableImage.java
swt/org.argeo.cms.jcr.ui/src/org/argeo/cms/ui/widgets/Img.java

index da38c969ce0e3000487fe03b6d386d2aa35a48bc..9e662ecc96ab8dcbf128c452ba1c1f42acfc661f 100644 (file)
@@ -168,7 +168,7 @@ public class JcrContent extends AbstractContent {
                try {
                        // Note: it is important to to use the default way (recursing through parents),
                        // since the session may not have access to parent nodes
-                       return ContentUtils.ROOT_SLASH + jcrWorkspace + getJcrNode().getPath();
+                       return Content.ROOT_PATH + jcrWorkspace + getJcrNode().getPath();
                } catch (RepositoryException e) {
                        throw new JcrException("Cannot get depth of " + getJcrNode(), e);
                }
@@ -552,7 +552,7 @@ public class JcrContent extends AbstractContent {
                        if (contentSession == null)
                                throw new IllegalArgumentException(
                                                "Cannot adapt " + node + " to content, because it was not loaded from a content session");
-                       return contentSession.get(ContentUtils.SLASH + CmsConstants.SYS_WORKSPACE + node.getPath());
+                       return contentSession.get(Content.ROOT_PATH + CmsConstants.SYS_WORKSPACE + node.getPath());
                } catch (RepositoryException e) {
                        throw new JcrException("Cannot adapt " + node + " to a content", e);
                }
index 136fff72e09ed6030f5377ed999e81cabf89590c..eaeab95b43d7613e574930486a34ece2455ad13d 100644 (file)
@@ -188,7 +188,7 @@ public class FormPageViewer extends AbstractPageViewer {
                        // use control AFTER setting style, since it may have been reset
                        if (part instanceof EditableImage) {
                                EditableImage editableImage = (EditableImage) part;
-                               imageManager().load(partNode, part.getControl(), editableImage.getPreferredImageSize());
+                               imageManager().load(partNode, part.getControl(), editableImage.getPreferredImageSize(), null);
                        }
                }
        }
index b431fc3c9618c428dd14219c3923ef7d06381d21..405642955a5e6ce3ef5b9f490fec12869b4b256f 100644 (file)
@@ -24,9 +24,7 @@ import org.argeo.jcr.JcrException;
 import org.argeo.jcr.JcrUtils;
 import org.eclipse.rap.rwt.RWT;
 import org.eclipse.rap.rwt.service.ResourceManager;
-import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.graphics.ImageData;
-import org.eclipse.swt.widgets.Display;
 
 /** Manages only public images so far. */
 public class DefaultImageManager extends AbstractSwtImageManager<Node> {
@@ -62,14 +60,14 @@ public class DefaultImageManager extends AbstractSwtImageManager<Node> {
                }
        }
 
-       public Image getSwtImage(Node node) {
+       public ImageData getSwtImageData(Node node) {
                InputStream inputStream = null;
                Binary binary = getImageBinary(node);
                if (binary == null)
                        return null;
                try {
                        inputStream = binary.getStream();
-                       return new Image(Display.getCurrent(), inputStream);
+                       return new ImageData(inputStream);
                } catch (RepositoryException e) {
                        throw new JcrException(e);
                } finally {
index 95d9e8ee9a0d5d957ec54b46dcecec9d761f9b90..85ccec912cf700149363e512e8a414da0cfd26b9 100644 (file)
@@ -83,7 +83,7 @@ public abstract class EditableImage extends StyledControl {
                if (control != null) {
                        ((Label) control).setText(imgTag);
                        control.setSize(preferredImageSize != null
-                                       ? new Point(preferredImageSize.getWidth(), preferredImageSize.getHeight())
+                                       ? new Point(preferredImageSize.width(), preferredImageSize.height())
                                        : getSize());
                } else {
                        loaded = false;
index 9093c8435166f250edacb545454885fb36f59408..f5cae6ae9de70e0abca05b398af96a8468c2e311 100644 (file)
@@ -79,7 +79,7 @@ public class Img extends EditableImage implements SectionPart, NodePart {
        @Override
        protected synchronized Boolean load(Control lbl) {
                Node imgNode = getNode();
-               boolean loaded = imageManager.load(imgNode, lbl, getPreferredImageSize());
+               boolean loaded = imageManager.load(imgNode, lbl, getPreferredImageSize(), null);
                // getParent().layout();
                return loaded;
        }