FileDocCategorySizeDatePackage
LayoutQueue.javaAPI DocJava SE 5 API1980Fri Aug 26 14:58:16 BST 2005javax.swing.text

LayoutQueue

public class LayoutQueue extends Object
A queue of text layout tasks.
author
Timothy Prinzing
version
1.6 12/19/03
see
AsyncBoxView
since
1.3

Fields Summary
Vector
tasks
Thread
worker
static LayoutQueue
defaultQueue
Constructors Summary
public LayoutQueue()
Construct a layout queue.

	tasks = new Vector();
    
Methods Summary
public synchronized voidaddTask(java.lang.Runnable task)
Add a task that is not needed immediately because the results are not believed to be visible.

	if (worker == null) {
	    worker = new LayoutThread();
	    worker.start();
	}
	tasks.addElement(task);
	notifyAll();
    
public static javax.swing.text.LayoutQueuegetDefaultQueue()
Fetch the default layout queue.

	if (defaultQueue == null) {
	    defaultQueue = new LayoutQueue();
	}
	return defaultQueue;
    
public static voidsetDefaultQueue(javax.swing.text.LayoutQueue q)
Set the default layout queue.

param
q the new queue.

	defaultQueue = q;
    
protected synchronized java.lang.RunnablewaitForWork()
Used by the worker thread to get a new task to execute

	while (tasks.size() == 0) {
	    try {
		wait();
	    } catch (InterruptedException ie) {
		return null;
	    }
	}
	Runnable work = (Runnable) tasks.firstElement();
	tasks.removeElementAt(0);
	return work;