Package com.iizigo.image
Class ImageInfo
- java.lang.Object
- com.iizigo.image.ImageInfo
- All Implemented Interfaces:
EventListener,java.lang.Runnable
public class ImageInfo extends java.lang.Object implements EventListener, java.lang.Runnable
The image info used by the image editor components.- Author:
- Christopher Mindus
Constructor Summary
Constructors Constructor Description ImageInfo(org.eclipse.core.resources.IFile file)Creates an instance from an existing file to load the image.
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddListener(IImageInfoChanged listener)Adds listener.voiddispose()Disposes of the instance, i.e.AssetReferencegetAssetReference()Gets the reference.java.lang.StringgetError()Gets the error text when not valid.org.eclipse.core.resources.IFilegetFile()Gets the file.intgetHeight()Gets the height.org.eclipse.swt.graphics.ImagegetImage()Gets the image.SizegetSize()Gets the size.intgetWidth()Gets the width.static ImageInfograb(AssetReference ref, GProp<?> anyPropInTree)From a AssetReference, gets the ImageInfo instance and adds a reference count to it.booleanisValid()Checks for validity.voidonEvent(GEvent event)Property event.voidrelease()Releases this instance that was "grabbed".voidremoveListener(IImageInfoChanged listener)Adds listener.voidrun()Called at async prop events.java.lang.StringtoString()Prints a string representation.
Method Detail
grab
public static ImageInfo grab(AssetReference ref, GProp<?> anyPropInTree)
From a AssetReference, gets the ImageInfo instance and adds a reference count to it.
addListener
public void addListener(IImageInfoChanged listener)
Adds listener.
removeListener
public void removeListener(IImageInfoChanged listener)
Adds listener.
dispose
public void dispose()
Disposes of the instance, i.e. the image.
release
public void release()
Releases this instance that was "grabbed".
onEvent
public void onEvent(GEvent event)
Property event.- Specified by:
onEventin interfaceEventListener- Parameters:
event- The event.
run
public void run()
Called at async prop events.- Specified by:
runin interfacejava.lang.Runnable
isValid
public boolean isValid()
Checks for validity.
getImage
public org.eclipse.swt.graphics.Image getImage()
Gets the image.
getWidth
public int getWidth()
Gets the width.
getHeight
public int getHeight()
Gets the height.
getSize
public Size getSize()
Gets the size.- Returns:
- The size, or null if not valid.
getFile
public org.eclipse.core.resources.IFile getFile()
Gets the file.
getError
public java.lang.String getError()
Gets the error text when not valid.- Returns:
- The error string, null when valid.
getAssetReference
public AssetReference getAssetReference()
Gets the reference.
toString
public java.lang.String toString()
Prints a string representation.- Overrides:
toStringin classjava.lang.Object