Mercurial > illumos > onarm
annotate usr/src/cmd/krb5/kadmin/gui/visualrt/sunsoft/jws/visual/rt/base/DesignerAccess.java @ 4:1a15d5aaf794
synchronized with onnv_86 (6202) in onnv-gate
author | Koji Uno <koji.uno@sun.com> |
---|---|
date | Mon, 31 Aug 2009 14:38:03 +0900 |
parents | c9caec207d52 |
children |
rev | line source |
---|---|
0 | 1 /* |
2 * CDDL HEADER START | |
3 * | |
4 * The contents of this file are subject to the terms of the | |
5 * Common Development and Distribution License, Version 1.0 only | |
6 * (the "License"). You may not use this file except in compliance | |
7 * with the License. | |
8 * | |
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE | |
10 * or http://www.opensolaris.org/os/licensing. | |
11 * See the License for the specific language governing permissions | |
12 * and limitations under the License. | |
13 * | |
14 * When distributing Covered Code, include this CDDL HEADER in each | |
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. | |
16 * If applicable, add the following below this CDDL HEADER, with the | |
17 * fields enclosed by brackets "[]" replaced with your own identifying | |
18 * information: Portions Copyright [yyyy] [name of copyright owner] | |
19 * | |
20 * CDDL HEADER END | |
21 */ | |
22 /* | |
4
1a15d5aaf794
synchronized with onnv_86 (6202) in onnv-gate
Koji Uno <koji.uno@sun.com>
parents:
0
diff
changeset
|
23 * ident "%Z%%M% %I% %E% SMI" |
0 | 24 * |
25 * Copyright (c) 2000 by Sun Microsystems, Inc. | |
26 * All rights reserved. | |
27 */ | |
28 | |
29 /* | |
30 * Copyright (C) 1996 Active Software, Inc. | |
31 * All rights reserved. | |
32 * | |
33 * @(#) DesignerAccess.java 1.25 - last change made 08/07/97 | |
34 */ | |
35 | |
36 package sunsoft.jws.visual.rt.base; | |
37 | |
38 import sunsoft.jws.visual.rt.shadow.java.awt.*; | |
39 import java.util.Hashtable; | |
40 import java.awt.Insets; | |
41 | |
42 /** | |
43 * Accessor class for use by Visual Java. Gives | |
44 * access to specific methods in the rt package that are package | |
45 * private. The methods in this class should not be used by any other | |
46 * application; they are for use by Visual Java only and are subject | |
47 * to change. | |
48 * | |
49 * @version 08/07/97, 1.25 | |
50 */ | |
51 public class DesignerAccess { | |
52 // | |
53 // Constants | |
54 // | |
55 public static final int STATUS_BAR = 2002; | |
56 | |
57 // | |
58 // Internal "Group" methods | |
59 // | |
60 public static ContainerShadow getContainer(Group group) { | |
61 return group.getContainer(); | |
62 } | |
63 | |
64 public static PanelShadow getPanel(Group group) { | |
65 return group.getPanel(); | |
66 } | |
67 | |
68 public static WindowShadow getWindow(Group group) { | |
69 return group.getWindow(); | |
70 } | |
71 | |
72 public static void internalShowGroup(Group group) { | |
73 group.internalShowGroup(); | |
74 } | |
75 | |
76 public static void internalHideGroup(Group group) { | |
77 group.internalHideGroup(); | |
78 } | |
79 | |
80 public static boolean doingShow(Group group) { | |
81 return group.doingShow(); | |
82 } | |
83 | |
84 public static void preValidate(Group group) { | |
85 group.preValidate(); | |
86 } | |
87 | |
88 // | |
89 // Internal "AttributeManager" methods | |
90 // | |
91 public static AttributeManager replicate(AttributeManager mgr) { | |
92 return mgr.replicate(); | |
93 } | |
94 | |
95 // | |
96 // Internal "Root" methods | |
97 // | |
98 public static void setMainChild(Root root, AttributeManager | |
99 container, boolean isPanel) { | |
100 root.setMainChild(container, isPanel); | |
101 } | |
102 | |
103 public static void addRootObserver(Root root, RootObserver observer) | |
104 | |
105 { | |
106 root.addRootObserver(observer); | |
107 } | |
108 | |
109 public static void removeRootObserver(Root root, RootObserver | |
110 observer) { | |
111 root.removeRootObserver(observer); | |
112 } | |
113 | |
114 public static void disableEventForwarding(Root root) { | |
115 root.disableEventForwarding(); | |
116 } | |
117 | |
118 public static void enableEventForwarding(Root root) { | |
119 root.enableEventForwarding(); | |
120 } | |
121 | |
122 public static void clearUniqueNameTable(Root root) { | |
123 root.clearUniqueNameTable(); | |
124 } | |
125 | |
126 public static boolean isValidName(String name) { | |
127 return Root.isValidName(name); | |
128 } | |
129 | |
130 public static boolean isUniqueName(Root root, String name) { | |
131 return root.isUniqueName(name); | |
132 } | |
133 | |
134 public static boolean isUniqueName(Root root, String name, | |
135 AttributeManager skip) { | |
136 return root.isUniqueName(name, skip); | |
137 } | |
138 | |
139 public static boolean isUniqueName(Root root, String name, | |
140 AttributeManager skip, | |
141 AttributeManager prune) { | |
142 return root.isUniqueName(name, skip, prune); | |
143 } | |
144 | |
145 public static String getUniqueName(Root root, AttributeManager | |
146 child) { | |
147 return root.getUniqueName(child); | |
148 } | |
149 | |
150 public static String getUniqueName(Root root, AttributeManager | |
151 child, Root otherTree) { | |
152 return root.getUniqueName(child, otherTree); | |
153 } | |
154 | |
155 public static String getProblemWithName(Root root, String name) { | |
156 return root.getProblemWithName(name); | |
157 } | |
158 | |
159 public static void setCursor(Root root, int cursor) { | |
160 root.setCursor(cursor); | |
161 } | |
162 | |
163 // | |
164 // LOADED ROOT | |
165 // | |
166 | |
167 /* | |
168 * Sets the loaded root flag. | |
169 */ | |
170 public static void setLoadedRoot(Root root, boolean flag) { | |
171 root.setLoadedRoot(flag); | |
172 } | |
173 | |
174 // | |
175 // Designer classes used by FrameShadow, DialogShadow, | |
176 // GBPanel, RootFrame | |
177 // and RootDialog. | |
178 // | |
179 | |
180 private static Class frameClass; | |
181 private static Class dialogClass; | |
182 private static Class gbPanelClass; | |
183 private static Class rootWindowHelperClass; | |
184 | |
185 public static void setFrameClass(Class fc) { | |
186 frameClass = fc; | |
187 } | |
188 | |
189 public static Class getFrameClass() { | |
190 return frameClass; | |
191 } | |
192 | |
193 public static void setDialogClass(Class dc) { | |
194 dialogClass = dc; | |
195 } | |
196 | |
197 public static Class getDialogClass() { | |
198 return dialogClass; | |
199 } | |
200 | |
201 public static void setGBPanelClass(Class gbc) { | |
202 gbPanelClass = gbc; | |
203 } | |
204 | |
205 public static Class getGBPanelClass() { | |
206 return gbPanelClass; | |
207 } | |
208 | |
209 public static void setRootWindowHelperClass(Class c) { | |
210 rootWindowHelperClass = c; | |
211 } | |
212 | |
213 public static Class getRootWindowHelperClass() { | |
214 return rootWindowHelperClass; | |
215 } | |
216 | |
217 // | |
218 // The current working directory for the designer | |
219 // | |
220 private static String cwd; | |
221 | |
222 public static void setCWD(String cwd) { | |
223 DesignerAccess.cwd = cwd; | |
224 } | |
225 | |
226 public static String getCWD() { | |
227 return cwd; | |
228 } | |
229 | |
230 // | |
231 // UNSAVED EDITS REGISTRY | |
232 // | |
233 | |
234 /** | |
235 * Is true when there are unsaved changes. Isn't going to get used | |
236 * unless the visual designer is running. | |
237 */ | |
238 private static boolean changesMade = false; | |
239 | |
240 /* | |
241 * Returns whether there have been any changes made | |
242 * since the last save. | |
243 */ | |
244 public static boolean getChangesMade() { | |
245 return (changesMade); | |
246 } | |
247 | |
248 /* | |
249 * Sets the changes made flag. Set to true when a change is made. | |
250 * This needs to set to false at the top-level of the designer's GUI | |
251 * whenever a file is opened, a "New" is done, a file is saved, etc. | |
252 * This doesn't work all the time, so we might replace it with | |
253 * something else in the future. | |
254 */ | |
255 public static void setChangesMade(boolean b) { | |
256 // if (b != changesMade) { | |
257 // Error e = new Error("DesignerAccess.changesMade | |
258 // switched to " + b); | |
259 // e.printStackTrace(); | |
260 // } | |
261 changesMade = b; | |
262 } | |
263 | |
264 // | |
265 // COMPONENT -> SHADOW HASHTABLE | |
266 // | |
267 | |
268 /* | |
269 * Storage to map components (keys) to their shadow objects (values) | |
270 */ | |
271 private static Hashtable shadowTable = new Hashtable(); | |
272 | |
273 /* | |
274 * Returns the shadow table, which contains components (as keys) and | |
275 * their associated shadow objects (as the values.) This one table | |
276 * is shared by all of runtime and the visual designer. | |
277 * It is used to | |
278 * find the Group that should handle the event for a particular | |
279 * component | |
280 * and to find the shadow object for components in the designer. | |
281 */ | |
282 public static Hashtable getShadowTable() { | |
283 return (shadowTable); | |
284 } | |
285 | |
286 /** | |
287 * Global lock (for paint workaround.) | |
288 */ | |
289 public static Object mutex = new Object(); | |
290 | |
291 /* | |
292 * | |
293 */ | |
294 | |
295 private static DesignerErrorInterface designerError = null; | |
296 | |
297 static public void | |
298 setDesignerErrorInterface(DesignerErrorInterface obj) { | |
299 designerError = obj; | |
300 } | |
301 | |
302 static public void reportInstantiationError(String msg) { | |
303 if (!java.beans.Beans.isDesignTime()) | |
304 return; | |
305 | |
306 if (designerError != null) { | |
307 designerError.reportInstantiationError(msg); | |
308 } | |
309 else | |
310 { | |
311 System.out.println(msg); | |
312 } | |
313 } | |
314 } |