jdk/src/share/classes/java/awt/EventDispatchThread.java
author ant
Wed, 04 Jun 2008 12:32:05 +0400 (2008-06-04)
changeset 1168 5f1d2fcfcd3e
parent 2 90ce3da70b43
child 1293 ef349b440fc9
child 1961 436a5a828d9f
permissions -rw-r--r--
6280057: I have audited SystemTray and TrayIcon code Summary: small refactoring Reviewed-by: dcherepanov
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * Copyright 1996-2007 Sun Microsystems, Inc.  All Rights Reserved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package java.awt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.awt.event.InputEvent;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.awt.event.MouseEvent;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.awt.event.ActionEvent;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.awt.event.WindowEvent;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.lang.reflect.Method;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.security.AccessController;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import sun.security.action.GetPropertyAction;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import sun.awt.AWTAutoShutdown;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import sun.awt.SunToolkit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
import java.util.Vector;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
import java.util.logging.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
import sun.awt.dnd.SunDragSourceContextPeer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * EventDispatchThread is a package-private AWT class which takes
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * events off the EventQueue and dispatches them to the appropriate
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * AWT components.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * The Thread starts a "permanent" event pump with a call to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * pumpEvents(Conditional) in its run() method. Event handlers can choose to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * block this event pump at any time, but should start a new pump (<b>not</b>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * a new EventDispatchThread) by again calling pumpEvents(Conditional). This
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * secondary event pump will exit automatically as soon as the Condtional
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * evaluate()s to false and an additional Event is pumped and dispatched.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * @author Tom Ball
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * @author Amy Fowler
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * @author Fred Ecks
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * @author David Mendenhall
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * @since 1.1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
class EventDispatchThread extends Thread {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    private static final Logger eventLog = Logger.getLogger("java.awt.event.EventDispatchThread");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    private EventQueue theQueue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    private boolean doDispatch = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    private static final int ANY_EVENT = -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    private Vector<EventFilter> eventFilters = new Vector<EventFilter>();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
    // used in handleException
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    private int modalFiltersCount = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    EventDispatchThread(ThreadGroup group, String name, EventQueue queue) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
        super(group, name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
        theQueue = queue;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    void stopDispatchingImpl(boolean wait) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
        // Note: We stop dispatching via a flag rather than using
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
        // Thread.interrupt() because we can't guarantee that the wait()
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
        // we interrupt will be EventQueue.getNextEvent()'s.  -fredx 8-11-98
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
        StopDispatchEvent stopEvent = new StopDispatchEvent();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
        // wait for the dispatcher to complete
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
        if (Thread.currentThread() != this) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
            // fix 4122683, 4128923
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
            // Post an empty event to ensure getNextEvent is unblocked
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
            //
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
            // We have to use postEventPrivate instead of postEvent because
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
            // EventQueue.pop calls EventDispatchThread.stopDispatching.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
            // Calling SunToolkit.flushPendingEvents in this case could
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
            // lead to deadlock.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
            theQueue.postEventPrivate(stopEvent);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
            if (wait) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
                try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
                    join();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
                } catch(InterruptedException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
            stopEvent.dispatch();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
        synchronized (theQueue) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
            if (theQueue.getDispatchThread() == this) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
                theQueue.detachDispatchThread();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    public void stopDispatching() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
        stopDispatchingImpl(true);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    public void stopDispatchingLater() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
        stopDispatchingImpl(false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
    class StopDispatchEvent extends AWTEvent implements ActiveEvent {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
         * serialVersionUID
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
        static final long serialVersionUID = -3692158172100730735L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
        public StopDispatchEvent() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
            super(EventDispatchThread.this,0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
        public void dispatch() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
            doDispatch = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
    public void run() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
            pumpEvents(new Conditional() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
                public boolean evaluate() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
                    return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
            });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
        } finally {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
            /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
             * This synchronized block is to secure that the event dispatch
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
             * thread won't die in the middle of posting a new event to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
             * associated event queue. It is important because we notify
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
             * that the event dispatch thread is busy after posting a new event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
             * to its queue, so the EventQueue.dispatchThread reference must
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
             * be valid at that point.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
             */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
            synchronized (theQueue) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
                if (theQueue.getDispatchThread() == this) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
                    theQueue.detachDispatchThread();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
                /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
                 * Event dispatch thread dies in case of an uncaught exception.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
                 * A new event dispatch thread for this queue will be started
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
                 * only if a new event is posted to it. In case if no more
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
                 * events are posted after this thread died all events that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
                 * currently are in the queue will never be dispatched.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
                 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
                /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
                 * Fix for 4648733. Check both the associated java event
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
                 * queue and the PostEventQueue.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
                 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
                if (theQueue.peekEvent() != null ||
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
                    !SunToolkit.isPostEventQueueEmpty()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
                    theQueue.initDispatchThread();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
                AWTAutoShutdown.getInstance().notifyThreadFree(this);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
    void pumpEvents(Conditional cond) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
        pumpEvents(ANY_EVENT, cond);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
    void pumpEventsForHierarchy(Conditional cond, Component modalComponent) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
        pumpEventsForHierarchy(ANY_EVENT, cond, modalComponent);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
    void pumpEvents(int id, Conditional cond) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
        pumpEventsForHierarchy(id, cond, null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
    void pumpEventsForHierarchy(int id, Conditional cond, Component modalComponent)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
        pumpEventsForFilter(id, cond, new HierarchyEventFilter(modalComponent));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
    void pumpEventsForFilter(Conditional cond, EventFilter filter) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
        pumpEventsForFilter(ANY_EVENT, cond, filter);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
    void pumpEventsForFilter(int id, Conditional cond, EventFilter filter) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
        addEventFilter(filter);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
        while (doDispatch && cond.evaluate()) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
            if (isInterrupted() || !pumpOneEventForFilters(id)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
                doDispatch = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
        removeEventFilter(filter);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
    void addEventFilter(EventFilter filter) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
        synchronized (eventFilters) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
            if (!eventFilters.contains(filter)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
                if (filter instanceof ModalEventFilter) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
                    ModalEventFilter newFilter = (ModalEventFilter)filter;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
                    int k = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
                    for (k = 0; k < eventFilters.size(); k++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
                        EventFilter f = eventFilters.get(k);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
                        if (f instanceof ModalEventFilter) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
                            ModalEventFilter cf = (ModalEventFilter)f;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
                            if (cf.compareTo(newFilter) > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
                                break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
                            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
                        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
                    eventFilters.add(k, filter);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
                    modalFiltersCount++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
                } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
                    eventFilters.add(filter);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    void removeEventFilter(EventFilter filter) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
        synchronized (eventFilters) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
            if (eventFilters.contains(filter)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
                if (filter instanceof ModalEventFilter) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
                    modalFiltersCount--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
                eventFilters.remove(filter);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
    boolean pumpOneEventForFilters(int id) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
            AWTEvent event;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
            boolean eventOK;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
            do {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
                event = (id == ANY_EVENT)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
                    ? theQueue.getNextEvent()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
                    : theQueue.getNextEvent(id);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
                eventOK = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
                synchronized (eventFilters) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
                    for (int i = eventFilters.size() - 1; i >= 0; i--) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
                        EventFilter f = eventFilters.get(i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
                        EventFilter.FilterAction accept = f.acceptEvent(event);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
                        if (accept == EventFilter.FilterAction.REJECT) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
                            eventOK = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
                            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
                        } else if (accept == EventFilter.FilterAction.ACCEPT_IMMEDIATELY) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
                            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
                        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
                eventOK = eventOK && SunDragSourceContextPeer.checkEvent(event);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
                if (!eventOK) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
                    event.consume();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
            while (eventOK == false);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
            if (eventLog.isLoggable(Level.FINEST)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
                eventLog.log(Level.FINEST, "Dispatching: " + event);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
            theQueue.dispatchEvent(event);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
            return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
        catch (ThreadDeath death) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
        catch (InterruptedException interruptedException) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
            return false; // AppContext.dispose() interrupts all
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
                          // Threads in the AppContext
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
        // Can get and throw only unchecked exceptions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
        catch (RuntimeException e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
            processException(e, modalFiltersCount > 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
        } catch (Error e) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
            processException(e, modalFiltersCount > 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
        return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
    private void processException(Throwable e, boolean isModal) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
        if (eventLog.isLoggable(Level.FINE)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
            eventLog.log(Level.FINE, "Processing exception: " + e +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
                                     ", isModal = " + isModal);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
        if (!handleException(e)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
            // See bug ID 4499199.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
            // If we are in a modal dialog, we cannot throw
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
            // an exception for the ThreadGroup to handle (as added
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
            // in RFE 4063022).  If we did, the message pump of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
            // the modal dialog would be interrupted.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
            // We instead choose to handle the exception ourselves.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
            // It may be useful to add either a runtime flag or API
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
            // later if someone would like to instead dispose the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
            // dialog and allow the thread group to handle it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
            if (isModal) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
                System.err.println(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
                    "Exception occurred during event dispatching:");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
                e.printStackTrace();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
            } else if (e instanceof RuntimeException) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
                throw (RuntimeException)e;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
            } else if (e instanceof Error) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
                throw (Error)e;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
    private static final String handlerPropName = "sun.awt.exception.handler";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
    private static String handlerClassName = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
    private static String NO_HANDLER = new String();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
     * Handles an exception thrown in the event-dispatch thread.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
     * <p> If the system property "sun.awt.exception.handler" is defined, then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
     * when this method is invoked it will attempt to do the following:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
     * <ol>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
     * <li> Load the class named by the value of that property, using the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
     *      current thread's context class loader,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
     * <li> Instantiate that class using its zero-argument constructor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
     * <li> Find the resulting handler object's <tt>public void handle</tt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
     *      method, which should take a single argument of type
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
     *      <tt>Throwable</tt>, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
     * <li> Invoke the handler's <tt>handle</tt> method, passing it the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
     *      <tt>thrown</tt> argument that was passed to this method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
     * </ol>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
     * If any of the first three steps fail then this method will return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
     * <tt>false</tt> and all following invocations of this method will return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
     * <tt>false</tt> immediately.  An exception thrown by the handler object's
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
     * <tt>handle</tt> will be caught, and will cause this method to return
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
     * <tt>false</tt>.  If the handler's <tt>handle</tt> method is successfully
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
     * invoked, then this method will return <tt>true</tt>.  This method will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
     * never throw any sort of exception.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
     * <p> <i>Note:</i> This method is a temporary hack to work around the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
     * absence of a real API that provides the ability to replace the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
     * event-dispatch thread.  The magic "sun.awt.exception.handler" property
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
     * <i>will be removed</i> in a future release.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
     * @param  thrown  The Throwable that was thrown in the event-dispatch
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
     *                 thread
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
     * @return  <tt>false</tt> if any of the above steps failed, otherwise
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
     *          <tt>true</tt>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
    private boolean handleException(Throwable thrown) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
        try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
            if (handlerClassName == NO_HANDLER) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
                return false;   /* Already tried, and failed */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
            /* Look up the class name */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
            if (handlerClassName == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
                handlerClassName = ((String) AccessController.doPrivileged(
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
                    new GetPropertyAction(handlerPropName)));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
                if (handlerClassName == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
                    handlerClassName = NO_HANDLER; /* Do not try this again */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
                    return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
            /* Load the class, instantiate it, and find its handle method */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
            Method m;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
            Object h;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
            try {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
                ClassLoader cl = Thread.currentThread().getContextClassLoader();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
                Class c = Class.forName(handlerClassName, true, cl);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
                m = c.getMethod("handle", new Class[] { Throwable.class });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
                h = c.newInstance();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
            } catch (Throwable x) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
                handlerClassName = NO_HANDLER; /* Do not try this again */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
                return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
            /* Finally, invoke the handler */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
            m.invoke(h, new Object[] { thrown });
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
        } catch (Throwable x) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
            return false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
        return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
    boolean isDispatching(EventQueue eq) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
        return theQueue.equals(eq);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
    EventQueue getEventQueue() { return theQueue; }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
    private static class HierarchyEventFilter implements EventFilter {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
        private Component modalComponent;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
        public HierarchyEventFilter(Component modalComponent) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
            this.modalComponent = modalComponent;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
        public FilterAction acceptEvent(AWTEvent event) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
            if (modalComponent != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
                int eventID = event.getID();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
                boolean mouseEvent = (eventID >= MouseEvent.MOUSE_FIRST) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
                                     (eventID <= MouseEvent.MOUSE_LAST);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
                boolean actionEvent = (eventID >= ActionEvent.ACTION_FIRST) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
                                      (eventID <= ActionEvent.ACTION_LAST);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
                boolean windowClosingEvent = (eventID == WindowEvent.WINDOW_CLOSING);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
                /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
                 * filter out MouseEvent and ActionEvent that's outside
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
                 * the modalComponent hierarchy.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
                 * KeyEvent is handled by using enqueueKeyEvent
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
                 * in Dialog.show
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
                 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
                if (Component.isInstanceOf(modalComponent, "javax.swing.JInternalFrame")) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
                    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
                     * Modal internal frames are handled separately. If event is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
                     * for some component from another heavyweight than modalComp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
                     * it is accepted. If heavyweight is the same - we still accept
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
                     * event and perform further filtering in LightweightDispatcher
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
                     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
                    return windowClosingEvent ? FilterAction.REJECT : FilterAction.ACCEPT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
                if (mouseEvent || actionEvent || windowClosingEvent) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
                    Object o = event.getSource();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
                    if (o instanceof sun.awt.ModalExclude) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
                        // Exclude this object from modality and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
                        // continue to pump it's events.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
                        return FilterAction.ACCEPT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
                    } else if (o instanceof Component) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
                        Component c = (Component) o;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
                        // 5.0u3 modal exclusion
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
                        boolean modalExcluded = false;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
                        if (modalComponent instanceof Container) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
                            while (c != modalComponent && c != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
                                if ((c instanceof Window) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
                                    (sun.awt.SunToolkit.isModalExcluded((Window)c))) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
                                    // Exclude this window and all its children from
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
                                    //  modality and continue to pump it's events.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
                                    modalExcluded = true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
                                    break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
                                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
                                c = c.getParent();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
                            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
                        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
                        if (!modalExcluded && (c != modalComponent)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
                            return FilterAction.REJECT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
                        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
                    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
            return FilterAction.ACCEPT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
}