author | herrick |
Tue, 12 Nov 2019 10:18:11 -0500 | |
branch | JDK-8200758-branch |
changeset 59033 | 5ac41b9db9da |
parent 47216 | 71c04702a3d5 |
permissions | -rw-r--r-- |
29883
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
1 |
/* |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
2 |
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
4 |
* |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
10 |
* |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
15 |
* accompanied this code). |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
16 |
* |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
20 |
* |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
23 |
* questions. |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
24 |
*/ |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
25 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
26 |
package com.sun.java.accessibility.util; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
27 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
28 |
import java.awt.*; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
29 |
import java.util.EventListener; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
30 |
import javax.accessibility.*; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
31 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
32 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
33 |
/** |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
34 |
* The TopLevelWindowMulticaster class is used to maintain a list of |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
35 |
* TopLevelWindowListener classes. It is intended to be used primarily |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
36 |
* for internal support in the EventQueueMonitor class, and is not intended |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
37 |
* to be used by classes outside the Java Accessibility Utility package. |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
38 |
* |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
39 |
* @see EventQueueMonitor |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
40 |
* @see EventQueueMonitor#addTopLevelWindowListener |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
41 |
* @see EventQueueMonitor#removeTopLevelWindowListener |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
42 |
* |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
43 |
*/ |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
44 |
class TopLevelWindowMulticaster |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
45 |
extends AWTEventMulticaster implements TopLevelWindowListener |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
46 |
{ |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
47 |
protected TopLevelWindowMulticaster(EventListener a, EventListener b) { |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
48 |
super(a, b); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
49 |
} |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
50 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
51 |
public void topLevelWindowCreated(Window w) { |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
52 |
((TopLevelWindowListener)a).topLevelWindowCreated(w); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
53 |
((TopLevelWindowListener)b).topLevelWindowCreated(w); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
54 |
} |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
55 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
56 |
public void topLevelWindowDestroyed(Window w) { |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
57 |
((TopLevelWindowListener)a).topLevelWindowDestroyed(w); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
58 |
((TopLevelWindowListener)b).topLevelWindowDestroyed(w); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
59 |
} |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
60 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
61 |
public static TopLevelWindowListener add(TopLevelWindowListener a, TopLevelWindowListener b) { |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
62 |
return (TopLevelWindowListener)addInternal(a, b); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
63 |
} |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
64 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
65 |
public static TopLevelWindowListener remove(TopLevelWindowListener l, TopLevelWindowListener oldl) { |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
66 |
return (TopLevelWindowListener)removeInternal(l, oldl); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
67 |
} |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
68 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
69 |
protected static EventListener addInternal(EventListener a, EventListener b) { |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
70 |
if (a == null) return b; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
71 |
if (b == null) return a; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
72 |
return new TopLevelWindowMulticaster(a, b); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
73 |
} |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
74 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
75 |
protected static EventListener removeInternal(EventListener l, EventListener oldl) { |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
76 |
if (l == oldl || l == null) { |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
77 |
return null; |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
78 |
} else if (l instanceof TopLevelWindowMulticaster) { |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
79 |
return ((TopLevelWindowMulticaster)l).remove(oldl); |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
80 |
} else { |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
81 |
return l; // it's not here |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
82 |
} |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
83 |
} |
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
84 |
|
e02d168adbc6
8076182: Open Source Java Access Bridge - Create Patch for JEP C127 8055831
ptbrunet
parents:
diff
changeset
|
85 |
} |