java.lang.Object
org.jpo.datamodel.SourcePicture
This class can load and rotate a digital picture either immediately or in a
separate thread from a URL
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
States of the source picture -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addListener
(SourcePictureListener listener) Adds a listenerint
return the height of the image or Zero if there is nonelong
int
Returns how much of the image has been loadeddouble
return the rotation of the imagegetSize()
return the size of the image or Dimension(0,0) if there is nonereturns the buffered image that was loaded or null if there is no image.Method that returns the status code of the picture loading.Method that returns the status code of the picture loading.int
getWidth()
return the width of the image or Zero if there is nonevoid
loadPicture
(String sha256, File file, double rotation) Loads the picture indicated by the file to this SourcePicture on the current thread.void
loadPictureInThread
(String sha256, File imageFile, int priority, double rotation) method to invoke with a file of a picture that is to be loaded in a new thread.void
removeListener
(SourcePictureListener listener) method to register the listening object of the status eventsvoid
this method can be invoked to flag the current reader to stop at a convenient momentboolean
stopLoadingExcept
(File exemptionFile) this method can be invoked to stop the current reader except if it is reading the desired file.
-
Constructor Details
-
SourcePicture
public SourcePicture()
-
-
Method Details
-
getLoadTime
public long getLoadTime() -
loadPicture
Loads the picture indicated by the file to this SourcePicture on the current thread. If the file doesn't exist the getSourceBufferedImage method will return a null.- Parameters:
file
- The file with the imagerotation
- Image rotation
-
loadPictureInThread
method to invoke with a file of a picture that is to be loaded in a new thread. This is handy to update the screen while the loading chugs along in the background.- Parameters:
imageFile
- The file with the image to be loadedpriority
- The Thread priority for this thread.rotation
- The rotation 0-360 to be used on this picture
-
stopLoading
public void stopLoading()this method can be invoked to flag the current reader to stop at a convenient moment -
stopLoadingExcept
this method can be invoked to stop the current reader except if it is reading the desired file. It returns true is the desired file is being loaded. Otherwise, it returns false.- Parameters:
exemptionFile
- The exemption URL- Returns:
- True if loading in progress, false if not
-
getSize
return the size of the image or Dimension(0,0) if there is none- Returns:
- the Dimension of the sourceBufferedImage
-
getHeight
public int getHeight()return the height of the image or Zero if there is none- Returns:
- the height of the image
-
getWidth
public int getWidth()return the width of the image or Zero if there is none- Returns:
- the width of the image
-
getRotation
public double getRotation()return the rotation of the image- Returns:
- the rotation angle
-
addListener
Adds a listener- Parameters:
listener
- Listener
-
removeListener
method to register the listening object of the status events- Parameters:
listener
- the listener to remove
-
getStatusCode
Method that returns the status code of the picture loading.- Returns:
- the status value
-
getStatusMessage
Method that returns the status code of the picture loading.- Returns:
- the message of the status
-
getPercentLoaded
public int getPercentLoaded()Returns how much of the image has been loaded- Returns:
- the percentage loaded
-
getSourceBufferedImage
returns the buffered image that was loaded or null if there is no image.- Returns:
- the
BufferedImage
that was loaded or null if there is no image.
-