public void addEventListener(final String type,
EventListener listener,
final boolean useCapture) {
final EventListener l = new EventListenerWrapper(documentWrapper, listener);
HashTable listeners;
if (useCapture) {
if (capturingListeners == null) {
capturingListeners = new HashTable(3);
}
listeners = capturingListeners;
} else {
if (bubblingListeners == null) {
bubblingListeners = new HashTable(3);
}
listeners = bubblingListeners;
}
HashTable ht = (HashTable)listeners.get(type);
if (ht == null) {
ht = new HashTable(3);
listeners.put(type, ht);
}
ht.put(listeners, l);
class Request implements Runnable {
public void run() {
((EventTarget)node).addEventListener(type, l, useCapture);
}