java.lang.Object
org.jpo.cache.ThumbnailQueueRequest
- All Implemented Interfaces:
Comparable<ThumbnailQueueRequest>
The ThumbnailQueueRequest is the type of object that will sit on the
ThumbnailCreationQueue
with a references to the
ThumbnailQueueRequestCallbackHandler
and the queue priority.
When the Thumbnail has been created the
ThumbnailQueueRequestCallbackHandler.callbackThumbnailCreated(org.jpo.cache.ThumbnailQueueRequest)
method will be fired and the caller can process the new Thumbnail.-
Field Summary
Modifier and TypeFieldDescriptionprotected final ThumbnailQueueRequestCallbackHandler
The target to notify that the Thumbnail is now readyprotected Boolean
A flag to indicate that the request was canceled.protected final SortableDefaultMutableTreeNode
The node for which we are to create a thumbnailprotected QUEUE_PRIORITY
the priority the request has on the queue.protected final Dimension
The size we should scale the thumbnail to -
Constructor Summary
ConstructorDescriptionThumbnailQueueRequest
(ThumbnailQueueRequestCallbackHandler callbackHandler, SortableDefaultMutableTreeNode node, QUEUE_PRIORITY priority, Dimension size) Constructs a ThumbnailQueueRequest object -
Method Summary
Modifier and TypeMethodDescriptionvoid
cancel()
Cancel the requestint
compareTo
(ThumbnailQueueRequest thumbnailQueueRequest) Compares to another request based on priority.boolean
Compares to another request based on priority.getIcon()
getNode()
Returns the node for the requestgetSize()
The size the thumbnail should be scaled toreturns theThumbnailQueueRequestCallbackHandler
that should be notified when the ImageIcon is readyvoid
increasePriorityTo
(QUEUE_PRIORITY newPriority) Increases the priority of the request to the supplied higher priority if the supplied priority is higher.boolean
void
sends the notification that the Icon is available to the callback handler if the request was not canceled in the meantime.void
Sets the icon after the creation queuevoid
setPriority
(QUEUE_PRIORITY newPriority) sets the priority in which theThumbnailController
is to be created.
-
Field Details
-
callbackHandler
The target to notify that the Thumbnail is now ready -
priority
the priority the request has on the queue. -
size
The size we should scale the thumbnail to -
node
The node for which we are to create a thumbnail -
isCanceled
A flag to indicate that the request was canceled.
-
-
Constructor Details
-
ThumbnailQueueRequest
public ThumbnailQueueRequest(ThumbnailQueueRequestCallbackHandler callbackHandler, SortableDefaultMutableTreeNode node, QUEUE_PRIORITY priority, Dimension size) Constructs a ThumbnailQueueRequest object- Parameters:
callbackHandler
- The callback handler that will be notified when the image icon is readynode
- the node for which the image is to be createdpriority
- The queue priority with which the thumbnail is to be created Possible values areQUEUE_PRIORITY.HIGH_PRIORITY
,QUEUE_PRIORITY.MEDIUM_PRIORITY
,QUEUE_PRIORITY.LOW_PRIORITY
andQUEUE_PRIORITY.LOWEST_PRIORITY
.size
- the maximum size of the thumbnail
-
-
Method Details
-
getThumbnailQueueRequestCallbackHandler
returns theThumbnailQueueRequestCallbackHandler
that should be notified when the ImageIcon is ready- Returns:
- the thumbnail
-
notifyCallbackHandler
public void notifyCallbackHandler()sends the notification that the Icon is available to the callback handler if the request was not canceled in the meantime. -
setPriority
sets the priority in which theThumbnailController
is to be created. The possible values areQUEUE_PRIORITY.LOWEST_PRIORITY
,QUEUE_PRIORITY.LOW_PRIORITY
,QUEUE_PRIORITY.MEDIUM_PRIORITY
orQUEUE_PRIORITY.HIGH_PRIORITY
. A high numeric value means less priority.- Parameters:
newPriority
- The priority of the request:QUEUE_PRIORITY.LOW_PRIORITY
,QUEUE_PRIORITY.MEDIUM_PRIORITY
orQUEUE_PRIORITY.HIGH_PRIORITY
-
compareTo
Compares to another request based on priority.- Specified by:
compareTo
in interfaceComparable<ThumbnailQueueRequest>
- Parameters:
thumbnailQueueRequest
- The request to compare against- Returns:
- a negative 0 or positive number as defined by the compareTo interface
-
equals
Compares to another request based on priority. -
increasePriorityTo
Increases the priority of the request to the supplied higher priority if the supplied priority is higher.- Parameters:
newPriority
- the new, possibly higher priority
-
getSize
The size the thumbnail should be scaled to- Returns:
- the size
-
getNode
Returns the node for the request- Returns:
- the node
-
getIcon
- Returns:
- the icon that was created
-
setIcon
Sets the icon after the creation queue- Parameters:
icon
- the new icon
-
isCanceled
public boolean isCanceled()- Returns:
- true is the request is canceled
-
cancel
public void cancel()Cancel the request
-