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
FieldsModifier and TypeFieldDescriptionprotected final ThumbnailQueueRequestCallbackHandlerThe target to notify that the Thumbnail is now readyprotected BooleanA flag to indicate that the request was canceled.protected final SortableDefaultMutableTreeNodeThe node for which we are to create a thumbnailprotected QUEUE_PRIORITYthe priority the request has on the queue.protected final DimensionThe size we should scale the thumbnail to -
Constructor Summary
ConstructorsConstructorDescriptionThumbnailQueueRequest(ThumbnailQueueRequestCallbackHandler callbackHandler, SortableDefaultMutableTreeNode node, QUEUE_PRIORITY priority, Dimension size) Constructs a ThumbnailQueueRequest object -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()Cancel the requestintcompareTo(ThumbnailQueueRequest thumbnailQueueRequest) Compares to another request based on priority.booleanCompares to another request based on priority.getIcon()getNode()Returns the node for the requestgetSize()The size the thumbnail should be scaled toreturns theThumbnailQueueRequestCallbackHandlerthat should be notified when the ImageIcon is readyvoidincreasePriorityTo(QUEUE_PRIORITY newPriority) Increases the priority of the request to the supplied higher priority if the supplied priority is higher.booleanvoidsends the notification that the Icon is available to the callback handler if the request was not canceled in the meantime.voidSets the icon after the creation queuevoidsetPriority(QUEUE_PRIORITY newPriority) sets the priority in which theThumbnailControlleris 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_PRIORITYandQUEUE_PRIORITY.LOWEST_PRIORITY.size- the maximum size of the thumbnail
-
-
Method Details
-
getThumbnailQueueRequestCallbackHandler
returns theThumbnailQueueRequestCallbackHandlerthat 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 theThumbnailControlleris to be created. The possible values areQUEUE_PRIORITY.LOWEST_PRIORITY,QUEUE_PRIORITY.LOW_PRIORITY,QUEUE_PRIORITY.MEDIUM_PRIORITYorQUEUE_PRIORITY.HIGH_PRIORITY. A high numeric value means less priority.- Parameters:
newPriority- The priority of the request:QUEUE_PRIORITY.LOW_PRIORITY,QUEUE_PRIORITY.MEDIUM_PRIORITYorQUEUE_PRIORITY.HIGH_PRIORITY
-
compareTo
Compares to another request based on priority.- Specified by:
compareToin 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
-