]>
git.argeo.org Git - lgpl/argeo-commons.git/blob - org.argeo.cms.ui/src/org/argeo/cms/ui/CmsImageManager.java
1 package org
.argeo
.cms
.ui
;
3 import java
.io
.InputStream
;
5 import javax
.jcr
.Binary
;
7 import javax
.jcr
.RepositoryException
;
9 import org
.eclipse
.swt
.graphics
.Image
;
10 import org
.eclipse
.swt
.graphics
.Point
;
11 import org
.eclipse
.swt
.widgets
.Control
;
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
;
18 /** @return (0,0) if not available */
19 public Point
getImageSize(Node node
) throws RepositoryException
;
22 * The related <img> tag, with src, width and height set.
24 * @return null if not available
26 public String
getImageTag(Node node
) throws RepositoryException
;
29 * The related <img> tag, with url, width and height set. Caller must
30 * close the tag (or add additional attributes).
32 * @return null if not available
34 public StringBuilder
getImageTagBuilder(Node node
, Point size
) throws RepositoryException
;
37 * Returns the remotely accessible URL of the image (registering it if
38 * needed) @return null if not available
40 public String
getImageUrl(Node node
) throws RepositoryException
;
42 public Binary
getImageBinary(Node node
) throws RepositoryException
;
44 public Image
getSwtImage(Node node
) throws RepositoryException
;
47 public String
uploadImage(Node context
, Node uploadFolder
, String fileName
, InputStream in
, String contentType
)
48 throws RepositoryException
;
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);