0N/A/*
2362N/A * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Apackage java.awt;
0N/A
0N/Aimport sun.awt.AppContext;
0N/Aimport sun.awt.SunToolkit;
0N/A
0N/A/**
0N/A * A wrapping tag for a nested AWTEvent which indicates that the event was
0N/A * sent from another AppContext. The destination AppContext should handle the
0N/A * event even if it is currently blocked waiting for a SequencedEvent or
0N/A * another SentEvent to be handled.
0N/A *
0N/A * @author David Mendenhall
0N/A */
0N/Aclass SentEvent extends AWTEvent implements ActiveEvent {
0N/A /*
0N/A * serialVersionUID
0N/A */
0N/A private static final long serialVersionUID = -383615247028828931L;
0N/A
0N/A static final int ID =
0N/A java.awt.event.FocusEvent.FOCUS_LAST + 2;
0N/A
0N/A boolean dispatched;
0N/A private AWTEvent nested;
0N/A private AppContext toNotify;
0N/A
0N/A SentEvent() {
0N/A this(null);
0N/A }
0N/A SentEvent(AWTEvent nested) {
0N/A this(nested, null);
0N/A }
0N/A SentEvent(AWTEvent nested, AppContext toNotify) {
0N/A super((nested != null)
0N/A ? nested.getSource()
0N/A : Toolkit.getDefaultToolkit(),
0N/A ID);
0N/A this.nested = nested;
0N/A this.toNotify = toNotify;
0N/A }
0N/A
0N/A public void dispatch() {
0N/A try {
0N/A if (nested != null) {
0N/A Toolkit.getEventQueue().dispatchEvent(nested);
0N/A }
0N/A } finally {
0N/A dispatched = true;
0N/A if (toNotify != null) {
0N/A SunToolkit.postEvent(toNotify, new SentEvent());
0N/A }
0N/A synchronized (this) {
0N/A notifyAll();
0N/A }
0N/A }
0N/A }
0N/A final void dispose() {
0N/A dispatched = true;
0N/A if (toNotify != null) {
0N/A SunToolkit.postEvent(toNotify, new SentEvent());
0N/A }
0N/A synchronized (this) {
0N/A notifyAll();
0N/A }
0N/A }
0N/A}