Module org.jpo

Class SourcePicture

java.lang.Object
org.jpo.datamodel.SourcePicture

public class SourcePicture extends Object
This class can load and rotate a digital picture either immediately or in a separate thread from a URL
  • Constructor Details

    • SourcePicture

      public SourcePicture()
  • Method Details

    • getLoadTime

      public long getLoadTime()
    • loadPicture

      public void loadPicture(String sha256, File file, double rotation)
      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 image
      rotation - Image rotation
    • loadPictureInThread

      public 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. This is handy to update the screen while the loading chugs along in the background.
      Parameters:
      imageFile - The file with the image to be loaded
      priority - 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

      public boolean stopLoadingExcept(File exemptionFile)
      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

      public Dimension 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

      public void addListener(SourcePictureListener listener)
      Adds a listener
      Parameters:
      listener - Listener
    • removeListener

      public void removeListener(SourcePictureListener listener)
      method to register the listening object of the status events
      Parameters:
      listener - the listener to remove
    • getStatusCode

      public SourcePicture.SourcePictureStatus getStatusCode()
      Method that returns the status code of the picture loading.
      Returns:
      the status value
    • getStatusMessage

      public String 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

      public BufferedImage 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.