xref: /titanic_44/usr/src/cmd/krb5/kadmin/gui/KdcGuiOps.java (revision 9dd0f810214fdc8e1af881a9a5c4b6927629ff9e)
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 /*
23  * ident	"%Z%%M%	%I%	%E% SMI"
24  *
25  * Copyright (c) 2001 by Sun Microsystems, Inc.
26  * All rights reserved.
27  *
28  */
29 
30 /**
31  * This file was originally automatically generated by Java WorkShop.
32  *
33  * Runtime vendor: SunSoft, Inc.
34  * Runtime version: 1.0
35  *
36  * Visual vendor: SunSoft, Inc.
37  * Visual version: 1.0
38  */
39 
40 
41 import sunsoft.jws.visual.rt.base.*;
42 import sunsoft.jws.visual.rt.type.*;
43 import java.awt.Event;
44 
45 
46 public class KdcGuiOps extends Operations {
47     private Op ops[];
48 
49     private KdcGui group;
50     private KdcGuiRoot gui;
51 
52     public void setGroup(Group group) {
53         this.group = (KdcGui)group;
54     }
55 
56     public void setRoot(Root root) {
57         this.gui = (KdcGuiRoot)root;
58         if (ops == null)
59             initializeOps();
60     }
61 
62     public boolean handleMessage(Message msg) {
63         for (int i = 0; i < ops.length; i++) {
64             if (ops[i].hasCode()) {
65                 if (ops[i].matchMessage(msg)) {
66                     handleCallback(i, msg,
67 				   (msg.isAWT ? (Event)msg.arg : null));
68                 }
69             } else {
70                 ops[i].handleMessage(msg);
71             }
72         }
73 
74         return false;
75     }
76 
77     private void initializeOps() {
78         ops = new Op[17];
79 
80         ops[0] = new Op(gui);
81         ops[0].name = "Op1";
82         ops[0].filter = new OpFilter();
83         ops[0].filter.filterType = OpFilter.EVENT;
84         ops[0].filter.target = gui.Exit2;
85         ops[0].filter.id = 1001;
86         ops[0].action = new OpAction();
87         ops[0].action.actionType = OpAction.CODE;
88 
89         ops[1] = new Op(gui);
90         ops[1].name = "Op1";
91         ops[1].filter = new OpFilter();
92         ops[1].filter.filterType = OpFilter.EVENT;
93         ops[1].filter.target = gui.browserHelp1;
94         ops[1].filter.id = 1001;
95         ops[1].action = new OpAction();
96         ops[1].action.actionType = OpAction.CODE;
97 
98         ops[2] = new Op(gui);
99         ops[2].name = "Op1";
100         ops[2].filter = new OpFilter();
101         ops[2].filter.filterType = OpFilter.EVENT;
102         ops[2].filter.target = gui.Context2;
103         ops[2].filter.id = 1001;
104         ops[2].action = new OpAction();
105         ops[2].action.actionType = OpAction.CODE;
106 
107         ops[3] = new Op(gui);
108         ops[3].name = "Op1";
109         ops[3].filter = new OpFilter();
110         ops[3].filter.filterType = OpFilter.EVENT;
111         ops[3].filter.target = gui.About2;
112         ops[3].filter.id = 1001;
113         ops[3].action = new OpAction();
114         ops[3].action.actionType = OpAction.CODE;
115 
116         ops[4] = new Op(gui);
117         ops[4].name = "Exit";
118         ops[4].filter = new OpFilter();
119         ops[4].filter.filterType = OpFilter.EVENT;
120         ops[4].filter.target = gui.mainframe;
121         ops[4].filter.id = 1001;
122         ops[4].action = new OpAction();
123         ops[4].action.actionType = OpAction.CODE;
124 
125         ops[5] = new Op(gui);
126         ops[5].name = "Op1";
127         ops[5].filter = new OpFilter();
128         ops[5].filter.filterType = OpFilter.EVENT;
129         ops[5].filter.target = gui.PrintCurPr;
130         ops[5].filter.id = 1001;
131         ops[5].action = new OpAction();
132         ops[5].action.actionType = OpAction.CODE;
133 
134         ops[6] = new Op(gui);
135         ops[6].name = "Op1";
136         ops[6].filter = new OpFilter();
137         ops[6].filter.filterType = OpFilter.EVENT;
138         ops[6].filter.target = gui.PrintCurPol;
139         ops[6].filter.id = 1001;
140         ops[6].action = new OpAction();
141         ops[6].action.actionType = OpAction.CODE;
142 
143         ops[7] = new Op(gui);
144         ops[7].name = "Op1";
145         ops[7].filter = new OpFilter();
146         ops[7].filter.filterType = OpFilter.EVENT;
147         ops[7].filter.target = gui.PrintPrlist;
148         ops[7].filter.id = 1001;
149         ops[7].action = new OpAction();
150         ops[7].action.actionType = OpAction.CODE;
151 
152         ops[8] = new Op(gui);
153         ops[8].name = "Op1";
154         ops[8].filter = new OpFilter();
155         ops[8].filter.filterType = OpFilter.EVENT;
156         ops[8].filter.target = gui.PrintPollist;
157         ops[8].filter.id = 1001;
158         ops[8].action = new OpAction();
159         ops[8].action.actionType = OpAction.CODE;
160 
161         ops[9] = new Op(gui);
162         ops[9].name = "Op1";
163         ops[9].filter = new OpFilter();
164         ops[9].filter.filterType = OpFilter.EVENT;
165         ops[9].filter.target = gui.logout;
166         ops[9].filter.id = 1001;
167         ops[9].action = new OpAction();
168         ops[9].action.actionType = OpAction.CODE;
169 
170         ops[10] = new Op(gui);
171         ops[10].name = "Exit";
172         ops[10].filter = new OpFilter();
173         ops[10].filter.filterType = OpFilter.EVENT;
174         ops[10].filter.target = gui.Exit;
175         ops[10].filter.id = 1001;
176         ops[10].action = new OpAction();
177         ops[10].action.actionType = OpAction.CODE;
178 
179         ops[11] = new Op(gui);
180         ops[11].name = "Op1";
181         ops[11].filter = new OpFilter();
182         ops[11].filter.filterType = OpFilter.EVENT;
183         ops[11].filter.target = gui.editPreferences;
184         ops[11].filter.id = 1001;
185         ops[11].action = new OpAction();
186         ops[11].action.actionType = OpAction.CODE;
187 
188         ops[12] = new Op(gui);
189         ops[12].name = "Op1";
190         ops[12].filter = new OpFilter();
191         ops[12].filter.filterType = OpFilter.EVENT;
192         ops[12].filter.target = gui.refreshPrincipals;
193         ops[12].filter.id = 1001;
194         ops[12].action = new OpAction();
195         ops[12].action.actionType = OpAction.CODE;
196 
197         ops[13] = new Op(gui);
198         ops[13].name = "Op1";
199         ops[13].filter = new OpFilter();
200         ops[13].filter.filterType = OpFilter.EVENT;
201         ops[13].filter.target = gui.refreshPolicies;
202         ops[13].filter.id = 1001;
203         ops[13].action = new OpAction();
204         ops[13].action.actionType = OpAction.CODE;
205 
206         ops[14] = new Op(gui);
207         ops[14].name = "Op1";
208         ops[14].filter = new OpFilter();
209         ops[14].filter.filterType = OpFilter.EVENT;
210         ops[14].filter.target = gui.browserHelp2;
211         ops[14].filter.id = 1001;
212         ops[14].action = new OpAction();
213         ops[14].action.actionType = OpAction.CODE;
214 
215         ops[15] = new Op(gui);
216         ops[15].name = "Op1";
217         ops[15].filter = new OpFilter();
218         ops[15].filter.filterType = OpFilter.EVENT;
219         ops[15].filter.target = gui.Context;
220         ops[15].filter.id = 1001;
221         ops[15].action = new OpAction();
222         ops[15].action.actionType = OpAction.CODE;
223 
224         ops[16] = new Op(gui);
225         ops[16].name = "Op1";
226         ops[16].filter = new OpFilter();
227         ops[16].filter.filterType = OpFilter.EVENT;
228         ops[16].filter.target = gui.About;
229         ops[16].filter.id = 1001;
230         ops[16].action = new OpAction();
231         ops[16].action.actionType = OpAction.CODE;
232     }
233 
234     private void handleCallback(int index, Message msg, Event evt) {
235         switch (index) {
236 	case 0:
237             {
238                 group.checkExit(
239 				(java.awt.Frame)gui.loginframe.getBody());
240             }
241             break;
242 	case 1:
243             {
244                 group.checkHelp(
245 				(java.awt.Frame)gui.loginframe.getBody());
246             }
247             break;
248 	case 2:
249             {
250                 group.checkContextSensitiveHelp(
251 				(java.awt.Frame)gui.loginframe.getBody());
252             }
253             break;
254 	case 3:
255             {
256                 group.checkAbout(
257 				 (java.awt.Frame)gui.loginframe.getBody());
258             }
259             break;
260 	case 4:
261             {
262                 group.exit();
263             }
264             break;
265 	case 5:
266             {
267                 group.checkPrintCurPr();
268             }
269             break;
270 	case 6:
271             {
272                 group.checkPrintCurPol();
273             }
274             break;
275 	case 7:
276             {
277                 group.checkPrintPrList();
278             }
279             break;
280 	case 8:
281             {
282                 group.checkPrintPoList();
283             }
284             break;
285 	case 9:
286             {
287                 group.checkLogout();
288             }
289             break;
290 	case 10:
291             {
292                 group.checkExit(
293 				(java.awt.Frame)gui.mainframe.getBody());
294             }
295             break;
296 	case 11:
297             {
298                 group.checkEditPreferences();
299             }
300             break;
301 	case 12:
302             {
303                 group.checkRefreshPrincipals();
304             }
305             break;
306 	case 13:
307             {
308                 group.checkRefreshPolicies();
309             }
310             break;
311 	case 14:
312             {
313                 group.checkHelp(
314 				(java.awt.Frame)gui.mainframe.getBody());
315             }
316             break;
317 	case 15:
318             {
319                 group.checkContextSensitiveHelp(
320 				(java.awt.Frame)gui.mainframe.getBody());
321             }
322             break;
323 	case 16:
324             {
325                 group.checkAbout(
326 				 (java.awt.Frame)gui.mainframe.getBody());
327             }
328             break;
329 	default:
330             throw new Error("Bad callback index: " + index);
331         }
332     }
333 
334 
335     // methods from lib/visual/gen/methods.java
336 
337     /**
338      * Converts a string to the specified type.
339      */
340     private Object convert(String type, String value) {
341         return (Converter.getConverter(type).convertFromString(value));
342     }
343 }
344