]> git.argeo.org Git - lgpl/argeo-commons.git/blob - org.argeo.cms.ui/src/org/argeo/cms/ui/CmsImageManager.java
Merge remote-tracking branch 'origin/master' into v2.x
[lgpl/argeo-commons.git] / org.argeo.cms.ui / src / org / argeo / cms / ui / CmsImageManager.java
1 package org.argeo.cms.ui;
2
3 import java.io.InputStream;
4
5 import javax.jcr.Binary;
6 import javax.jcr.Node;
7 import javax.jcr.RepositoryException;
8
9 import org.eclipse.swt.graphics.Image;
10 import org.eclipse.swt.graphics.Point;
11 import org.eclipse.swt.widgets.Control;
12
13 /** Read and write access to images. */
14 public interface CmsImageManager {
15 /** Load image in control */
16 public Boolean load(Node node, Control control, Point size) throws RepositoryException;
17
18 /** @return (0,0) if not available */
19 public Point getImageSize(Node node) throws RepositoryException;
20
21 /**
22 * The related <img> tag, with src, width and height set.
23 *
24 * @return null if not available
25 */
26 public String getImageTag(Node node) throws RepositoryException;
27
28 /**
29 * The related <img> tag, with url, width and height set. Caller must
30 * close the tag (or add additional attributes).
31 *
32 * @return null if not available
33 */
34 public StringBuilder getImageTagBuilder(Node node, Point size) throws RepositoryException;
35
36 /**
37 * Returns the remotely accessible URL of the image (registering it if
38 * needed) @return null if not available
39 */
40 public String getImageUrl(Node node) throws RepositoryException;
41
42 public Binary getImageBinary(Node node) throws RepositoryException;
43
44 public Image getSwtImage(Node node) throws RepositoryException;
45
46 /** @return URL */
47 public String uploadImage(Node context, Node uploadFolder, String fileName, InputStream in, String contentType)
48 throws RepositoryException;
49
50 @Deprecated
51 default String uploadImage(Node uploadFolder, String fileName, InputStream in) throws RepositoryException {
52 System.err.println("Context must be provided to " + CmsImageManager.class.getName());
53 return uploadImage(null, uploadFolder, fileName, in, null);
54 }
55 }