Package com._1c.g5.v8.dt.md.resource
Enum PictureManager
- java.lang.Object
-
- java.lang.Enum<PictureManager>
-
- com._1c.g5.v8.dt.md.resource.PictureManager
-
- All Implemented Interfaces:
Serializable
,Comparable<PictureManager>
public enum PictureManager extends Enum<PictureManager>
This is a common place for business logics related toCommonPicture
orMdPicture
as anIBmObject
. It contains methods that control life cycle of the issue: loading, saving, setting new contents, and erasing current contents.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
PictureManager.IPictureListener
Interface for listening for content changes on an picture.
-
Enum Constant Summary
Enum Constants Enum Constant Description INSTANCE
-
Field Summary
Fields Modifier and Type Field Description static String[]
PICTURE_EXTENSIONS
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addListener(PictureManager.IPictureListener listener)
Adds a listener to this manager that will be notified when this manager's state changes.void
deleteContents(PictureDef picture)
Deletes the contents of the givenpicture
.protected void
firePictureChange(PictureDef picture)
Fires a picture change event.static String
getExtension(PictureDef picture)
Returns stored picture extensionstatic String
getFilename(PictureDef picture)
Returns stored picture file namestatic boolean
isMultiImage(Picture picture)
Is this picture object contain many imagesvoid
removeListener(PictureManager.IPictureListener listener)
Removes a listener from this manager.void
setContents(PictureDef picture, InputStream input, String extension)
Reads contents of the giveninputStream
and stores it insidepicture
.<T> void
storeContents(PictureDef picture, org.eclipse.core.resources.IFile file)
Writes the contents of this picture, which was set by#setContents(PictureDef, File)
or#setContents(PictureDef, InputStream, URI)
, to file system.static PictureManager
valueOf(String name)
Returns the enum constant of this type with the specified name.static PictureManager[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
INSTANCE
public static final PictureManager INSTANCE
-
-
Field Detail
-
PICTURE_EXTENSIONS
public static final String[] PICTURE_EXTENSIONS
-
-
Method Detail
-
values
public static PictureManager[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (PictureManager c : PictureManager.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static PictureManager valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
addListener
public void addListener(PictureManager.IPictureListener listener)
Adds a listener to this manager that will be notified when this manager's state changes.- Parameters:
listener
- The listener to be added; must not benull
.
-
removeListener
public void removeListener(PictureManager.IPictureListener listener)
Removes a listener from this manager.- Parameters:
listener
- The listener to be removed; must not benull
.
-
firePictureChange
protected void firePictureChange(PictureDef picture)
Fires a picture change event.- Parameters:
picture
- - a picture that changed
-
setContents
public void setContents(PictureDef picture, InputStream input, String extension) throws IOException
Reads contents of the giveninputStream
and stores it insidepicture
. After a successful completionPictureDef#inputStream()
will return the given contents.- Parameters:
picture
- aPictureDef
to set contents offile
- aInputStream
to get contents frominput
- contentsextension
- file extension used to identify image type- Throws:
IOException
- in case of failure
-
storeContents
public <T> void storeContents(PictureDef picture, org.eclipse.core.resources.IFile file) throws org.eclipse.core.runtime.CoreException, IOException
Writes the contents of this picture, which was set by#setContents(PictureDef, File)
or#setContents(PictureDef, InputStream, URI)
, to file system.- Type Parameters:
T
-- Parameters:
picture
- aPictureDef
to store contents offile
- file name under which the givenpicture
will be stored- Throws:
org.eclipse.core.runtime.CoreException
IOException
-
deleteContents
public void deleteContents(PictureDef picture) throws org.eclipse.core.runtime.CoreException
Deletes the contents of the givenpicture
. Also tries to remove the contents from the file system- Throws:
org.eclipse.core.runtime.CoreException
-
getExtension
public static String getExtension(PictureDef picture)
Returns stored picture extension- Parameters:
picture
-- Returns:
-
isMultiImage
public static boolean isMultiImage(Picture picture)
Is this picture object contain many images
- Parameters:
picture
- source picture object, cannot benull
- Returns:
true
if this picture contain many images
-
getFilename
public static String getFilename(PictureDef picture)
Returns stored picture file name- Parameters:
picture
-- Returns:
-
-