public class SourcePicture
extends java.lang.Object
implements java.lang.Cloneable
Modifier and Type | Field and Description |
---|---|
static int |
ERROR
status code used to signal that there was an error
|
protected ucar.nc2.ui.image.SourcePicture.ImageProgressListener |
imageProgressListener
reference to the inner class that listens to the image loading progress
|
static int |
LOADING
status code used to signal that the thread is loading the image
|
static int |
LOADING_COMPLETED
status code used to tell that we have a finished loading
but only used on notifySourceLoadProgressListeners
|
static int |
LOADING_PROGRESS
status code used to tell that we have a progress update
but only used on notifySourceLoadProgressListeners
|
static int |
LOADING_STARTED
status code used to tell that we have started loading an
image but only used on notifySourceLoadProgressListeners
|
static int |
READY
status code used to signal that the rotated image is available.
|
static int |
ROTATING
status code used to signal that the thread is rotating the image
|
java.awt.image.BufferedImage |
sourcePictureBufferedImage
the Buffered Image that this class protects and provides features for.
|
static int |
UNINITIALISED
status code used to signal that the picture is not loaded
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(SourcePictureListener listener)
method to register the listening object of the status events
|
java.lang.Object |
clone()
creates a copy of the SourcePicture
|
int |
getHeight()
return the height of the image or Zero if there is none
|
int |
getPercentLoaded()
Returns how much of the image has been loaded
|
double |
getRotation()
return the rotation of the image
|
java.awt.Dimension |
getSize()
return the size of the image or Zero if there is none
|
java.awt.image.BufferedImage |
getSourceBufferedImage()
returns the buffered image that was loaded or null if there is no image.
|
SourcePicture |
getSourcePicture()
returns a reference to this
SourcePicture object |
int |
getStatusCode()
Method that returns the status code of the picture loading.
|
java.lang.String |
getStatusMessage()
Method that returns the status code of the picture loading.
|
java.net.URL |
getUrl()
return the URL of the original image
|
java.lang.String |
getUrlString()
return the URL of the original image as a string
|
int |
getWidth()
return the width of the image or Zero if there is none
|
boolean |
hasNoListeners()
method that says whether there are any listeners attached to this object
|
void |
loadPicture()
loads a picture from the URL in the imageUrl object into the sourcePictureBufferedImage
object and updates the status when done or failed.
|
void |
loadPicture(java.net.URL imageUrl,
double rotation)
method to invoke with a filename or URL of a picture that is to be loaded in
the main thread.
|
void |
loadPictureInThread(java.net.URL imageUrl,
int priority,
double rotation)
method to invoke with a filename or URL of a picture that is to be loaded
a new thread.
|
void |
removeListener(SourcePictureListener listener)
method to register the listening object of the status events
|
void |
setSourceBufferedImage(java.awt.image.BufferedImage img,
java.lang.String statusMessage)
sets the buffered image.
|
void |
showListeners() |
void |
stopLoading()
this method can be invoked to stop the current reader
|
boolean |
stopLoadingExcept(java.net.URL exemptionURL)
this method can be invoked to stop the current reader except if it
is reading the desired file.
|
public static final int UNINITIALISED
public static final int LOADING
public static final int ROTATING
public static final int READY
public static final int ERROR
public static final int LOADING_STARTED
public static final int LOADING_PROGRESS
public static final int LOADING_COMPLETED
public java.awt.image.BufferedImage sourcePictureBufferedImage
protected ucar.nc2.ui.image.SourcePicture.ImageProgressListener imageProgressListener
public void loadPictureInThread(java.net.URL imageUrl, int priority, double rotation)
imageUrl
- The URL of the image to be loadedpriority
- The Thread priority for this thread.rotation
- The rotation 0-360 to be used on this picturepublic void loadPicture(java.net.URL imageUrl, double rotation)
public void loadPicture()
public void stopLoading()
public boolean stopLoadingExcept(java.net.URL exemptionURL)
public java.awt.Dimension getSize()
public int getHeight()
public int getWidth()
public java.lang.String getUrlString()
public java.net.URL getUrl()
public double getRotation()
public void addListener(SourcePictureListener listener)
public void removeListener(SourcePictureListener listener)
public void showListeners()
public boolean hasNoListeners()
public int getStatusCode()
public java.lang.String getStatusMessage()
public int getPercentLoaded()
public java.awt.image.BufferedImage getSourceBufferedImage()
BufferedImage
that was loaded or null if there is no image.public void setSourceBufferedImage(java.awt.image.BufferedImage img, java.lang.String statusMessage)
public SourcePicture getSourcePicture()
SourcePicture
objectSourcePicture
objectpublic java.lang.Object clone()
clone
in class java.lang.Object