Class TabPreviewThread
java.lang.Object
java.lang.Thread
org.pushingpixels.lafwidget.utils.TrackableThread
org.pushingpixels.lafwidget.tabbed.TabPreviewThread
- All Implemented Interfaces:
Runnable
Thread for running the tab preview requests.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceInterface for offering the tab preview image once it has been computed.static classInformation for previewing a tabbed pane.Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsFields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Method Summary
Modifier and TypeMethodDescriptionvoidcancelTabPreviewRequests(Object initiator) Cancels all tab preview requests that were initiated by the specified initiator.static TabPreviewThreadReturns the singleton instance of the tab preview thread.protected voidgetSingleTabPreviewImage(JTabbedPane tabPane, TabPreviewPainter previewPainter, TabPreviewThread.TabPreviewInfo previewInfo, int tabIndex) Computes and offers the preview thumbnail for a single tab.static booleanReturns indication whether tab preview thread is running.voidqueueTabPreviewRequest(TabPreviewThread.TabPreviewInfo previewInfo) Queues the request to preview one or all tabs in the specified tabbed pane.protected voidIssues a stop request onthisthread.voidrun()Methods inherited from class org.pushingpixels.lafwidget.utils.TrackableThread
requestStopAllThreadsMethods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, toString, yield
-
Field Details
-
previewQueue
Queue of preview requests. ContainsTabPreviewThread.TabPreviewInfos.
-
-
Method Details
-
run
public void run() -
getSingleTabPreviewImage
protected void getSingleTabPreviewImage(JTabbedPane tabPane, TabPreviewPainter previewPainter, TabPreviewThread.TabPreviewInfo previewInfo, int tabIndex) Computes and offers the preview thumbnail for a single tab.- Parameters:
tabPane- Tabbed pane.previewPainter- Tab preview painter.previewInfo- Preview info.tabIndex- Index of the tab to preview.
-
queueTabPreviewRequest
Queues the request to preview one or all tabs in the specified tabbed pane. Once the request is queued, the thread will pick it up from the queue (in at most 500 milliseconds in the current implementation) and start processing it. For each tab (if all tabs were requested to be previewed), the preview thumbnail will be offered to the relevant callback. This allows to maintain the interactivity of the application while generating the preview thumbnails for the tab overview dialog (seeTabOverviewDialog).- Parameters:
previewInfo- Tab preview info.
-
cancelTabPreviewRequests
Cancels all tab preview requests that were initiated by the specified initiator.- Parameters:
initiator- Initiator.
-
requestStop
protected void requestStop()Description copied from class:TrackableThreadIssues a stop request onthisthread.- Specified by:
requestStopin classTrackableThread
-
getInstance
Returns the singleton instance of the tab preview thread.- Returns:
- The singleton instance of the tab preview thread.
-
instanceRunning
public static boolean instanceRunning()Returns indication whether tab preview thread is running.- Returns:
trueif the tab preview thread is running,falseotherwise.
-