Class WebLogo


  • public class WebLogo
    extends java.lang.Object
    Class holding information about a logo of a web site, typically "apple.com" or "www.apple.com", by trying various "smart" algorithms to extract the logo from the site.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      WebLogoStateaddCompletionListener​(java.lang.Runnable runnable)
      Adds a completion listener that will wait for completion of the loading.
      booleanaddListener​(IWebLogoListener listener)
      Adds a listener for the loading state.
      java.lang.ThrowablegetException()
      The exception the caused the failure when performing the loading of the logo for the web site.
      java.io.FilegetFile()
      Gets the file in the file provider system that should be used for the web site logo.
      java.lang.StringgetSite()
      Gets the web site of the logo.
      WebLogoStategetState()
      Gets the state of the logo process.
      IWSFilegetWSFile()
      Gets the Web Server file in the file provider system that should be used for the web site logo.
      booleanisDisposed()
      Checks if disposed.
      booleanremoveListener​(IWebLogoListener listener)
      Removes a listener for the loading state.
      WebLogoStatewaitForCompletion​(java.lang.Runnable runnable)
      Waits for completion of the loading.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • isDisposed

        public boolean isDisposed()
        Checks if disposed.
        Returns:
        true if disposed of.
      • waitForCompletion

        public WebLogoState waitForCompletion​(java.lang.Runnable runnable)
        Waits for completion of the loading. The state must be in PENDING or LOADING mode. The current thread is blocked until it completes.

        Once the loading has completed, the runnable will be invoked. Please note that if the WebLogo instance has been disposed of, no call to the runnable will be performed.

        Parameters:
        runnable - Called when the loading completed, with or without error. Please check the getState() or getException().
        Returns:
        The state of the logo.
      • addCompletionListener

        public WebLogoState addCompletionListener​(java.lang.Runnable runnable)
        Adds a completion listener that will wait for completion of the loading. The state must be in PENDING or LOADING mode.

        The current thread is blocked until it completes. If you do not wish to have a blocking operation, use the addListener(IWebLogoListener) method instead.

        Once the loading has completed, the runnable will be invoked. Please note that if the WebLogo instance has been disposed of, no call to the runnable will be performed.

        Parameters:
        runnable - Called when the loading completed, with or without error. Please check the getState() or getException().
        Returns:
        The state of the logo.
      • getFile

        public java.io.File getFile()
        Gets the file in the file provider system that should be used for the web site logo. It might be a ".png" (quite common), ".jpg", but also other formats such as SVG (".svg).
        Returns:
        The file, it might NOT be loaded yet, this is can be null!
      • getWSFile

        public IWSFile getWSFile()
        Gets the Web Server file in the file provider system that should be used for the web site logo. It might be a ".png" (quite common), ".jpg", ".gif", but also other formats such as SVG (".svg).
        Returns:
        The wsFile, it might NOT be loaded yet, this is can be null!
      • getState

        public WebLogoState getState()
        Gets the state of the logo process.
        Returns:
        The enumeration value of State.
      • getException

        public java.lang.Throwable getException()
        The exception the caused the failure when performing the loading of the logo for the web site.
        Returns:
        The exception, or null for none.
      • getSite

        public java.lang.String getSite()
        Gets the web site of the logo.
        Returns:
        The web site string such as "apple.com" or "www.apple.com".
      • addListener

        public boolean addListener​(IWebLogoListener listener)
        Adds a listener for the loading state.

        Calling this method twice with the same listener will always return false.

        Parameters:
        listener - The listener that will be called from the loading thread.
        Returns:
        true when the listener is added successfully and that the state is not WebLogoState.PENDING and not WebLogoState.RETRIEVING.
      • removeListener

        public boolean removeListener​(IWebLogoListener listener)
        Removes a listener for the loading state.

        Calling this method twice with the same listener will always return false.

        Parameters:
        listener - The listener.
        Returns:
        true when the listener is removed successfully.