Package com.iizix.server.webthumbs
Class WebThumbnail
java.lang.Object
com.iizix.server.webthumbs.WebThumbnail
Class holding information about a thumbnail of a Website, typically "apple.com" or "www.apple.com", such as can be viewed in a browser.
Method Summary
Modifier and TypeMethodDescriptionaddCompletionListener
(Runnable runnable) Adds a completion listener that will wait for completion of the loading.boolean
addListener
(IWebThumbnailListener listener) Adds a listener for the loading state.The exception the caused the failure when performing the loading of the thumbnail for the Website.getFile()
Gets the file in the file provider system that should be used for the Website thumbnail: 1280 x 1024.getSite()
Gets the Website of the thumbnail.getState()
Gets the state of the thumbnail process.Gets the Web Server File that should be used for the Website thumbnail: 1280 x 1024.boolean
Checks if disposed.boolean
removeListener
(IWebThumbnailListener listener) Removes a listener for the loading state.waitForCompletion
(Runnable runnable) Waits for completion of the loading.
Method Details
isDisposed
public boolean isDisposed()Checks if disposed.- Returns:
- true if disposed of.
waitForCompletion
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 theWebThumbnail
instance has been disposed of, no call to therunnable
will be performed.- Parameters:
runnable
- Called when the loading completed, with or without error. Please check thegetState()
orgetException()
.- Returns:
- The state of the thumbnail.
addCompletionListener
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
method instead.addListener(IWebThumbnailListener)
Once the loading has completed, the
runnable
will be invoked. Please note that if theWebThumbnail
instance has been disposed of, no call to therunnable
will be performed.- Parameters:
runnable
- Called when the loading completed, with or without error. Please check thegetState()
orgetException()
.- Returns:
- The state of the thumbnail.
getFile
Gets the file in the file provider system that should be used for the Website thumbnail: 1280 x 1024. The file might not exist!- Returns:
- The file, it might NOT be loaded yet, this is can be
null
!
getWSFile
Gets the Web Server File that should be used for the Website thumbnail: 1280 x 1024.- Returns:
- The wsFile, it might NOT be loaded yet, this is can be
null
!
getState
Gets the state of the thumbnail process.- Returns:
- The enumeration value of State.
getException
The exception the caused the failure when performing the loading of the thumbnail for the Website.- Returns:
- The exception, or null for none.
getSite
Gets the Website of the thumbnail.- Returns:
- The Website string such as "apple.com" or "www.apple.com".
addListener
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 thestate
is not
and notWebThumbnailState.PENDING
.WebThumbnailState.RETRIEVING
removeListener
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.