1*0Sstevel@tonic-gate /*
2*0Sstevel@tonic-gate  * CDDL HEADER START
3*0Sstevel@tonic-gate  *
4*0Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*0Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*0Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*0Sstevel@tonic-gate  * with the License.
8*0Sstevel@tonic-gate  *
9*0Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*0Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*0Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*0Sstevel@tonic-gate  * and limitations under the License.
13*0Sstevel@tonic-gate  *
14*0Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*0Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*0Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*0Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*0Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*0Sstevel@tonic-gate  *
20*0Sstevel@tonic-gate  * CDDL HEADER END
21*0Sstevel@tonic-gate  */
22*0Sstevel@tonic-gate /*
23*0Sstevel@tonic-gate  * ident	"%Z%%M%	%I%	%E% SMI"
24*0Sstevel@tonic-gate  *
25*0Sstevel@tonic-gate  * Copyright 2000-2002 Sun Microsystems, Inc.  All rights reserved.
26*0Sstevel@tonic-gate  * Use is subject to license terms.
27*0Sstevel@tonic-gate  */
28*0Sstevel@tonic-gate 
29*0Sstevel@tonic-gate /**
30*0Sstevel@tonic-gate  * GUI interface for Kerberos KDC
31*0Sstevel@tonic-gate  */
32*0Sstevel@tonic-gate 
33*0Sstevel@tonic-gate // Java Workshop stuff
34*0Sstevel@tonic-gate import sunsoft.jws.visual.rt.base.*;
35*0Sstevel@tonic-gate import sunsoft.jws.visual.rt.base.Global;
36*0Sstevel@tonic-gate import sunsoft.jws.visual.rt.awt.TabbedFolder;
37*0Sstevel@tonic-gate import sunsoft.jws.visual.rt.awt.TextList;
38*0Sstevel@tonic-gate import sunsoft.jws.visual.rt.awt.StringVector;
39*0Sstevel@tonic-gate import sunsoft.jws.visual.rt.shadow.java.awt.*;
40*0Sstevel@tonic-gate 
41*0Sstevel@tonic-gate // Regular JDK stuff
42*0Sstevel@tonic-gate import java.awt.*;
43*0Sstevel@tonic-gate import java.awt.event.*;
44*0Sstevel@tonic-gate import java.util.EventListener;
45*0Sstevel@tonic-gate import java.util.Properties;
46*0Sstevel@tonic-gate import java.util.Vector;
47*0Sstevel@tonic-gate import java.util.Random;
48*0Sstevel@tonic-gate import java.util.StringTokenizer;
49*0Sstevel@tonic-gate import java.io.IOException;
50*0Sstevel@tonic-gate import java.io.File;
51*0Sstevel@tonic-gate import java.io.InputStream;
52*0Sstevel@tonic-gate import java.net.URL;
53*0Sstevel@tonic-gate 
54*0Sstevel@tonic-gate // Stuff to support I18N
55*0Sstevel@tonic-gate import java.util.Date;
56*0Sstevel@tonic-gate import java.util.Calendar;
57*0Sstevel@tonic-gate import java.util.GregorianCalendar;
58*0Sstevel@tonic-gate import java.util.Locale;
59*0Sstevel@tonic-gate import java.text.DateFormat;
60*0Sstevel@tonic-gate import java.text.ParseException;
61*0Sstevel@tonic-gate import java.text.DateFormatSymbols;
62*0Sstevel@tonic-gate import java.text.NumberFormat;
63*0Sstevel@tonic-gate import java.util.ResourceBundle;
64*0Sstevel@tonic-gate import java.util.ListResourceBundle;
65*0Sstevel@tonic-gate import java.util.MissingResourceException;
66*0Sstevel@tonic-gate import java.util.Enumeration;
67*0Sstevel@tonic-gate 
68*0Sstevel@tonic-gate public class KdcGui extends Group {
69*0Sstevel@tonic-gate 
70*0Sstevel@tonic-gate     // Basics
71*0Sstevel@tonic-gate     private KdcGuiRoot gui;
72*0Sstevel@tonic-gate     private Krb5Conf kc;
73*0Sstevel@tonic-gate     private Principal prin = null;
74*0Sstevel@tonic-gate     private Policy pol = null;
75*0Sstevel@tonic-gate     private Defaults defaults = null;
76*0Sstevel@tonic-gate     private Defaults olddefaults = null;
77*0Sstevel@tonic-gate     public Frame defaultsEditingFrame = null; // public since used
78*0Sstevel@tonic-gate     // by ContextHelp class
79*0Sstevel@tonic-gate     public Frame realMainFrame = null;
80*0Sstevel@tonic-gate     public Frame realLoginFrame = null;
81*0Sstevel@tonic-gate 
82*0Sstevel@tonic-gate     public Kadmin Kadmin = null;
83*0Sstevel@tonic-gate 
84*0Sstevel@tonic-gate     // Privileges stuff: corresponds to ADMCIL set in kdc.conf
85*0Sstevel@tonic-gate     public int privs = 0;
86*0Sstevel@tonic-gate     public static final int PRIV_ADD	= 0x02;		// KADM5_PRIV_ADD
87*0Sstevel@tonic-gate     public static final int PRIV_DELETE	= 0x08;		// KADM5_PRIV_DELETE
88*0Sstevel@tonic-gate     public static final int PRIV_MODIFY	= 0x04;		// KADM5_PRIV_MODIFY
89*0Sstevel@tonic-gate     public static final int PRIV_CHANGEPW	= 0x20;	// KADM5_PRIV_CPW
90*0Sstevel@tonic-gate     public static final int PRIV_INQUIRE	= 0x01;	// KADM5_PRIV_GET
91*0Sstevel@tonic-gate     public static final int PRIV_LIST	= 0x10;		// KADM5_PRIV_LIST
92*0Sstevel@tonic-gate     public boolean noLists = false;
93*0Sstevel@tonic-gate 
94*0Sstevel@tonic-gate     // For modal warning dialog and context-sensitive help dialog
95*0Sstevel@tonic-gate     private Dialog dialog;
96*0Sstevel@tonic-gate     public ContextHelp cHelp = null; // tweaked from ContextHelp when
97*0Sstevel@tonic-gate     // it is dismissed
98*0Sstevel@tonic-gate 
99*0Sstevel@tonic-gate     private static Toolkit toolkit;
100*0Sstevel@tonic-gate 
101*0Sstevel@tonic-gate     // For showDataFormatError() to determine what kind of error to show
102*0Sstevel@tonic-gate 
103*0Sstevel@tonic-gate     public static final int DURATION_DATA = 1;
104*0Sstevel@tonic-gate     public static final int DATE_DATA = 2;
105*0Sstevel@tonic-gate     public static final int NUMBER_DATA = 3;
106*0Sstevel@tonic-gate 
107*0Sstevel@tonic-gate     private static String[] durationErrorText = null;
108*0Sstevel@tonic-gate     private static String[] dateErrorText = null;
109*0Sstevel@tonic-gate     private static String[] numberErrorText = null;
110*0Sstevel@tonic-gate 
111*0Sstevel@tonic-gate     // For date & time helper dialogs
112*0Sstevel@tonic-gate     private DateTimeDialog dateTimeDialog = null;
113*0Sstevel@tonic-gate     private DurationHelper durationHelper = null;
114*0Sstevel@tonic-gate 
115*0Sstevel@tonic-gate     // Important defaults and current settings
116*0Sstevel@tonic-gate     private String DefName = null;
117*0Sstevel@tonic-gate     private String DefRealm = null;
118*0Sstevel@tonic-gate     private String DefServer = null;
119*0Sstevel@tonic-gate     private String DefPort = "0";
120*0Sstevel@tonic-gate     private String CurName, CurPass, CurRealm, CurServer;
121*0Sstevel@tonic-gate     private int CurPort;
122*0Sstevel@tonic-gate     private String CurPrincipal;
123*0Sstevel@tonic-gate     private String CurPolicy;
124*0Sstevel@tonic-gate     private String curPrPattern = "";
125*0Sstevel@tonic-gate     private String curPoPattern = "";
126*0Sstevel@tonic-gate     private int curPrListPos = 0;
127*0Sstevel@tonic-gate     private int curPoListPos = 0;
128*0Sstevel@tonic-gate     private String[] principalList = null;
129*0Sstevel@tonic-gate     private Date principalListDate = new Date(0);
130*0Sstevel@tonic-gate     private String[] policyList = null;
131*0Sstevel@tonic-gate     private Date policyListDate = new Date(0);
132*0Sstevel@tonic-gate     private static final long A_LONG_TIME = 1000 * 60 * 60 * 24 * 365;
133*0Sstevel@tonic-gate 
134*0Sstevel@tonic-gate     // General state variables
135*0Sstevel@tonic-gate     private boolean prSelValid = false;
136*0Sstevel@tonic-gate     private String[] prMulti = null;
137*0Sstevel@tonic-gate     private boolean prNeedSave = false;
138*0Sstevel@tonic-gate     private boolean poSelValid = false;
139*0Sstevel@tonic-gate     private String[] poMulti = null;
140*0Sstevel@tonic-gate     private boolean poNeedSave = false;
141*0Sstevel@tonic-gate     private boolean glNeedSave = false;
142*0Sstevel@tonic-gate     private boolean firsttime = true;
143*0Sstevel@tonic-gate     private boolean prnameEditable = false;
144*0Sstevel@tonic-gate     private boolean ponameEditable = false;
145*0Sstevel@tonic-gate 
146*0Sstevel@tonic-gate     // Support for context-sensitive help
147*0Sstevel@tonic-gate     private static final int BUTTON_ACTION = 1;
148*0Sstevel@tonic-gate     private static final int BUTTON_MOUSE = 2;
149*0Sstevel@tonic-gate     private static final int TEXTFIELD_ACTION = 3;
150*0Sstevel@tonic-gate     private static final int TEXTFIELD_MOUSE = 4;
151*0Sstevel@tonic-gate     private static final int TEXTFIELD_KEY = 5;
152*0Sstevel@tonic-gate     private static final int CHOICE_ITEM = 6;
153*0Sstevel@tonic-gate     private static final int CHOICE_MOUSE = 7;
154*0Sstevel@tonic-gate     private static final int CHECKBOX_ITEM = 8;
155*0Sstevel@tonic-gate     private static final int CHECKBOX_MOUSE = 9;
156*0Sstevel@tonic-gate     private static final int LABEL_MOUSE = 10;
157*0Sstevel@tonic-gate     private static final int WINDOW_LISTENER = 11;
158*0Sstevel@tonic-gate 
159*0Sstevel@tonic-gate     private boolean loginListeners = false;
160*0Sstevel@tonic-gate     private Vector LoginNormal = null;
161*0Sstevel@tonic-gate     private Vector LoginHelp = null;
162*0Sstevel@tonic-gate     private Vector LoginFixers = null;
163*0Sstevel@tonic-gate     private Vector MainNormal = null;
164*0Sstevel@tonic-gate     private Vector MainHelp = null;
165*0Sstevel@tonic-gate     private Vector MainFixers = null;
166*0Sstevel@tonic-gate     private Vector defaultsNormal = null;
167*0Sstevel@tonic-gate     private Vector defaultsHelp = null;
168*0Sstevel@tonic-gate     private Vector defaultsFixers = null;
169*0Sstevel@tonic-gate     public boolean loginHelpMode = false;
170*0Sstevel@tonic-gate     public boolean mainHelpMode = false;
171*0Sstevel@tonic-gate     public boolean defaultsHelpMode = false;
172*0Sstevel@tonic-gate 
173*0Sstevel@tonic-gate     // For Principal and Policy Keystroke listeners
174*0Sstevel@tonic-gate     private static final int PRINCIPAL_EDITING = 1;
175*0Sstevel@tonic-gate     private static final int POLICY_EDITING = 2;
176*0Sstevel@tonic-gate     private static final int DEFAULTS_EDITING = 3;
177*0Sstevel@tonic-gate     private static final int PRINCIPAL_LIST = 4;
178*0Sstevel@tonic-gate     private static final int POLICY_LIST = 5;
179*0Sstevel@tonic-gate 
180*0Sstevel@tonic-gate     // For status line
181*0Sstevel@tonic-gate     private String OpString = "";
182*0Sstevel@tonic-gate     private String ModeString = "";
183*0Sstevel@tonic-gate     private String SaveString = "";
184*0Sstevel@tonic-gate 
185*0Sstevel@tonic-gate     // For I18N
186*0Sstevel@tonic-gate     private static ResourceBundle rb;
187*0Sstevel@tonic-gate     private static ResourceBundle hrb;
188*0Sstevel@tonic-gate     private static DateFormat df;
189*0Sstevel@tonic-gate     private static NumberFormat nf;
190*0Sstevel@tonic-gate 
191*0Sstevel@tonic-gate     private static String neverString;
192*0Sstevel@tonic-gate 
193*0Sstevel@tonic-gate     // For general pupose help
194*0Sstevel@tonic-gate     Process browserProcess;
195*0Sstevel@tonic-gate     String helpIndexFile = "file:/usr/lib/krb5/HelpIndex.html";
196*0Sstevel@tonic-gate 
197*0Sstevel@tonic-gate     // For performance monitoring
198*0Sstevel@tonic-gate     boolean perfmon = false;
199*0Sstevel@tonic-gate     Date pdateFirst;
200*0Sstevel@tonic-gate     Date pdateAfterKrb5Conf;
201*0Sstevel@tonic-gate     Date pdateEndGuiRoot;
202*0Sstevel@tonic-gate     Date pdateBeginStartGroup;
203*0Sstevel@tonic-gate     Date pdateStringsDone;
204*0Sstevel@tonic-gate     Date pdateLoginReady;
205*0Sstevel@tonic-gate     Date pdateLoginDone;
206*0Sstevel@tonic-gate     Date pdateSessionUp;
207*0Sstevel@tonic-gate     Date pdatePreMainShow;
208*0Sstevel@tonic-gate     Date pdatePostMainShow;
209*0Sstevel@tonic-gate     Date pdateMainActive;
210*0Sstevel@tonic-gate     Date pdateStartPlist;
211*0Sstevel@tonic-gate     Date pdateHavePlist;
212*0Sstevel@tonic-gate     Date pdateEmptyPlist;
213*0Sstevel@tonic-gate     Date pdateDonePlist;
214*0Sstevel@tonic-gate 
215*0Sstevel@tonic-gate     public void reportTime(String s0, Date curr, Date prev) {
216*0Sstevel@tonic-gate         if (!perfmon)
217*0Sstevel@tonic-gate             return;
218*0Sstevel@tonic-gate         String s1 = curr.toString();
219*0Sstevel@tonic-gate         long curdiff = curr.getTime() - prev.getTime();
220*0Sstevel@tonic-gate         String s2 = (new Long(curdiff)).toString();
221*0Sstevel@tonic-gate         long cumdiff = curr.getTime() - pdateFirst.getTime();
222*0Sstevel@tonic-gate         String s3 = (new Long(cumdiff)).toString();
223*0Sstevel@tonic-gate         System.out.println(s0+s1+" delta "+s2+" cume "+s3);
224*0Sstevel@tonic-gate     }
225*0Sstevel@tonic-gate 
226*0Sstevel@tonic-gate     public void reportStartTimes() {
227*0Sstevel@tonic-gate         if (!perfmon)
228*0Sstevel@tonic-gate             return;
229*0Sstevel@tonic-gate         System.out.println("");
230*0Sstevel@tonic-gate         reportTime("First timestamp: ", pdateFirst, pdateFirst);
231*0Sstevel@tonic-gate         reportTime("After krb5.conf: ", pdateAfterKrb5Conf, pdateFirst);
232*0Sstevel@tonic-gate         reportTime("KdcGuiRoot done: ", pdateEndGuiRoot, pdateAfterKrb5Conf);
233*0Sstevel@tonic-gate         reportTime("At startGroup  : ", pdateBeginStartGroup, pdateEndGuiRoot);
234*0Sstevel@tonic-gate         reportTime("Strings set up : ", pdateStringsDone, pdateBeginStartGroup);
235*0Sstevel@tonic-gate         reportTime("Login ready    : ", pdateLoginReady, pdateStringsDone);
236*0Sstevel@tonic-gate         reportTime("Login complete : ", pdateLoginDone, pdateLoginReady);
237*0Sstevel@tonic-gate         reportTime("Session set up : ", pdateSessionUp, pdateLoginDone);
238*0Sstevel@tonic-gate         reportTime("Start main win : ", pdatePreMainShow, pdateSessionUp);
239*0Sstevel@tonic-gate         reportTime("Done main win  : ", pdatePostMainShow, pdatePreMainShow);
240*0Sstevel@tonic-gate         reportTime("Main win active: ", pdateMainActive, pdatePostMainShow);
241*0Sstevel@tonic-gate     }
242*0Sstevel@tonic-gate 
243*0Sstevel@tonic-gate     /**
244*0Sstevel@tonic-gate      * Sample method call ordering during a group's lifetime:
245*0Sstevel@tonic-gate      *
246*0Sstevel@tonic-gate      * Constructor
247*0Sstevel@tonic-gate      * initRoot
248*0Sstevel@tonic-gate      * initGroup
249*0Sstevel@tonic-gate      * (setOnGroup and getOnGroup may be called at any time in any
250*0Sstevel@tonic-gate      *  order after initGroup has been called)
251*0Sstevel@tonic-gate      * createGroup
252*0Sstevel@tonic-gate      * showGroup/hideGroup + startGroup/stopGroup
253*0Sstevel@tonic-gate      * destroyGroup
254*0Sstevel@tonic-gate      */
255*0Sstevel@tonic-gate 
256*0Sstevel@tonic-gate     /**
257*0Sstevel@tonic-gate      * The constructor sets up defaults for login screen
258*0Sstevel@tonic-gate      *
259*0Sstevel@tonic-gate      */
260*0Sstevel@tonic-gate     public KdcGui() {
261*0Sstevel@tonic-gate 
262*0Sstevel@tonic-gate         /*
263*0Sstevel@tonic-gate          * Set up defaults from /etc/krb5/krb5.conf
264*0Sstevel@tonic-gate          */
265*0Sstevel@tonic-gate 
266*0Sstevel@tonic-gate         pdateFirst = new Date();
267*0Sstevel@tonic-gate         DefName = System.getProperty("user.name" /* NOI18N */)+
268*0Sstevel@tonic-gate 	    "/admin" /* NOI18N */;
269*0Sstevel@tonic-gate         kc = new Krb5Conf();
270*0Sstevel@tonic-gate         DefRealm = kc.getDefaultRealm();
271*0Sstevel@tonic-gate         DefServer = kc.getRealmServer(DefRealm);
272*0Sstevel@tonic-gate         DefPort = kc.getRealmPort(DefRealm);
273*0Sstevel@tonic-gate         pdateAfterKrb5Conf = new Date();
274*0Sstevel@tonic-gate 
275*0Sstevel@tonic-gate         /*
276*0Sstevel@tonic-gate          * Take care of Java Workshop attribute plumbing
277*0Sstevel@tonic-gate          */
278*0Sstevel@tonic-gate         addForwardedAttributes();
279*0Sstevel@tonic-gate     }
280*0Sstevel@tonic-gate 
281*0Sstevel@tonic-gate     /**
282*0Sstevel@tonic-gate      * Inherited from the Java Workshop skeleton
283*0Sstevel@tonic-gate      *
284*0Sstevel@tonic-gate      */
285*0Sstevel@tonic-gate     protected Root initRoot() {
286*0Sstevel@tonic-gate         /*
287*0Sstevel@tonic-gate          * Initialize the gui components
288*0Sstevel@tonic-gate          */
289*0Sstevel@tonic-gate         gui = new KdcGuiRoot(this);
290*0Sstevel@tonic-gate         pdateEndGuiRoot = new Date();
291*0Sstevel@tonic-gate 
292*0Sstevel@tonic-gate         /*
293*0Sstevel@tonic-gate          * Take care of Java Workshop attribute plumbing.
294*0Sstevel@tonic-gate          */
295*0Sstevel@tonic-gate         addAttributeForward(gui.getMainChild());
296*0Sstevel@tonic-gate 
297*0Sstevel@tonic-gate         initLoginStrings();
298*0Sstevel@tonic-gate         initMainStrings();
299*0Sstevel@tonic-gate         pdateStringsDone = new Date();
300*0Sstevel@tonic-gate         return gui;
301*0Sstevel@tonic-gate     }
302*0Sstevel@tonic-gate 
303*0Sstevel@tonic-gate     /**
304*0Sstevel@tonic-gate      * Set up the login screen properly.
305*0Sstevel@tonic-gate      *
306*0Sstevel@tonic-gate      */
307*0Sstevel@tonic-gate     protected void startGroup() {
308*0Sstevel@tonic-gate         pdateBeginStartGroup = new Date();
309*0Sstevel@tonic-gate         realLoginFrame = (Frame)gui.loginframe.getBody();
310*0Sstevel@tonic-gate         realLoginFrame.setTitle(getString("SEAM Administration Login"));
311*0Sstevel@tonic-gate         setLoginDefaults();
312*0Sstevel@tonic-gate         pdateLoginReady = new Date();
313*0Sstevel@tonic-gate     }
314*0Sstevel@tonic-gate 
315*0Sstevel@tonic-gate     /**
316*0Sstevel@tonic-gate      * All cleanup done here.
317*0Sstevel@tonic-gate      */
318*0Sstevel@tonic-gate     protected void stopGroup() {
319*0Sstevel@tonic-gate         killHelpBrowser();
320*0Sstevel@tonic-gate     }
321*0Sstevel@tonic-gate 
322*0Sstevel@tonic-gate 
323*0Sstevel@tonic-gate     /**
324*0Sstevel@tonic-gate      * Callbacks from Java workshop to decide whether to take the action
325*0Sstevel@tonic-gate      * or show appropriate help for it.
326*0Sstevel@tonic-gate      *
327*0Sstevel@tonic-gate      * 1. Actions that are triggered from all three - mainframe,
328*0Sstevel@tonic-gate      *    loginframe, and defaultsEditingFrame - are: context sensitive help.
329*0Sstevel@tonic-gate      * 2. Actions that are triggered only from mainframe are: printing,
330*0Sstevel@tonic-gate      *    logging out, edit preferences.
331*0Sstevel@tonic-gate      * 3. Actions that are triggered from mainframe and loginframe are:
332*0Sstevel@tonic-gate      *    exit, general help, context sensitive help, about.
333*0Sstevel@tonic-gate      */
334*0Sstevel@tonic-gate 
335*0Sstevel@tonic-gate 
336*0Sstevel@tonic-gate     // All three frames
337*0Sstevel@tonic-gate 
338*0Sstevel@tonic-gate     public void checkContextSensitiveHelp(Frame frame) {
339*0Sstevel@tonic-gate         if ((loginHelpMode && frame == realLoginFrame)
340*0Sstevel@tonic-gate             || (mainHelpMode && frame == realMainFrame)
341*0Sstevel@tonic-gate 	    || (defaultsHelpMode && frame == defaultsEditingFrame))
342*0Sstevel@tonic-gate 	    showHelp("ContextSensitiveHelp");
343*0Sstevel@tonic-gate         else
344*0Sstevel@tonic-gate             contextHelp(frame);
345*0Sstevel@tonic-gate     }
346*0Sstevel@tonic-gate 
347*0Sstevel@tonic-gate     // Mainframe only
348*0Sstevel@tonic-gate 
349*0Sstevel@tonic-gate     public void checkPrintCurPr() {
350*0Sstevel@tonic-gate         if (mainHelpMode)
351*0Sstevel@tonic-gate             showHelp("PrintCurrentPrincipal");
352*0Sstevel@tonic-gate         else
353*0Sstevel@tonic-gate             printCurPr();
354*0Sstevel@tonic-gate     }
355*0Sstevel@tonic-gate 
356*0Sstevel@tonic-gate     public void checkPrintCurPol() {
357*0Sstevel@tonic-gate         if (mainHelpMode)
358*0Sstevel@tonic-gate             showHelp("PrintCurrentPolicy");
359*0Sstevel@tonic-gate         else
360*0Sstevel@tonic-gate             printCurPol();
361*0Sstevel@tonic-gate     }
362*0Sstevel@tonic-gate 
363*0Sstevel@tonic-gate     public void checkPrintPrList() {
364*0Sstevel@tonic-gate         if (mainHelpMode)
365*0Sstevel@tonic-gate             showHelp("PrintPrincipalList");
366*0Sstevel@tonic-gate         else
367*0Sstevel@tonic-gate             printPrList();
368*0Sstevel@tonic-gate     }
369*0Sstevel@tonic-gate 
370*0Sstevel@tonic-gate     public void checkPrintPoList() {
371*0Sstevel@tonic-gate         if (mainHelpMode)
372*0Sstevel@tonic-gate             showHelp("PrintPolicyList");
373*0Sstevel@tonic-gate         else
374*0Sstevel@tonic-gate             printPoList();
375*0Sstevel@tonic-gate     }
376*0Sstevel@tonic-gate 
377*0Sstevel@tonic-gate     public void checkLogout() {
378*0Sstevel@tonic-gate         if (mainHelpMode)
379*0Sstevel@tonic-gate             showHelp("Logout");
380*0Sstevel@tonic-gate         else if (okayToLeave(realMainFrame))
381*0Sstevel@tonic-gate             logout();
382*0Sstevel@tonic-gate     }
383*0Sstevel@tonic-gate 
384*0Sstevel@tonic-gate     public void checkEditPreferences() {
385*0Sstevel@tonic-gate         if (mainHelpMode)
386*0Sstevel@tonic-gate             showHelp("EditPreferences");
387*0Sstevel@tonic-gate         else
388*0Sstevel@tonic-gate             editPreferences();
389*0Sstevel@tonic-gate     }
390*0Sstevel@tonic-gate 
391*0Sstevel@tonic-gate     public void checkRefreshPrincipals() {
392*0Sstevel@tonic-gate         if (mainHelpMode)
393*0Sstevel@tonic-gate             showHelp("RefreshPrincipals");
394*0Sstevel@tonic-gate         else {
395*0Sstevel@tonic-gate             principalList = null;
396*0Sstevel@tonic-gate             fillPrincipalList(curPrPattern);
397*0Sstevel@tonic-gate         }
398*0Sstevel@tonic-gate     }
399*0Sstevel@tonic-gate 
400*0Sstevel@tonic-gate     public void checkRefreshPolicies() {
401*0Sstevel@tonic-gate         if (mainHelpMode)
402*0Sstevel@tonic-gate             showHelp("RefreshPolicies");
403*0Sstevel@tonic-gate         else {
404*0Sstevel@tonic-gate             policyList = null;
405*0Sstevel@tonic-gate             fillPolicyList(curPoPattern);
406*0Sstevel@tonic-gate         }
407*0Sstevel@tonic-gate     }
408*0Sstevel@tonic-gate 
409*0Sstevel@tonic-gate     // Mainframe and loginframe
410*0Sstevel@tonic-gate 
411*0Sstevel@tonic-gate     public void checkExit(Frame frame) {
412*0Sstevel@tonic-gate         if ((loginHelpMode && frame == realLoginFrame)
413*0Sstevel@tonic-gate             || (mainHelpMode && frame == realMainFrame))
414*0Sstevel@tonic-gate 	    showHelp("Exit");
415*0Sstevel@tonic-gate         else if (okayToLeave(frame))
416*0Sstevel@tonic-gate             exit();
417*0Sstevel@tonic-gate     }
418*0Sstevel@tonic-gate 
419*0Sstevel@tonic-gate     public void checkHelp(Frame frame) {
420*0Sstevel@tonic-gate         if ((loginHelpMode && frame == realLoginFrame)
421*0Sstevel@tonic-gate             || (mainHelpMode && frame == realMainFrame))
422*0Sstevel@tonic-gate 	    showHelp("HelpBrowser");
423*0Sstevel@tonic-gate         else
424*0Sstevel@tonic-gate             showHelpBrowser(frame);
425*0Sstevel@tonic-gate     }
426*0Sstevel@tonic-gate 
427*0Sstevel@tonic-gate     public void checkAbout(Frame frame) {
428*0Sstevel@tonic-gate         if ((loginHelpMode && frame == realLoginFrame)
429*0Sstevel@tonic-gate             || (mainHelpMode && frame == realMainFrame))
430*0Sstevel@tonic-gate 	    showHelp("About");
431*0Sstevel@tonic-gate         else
432*0Sstevel@tonic-gate             doAbout(frame);
433*0Sstevel@tonic-gate     }
434*0Sstevel@tonic-gate 
435*0Sstevel@tonic-gate     public boolean okayToLeave(Frame frame) {
436*0Sstevel@tonic-gate         if (prNeedSave || poNeedSave || glNeedSave) {
437*0Sstevel@tonic-gate             String text[] = {getString("You are about to lose changes."),
438*0Sstevel@tonic-gate 			     getString("Click Save to commit changes, "
439*0Sstevel@tonic-gate 				       +"Discard to discard changes, "
440*0Sstevel@tonic-gate 				       +"or Cancel to continue editing.")};
441*0Sstevel@tonic-gate             String resp = confirmSave(frame, text);
442*0Sstevel@tonic-gate             if (resp.equals(getString("Cancel")))
443*0Sstevel@tonic-gate                 return false;
444*0Sstevel@tonic-gate             else if (resp.equals(getString("Save"))) {
445*0Sstevel@tonic-gate                 if (prNeedSave)
446*0Sstevel@tonic-gate                     if (!prDoSave())
447*0Sstevel@tonic-gate 			return false; // found an error so cannot leave
448*0Sstevel@tonic-gate                 if (poNeedSave)
449*0Sstevel@tonic-gate                     if (!poDoSave())
450*0Sstevel@tonic-gate 			return false; // found an error so cannot leave
451*0Sstevel@tonic-gate                 if (glNeedSave)
452*0Sstevel@tonic-gate                     glDoSave(true);
453*0Sstevel@tonic-gate             } else
454*0Sstevel@tonic-gate                 prNeedSave = poNeedSave = glNeedSave = false;
455*0Sstevel@tonic-gate         }
456*0Sstevel@tonic-gate         return true;
457*0Sstevel@tonic-gate     }
458*0Sstevel@tonic-gate 
459*0Sstevel@tonic-gate     /**
460*0Sstevel@tonic-gate      * We use the JDK 1.1 event model for most of our events, but
461*0Sstevel@tonic-gate      * we do still need to handle old-style events because the
462*0Sstevel@tonic-gate      * tabbed folder and the card panel(supplied by Java Workshop)
463*0Sstevel@tonic-gate      * are not compatible with the new event model.  We use the
464*0Sstevel@tonic-gate      * callouts from Java Workshop to deal with the card panel,
465*0Sstevel@tonic-gate      * but we need to have some code here to do the right thing
466*0Sstevel@tonic-gate      * when the user selects a new tab in the tabbed folder.
467*0Sstevel@tonic-gate      *
468*0Sstevel@tonic-gate      * It is important that not too many conditions are tested here,
469*0Sstevel@tonic-gate      * because all events flow through this code path.
470*0Sstevel@tonic-gate      *
471*0Sstevel@tonic-gate      */
472*0Sstevel@tonic-gate     public boolean handleEvent(Message msg, Event evt) {
473*0Sstevel@tonic-gate 
474*0Sstevel@tonic-gate         /*
475*0Sstevel@tonic-gate          * Look for events from the principal and policy list.
476*0Sstevel@tonic-gate          */
477*0Sstevel@tonic-gate 
478*0Sstevel@tonic-gate         if (evt.target == gui.Prlist.getBody()) {
479*0Sstevel@tonic-gate             if (mainHelpMode) {
480*0Sstevel@tonic-gate                 if (evt.id == Event.ACTION_EVENT
481*0Sstevel@tonic-gate 		    || evt.id == Event.LIST_SELECT) {
482*0Sstevel@tonic-gate                     restorePrListSelection();
483*0Sstevel@tonic-gate                     showHelp(((Component)gui.Prlist.getBody()).getName());
484*0Sstevel@tonic-gate                 }
485*0Sstevel@tonic-gate             } // end of help mode
486*0Sstevel@tonic-gate             else if (evt.id == Event.ACTION_EVENT)
487*0Sstevel@tonic-gate                 prModify();
488*0Sstevel@tonic-gate             else if (evt.id == Event.LIST_SELECT)
489*0Sstevel@tonic-gate                 lookAtPrList();
490*0Sstevel@tonic-gate             return true;
491*0Sstevel@tonic-gate         } // end of Prlist
492*0Sstevel@tonic-gate 
493*0Sstevel@tonic-gate         if (evt.target == gui.Pollist.getBody()) {
494*0Sstevel@tonic-gate             if (mainHelpMode) {
495*0Sstevel@tonic-gate                 if (evt.id == Event.ACTION_EVENT
496*0Sstevel@tonic-gate 		    || evt.id == Event.LIST_SELECT) {
497*0Sstevel@tonic-gate                     restorePoListSelection();
498*0Sstevel@tonic-gate                     showHelp(((Component)gui.Pollist.getBody()).getName());
499*0Sstevel@tonic-gate                 }
500*0Sstevel@tonic-gate             } // end of help mode
501*0Sstevel@tonic-gate             else if (evt.id == Event.ACTION_EVENT)
502*0Sstevel@tonic-gate                 poSelected();
503*0Sstevel@tonic-gate             else if (evt.id == Event.LIST_SELECT)
504*0Sstevel@tonic-gate                 lookAtPoList();
505*0Sstevel@tonic-gate             return true;
506*0Sstevel@tonic-gate         } // end of Pollist
507*0Sstevel@tonic-gate 
508*0Sstevel@tonic-gate         /*
509*0Sstevel@tonic-gate          * Look for a unique event from the tabbed folder component;
510*0Sstevel@tonic-gate          * if I see it, I know I have a chance to disallow a switch.
511*0Sstevel@tonic-gate          * This makes sure data is saved before leaving a tab.
512*0Sstevel@tonic-gate          */
513*0Sstevel@tonic-gate         if (evt.id == TabbedFolder.CONFIRM_SWITCH) {
514*0Sstevel@tonic-gate             // System.out.println("Got confirm for "+evt.arg);
515*0Sstevel@tonic-gate             String e = (String)evt.arg;
516*0Sstevel@tonic-gate             if (!mainHelpMode && okayToLeave(realMainFrame) == false) {
517*0Sstevel@tonic-gate                 // System.out.println("Denying switch");
518*0Sstevel@tonic-gate                 ((TabbedFolder)gui.tabbedfolder1.getBody()).cancelSwitch();
519*0Sstevel@tonic-gate             }
520*0Sstevel@tonic-gate             /*
521*0Sstevel@tonic-gate              * Okay with switch; make sure the data is up to date
522*0Sstevel@tonic-gate              */
523*0Sstevel@tonic-gate             else if (e.compareTo(getString("Principals")) == 0) {
524*0Sstevel@tonic-gate                 if (mainHelpMode) {
525*0Sstevel@tonic-gate                     showHelp("PrincipalTab");
526*0Sstevel@tonic-gate                     ((TabbedFolder)gui.tabbedfolder1.getBody()).cancelSwitch();
527*0Sstevel@tonic-gate                 } else {
528*0Sstevel@tonic-gate                     showPrincipalList(curPrPattern);
529*0Sstevel@tonic-gate                     disablePolicyPrinting();
530*0Sstevel@tonic-gate                 }
531*0Sstevel@tonic-gate             } else if (e.compareTo(getString("Policies")) == 0) {
532*0Sstevel@tonic-gate                 if (mainHelpMode) {
533*0Sstevel@tonic-gate                     showHelp("PolicyTab");
534*0Sstevel@tonic-gate                     ((TabbedFolder)gui.tabbedfolder1.getBody()).cancelSwitch();
535*0Sstevel@tonic-gate                 } else {
536*0Sstevel@tonic-gate                     showPolicyList(curPoPattern);
537*0Sstevel@tonic-gate                     disablePrincipalPrinting();
538*0Sstevel@tonic-gate                 }
539*0Sstevel@tonic-gate             }
540*0Sstevel@tonic-gate         }
541*0Sstevel@tonic-gate         return super.handleEvent(msg, evt);
542*0Sstevel@tonic-gate     }
543*0Sstevel@tonic-gate 
544*0Sstevel@tonic-gate     /*
545*0Sstevel@tonic-gate      * New methods for the admin gui login screen.
546*0Sstevel@tonic-gate      */
547*0Sstevel@tonic-gate 
548*0Sstevel@tonic-gate     /**
549*0Sstevel@tonic-gate      * Set strings on login screen to their I18N'd values
550*0Sstevel@tonic-gate      *
551*0Sstevel@tonic-gate      */
552*0Sstevel@tonic-gate     public void initLoginStrings() {
553*0Sstevel@tonic-gate         gui.File2.set("text" /* NOI18N */, getString("File"));
554*0Sstevel@tonic-gate         gui.Exit2.set("text" /* NOI18N */, getString("Exit"));
555*0Sstevel@tonic-gate         gui.menu1.set("text" /* NOI18N */, getString("Help"));
556*0Sstevel@tonic-gate         gui.browserHelp1.set("text" /* NOI18N */, getString("Help Contents"));
557*0Sstevel@tonic-gate         gui.Context2.set("text" /* NOI18N */,
558*0Sstevel@tonic-gate 			 getString("Context-Sensitive Help"));
559*0Sstevel@tonic-gate         gui.About2.set("text" /* NOI18N */, getString("About"));
560*0Sstevel@tonic-gate         gui.LoginNameLabel.set("text" /* NOI18N */,
561*0Sstevel@tonic-gate 			       getString("Principal Name:"));
562*0Sstevel@tonic-gate         gui.LoginPassLabel.set("text" /* NOI18N */, getString("Password:"));
563*0Sstevel@tonic-gate         gui.LoginRealmLabel.set("text" /* NOI18N */, getString("Realm:"));
564*0Sstevel@tonic-gate         gui.LoginServerLabel.set("text" /* NOI18N */, getString("Master KDC:"));
565*0Sstevel@tonic-gate         gui.LoginOK.set("text" /* NOI18N */, getString("OK"));
566*0Sstevel@tonic-gate         gui.LoginStartOver.set("text" /* NOI18N */, getString("Start Over"));
567*0Sstevel@tonic-gate     }
568*0Sstevel@tonic-gate 
569*0Sstevel@tonic-gate     /**
570*0Sstevel@tonic-gate      * Set strings on main screen to their I18N'd values
571*0Sstevel@tonic-gate      *
572*0Sstevel@tonic-gate      */
573*0Sstevel@tonic-gate     public void initMainStrings() {
574*0Sstevel@tonic-gate         gui.mainframe.set("title" /* NOI18N */,
575*0Sstevel@tonic-gate 			  getString("SEAM Administration Tool"));
576*0Sstevel@tonic-gate         gui.File.set("text" /* NOI18N */, getString("File"));
577*0Sstevel@tonic-gate         gui.Print.set("text" /* NOI18N */, getString("Print"));
578*0Sstevel@tonic-gate         gui.PrintCurPr.set("text" /* NOI18N */, getString("Current Principal"));
579*0Sstevel@tonic-gate         gui.PrintCurPol.set("text" /* NOI18N */, getString("Current Policy"));
580*0Sstevel@tonic-gate         gui.PrintPrlist.set("text" /* NOI18N */, getString("Principal List"));
581*0Sstevel@tonic-gate         gui.PrintPollist.set("text" /* NOI18N */, getString("Policy List"));
582*0Sstevel@tonic-gate         gui.logout.set("text" /* NOI18N */, getString("Log Out"));
583*0Sstevel@tonic-gate         gui.Exit.set("text" /* NOI18N */, getString("Exit"));
584*0Sstevel@tonic-gate         gui.editMenu.set("text" /* NOI18N */, getString("Edit"));
585*0Sstevel@tonic-gate         gui.editPreferences.set("text" /* NOI18N */,
586*0Sstevel@tonic-gate 				getString("Properties..."));
587*0Sstevel@tonic-gate         gui.menu2.set("text" /* NOI18N */, getString("Refresh"));
588*0Sstevel@tonic-gate         gui.refreshPrincipals.set("text" /* NOI18N */,
589*0Sstevel@tonic-gate 				  getString("Principal List"));
590*0Sstevel@tonic-gate         gui.refreshPolicies.set("text" /* NOI18N */, getString("Policy List"));
591*0Sstevel@tonic-gate         gui.Help.set("text" /* NOI18N */, getString("Help"));
592*0Sstevel@tonic-gate         gui.browserHelp2.set("text" /* NOI18N */, getString("Help Contents"));
593*0Sstevel@tonic-gate         gui.Context.set("text" /* NOI18N */,
594*0Sstevel@tonic-gate 			getString("Context-Sensitive Help"));
595*0Sstevel@tonic-gate         gui.About.set("text" /* NOI18N */, getString("About"));
596*0Sstevel@tonic-gate 
597*0Sstevel@tonic-gate         gui.Prlisttab.set("layoutName", getString("Principals"));
598*0Sstevel@tonic-gate         gui.Pollisttab.set("layoutName", getString("Policies"));
599*0Sstevel@tonic-gate 
600*0Sstevel@tonic-gate         gui.PrListLabel.set("text" /* NOI18N */, getString("Principal List"));
601*0Sstevel@tonic-gate         gui.PrSearchLab.set("text" /* NOI18N */, getString("Filter Pattern:"));
602*0Sstevel@tonic-gate         gui.PrListClear.set("text" /* NOI18N */, getString("Clear Filter"));
603*0Sstevel@tonic-gate         gui.PrListModify.set("text" /* NOI18N */, getString("Modify"));
604*0Sstevel@tonic-gate         gui.PrListAdd.set("text" /* NOI18N */, getString("Create New"));
605*0Sstevel@tonic-gate         gui.PrListDelete.set("text" /* NOI18N */, getString("Delete"));
606*0Sstevel@tonic-gate         gui.PrListDuplicate.set("text" /* NOI18N */, getString("Duplicate"));
607*0Sstevel@tonic-gate 
608*0Sstevel@tonic-gate         gui.PrBasicLabel.set("text" /* NOI18N */,
609*0Sstevel@tonic-gate 			     getString("Principal Basics"));
610*0Sstevel@tonic-gate         gui.PrNameLabel1.set("text" /* NOI18N */, getString("Principal Name:"));
611*0Sstevel@tonic-gate         gui.LabelBarGeneral.set("text" /* NOI18N */, getString("General"));
612*0Sstevel@tonic-gate         gui.PrCommentsLabel.set("text" /* NOI18N */, getString("Comments:"));
613*0Sstevel@tonic-gate         gui.PrPolicyLabel.set("text" /* NOI18N */, getString("Policy:"));
614*0Sstevel@tonic-gate         gui.PrPasswordLabel.set("text" /* NOI18N */, getString("Password:"));
615*0Sstevel@tonic-gate         gui.PrBasicRandomPw.set("text" /* NOI18N */,
616*0Sstevel@tonic-gate 				getString("Generate Random Password"));
617*0Sstevel@tonic-gate         gui.LabelBarPrincipal.set("text" /* NOI18N */,
618*0Sstevel@tonic-gate 				  getString("Admin History"));
619*0Sstevel@tonic-gate         gui.PrLastChangedTimeLabel.set("text" /* NOI18N */,
620*0Sstevel@tonic-gate 				       getString("Last Principal Change:"));
621*0Sstevel@tonic-gate         gui.PrLastChangedByLabel.set("text" /* NOI18N */,
622*0Sstevel@tonic-gate 				     getString("Last Changed By:"));
623*0Sstevel@tonic-gate         gui.PrExpiryLabel.set("text" /* NOI18N */,
624*0Sstevel@tonic-gate 			      getString("Account Expires:"));
625*0Sstevel@tonic-gate         gui.PrBasicSave.set("text" /* NOI18N */, getString("Save"));
626*0Sstevel@tonic-gate         gui.PrBasicPrevious.set("text" /* NOI18N */, getString("Previous"));
627*0Sstevel@tonic-gate         gui.PrBasicNext.set("text" /* NOI18N */, getString("Next"));
628*0Sstevel@tonic-gate         gui.PrBasicCancel.set("text" /* NOI18N */, getString("Cancel"));
629*0Sstevel@tonic-gate 
630*0Sstevel@tonic-gate         gui.PrDetailLabel.set("text" /* NOI18N */,
631*0Sstevel@tonic-gate 			      getString("Principal Details"));
632*0Sstevel@tonic-gate         gui.LabelBarPassword.set("text" /* NOI18N */, getString("Password"));
633*0Sstevel@tonic-gate         gui.PrLastSuccessLabel.set("text" /* NOI18N */,
634*0Sstevel@tonic-gate 				   getString("Last Success:"));
635*0Sstevel@tonic-gate         gui.PrLastFailureLabel.set("text" /* NOI18N */,
636*0Sstevel@tonic-gate 				   getString("Last Failure:"));
637*0Sstevel@tonic-gate         gui.PrFailureCountLabel.set("text" /* NOI18N */,
638*0Sstevel@tonic-gate 				    getString("Failure Count:"));
639*0Sstevel@tonic-gate         gui.PrPwLastChangedLabel.set("text" /* NOI18N */,
640*0Sstevel@tonic-gate 				     getString("Last Password Change:"));
641*0Sstevel@tonic-gate         gui.PrPwExpiryLabel.set("text" /* NOI18N */,
642*0Sstevel@tonic-gate 				getString("Password Expires:"));
643*0Sstevel@tonic-gate         gui.PrKvnoLabel.set("text" /* NOI18N */, getString("Key Version:"));
644*0Sstevel@tonic-gate         gui.LabelBarTicket.set("text" /* NOI18N */,
645*0Sstevel@tonic-gate 			       getString("Ticket Lifetimes"));
646*0Sstevel@tonic-gate         gui.PrMaxTicketLifetimeLabel.set("text" /* NOI18N */,
647*0Sstevel@tonic-gate 				 getString("Maximum Lifetime (seconds):"));
648*0Sstevel@tonic-gate         gui.PrMaxTicketRenewalLabel.set("text" /* NOI18N */,
649*0Sstevel@tonic-gate 				getString("Maximum Renewal (seconds):"));
650*0Sstevel@tonic-gate         gui.PrDetailSave.set("text" /* NOI18N */, getString("Save"));
651*0Sstevel@tonic-gate         gui.PrDetailPrevious.set("text" /* NOI18N */, getString("Previous"));
652*0Sstevel@tonic-gate         gui.PrDetailNext.set("text" /* NOI18N */, getString("Next"));
653*0Sstevel@tonic-gate         gui.PrDetailCancel.set("text" /* NOI18N */, getString("Cancel"));
654*0Sstevel@tonic-gate 
655*0Sstevel@tonic-gate         gui.PrFlagLabel.set("text" /* NOI18N */, getString("Principal Flags"));
656*0Sstevel@tonic-gate         gui.LabelBarSecurity.set("text" /* NOI18N */, getString("Security"));
657*0Sstevel@tonic-gate 
658*0Sstevel@tonic-gate         gui.PrLockAcct.set("text" /* NOI18N */,
659*0Sstevel@tonic-gate 			   Flags.getLabel(Flags.DISALLOW_ALL_TIX));
660*0Sstevel@tonic-gate         gui.PrForcePwChange.set("text" /* NOI18N */,
661*0Sstevel@tonic-gate 				Flags.getLabel(Flags.REQUIRES_PWCHANGE));
662*0Sstevel@tonic-gate         gui.LabelBarTickets.set("text" /* NOI18N */, getString("Ticket"));
663*0Sstevel@tonic-gate         gui.PrAllowPostdated.set("text" /* NOI18N */,
664*0Sstevel@tonic-gate 				 Flags.getLabel(Flags.DISALLOW_POSTDATED));
665*0Sstevel@tonic-gate         gui.PrAllowForwardable.set("text" /* NOI18N */,
666*0Sstevel@tonic-gate 				   Flags.getLabel(Flags.DISALLOW_FORWARDABLE));
667*0Sstevel@tonic-gate         gui.PrAllowRenewable.set("text" /* NOI18N */,
668*0Sstevel@tonic-gate 				 Flags.getLabel(Flags.DISALLOW_RENEWABLE));
669*0Sstevel@tonic-gate         gui.PrAllowProxiable.set("text" /* NOI18N */,
670*0Sstevel@tonic-gate 				 Flags.getLabel(Flags.DISALLOW_PROXIABLE));
671*0Sstevel@tonic-gate         gui.PrAllowSvr.set("text" /* NOI18N */,
672*0Sstevel@tonic-gate 			   Flags.getLabel(Flags.DISALLOW_SVR));
673*0Sstevel@tonic-gate         gui.LabelBarMiscellany.set("text" /* NOI18N */,
674*0Sstevel@tonic-gate 				   getString("Miscellaneous"));
675*0Sstevel@tonic-gate         gui.PrAllowTGT.set("text" /* NOI18N */,
676*0Sstevel@tonic-gate 			   Flags.getLabel(Flags.DISALLOW_TGT_BASED));
677*0Sstevel@tonic-gate         gui.PrAllowDupAuth.set("text" /* NOI18N */,
678*0Sstevel@tonic-gate 			       Flags.getLabel(Flags.DISALLOW_DUP_SKEY));
679*0Sstevel@tonic-gate         gui.PrRequirePreAuth.set("text" /* NOI18N */,
680*0Sstevel@tonic-gate 				 Flags.getLabel(Flags.REQUIRE_PRE_AUTH));
681*0Sstevel@tonic-gate         gui.PrRequireHwPreAuth.set("text" /* NOI18N */,
682*0Sstevel@tonic-gate 				   Flags.getLabel(Flags.REQUIRE_HW_AUTH));
683*0Sstevel@tonic-gate         gui.PrFlagsSave.set("text" /* NOI18N */, getString("Save"));
684*0Sstevel@tonic-gate         gui.PrFlagsPrevious.set("text" /* NOI18N */, getString("Previous"));
685*0Sstevel@tonic-gate         gui.PrFlagsNext.set("text" /* NOI18N */, getString("Done"));
686*0Sstevel@tonic-gate         gui.PrFlagsCancel.set("text" /* NOI18N */, getString("Cancel"));
687*0Sstevel@tonic-gate 
688*0Sstevel@tonic-gate         gui.PoListLabel.set("text" /* NOI18N */, getString("Policy List"));
689*0Sstevel@tonic-gate         gui.PoListPatternLabel.set("text" /* NOI18N */,
690*0Sstevel@tonic-gate 				   getString("Filter Pattern:"));
691*0Sstevel@tonic-gate         gui.PoListClear.set("text" /* NOI18N */, getString("Clear Filter"));
692*0Sstevel@tonic-gate         gui.PoListModify.set("text" /* NOI18N */, getString("Modify"));
693*0Sstevel@tonic-gate         gui.PoListAdd.set("text" /* NOI18N */, getString("Create New"));
694*0Sstevel@tonic-gate         gui.PoListDelete.set("text" /* NOI18N */, getString("Delete"));
695*0Sstevel@tonic-gate         gui.PoListDuplicate.set("text" /* NOI18N */, getString("Duplicate"));
696*0Sstevel@tonic-gate 
697*0Sstevel@tonic-gate         gui.PoDetailLabel.set("text" /* NOI18N */, getString("Policy Details"));
698*0Sstevel@tonic-gate         gui.PoNameLabel.set("text" /* NOI18N */, getString("Policy Name:"));
699*0Sstevel@tonic-gate         gui.PoMinPwLengthLabel.set("text" /* NOI18N */,
700*0Sstevel@tonic-gate 				   getString("Minimum Password Length:"));
701*0Sstevel@tonic-gate         gui.PoMinPwClassLabel.set("text" /* NOI18N */,
702*0Sstevel@tonic-gate 				  getString("Minimum Password Classes:"));
703*0Sstevel@tonic-gate         gui.PoSavedPasswordsLabel.set("text" /* NOI18N */,
704*0Sstevel@tonic-gate 				      getString("Saved Password History:"));
705*0Sstevel@tonic-gate         gui.PoMinTicketLifetimeLabel.set("text" /* NOI18N */,
706*0Sstevel@tonic-gate 			 getString("Minimum Password Lifetime (seconds):"));
707*0Sstevel@tonic-gate         gui.PoMaxTicketLifetimeLabel.set("text" /* NOI18N */,
708*0Sstevel@tonic-gate 			 getString("Maximum Password Lifetime (seconds):"));
709*0Sstevel@tonic-gate         gui.PoReferencesLabel.set("text" /* NOI18N */,
710*0Sstevel@tonic-gate 				  getString("Principals Using This Policy:"));
711*0Sstevel@tonic-gate         gui.PoDetailSave.set("text" /* NOI18N */, getString("Save"));
712*0Sstevel@tonic-gate         gui.PoDetailPrevious.set("text" /* NOI18N */, getString("Previous"));
713*0Sstevel@tonic-gate         gui.PoDetailDone.set("text" /* NOI18N */, getString("Done"));
714*0Sstevel@tonic-gate         gui.PoDetailCancel.set("text" /* NOI18N */, getString("Cancel"));
715*0Sstevel@tonic-gate     }
716*0Sstevel@tonic-gate 
717*0Sstevel@tonic-gate     /**
718*0Sstevel@tonic-gate      * Allow user to see a fatal error before exiting
719*0Sstevel@tonic-gate      */
720*0Sstevel@tonic-gate     public void fatalError(Frame frame, String[] text) {
721*0Sstevel@tonic-gate         String title = getString("Error");
722*0Sstevel@tonic-gate         String[] buttons = new String[1];
723*0Sstevel@tonic-gate         buttons[0] = getString("OK");
724*0Sstevel@tonic-gate         ChoiceDialog cd = new ChoiceDialog(frame, title, text, buttons);
725*0Sstevel@tonic-gate         cd.getSelection();
726*0Sstevel@tonic-gate         exit();
727*0Sstevel@tonic-gate     }
728*0Sstevel@tonic-gate 
729*0Sstevel@tonic-gate     /**
730*0Sstevel@tonic-gate      * Set the defaults for the login screen.  Called on startup,
731*0Sstevel@tonic-gate      * when "Start Over" is pressed, or when "Log Out" is chosen
732*0Sstevel@tonic-gate      * from the main screen's menu.
733*0Sstevel@tonic-gate      *
734*0Sstevel@tonic-gate      */
735*0Sstevel@tonic-gate     public void setLoginDefaults() {
736*0Sstevel@tonic-gate         CurName = DefName;
737*0Sstevel@tonic-gate         CurPass = "";
738*0Sstevel@tonic-gate         if (DefRealm != null)
739*0Sstevel@tonic-gate             CurRealm = DefRealm;
740*0Sstevel@tonic-gate         else {
741*0Sstevel@tonic-gate             CurRealm = "";
742*0Sstevel@tonic-gate             if (firsttime) {
743*0Sstevel@tonic-gate                 showLoginWarning(getString("Cannot find default realm; "
744*0Sstevel@tonic-gate 					   +"check /etc/krb5/krb5.conf"));
745*0Sstevel@tonic-gate                 firsttime = false;
746*0Sstevel@tonic-gate             }
747*0Sstevel@tonic-gate         }
748*0Sstevel@tonic-gate         if (DefServer != null)
749*0Sstevel@tonic-gate             CurServer = DefServer;
750*0Sstevel@tonic-gate         else
751*0Sstevel@tonic-gate             CurServer = "";
752*0Sstevel@tonic-gate         CurPort = 0;
753*0Sstevel@tonic-gate         try {
754*0Sstevel@tonic-gate             Integer i = new Integer(DefPort);
755*0Sstevel@tonic-gate             CurPort = i.intValue();
756*0Sstevel@tonic-gate         } catch (NumberFormatException e) {}
757*0Sstevel@tonic-gate         gui.LoginName.set("text" /* NOI18N */, CurName);
758*0Sstevel@tonic-gate         gui.LoginPass.set("text" /* NOI18N */, CurPass);
759*0Sstevel@tonic-gate         gui.LoginRealm.set("text" /* NOI18N */, CurRealm);
760*0Sstevel@tonic-gate         gui.LoginServer.set("text" /* NOI18N */, CurServer);
761*0Sstevel@tonic-gate         if (CurRealm.equals("___default_realm___")) {
762*0Sstevel@tonic-gate             String[] error = new String[1];
763*0Sstevel@tonic-gate             error[0] = getString(
764*0Sstevel@tonic-gate 				 "Kerberos /etc/krb5/krb5.conf configuration"
765*0Sstevel@tonic-gate 				 +" file not configured; exiting");
766*0Sstevel@tonic-gate             fatalError(realLoginFrame, error);
767*0Sstevel@tonic-gate         }
768*0Sstevel@tonic-gate         if (!loginListeners)
769*0Sstevel@tonic-gate             setupLoginNormalListeners();
770*0Sstevel@tonic-gate         loginListeners = true;
771*0Sstevel@tonic-gate         TextField name = (TextField)gui.LoginName.getBody();
772*0Sstevel@tonic-gate         name.selectAll();
773*0Sstevel@tonic-gate         name.requestFocus();
774*0Sstevel@tonic-gate     }
775*0Sstevel@tonic-gate 
776*0Sstevel@tonic-gate     /**
777*0Sstevel@tonic-gate      * React after new realm entered
778*0Sstevel@tonic-gate      *
779*0Sstevel@tonic-gate      */
780*0Sstevel@tonic-gate     public void newRealm() {
781*0Sstevel@tonic-gate         CurRealm = (String)gui.LoginRealm.get("text" /* NOI18N */);
782*0Sstevel@tonic-gate         String s = kc.getRealmServer(CurRealm);
783*0Sstevel@tonic-gate         if (s != null) {
784*0Sstevel@tonic-gate             CurServer = s;
785*0Sstevel@tonic-gate             gui.LoginServer.set("text" /* NOI18N */, CurServer);
786*0Sstevel@tonic-gate 
787*0Sstevel@tonic-gate         } else {
788*0Sstevel@tonic-gate             showLoginWarning(getString("Cannot find default server for realm"));
789*0Sstevel@tonic-gate             CurServer = "";
790*0Sstevel@tonic-gate             gui.LoginServer.set("text" /* NOI18N */, CurServer);
791*0Sstevel@tonic-gate             ((TextField)gui.LoginServer.getBody()).requestFocus();
792*0Sstevel@tonic-gate         }
793*0Sstevel@tonic-gate     }
794*0Sstevel@tonic-gate 
795*0Sstevel@tonic-gate     /**
796*0Sstevel@tonic-gate      * React after new server entered
797*0Sstevel@tonic-gate      *
798*0Sstevel@tonic-gate      */
799*0Sstevel@tonic-gate     public void newServer() {
800*0Sstevel@tonic-gate         CurServer = (String)gui.LoginServer.get("text" /* NOI18N */);
801*0Sstevel@tonic-gate         if (CurPass.compareTo("") != 0)
802*0Sstevel@tonic-gate             loginComplete();
803*0Sstevel@tonic-gate     }
804*0Sstevel@tonic-gate 
805*0Sstevel@tonic-gate     /**
806*0Sstevel@tonic-gate      * React after username is complete
807*0Sstevel@tonic-gate      *
808*0Sstevel@tonic-gate      */
809*0Sstevel@tonic-gate     public void nameComplete() {
810*0Sstevel@tonic-gate         ((TextField)gui.LoginName.getBody()).select(0, 0);
811*0Sstevel@tonic-gate         ((TextField)gui.LoginPass.getBody()).requestFocus();
812*0Sstevel@tonic-gate     }
813*0Sstevel@tonic-gate 
814*0Sstevel@tonic-gate     /**
815*0Sstevel@tonic-gate      * React after password is complete or "OK" button is pressed.
816*0Sstevel@tonic-gate      * We insist that the realm and server are set here separately
817*0Sstevel@tonic-gate      * so that we can permit field-to-field motion if /etc/krb5/krb5.conf
818*0Sstevel@tonic-gate      * does not exist.
819*0Sstevel@tonic-gate      *
820*0Sstevel@tonic-gate      */
821*0Sstevel@tonic-gate     public void passwordComplete() {
822*0Sstevel@tonic-gate         CurPass = (String)gui.LoginPass.get("text" /* NOI18N */);
823*0Sstevel@tonic-gate         if (CurRealm.compareTo("") == 0) {
824*0Sstevel@tonic-gate             ((TextField)gui.LoginRealm.getBody()).requestFocus();
825*0Sstevel@tonic-gate             return;
826*0Sstevel@tonic-gate         }
827*0Sstevel@tonic-gate         if (CurServer.compareTo("") == 0) {
828*0Sstevel@tonic-gate             ((TextField)gui.LoginServer.getBody()).requestFocus();
829*0Sstevel@tonic-gate             return;
830*0Sstevel@tonic-gate         }
831*0Sstevel@tonic-gate         loginComplete();
832*0Sstevel@tonic-gate     }
833*0Sstevel@tonic-gate 
834*0Sstevel@tonic-gate     /**
835*0Sstevel@tonic-gate      * Check to see if we're happy with the login information.
836*0Sstevel@tonic-gate      * We may want to go to the main screen, principal list tab.
837*0Sstevel@tonic-gate      *
838*0Sstevel@tonic-gate      */
839*0Sstevel@tonic-gate     public void loginComplete() {
840*0Sstevel@tonic-gate         pdateLoginDone = new Date();
841*0Sstevel@tonic-gate         CurName   = (String)gui.LoginName.get("text" /* NOI18N */);
842*0Sstevel@tonic-gate         CurPass   = (String)gui.LoginPass.get("text" /* NOI18N */);
843*0Sstevel@tonic-gate         CurRealm  = (String)gui.LoginRealm.get("text" /* NOI18N */);
844*0Sstevel@tonic-gate         CurServer = (String)gui.LoginServer.get("text" /* NOI18N */);
845*0Sstevel@tonic-gate         if (CurPass.compareTo("") == 0) {
846*0Sstevel@tonic-gate             showLoginWarning(getString("A password must be specified"));
847*0Sstevel@tonic-gate             ((TextField)gui.LoginPass.getBody()).requestFocus();
848*0Sstevel@tonic-gate             return;
849*0Sstevel@tonic-gate         }
850*0Sstevel@tonic-gate         if (CurRealm.compareTo("") == 0) {
851*0Sstevel@tonic-gate             showLoginWarning(getString("A realm entry must be specified"));
852*0Sstevel@tonic-gate             ((TextField)gui.LoginRealm.getBody()).requestFocus();
853*0Sstevel@tonic-gate             return;
854*0Sstevel@tonic-gate         }
855*0Sstevel@tonic-gate         if (CurServer.compareTo("") == 0) {
856*0Sstevel@tonic-gate             showLoginWarning(getString("A master KDC entry must be specified"));
857*0Sstevel@tonic-gate             ((TextField)gui.LoginServer.getBody()).requestFocus();
858*0Sstevel@tonic-gate             return;
859*0Sstevel@tonic-gate         }
860*0Sstevel@tonic-gate 
861*0Sstevel@tonic-gate         realLoginFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
862*0Sstevel@tonic-gate         Kadmin = new Kadmin();
863*0Sstevel@tonic-gate         boolean b;
864*0Sstevel@tonic-gate         try {
865*0Sstevel@tonic-gate             b = Kadmin.sessionInit(CurName, CurPass, CurRealm, CurServer,
866*0Sstevel@tonic-gate 				   CurPort);
867*0Sstevel@tonic-gate         } catch (Exception e) {
868*0Sstevel@tonic-gate             b = false;
869*0Sstevel@tonic-gate             realLoginFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
870*0Sstevel@tonic-gate             showLoginError(e.getMessage());
871*0Sstevel@tonic-gate             return;
872*0Sstevel@tonic-gate         }
873*0Sstevel@tonic-gate         realLoginFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
874*0Sstevel@tonic-gate         if (b == false) {
875*0Sstevel@tonic-gate             showLoginError(getString("Invalid login, please try again"));
876*0Sstevel@tonic-gate             return;
877*0Sstevel@tonic-gate         }
878*0Sstevel@tonic-gate         pdateSessionUp = new Date();
879*0Sstevel@tonic-gate 
880*0Sstevel@tonic-gate         // Instantiate defaults for this user
881*0Sstevel@tonic-gate         if (defaults == null)
882*0Sstevel@tonic-gate             defaults = new Defaults(System.getProperty("user.home" /* NOI18N */)
883*0Sstevel@tonic-gate 				    + "/.gkadmin" /* NOI18N */,
884*0Sstevel@tonic-gate 			    (java.awt.Color)gui.mainframe.get("background"));
885*0Sstevel@tonic-gate         else
886*0Sstevel@tonic-gate             defaults.refreshDefaults();
887*0Sstevel@tonic-gate 
888*0Sstevel@tonic-gate         // Figure out what privileges we have
889*0Sstevel@tonic-gate         try {
890*0Sstevel@tonic-gate             privs = Kadmin.getPrivs();
891*0Sstevel@tonic-gate         } catch (Exception e) {
892*0Sstevel@tonic-gate             showLoginError(e.getMessage());
893*0Sstevel@tonic-gate         }
894*0Sstevel@tonic-gate 
895*0Sstevel@tonic-gate         // Check privileges; if bad enough, we'll just give up.
896*0Sstevel@tonic-gate         if (checkPrivs() == false) {
897*0Sstevel@tonic-gate             try {
898*0Sstevel@tonic-gate                 Kadmin.sessionExit();
899*0Sstevel@tonic-gate             } catch (Exception e) {}
900*0Sstevel@tonic-gate             return;
901*0Sstevel@tonic-gate         }
902*0Sstevel@tonic-gate         reactToPrivs();
903*0Sstevel@tonic-gate 
904*0Sstevel@tonic-gate         prSetEditable(false);
905*0Sstevel@tonic-gate         prSetCanSave(false);
906*0Sstevel@tonic-gate         poSetEditable(false);
907*0Sstevel@tonic-gate         poSetCanSave(false);
908*0Sstevel@tonic-gate         prSelValid(false);
909*0Sstevel@tonic-gate         poSelValid(false);
910*0Sstevel@tonic-gate         gui.PrListPattern.set("text" /* NOI18N */, "");
911*0Sstevel@tonic-gate         gui.PoListPattern.set("text" /* NOI18N */, "");
912*0Sstevel@tonic-gate 
913*0Sstevel@tonic-gate         // Disable login frame
914*0Sstevel@tonic-gate         setListeners(LoginNormal, false);
915*0Sstevel@tonic-gate         loginListeners = false;
916*0Sstevel@tonic-gate 
917*0Sstevel@tonic-gate         pdatePreMainShow = new Date();
918*0Sstevel@tonic-gate         realLoginFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
919*0Sstevel@tonic-gate         gui.mainframe.show(true);	/* XXX - done waaay too early, fix */
920*0Sstevel@tonic-gate         realLoginFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
921*0Sstevel@tonic-gate         pdatePostMainShow = new Date();
922*0Sstevel@tonic-gate         realMainFrame  = (Frame)gui.mainframe.getBody();
923*0Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
924*0Sstevel@tonic-gate         gui.tabbedfolder1.show(getString("Principals"));
925*0Sstevel@tonic-gate         gui.cardpanel2.show("List" /* NOI18N */);
926*0Sstevel@tonic-gate         setupMainNormalListeners();
927*0Sstevel@tonic-gate         setupDefaultsEditingFrame();
928*0Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
929*0Sstevel@tonic-gate         pdateMainActive = new Date();
930*0Sstevel@tonic-gate         reportStartTimes();
931*0Sstevel@tonic-gate 
932*0Sstevel@tonic-gate         showPolicyList("");
933*0Sstevel@tonic-gate         showPrincipalList("");
934*0Sstevel@tonic-gate         setPolicyChoice();
935*0Sstevel@tonic-gate         /* XXX - disabled multiple selection until double-click works */
936*0Sstevel@tonic-gate         gui.Prlist.set("allowMultipleSelections" /* NOI18N */,
937*0Sstevel@tonic-gate 		       new Boolean(false));
938*0Sstevel@tonic-gate         gui.Pollist.set("allowMultipleSelections" /* NOI18N */,
939*0Sstevel@tonic-gate 			new Boolean(false));
940*0Sstevel@tonic-gate         if ((privs & PRIV_LIST) == 0) {
941*0Sstevel@tonic-gate             showWarning(
942*0Sstevel@tonic-gate 	getString("Unable to access lists;please use the Name field."));
943*0Sstevel@tonic-gate             ((TextField)gui.PrListPattern.getBody()).requestFocus();
944*0Sstevel@tonic-gate         }
945*0Sstevel@tonic-gate     }
946*0Sstevel@tonic-gate 
947*0Sstevel@tonic-gate     /**
948*0Sstevel@tonic-gate      * React to main screen's "Log Out" choice by going back to login screen.
949*0Sstevel@tonic-gate      *
950*0Sstevel@tonic-gate      */
951*0Sstevel@tonic-gate     public void logout() {
952*0Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
953*0Sstevel@tonic-gate         setListeners(MainNormal, false);
954*0Sstevel@tonic-gate         setListeners(defaultsNormal, false);
955*0Sstevel@tonic-gate         try {
956*0Sstevel@tonic-gate             Kadmin.sessionExit();
957*0Sstevel@tonic-gate             Kadmin = null;
958*0Sstevel@tonic-gate         } catch (Exception e) {
959*0Sstevel@tonic-gate             realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
960*0Sstevel@tonic-gate             showError(e.getMessage());
961*0Sstevel@tonic-gate             return;
962*0Sstevel@tonic-gate         }
963*0Sstevel@tonic-gate         setLoginDefaults();
964*0Sstevel@tonic-gate         principalList = null;
965*0Sstevel@tonic-gate         gui.Prlist.set("items" /* NOI18N */, null);
966*0Sstevel@tonic-gate         policyList = null;
967*0Sstevel@tonic-gate         gui.Pollist.set("items" /* NOI18N */, null);
968*0Sstevel@tonic-gate         gui.mainframe.show(false);
969*0Sstevel@tonic-gate         curPrListPos = 0;
970*0Sstevel@tonic-gate         curPrPattern = "";
971*0Sstevel@tonic-gate         curPoListPos = 0;
972*0Sstevel@tonic-gate         curPoPattern = "";
973*0Sstevel@tonic-gate 
974*0Sstevel@tonic-gate         // Forget this user's print preferences
975*0Sstevel@tonic-gate         PrintUtil.reinitialize();
976*0Sstevel@tonic-gate 
977*0Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
978*0Sstevel@tonic-gate     }
979*0Sstevel@tonic-gate 
980*0Sstevel@tonic-gate     public void exit() {
981*0Sstevel@tonic-gate         try {
982*0Sstevel@tonic-gate             if (Kadmin != null)
983*0Sstevel@tonic-gate                 Kadmin.sessionExit();
984*0Sstevel@tonic-gate         } catch (Exception e) {}
985*0Sstevel@tonic-gate         super.exit();
986*0Sstevel@tonic-gate     }
987*0Sstevel@tonic-gate 
988*0Sstevel@tonic-gate     /*
989*0Sstevel@tonic-gate      * Methods for the principal list panel
990*0Sstevel@tonic-gate      */
991*0Sstevel@tonic-gate 
992*0Sstevel@tonic-gate     /**
993*0Sstevel@tonic-gate      * Update all principal text fields from gui.
994*0Sstevel@tonic-gate      * Check to see if anyone of them had a parse error.
995*0Sstevel@tonic-gate      * @param nullPasswdOK true if the password can be null. This is
996*0Sstevel@tonic-gate      * allowed only when the operation is a modify on an existing
997*0Sstevel@tonic-gate      * principal or if it is an attempt to print a new principal still
998*0Sstevel@tonic-gate      * in creation.
999*0Sstevel@tonic-gate      * @returns true if all is ok,  false if an error occurs
1000*0Sstevel@tonic-gate      */
1001*0Sstevel@tonic-gate     // Quits as soon as the first error is detected. The method that
1002*0Sstevel@tonic-gate     // detects the error also shows a dialog box with a message.
1003*0Sstevel@tonic-gate     public boolean prUpdateFromGui(boolean nullPasswdOK) {
1004*0Sstevel@tonic-gate         return (setPrName1() && setPrPassword(nullPasswdOK) && setPrExpiry() &&
1005*0Sstevel@tonic-gate 		setPrComments() && setPrPwExpiry() && setPrKvno() &&
1006*0Sstevel@tonic-gate 		setPrMaxlife() && setPrMaxrenew());
1007*0Sstevel@tonic-gate     }
1008*0Sstevel@tonic-gate 
1009*0Sstevel@tonic-gate     /**
1010*0Sstevel@tonic-gate      * Is the principal name field editable?
1011*0Sstevel@tonic-gate      *
1012*0Sstevel@tonic-gate      */
1013*0Sstevel@tonic-gate     public void prSetEditable(boolean editable) {
1014*0Sstevel@tonic-gate         prnameEditable = editable;
1015*0Sstevel@tonic-gate         Boolean b = new Boolean(editable);
1016*0Sstevel@tonic-gate         gui.PrName1.set("editable" /* NOI18N */, b);
1017*0Sstevel@tonic-gate     }
1018*0Sstevel@tonic-gate 
1019*0Sstevel@tonic-gate     /**
1020*0Sstevel@tonic-gate      * React to a change in the principal search pattern
1021*0Sstevel@tonic-gate      *
1022*0Sstevel@tonic-gate      */
1023*0Sstevel@tonic-gate     public void prPatternComplete() {
1024*0Sstevel@tonic-gate         curPrListPos = 0;
1025*0Sstevel@tonic-gate         String pattern = (String)gui.PrListPattern.get("text" /* NOI18N */);
1026*0Sstevel@tonic-gate         if (!noLists)
1027*0Sstevel@tonic-gate             showPrincipalList(pattern);
1028*0Sstevel@tonic-gate         else
1029*0Sstevel@tonic-gate             setCurPrincipal(pattern);
1030*0Sstevel@tonic-gate     }
1031*0Sstevel@tonic-gate 
1032*0Sstevel@tonic-gate     /**
1033*0Sstevel@tonic-gate      * Clear principal search pattern
1034*0Sstevel@tonic-gate      *
1035*0Sstevel@tonic-gate      */
1036*0Sstevel@tonic-gate     public void prPatternClear() {
1037*0Sstevel@tonic-gate         if (noLists) {
1038*0Sstevel@tonic-gate             gui.PrListPattern.set("text" /* NOI18N */, "");
1039*0Sstevel@tonic-gate             ((TextField)gui.PrListPattern.getBody()).requestFocus();
1040*0Sstevel@tonic-gate         } else {
1041*0Sstevel@tonic-gate             String tempName = CurPrincipal;
1042*0Sstevel@tonic-gate             fillPrincipalList("");
1043*0Sstevel@tonic-gate             selectPrincipal(tempName);
1044*0Sstevel@tonic-gate         }
1045*0Sstevel@tonic-gate     }
1046*0Sstevel@tonic-gate 
1047*0Sstevel@tonic-gate     /**
1048*0Sstevel@tonic-gate      * Show the principal list after applying the filter passed in.
1049*0Sstevel@tonic-gate      */
1050*0Sstevel@tonic-gate     public void showPrincipalList(String pattern) {
1051*0Sstevel@tonic-gate         prin = null; // we are not editing a principal
1052*0Sstevel@tonic-gate         fillPrincipalList(pattern);
1053*0Sstevel@tonic-gate         ModeString = "";
1054*0Sstevel@tonic-gate         OpString = "";
1055*0Sstevel@tonic-gate         updateStatus();
1056*0Sstevel@tonic-gate         gui.cardpanel1.show("List" /* NOI18N */);
1057*0Sstevel@tonic-gate         if (noLists)
1058*0Sstevel@tonic-gate             ((TextField)gui.PrListPattern.getBody()).requestFocus();
1059*0Sstevel@tonic-gate     }
1060*0Sstevel@tonic-gate 
1061*0Sstevel@tonic-gate     /**
1062*0Sstevel@tonic-gate      * Generate the principal list for the first time or after a pattern
1063*0Sstevel@tonic-gate      * has been chosen.
1064*0Sstevel@tonic-gate      *
1065*0Sstevel@tonic-gate      */
1066*0Sstevel@tonic-gate     public void fillPrincipalList(String pattern) {
1067*0Sstevel@tonic-gate         if (noLists) {
1068*0Sstevel@tonic-gate             setCurPrincipal((String)gui.PrListPattern.get("text" /* NOI18N */));
1069*0Sstevel@tonic-gate             ((TextField)gui.PrListPattern.getBody()).requestFocus();
1070*0Sstevel@tonic-gate             disablePrincipalPrinting();
1071*0Sstevel@tonic-gate             return;
1072*0Sstevel@tonic-gate         }
1073*0Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
1074*0Sstevel@tonic-gate         pdateStartPlist = new Date();
1075*0Sstevel@tonic-gate         // Do we still want to cache the principal list?
1076*0Sstevel@tonic-gate         long cachetime = A_LONG_TIME;
1077*0Sstevel@tonic-gate         if (!defaults.getStaticLists())
1078*0Sstevel@tonic-gate             cachetime = defaults.getCacheTime() * 1000;
1079*0Sstevel@tonic-gate         if (principalList != null
1080*0Sstevel@tonic-gate 	    && ((new Date()).getTime() - principalListDate.getTime())
1081*0Sstevel@tonic-gate 	    <= cachetime) {
1082*0Sstevel@tonic-gate 
1083*0Sstevel@tonic-gate             // Has the pattern changed?
1084*0Sstevel@tonic-gate             if (pattern.compareTo(curPrPattern) != 0)
1085*0Sstevel@tonic-gate                 newPrPattern(pattern);
1086*0Sstevel@tonic-gate             realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
1087*0Sstevel@tonic-gate             selectPrincipal(curPrListPos);
1088*0Sstevel@tonic-gate             return;
1089*0Sstevel@tonic-gate 
1090*0Sstevel@tonic-gate         }
1091*0Sstevel@tonic-gate         PrincipalList p = new PrincipalList(Kadmin);
1092*0Sstevel@tonic-gate         gui.StatusLine.set("text" /* NOI18N */,
1093*0Sstevel@tonic-gate 			   getString("Loading principal list"));
1094*0Sstevel@tonic-gate         try {
1095*0Sstevel@tonic-gate             principalList = p.getPrincipalList(CurRealm);
1096*0Sstevel@tonic-gate             principalListDate = new Date();
1097*0Sstevel@tonic-gate         } catch (Exception e) {
1098*0Sstevel@tonic-gate             realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
1099*0Sstevel@tonic-gate             showError(e.getMessage());
1100*0Sstevel@tonic-gate             updateStatus();
1101*0Sstevel@tonic-gate             return;
1102*0Sstevel@tonic-gate         }
1103*0Sstevel@tonic-gate         updateStatus();
1104*0Sstevel@tonic-gate         pdateHavePlist = new Date();
1105*0Sstevel@tonic-gate         reportTime("Fetched Plist  : ", pdateHavePlist, pdateStartPlist);
1106*0Sstevel@tonic-gate         newPrPattern(pattern);
1107*0Sstevel@tonic-gate         selectPrincipal(curPrListPos);
1108*0Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
1109*0Sstevel@tonic-gate         pdateDonePlist = new Date();
1110*0Sstevel@tonic-gate         reportTime("Completed Plist: ", pdateDonePlist, pdateHavePlist);
1111*0Sstevel@tonic-gate         if (perfmon)
1112*0Sstevel@tonic-gate             System.out.println("Principal list has "
1113*0Sstevel@tonic-gate 	       +(new Integer(principalList.length)).toString()+" items");
1114*0Sstevel@tonic-gate     }
1115*0Sstevel@tonic-gate 
1116*0Sstevel@tonic-gate     private void newPrPattern(String pattern) {
1117*0Sstevel@tonic-gate         curPrPattern = pattern;
1118*0Sstevel@tonic-gate         gui.PrListPattern.set("text" /* NOI18N */, pattern);
1119*0Sstevel@tonic-gate         refreshPrincipalList();
1120*0Sstevel@tonic-gate     }
1121*0Sstevel@tonic-gate 
1122*0Sstevel@tonic-gate     private void refreshPrincipalList() {
1123*0Sstevel@tonic-gate         if (noLists)
1124*0Sstevel@tonic-gate             return;
1125*0Sstevel@tonic-gate         Filter f = new Filter(principalList, curPrPattern);
1126*0Sstevel@tonic-gate         gui.Prlist.set("items" /* NOI18N */, f.out);
1127*0Sstevel@tonic-gate     }
1128*0Sstevel@tonic-gate 
1129*0Sstevel@tonic-gate     private void selectPrincipal(int pos) {
1130*0Sstevel@tonic-gate         TextList list = (TextList)gui.Prlist.getBody();
1131*0Sstevel@tonic-gate         if (list.countItems() == 0) {
1132*0Sstevel@tonic-gate             setCurPrincipal("");
1133*0Sstevel@tonic-gate             return;
1134*0Sstevel@tonic-gate         }
1135*0Sstevel@tonic-gate 
1136*0Sstevel@tonic-gate         if (pos < 0)
1137*0Sstevel@tonic-gate             pos = 0;
1138*0Sstevel@tonic-gate         else if (pos >= list.countItems())
1139*0Sstevel@tonic-gate             pos = list.countItems() - 1;
1140*0Sstevel@tonic-gate 
1141*0Sstevel@tonic-gate         list.select(pos);
1142*0Sstevel@tonic-gate         enablePrincipalPrinting();
1143*0Sstevel@tonic-gate         list.makeVisible(pos);
1144*0Sstevel@tonic-gate         setCurPrincipal(list.getItem(pos));
1145*0Sstevel@tonic-gate     }
1146*0Sstevel@tonic-gate 
1147*0Sstevel@tonic-gate     private void selectPrincipal(String name) {
1148*0Sstevel@tonic-gate         String[] list = getItemsFromTextList(((TextList)gui.Prlist.getBody()));
1149*0Sstevel@tonic-gate         selectPrincipal(search(list, name));
1150*0Sstevel@tonic-gate     }
1151*0Sstevel@tonic-gate 
1152*0Sstevel@tonic-gate     private String[] getItemsFromTextList(TextList list) {
1153*0Sstevel@tonic-gate         StringVector v = list.items();
1154*0Sstevel@tonic-gate         String [] ret = new String[v.size()];
1155*0Sstevel@tonic-gate         v.copyInto(ret);
1156*0Sstevel@tonic-gate         return ret;
1157*0Sstevel@tonic-gate     }
1158*0Sstevel@tonic-gate 
1159*0Sstevel@tonic-gate     /**
1160*0Sstevel@tonic-gate      * Find index where "name" might go in a sorted string array;
1161*0Sstevel@tonic-gate      * returns either the element which matches "name" exactly
1162*0Sstevel@tonic-gate      * or the element just lexographically greater than "name".
1163*0Sstevel@tonic-gate      */
1164*0Sstevel@tonic-gate     private int search(String[] array, String name) {
1165*0Sstevel@tonic-gate         int lo = 0;
1166*0Sstevel@tonic-gate         int hi = array.length;
1167*0Sstevel@tonic-gate         int mid = hi;
1168*0Sstevel@tonic-gate         while (lo < hi) {
1169*0Sstevel@tonic-gate             mid = (lo + hi) / 2;
1170*0Sstevel@tonic-gate             int cmp = name.concat("@").compareTo(array[mid].concat("@"));
1171*0Sstevel@tonic-gate             if (hi - lo == 1) {
1172*0Sstevel@tonic-gate                 if (cmp > 0)
1173*0Sstevel@tonic-gate                     mid = hi;
1174*0Sstevel@tonic-gate                 break;
1175*0Sstevel@tonic-gate             }
1176*0Sstevel@tonic-gate             if (cmp == 0)
1177*0Sstevel@tonic-gate                 break;
1178*0Sstevel@tonic-gate             if (cmp < 0)
1179*0Sstevel@tonic-gate                 hi = mid;
1180*0Sstevel@tonic-gate             else if (cmp > 0)
1181*0Sstevel@tonic-gate                 lo = mid;
1182*0Sstevel@tonic-gate         }
1183*0Sstevel@tonic-gate         return mid;
1184*0Sstevel@tonic-gate     }
1185*0Sstevel@tonic-gate 
1186*0Sstevel@tonic-gate     private String[] addToList(String[] list, String name) {
1187*0Sstevel@tonic-gate         if (list == null)
1188*0Sstevel@tonic-gate             return null;
1189*0Sstevel@tonic-gate         int index = search(list, name);
1190*0Sstevel@tonic-gate         int rem = list.length - index;
1191*0Sstevel@tonic-gate         String[] newlist = new String[list.length+1];
1192*0Sstevel@tonic-gate         if (index > 0)
1193*0Sstevel@tonic-gate             System.arraycopy(list, 0, newlist, 0, index);
1194*0Sstevel@tonic-gate         newlist[index] = name;
1195*0Sstevel@tonic-gate         if (rem > 0)
1196*0Sstevel@tonic-gate             System.arraycopy(list, index, newlist, index+1, rem);
1197*0Sstevel@tonic-gate         return newlist;
1198*0Sstevel@tonic-gate     }
1199*0Sstevel@tonic-gate 
1200*0Sstevel@tonic-gate     private String[] delFromList(String[] list, String name) {
1201*0Sstevel@tonic-gate         if (list == null)
1202*0Sstevel@tonic-gate             return null;
1203*0Sstevel@tonic-gate         int index = search(list, name);
1204*0Sstevel@tonic-gate         int rem = list.length - index;
1205*0Sstevel@tonic-gate         String[] newlist = new String[list.length-1];
1206*0Sstevel@tonic-gate         if (index > 0)
1207*0Sstevel@tonic-gate             System.arraycopy(list, 0, newlist, 0, index);
1208*0Sstevel@tonic-gate         if (rem > 1)
1209*0Sstevel@tonic-gate             System.arraycopy(list, index+1, newlist, index, rem-1);
1210*0Sstevel@tonic-gate         return newlist;
1211*0Sstevel@tonic-gate     }
1212*0Sstevel@tonic-gate 
1213*0Sstevel@tonic-gate     /**
1214*0Sstevel@tonic-gate      * Collect the policy choice entries
1215*0Sstevel@tonic-gate      *
1216*0Sstevel@tonic-gate      */
1217*0Sstevel@tonic-gate     public void setPolicyChoice() {
1218*0Sstevel@tonic-gate         String[] pols = null;
1219*0Sstevel@tonic-gate         if (!noLists) {
1220*0Sstevel@tonic-gate             PolicyList p = new PolicyList(Kadmin);
1221*0Sstevel@tonic-gate             try {
1222*0Sstevel@tonic-gate                 pols = p.getPolicyList();
1223*0Sstevel@tonic-gate             } catch (Exception e) {
1224*0Sstevel@tonic-gate                 showError(e.getMessage());
1225*0Sstevel@tonic-gate                 return;
1226*0Sstevel@tonic-gate             }
1227*0Sstevel@tonic-gate         }
1228*0Sstevel@tonic-gate         Choice c = (Choice)gui.PrPolicy.getBody();
1229*0Sstevel@tonic-gate         c.removeAll();
1230*0Sstevel@tonic-gate         c.add(getString("(no policy)"));
1231*0Sstevel@tonic-gate         for (int i = 0; pols != null && i < pols.length; i++)
1232*0Sstevel@tonic-gate             c.add(pols[i]);
1233*0Sstevel@tonic-gate     }
1234*0Sstevel@tonic-gate 
1235*0Sstevel@tonic-gate     /**
1236*0Sstevel@tonic-gate      * Look at the principal list to see what's selected
1237*0Sstevel@tonic-gate      *
1238*0Sstevel@tonic-gate      */
1239*0Sstevel@tonic-gate     public void lookAtPrList() {
1240*0Sstevel@tonic-gate         if (noLists)
1241*0Sstevel@tonic-gate             return;
1242*0Sstevel@tonic-gate         TextList list = (TextList) gui.Prlist.getBody();
1243*0Sstevel@tonic-gate         prMulti = null;
1244*0Sstevel@tonic-gate         String[] sel = list.getSelectedItems();
1245*0Sstevel@tonic-gate         if (sel.length == 1) {
1246*0Sstevel@tonic-gate             setCurPrincipal(sel[0]);
1247*0Sstevel@tonic-gate             curPrListPos = list.getSelectedIndex();
1248*0Sstevel@tonic-gate         } else {
1249*0Sstevel@tonic-gate             if (sel.length > 0)
1250*0Sstevel@tonic-gate                 prMulti = sel;
1251*0Sstevel@tonic-gate             setCurPrincipal("");
1252*0Sstevel@tonic-gate         }
1253*0Sstevel@tonic-gate     }
1254*0Sstevel@tonic-gate 
1255*0Sstevel@tonic-gate     private void restorePrListSelection() {
1256*0Sstevel@tonic-gate         if (noLists)
1257*0Sstevel@tonic-gate             return;
1258*0Sstevel@tonic-gate         TextList list = (TextList) gui.Prlist.getBody();
1259*0Sstevel@tonic-gate         list.select(curPrListPos);
1260*0Sstevel@tonic-gate     }
1261*0Sstevel@tonic-gate 
1262*0Sstevel@tonic-gate     /**
1263*0Sstevel@tonic-gate      * When the principal name choice changes, we want to reflect
1264*0Sstevel@tonic-gate      * the name in the other principal tabs.  We can also use this
1265*0Sstevel@tonic-gate      * opportunity to enable/disable buttons.
1266*0Sstevel@tonic-gate      *
1267*0Sstevel@tonic-gate      */
1268*0Sstevel@tonic-gate     public void setCurPrincipal(String name) {
1269*0Sstevel@tonic-gate         CurPrincipal = name;
1270*0Sstevel@tonic-gate         gui.PrName1.set("text" /* NOI18N */, name);
1271*0Sstevel@tonic-gate         gui.PrName2.set("text" /* NOI18N */, name);
1272*0Sstevel@tonic-gate         gui.PrName3.set("text" /* NOI18N */, name);
1273*0Sstevel@tonic-gate         if (name.compareTo("") == 0) {
1274*0Sstevel@tonic-gate             prSelValid(false);
1275*0Sstevel@tonic-gate             return;
1276*0Sstevel@tonic-gate         }
1277*0Sstevel@tonic-gate         prSelValid(true);
1278*0Sstevel@tonic-gate     }
1279*0Sstevel@tonic-gate 
1280*0Sstevel@tonic-gate     /**
1281*0Sstevel@tonic-gate      * Make Modify, Delete and Duplicate buttons react to what is selected.
1282*0Sstevel@tonic-gate      * Privileges:
1283*0Sstevel@tonic-gate      * If we have neither modify or inquire, we keep Modify disabled;
1284*0Sstevel@tonic-gate      * if we have no modify privileges, we permit Modify to see info,
1285*0Sstevel@tonic-gate      * but the principal panel components are disabled in reactToPrivs().
1286*0Sstevel@tonic-gate      * If we have add and inquire privileges, we can permit Duplicate;
1287*0Sstevel@tonic-gate      * no add also means Create New is permanently disabled in reactToPrivs().
1288*0Sstevel@tonic-gate      * If we have no delete privileges, we keep Delete disabled.
1289*0Sstevel@tonic-gate      */
1290*0Sstevel@tonic-gate     public void prSelValid(boolean selected) {
1291*0Sstevel@tonic-gate         prSelValid = selected;
1292*0Sstevel@tonic-gate         Boolean b = new Boolean(selected && (privs & PRIV_INQUIRE) != 0);
1293*0Sstevel@tonic-gate         gui.PrListModify.set("enabled" /* NOI18N */, b);
1294*0Sstevel@tonic-gate         int want = (PRIV_ADD | PRIV_INQUIRE);
1295*0Sstevel@tonic-gate         b = new Boolean(selected && (privs & want) == want);
1296*0Sstevel@tonic-gate         gui.PrListDuplicate.set("enabled" /* NOI18N */, b);
1297*0Sstevel@tonic-gate         b = new Boolean((selected || prMulti != null)
1298*0Sstevel@tonic-gate 			&&(privs & PRIV_DELETE) != 0);
1299*0Sstevel@tonic-gate         gui.PrListDelete.set("enabled" /* NOI18N */, b);
1300*0Sstevel@tonic-gate     }
1301*0Sstevel@tonic-gate 
1302*0Sstevel@tonic-gate     /**
1303*0Sstevel@tonic-gate      * Make the Save button do the right thing.
1304*0Sstevel@tonic-gate      *
1305*0Sstevel@tonic-gate      */
1306*0Sstevel@tonic-gate     public void prSetCanSave(boolean ok) {
1307*0Sstevel@tonic-gate         Boolean b = new Boolean(ok);
1308*0Sstevel@tonic-gate         gui.PrBasicSave.set("enabled" /* NOI18N */, b);
1309*0Sstevel@tonic-gate         gui.PrDetailSave.set("enabled" /* NOI18N */, b);
1310*0Sstevel@tonic-gate         gui.PrFlagsSave.set("enabled" /* NOI18N */, b);
1311*0Sstevel@tonic-gate     }
1312*0Sstevel@tonic-gate 
1313*0Sstevel@tonic-gate     /**
1314*0Sstevel@tonic-gate      * Update status line with current information.
1315*0Sstevel@tonic-gate      *
1316*0Sstevel@tonic-gate      */
1317*0Sstevel@tonic-gate     public void updateStatus() {
1318*0Sstevel@tonic-gate         gui.StatusLine.set("text" /* NOI18N */, ModeString+OpString+SaveString);
1319*0Sstevel@tonic-gate     }
1320*0Sstevel@tonic-gate 
1321*0Sstevel@tonic-gate     /**
1322*0Sstevel@tonic-gate      * This is a way for the data modification actions to note that
1323*0Sstevel@tonic-gate      * the principal has edits outstanding.
1324*0Sstevel@tonic-gate      *
1325*0Sstevel@tonic-gate      */
1326*0Sstevel@tonic-gate     public void prSetNeedSave() {
1327*0Sstevel@tonic-gate         prNeedSave = true;
1328*0Sstevel@tonic-gate         prSetCanSave(true);
1329*0Sstevel@tonic-gate         SaveString = getString("- *CHANGES*");
1330*0Sstevel@tonic-gate         updateStatus();
1331*0Sstevel@tonic-gate     }
1332*0Sstevel@tonic-gate 
1333*0Sstevel@tonic-gate     public boolean prDoSave() {
1334*0Sstevel@tonic-gate 
1335*0Sstevel@tonic-gate         // before attempting to save make sure all text fields are in order
1336*0Sstevel@tonic-gate         if (prUpdateFromGui(!prin.isNew) == false)
1337*0Sstevel@tonic-gate             return false;
1338*0Sstevel@tonic-gate 
1339*0Sstevel@tonic-gate         boolean b = true;
1340*0Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
1341*0Sstevel@tonic-gate         try {
1342*0Sstevel@tonic-gate             b = prin.savePrincipal();
1343*0Sstevel@tonic-gate         } catch (Exception e) {
1344*0Sstevel@tonic-gate             b = false;
1345*0Sstevel@tonic-gate             showError(e.getMessage());
1346*0Sstevel@tonic-gate         }
1347*0Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
1348*0Sstevel@tonic-gate         if (!b)
1349*0Sstevel@tonic-gate             return false;
1350*0Sstevel@tonic-gate         if (prin.isNew) {
1351*0Sstevel@tonic-gate             principalList = addToList(principalList, prin.PrName);
1352*0Sstevel@tonic-gate             refreshPrincipalList();
1353*0Sstevel@tonic-gate             selectPrincipal(prin.PrName);
1354*0Sstevel@tonic-gate         }
1355*0Sstevel@tonic-gate         prin.isNew = false;
1356*0Sstevel@tonic-gate         gui.PrPassword.set("text" /* NOI18N */, "");
1357*0Sstevel@tonic-gate         prin.setPassword("");
1358*0Sstevel@tonic-gate         prSetEditable(false);
1359*0Sstevel@tonic-gate         prSetCanSave(false);
1360*0Sstevel@tonic-gate         prNeedSave = false;
1361*0Sstevel@tonic-gate         SaveString = "";
1362*0Sstevel@tonic-gate         updateStatus();
1363*0Sstevel@tonic-gate         return true;
1364*0Sstevel@tonic-gate     }
1365*0Sstevel@tonic-gate 
1366*0Sstevel@tonic-gate     /**
1367*0Sstevel@tonic-gate      * React to a choice from the principal list via double-click or
1368*0Sstevel@tonic-gate      * single-click+Modify; we want to go to the next tab in each case.
1369*0Sstevel@tonic-gate      * If we don't have modify privileges, we need to simply show values.
1370*0Sstevel@tonic-gate      */
1371*0Sstevel@tonic-gate     public void prModify() {
1372*0Sstevel@tonic-gate         enablePrincipalPrinting();
1373*0Sstevel@tonic-gate         if (!prNeedSave) {
1374*0Sstevel@tonic-gate             prSetEditable(false);
1375*0Sstevel@tonic-gate             prSetCanSave(false);
1376*0Sstevel@tonic-gate         }
1377*0Sstevel@tonic-gate         if (noLists)
1378*0Sstevel@tonic-gate             CurPrincipal = (String)gui.PrListPattern.get("text" /* NOI18N */);
1379*0Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
1380*0Sstevel@tonic-gate         enablePrAttributes(new Boolean((privs & (PRIV_ADD|PRIV_MODIFY)) != 0));
1381*0Sstevel@tonic-gate         Boolean b = new Boolean((privs & PRIV_CHANGEPW) != 0);
1382*0Sstevel@tonic-gate         gui.PrPassword.set("enabled" /* NOI18N */, b);
1383*0Sstevel@tonic-gate         gui.PrBasicRandomPw.set("enabled" /* NOI18N */, b);
1384*0Sstevel@tonic-gate         try {
1385*0Sstevel@tonic-gate             prin = new Principal(Kadmin, CurPrincipal);
1386*0Sstevel@tonic-gate         } catch (Exception e) {
1387*0Sstevel@tonic-gate             showError(e.getMessage());
1388*0Sstevel@tonic-gate             realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
1389*0Sstevel@tonic-gate             return;
1390*0Sstevel@tonic-gate         }
1391*0Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
1392*0Sstevel@tonic-gate         showPrincipal(prin);
1393*0Sstevel@tonic-gate         String policy = (String)gui.PrPolicy.get("selectedItem" /* NOI18N */);
1394*0Sstevel@tonic-gate         if (policy.compareTo(getString("(no policy)")) == 0)
1395*0Sstevel@tonic-gate             policy = "";
1396*0Sstevel@tonic-gate         else
1397*0Sstevel@tonic-gate             setDefaultPolicy(policy);
1398*0Sstevel@tonic-gate         ModeString = getString("Modify")+" ";
1399*0Sstevel@tonic-gate         OpString = getString("Principal");
1400*0Sstevel@tonic-gate         updateStatus();
1401*0Sstevel@tonic-gate         gui.cardpanel1.show("Basics" /* NOI18N */);
1402*0Sstevel@tonic-gate     }
1403*0Sstevel@tonic-gate 
1404*0Sstevel@tonic-gate     /**
1405*0Sstevel@tonic-gate      * React to add principal button
1406*0Sstevel@tonic-gate      * If we got here, we need to enable attributes since we have privs.
1407*0Sstevel@tonic-gate      */
1408*0Sstevel@tonic-gate     public void prAdd() {
1409*0Sstevel@tonic-gate         enablePrincipalPrinting();
1410*0Sstevel@tonic-gate         setCurPrincipal("");
1411*0Sstevel@tonic-gate         prSelValid = true;
1412*0Sstevel@tonic-gate         prSetEditable(true);
1413*0Sstevel@tonic-gate         prSetNeedSave();
1414*0Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
1415*0Sstevel@tonic-gate         Boolean b = new Boolean(true);
1416*0Sstevel@tonic-gate         enablePrAttributes(b);
1417*0Sstevel@tonic-gate         gui.PrPassword.set("enabled" /* NOI18N */, b);
1418*0Sstevel@tonic-gate         gui.PrBasicRandomPw.set("enabled" /* NOI18N */, b);
1419*0Sstevel@tonic-gate         try {
1420*0Sstevel@tonic-gate             prin = new Principal(Kadmin, defaults);
1421*0Sstevel@tonic-gate         } catch (Exception e) {
1422*0Sstevel@tonic-gate             showError(e.getMessage());
1423*0Sstevel@tonic-gate             realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
1424*0Sstevel@tonic-gate             return;
1425*0Sstevel@tonic-gate         }
1426*0Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
1427*0Sstevel@tonic-gate         showPrincipal(prin);
1428*0Sstevel@tonic-gate         ModeString = getString("Create New")+" ";
1429*0Sstevel@tonic-gate         OpString = getString("Principal");
1430*0Sstevel@tonic-gate         updateStatus();
1431*0Sstevel@tonic-gate         gui.cardpanel1.show("Basics" /* NOI18N */);
1432*0Sstevel@tonic-gate         ((TextField)gui.PrName1.getBody()).requestFocus();
1433*0Sstevel@tonic-gate     }
1434*0Sstevel@tonic-gate 
1435*0Sstevel@tonic-gate     /**
1436*0Sstevel@tonic-gate      * React to duplicate principal button
1437*0Sstevel@tonic-gate      *
1438*0Sstevel@tonic-gate      */
1439*0Sstevel@tonic-gate     public void prDuplicate() {
1440*0Sstevel@tonic-gate         enablePrincipalPrinting();
1441*0Sstevel@tonic-gate         if (noLists)
1442*0Sstevel@tonic-gate             CurPrincipal = (String)gui.PrListPattern.get("text" /* NOI18N */);
1443*0Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
1444*0Sstevel@tonic-gate         try {
1445*0Sstevel@tonic-gate             prin = new Principal(Kadmin, CurPrincipal);
1446*0Sstevel@tonic-gate         } catch (Exception e) {
1447*0Sstevel@tonic-gate             showError(e.getMessage());
1448*0Sstevel@tonic-gate             realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
1449*0Sstevel@tonic-gate             return;
1450*0Sstevel@tonic-gate         }
1451*0Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
1452*0Sstevel@tonic-gate         setCurPrincipal("");
1453*0Sstevel@tonic-gate         prSelValid = true;
1454*0Sstevel@tonic-gate         prSetEditable(true);
1455*0Sstevel@tonic-gate         prSetNeedSave();
1456*0Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
1457*0Sstevel@tonic-gate         Boolean b = new Boolean(true);
1458*0Sstevel@tonic-gate         enablePrAttributes(b);
1459*0Sstevel@tonic-gate         gui.PrPassword.set("enabled" /* NOI18N */, b);
1460*0Sstevel@tonic-gate         gui.PrBasicRandomPw.set("enabled" /* NOI18N */, b);
1461*0Sstevel@tonic-gate         try {
1462*0Sstevel@tonic-gate             prin = new Principal(Kadmin, prin);
1463*0Sstevel@tonic-gate         } catch (Exception e) {
1464*0Sstevel@tonic-gate             showError(e.getMessage());
1465*0Sstevel@tonic-gate             realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
1466*0Sstevel@tonic-gate             return;
1467*0Sstevel@tonic-gate         }
1468*0Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
1469*0Sstevel@tonic-gate         prin.PrName = "";
1470*0Sstevel@tonic-gate         showPrincipal(prin);
1471*0Sstevel@tonic-gate         ModeString = getString("Duplicate")+" ";
1472*0Sstevel@tonic-gate         OpString = getString("Principal");
1473*0Sstevel@tonic-gate         updateStatus();
1474*0Sstevel@tonic-gate         gui.cardpanel1.show("Basics" /* NOI18N */);
1475*0Sstevel@tonic-gate         ((TextField)gui.PrName1.getBody()).requestFocus();
1476*0Sstevel@tonic-gate     }
1477*0Sstevel@tonic-gate 
1478*0Sstevel@tonic-gate     /**
1479*0Sstevel@tonic-gate      * React to delete principal button
1480*0Sstevel@tonic-gate      */
1481*0Sstevel@tonic-gate     public void prDelete() {
1482*0Sstevel@tonic-gate         String text[] = {getString("You are about to destroy data."),
1483*0Sstevel@tonic-gate 			 getString("Click OK to proceed or"
1484*0Sstevel@tonic-gate 				   +" Cancel to continue editing.")};
1485*0Sstevel@tonic-gate         String resp = confirmAction(realMainFrame, text);
1486*0Sstevel@tonic-gate         if (resp.equals(getString("Cancel")))
1487*0Sstevel@tonic-gate             return;
1488*0Sstevel@tonic-gate         if (noLists)
1489*0Sstevel@tonic-gate             CurPrincipal = (String)gui.PrListPattern.get("text" /* NOI18N */);
1490*0Sstevel@tonic-gate         boolean b = false;
1491*0Sstevel@tonic-gate         try {
1492*0Sstevel@tonic-gate             b = Kadmin.deletePrincipal(CurPrincipal);
1493*0Sstevel@tonic-gate         } catch (Exception e) {
1494*0Sstevel@tonic-gate             showError(e.getMessage());
1495*0Sstevel@tonic-gate             return;
1496*0Sstevel@tonic-gate         }
1497*0Sstevel@tonic-gate         if (!b)
1498*0Sstevel@tonic-gate             return;
1499*0Sstevel@tonic-gate         principalList = delFromList(principalList, CurPrincipal);
1500*0Sstevel@tonic-gate         refreshPrincipalList();
1501*0Sstevel@tonic-gate         setCurPrincipal("");
1502*0Sstevel@tonic-gate         prSelValid = true;
1503*0Sstevel@tonic-gate         prSetEditable(true);
1504*0Sstevel@tonic-gate         if (curPrListPos == ((TextList)gui.Prlist.getBody()).countItems())
1505*0Sstevel@tonic-gate             curPrListPos--;
1506*0Sstevel@tonic-gate         showPrincipalList(curPrPattern);
1507*0Sstevel@tonic-gate     }
1508*0Sstevel@tonic-gate 
1509*0Sstevel@tonic-gate     /**
1510*0Sstevel@tonic-gate      * React to Previous button on basic screen
1511*0Sstevel@tonic-gate      *
1512*0Sstevel@tonic-gate      */
1513*0Sstevel@tonic-gate     public void prBasicPrevious() {
1514*0Sstevel@tonic-gate         prCancel();
1515*0Sstevel@tonic-gate     }
1516*0Sstevel@tonic-gate 
1517*0Sstevel@tonic-gate     /**
1518*0Sstevel@tonic-gate      * React to Next button on basic screen. If some changes were made
1519*0Sstevel@tonic-gate      * then check to see if they contain a parse error. If so, do
1520*0Sstevel@tonic-gate      * nothing. The method that checks for error messages also displays
1521*0Sstevel@tonic-gate      * the error message.
1522*0Sstevel@tonic-gate      *
1523*0Sstevel@tonic-gate      */
1524*0Sstevel@tonic-gate     public void prBasicNext() {
1525*0Sstevel@tonic-gate         if (prNeedSave)
1526*0Sstevel@tonic-gate             if (!prUpdateFromGui(!prin.isNew))
1527*0Sstevel@tonic-gate 		return;
1528*0Sstevel@tonic-gate 
1529*0Sstevel@tonic-gate         updateStatus();
1530*0Sstevel@tonic-gate         gui.cardpanel1.show("Details" /* NOI18N */);
1531*0Sstevel@tonic-gate     }
1532*0Sstevel@tonic-gate 
1533*0Sstevel@tonic-gate     /**
1534*0Sstevel@tonic-gate      * React to Previous button on detail screen. If some changes were made
1535*0Sstevel@tonic-gate      * then check to see if they contain a parse error. If so, do
1536*0Sstevel@tonic-gate      * nothing. The method that checks for error messages also displays
1537*0Sstevel@tonic-gate      * the error message.
1538*0Sstevel@tonic-gate      */
1539*0Sstevel@tonic-gate     public void prDetailPrevious() {
1540*0Sstevel@tonic-gate         if (prNeedSave)
1541*0Sstevel@tonic-gate             if (!prUpdateFromGui(!prin.isNew))
1542*0Sstevel@tonic-gate 		return;
1543*0Sstevel@tonic-gate 
1544*0Sstevel@tonic-gate         updateStatus();
1545*0Sstevel@tonic-gate         gui.cardpanel1.show("Basics" /* NOI18N */);
1546*0Sstevel@tonic-gate     }
1547*0Sstevel@tonic-gate 
1548*0Sstevel@tonic-gate     /**
1549*0Sstevel@tonic-gate      * React to Next button on detail screen. If some changes were made
1550*0Sstevel@tonic-gate      * then check to see if they contain a parse error. If so, do
1551*0Sstevel@tonic-gate      * nothing. The method that checks for error messages also displays
1552*0Sstevel@tonic-gate      * the error message.
1553*0Sstevel@tonic-gate      *
1554*0Sstevel@tonic-gate      */
1555*0Sstevel@tonic-gate     public void prDetailNext() {
1556*0Sstevel@tonic-gate         if (prNeedSave)
1557*0Sstevel@tonic-gate             if (!prUpdateFromGui(!prin.isNew))
1558*0Sstevel@tonic-gate 		return;
1559*0Sstevel@tonic-gate 
1560*0Sstevel@tonic-gate         updateStatus();
1561*0Sstevel@tonic-gate         gui.cardpanel1.show("Flags" /* NOI18N */);
1562*0Sstevel@tonic-gate     }
1563*0Sstevel@tonic-gate 
1564*0Sstevel@tonic-gate     /**
1565*0Sstevel@tonic-gate      * React to Previous button on flags screen
1566*0Sstevel@tonic-gate      *
1567*0Sstevel@tonic-gate      */
1568*0Sstevel@tonic-gate     public void prFlagsPrevious() {
1569*0Sstevel@tonic-gate         updateStatus();
1570*0Sstevel@tonic-gate         gui.cardpanel1.show("Details" /* NOI18N */);
1571*0Sstevel@tonic-gate     }
1572*0Sstevel@tonic-gate 
1573*0Sstevel@tonic-gate     /**
1574*0Sstevel@tonic-gate      * React to Done button on flags screen. If any changes were made to
1575*0Sstevel@tonic-gate      * the principal, then try to save them. If the save fails for any
1576*0Sstevel@tonic-gate      * reason, do not return to the principal list.
1577*0Sstevel@tonic-gate      *
1578*0Sstevel@tonic-gate      */
1579*0Sstevel@tonic-gate     public void prFlagsDone() {
1580*0Sstevel@tonic-gate         if (prNeedSave && prDoSave() == false)
1581*0Sstevel@tonic-gate             return;
1582*0Sstevel@tonic-gate         showPrincipalList(curPrPattern);
1583*0Sstevel@tonic-gate     }
1584*0Sstevel@tonic-gate 
1585*0Sstevel@tonic-gate     /**
1586*0Sstevel@tonic-gate      * React to save principal button
1587*0Sstevel@tonic-gate      *
1588*0Sstevel@tonic-gate      */
1589*0Sstevel@tonic-gate     public void prSave() {
1590*0Sstevel@tonic-gate         prDoSave();
1591*0Sstevel@tonic-gate     }
1592*0Sstevel@tonic-gate 
1593*0Sstevel@tonic-gate     /**
1594*0Sstevel@tonic-gate      * React to cancel principal button
1595*0Sstevel@tonic-gate      *
1596*0Sstevel@tonic-gate      */
1597*0Sstevel@tonic-gate     public void prCancel() {
1598*0Sstevel@tonic-gate         if (prNeedSave) {
1599*0Sstevel@tonic-gate             String text[] = {getString("You are about to lose changes."),
1600*0Sstevel@tonic-gate 			     getString("Click Save to commit changes, "
1601*0Sstevel@tonic-gate 				       +"Discard to discard changes, "
1602*0Sstevel@tonic-gate 				       +"or Cancel to continue editing.")};
1603*0Sstevel@tonic-gate             String resp = confirmSave(realMainFrame, text);
1604*0Sstevel@tonic-gate             if (resp.equals(getString("Cancel")))
1605*0Sstevel@tonic-gate                 return;
1606*0Sstevel@tonic-gate             if (resp.equals(getString("Save")))
1607*0Sstevel@tonic-gate                 if (!prDoSave())
1608*0Sstevel@tonic-gate 		    return;
1609*0Sstevel@tonic-gate         }
1610*0Sstevel@tonic-gate         prSetEditable(false);
1611*0Sstevel@tonic-gate         prSetCanSave(false);
1612*0Sstevel@tonic-gate         prNeedSave = false;
1613*0Sstevel@tonic-gate         lookAtPrList();
1614*0Sstevel@tonic-gate         SaveString = "";
1615*0Sstevel@tonic-gate         showPrincipalList(curPrPattern);
1616*0Sstevel@tonic-gate     }
1617*0Sstevel@tonic-gate 
1618*0Sstevel@tonic-gate     /*
1619*0Sstevel@tonic-gate      * Methods for the principal attribute panels
1620*0Sstevel@tonic-gate      */
1621*0Sstevel@tonic-gate 
1622*0Sstevel@tonic-gate     public boolean setPrName1() {
1623*0Sstevel@tonic-gate         if (!prnameEditable)
1624*0Sstevel@tonic-gate             return true;
1625*0Sstevel@tonic-gate 
1626*0Sstevel@tonic-gate         String p = ((String)gui.PrName1.get("text" /* NOI18N */)).trim();
1627*0Sstevel@tonic-gate         if (p.compareTo("") == 0) {
1628*0Sstevel@tonic-gate             showError(getString("Please enter a principal name or cancel"));
1629*0Sstevel@tonic-gate             ((TextField)gui.PrName1.getBody()).requestFocus();
1630*0Sstevel@tonic-gate             return false;
1631*0Sstevel@tonic-gate         }
1632*0Sstevel@tonic-gate         // visually delete any white space that was at the start or end
1633*0Sstevel@tonic-gate         // by resetting the field to the trimmmed String.
1634*0Sstevel@tonic-gate         gui.PrName1.set("text" /* NOI18N */, p);
1635*0Sstevel@tonic-gate         setCurPrincipal(p);
1636*0Sstevel@tonic-gate         prin.setName(p);
1637*0Sstevel@tonic-gate         return true;
1638*0Sstevel@tonic-gate     }
1639*0Sstevel@tonic-gate 
1640*0Sstevel@tonic-gate     public boolean setPrComments() {
1641*0Sstevel@tonic-gate         prin.setComments((String)gui.PrComments.get("text" /* NOI18N */));
1642*0Sstevel@tonic-gate         return true;
1643*0Sstevel@tonic-gate     }
1644*0Sstevel@tonic-gate 
1645*0Sstevel@tonic-gate     public boolean setPrExpiry() {
1646*0Sstevel@tonic-gate         if (prin.setExpiry((String)gui.PrExpiry.get("text" /* NOI18N */))) {
1647*0Sstevel@tonic-gate             // visually delete any extraneous data that was ignored in the
1648*0Sstevel@tonic-gate             // parsing by resetting the gui data
1649*0Sstevel@tonic-gate             gui.PrExpiry.set("text" /* NOI18N */,  prin.getExpiry());
1650*0Sstevel@tonic-gate             return true;
1651*0Sstevel@tonic-gate         } else {
1652*0Sstevel@tonic-gate             showDataFormatError(((TextField)gui.PrExpiry.getBody()),
1653*0Sstevel@tonic-gate 				DATE_DATA);
1654*0Sstevel@tonic-gate             return false;
1655*0Sstevel@tonic-gate         }
1656*0Sstevel@tonic-gate     }
1657*0Sstevel@tonic-gate 
1658*0Sstevel@tonic-gate     public boolean setPrPassword(boolean nullOK) {
1659*0Sstevel@tonic-gate         String p = (String)gui.PrPassword.get("text" /* NOI18N */);
1660*0Sstevel@tonic-gate         if (p.compareTo("") == 0) {
1661*0Sstevel@tonic-gate             if (!nullOK) {
1662*0Sstevel@tonic-gate                 showError(getString("Please enter a password or cancel"));
1663*0Sstevel@tonic-gate                 ((TextField)gui.PrPassword.getBody()).requestFocus();
1664*0Sstevel@tonic-gate                 return false;
1665*0Sstevel@tonic-gate             } else return true;
1666*0Sstevel@tonic-gate 	}
1667*0Sstevel@tonic-gate 
1668*0Sstevel@tonic-gate         prin.setPassword(p);
1669*0Sstevel@tonic-gate         return true;
1670*0Sstevel@tonic-gate     }
1671*0Sstevel@tonic-gate 
1672*0Sstevel@tonic-gate     public void genRandomPassword() {
1673*0Sstevel@tonic-gate         int n, count = 0;
1674*0Sstevel@tonic-gate         byte[] buf = new byte[20];
1675*0Sstevel@tonic-gate         byte b;
1676*0Sstevel@tonic-gate         Random r = new Random();
1677*0Sstevel@tonic-gate         String passlist = "abcdefghijklmnopqrstuvwxyz1234567890!#$%&*+@"
1678*0Sstevel@tonic-gate 	    /* NOI18N */;
1679*0Sstevel@tonic-gate 
1680*0Sstevel@tonic-gate         gui.PrPassword.set("text" /* NOI18N */, "");
1681*0Sstevel@tonic-gate         while (count < 10) {
1682*0Sstevel@tonic-gate             n = r.nextInt() & 0x7F;
1683*0Sstevel@tonic-gate             b = (byte)n;
1684*0Sstevel@tonic-gate             if (passlist.indexOf(b) == -1)
1685*0Sstevel@tonic-gate                 continue;
1686*0Sstevel@tonic-gate             buf[count++] = b;
1687*0Sstevel@tonic-gate         }
1688*0Sstevel@tonic-gate         buf[count] = 0;
1689*0Sstevel@tonic-gate         CurPass = new String(buf);
1690*0Sstevel@tonic-gate         gui.PrPassword.set("text" /* NOI18N */, CurPass);
1691*0Sstevel@tonic-gate         prin.setPassword((String)gui.PrPassword.get("text" /* NOI18N */));
1692*0Sstevel@tonic-gate     }
1693*0Sstevel@tonic-gate 
1694*0Sstevel@tonic-gate     public void setPrPolicy() {
1695*0Sstevel@tonic-gate         if (prin == null)
1696*0Sstevel@tonic-gate                 return;
1697*0Sstevel@tonic-gate         String policy = (String)gui.PrPolicy.get("selectedItem" /* NOI18N */);
1698*0Sstevel@tonic-gate         if (policy.compareTo(getString("(no policy)")) == 0)
1699*0Sstevel@tonic-gate             policy = "";
1700*0Sstevel@tonic-gate         try {
1701*0Sstevel@tonic-gate                 prin.setPolicy(policy);
1702*0Sstevel@tonic-gate         } catch (Exception e) {};
1703*0Sstevel@tonic-gate         setDefaultPolicy(policy);
1704*0Sstevel@tonic-gate     }
1705*0Sstevel@tonic-gate 
1706*0Sstevel@tonic-gate     public boolean setPrMaxlife() {
1707*0Sstevel@tonic-gate         if (prin.setMaxlife((String)gui.PrMaxLifetime.get("text"
1708*0Sstevel@tonic-gate 							  /* NOI18N */))) {
1709*0Sstevel@tonic-gate             // visually delete any extraneous data that was ignored in the
1710*0Sstevel@tonic-gate             // parsing by resetting the gui data
1711*0Sstevel@tonic-gate             gui.PrMaxLifetime.set("text" /* NOI18N */, prin.getMaxLife());
1712*0Sstevel@tonic-gate             return true;
1713*0Sstevel@tonic-gate         } else {
1714*0Sstevel@tonic-gate             showDataFormatError(((TextField)gui.PrMaxLifetime.getBody()),
1715*0Sstevel@tonic-gate 				DURATION_DATA);
1716*0Sstevel@tonic-gate             return false;
1717*0Sstevel@tonic-gate         }
1718*0Sstevel@tonic-gate     }
1719*0Sstevel@tonic-gate 
1720*0Sstevel@tonic-gate     public boolean setPrMaxrenew() {
1721*0Sstevel@tonic-gate         if (prin.setMaxrenew((String)gui.PrMaxRenewal.get(
1722*0Sstevel@tonic-gate 						  "text" /* NOI18N */))) {
1723*0Sstevel@tonic-gate             // visually delete any extraneous data that was ignored in the
1724*0Sstevel@tonic-gate             // parsing  by resetting the gui data
1725*0Sstevel@tonic-gate             gui.PrMaxRenewal.set("text" /* NOI18N */, prin.getMaxRenew());
1726*0Sstevel@tonic-gate             return true;
1727*0Sstevel@tonic-gate         } else {
1728*0Sstevel@tonic-gate             showDataFormatError(((TextField)gui.PrMaxRenewal.getBody()),
1729*0Sstevel@tonic-gate 				DURATION_DATA);
1730*0Sstevel@tonic-gate             return false;
1731*0Sstevel@tonic-gate         }
1732*0Sstevel@tonic-gate     }
1733*0Sstevel@tonic-gate 
1734*0Sstevel@tonic-gate     public boolean setPrKvno() {
1735*0Sstevel@tonic-gate         if (prin.setKvno((String)gui.PrKvno.get("text" /* NOI18N */))) {
1736*0Sstevel@tonic-gate             // visually delete any extraneous data that was ignored in the
1737*0Sstevel@tonic-gate             // parsing by resetting the gui data
1738*0Sstevel@tonic-gate             gui.PrKvno.set("text" /* NOI18N */, nf.format(prin.Kvno));
1739*0Sstevel@tonic-gate             return true;
1740*0Sstevel@tonic-gate         } else {
1741*0Sstevel@tonic-gate             showDataFormatError(((TextField)gui.PrKvno.getBody()), NUMBER_DATA);
1742*0Sstevel@tonic-gate             return false;
1743*0Sstevel@tonic-gate         }
1744*0Sstevel@tonic-gate     }
1745*0Sstevel@tonic-gate 
1746*0Sstevel@tonic-gate     public boolean setPrPwExpiry() {
1747*0Sstevel@tonic-gate         if (prin.setPwExpiry((String)gui.PrPwExpiry.get("text" /* NOI18N */))) {
1748*0Sstevel@tonic-gate             // visually delete any extraneous data that was ignored in the
1749*0Sstevel@tonic-gate             // parsing by resetting the gui data
1750*0Sstevel@tonic-gate             gui.PrPwExpiry.set("text" /* NOI18N */, prin.getPwExpireTime());
1751*0Sstevel@tonic-gate             return true;
1752*0Sstevel@tonic-gate         } else {
1753*0Sstevel@tonic-gate             showDataFormatError(((TextField)gui.PrPwExpiry.getBody()),
1754*0Sstevel@tonic-gate 				DATE_DATA);
1755*0Sstevel@tonic-gate             return false;
1756*0Sstevel@tonic-gate         }
1757*0Sstevel@tonic-gate     }
1758*0Sstevel@tonic-gate 
1759*0Sstevel@tonic-gate     public void setPrFlag(int bitmask) {
1760*0Sstevel@tonic-gate         prin.flags.toggleFlags(bitmask);
1761*0Sstevel@tonic-gate     }
1762*0Sstevel@tonic-gate 
1763*0Sstevel@tonic-gate     /**
1764*0Sstevel@tonic-gate      * Update components to reflect data in this principal
1765*0Sstevel@tonic-gate      *
1766*0Sstevel@tonic-gate      */
1767*0Sstevel@tonic-gate     public void showPrincipal(Principal p) {
1768*0Sstevel@tonic-gate 
1769*0Sstevel@tonic-gate         gui.PrName1.set("text" /* NOI18N */, p.PrName);
1770*0Sstevel@tonic-gate         gui.PrName2.set("text" /* NOI18N */, p.PrName);
1771*0Sstevel@tonic-gate         gui.PrName3.set("text" /* NOI18N */, p.PrName);
1772*0Sstevel@tonic-gate         gui.PrComments.set("text" /* NOI18N */, p.Comments);
1773*0Sstevel@tonic-gate         String policy = p.Policy;
1774*0Sstevel@tonic-gate         if (policy.compareTo("") == 0)
1775*0Sstevel@tonic-gate             policy = getString("(no policy)");
1776*0Sstevel@tonic-gate         gui.PrPolicy.set("selectedItem" /* NOI18N */, policy);
1777*0Sstevel@tonic-gate         gui.PrPassword.set("text" /* NOI18N */, "");
1778*0Sstevel@tonic-gate 
1779*0Sstevel@tonic-gate         gui.PrLastChangedTime.set("text" /* NOI18N */, p.getModTime());
1780*0Sstevel@tonic-gate         gui.PrLastChangedBy.set("text" /* NOI18N */,   p.ModName);
1781*0Sstevel@tonic-gate         gui.PrExpiry.set("text" /* NOI18N */,          p.getExpiry());
1782*0Sstevel@tonic-gate         gui.PrLastSuccess.set("text" /* NOI18N */,     p.getLastSuccess());
1783*0Sstevel@tonic-gate         gui.PrLastFailure.set("text" /* NOI18N */,     p.getLastFailure());
1784*0Sstevel@tonic-gate         gui.PrFailCount.set("text" /* NOI18N */, nf.format(p.NumFailures));
1785*0Sstevel@tonic-gate         gui.PrLastPwChange.set("text" /* NOI18N */,    p.getLastPwChange());
1786*0Sstevel@tonic-gate         gui.PrPwExpiry.set("text" /* NOI18N */,        p.getPwExpireTime());
1787*0Sstevel@tonic-gate         gui.PrKvno.set("text" /* NOI18N */, nf.format(p.Kvno));
1788*0Sstevel@tonic-gate         gui.PrMaxLifetime.set("text" /* NOI18N */, p.getMaxLife());
1789*0Sstevel@tonic-gate         gui.PrMaxRenewal.set("text" /* NOI18N */, p.getMaxRenew());
1790*0Sstevel@tonic-gate 
1791*0Sstevel@tonic-gate         gui.PrLockAcct.set("state" /* NOI18N */,
1792*0Sstevel@tonic-gate 		   new Boolean(p.flags.getFlag(Flags.DISALLOW_ALL_TIX)));
1793*0Sstevel@tonic-gate         gui.PrForcePwChange.set("state" /* NOI18N */,
1794*0Sstevel@tonic-gate 			new Boolean(p.flags.getFlag(Flags.REQUIRES_PWCHANGE)));
1795*0Sstevel@tonic-gate         gui.PrAllowPostdated.set("state" /* NOI18N */,
1796*0Sstevel@tonic-gate 		 new Boolean(!p.flags.getFlag(Flags.DISALLOW_POSTDATED)));
1797*0Sstevel@tonic-gate         gui.PrAllowForwardable.set("state" /* NOI18N */,
1798*0Sstevel@tonic-gate 		   new Boolean(!p.flags.getFlag(Flags.DISALLOW_FORWARDABLE)));
1799*0Sstevel@tonic-gate         gui.PrAllowRenewable.set("state" /* NOI18N */,
1800*0Sstevel@tonic-gate 		 new Boolean(!p.flags.getFlag(Flags.DISALLOW_RENEWABLE)));
1801*0Sstevel@tonic-gate         gui.PrAllowProxiable.set("state" /* NOI18N */,
1802*0Sstevel@tonic-gate 		 new Boolean(!p.flags.getFlag(Flags.DISALLOW_PROXIABLE)));
1803*0Sstevel@tonic-gate         gui.PrAllowSvr.set("state" /* NOI18N */,
1804*0Sstevel@tonic-gate 			   new Boolean(!p.flags.getFlag(Flags.DISALLOW_SVR)));
1805*0Sstevel@tonic-gate         gui.PrAllowTGT.set("state" /* NOI18N */,
1806*0Sstevel@tonic-gate 		   new Boolean(!p.flags.getFlag(Flags.DISALLOW_TGT_BASED)));
1807*0Sstevel@tonic-gate         gui.PrAllowDupAuth.set("state" /* NOI18N */,
1808*0Sstevel@tonic-gate 		       new Boolean(!p.flags.getFlag(Flags.DISALLOW_DUP_SKEY)));
1809*0Sstevel@tonic-gate         gui.PrRequirePreAuth.set("state" /* NOI18N */,
1810*0Sstevel@tonic-gate 			 new Boolean(p.flags.getFlag(Flags.REQUIRE_PRE_AUTH)));
1811*0Sstevel@tonic-gate         gui.PrRequireHwPreAuth.set("state" /* NOI18N */,
1812*0Sstevel@tonic-gate 			   new Boolean(p.flags.getFlag(Flags.REQUIRE_HW_AUTH)));
1813*0Sstevel@tonic-gate     }
1814*0Sstevel@tonic-gate 
1815*0Sstevel@tonic-gate     /**
1816*0Sstevel@tonic-gate      * Format a time duration for printing, using I18N formats
1817*0Sstevel@tonic-gate      *
1818*0Sstevel@tonic-gate      */
1819*0Sstevel@tonic-gate     public String showDuration(Integer seconds) {
1820*0Sstevel@tonic-gate         return nf.format(seconds.longValue());
1821*0Sstevel@tonic-gate     }
1822*0Sstevel@tonic-gate 
1823*0Sstevel@tonic-gate     /*
1824*0Sstevel@tonic-gate      * Methods for the policy list panel
1825*0Sstevel@tonic-gate      */
1826*0Sstevel@tonic-gate 
1827*0Sstevel@tonic-gate     /**
1828*0Sstevel@tonic-gate      * Update all policy text fields from gui.
1829*0Sstevel@tonic-gate      * Check to see if anyone of them had a parse error.
1830*0Sstevel@tonic-gate      * @returns true if all is ok,  false if an error occurs
1831*0Sstevel@tonic-gate      */
1832*0Sstevel@tonic-gate     // Quits as soon as the first error is detected. The method that
1833*0Sstevel@tonic-gate     // detects the error also shows a dialog box with a message.
1834*0Sstevel@tonic-gate     public boolean poUpdateFromGui() {
1835*0Sstevel@tonic-gate         return (setPolName() && setPolMinlife() && setPolMaxlife());
1836*0Sstevel@tonic-gate     }
1837*0Sstevel@tonic-gate 
1838*0Sstevel@tonic-gate     /**
1839*0Sstevel@tonic-gate      * If we have edited a principal, select their policy by default
1840*0Sstevel@tonic-gate      *
1841*0Sstevel@tonic-gate      */
1842*0Sstevel@tonic-gate     public void setDefaultPolicy(String name) {
1843*0Sstevel@tonic-gate         setCurPolicy(name);
1844*0Sstevel@tonic-gate         fillPolicyList("");
1845*0Sstevel@tonic-gate         TextList l = (TextList)gui.Pollist.getBody();
1846*0Sstevel@tonic-gate         int itemcount = l.countItems();
1847*0Sstevel@tonic-gate         for (int i = 0; i < itemcount; i++)
1848*0Sstevel@tonic-gate             if (l.getItem(i).compareTo(name) == 0) {
1849*0Sstevel@tonic-gate 		curPoListPos = i;
1850*0Sstevel@tonic-gate 		break;
1851*0Sstevel@tonic-gate 	    }
1852*0Sstevel@tonic-gate     }
1853*0Sstevel@tonic-gate 
1854*0Sstevel@tonic-gate     /**
1855*0Sstevel@tonic-gate      * Is the policy name field editable?
1856*0Sstevel@tonic-gate      *
1857*0Sstevel@tonic-gate      */
1858*0Sstevel@tonic-gate     public void poSetEditable(boolean editable) {
1859*0Sstevel@tonic-gate         ponameEditable = editable;
1860*0Sstevel@tonic-gate         Boolean b = new Boolean(editable);
1861*0Sstevel@tonic-gate         gui.PoName.set("editable" /* NOI18N */, b);
1862*0Sstevel@tonic-gate     }
1863*0Sstevel@tonic-gate 
1864*0Sstevel@tonic-gate     /**
1865*0Sstevel@tonic-gate      * React to a change in the policy list pattern
1866*0Sstevel@tonic-gate      *
1867*0Sstevel@tonic-gate      */
1868*0Sstevel@tonic-gate     public void poPatternComplete() {
1869*0Sstevel@tonic-gate         curPoListPos = 0;
1870*0Sstevel@tonic-gate         String pattern = (String)gui.PoListPattern.get("text" /* NOI18N */);
1871*0Sstevel@tonic-gate         if (!noLists)
1872*0Sstevel@tonic-gate             showPolicyList(pattern);
1873*0Sstevel@tonic-gate         else
1874*0Sstevel@tonic-gate             setCurPolicy(pattern);
1875*0Sstevel@tonic-gate     }
1876*0Sstevel@tonic-gate 
1877*0Sstevel@tonic-gate     /**
1878*0Sstevel@tonic-gate      * Clear policy list pattern
1879*0Sstevel@tonic-gate      *
1880*0Sstevel@tonic-gate      */
1881*0Sstevel@tonic-gate     public void poPatternClear() {
1882*0Sstevel@tonic-gate         if (noLists) {
1883*0Sstevel@tonic-gate             gui.PoListPattern.set("text" /* NOI18N */, "");
1884*0Sstevel@tonic-gate             ((TextField)gui.PoListPattern.getBody()).requestFocus();
1885*0Sstevel@tonic-gate         } else {
1886*0Sstevel@tonic-gate             String tempName = CurPolicy;
1887*0Sstevel@tonic-gate             fillPolicyList("");
1888*0Sstevel@tonic-gate             selectPolicy(tempName);
1889*0Sstevel@tonic-gate         }
1890*0Sstevel@tonic-gate     }
1891*0Sstevel@tonic-gate 
1892*0Sstevel@tonic-gate     /**
1893*0Sstevel@tonic-gate      * Show the policy list after applying the filter passed in.
1894*0Sstevel@tonic-gate      */
1895*0Sstevel@tonic-gate     public void showPolicyList(String pattern) {
1896*0Sstevel@tonic-gate         pol = null; // we are not editing a policy
1897*0Sstevel@tonic-gate         fillPolicyList(pattern);
1898*0Sstevel@tonic-gate         ModeString = "";
1899*0Sstevel@tonic-gate         OpString = "";
1900*0Sstevel@tonic-gate         updateStatus();
1901*0Sstevel@tonic-gate         gui.cardpanel2.show("List" /* NOI18N */);
1902*0Sstevel@tonic-gate         if (noLists)
1903*0Sstevel@tonic-gate             ((TextField)gui.PoListPattern.getBody()).requestFocus();
1904*0Sstevel@tonic-gate     }
1905*0Sstevel@tonic-gate 
1906*0Sstevel@tonic-gate     /**
1907*0Sstevel@tonic-gate      * Generate the policy list for the first time or after a pattern
1908*0Sstevel@tonic-gate      * has been chosen.
1909*0Sstevel@tonic-gate      *
1910*0Sstevel@tonic-gate      */
1911*0Sstevel@tonic-gate     public void fillPolicyList(String pattern) {
1912*0Sstevel@tonic-gate         if (noLists) {
1913*0Sstevel@tonic-gate             setCurPolicy((String)gui.PoListPattern.get("text" /* NOI18N */));
1914*0Sstevel@tonic-gate             ((TextField)gui.PoListPattern.getBody()).requestFocus();
1915*0Sstevel@tonic-gate             disablePolicyPrinting();
1916*0Sstevel@tonic-gate             return;
1917*0Sstevel@tonic-gate         }
1918*0Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
1919*0Sstevel@tonic-gate         long cachetime = A_LONG_TIME;
1920*0Sstevel@tonic-gate         if (!defaults.getStaticLists())
1921*0Sstevel@tonic-gate             cachetime = defaults.getCacheTime() * 1000;
1922*0Sstevel@tonic-gate         if (policyList != null
1923*0Sstevel@tonic-gate 	    && ((new Date()).getTime() - policyListDate.getTime())
1924*0Sstevel@tonic-gate 	    <= cachetime) {
1925*0Sstevel@tonic-gate             if (pattern.compareTo(curPoPattern) != 0)
1926*0Sstevel@tonic-gate                 newPoPattern(pattern);
1927*0Sstevel@tonic-gate             realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
1928*0Sstevel@tonic-gate             selectPolicy(curPoListPos);
1929*0Sstevel@tonic-gate             return;
1930*0Sstevel@tonic-gate         }
1931*0Sstevel@tonic-gate         PolicyList p = new PolicyList(Kadmin);
1932*0Sstevel@tonic-gate         gui.StatusLine.set("text" /* NOI18N */,
1933*0Sstevel@tonic-gate 			   getString("Loading policy list"));
1934*0Sstevel@tonic-gate         try {
1935*0Sstevel@tonic-gate             policyList = p.getPolicyList();
1936*0Sstevel@tonic-gate             policyListDate = new Date();
1937*0Sstevel@tonic-gate         } catch (Exception e) {
1938*0Sstevel@tonic-gate             realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
1939*0Sstevel@tonic-gate             showError(e.getMessage());
1940*0Sstevel@tonic-gate             updateStatus();
1941*0Sstevel@tonic-gate             return;
1942*0Sstevel@tonic-gate         }
1943*0Sstevel@tonic-gate         updateStatus();
1944*0Sstevel@tonic-gate         newPoPattern(pattern);
1945*0Sstevel@tonic-gate         selectPolicy(curPoListPos);
1946*0Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
1947*0Sstevel@tonic-gate     }
1948*0Sstevel@tonic-gate 
1949*0Sstevel@tonic-gate     private void newPoPattern(String pattern) {
1950*0Sstevel@tonic-gate         curPoPattern = pattern;
1951*0Sstevel@tonic-gate         gui.PoListPattern.set("text" /* NOI18N */, pattern);
1952*0Sstevel@tonic-gate         refreshPolicyList();
1953*0Sstevel@tonic-gate     }
1954*0Sstevel@tonic-gate 
1955*0Sstevel@tonic-gate     private void refreshPolicyList() {
1956*0Sstevel@tonic-gate         if (noLists)
1957*0Sstevel@tonic-gate             return;
1958*0Sstevel@tonic-gate         Filter f = new Filter(policyList, curPoPattern);
1959*0Sstevel@tonic-gate         gui.Pollist.set("items" /* NOI18N */, f.out);
1960*0Sstevel@tonic-gate     }
1961*0Sstevel@tonic-gate 
1962*0Sstevel@tonic-gate     private void selectPolicy(int pos) {
1963*0Sstevel@tonic-gate         TextList list = (TextList)gui.Pollist.getBody();
1964*0Sstevel@tonic-gate         if (list.countItems() == 0) {
1965*0Sstevel@tonic-gate             setCurPolicy("");
1966*0Sstevel@tonic-gate             return;
1967*0Sstevel@tonic-gate         }
1968*0Sstevel@tonic-gate 
1969*0Sstevel@tonic-gate         if (pos < 0)
1970*0Sstevel@tonic-gate             pos = 0;
1971*0Sstevel@tonic-gate         else if (pos >= list.countItems())
1972*0Sstevel@tonic-gate             pos = list.countItems() - 1;
1973*0Sstevel@tonic-gate 
1974*0Sstevel@tonic-gate         list.select(pos);
1975*0Sstevel@tonic-gate         enablePolicyPrinting();
1976*0Sstevel@tonic-gate         list.makeVisible(pos);
1977*0Sstevel@tonic-gate         setCurPolicy(list.getItem(pos));
1978*0Sstevel@tonic-gate     }
1979*0Sstevel@tonic-gate 
1980*0Sstevel@tonic-gate     private void selectPolicy(String name) {
1981*0Sstevel@tonic-gate         String[] list = getItemsFromTextList((TextList)gui.Pollist.getBody());
1982*0Sstevel@tonic-gate         selectPolicy(search(list, name));
1983*0Sstevel@tonic-gate     }
1984*0Sstevel@tonic-gate 
1985*0Sstevel@tonic-gate     /**
1986*0Sstevel@tonic-gate      * When the policy name choice changes, we want to reflect
1987*0Sstevel@tonic-gate      * the name in the policy detail tab.
1988*0Sstevel@tonic-gate      *
1989*0Sstevel@tonic-gate      */
1990*0Sstevel@tonic-gate     public void setCurPolicy(String name) {
1991*0Sstevel@tonic-gate         CurPolicy = name;
1992*0Sstevel@tonic-gate         gui.PoName.set("text" /* NOI18N */, CurPolicy);
1993*0Sstevel@tonic-gate         if (name.compareTo("") == 0) {
1994*0Sstevel@tonic-gate             poSelValid(false);
1995*0Sstevel@tonic-gate             return;
1996*0Sstevel@tonic-gate         }
1997*0Sstevel@tonic-gate         poSelValid(true);
1998*0Sstevel@tonic-gate     }
1999*0Sstevel@tonic-gate 
2000*0Sstevel@tonic-gate     /**
2001*0Sstevel@tonic-gate      * Look at the policy list to see what's selected
2002*0Sstevel@tonic-gate      *
2003*0Sstevel@tonic-gate      */
2004*0Sstevel@tonic-gate     public void lookAtPoList() {
2005*0Sstevel@tonic-gate         if (noLists)
2006*0Sstevel@tonic-gate             return;
2007*0Sstevel@tonic-gate         TextList list = (TextList) gui.Pollist.getBody();
2008*0Sstevel@tonic-gate         poMulti = null;
2009*0Sstevel@tonic-gate         String[] sel = list.getSelectedItems();
2010*0Sstevel@tonic-gate         if (sel.length == 1) {
2011*0Sstevel@tonic-gate             setCurPolicy(sel[0]);
2012*0Sstevel@tonic-gate             curPoListPos = list.getSelectedIndex();
2013*0Sstevel@tonic-gate         } else {
2014*0Sstevel@tonic-gate             if (sel.length > 0)
2015*0Sstevel@tonic-gate                 poMulti = sel;
2016*0Sstevel@tonic-gate             setCurPolicy("");
2017*0Sstevel@tonic-gate         }
2018*0Sstevel@tonic-gate     }
2019*0Sstevel@tonic-gate 
2020*0Sstevel@tonic-gate     private void restorePoListSelection() {
2021*0Sstevel@tonic-gate         if (noLists)
2022*0Sstevel@tonic-gate             return;
2023*0Sstevel@tonic-gate         TextList list = (TextList) gui.Pollist.getBody();
2024*0Sstevel@tonic-gate         list.select(curPoListPos);
2025*0Sstevel@tonic-gate     }
2026*0Sstevel@tonic-gate 
2027*0Sstevel@tonic-gate     /**
2028*0Sstevel@tonic-gate      * Make Modify, Delete and Duplicate buttons react to what is selected.
2029*0Sstevel@tonic-gate      *
2030*0Sstevel@tonic-gate      */
2031*0Sstevel@tonic-gate     public void poSelValid(boolean selected) {
2032*0Sstevel@tonic-gate         poSelValid = selected;
2033*0Sstevel@tonic-gate         Boolean b = new Boolean(selected && (privs & PRIV_INQUIRE) != 0);
2034*0Sstevel@tonic-gate         gui.PoListModify.set("enabled" /* NOI18N */, b);
2035*0Sstevel@tonic-gate         int want = (PRIV_ADD | PRIV_INQUIRE);
2036*0Sstevel@tonic-gate         b = new Boolean(selected && (privs & want) == want);
2037*0Sstevel@tonic-gate         gui.PoListDuplicate.set("enabled" /* NOI18N */, b);
2038*0Sstevel@tonic-gate         b = new Boolean((selected || poMulti != null)
2039*0Sstevel@tonic-gate 			&&(privs & PRIV_DELETE) != 0);
2040*0Sstevel@tonic-gate         gui.PoListDelete.set("enabled" /* NOI18N */, b);
2041*0Sstevel@tonic-gate     }
2042*0Sstevel@tonic-gate 
2043*0Sstevel@tonic-gate     /**
2044*0Sstevel@tonic-gate      * Make the Save button do the right thing.
2045*0Sstevel@tonic-gate      *
2046*0Sstevel@tonic-gate      */
2047*0Sstevel@tonic-gate     public void poSetCanSave(boolean ok) {
2048*0Sstevel@tonic-gate         Boolean b = new Boolean(ok);
2049*0Sstevel@tonic-gate         gui.PoDetailSave.set("enabled"  /* NOI18N */, b);
2050*0Sstevel@tonic-gate     }
2051*0Sstevel@tonic-gate 
2052*0Sstevel@tonic-gate     /**
2053*0Sstevel@tonic-gate      * This is a way for the data modification actions to note that
2054*0Sstevel@tonic-gate      * the principal has edits outstanding.
2055*0Sstevel@tonic-gate      *
2056*0Sstevel@tonic-gate      */
2057*0Sstevel@tonic-gate     public void poSetNeedSave() {
2058*0Sstevel@tonic-gate         poNeedSave = true;
2059*0Sstevel@tonic-gate         poSetCanSave(true);
2060*0Sstevel@tonic-gate         SaveString = getString("- *CHANGES*");
2061*0Sstevel@tonic-gate         updateStatus();
2062*0Sstevel@tonic-gate     }
2063*0Sstevel@tonic-gate 
2064*0Sstevel@tonic-gate     public boolean poDoSave() {
2065*0Sstevel@tonic-gate 
2066*0Sstevel@tonic-gate         // before attempting to save make sure all text fields are in order
2067*0Sstevel@tonic-gate         if (poUpdateFromGui() == false)
2068*0Sstevel@tonic-gate             return false;
2069*0Sstevel@tonic-gate 
2070*0Sstevel@tonic-gate         boolean b = true;
2071*0Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
2072*0Sstevel@tonic-gate         try {
2073*0Sstevel@tonic-gate             b = pol.savePolicy();
2074*0Sstevel@tonic-gate         } catch (Exception e) {
2075*0Sstevel@tonic-gate             b = false;
2076*0Sstevel@tonic-gate             showError(e.getMessage());
2077*0Sstevel@tonic-gate         }
2078*0Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
2079*0Sstevel@tonic-gate         if (!b)
2080*0Sstevel@tonic-gate             return false;
2081*0Sstevel@tonic-gate         if (pol.isNew) {
2082*0Sstevel@tonic-gate             policyList = addToList(policyList, pol.PolicyName);
2083*0Sstevel@tonic-gate             refreshPolicyList();
2084*0Sstevel@tonic-gate             selectPolicy(pol.PolicyName);
2085*0Sstevel@tonic-gate             setPolicyChoice();
2086*0Sstevel@tonic-gate         }
2087*0Sstevel@tonic-gate         pol.isNew = false;
2088*0Sstevel@tonic-gate         poSetEditable(false);
2089*0Sstevel@tonic-gate         poSetCanSave(false);
2090*0Sstevel@tonic-gate         poNeedSave = false;
2091*0Sstevel@tonic-gate         SaveString = "";
2092*0Sstevel@tonic-gate         updateStatus();
2093*0Sstevel@tonic-gate         return true;
2094*0Sstevel@tonic-gate     }
2095*0Sstevel@tonic-gate 
2096*0Sstevel@tonic-gate     /**
2097*0Sstevel@tonic-gate      * React to a choice from the policy list via double-click or
2098*0Sstevel@tonic-gate      * single-click+Modify; we want to go to the next tab in each case.
2099*0Sstevel@tonic-gate      * If we don't have modify privileges, we need to simply show values.
2100*0Sstevel@tonic-gate      */
2101*0Sstevel@tonic-gate     public void poSelected() {
2102*0Sstevel@tonic-gate         enablePolicyPrinting();
2103*0Sstevel@tonic-gate         lookAtPoList();
2104*0Sstevel@tonic-gate         if (!poNeedSave) {
2105*0Sstevel@tonic-gate             poSetEditable(false);
2106*0Sstevel@tonic-gate             poSetCanSave(false);
2107*0Sstevel@tonic-gate         }
2108*0Sstevel@tonic-gate         if (noLists)
2109*0Sstevel@tonic-gate             CurPolicy = (String)gui.PoListPattern.get("text" /* NOI18N */);
2110*0Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
2111*0Sstevel@tonic-gate         enablePoAttributes(new Boolean((privs & (PRIV_ADD|PRIV_MODIFY)) != 0));
2112*0Sstevel@tonic-gate         try {
2113*0Sstevel@tonic-gate             pol = new Policy(Kadmin, CurPolicy);
2114*0Sstevel@tonic-gate         } catch (Exception e) {
2115*0Sstevel@tonic-gate             showError(e.getMessage());
2116*0Sstevel@tonic-gate             realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
2117*0Sstevel@tonic-gate             return;
2118*0Sstevel@tonic-gate         }
2119*0Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
2120*0Sstevel@tonic-gate         showPolicy(pol);
2121*0Sstevel@tonic-gate         ModeString = getString("Modify")+" ";
2122*0Sstevel@tonic-gate         OpString = getString("Policy");
2123*0Sstevel@tonic-gate         updateStatus();
2124*0Sstevel@tonic-gate         gui.cardpanel2.show("Details" /* NOI18N */);
2125*0Sstevel@tonic-gate     }
2126*0Sstevel@tonic-gate 
2127*0Sstevel@tonic-gate     /**
2128*0Sstevel@tonic-gate      * React to add policy button
2129*0Sstevel@tonic-gate      * If we got here, we need to enable attributes since we have privs.
2130*0Sstevel@tonic-gate      */
2131*0Sstevel@tonic-gate     public void poAdd() {
2132*0Sstevel@tonic-gate         enablePolicyPrinting();
2133*0Sstevel@tonic-gate         setCurPolicy("");
2134*0Sstevel@tonic-gate         poSelValid = true;
2135*0Sstevel@tonic-gate         poSetEditable(true);
2136*0Sstevel@tonic-gate         poSetNeedSave();
2137*0Sstevel@tonic-gate         enablePoAttributes(new Boolean(true));
2138*0Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
2139*0Sstevel@tonic-gate         try {
2140*0Sstevel@tonic-gate             pol = new Policy(Kadmin);
2141*0Sstevel@tonic-gate         } catch (Exception e) {
2142*0Sstevel@tonic-gate             showError(e.getMessage());
2143*0Sstevel@tonic-gate             realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
2144*0Sstevel@tonic-gate             return;
2145*0Sstevel@tonic-gate         }
2146*0Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
2147*0Sstevel@tonic-gate         showPolicy(pol);
2148*0Sstevel@tonic-gate         ModeString = getString("Create New")+" ";
2149*0Sstevel@tonic-gate         OpString = getString("Policy");
2150*0Sstevel@tonic-gate         updateStatus();
2151*0Sstevel@tonic-gate         gui.cardpanel2.show("Details" /* NOI18N */);
2152*0Sstevel@tonic-gate         ((TextField)gui.PoName.getBody()).requestFocus();
2153*0Sstevel@tonic-gate     }
2154*0Sstevel@tonic-gate 
2155*0Sstevel@tonic-gate     /**
2156*0Sstevel@tonic-gate      * React to duplicate policy button
2157*0Sstevel@tonic-gate      *
2158*0Sstevel@tonic-gate      */
2159*0Sstevel@tonic-gate     public void poDuplicate() {
2160*0Sstevel@tonic-gate         enablePolicyPrinting();
2161*0Sstevel@tonic-gate         if (noLists)
2162*0Sstevel@tonic-gate             CurPolicy = (String)gui.PoListPattern.get("text" /* NOI18N */);
2163*0Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
2164*0Sstevel@tonic-gate         try {
2165*0Sstevel@tonic-gate             pol = new Policy(Kadmin, CurPolicy);
2166*0Sstevel@tonic-gate         } catch (Exception e) {
2167*0Sstevel@tonic-gate             showError(e.getMessage());
2168*0Sstevel@tonic-gate             realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
2169*0Sstevel@tonic-gate             return;
2170*0Sstevel@tonic-gate         }
2171*0Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
2172*0Sstevel@tonic-gate         setCurPolicy("");
2173*0Sstevel@tonic-gate         poSelValid = true;
2174*0Sstevel@tonic-gate         poSetEditable(true);
2175*0Sstevel@tonic-gate         poSetNeedSave();
2176*0Sstevel@tonic-gate         try {
2177*0Sstevel@tonic-gate             pol = new Policy(Kadmin, pol);
2178*0Sstevel@tonic-gate         } catch (Exception e) {
2179*0Sstevel@tonic-gate             showError(e.getMessage());
2180*0Sstevel@tonic-gate             return;
2181*0Sstevel@tonic-gate         }
2182*0Sstevel@tonic-gate         pol.PolicyName = "";
2183*0Sstevel@tonic-gate         showPolicy(pol);
2184*0Sstevel@tonic-gate         ModeString = getString("Duplicate")+" ";
2185*0Sstevel@tonic-gate         OpString = getString("Policy");
2186*0Sstevel@tonic-gate         updateStatus();
2187*0Sstevel@tonic-gate         gui.cardpanel2.show("Details" /* NOI18N */);
2188*0Sstevel@tonic-gate         ((TextField)gui.PoName.getBody()).requestFocus();
2189*0Sstevel@tonic-gate     }
2190*0Sstevel@tonic-gate 
2191*0Sstevel@tonic-gate     /**
2192*0Sstevel@tonic-gate      * React to delete policy button
2193*0Sstevel@tonic-gate      */
2194*0Sstevel@tonic-gate     public void poDelete() {
2195*0Sstevel@tonic-gate         String text[] = {getString("You are about to destroy data."),
2196*0Sstevel@tonic-gate 			 getString("Click OK to proceed or"
2197*0Sstevel@tonic-gate 				   +" Cancel to continue editing.")};
2198*0Sstevel@tonic-gate         String resp = confirmAction(realMainFrame, text);
2199*0Sstevel@tonic-gate         if (resp.equals(getString("Cancel")))
2200*0Sstevel@tonic-gate             return;
2201*0Sstevel@tonic-gate         boolean b;
2202*0Sstevel@tonic-gate         if (noLists)
2203*0Sstevel@tonic-gate             CurPolicy = (String)gui.PoListPattern.get("text" /* NOI18N */);
2204*0Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
2205*0Sstevel@tonic-gate         try {
2206*0Sstevel@tonic-gate             b = Kadmin.deletePolicy(CurPolicy);
2207*0Sstevel@tonic-gate         } catch (Exception e) {
2208*0Sstevel@tonic-gate             showError(e.getMessage());
2209*0Sstevel@tonic-gate             realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
2210*0Sstevel@tonic-gate             return;
2211*0Sstevel@tonic-gate         }
2212*0Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
2213*0Sstevel@tonic-gate         if (!b)
2214*0Sstevel@tonic-gate             return;
2215*0Sstevel@tonic-gate         policyList = delFromList(policyList, CurPolicy);
2216*0Sstevel@tonic-gate         refreshPolicyList();
2217*0Sstevel@tonic-gate         setPolicyChoice();
2218*0Sstevel@tonic-gate         setCurPolicy("");
2219*0Sstevel@tonic-gate         poSelValid = true;
2220*0Sstevel@tonic-gate         poSetEditable(true);
2221*0Sstevel@tonic-gate         if (curPoListPos == ((TextList)gui.Pollist.getBody()).countItems())
2222*0Sstevel@tonic-gate             curPoListPos--;
2223*0Sstevel@tonic-gate         showPolicyList(curPoPattern);
2224*0Sstevel@tonic-gate     }
2225*0Sstevel@tonic-gate 
2226*0Sstevel@tonic-gate     /**
2227*0Sstevel@tonic-gate      * React to save policy button
2228*0Sstevel@tonic-gate      *
2229*0Sstevel@tonic-gate      */
2230*0Sstevel@tonic-gate     public void poSave() {
2231*0Sstevel@tonic-gate         poDoSave();
2232*0Sstevel@tonic-gate     }
2233*0Sstevel@tonic-gate 
2234*0Sstevel@tonic-gate     /**
2235*0Sstevel@tonic-gate      * React to cancel policy button
2236*0Sstevel@tonic-gate      *
2237*0Sstevel@tonic-gate      */
2238*0Sstevel@tonic-gate     public void poCancel() {
2239*0Sstevel@tonic-gate         if (poNeedSave) {
2240*0Sstevel@tonic-gate             String text[] = {getString("You are about to lose changes."),
2241*0Sstevel@tonic-gate 			     getString("Click Save to commit changes, "
2242*0Sstevel@tonic-gate 				       +"Discard to discard changes, "
2243*0Sstevel@tonic-gate 				       +"or Cancel to continue editing.")};
2244*0Sstevel@tonic-gate             String resp = confirmSave(realMainFrame, text);
2245*0Sstevel@tonic-gate             if (resp.equals(getString("Cancel")))
2246*0Sstevel@tonic-gate                 return;
2247*0Sstevel@tonic-gate             if (resp.equals(getString("Save")))
2248*0Sstevel@tonic-gate                 if (!poDoSave())
2249*0Sstevel@tonic-gate 		    return;
2250*0Sstevel@tonic-gate         }
2251*0Sstevel@tonic-gate         poSetEditable(false);
2252*0Sstevel@tonic-gate         poSetCanSave(false);
2253*0Sstevel@tonic-gate         poNeedSave = false;
2254*0Sstevel@tonic-gate         lookAtPoList();
2255*0Sstevel@tonic-gate         SaveString = "";
2256*0Sstevel@tonic-gate         showPolicyList(curPoPattern);
2257*0Sstevel@tonic-gate     }
2258*0Sstevel@tonic-gate 
2259*0Sstevel@tonic-gate     /**
2260*0Sstevel@tonic-gate      * React to previous button on policy detail screen
2261*0Sstevel@tonic-gate      *
2262*0Sstevel@tonic-gate      */
2263*0Sstevel@tonic-gate     public void polPrevious() {
2264*0Sstevel@tonic-gate         poCancel();
2265*0Sstevel@tonic-gate     }
2266*0Sstevel@tonic-gate 
2267*0Sstevel@tonic-gate     /**
2268*0Sstevel@tonic-gate      * React to done button on policy detail screen
2269*0Sstevel@tonic-gate      *
2270*0Sstevel@tonic-gate      */
2271*0Sstevel@tonic-gate     public void polDone() {
2272*0Sstevel@tonic-gate         if (poNeedSave && poDoSave() == false)
2273*0Sstevel@tonic-gate             return;
2274*0Sstevel@tonic-gate         showPolicyList(curPoPattern);
2275*0Sstevel@tonic-gate     }
2276*0Sstevel@tonic-gate 
2277*0Sstevel@tonic-gate     /*
2278*0Sstevel@tonic-gate      * Methods for the policy details panel
2279*0Sstevel@tonic-gate      */
2280*0Sstevel@tonic-gate 
2281*0Sstevel@tonic-gate     public boolean setPolName() {
2282*0Sstevel@tonic-gate         if (!ponameEditable)
2283*0Sstevel@tonic-gate             return true;
2284*0Sstevel@tonic-gate 
2285*0Sstevel@tonic-gate         String p = (String)gui.PoName.get("text" /* NOI18N */);
2286*0Sstevel@tonic-gate         if (p.compareTo(getString("(no policy)")) == 0) {
2287*0Sstevel@tonic-gate             showError(getString("Policy name already exists. Please choose "
2288*0Sstevel@tonic-gate 				+"a different policy name or cancel"));
2289*0Sstevel@tonic-gate             gui.PoName.set("text" /* NOI18N */, "");
2290*0Sstevel@tonic-gate             ((TextField)gui.PoName.getBody()).requestFocus();
2291*0Sstevel@tonic-gate             return false;
2292*0Sstevel@tonic-gate         }
2293*0Sstevel@tonic-gate         if (p.compareTo("") == 0) {
2294*0Sstevel@tonic-gate             showError(getString("Please enter a policy name or cancel"));
2295*0Sstevel@tonic-gate             ((TextField)gui.PoName.getBody()).requestFocus();
2296*0Sstevel@tonic-gate             return false;
2297*0Sstevel@tonic-gate         }
2298*0Sstevel@tonic-gate 
2299*0Sstevel@tonic-gate         setCurPolicy(p);
2300*0Sstevel@tonic-gate         pol.setName(p);
2301*0Sstevel@tonic-gate         return true;
2302*0Sstevel@tonic-gate     }
2303*0Sstevel@tonic-gate 
2304*0Sstevel@tonic-gate     public void setPolPwLength() {
2305*0Sstevel@tonic-gate         if (pol == null)
2306*0Sstevel@tonic-gate                 return;
2307*0Sstevel@tonic-gate         try {
2308*0Sstevel@tonic-gate             pol.setPolPwLength((String)gui.PoMinPwLength.get("selectedItem"
2309*0Sstevel@tonic-gate 							 /* NOI18N */));
2310*0Sstevel@tonic-gate         } catch (Exception e) {};
2311*0Sstevel@tonic-gate     }
2312*0Sstevel@tonic-gate 
2313*0Sstevel@tonic-gate     public void setPolPwClasses() {
2314*0Sstevel@tonic-gate         if (pol == null)
2315*0Sstevel@tonic-gate                 return;
2316*0Sstevel@tonic-gate         try {
2317*0Sstevel@tonic-gate             pol.setPolPwClasses((String)gui.PoMinPwClass.get("selectedItem"
2318*0Sstevel@tonic-gate 							 /* NOI18N */));
2319*0Sstevel@tonic-gate         } catch (Exception e) {};
2320*0Sstevel@tonic-gate     }
2321*0Sstevel@tonic-gate 
2322*0Sstevel@tonic-gate     public void setPolPwHistory() {
2323*0Sstevel@tonic-gate         if (pol == null)
2324*0Sstevel@tonic-gate                 return;
2325*0Sstevel@tonic-gate         try {
2326*0Sstevel@tonic-gate             pol.setPolPwHistory((String)gui.PoSavedPasswords.get("selectedItem"
2327*0Sstevel@tonic-gate 							     /* NOI18N */));
2328*0Sstevel@tonic-gate         } catch (Exception e) {};
2329*0Sstevel@tonic-gate     }
2330*0Sstevel@tonic-gate 
2331*0Sstevel@tonic-gate     public boolean setPolMinlife() {
2332*0Sstevel@tonic-gate         if (pol.setPolMinlife((String)gui.PoMinTicketLifetime.get("text"
2333*0Sstevel@tonic-gate 							  /* NOI18N */))) {
2334*0Sstevel@tonic-gate             // visually delete any extraneous data that was ignored in the
2335*0Sstevel@tonic-gate             // parsing by resetting the gui data
2336*0Sstevel@tonic-gate             gui.PoMinTicketLifetime.set("text" /* NOI18N */,
2337*0Sstevel@tonic-gate 					showDuration(pol.PwMinLife));
2338*0Sstevel@tonic-gate             return true;
2339*0Sstevel@tonic-gate         } else {
2340*0Sstevel@tonic-gate             showDataFormatError(((TextField)gui.PoMinTicketLifetime.getBody()),
2341*0Sstevel@tonic-gate 				DURATION_DATA);
2342*0Sstevel@tonic-gate             return false;
2343*0Sstevel@tonic-gate         }
2344*0Sstevel@tonic-gate     }
2345*0Sstevel@tonic-gate 
2346*0Sstevel@tonic-gate     public boolean setPolMaxlife() {
2347*0Sstevel@tonic-gate         if (pol.setPolMaxlife((String)gui.PoMaxTicketLifetime.get(
2348*0Sstevel@tonic-gate 						  "text" /* NOI18N */))) {
2349*0Sstevel@tonic-gate             // visually delete any extraneous data that was ignored in the
2350*0Sstevel@tonic-gate             // parsing by resetting the gui data
2351*0Sstevel@tonic-gate             gui.PoMaxTicketLifetime.set("text" /* NOI18N */,
2352*0Sstevel@tonic-gate 					showDuration(pol.PwMaxLife));
2353*0Sstevel@tonic-gate             return true;
2354*0Sstevel@tonic-gate         } else {
2355*0Sstevel@tonic-gate             showDataFormatError(((TextField)gui.PoMaxTicketLifetime.getBody()),
2356*0Sstevel@tonic-gate 				DURATION_DATA);
2357*0Sstevel@tonic-gate             return false;
2358*0Sstevel@tonic-gate         }
2359*0Sstevel@tonic-gate     }
2360*0Sstevel@tonic-gate 
2361*0Sstevel@tonic-gate     /**
2362*0Sstevel@tonic-gate      * Update components to reflect data in this policy
2363*0Sstevel@tonic-gate      *
2364*0Sstevel@tonic-gate      */
2365*0Sstevel@tonic-gate     public void showPolicy(Policy p) {
2366*0Sstevel@tonic-gate         gui.PoName.set("text" /* NOI18N */, p.PolicyName);
2367*0Sstevel@tonic-gate         gui.PoMinPwLength.set("selectedItem" /* NOI18N */,
2368*0Sstevel@tonic-gate 			      nf.format(p.PwMinLength));
2369*0Sstevel@tonic-gate         gui.PoMinPwClass.set("selectedItem" /* NOI18N */,
2370*0Sstevel@tonic-gate 			     nf.format(p.PwMinClasses));
2371*0Sstevel@tonic-gate         gui.PoSavedPasswords.set("selectedItem" /* NOI18N */,
2372*0Sstevel@tonic-gate 				 nf.format(p.PwSaveCount));
2373*0Sstevel@tonic-gate         gui.PoMinTicketLifetime.set("text" /* NOI18N */,
2374*0Sstevel@tonic-gate 				    showDuration(p.PwMinLife));
2375*0Sstevel@tonic-gate         gui.PoMaxTicketLifetime.set("text" /* NOI18N */,
2376*0Sstevel@tonic-gate 				    showDuration(p.PwMaxLife));
2377*0Sstevel@tonic-gate         gui.PoReferences.set("text" /* NOI18N */, nf.format(p.RefCount));
2378*0Sstevel@tonic-gate     }
2379*0Sstevel@tonic-gate 
2380*0Sstevel@tonic-gate     /*
2381*0Sstevel@tonic-gate      * Methods for defaults tab
2382*0Sstevel@tonic-gate      */
2383*0Sstevel@tonic-gate 
2384*0Sstevel@tonic-gate     /**
2385*0Sstevel@tonic-gate      * React to save button
2386*0Sstevel@tonic-gate      *
2387*0Sstevel@tonic-gate      */
2388*0Sstevel@tonic-gate     public void glSave() {
2389*0Sstevel@tonic-gate         if (defaults.updateFromGui()) {
2390*0Sstevel@tonic-gate             glDoSave(true);
2391*0Sstevel@tonic-gate             glUpdate();
2392*0Sstevel@tonic-gate         }
2393*0Sstevel@tonic-gate     }
2394*0Sstevel@tonic-gate 
2395*0Sstevel@tonic-gate     /**
2396*0Sstevel@tonic-gate      * React to apply button
2397*0Sstevel@tonic-gate      *
2398*0Sstevel@tonic-gate      */
2399*0Sstevel@tonic-gate     public void glApply() {
2400*0Sstevel@tonic-gate         if (defaults.updateFromGui()) {
2401*0Sstevel@tonic-gate             glDoSave(false);
2402*0Sstevel@tonic-gate             glUpdate();
2403*0Sstevel@tonic-gate         }
2404*0Sstevel@tonic-gate     }
2405*0Sstevel@tonic-gate 
2406*0Sstevel@tonic-gate     /**
2407*0Sstevel@tonic-gate      * React to cancel button
2408*0Sstevel@tonic-gate      *
2409*0Sstevel@tonic-gate      */
2410*0Sstevel@tonic-gate     public void glCancel() {
2411*0Sstevel@tonic-gate         if (glNeedSave) {
2412*0Sstevel@tonic-gate             String text[] = {getString("You are about to lose changes."),
2413*0Sstevel@tonic-gate 			     getString("Click Save to commit changes, "
2414*0Sstevel@tonic-gate 				       +"Discard to discard changes, "
2415*0Sstevel@tonic-gate 				       +"or Cancel to continue editing.")};
2416*0Sstevel@tonic-gate             String resp = confirmSave(defaultsEditingFrame, text);
2417*0Sstevel@tonic-gate             if (resp.equals(getString("Cancel")))
2418*0Sstevel@tonic-gate                 return;
2419*0Sstevel@tonic-gate             if (resp.equals(getString("Discard")))
2420*0Sstevel@tonic-gate                 defaults.restoreValues(olddefaults);
2421*0Sstevel@tonic-gate             if (resp.equals(getString("Save"))) {
2422*0Sstevel@tonic-gate                 glDoSave(true);
2423*0Sstevel@tonic-gate                 glUpdate();
2424*0Sstevel@tonic-gate                 return;
2425*0Sstevel@tonic-gate             }
2426*0Sstevel@tonic-gate         }
2427*0Sstevel@tonic-gate         glDoSave(false);
2428*0Sstevel@tonic-gate     }
2429*0Sstevel@tonic-gate 
2430*0Sstevel@tonic-gate     public void glDoSave(boolean save) {
2431*0Sstevel@tonic-gate         defaults.close(save);
2432*0Sstevel@tonic-gate         glSetCanSave(false);
2433*0Sstevel@tonic-gate         glNeedSave = false;
2434*0Sstevel@tonic-gate         SaveString = "";
2435*0Sstevel@tonic-gate         updateStatus();
2436*0Sstevel@tonic-gate     }
2437*0Sstevel@tonic-gate 
2438*0Sstevel@tonic-gate     public void glUpdate() {
2439*0Sstevel@tonic-gate         noLists = ((privs & PRIV_LIST) == 0 || !defaults.getShowLists());
2440*0Sstevel@tonic-gate         fixHelpTags();
2441*0Sstevel@tonic-gate         fixListPanels();
2442*0Sstevel@tonic-gate         // Load principal list if we are in the principal tab and are not
2443*0Sstevel@tonic-gate         // editing a principal
2444*0Sstevel@tonic-gate         if (gui.tabbedfolder1.get("currentCard" /* NO18N */) ==
2445*0Sstevel@tonic-gate 	    getString("Principals") && prin == null)
2446*0Sstevel@tonic-gate 	    fillPrincipalList(curPrPattern);
2447*0Sstevel@tonic-gate         // Load policy list if we are in the policy tab and are not
2448*0Sstevel@tonic-gate         // editing a policy
2449*0Sstevel@tonic-gate         if (gui.tabbedfolder1.get("currentCard" /* NO18N */) ==
2450*0Sstevel@tonic-gate 	    getString("Policies") && pol == null)
2451*0Sstevel@tonic-gate 	    fillPolicyList(curPoPattern);
2452*0Sstevel@tonic-gate     }
2453*0Sstevel@tonic-gate 
2454*0Sstevel@tonic-gate     /**
2455*0Sstevel@tonic-gate      * This is a way for the data modification actions to note that
2456*0Sstevel@tonic-gate      * the principal has edits outstanding.
2457*0Sstevel@tonic-gate      *
2458*0Sstevel@tonic-gate      */
2459*0Sstevel@tonic-gate     public void glSetNeedSave() {
2460*0Sstevel@tonic-gate         glNeedSave = true;
2461*0Sstevel@tonic-gate         glSetCanSave(true);
2462*0Sstevel@tonic-gate     }
2463*0Sstevel@tonic-gate 
2464*0Sstevel@tonic-gate     /**
2465*0Sstevel@tonic-gate      * Make the Save button do the right thing.
2466*0Sstevel@tonic-gate      *
2467*0Sstevel@tonic-gate      */
2468*0Sstevel@tonic-gate     public void glSetCanSave(boolean ok) {
2469*0Sstevel@tonic-gate         defaults.saveButton.setEnabled(ok);
2470*0Sstevel@tonic-gate         defaults.applyButton.setEnabled(ok);
2471*0Sstevel@tonic-gate     }
2472*0Sstevel@tonic-gate 
2473*0Sstevel@tonic-gate     public boolean setGlobalMaxrenew() {
2474*0Sstevel@tonic-gate         boolean done = defaults.setMaxTicketRenewableLife();
2475*0Sstevel@tonic-gate         glSetNeedSave();
2476*0Sstevel@tonic-gate         return done;
2477*0Sstevel@tonic-gate     }
2478*0Sstevel@tonic-gate 
2479*0Sstevel@tonic-gate     public boolean setGlobalMaxlife() {
2480*0Sstevel@tonic-gate         boolean done = defaults.setMaxTicketLife();
2481*0Sstevel@tonic-gate         glSetNeedSave();
2482*0Sstevel@tonic-gate         return done;
2483*0Sstevel@tonic-gate     }
2484*0Sstevel@tonic-gate 
2485*0Sstevel@tonic-gate     public boolean setGlobalExpiry() {
2486*0Sstevel@tonic-gate         boolean done = defaults.setAccountExpiryDate();
2487*0Sstevel@tonic-gate         glSetNeedSave();
2488*0Sstevel@tonic-gate         return done;
2489*0Sstevel@tonic-gate     }
2490*0Sstevel@tonic-gate 
2491*0Sstevel@tonic-gate     public boolean setServerSide() {
2492*0Sstevel@tonic-gate         boolean done = defaults.setServerSide();
2493*0Sstevel@tonic-gate         glSetNeedSave();
2494*0Sstevel@tonic-gate         return done;
2495*0Sstevel@tonic-gate     }
2496*0Sstevel@tonic-gate 
2497*0Sstevel@tonic-gate     public boolean setShowLists() {
2498*0Sstevel@tonic-gate         boolean done = defaults.setShowLists();
2499*0Sstevel@tonic-gate         glSetNeedSave();
2500*0Sstevel@tonic-gate         return done;
2501*0Sstevel@tonic-gate     }
2502*0Sstevel@tonic-gate 
2503*0Sstevel@tonic-gate     public boolean setStaticLists() {
2504*0Sstevel@tonic-gate         boolean done = defaults.setStaticLists();
2505*0Sstevel@tonic-gate         glSetNeedSave();
2506*0Sstevel@tonic-gate         return done;
2507*0Sstevel@tonic-gate     }
2508*0Sstevel@tonic-gate 
2509*0Sstevel@tonic-gate     public boolean setCacheTime() {
2510*0Sstevel@tonic-gate         boolean done = defaults.setCacheTime();
2511*0Sstevel@tonic-gate         glSetNeedSave();
2512*0Sstevel@tonic-gate         return done;
2513*0Sstevel@tonic-gate     }
2514*0Sstevel@tonic-gate 
2515*0Sstevel@tonic-gate     public void setGlobalFlag(int bitfield) {
2516*0Sstevel@tonic-gate         defaults.toggleFlag(bitfield);
2517*0Sstevel@tonic-gate         glSetNeedSave();
2518*0Sstevel@tonic-gate     }
2519*0Sstevel@tonic-gate 
2520*0Sstevel@tonic-gate     /*
2521*0Sstevel@tonic-gate      * Miscellany
2522*0Sstevel@tonic-gate      */
2523*0Sstevel@tonic-gate     public void printPrList() {
2524*0Sstevel@tonic-gate         String title = getString("Principal List");
2525*0Sstevel@tonic-gate         if (curPrPattern.length() > 0)
2526*0Sstevel@tonic-gate             title = title.concat(" (" + getString("Filter Pattern:") + " "
2527*0Sstevel@tonic-gate 				 + curPrPattern + ")");
2528*0Sstevel@tonic-gate         if (principalList == null)
2529*0Sstevel@tonic-gate             fillPrincipalList(curPrPattern);
2530*0Sstevel@tonic-gate         printList((TextList)gui.Prlist.getBody(), title);
2531*0Sstevel@tonic-gate     }
2532*0Sstevel@tonic-gate 
2533*0Sstevel@tonic-gate     public void printCurPr() {
2534*0Sstevel@tonic-gate         Principal toPrint;
2535*0Sstevel@tonic-gate 
2536*0Sstevel@tonic-gate         if (prin == null) {
2537*0Sstevel@tonic-gate             // We are viewing the principal list. Instantiate a new
2538*0Sstevel@tonic-gate             // principal using the current name.
2539*0Sstevel@tonic-gate             toPrint =  new Principal(Kadmin, CurPrincipal);
2540*0Sstevel@tonic-gate         } else {
2541*0Sstevel@tonic-gate             // We are in the middle of editing a principal. Update the
2542*0Sstevel@tonic-gate             // current principal object with the current contents of the
2543*0Sstevel@tonic-gate             // gui. It's ok for the password to be null, we are not printing
2544*0Sstevel@tonic-gate             // it anyway.
2545*0Sstevel@tonic-gate             if (!prUpdateFromGui(true))
2546*0Sstevel@tonic-gate                 return;
2547*0Sstevel@tonic-gate             toPrint = prin;
2548*0Sstevel@tonic-gate         }
2549*0Sstevel@tonic-gate 
2550*0Sstevel@tonic-gate         PrintUtil.dump(realMainFrame, toPrint);
2551*0Sstevel@tonic-gate     }
2552*0Sstevel@tonic-gate 
2553*0Sstevel@tonic-gate     public void printPoList() {
2554*0Sstevel@tonic-gate         String title = getString("Policy List");
2555*0Sstevel@tonic-gate         if (curPoPattern.length() > 0)
2556*0Sstevel@tonic-gate             title = title.concat(" (" + getString("Filter Pattern:") + " "
2557*0Sstevel@tonic-gate 				 + curPoPattern + ")");
2558*0Sstevel@tonic-gate         if (policyList == null)
2559*0Sstevel@tonic-gate             fillPolicyList(curPoPattern);
2560*0Sstevel@tonic-gate         printList((TextList)gui.Pollist.getBody(), title);
2561*0Sstevel@tonic-gate     }
2562*0Sstevel@tonic-gate 
2563*0Sstevel@tonic-gate     public void printCurPol() {
2564*0Sstevel@tonic-gate         Policy toPrint;
2565*0Sstevel@tonic-gate 
2566*0Sstevel@tonic-gate         if (pol == null) {
2567*0Sstevel@tonic-gate             // We are viewing the policy list. Instantiate a new
2568*0Sstevel@tonic-gate             // policy using the current name.
2569*0Sstevel@tonic-gate             toPrint = new Policy(Kadmin, CurPolicy);
2570*0Sstevel@tonic-gate         } else {
2571*0Sstevel@tonic-gate             // We are in the middle of editing a policy. Update the current
2572*0Sstevel@tonic-gate             // policy object with the current contents of the gui.
2573*0Sstevel@tonic-gate             if (!poUpdateFromGui())
2574*0Sstevel@tonic-gate                 return;
2575*0Sstevel@tonic-gate             toPrint = pol;
2576*0Sstevel@tonic-gate         }
2577*0Sstevel@tonic-gate 
2578*0Sstevel@tonic-gate         PrintUtil.dump(realMainFrame, toPrint);
2579*0Sstevel@tonic-gate 
2580*0Sstevel@tonic-gate     }
2581*0Sstevel@tonic-gate 
2582*0Sstevel@tonic-gate     private void printList(TextList guiList, String title) {
2583*0Sstevel@tonic-gate         String[] list = getItemsFromTextList(guiList);
2584*0Sstevel@tonic-gate         StringBuffer sb = new StringBuffer(title).append('\n');
2585*0Sstevel@tonic-gate 
2586*0Sstevel@tonic-gate         for (int i = 0; i < list.length; i++) {
2587*0Sstevel@tonic-gate             sb.append(list[i]).append('\n');
2588*0Sstevel@tonic-gate         }
2589*0Sstevel@tonic-gate 
2590*0Sstevel@tonic-gate         PrintUtil.dump(realMainFrame, sb);
2591*0Sstevel@tonic-gate     }
2592*0Sstevel@tonic-gate 
2593*0Sstevel@tonic-gate     public void showHelpBrowser(Frame frame) {
2594*0Sstevel@tonic-gate         try {
2595*0Sstevel@tonic-gate 
2596*0Sstevel@tonic-gate             File file = new File("/usr/dt/bin/sdtwebclient");
2597*0Sstevel@tonic-gate             if (!file.exists()) {
2598*0Sstevel@tonic-gate                 showDialog(frame, getString("Error"),
2599*0Sstevel@tonic-gate 			   getString("Can't run /usr/dt/bin/sdtwebclient."));
2600*0Sstevel@tonic-gate                 return;
2601*0Sstevel@tonic-gate             }
2602*0Sstevel@tonic-gate             String url = kc.getHelpURL();
2603*0Sstevel@tonic-gate             if (url == null)
2604*0Sstevel@tonic-gate                 url = helpIndexFile;
2605*0Sstevel@tonic-gate             URL help = new URL(url);
2606*0Sstevel@tonic-gate             InputStream is = null;
2607*0Sstevel@tonic-gate             try {
2608*0Sstevel@tonic-gate                 is = help.openStream();
2609*0Sstevel@tonic-gate             } catch (IOException e) {}
2610*0Sstevel@tonic-gate             if (is == null) {
2611*0Sstevel@tonic-gate                 showDialog(frame, getString("Error"),
2612*0Sstevel@tonic-gate 			   getString("Invalid URL: ")+url);
2613*0Sstevel@tonic-gate                 return;
2614*0Sstevel@tonic-gate             }
2615*0Sstevel@tonic-gate 
2616*0Sstevel@tonic-gate             if (browserProcess != null) {
2617*0Sstevel@tonic-gate                 // Will throw IllegalThreadStateException if thread not exited
2618*0Sstevel@tonic-gate                 // yet
2619*0Sstevel@tonic-gate                 int i = browserProcess.exitValue();
2620*0Sstevel@tonic-gate             }
2621*0Sstevel@tonic-gate 
2622*0Sstevel@tonic-gate             // Thread has exited or never existed
2623*0Sstevel@tonic-gate             browserProcess =
2624*0Sstevel@tonic-gate 		Runtime.getRuntime().exec("/usr/dt/bin/sdtwebclient" +url);
2625*0Sstevel@tonic-gate 
2626*0Sstevel@tonic-gate         } catch (IOException e) {
2627*0Sstevel@tonic-gate             showDialog(frame, getString("Error"), e.getMessage());
2628*0Sstevel@tonic-gate         } catch (IllegalThreadStateException e) {
2629*0Sstevel@tonic-gate             // Ok. All this mean is that a previous instance of the browser
2630*0Sstevel@tonic-gate             // exists
2631*0Sstevel@tonic-gate         }
2632*0Sstevel@tonic-gate     }
2633*0Sstevel@tonic-gate 
2634*0Sstevel@tonic-gate     private void killHelpBrowser() {
2635*0Sstevel@tonic-gate         if (browserProcess != null) {
2636*0Sstevel@tonic-gate             browserProcess.destroy();
2637*0Sstevel@tonic-gate         }
2638*0Sstevel@tonic-gate     }
2639*0Sstevel@tonic-gate 
2640*0Sstevel@tonic-gate     private void setupDefaultsEditingFrame() {
2641*0Sstevel@tonic-gate         defaultsEditingFrame = defaults.getEditingFrame();
2642*0Sstevel@tonic-gate         glSetCanSave(false);
2643*0Sstevel@tonic-gate         setupDefaultsNormalListeners();
2644*0Sstevel@tonic-gate         defaults.csHelp.addActionListener
2645*0Sstevel@tonic-gate 	    (new DefaultsContextSensitiveHelpListener());
2646*0Sstevel@tonic-gate     }
2647*0Sstevel@tonic-gate 
2648*0Sstevel@tonic-gate     public void editPreferences() {
2649*0Sstevel@tonic-gate         olddefaults = new Defaults(defaults);
2650*0Sstevel@tonic-gate         defaults.updateGuiComponents();
2651*0Sstevel@tonic-gate         defaultsEditingFrame.setVisible(true);
2652*0Sstevel@tonic-gate     }
2653*0Sstevel@tonic-gate 
2654*0Sstevel@tonic-gate     static Frame getFrame(Component c) {
2655*0Sstevel@tonic-gate         Frame frame = null;
2656*0Sstevel@tonic-gate 
2657*0Sstevel@tonic-gate         while ((c = c.getParent()) != null)
2658*0Sstevel@tonic-gate             if (c instanceof Frame)
2659*0Sstevel@tonic-gate 		frame = (Frame)c;
2660*0Sstevel@tonic-gate         return frame;
2661*0Sstevel@tonic-gate     }
2662*0Sstevel@tonic-gate 
2663*0Sstevel@tonic-gate     /**
2664*0Sstevel@tonic-gate      * General purpose dialog with title and a label settable
2665*0Sstevel@tonic-gate      */
2666*0Sstevel@tonic-gate     public void showDialog(Frame frame, String title, String text) {
2667*0Sstevel@tonic-gate         String[] lines = new String[1];
2668*0Sstevel@tonic-gate         lines[0] = text;
2669*0Sstevel@tonic-gate         String[] buttons = new String[1];
2670*0Sstevel@tonic-gate         buttons[0] = getString("OK");
2671*0Sstevel@tonic-gate         ChoiceDialog cd = new ChoiceDialog(frame, title, lines, buttons);
2672*0Sstevel@tonic-gate     }
2673*0Sstevel@tonic-gate 
2674*0Sstevel@tonic-gate     public void showLoginWarning(String err) {
2675*0Sstevel@tonic-gate         showDialog(realLoginFrame, getString("Warning"), err);
2676*0Sstevel@tonic-gate     }
2677*0Sstevel@tonic-gate 
2678*0Sstevel@tonic-gate     public void showLoginError(String err) {
2679*0Sstevel@tonic-gate         showDialog(realLoginFrame, getString("Error"), err);
2680*0Sstevel@tonic-gate     }
2681*0Sstevel@tonic-gate 
2682*0Sstevel@tonic-gate     public void showWarning(String err) {
2683*0Sstevel@tonic-gate         showDialog(realMainFrame, getString("Warning"), err);
2684*0Sstevel@tonic-gate     }
2685*0Sstevel@tonic-gate 
2686*0Sstevel@tonic-gate     public void showError(String err) {
2687*0Sstevel@tonic-gate         showDialog(realMainFrame, getString("Error"), err);
2688*0Sstevel@tonic-gate     }
2689*0Sstevel@tonic-gate 
2690*0Sstevel@tonic-gate     public static void showDataFormatError(TextField tf, int dataType) {
2691*0Sstevel@tonic-gate 
2692*0Sstevel@tonic-gate         Frame parent = getFrame(tf);
2693*0Sstevel@tonic-gate 
2694*0Sstevel@tonic-gate         tf.selectAll();
2695*0Sstevel@tonic-gate         toolkit.beep();
2696*0Sstevel@tonic-gate 
2697*0Sstevel@tonic-gate         String title = getString("Error");
2698*0Sstevel@tonic-gate 
2699*0Sstevel@tonic-gate         String[] lines = null;
2700*0Sstevel@tonic-gate         String[] buttons = {getString("OK")};
2701*0Sstevel@tonic-gate 
2702*0Sstevel@tonic-gate         switch (dataType) {
2703*0Sstevel@tonic-gate 	case DURATION_DATA:
2704*0Sstevel@tonic-gate             lines = durationErrorText;
2705*0Sstevel@tonic-gate             break;
2706*0Sstevel@tonic-gate 	case DATE_DATA:
2707*0Sstevel@tonic-gate             lines = dateErrorText;
2708*0Sstevel@tonic-gate             break;
2709*0Sstevel@tonic-gate 	case NUMBER_DATA:
2710*0Sstevel@tonic-gate             lines = numberErrorText;
2711*0Sstevel@tonic-gate             break;
2712*0Sstevel@tonic-gate         }
2713*0Sstevel@tonic-gate 
2714*0Sstevel@tonic-gate         Point p = tf.getLocationOnScreen();
2715*0Sstevel@tonic-gate         ChoiceDialog cd = new ChoiceDialog(parent, title, lines,
2716*0Sstevel@tonic-gate 					   buttons, p.x, p.y);
2717*0Sstevel@tonic-gate 
2718*0Sstevel@tonic-gate         tf.requestFocus();
2719*0Sstevel@tonic-gate 
2720*0Sstevel@tonic-gate     }
2721*0Sstevel@tonic-gate 
2722*0Sstevel@tonic-gate     /**
2723*0Sstevel@tonic-gate      * Confirm a destructive user action
2724*0Sstevel@tonic-gate      */
2725*0Sstevel@tonic-gate     public String confirmAction(Frame frame, String[] text) {
2726*0Sstevel@tonic-gate         String title = getString("Confirm Action");
2727*0Sstevel@tonic-gate         String[] buttons = new String[2];
2728*0Sstevel@tonic-gate         buttons[0] = getString("OK");
2729*0Sstevel@tonic-gate         buttons[1] = getString("Cancel");
2730*0Sstevel@tonic-gate         ChoiceDialog cd = new ChoiceDialog(frame, title, text, buttons);
2731*0Sstevel@tonic-gate         return (cd.getSelection() == null? getString("Cancel")
2732*0Sstevel@tonic-gate 		:cd.getSelection());
2733*0Sstevel@tonic-gate     }
2734*0Sstevel@tonic-gate 
2735*0Sstevel@tonic-gate     /**
2736*0Sstevel@tonic-gate      * Confirm a destructive user action, offering choice of saving
2737*0Sstevel@tonic-gate      */
2738*0Sstevel@tonic-gate     public String confirmSave(Frame frame, String[] text) {
2739*0Sstevel@tonic-gate         String title = getString("Confirm Action");
2740*0Sstevel@tonic-gate         String[] buttons = new String[3];
2741*0Sstevel@tonic-gate         buttons[0] = getString("Save");
2742*0Sstevel@tonic-gate         buttons[1] = getString("Discard");
2743*0Sstevel@tonic-gate         buttons[2] = getString("Cancel");
2744*0Sstevel@tonic-gate         ChoiceDialog cd = new ChoiceDialog(frame, title, text, buttons);
2745*0Sstevel@tonic-gate         return (cd.getSelection() == null? getString("Cancel")
2746*0Sstevel@tonic-gate 		: cd.getSelection());
2747*0Sstevel@tonic-gate     }
2748*0Sstevel@tonic-gate 
2749*0Sstevel@tonic-gate     /**
2750*0Sstevel@tonic-gate      * Show version info
2751*0Sstevel@tonic-gate      */
2752*0Sstevel@tonic-gate     public void doAbout(Frame frame) {
2753*0Sstevel@tonic-gate         String title = getString("About SEAM Adminstration Tool");
2754*0Sstevel@tonic-gate         String[] text = new String[7];
2755*0Sstevel@tonic-gate         text[0] = getString("Sun Enterprise Authentication"
2756*0Sstevel@tonic-gate 			    +" Mechanism Administration Tool");
2757*0Sstevel@tonic-gate         text[1] = System.getProperty("SEAM_VERS" /* NOI18N */);
2758*0Sstevel@tonic-gate         text[2] = getString("Copyright 1999-2002 Sun Microsystems, Inc.");
2759*0Sstevel@tonic-gate         text[3] = getString("All Rights Reserved.");
2760*0Sstevel@tonic-gate         text[4] = System.getProperty("os.name" /* NOI18N */);
2761*0Sstevel@tonic-gate         text[5] = System.getProperty("os.arch" /* NOI18N */);
2762*0Sstevel@tonic-gate         text[6] = System.getProperty("os.version" /* NOI18N */);
2763*0Sstevel@tonic-gate         String[] button = new String[1];
2764*0Sstevel@tonic-gate         button[0] = getString("Dismiss");
2765*0Sstevel@tonic-gate         ChoiceDialog cd = new ChoiceDialog(frame, title, text, button);
2766*0Sstevel@tonic-gate     }
2767*0Sstevel@tonic-gate 
2768*0Sstevel@tonic-gate     private void getDateTimeFromDialogBox(TextField tf, Frame frame) {
2769*0Sstevel@tonic-gate         tf.select(0, 0);
2770*0Sstevel@tonic-gate         dateTimeDialog = new DateTimeDialog(frame, tf.getBackground(),
2771*0Sstevel@tonic-gate 					    tf.getForeground());
2772*0Sstevel@tonic-gate 
2773*0Sstevel@tonic-gate         if (!tf.getText().equalsIgnoreCase(neverString)) {
2774*0Sstevel@tonic-gate             try {
2775*0Sstevel@tonic-gate                 Date currVal = df.parse(tf.getText());
2776*0Sstevel@tonic-gate                 dateTimeDialog.setDate(currVal);
2777*0Sstevel@tonic-gate                 /*
2778*0Sstevel@tonic-gate                  * In case an exception occurs, let the dialog box be
2779*0Sstevel@tonic-gate                  * initialized to its default date (viz current time).
2780*0Sstevel@tonic-gate                  */
2781*0Sstevel@tonic-gate             } catch (ParseException e) {
2782*0Sstevel@tonic-gate             } catch (NullPointerException e) {
2783*0Sstevel@tonic-gate                 // gets thrown when parse string begins with text
2784*0Sstevel@tonic-gate                 // probable JDK bug
2785*0Sstevel@tonic-gate             }
2786*0Sstevel@tonic-gate             catch (StringIndexOutOfBoundsException e) {
2787*0Sstevel@tonic-gate                 // gets thrown when parse string contains only one number
2788*0Sstevel@tonic-gate                 // probable JDK bug
2789*0Sstevel@tonic-gate             }
2790*0Sstevel@tonic-gate         }
2791*0Sstevel@tonic-gate         dateTimeDialog.setVisible(true);
2792*0Sstevel@tonic-gate 
2793*0Sstevel@tonic-gate         // Modal dialog box so this is after dialog box disappers
2794*0Sstevel@tonic-gate         if (dateTimeDialog.isSaved()) {
2795*0Sstevel@tonic-gate             tf.setText(dateTimeDialog.toString());
2796*0Sstevel@tonic-gate             tf.dispatchEvent(new ActionEvent(tf, ActionEvent.ACTION_PERFORMED,
2797*0Sstevel@tonic-gate 				     "setFromDateTimeDialog" /* NOI18N */));
2798*0Sstevel@tonic-gate         }
2799*0Sstevel@tonic-gate     }
2800*0Sstevel@tonic-gate 
2801*0Sstevel@tonic-gate     private void getDurationFromDialogBox(TextField tf, Frame frame) {
2802*0Sstevel@tonic-gate         tf.select(0, 0);
2803*0Sstevel@tonic-gate         durationHelper = new DurationHelper(frame, tf.getBackground(),
2804*0Sstevel@tonic-gate 					    tf.getForeground());
2805*0Sstevel@tonic-gate         durationHelper.setVisible(true);
2806*0Sstevel@tonic-gate 
2807*0Sstevel@tonic-gate         // Modal dialog box so this is after dialog box disappers
2808*0Sstevel@tonic-gate         if (durationHelper.isSaved()) {
2809*0Sstevel@tonic-gate             tf.setText(durationHelper.toString());
2810*0Sstevel@tonic-gate             tf.dispatchEvent(new ActionEvent(tf, ActionEvent.ACTION_PERFORMED,
2811*0Sstevel@tonic-gate 				     "setFromDurationHelper" /* NOI18N */));
2812*0Sstevel@tonic-gate         }
2813*0Sstevel@tonic-gate     }
2814*0Sstevel@tonic-gate 
2815*0Sstevel@tonic-gate     /**
2816*0Sstevel@tonic-gate      * By going into context-sensitive help mode, normal listeners will
2817*0Sstevel@tonic-gate      * be removed and replaced with help listeners, so that help will
2818*0Sstevel@tonic-gate      * be shown for the object.
2819*0Sstevel@tonic-gate      *
2820*0Sstevel@tonic-gate      */
2821*0Sstevel@tonic-gate     public void contextHelp(Frame frame) {
2822*0Sstevel@tonic-gate 
2823*0Sstevel@tonic-gate         if (cHelp == null) {
2824*0Sstevel@tonic-gate             cHelp = new ContextHelp(frame, this);
2825*0Sstevel@tonic-gate             cHelp.setVisible(true);
2826*0Sstevel@tonic-gate         }
2827*0Sstevel@tonic-gate 
2828*0Sstevel@tonic-gate         if (frame == realLoginFrame)
2829*0Sstevel@tonic-gate             setupLoginHelpListeners();
2830*0Sstevel@tonic-gate         else if (frame == realMainFrame)
2831*0Sstevel@tonic-gate             setupMainHelpListeners();
2832*0Sstevel@tonic-gate         else if (frame == defaultsEditingFrame)
2833*0Sstevel@tonic-gate             setupDefaultsHelpListeners();
2834*0Sstevel@tonic-gate 
2835*0Sstevel@tonic-gate         frame.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
2836*0Sstevel@tonic-gate     }
2837*0Sstevel@tonic-gate 
2838*0Sstevel@tonic-gate 
2839*0Sstevel@tonic-gate     /**
2840*0Sstevel@tonic-gate      * Enables the print menu for printing principal related info.
2841*0Sstevel@tonic-gate      */
2842*0Sstevel@tonic-gate     private void enablePrincipalPrinting() {
2843*0Sstevel@tonic-gate         ((MenuItem)gui.PrintCurPr.getBody()).setEnabled(true);
2844*0Sstevel@tonic-gate     }
2845*0Sstevel@tonic-gate 
2846*0Sstevel@tonic-gate     /**
2847*0Sstevel@tonic-gate      * Enables the print menu for printing policy related info.
2848*0Sstevel@tonic-gate      */
2849*0Sstevel@tonic-gate     private void enablePolicyPrinting() {
2850*0Sstevel@tonic-gate         ((MenuItem)gui.PrintCurPol.getBody()).setEnabled(true);
2851*0Sstevel@tonic-gate     }
2852*0Sstevel@tonic-gate 
2853*0Sstevel@tonic-gate     /**
2854*0Sstevel@tonic-gate      * Disables the print menu for printing principal related info.
2855*0Sstevel@tonic-gate      */
2856*0Sstevel@tonic-gate     private void disablePrincipalPrinting() {
2857*0Sstevel@tonic-gate         ((MenuItem)gui.PrintCurPr.getBody()).setEnabled(false);
2858*0Sstevel@tonic-gate     }
2859*0Sstevel@tonic-gate 
2860*0Sstevel@tonic-gate     /**
2861*0Sstevel@tonic-gate      * Disables the print menu for printing policy related info.
2862*0Sstevel@tonic-gate      */
2863*0Sstevel@tonic-gate     private void disablePolicyPrinting() {
2864*0Sstevel@tonic-gate         ((MenuItem)gui.PrintCurPol.getBody()).setEnabled(false);
2865*0Sstevel@tonic-gate     }
2866*0Sstevel@tonic-gate 
2867*0Sstevel@tonic-gate     /**
2868*0Sstevel@tonic-gate      * Set up the listeners for the objects on the login screen in normal mode
2869*0Sstevel@tonic-gate      *
2870*0Sstevel@tonic-gate      */
2871*0Sstevel@tonic-gate     public void setupLoginNormalListeners() {
2872*0Sstevel@tonic-gate         if (LoginNormal == null) {
2873*0Sstevel@tonic-gate             LoginNormal = new Vector(10, 10);
2874*0Sstevel@tonic-gate             ActionListener al;
2875*0Sstevel@tonic-gate             Association a;
2876*0Sstevel@tonic-gate             Object o;
2877*0Sstevel@tonic-gate 
2878*0Sstevel@tonic-gate             al = new LoginNameAction();
2879*0Sstevel@tonic-gate             o = gui.LoginName.getBody();
2880*0Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
2881*0Sstevel@tonic-gate             LoginNormal.addElement(a);
2882*0Sstevel@tonic-gate 
2883*0Sstevel@tonic-gate             al = new LoginPassAction();
2884*0Sstevel@tonic-gate             o = gui.LoginPass.getBody();
2885*0Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
2886*0Sstevel@tonic-gate             LoginNormal.addElement(a);
2887*0Sstevel@tonic-gate 
2888*0Sstevel@tonic-gate             al = new LoginRealmAction();
2889*0Sstevel@tonic-gate             o = gui.LoginRealm.getBody();
2890*0Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
2891*0Sstevel@tonic-gate             LoginNormal.addElement(a);
2892*0Sstevel@tonic-gate 
2893*0Sstevel@tonic-gate             al = new LoginServerAction();
2894*0Sstevel@tonic-gate             o = gui.LoginServer.getBody();
2895*0Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
2896*0Sstevel@tonic-gate             LoginNormal.addElement(a);
2897*0Sstevel@tonic-gate 
2898*0Sstevel@tonic-gate             al = new LoginOKAction();
2899*0Sstevel@tonic-gate             o = gui.LoginOK.getBody();
2900*0Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
2901*0Sstevel@tonic-gate             LoginNormal.addElement(a);
2902*0Sstevel@tonic-gate 
2903*0Sstevel@tonic-gate             al = new LoginStartOverAction();
2904*0Sstevel@tonic-gate             o = gui.LoginStartOver.getBody();
2905*0Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
2906*0Sstevel@tonic-gate             LoginNormal.addElement(a);
2907*0Sstevel@tonic-gate         }
2908*0Sstevel@tonic-gate         setListeners(LoginHelp, false);
2909*0Sstevel@tonic-gate         setListeners(LoginFixers, false);
2910*0Sstevel@tonic-gate         setListeners(LoginNormal, true);
2911*0Sstevel@tonic-gate         loginHelpMode = false;
2912*0Sstevel@tonic-gate     }
2913*0Sstevel@tonic-gate 
2914*0Sstevel@tonic-gate     /**
2915*0Sstevel@tonic-gate      * Set up the listeners for the objects on the login screen in help mode
2916*0Sstevel@tonic-gate      *
2917*0Sstevel@tonic-gate      */
2918*0Sstevel@tonic-gate     public void setupLoginHelpListeners() {
2919*0Sstevel@tonic-gate         if (LoginHelp == null) {
2920*0Sstevel@tonic-gate             LoginHelp = new Vector(10, 10);
2921*0Sstevel@tonic-gate             MouseListener ml = new HelpListener();
2922*0Sstevel@tonic-gate             Association a;
2923*0Sstevel@tonic-gate             Object o;
2924*0Sstevel@tonic-gate 
2925*0Sstevel@tonic-gate             o = gui.LoginName.getBody();
2926*0Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
2927*0Sstevel@tonic-gate             LoginHelp.addElement(a);
2928*0Sstevel@tonic-gate             ((TextField)o).setName("LoginName" /* NOI18N */);
2929*0Sstevel@tonic-gate 
2930*0Sstevel@tonic-gate             o = gui.LoginNameLabel.getBody();
2931*0Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
2932*0Sstevel@tonic-gate             LoginHelp.addElement(a);
2933*0Sstevel@tonic-gate             ((Label)o).setName("LoginName" /* NOI18N */);
2934*0Sstevel@tonic-gate 
2935*0Sstevel@tonic-gate             o = gui.LoginPass.getBody();
2936*0Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
2937*0Sstevel@tonic-gate             LoginHelp.addElement(a);
2938*0Sstevel@tonic-gate             ((TextField)o).setName("LoginPass" /* NOI18N */);
2939*0Sstevel@tonic-gate 
2940*0Sstevel@tonic-gate             o = gui.LoginPassLabel.getBody();
2941*0Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
2942*0Sstevel@tonic-gate             LoginHelp.addElement(a);
2943*0Sstevel@tonic-gate             ((Label)o).setName("LoginPass" /* NOI18N */);
2944*0Sstevel@tonic-gate 
2945*0Sstevel@tonic-gate             o = gui.LoginRealm.getBody();
2946*0Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
2947*0Sstevel@tonic-gate             LoginHelp.addElement(a);
2948*0Sstevel@tonic-gate             ((TextField)o).setName("LoginRealm" /* NOI18N */);
2949*0Sstevel@tonic-gate 
2950*0Sstevel@tonic-gate             o = gui.LoginRealmLabel.getBody();
2951*0Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
2952*0Sstevel@tonic-gate             LoginHelp.addElement(a);
2953*0Sstevel@tonic-gate             ((Label)o).setName("LoginRealm" /* NOI18N */);
2954*0Sstevel@tonic-gate 
2955*0Sstevel@tonic-gate             o = gui.LoginServer.getBody();
2956*0Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
2957*0Sstevel@tonic-gate             LoginHelp.addElement(a);
2958*0Sstevel@tonic-gate             ((TextField)o).setName("LoginServer" /* NOI18N */);
2959*0Sstevel@tonic-gate 
2960*0Sstevel@tonic-gate             o = gui.LoginServerLabel.getBody();
2961*0Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
2962*0Sstevel@tonic-gate             LoginHelp.addElement(a);
2963*0Sstevel@tonic-gate             ((Label)o).setName("LoginServer" /* NOI18N */);
2964*0Sstevel@tonic-gate 
2965*0Sstevel@tonic-gate             o = gui.LoginOK.getBody();
2966*0Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
2967*0Sstevel@tonic-gate             LoginHelp.addElement(a);
2968*0Sstevel@tonic-gate             ((Button)o).setName("LoginOK" /* NOI18N */);
2969*0Sstevel@tonic-gate 
2970*0Sstevel@tonic-gate             o = gui.LoginStartOver.getBody();
2971*0Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
2972*0Sstevel@tonic-gate             LoginHelp.addElement(a);
2973*0Sstevel@tonic-gate             ((Button)o).setName("LoginStartOver" /* NOI18N */);
2974*0Sstevel@tonic-gate         }
2975*0Sstevel@tonic-gate         setListeners(LoginNormal, false);
2976*0Sstevel@tonic-gate         setListeners(LoginHelp, true);
2977*0Sstevel@tonic-gate         setupLoginHelpFixers();
2978*0Sstevel@tonic-gate         loginHelpMode = true;
2979*0Sstevel@tonic-gate     }
2980*0Sstevel@tonic-gate 
2981*0Sstevel@tonic-gate     public void setupLoginHelpFixers() {
2982*0Sstevel@tonic-gate         LoginFixers = new Vector(10, 10);
2983*0Sstevel@tonic-gate         Object o;
2984*0Sstevel@tonic-gate         Association a;
2985*0Sstevel@tonic-gate         TextFixer tf;
2986*0Sstevel@tonic-gate 
2987*0Sstevel@tonic-gate         o = gui.LoginName.getBody();
2988*0Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
2989*0Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
2990*0Sstevel@tonic-gate         LoginFixers.addElement(a);
2991*0Sstevel@tonic-gate 
2992*0Sstevel@tonic-gate         o = gui.LoginPass.getBody();
2993*0Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
2994*0Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
2995*0Sstevel@tonic-gate         LoginFixers.addElement(a);
2996*0Sstevel@tonic-gate 
2997*0Sstevel@tonic-gate         o = gui.LoginRealm.getBody();
2998*0Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
2999*0Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
3000*0Sstevel@tonic-gate         LoginFixers.addElement(a);
3001*0Sstevel@tonic-gate 
3002*0Sstevel@tonic-gate         o = gui.LoginServer.getBody();
3003*0Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
3004*0Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
3005*0Sstevel@tonic-gate         LoginFixers.addElement(a);
3006*0Sstevel@tonic-gate 
3007*0Sstevel@tonic-gate         setListeners(LoginFixers, true);
3008*0Sstevel@tonic-gate     }
3009*0Sstevel@tonic-gate 
3010*0Sstevel@tonic-gate     /**
3011*0Sstevel@tonic-gate      * Set up the listeners for the objects on the main screen in normal mode
3012*0Sstevel@tonic-gate      *
3013*0Sstevel@tonic-gate      */
3014*0Sstevel@tonic-gate     public void setupMainNormalListeners() {
3015*0Sstevel@tonic-gate         if (MainNormal == null) {
3016*0Sstevel@tonic-gate             Frame fr = realMainFrame;
3017*0Sstevel@tonic-gate             MainNormal = new Vector(10, 10);
3018*0Sstevel@tonic-gate             ActionListener al;
3019*0Sstevel@tonic-gate             ItemListener il;
3020*0Sstevel@tonic-gate             DateTimeListener dtl;
3021*0Sstevel@tonic-gate             DurationListener dl;
3022*0Sstevel@tonic-gate             KeyListener kl1 = new KeystrokeDetector(PRINCIPAL_EDITING);
3023*0Sstevel@tonic-gate             KeyListener kl2 = new KeystrokeDetector(POLICY_EDITING);
3024*0Sstevel@tonic-gate             KeyListener kl3 = new KeystrokeDetector(PRINCIPAL_LIST);
3025*0Sstevel@tonic-gate             KeyListener kl4 = new KeystrokeDetector(POLICY_LIST);
3026*0Sstevel@tonic-gate             Association a;
3027*0Sstevel@tonic-gate             Object o;
3028*0Sstevel@tonic-gate 
3029*0Sstevel@tonic-gate             WindowListener wl = new MainWindowCloseAction();
3030*0Sstevel@tonic-gate             o = realMainFrame;
3031*0Sstevel@tonic-gate             a = new Association(o, wl, WINDOW_LISTENER);
3032*0Sstevel@tonic-gate             MainNormal.addElement(a);
3033*0Sstevel@tonic-gate 
3034*0Sstevel@tonic-gate             al = new PrListPatternAction();
3035*0Sstevel@tonic-gate             o = gui.PrListPattern.getBody();
3036*0Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
3037*0Sstevel@tonic-gate             MainNormal.addElement(a);
3038*0Sstevel@tonic-gate             a = new Association(o, kl3, TEXTFIELD_KEY);
3039*0Sstevel@tonic-gate             MainNormal.addElement(a);
3040*0Sstevel@tonic-gate 
3041*0Sstevel@tonic-gate             al = new PrListClearAction();
3042*0Sstevel@tonic-gate             o = gui.PrListClear.getBody();
3043*0Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
3044*0Sstevel@tonic-gate             MainNormal.addElement(a);
3045*0Sstevel@tonic-gate 
3046*0Sstevel@tonic-gate             al = new PrListModifyAction();
3047*0Sstevel@tonic-gate             o = gui.PrListModify.getBody();
3048*0Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
3049*0Sstevel@tonic-gate             MainNormal.addElement(a);
3050*0Sstevel@tonic-gate 
3051*0Sstevel@tonic-gate             al = new PrListAddAction();
3052*0Sstevel@tonic-gate             o = gui.PrListAdd.getBody();
3053*0Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
3054*0Sstevel@tonic-gate             MainNormal.addElement(a);
3055*0Sstevel@tonic-gate 
3056*0Sstevel@tonic-gate             al = new PrListDeleteAction();
3057*0Sstevel@tonic-gate             o = gui.PrListDelete.getBody();
3058*0Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
3059*0Sstevel@tonic-gate             MainNormal.addElement(a);
3060*0Sstevel@tonic-gate 
3061*0Sstevel@tonic-gate             al = new PrListDuplicateAction();
3062*0Sstevel@tonic-gate             o = gui.PrListDuplicate.getBody();
3063*0Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
3064*0Sstevel@tonic-gate             MainNormal.addElement(a);
3065*0Sstevel@tonic-gate 
3066*0Sstevel@tonic-gate             al = new PrSaveAction();
3067*0Sstevel@tonic-gate             o = gui.PrBasicSave.getBody();
3068*0Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
3069*0Sstevel@tonic-gate             MainNormal.addElement(a);
3070*0Sstevel@tonic-gate             o = gui.PrDetailSave.getBody();
3071*0Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
3072*0Sstevel@tonic-gate             MainNormal.addElement(a);
3073*0Sstevel@tonic-gate             o = gui.PrFlagsSave.getBody();
3074*0Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
3075*0Sstevel@tonic-gate             MainNormal.addElement(a);
3076*0Sstevel@tonic-gate 
3077*0Sstevel@tonic-gate             al = new PrCancelAction();
3078*0Sstevel@tonic-gate             o = gui.PrBasicCancel.getBody();
3079*0Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
3080*0Sstevel@tonic-gate             MainNormal.addElement(a);
3081*0Sstevel@tonic-gate             o = gui.PrDetailCancel.getBody();
3082*0Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
3083*0Sstevel@tonic-gate             MainNormal.addElement(a);
3084*0Sstevel@tonic-gate             o = gui.PrFlagsCancel.getBody();
3085*0Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
3086*0Sstevel@tonic-gate             MainNormal.addElement(a);
3087*0Sstevel@tonic-gate 
3088*0Sstevel@tonic-gate             al = new PrCommentsAction();
3089*0Sstevel@tonic-gate             o = gui.PrComments.getBody();
3090*0Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
3091*0Sstevel@tonic-gate             MainNormal.addElement(a);
3092*0Sstevel@tonic-gate             a = new Association(o, kl1, TEXTFIELD_KEY);
3093*0Sstevel@tonic-gate             MainNormal.addElement(a);
3094*0Sstevel@tonic-gate 
3095*0Sstevel@tonic-gate             il = new PrPolicyAction();
3096*0Sstevel@tonic-gate             o = gui.PrPolicy.getBody();
3097*0Sstevel@tonic-gate             a = new Association(o, il, CHOICE_ITEM);
3098*0Sstevel@tonic-gate             MainNormal.addElement(a);
3099*0Sstevel@tonic-gate 
3100*0Sstevel@tonic-gate             al = new PrPasswordAction();
3101*0Sstevel@tonic-gate             o = gui.PrPassword.getBody();
3102*0Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
3103*0Sstevel@tonic-gate             MainNormal.addElement(a);
3104*0Sstevel@tonic-gate             a = new Association(o, kl1, TEXTFIELD_KEY);
3105*0Sstevel@tonic-gate             MainNormal.addElement(a);
3106*0Sstevel@tonic-gate 
3107*0Sstevel@tonic-gate             al = new PrRandomPwAction();
3108*0Sstevel@tonic-gate             o = gui.PrBasicRandomPw.getBody();
3109*0Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
3110*0Sstevel@tonic-gate             MainNormal.addElement(a);
3111*0Sstevel@tonic-gate 
3112*0Sstevel@tonic-gate             al = new PrExpiryAction();
3113*0Sstevel@tonic-gate             o = gui.PrExpiry.getBody();
3114*0Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
3115*0Sstevel@tonic-gate             MainNormal.addElement(a);
3116*0Sstevel@tonic-gate             a = new Association(o, kl1, TEXTFIELD_KEY);
3117*0Sstevel@tonic-gate             MainNormal.addElement(a);
3118*0Sstevel@tonic-gate 
3119*0Sstevel@tonic-gate             dtl = new DateTimeListener((TextField)gui.PrExpiry.getBody(), fr);
3120*0Sstevel@tonic-gate             o = gui.PrExpiryMoreButton.getBody();
3121*0Sstevel@tonic-gate             a = new Association(o, dtl, BUTTON_ACTION);
3122*0Sstevel@tonic-gate             MainNormal.addElement(a);
3123*0Sstevel@tonic-gate 
3124*0Sstevel@tonic-gate             al = new PrBasicPreviousAction();
3125*0Sstevel@tonic-gate             o = gui.PrBasicPrevious.getBody();
3126*0Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
3127*0Sstevel@tonic-gate             MainNormal.addElement(a);
3128*0Sstevel@tonic-gate 
3129*0Sstevel@tonic-gate             al = new PrBasicNextAction();
3130*0Sstevel@tonic-gate             o = gui.PrBasicNext.getBody();
3131*0Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
3132*0Sstevel@tonic-gate             MainNormal.addElement(a);
3133*0Sstevel@tonic-gate 
3134*0Sstevel@tonic-gate             al = new PrPwExpiryAction();
3135*0Sstevel@tonic-gate             o = gui.PrPwExpiry.getBody();
3136*0Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
3137*0Sstevel@tonic-gate             MainNormal.addElement(a);
3138*0Sstevel@tonic-gate             a = new Association(o, kl1, TEXTFIELD_KEY);
3139*0Sstevel@tonic-gate             MainNormal.addElement(a);
3140*0Sstevel@tonic-gate 
3141*0Sstevel@tonic-gate             dtl = new DateTimeListener((TextField)gui.PrPwExpiry.getBody(), fr);
3142*0Sstevel@tonic-gate             o = gui.PrPwExpiryMoreButton.getBody();
3143*0Sstevel@tonic-gate             a = new Association(o, dtl, BUTTON_ACTION);
3144*0Sstevel@tonic-gate             MainNormal.addElement(a);
3145*0Sstevel@tonic-gate 
3146*0Sstevel@tonic-gate             al = new PrKvnoAction();
3147*0Sstevel@tonic-gate             o = gui.PrKvno.getBody();
3148*0Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
3149*0Sstevel@tonic-gate             MainNormal.addElement(a);
3150*0Sstevel@tonic-gate             a = new Association(o, kl1, TEXTFIELD_KEY);
3151*0Sstevel@tonic-gate             MainNormal.addElement(a);
3152*0Sstevel@tonic-gate 
3153*0Sstevel@tonic-gate             al = new PrMaxLifetimeAction();
3154*0Sstevel@tonic-gate             o = gui.PrMaxLifetime.getBody();
3155*0Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
3156*0Sstevel@tonic-gate             MainNormal.addElement(a);
3157*0Sstevel@tonic-gate             a = new Association(o, kl1, TEXTFIELD_KEY);
3158*0Sstevel@tonic-gate             MainNormal.addElement(a);
3159*0Sstevel@tonic-gate 
3160*0Sstevel@tonic-gate             dl = new DurationListener((TextField)gui.PrMaxLifetime.getBody(),
3161*0Sstevel@tonic-gate 				      fr);
3162*0Sstevel@tonic-gate             o = gui.PrMaxLifetimeMoreButton.getBody();
3163*0Sstevel@tonic-gate             a = new Association(o, dl, BUTTON_ACTION);
3164*0Sstevel@tonic-gate             MainNormal.addElement(a);
3165*0Sstevel@tonic-gate 
3166*0Sstevel@tonic-gate             al = new PrMaxRenewalAction();
3167*0Sstevel@tonic-gate             o = gui.PrMaxRenewal.getBody();
3168*0Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
3169*0Sstevel@tonic-gate             MainNormal.addElement(a);
3170*0Sstevel@tonic-gate             a = new Association(o, kl1, TEXTFIELD_KEY);
3171*0Sstevel@tonic-gate             MainNormal.addElement(a);
3172*0Sstevel@tonic-gate 
3173*0Sstevel@tonic-gate             dl = new DurationListener((TextField)gui.PrMaxRenewal.getBody(),
3174*0Sstevel@tonic-gate 				      fr);
3175*0Sstevel@tonic-gate             o = gui.PrMaxRenewalMoreButton.getBody();
3176*0Sstevel@tonic-gate             a = new Association(o, dl, BUTTON_ACTION);
3177*0Sstevel@tonic-gate             MainNormal.addElement(a);
3178*0Sstevel@tonic-gate 
3179*0Sstevel@tonic-gate             al = new PrDetailPreviousAction();
3180*0Sstevel@tonic-gate             o = gui.PrDetailPrevious.getBody();
3181*0Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
3182*0Sstevel@tonic-gate             MainNormal.addElement(a);
3183*0Sstevel@tonic-gate 
3184*0Sstevel@tonic-gate             al = new PrDetailNextAction();
3185*0Sstevel@tonic-gate             o = gui.PrDetailNext.getBody();
3186*0Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
3187*0Sstevel@tonic-gate             MainNormal.addElement(a);
3188*0Sstevel@tonic-gate 
3189*0Sstevel@tonic-gate             al = new PrFlagsPreviousAction();
3190*0Sstevel@tonic-gate             o = gui.PrFlagsPrevious.getBody();
3191*0Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
3192*0Sstevel@tonic-gate             MainNormal.addElement(a);
3193*0Sstevel@tonic-gate 
3194*0Sstevel@tonic-gate             al = new PrFlagsNextAction();
3195*0Sstevel@tonic-gate             o = gui.PrFlagsNext.getBody();
3196*0Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
3197*0Sstevel@tonic-gate             MainNormal.addElement(a);
3198*0Sstevel@tonic-gate 
3199*0Sstevel@tonic-gate             il = new PrLockAcctAction();
3200*0Sstevel@tonic-gate             o = gui.PrLockAcct.getBody();
3201*0Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
3202*0Sstevel@tonic-gate             MainNormal.addElement(a);
3203*0Sstevel@tonic-gate 
3204*0Sstevel@tonic-gate             il = new PrForcePwChangeAction();
3205*0Sstevel@tonic-gate             o = gui.PrForcePwChange.getBody();
3206*0Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
3207*0Sstevel@tonic-gate             MainNormal.addElement(a);
3208*0Sstevel@tonic-gate 
3209*0Sstevel@tonic-gate             il = new PrAllowPostdatedAction();
3210*0Sstevel@tonic-gate             o = gui.PrAllowPostdated.getBody();
3211*0Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
3212*0Sstevel@tonic-gate             MainNormal.addElement(a);
3213*0Sstevel@tonic-gate 
3214*0Sstevel@tonic-gate             il = new PrAllowForwardableAction();
3215*0Sstevel@tonic-gate             o = gui.PrAllowForwardable.getBody();
3216*0Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
3217*0Sstevel@tonic-gate             MainNormal.addElement(a);
3218*0Sstevel@tonic-gate 
3219*0Sstevel@tonic-gate             il = new PrAllowRenewableAction();
3220*0Sstevel@tonic-gate             o = gui.PrAllowRenewable.getBody();
3221*0Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
3222*0Sstevel@tonic-gate             MainNormal.addElement(a);
3223*0Sstevel@tonic-gate 
3224*0Sstevel@tonic-gate             il = new PrAllowProxiableAction();
3225*0Sstevel@tonic-gate             o = gui.PrAllowProxiable.getBody();
3226*0Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
3227*0Sstevel@tonic-gate             MainNormal.addElement(a);
3228*0Sstevel@tonic-gate 
3229*0Sstevel@tonic-gate             il = new PrAllowSvrAction();
3230*0Sstevel@tonic-gate             o = gui.PrAllowSvr.getBody();
3231*0Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
3232*0Sstevel@tonic-gate             MainNormal.addElement(a);
3233*0Sstevel@tonic-gate 
3234*0Sstevel@tonic-gate             il = new PrAllowTGTAction();
3235*0Sstevel@tonic-gate             o = gui.PrAllowTGT.getBody();
3236*0Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
3237*0Sstevel@tonic-gate             MainNormal.addElement(a);
3238*0Sstevel@tonic-gate 
3239*0Sstevel@tonic-gate             il = new PrAllowDupAuthAction();
3240*0Sstevel@tonic-gate             o = gui.PrAllowDupAuth.getBody();
3241*0Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
3242*0Sstevel@tonic-gate             MainNormal.addElement(a);
3243*0Sstevel@tonic-gate 
3244*0Sstevel@tonic-gate             il = new PrRequirePreAuthAction();
3245*0Sstevel@tonic-gate             o = gui.PrRequirePreAuth.getBody();
3246*0Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
3247*0Sstevel@tonic-gate             MainNormal.addElement(a);
3248*0Sstevel@tonic-gate 
3249*0Sstevel@tonic-gate             il = new PrRequireHwPreAuthAction();
3250*0Sstevel@tonic-gate             o = gui.PrRequireHwPreAuth.getBody();
3251*0Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
3252*0Sstevel@tonic-gate             MainNormal.addElement(a);
3253*0Sstevel@tonic-gate 
3254*0Sstevel@tonic-gate             al = new PoListPatternAction();
3255*0Sstevel@tonic-gate             o = gui.PoListPattern.getBody();
3256*0Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
3257*0Sstevel@tonic-gate             MainNormal.addElement(a);
3258*0Sstevel@tonic-gate             a = new Association(o, kl4, TEXTFIELD_KEY);
3259*0Sstevel@tonic-gate             MainNormal.addElement(a);
3260*0Sstevel@tonic-gate 
3261*0Sstevel@tonic-gate             al = new PoListClearAction();
3262*0Sstevel@tonic-gate             o = gui.PoListClear.getBody();
3263*0Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
3264*0Sstevel@tonic-gate             MainNormal.addElement(a);
3265*0Sstevel@tonic-gate 
3266*0Sstevel@tonic-gate             al = new PoListModifyAction();
3267*0Sstevel@tonic-gate             o = gui.PoListModify.getBody();
3268*0Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
3269*0Sstevel@tonic-gate             MainNormal.addElement(a);
3270*0Sstevel@tonic-gate 
3271*0Sstevel@tonic-gate             al = new PoListAddAction();
3272*0Sstevel@tonic-gate             o = gui.PoListAdd.getBody();
3273*0Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
3274*0Sstevel@tonic-gate             MainNormal.addElement(a);
3275*0Sstevel@tonic-gate 
3276*0Sstevel@tonic-gate             al = new PoListDeleteAction();
3277*0Sstevel@tonic-gate             o = gui.PoListDelete.getBody();
3278*0Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
3279*0Sstevel@tonic-gate             MainNormal.addElement(a);
3280*0Sstevel@tonic-gate 
3281*0Sstevel@tonic-gate             al = new PoListDuplicateAction();
3282*0Sstevel@tonic-gate             o = gui.PoListDuplicate.getBody();
3283*0Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
3284*0Sstevel@tonic-gate             MainNormal.addElement(a);
3285*0Sstevel@tonic-gate 
3286*0Sstevel@tonic-gate             il = new PoMinPwLengthAction();
3287*0Sstevel@tonic-gate             o = gui.PoMinPwLength.getBody();
3288*0Sstevel@tonic-gate             a = new Association(o, il, CHOICE_ITEM);
3289*0Sstevel@tonic-gate             MainNormal.addElement(a);
3290*0Sstevel@tonic-gate 
3291*0Sstevel@tonic-gate             il = new PoMinPwClassAction();
3292*0Sstevel@tonic-gate             o = gui.PoMinPwClass.getBody();
3293*0Sstevel@tonic-gate             a = new Association(o, il, CHOICE_ITEM);
3294*0Sstevel@tonic-gate             MainNormal.addElement(a);
3295*0Sstevel@tonic-gate 
3296*0Sstevel@tonic-gate             il = new PoSavedPasswordsAction();
3297*0Sstevel@tonic-gate             o = gui.PoSavedPasswords.getBody();
3298*0Sstevel@tonic-gate             a = new Association(o, il, CHOICE_ITEM);
3299*0Sstevel@tonic-gate             MainNormal.addElement(a);
3300*0Sstevel@tonic-gate 
3301*0Sstevel@tonic-gate             al = new PoMinTicketLifetimeAction();
3302*0Sstevel@tonic-gate             o = gui.PoMinTicketLifetime.getBody();
3303*0Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
3304*0Sstevel@tonic-gate             MainNormal.addElement(a);
3305*0Sstevel@tonic-gate             a = new Association(o, kl2, TEXTFIELD_KEY);
3306*0Sstevel@tonic-gate             MainNormal.addElement(a);
3307*0Sstevel@tonic-gate 
3308*0Sstevel@tonic-gate             dl = new DurationListener(
3309*0Sstevel@tonic-gate 			      (TextField)gui.PoMinTicketLifetime.getBody(), fr);
3310*0Sstevel@tonic-gate             o = gui.PoMinTicketLifetimeMoreButton.getBody();
3311*0Sstevel@tonic-gate             a = new Association(o, dl, BUTTON_ACTION);
3312*0Sstevel@tonic-gate             MainNormal.addElement(a);
3313*0Sstevel@tonic-gate 
3314*0Sstevel@tonic-gate             al = new PoMaxTicketLifetimeAction();
3315*0Sstevel@tonic-gate             o = gui.PoMaxTicketLifetime.getBody();
3316*0Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
3317*0Sstevel@tonic-gate             MainNormal.addElement(a);
3318*0Sstevel@tonic-gate             a = new Association(o, kl2, TEXTFIELD_KEY);
3319*0Sstevel@tonic-gate             MainNormal.addElement(a);
3320*0Sstevel@tonic-gate 
3321*0Sstevel@tonic-gate             dl = new DurationListener(
3322*0Sstevel@tonic-gate 			      (TextField)gui.PoMaxTicketLifetime.getBody(), fr);
3323*0Sstevel@tonic-gate             o = gui.PoMaxTicketLifetimeMoreButton.getBody();
3324*0Sstevel@tonic-gate             a = new Association(o, dl, BUTTON_ACTION);
3325*0Sstevel@tonic-gate             MainNormal.addElement(a);
3326*0Sstevel@tonic-gate 
3327*0Sstevel@tonic-gate             al = new PoSaveAction();
3328*0Sstevel@tonic-gate             o = gui.PoDetailSave.getBody();
3329*0Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
3330*0Sstevel@tonic-gate             MainNormal.addElement(a);
3331*0Sstevel@tonic-gate 
3332*0Sstevel@tonic-gate             al = new PoCancelAction();
3333*0Sstevel@tonic-gate             o = gui.PoDetailCancel.getBody();
3334*0Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
3335*0Sstevel@tonic-gate             MainNormal.addElement(a);
3336*0Sstevel@tonic-gate 
3337*0Sstevel@tonic-gate             al = new PoPreviousAction();
3338*0Sstevel@tonic-gate             o = gui.PoDetailPrevious.getBody();
3339*0Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
3340*0Sstevel@tonic-gate             MainNormal.addElement(a);
3341*0Sstevel@tonic-gate 
3342*0Sstevel@tonic-gate             al = new PoDoneAction();
3343*0Sstevel@tonic-gate             o = gui.PoDetailDone.getBody();
3344*0Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
3345*0Sstevel@tonic-gate             MainNormal.addElement(a);
3346*0Sstevel@tonic-gate 
3347*0Sstevel@tonic-gate         }
3348*0Sstevel@tonic-gate         setListeners(MainHelp, false);
3349*0Sstevel@tonic-gate         setListeners(MainFixers, false);
3350*0Sstevel@tonic-gate         setListeners(MainNormal, true);
3351*0Sstevel@tonic-gate         mainHelpMode = false;
3352*0Sstevel@tonic-gate     }
3353*0Sstevel@tonic-gate 
3354*0Sstevel@tonic-gate     /**
3355*0Sstevel@tonic-gate      * Set up the listeners for the objects on the main screen in help mode
3356*0Sstevel@tonic-gate      *
3357*0Sstevel@tonic-gate      */
3358*0Sstevel@tonic-gate     public void setupMainHelpListeners() {
3359*0Sstevel@tonic-gate         if (MainHelp == null) {
3360*0Sstevel@tonic-gate             MainHelp = new Vector(10, 10);
3361*0Sstevel@tonic-gate             MouseListener ml = new HelpListener();
3362*0Sstevel@tonic-gate             Association a;
3363*0Sstevel@tonic-gate             Object o;
3364*0Sstevel@tonic-gate 
3365*0Sstevel@tonic-gate             o = gui.PrListPattern.getBody();
3366*0Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
3367*0Sstevel@tonic-gate             MainHelp.addElement(a);
3368*0Sstevel@tonic-gate             ((TextField)o).setName("PrListPattern" /* NOI18N */);
3369*0Sstevel@tonic-gate 
3370*0Sstevel@tonic-gate             o = gui.PrSearchLab.getBody();
3371*0Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
3372*0Sstevel@tonic-gate             MainHelp.addElement(a);
3373*0Sstevel@tonic-gate             ((Label)o).setName("PrListPattern" /* NOI18N */);
3374*0Sstevel@tonic-gate 
3375*0Sstevel@tonic-gate             o = gui.PrListClear.getBody();
3376*0Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
3377*0Sstevel@tonic-gate             MainHelp.addElement(a);
3378*0Sstevel@tonic-gate             ((Button)o).setName("PrListClear" /* NOI18N */);
3379*0Sstevel@tonic-gate 
3380*0Sstevel@tonic-gate             o = gui.PrListModify.getBody();
3381*0Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
3382*0Sstevel@tonic-gate             MainHelp.addElement(a);
3383*0Sstevel@tonic-gate             ((Button)o).setName("PrListModify" /* NOI18N */);
3384*0Sstevel@tonic-gate 
3385*0Sstevel@tonic-gate             o = gui.PrListAdd.getBody();
3386*0Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
3387*0Sstevel@tonic-gate             MainHelp.addElement(a);
3388*0Sstevel@tonic-gate             ((Button)o).setName("PrListAdd" /* NOI18N */);
3389*0Sstevel@tonic-gate 
3390*0Sstevel@tonic-gate             o = gui.PrListDelete.getBody();
3391*0Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
3392*0Sstevel@tonic-gate             MainHelp.addElement(a);
3393*0Sstevel@tonic-gate             ((Button)o).setName("PrListDelete" /* NOI18N */);
3394*0Sstevel@tonic-gate 
3395*0Sstevel@tonic-gate             o = gui.PrListDuplicate.getBody();
3396*0Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
3397*0Sstevel@tonic-gate             MainHelp.addElement(a);
3398*0Sstevel@tonic-gate             ((Button)o).setName("PrListDuplicate" /* NOI18N */);
3399*0Sstevel@tonic-gate 
3400*0Sstevel@tonic-gate             o = gui.PrBasicSave.getBody();
3401*0Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
3402*0Sstevel@tonic-gate             MainHelp.addElement(a);
3403*0Sstevel@tonic-gate             ((Button)o).setName("PrSave" /* NOI18N */);
3404*0Sstevel@tonic-gate 
3405*0Sstevel@tonic-gate             o = gui.PrDetailSave.getBody();
3406*0Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
3407*0Sstevel@tonic-gate             MainHelp.addElement(a);
3408*0Sstevel@tonic-gate             ((Button)o).setName("PrSave" /* NOI18N */);
3409*0Sstevel@tonic-gate 
3410*0Sstevel@tonic-gate             o = gui.PrFlagsSave.getBody();
3411*0Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
3412*0Sstevel@tonic-gate             MainHelp.addElement(a);
3413*0Sstevel@tonic-gate             ((Button)o).setName("PrSave" /* NOI18N */);
3414*0Sstevel@tonic-gate 
3415*0Sstevel@tonic-gate             o = gui.PrBasicCancel.getBody();
3416*0Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
3417*0Sstevel@tonic-gate             MainHelp.addElement(a);
3418*0Sstevel@tonic-gate             ((Button)o).setName("PrCancel" /* NOI18N */);
3419*0Sstevel@tonic-gate 
3420*0Sstevel@tonic-gate             o = gui.PrDetailCancel.getBody();
3421*0Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
3422*0Sstevel@tonic-gate             MainHelp.addElement(a);
3423*0Sstevel@tonic-gate             ((Button)o).setName("PrCancel" /* NOI18N */);
3424*0Sstevel@tonic-gate 
3425*0Sstevel@tonic-gate             o = gui.PrFlagsCancel.getBody();
3426*0Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
3427*0Sstevel@tonic-gate             MainHelp.addElement(a);
3428*0Sstevel@tonic-gate             ((Button)o).setName("PrCancel" /* NOI18N */);
3429*0Sstevel@tonic-gate 
3430*0Sstevel@tonic-gate             o = gui.PrName1.getBody();
3431*0Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
3432*0Sstevel@tonic-gate             MainHelp.addElement(a);
3433*0Sstevel@tonic-gate             ((TextField)o).setName("PrName" /* NOI18N */);
3434*0Sstevel@tonic-gate 
3435*0Sstevel@tonic-gate             o = gui.PrNameLabel1.getBody();
3436*0Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
3437*0Sstevel@tonic-gate             MainHelp.addElement(a);
3438*0Sstevel@tonic-gate             ((Label)o).setName("PrName" /* NOI18N */);
3439*0Sstevel@tonic-gate 
3440*0Sstevel@tonic-gate             o = gui.PrComments.getBody();
3441*0Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
3442*0Sstevel@tonic-gate             MainHelp.addElement(a);
3443*0Sstevel@tonic-gate             ((TextField)o).setName("PrComments" /* NOI18N */);
3444*0Sstevel@tonic-gate 
3445*0Sstevel@tonic-gate             o = gui.PrCommentsLabel.getBody();
3446*0Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
3447*0Sstevel@tonic-gate             MainHelp.addElement(a);
3448*0Sstevel@tonic-gate             ((Label)o).setName("PrComments" /* NOI18N */);
3449*0Sstevel@tonic-gate 
3450*0Sstevel@tonic-gate             o = gui.PrPolicy.getBody();
3451*0Sstevel@tonic-gate             a = new Association(o, ml, CHOICE_MOUSE);
3452*0Sstevel@tonic-gate             MainHelp.addElement(a);
3453*0Sstevel@tonic-gate             ((Choice)o).setName("PrPolicy" /* NOI18N */);
3454*0Sstevel@tonic-gate 
3455*0Sstevel@tonic-gate             o = gui.PrPolicyLabel.getBody();
3456*0Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
3457*0Sstevel@tonic-gate             MainHelp.addElement(a);
3458*0Sstevel@tonic-gate             ((Label)o).setName("PrPolicy" /* NOI18N */);
3459*0Sstevel@tonic-gate 
3460*0Sstevel@tonic-gate             o = gui.PrPassword.getBody();
3461*0Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
3462*0Sstevel@tonic-gate             MainHelp.addElement(a);
3463*0Sstevel@tonic-gate             ((TextField)o).setName("PrPassword" /* NOI18N */);
3464*0Sstevel@tonic-gate 
3465*0Sstevel@tonic-gate             o = gui.PrPasswordLabel.getBody();
3466*0Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
3467*0Sstevel@tonic-gate             MainHelp.addElement(a);
3468*0Sstevel@tonic-gate             ((Label)o).setName("PrPassword" /* NOI18N */);
3469*0Sstevel@tonic-gate 
3470*0Sstevel@tonic-gate             o = gui.PrBasicRandomPw.getBody();
3471*0Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
3472*0Sstevel@tonic-gate             MainHelp.addElement(a);
3473*0Sstevel@tonic-gate             ((Button)o).setName("PrBasicRandomPw" /* NOI18N */);
3474*0Sstevel@tonic-gate 
3475*0Sstevel@tonic-gate             o = gui.PrExpiry.getBody();
3476*0Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
3477*0Sstevel@tonic-gate             MainHelp.addElement(a);
3478*0Sstevel@tonic-gate             ((TextField)o).setName("PrExpiry" /* NOI18N */);
3479*0Sstevel@tonic-gate 
3480*0Sstevel@tonic-gate             o = gui.PrExpiryLabel.getBody();
3481*0Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
3482*0Sstevel@tonic-gate             MainHelp.addElement(a);
3483*0Sstevel@tonic-gate             ((Label)o).setName("PrExpiry" /* NOI18N */);
3484*0Sstevel@tonic-gate 
3485*0Sstevel@tonic-gate             o = gui.PrExpiryMoreButton.getBody();
3486*0Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
3487*0Sstevel@tonic-gate             MainHelp.addElement(a);
3488*0Sstevel@tonic-gate             ((Button)o).setName("DateHelperButton" /* NOI18N */);
3489*0Sstevel@tonic-gate 
3490*0Sstevel@tonic-gate             o = gui.PrLastChangedTime.getBody();
3491*0Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
3492*0Sstevel@tonic-gate             MainHelp.addElement(a);
3493*0Sstevel@tonic-gate             ((Label)o).setName("PrinBasLastPrincipalChange" /* NOI18N */);
3494*0Sstevel@tonic-gate 
3495*0Sstevel@tonic-gate             o = gui.PrLastChangedTimeLabel.getBody();
3496*0Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
3497*0Sstevel@tonic-gate             MainHelp.addElement(a);
3498*0Sstevel@tonic-gate             ((Label)o).setName("PrinBasLastPrincipalChange" /* NOI18N */);
3499*0Sstevel@tonic-gate 
3500*0Sstevel@tonic-gate             o = gui.PrLastChangedBy.getBody();
3501*0Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
3502*0Sstevel@tonic-gate             MainHelp.addElement(a);
3503*0Sstevel@tonic-gate             ((Label)o).setName("PrinBasLastChangedBy" /* NOI18N */);
3504*0Sstevel@tonic-gate 
3505*0Sstevel@tonic-gate             o = gui.PrLastChangedByLabel.getBody();
3506*0Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
3507*0Sstevel@tonic-gate             MainHelp.addElement(a);
3508*0Sstevel@tonic-gate             ((Label)o).setName("PrinBasLastChangedBy" /* NOI18N */);
3509*0Sstevel@tonic-gate 
3510*0Sstevel@tonic-gate             o = gui.PrBasicPrevious.getBody();
3511*0Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
3512*0Sstevel@tonic-gate             MainHelp.addElement(a);
3513*0Sstevel@tonic-gate             ((Button)o).setName("PrBasicPrevious" /* NOI18N */);
3514*0Sstevel@tonic-gate 
3515*0Sstevel@tonic-gate             o = gui.PrBasicNext.getBody();
3516*0Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
3517*0Sstevel@tonic-gate             MainHelp.addElement(a);
3518*0Sstevel@tonic-gate             ((Button)o).setName("PrBasicNext" /* NOI18N */);
3519*0Sstevel@tonic-gate 
3520*0Sstevel@tonic-gate             o = gui.PrLastSuccess.getBody();
3521*0Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
3522*0Sstevel@tonic-gate             MainHelp.addElement(a);
3523*0Sstevel@tonic-gate             ((Label)o).setName("PrinDetLastSuccess" /* NOI18N */);
3524*0Sstevel@tonic-gate 
3525*0Sstevel@tonic-gate             o = gui.PrLastSuccessLabel.getBody();
3526*0Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
3527*0Sstevel@tonic-gate             MainHelp.addElement(a);
3528*0Sstevel@tonic-gate             ((Label)o).setName("PrinDetLastSuccess" /* NOI18N */);
3529*0Sstevel@tonic-gate 
3530*0Sstevel@tonic-gate             o = gui.PrLastFailure.getBody();
3531*0Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
3532*0Sstevel@tonic-gate             MainHelp.addElement(a);
3533*0Sstevel@tonic-gate             ((Label)o).setName("PrinDetLastFailure" /* NOI18N */);
3534*0Sstevel@tonic-gate 
3535*0Sstevel@tonic-gate             o = gui.PrLastFailureLabel.getBody();
3536*0Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
3537*0Sstevel@tonic-gate             MainHelp.addElement(a);
3538*0Sstevel@tonic-gate             ((Label)o).setName("PrinDetLastFailure" /* NOI18N */);
3539*0Sstevel@tonic-gate 
3540*0Sstevel@tonic-gate             o = gui.PrFailCount.getBody();
3541*0Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
3542*0Sstevel@tonic-gate             MainHelp.addElement(a);
3543*0Sstevel@tonic-gate             ((Label)o).setName("PrinDetFailureCount" /* NOI18N */);
3544*0Sstevel@tonic-gate 
3545*0Sstevel@tonic-gate             o = gui.PrFailureCountLabel.getBody();
3546*0Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
3547*0Sstevel@tonic-gate             MainHelp.addElement(a);
3548*0Sstevel@tonic-gate             ((Label)o).setName("PrinDetFailureCount" /* NOI18N */);
3549*0Sstevel@tonic-gate 
3550*0Sstevel@tonic-gate             o = gui.PrLastPwChange.getBody();
3551*0Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
3552*0Sstevel@tonic-gate             MainHelp.addElement(a);
3553*0Sstevel@tonic-gate             ((Label)o).setName("PrinDetLastPasswordChange" /* NOI18N */);
3554*0Sstevel@tonic-gate 
3555*0Sstevel@tonic-gate             o = gui.PrPwLastChangedLabel.getBody();
3556*0Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
3557*0Sstevel@tonic-gate             MainHelp.addElement(a);
3558*0Sstevel@tonic-gate             ((Label)o).setName("PrinDetLastPasswordChange" /* NOI18N */);
3559*0Sstevel@tonic-gate 
3560*0Sstevel@tonic-gate             o = gui.PrPwExpiry.getBody();
3561*0Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
3562*0Sstevel@tonic-gate             MainHelp.addElement(a);
3563*0Sstevel@tonic-gate             ((TextField)o).setName("PrPwExpiry" /* NOI18N */);
3564*0Sstevel@tonic-gate 
3565*0Sstevel@tonic-gate             o = gui.PrPwExpiryLabel.getBody();
3566*0Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
3567*0Sstevel@tonic-gate             MainHelp.addElement(a);
3568*0Sstevel@tonic-gate             ((Label)o).setName("PrPwExpiry" /* NOI18N */);
3569*0Sstevel@tonic-gate 
3570*0Sstevel@tonic-gate             o = gui.PrPwExpiryMoreButton.getBody();
3571*0Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
3572*0Sstevel@tonic-gate             MainHelp.addElement(a);
3573*0Sstevel@tonic-gate             ((Button)o).setName("DateHelperButton" /* NOI18N */);
3574*0Sstevel@tonic-gate 
3575*0Sstevel@tonic-gate             o = gui.PrKvno.getBody();
3576*0Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
3577*0Sstevel@tonic-gate             MainHelp.addElement(a);
3578*0Sstevel@tonic-gate             ((TextField)o).setName("PrKvno" /* NOI18N */);
3579*0Sstevel@tonic-gate 
3580*0Sstevel@tonic-gate             o = gui.PrKvnoLabel.getBody();
3581*0Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
3582*0Sstevel@tonic-gate             MainHelp.addElement(a);
3583*0Sstevel@tonic-gate             ((Label)o).setName("PrKvno" /* NOI18N */);
3584*0Sstevel@tonic-gate 
3585*0Sstevel@tonic-gate             o = gui.PrMaxLifetime.getBody();
3586*0Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
3587*0Sstevel@tonic-gate             MainHelp.addElement(a);
3588*0Sstevel@tonic-gate             ((TextField)o).setName("PrMaxLifetime" /* NOI18N */);
3589*0Sstevel@tonic-gate 
3590*0Sstevel@tonic-gate             o = gui.PrMaxTicketLifetimeLabel.getBody();
3591*0Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
3592*0Sstevel@tonic-gate             MainHelp.addElement(a);
3593*0Sstevel@tonic-gate             ((Label)o).setName("PrMaxLifetime" /* NOI18N */);
3594*0Sstevel@tonic-gate 
3595*0Sstevel@tonic-gate             o = gui.PrMaxLifetimeMoreButton.getBody();
3596*0Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
3597*0Sstevel@tonic-gate             MainHelp.addElement(a);
3598*0Sstevel@tonic-gate             ((Button)o).setName("DurationHelperButton" /* NOI18N */);
3599*0Sstevel@tonic-gate 
3600*0Sstevel@tonic-gate             o = gui.PrMaxRenewal.getBody();
3601*0Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
3602*0Sstevel@tonic-gate             MainHelp.addElement(a);
3603*0Sstevel@tonic-gate             ((TextField)o).setName("PrMaxRenewal" /* NOI18N */);
3604*0Sstevel@tonic-gate 
3605*0Sstevel@tonic-gate             o = gui.PrMaxTicketRenewalLabel.getBody();
3606*0Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
3607*0Sstevel@tonic-gate             MainHelp.addElement(a);
3608*0Sstevel@tonic-gate             ((Label)o).setName("PrMaxRenewal" /* NOI18N */);
3609*0Sstevel@tonic-gate 
3610*0Sstevel@tonic-gate             o = gui.PrMaxRenewalMoreButton.getBody();
3611*0Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
3612*0Sstevel@tonic-gate             MainHelp.addElement(a);
3613*0Sstevel@tonic-gate             ((Button)o).setName("DurationHelperButton" /* NOI18N */);
3614*0Sstevel@tonic-gate 
3615*0Sstevel@tonic-gate             o = gui.PrDetailPrevious.getBody();
3616*0Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
3617*0Sstevel@tonic-gate             MainHelp.addElement(a);
3618*0Sstevel@tonic-gate             ((Button)o).setName("PrDetailPrevious" /* NOI18N */);
3619*0Sstevel@tonic-gate 
3620*0Sstevel@tonic-gate             o = gui.PrDetailNext.getBody();
3621*0Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
3622*0Sstevel@tonic-gate             MainHelp.addElement(a);
3623*0Sstevel@tonic-gate             ((Button)o).setName("PrDetailNext" /* NOI18N */);
3624*0Sstevel@tonic-gate 
3625*0Sstevel@tonic-gate             o = gui.PrFlagsPrevious.getBody();
3626*0Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
3627*0Sstevel@tonic-gate             MainHelp.addElement(a);
3628*0Sstevel@tonic-gate             ((Button)o).setName("PrFlagsPrevious" /* NOI18N */);
3629*0Sstevel@tonic-gate 
3630*0Sstevel@tonic-gate             o = gui.PrFlagsNext.getBody();
3631*0Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
3632*0Sstevel@tonic-gate             MainHelp.addElement(a);
3633*0Sstevel@tonic-gate             ((Button)o).setName("PrFlagsNext" /* NOI18N */);
3634*0Sstevel@tonic-gate 
3635*0Sstevel@tonic-gate             o = gui.PrLockAcct.getBody();
3636*0Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
3637*0Sstevel@tonic-gate             MainHelp.addElement(a);
3638*0Sstevel@tonic-gate             ((Checkbox)o).setName("PrLockAcct" /* NOI18N */);
3639*0Sstevel@tonic-gate 
3640*0Sstevel@tonic-gate             o = gui.PrForcePwChange.getBody();
3641*0Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
3642*0Sstevel@tonic-gate             MainHelp.addElement(a);
3643*0Sstevel@tonic-gate             ((Checkbox)o).setName("PrForcePwChange" /* NOI18N */);
3644*0Sstevel@tonic-gate 
3645*0Sstevel@tonic-gate             o = gui.PrAllowPostdated.getBody();
3646*0Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
3647*0Sstevel@tonic-gate             MainHelp.addElement(a);
3648*0Sstevel@tonic-gate             ((Checkbox)o).setName("PrAllowPostdated" /* NOI18N */);
3649*0Sstevel@tonic-gate 
3650*0Sstevel@tonic-gate             o = gui.PrAllowForwardable.getBody();
3651*0Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
3652*0Sstevel@tonic-gate             MainHelp.addElement(a);
3653*0Sstevel@tonic-gate             ((Checkbox)o).setName("PrAllowForwardable" /* NOI18N */);
3654*0Sstevel@tonic-gate 
3655*0Sstevel@tonic-gate             o = gui.PrAllowRenewable.getBody();
3656*0Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
3657*0Sstevel@tonic-gate             MainHelp.addElement(a);
3658*0Sstevel@tonic-gate             ((Checkbox)o).setName("PrAllowRenewable" /* NOI18N */);
3659*0Sstevel@tonic-gate 
3660*0Sstevel@tonic-gate             o = gui.PrAllowProxiable.getBody();
3661*0Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
3662*0Sstevel@tonic-gate             MainHelp.addElement(a);
3663*0Sstevel@tonic-gate             ((Checkbox)o).setName("PrAllowProxiable" /* NOI18N */);
3664*0Sstevel@tonic-gate 
3665*0Sstevel@tonic-gate             o = gui.PrAllowSvr.getBody();
3666*0Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
3667*0Sstevel@tonic-gate             MainHelp.addElement(a);
3668*0Sstevel@tonic-gate             ((Checkbox)o).setName("PrAllowSvr" /* NOI18N */);
3669*0Sstevel@tonic-gate 
3670*0Sstevel@tonic-gate             o = gui.PrAllowTGT.getBody();
3671*0Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
3672*0Sstevel@tonic-gate             MainHelp.addElement(a);
3673*0Sstevel@tonic-gate             ((Checkbox)o).setName("PrAllowTGT" /* NOI18N */);
3674*0Sstevel@tonic-gate 
3675*0Sstevel@tonic-gate             o = gui.PrAllowDupAuth.getBody();
3676*0Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
3677*0Sstevel@tonic-gate             MainHelp.addElement(a);
3678*0Sstevel@tonic-gate             ((Checkbox)o).setName("PrAllowDupAuth" /* NOI18N */);
3679*0Sstevel@tonic-gate 
3680*0Sstevel@tonic-gate             o = gui.PrRequirePreAuth.getBody();
3681*0Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
3682*0Sstevel@tonic-gate             MainHelp.addElement(a);
3683*0Sstevel@tonic-gate             ((Checkbox)o).setName("PrRequirePreAuth" /* NOI18N */);
3684*0Sstevel@tonic-gate 
3685*0Sstevel@tonic-gate             o = gui.PrRequireHwPreAuth.getBody();
3686*0Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
3687*0Sstevel@tonic-gate             MainHelp.addElement(a);
3688*0Sstevel@tonic-gate             ((Checkbox)o).setName("PrRequireHwPreAuth" /* NOI18N */);
3689*0Sstevel@tonic-gate 
3690*0Sstevel@tonic-gate             o = gui.PoListPattern.getBody();
3691*0Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
3692*0Sstevel@tonic-gate             MainHelp.addElement(a);
3693*0Sstevel@tonic-gate             ((TextField)o).setName("PoListPattern" /* NOI18N */);
3694*0Sstevel@tonic-gate 
3695*0Sstevel@tonic-gate             o = gui.PoListPatternLabel.getBody();
3696*0Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
3697*0Sstevel@tonic-gate             MainHelp.addElement(a);
3698*0Sstevel@tonic-gate             ((Label)o).setName("PoListPattern" /* NOI18N */);
3699*0Sstevel@tonic-gate 
3700*0Sstevel@tonic-gate             o = gui.PoListClear.getBody();
3701*0Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
3702*0Sstevel@tonic-gate             MainHelp.addElement(a);
3703*0Sstevel@tonic-gate             ((Button)o).setName("PoListClear" /* NOI18N */);
3704*0Sstevel@tonic-gate 
3705*0Sstevel@tonic-gate             o = gui.PoListModify.getBody();
3706*0Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
3707*0Sstevel@tonic-gate             MainHelp.addElement(a);
3708*0Sstevel@tonic-gate             ((Button)o).setName("PoListModify" /* NOI18N */);
3709*0Sstevel@tonic-gate 
3710*0Sstevel@tonic-gate             o = gui.PoListAdd.getBody();
3711*0Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
3712*0Sstevel@tonic-gate             MainHelp.addElement(a);
3713*0Sstevel@tonic-gate             ((Button)o).setName("PoListAdd" /* NOI18N */);
3714*0Sstevel@tonic-gate 
3715*0Sstevel@tonic-gate             o = gui.PoListDelete.getBody();
3716*0Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
3717*0Sstevel@tonic-gate             MainHelp.addElement(a);
3718*0Sstevel@tonic-gate             ((Button)o).setName("PoListDelete" /* NOI18N */);
3719*0Sstevel@tonic-gate 
3720*0Sstevel@tonic-gate             o = gui.PoListDuplicate.getBody();
3721*0Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
3722*0Sstevel@tonic-gate             MainHelp.addElement(a);
3723*0Sstevel@tonic-gate             ((Button)o).setName("PoListDuplicate" /* NOI18N */);
3724*0Sstevel@tonic-gate 
3725*0Sstevel@tonic-gate             o = gui.PoName.getBody();
3726*0Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
3727*0Sstevel@tonic-gate             MainHelp.addElement(a);
3728*0Sstevel@tonic-gate             ((TextField)o).setName("PoName" /* NOI18N */);
3729*0Sstevel@tonic-gate 
3730*0Sstevel@tonic-gate             o = gui.PoNameLabel.getBody();
3731*0Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
3732*0Sstevel@tonic-gate             MainHelp.addElement(a);
3733*0Sstevel@tonic-gate             ((Label)o).setName("PoName" /* NOI18N */);
3734*0Sstevel@tonic-gate 
3735*0Sstevel@tonic-gate             o = gui.PoMinPwLength.getBody();
3736*0Sstevel@tonic-gate             a = new Association(o, ml, CHOICE_MOUSE);
3737*0Sstevel@tonic-gate             MainHelp.addElement(a);
3738*0Sstevel@tonic-gate             ((Choice)o).setName("PoMinPwLength" /* NOI18N */);
3739*0Sstevel@tonic-gate 
3740*0Sstevel@tonic-gate             o = gui.PoMinPwLengthLabel.getBody();
3741*0Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
3742*0Sstevel@tonic-gate             MainHelp.addElement(a);
3743*0Sstevel@tonic-gate             ((Label)o).setName("PoMinPwLength" /* NOI18N */);
3744*0Sstevel@tonic-gate 
3745*0Sstevel@tonic-gate             o = gui.PoMinPwClass.getBody();
3746*0Sstevel@tonic-gate             a = new Association(o, ml, CHOICE_MOUSE);
3747*0Sstevel@tonic-gate             MainHelp.addElement(a);
3748*0Sstevel@tonic-gate             ((Choice)o).setName("PoMinPwClass" /* NOI18N */);
3749*0Sstevel@tonic-gate 
3750*0Sstevel@tonic-gate             o = gui.PoMinPwClassLabel.getBody();
3751*0Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
3752*0Sstevel@tonic-gate             MainHelp.addElement(a);
3753*0Sstevel@tonic-gate             ((Label)o).setName("PoMinPwClass" /* NOI18N */);
3754*0Sstevel@tonic-gate 
3755*0Sstevel@tonic-gate             o = gui.PoSavedPasswords.getBody();
3756*0Sstevel@tonic-gate             a = new Association(o, ml, CHOICE_MOUSE);
3757*0Sstevel@tonic-gate             MainHelp.addElement(a);
3758*0Sstevel@tonic-gate             ((Choice)o).setName("PoSavedPasswords" /* NOI18N */);
3759*0Sstevel@tonic-gate 
3760*0Sstevel@tonic-gate             o = gui.PoSavedPasswordsLabel.getBody();
3761*0Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
3762*0Sstevel@tonic-gate             MainHelp.addElement(a);
3763*0Sstevel@tonic-gate             ((Label)o).setName("PoSavedPasswords" /* NOI18N */);
3764*0Sstevel@tonic-gate 
3765*0Sstevel@tonic-gate             o = gui.PoMinTicketLifetime.getBody();
3766*0Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
3767*0Sstevel@tonic-gate             MainHelp.addElement(a);
3768*0Sstevel@tonic-gate             ((TextField)o).setName("PoMinTicketLifetime" /* NOI18N */);
3769*0Sstevel@tonic-gate 
3770*0Sstevel@tonic-gate             o = gui.PoMinTicketLifetimeLabel.getBody();
3771*0Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
3772*0Sstevel@tonic-gate             MainHelp.addElement(a);
3773*0Sstevel@tonic-gate             ((Label)o).setName("PoMinTicketLifetime" /* NOI18N */);
3774*0Sstevel@tonic-gate 
3775*0Sstevel@tonic-gate             o = gui.PoMinTicketLifetimeMoreButton.getBody();
3776*0Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
3777*0Sstevel@tonic-gate             MainHelp.addElement(a);
3778*0Sstevel@tonic-gate             ((Button)o).setName("DurationHelperButton" /* NOI18N */);
3779*0Sstevel@tonic-gate 
3780*0Sstevel@tonic-gate             o = gui.PoMaxTicketLifetime.getBody();
3781*0Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
3782*0Sstevel@tonic-gate             MainHelp.addElement(a);
3783*0Sstevel@tonic-gate             ((TextField)o).setName("PoMaxTicketLifetime" /* NOI18N */);
3784*0Sstevel@tonic-gate 
3785*0Sstevel@tonic-gate             o = gui.PoMaxTicketLifetimeLabel.getBody();
3786*0Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
3787*0Sstevel@tonic-gate             MainHelp.addElement(a);
3788*0Sstevel@tonic-gate             ((Label)o).setName("PoMaxTicketLifetime" /* NOI18N */);
3789*0Sstevel@tonic-gate 
3790*0Sstevel@tonic-gate             o = gui.PoMaxTicketLifetimeMoreButton.getBody();
3791*0Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
3792*0Sstevel@tonic-gate             MainHelp.addElement(a);
3793*0Sstevel@tonic-gate             ((Button)o).setName("DurationHelperButton" /* NOI18N */);
3794*0Sstevel@tonic-gate 
3795*0Sstevel@tonic-gate             o = gui.PoReferences.getBody();
3796*0Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
3797*0Sstevel@tonic-gate             MainHelp.addElement(a);
3798*0Sstevel@tonic-gate             ((Label)o).setName("PolDetPrincipalsUsingThisPolicy" /* NOI18N */);
3799*0Sstevel@tonic-gate 
3800*0Sstevel@tonic-gate             o = gui.PoReferencesLabel.getBody();
3801*0Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
3802*0Sstevel@tonic-gate             MainHelp.addElement(a);
3803*0Sstevel@tonic-gate             ((Label)o).setName("PolDetPrincipalsUsingThisPolicy" /* NOI18N */);
3804*0Sstevel@tonic-gate 
3805*0Sstevel@tonic-gate             o = gui.PoDetailSave.getBody();
3806*0Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
3807*0Sstevel@tonic-gate             MainHelp.addElement(a);
3808*0Sstevel@tonic-gate             ((Button)o).setName("PoSave" /* NOI18N */);
3809*0Sstevel@tonic-gate 
3810*0Sstevel@tonic-gate             o = gui.PoDetailCancel.getBody();
3811*0Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
3812*0Sstevel@tonic-gate             MainHelp.addElement(a);
3813*0Sstevel@tonic-gate             ((Button)o).setName("PoCancel" /* NOI18N */);
3814*0Sstevel@tonic-gate 
3815*0Sstevel@tonic-gate             o = gui.PoDetailPrevious.getBody();
3816*0Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
3817*0Sstevel@tonic-gate             MainHelp.addElement(a);
3818*0Sstevel@tonic-gate             ((Button)o).setName("PoDetailPrevious" /* NOI18N */);
3819*0Sstevel@tonic-gate 
3820*0Sstevel@tonic-gate             o = gui.PoDetailDone.getBody();
3821*0Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
3822*0Sstevel@tonic-gate             MainHelp.addElement(a);
3823*0Sstevel@tonic-gate             ((Button)o).setName("PoDetailDone" /* NOI18N */);
3824*0Sstevel@tonic-gate 
3825*0Sstevel@tonic-gate             setupMainHelpFlagTogglers();
3826*0Sstevel@tonic-gate         }
3827*0Sstevel@tonic-gate 
3828*0Sstevel@tonic-gate         fixHelpTags();
3829*0Sstevel@tonic-gate         setListeners(MainNormal, false);
3830*0Sstevel@tonic-gate         setListeners(MainHelp, true);
3831*0Sstevel@tonic-gate         setupMainHelpFixers();
3832*0Sstevel@tonic-gate         mainHelpMode = true;
3833*0Sstevel@tonic-gate     }
3834*0Sstevel@tonic-gate 
3835*0Sstevel@tonic-gate     public void fixHelpTags() {
3836*0Sstevel@tonic-gate         if (noLists) {
3837*0Sstevel@tonic-gate             ((TextList)gui.Prlist.getBody()).setName("PrNoList" /* NOI18N */);
3838*0Sstevel@tonic-gate             ((TextField)gui.PrListPattern.getBody()).setName("PrNameNoList"
3839*0Sstevel@tonic-gate 							     /* NOI18N */);
3840*0Sstevel@tonic-gate             ((Button)gui.PrListClear.getBody()).setName("PrNoListClear"
3841*0Sstevel@tonic-gate 							/* NOI18N */);
3842*0Sstevel@tonic-gate             ((TextList)gui.Pollist.getBody()).setName("PolNoList" /* NOI18N */);
3843*0Sstevel@tonic-gate             ((TextField)gui.PoListPattern.getBody()).setName("PoNameNoList"
3844*0Sstevel@tonic-gate 							     /* NOI18N */);
3845*0Sstevel@tonic-gate             ((Button)gui.PoListClear.getBody()).setName("PoNoListClear"
3846*0Sstevel@tonic-gate 							/* NOI18N */);
3847*0Sstevel@tonic-gate         } else {
3848*0Sstevel@tonic-gate             ((TextList)gui.Prlist.getBody()).setName("PrList" /* NOI18N */);
3849*0Sstevel@tonic-gate             ((TextField)gui.PrListPattern.getBody()).setName("PrListPattern"
3850*0Sstevel@tonic-gate 							     /* NOI18N */);
3851*0Sstevel@tonic-gate             ((Button)gui.PrListClear.getBody()).setName("PrListClear"
3852*0Sstevel@tonic-gate 							/* NOI18N */);
3853*0Sstevel@tonic-gate             ((TextList)gui.Pollist.getBody()).setName("Pollist" /* NOI18N */);
3854*0Sstevel@tonic-gate             ((TextField)gui.PoListPattern.getBody()).setName("PoListPattern"
3855*0Sstevel@tonic-gate 							     /* NOI18N */);
3856*0Sstevel@tonic-gate             ((Button)gui.PoListClear.getBody()).setName("PoListClear"
3857*0Sstevel@tonic-gate 							/* NOI18N */);
3858*0Sstevel@tonic-gate         }
3859*0Sstevel@tonic-gate     }
3860*0Sstevel@tonic-gate 
3861*0Sstevel@tonic-gate     /**
3862*0Sstevel@tonic-gate      * Helper method to setupMainHelpListeners. Should be called from
3863*0Sstevel@tonic-gate      * only from there.
3864*0Sstevel@tonic-gate      */
3865*0Sstevel@tonic-gate     private void 	setupMainHelpFlagTogglers() {
3866*0Sstevel@tonic-gate 
3867*0Sstevel@tonic-gate         if (MainHelp == null)
3868*0Sstevel@tonic-gate             return;
3869*0Sstevel@tonic-gate 
3870*0Sstevel@tonic-gate         CheckboxToggler ml = new CheckboxToggler();
3871*0Sstevel@tonic-gate         Object o;
3872*0Sstevel@tonic-gate         Association a;
3873*0Sstevel@tonic-gate 
3874*0Sstevel@tonic-gate         o = gui.PrLockAcct.getBody();
3875*0Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
3876*0Sstevel@tonic-gate         MainHelp.addElement(a);
3877*0Sstevel@tonic-gate 
3878*0Sstevel@tonic-gate         o = gui.PrForcePwChange.getBody();
3879*0Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
3880*0Sstevel@tonic-gate         MainHelp.addElement(a);
3881*0Sstevel@tonic-gate 
3882*0Sstevel@tonic-gate         o = gui.PrAllowPostdated.getBody();
3883*0Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
3884*0Sstevel@tonic-gate         MainHelp.addElement(a);
3885*0Sstevel@tonic-gate 
3886*0Sstevel@tonic-gate         o = gui.PrAllowForwardable.getBody();
3887*0Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
3888*0Sstevel@tonic-gate         MainHelp.addElement(a);
3889*0Sstevel@tonic-gate 
3890*0Sstevel@tonic-gate         o = gui.PrAllowRenewable.getBody();
3891*0Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
3892*0Sstevel@tonic-gate         MainHelp.addElement(a);
3893*0Sstevel@tonic-gate 
3894*0Sstevel@tonic-gate         o = gui.PrAllowProxiable.getBody();
3895*0Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
3896*0Sstevel@tonic-gate         MainHelp.addElement(a);
3897*0Sstevel@tonic-gate 
3898*0Sstevel@tonic-gate         o = gui.PrAllowSvr.getBody();
3899*0Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
3900*0Sstevel@tonic-gate         MainHelp.addElement(a);
3901*0Sstevel@tonic-gate 
3902*0Sstevel@tonic-gate         o = gui.PrAllowTGT.getBody();
3903*0Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
3904*0Sstevel@tonic-gate         MainHelp.addElement(a);
3905*0Sstevel@tonic-gate 
3906*0Sstevel@tonic-gate         o = gui.PrAllowDupAuth.getBody();
3907*0Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
3908*0Sstevel@tonic-gate         MainHelp.addElement(a);
3909*0Sstevel@tonic-gate 
3910*0Sstevel@tonic-gate         o = gui.PrRequirePreAuth.getBody();
3911*0Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
3912*0Sstevel@tonic-gate         MainHelp.addElement(a);
3913*0Sstevel@tonic-gate 
3914*0Sstevel@tonic-gate         o = gui.PrRequireHwPreAuth.getBody();
3915*0Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
3916*0Sstevel@tonic-gate         MainHelp.addElement(a);
3917*0Sstevel@tonic-gate     }
3918*0Sstevel@tonic-gate 
3919*0Sstevel@tonic-gate     public void setupMainHelpFixers() {
3920*0Sstevel@tonic-gate         MainFixers = new Vector(10, 10);
3921*0Sstevel@tonic-gate         Object o;
3922*0Sstevel@tonic-gate         Association a;
3923*0Sstevel@tonic-gate         TextFixer tf;
3924*0Sstevel@tonic-gate         ChoiceFixer cf;
3925*0Sstevel@tonic-gate 
3926*0Sstevel@tonic-gate         o = gui.PrListPattern.getBody();
3927*0Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
3928*0Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
3929*0Sstevel@tonic-gate         MainFixers.addElement(a);
3930*0Sstevel@tonic-gate 
3931*0Sstevel@tonic-gate         o = gui.PrName1.getBody();
3932*0Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
3933*0Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
3934*0Sstevel@tonic-gate         MainFixers.addElement(a);
3935*0Sstevel@tonic-gate 
3936*0Sstevel@tonic-gate         o = gui.PrComments.getBody();
3937*0Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
3938*0Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
3939*0Sstevel@tonic-gate         MainFixers.addElement(a);
3940*0Sstevel@tonic-gate 
3941*0Sstevel@tonic-gate         o = gui.PrPolicy.getBody();
3942*0Sstevel@tonic-gate         cf = new ChoiceFixer((Choice)o);
3943*0Sstevel@tonic-gate         a = new Association(o, cf, CHOICE_ITEM);
3944*0Sstevel@tonic-gate         MainFixers.addElement(a);
3945*0Sstevel@tonic-gate 
3946*0Sstevel@tonic-gate         o = gui.PrPassword.getBody();
3947*0Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
3948*0Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
3949*0Sstevel@tonic-gate         MainFixers.addElement(a);
3950*0Sstevel@tonic-gate 
3951*0Sstevel@tonic-gate         o = gui.PrExpiry.getBody();
3952*0Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
3953*0Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
3954*0Sstevel@tonic-gate         MainFixers.addElement(a);
3955*0Sstevel@tonic-gate 
3956*0Sstevel@tonic-gate         o = gui.PrPwExpiry.getBody();
3957*0Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
3958*0Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
3959*0Sstevel@tonic-gate         MainFixers.addElement(a);
3960*0Sstevel@tonic-gate 
3961*0Sstevel@tonic-gate         o = gui.PrKvno.getBody();
3962*0Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
3963*0Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
3964*0Sstevel@tonic-gate         MainFixers.addElement(a);
3965*0Sstevel@tonic-gate 
3966*0Sstevel@tonic-gate         o = gui.PrMaxLifetime.getBody();
3967*0Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
3968*0Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
3969*0Sstevel@tonic-gate         MainFixers.addElement(a);
3970*0Sstevel@tonic-gate 
3971*0Sstevel@tonic-gate         o = gui.PrMaxRenewal.getBody();
3972*0Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
3973*0Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
3974*0Sstevel@tonic-gate         MainFixers.addElement(a);
3975*0Sstevel@tonic-gate 
3976*0Sstevel@tonic-gate         o = gui.PoListPattern.getBody();
3977*0Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
3978*0Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
3979*0Sstevel@tonic-gate         MainFixers.addElement(a);
3980*0Sstevel@tonic-gate 
3981*0Sstevel@tonic-gate         o = gui.PoName.getBody();
3982*0Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
3983*0Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
3984*0Sstevel@tonic-gate         MainFixers.addElement(a);
3985*0Sstevel@tonic-gate 
3986*0Sstevel@tonic-gate         o = gui.PoMinPwLength.getBody();
3987*0Sstevel@tonic-gate         cf = new ChoiceFixer((Choice)o);
3988*0Sstevel@tonic-gate         a = new Association(o, cf, CHOICE_ITEM);
3989*0Sstevel@tonic-gate         MainFixers.addElement(a);
3990*0Sstevel@tonic-gate 
3991*0Sstevel@tonic-gate         o = gui.PoMinPwClass.getBody();
3992*0Sstevel@tonic-gate         cf = new ChoiceFixer((Choice)o);
3993*0Sstevel@tonic-gate         a = new Association(o, cf, CHOICE_ITEM);
3994*0Sstevel@tonic-gate         MainFixers.addElement(a);
3995*0Sstevel@tonic-gate 
3996*0Sstevel@tonic-gate         o = gui.PoSavedPasswords.getBody();
3997*0Sstevel@tonic-gate         cf = new ChoiceFixer((Choice)o);
3998*0Sstevel@tonic-gate         a = new Association(o, cf, CHOICE_ITEM);
3999*0Sstevel@tonic-gate         MainFixers.addElement(a);
4000*0Sstevel@tonic-gate 
4001*0Sstevel@tonic-gate         o = gui.PoMinTicketLifetime.getBody();
4002*0Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
4003*0Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
4004*0Sstevel@tonic-gate         MainFixers.addElement(a);
4005*0Sstevel@tonic-gate 
4006*0Sstevel@tonic-gate         o = gui.PoMaxTicketLifetime.getBody();
4007*0Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
4008*0Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
4009*0Sstevel@tonic-gate         MainFixers.addElement(a);
4010*0Sstevel@tonic-gate 
4011*0Sstevel@tonic-gate         setListeners(MainFixers, true);
4012*0Sstevel@tonic-gate     }
4013*0Sstevel@tonic-gate 
4014*0Sstevel@tonic-gate     public void setupDefaultsNormalListeners() {
4015*0Sstevel@tonic-gate 
4016*0Sstevel@tonic-gate         if (defaultsNormal == null) {
4017*0Sstevel@tonic-gate             defaultsNormal = new Vector(10, 10);
4018*0Sstevel@tonic-gate             ActionListener al;
4019*0Sstevel@tonic-gate             ItemListener il;
4020*0Sstevel@tonic-gate             KeyListener kl = new KeystrokeDetector(DEFAULTS_EDITING);
4021*0Sstevel@tonic-gate             Association a;
4022*0Sstevel@tonic-gate             Object o;
4023*0Sstevel@tonic-gate 
4024*0Sstevel@tonic-gate             // Action listeners for Defaults
4025*0Sstevel@tonic-gate 
4026*0Sstevel@tonic-gate             il = new GlobalLockAcctAction();
4027*0Sstevel@tonic-gate             o = defaults.disableAccount;
4028*0Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
4029*0Sstevel@tonic-gate             defaultsNormal.addElement(a);
4030*0Sstevel@tonic-gate 
4031*0Sstevel@tonic-gate             il = new GlobalForcePwChangeAction();
4032*0Sstevel@tonic-gate             o = defaults.forcePasswordChange;
4033*0Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
4034*0Sstevel@tonic-gate             defaultsNormal.addElement(a);
4035*0Sstevel@tonic-gate 
4036*0Sstevel@tonic-gate             il = new GlobalAllowPostdatedAction();
4037*0Sstevel@tonic-gate             o = defaults.allowPostdatedTix;
4038*0Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
4039*0Sstevel@tonic-gate             defaultsNormal.addElement(a);
4040*0Sstevel@tonic-gate 
4041*0Sstevel@tonic-gate             il = new GlobalAllowForwardableAction();
4042*0Sstevel@tonic-gate             o = defaults.allowForwardableTix;
4043*0Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
4044*0Sstevel@tonic-gate             defaultsNormal.addElement(a);
4045*0Sstevel@tonic-gate 
4046*0Sstevel@tonic-gate             il = new GlobalAllowRenewableAction();
4047*0Sstevel@tonic-gate             o = defaults.allowRenewableTix;
4048*0Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
4049*0Sstevel@tonic-gate             defaultsNormal.addElement(a);
4050*0Sstevel@tonic-gate 
4051*0Sstevel@tonic-gate             il = new GlobalAllowProxiableAction();
4052*0Sstevel@tonic-gate             o = defaults.allowProxiableTix;
4053*0Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
4054*0Sstevel@tonic-gate             defaultsNormal.addElement(a);
4055*0Sstevel@tonic-gate 
4056*0Sstevel@tonic-gate             il = new GlobalAllowSvrAction();
4057*0Sstevel@tonic-gate             o = defaults.allowServiceTix;
4058*0Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
4059*0Sstevel@tonic-gate             defaultsNormal.addElement(a);
4060*0Sstevel@tonic-gate 
4061*0Sstevel@tonic-gate             il = new GlobalAllowTGTAction();
4062*0Sstevel@tonic-gate             o = defaults.allowTGTAuth;
4063*0Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
4064*0Sstevel@tonic-gate             defaultsNormal.addElement(a);
4065*0Sstevel@tonic-gate 
4066*0Sstevel@tonic-gate             il = new GlobalAllowDupAuthAction();
4067*0Sstevel@tonic-gate             o = defaults.allowDupAuth;
4068*0Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
4069*0Sstevel@tonic-gate             defaultsNormal.addElement(a);
4070*0Sstevel@tonic-gate 
4071*0Sstevel@tonic-gate             il = new GlobalRequirePreAuthAction();
4072*0Sstevel@tonic-gate             o = defaults.requirePreauth;
4073*0Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
4074*0Sstevel@tonic-gate             defaultsNormal.addElement(a);
4075*0Sstevel@tonic-gate 
4076*0Sstevel@tonic-gate             il = new GlobalRequireHwPreAuthAction();
4077*0Sstevel@tonic-gate             o = defaults.requireHWAuth;
4078*0Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
4079*0Sstevel@tonic-gate             defaultsNormal.addElement(a);
4080*0Sstevel@tonic-gate 
4081*0Sstevel@tonic-gate             il = new GlobalDefaultServerSideAction();
4082*0Sstevel@tonic-gate             o = defaults.serverSide;
4083*0Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
4084*0Sstevel@tonic-gate             defaultsNormal.addElement(a);
4085*0Sstevel@tonic-gate 
4086*0Sstevel@tonic-gate             al = new GlobalDefaultRenewableLifeAction();
4087*0Sstevel@tonic-gate             o = defaults.maxTicketRenewableLife;
4088*0Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
4089*0Sstevel@tonic-gate             defaultsNormal.addElement(a);
4090*0Sstevel@tonic-gate             a = new Association(o, kl, TEXTFIELD_KEY);
4091*0Sstevel@tonic-gate             defaultsNormal.addElement(a);
4092*0Sstevel@tonic-gate 
4093*0Sstevel@tonic-gate             al = new GlobalDefaultLifeAction();
4094*0Sstevel@tonic-gate             o = defaults.maxTicketLife;
4095*0Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
4096*0Sstevel@tonic-gate             defaultsNormal.addElement(a);
4097*0Sstevel@tonic-gate             a = new Association(o, kl, TEXTFIELD_KEY);
4098*0Sstevel@tonic-gate             defaultsNormal.addElement(a);
4099*0Sstevel@tonic-gate 
4100*0Sstevel@tonic-gate             al = new GlobalDefaultExpiryAction();
4101*0Sstevel@tonic-gate             o = defaults.accountExpiryDate;
4102*0Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
4103*0Sstevel@tonic-gate             defaultsNormal.addElement(a);
4104*0Sstevel@tonic-gate             a = new Association(o, kl, TEXTFIELD_KEY);
4105*0Sstevel@tonic-gate             defaultsNormal.addElement(a);
4106*0Sstevel@tonic-gate 
4107*0Sstevel@tonic-gate             il = new GlobalDefaultShowListsAction();
4108*0Sstevel@tonic-gate             o = defaults.showLists;
4109*0Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
4110*0Sstevel@tonic-gate             defaultsNormal.addElement(a);
4111*0Sstevel@tonic-gate 
4112*0Sstevel@tonic-gate             il = new GlobalDefaultStaticListsAction();
4113*0Sstevel@tonic-gate             o = defaults.staticLists;
4114*0Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
4115*0Sstevel@tonic-gate             defaultsNormal.addElement(a);
4116*0Sstevel@tonic-gate 
4117*0Sstevel@tonic-gate             al = new GlobalDefaultCacheTimeAction();
4118*0Sstevel@tonic-gate             o = defaults.cacheTime;
4119*0Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
4120*0Sstevel@tonic-gate             defaultsNormal.addElement(a);
4121*0Sstevel@tonic-gate             a = new Association(o, kl, TEXTFIELD_KEY);
4122*0Sstevel@tonic-gate             defaultsNormal.addElement(a);
4123*0Sstevel@tonic-gate 
4124*0Sstevel@tonic-gate             al = new GlobalSaveAction();
4125*0Sstevel@tonic-gate             o = defaults.saveButton;
4126*0Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
4127*0Sstevel@tonic-gate             defaultsNormal.addElement(a);
4128*0Sstevel@tonic-gate 
4129*0Sstevel@tonic-gate             al = new GlobalApplyAction();
4130*0Sstevel@tonic-gate             o = defaults.applyButton;
4131*0Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
4132*0Sstevel@tonic-gate             defaultsNormal.addElement(a);
4133*0Sstevel@tonic-gate 
4134*0Sstevel@tonic-gate             al = new GlobalCancelAction();
4135*0Sstevel@tonic-gate             o = defaults.cancelButton;
4136*0Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
4137*0Sstevel@tonic-gate             defaultsNormal.addElement(a);
4138*0Sstevel@tonic-gate 
4139*0Sstevel@tonic-gate             DateTimeListener dtl = new DateTimeListener(
4140*0Sstevel@tonic-gate 			defaults.accountExpiryDate, defaultsEditingFrame);
4141*0Sstevel@tonic-gate             o = defaults.dateMoreButton;
4142*0Sstevel@tonic-gate             a = new Association(o, dtl, BUTTON_ACTION);
4143*0Sstevel@tonic-gate             defaultsNormal.addElement(a);
4144*0Sstevel@tonic-gate 
4145*0Sstevel@tonic-gate             DurationListener dl = new DurationListener(
4146*0Sstevel@tonic-gate 		       defaults.maxTicketRenewableLife, defaultsEditingFrame);
4147*0Sstevel@tonic-gate             o = defaults.renewalMoreButton;
4148*0Sstevel@tonic-gate             a = new Association(o, dl, BUTTON_ACTION);
4149*0Sstevel@tonic-gate             defaultsNormal.addElement(a);
4150*0Sstevel@tonic-gate 
4151*0Sstevel@tonic-gate             dl = new DurationListener(defaults.maxTicketLife,
4152*0Sstevel@tonic-gate 				      defaultsEditingFrame);
4153*0Sstevel@tonic-gate             o = defaults.lifeMoreButton;
4154*0Sstevel@tonic-gate             a = new Association(o, dl, BUTTON_ACTION);
4155*0Sstevel@tonic-gate             defaultsNormal.addElement(a);
4156*0Sstevel@tonic-gate 
4157*0Sstevel@tonic-gate             dl = new DurationListener(defaults.cacheTime, defaultsEditingFrame);
4158*0Sstevel@tonic-gate             o = defaults.cacheMoreButton;
4159*0Sstevel@tonic-gate             a = new Association(o, dl, BUTTON_ACTION);
4160*0Sstevel@tonic-gate             defaultsNormal.addElement(a);
4161*0Sstevel@tonic-gate 
4162*0Sstevel@tonic-gate         }
4163*0Sstevel@tonic-gate         setListeners(defaultsHelp, false);
4164*0Sstevel@tonic-gate         setListeners(defaultsFixers, false);
4165*0Sstevel@tonic-gate         setListeners(defaultsNormal, true);
4166*0Sstevel@tonic-gate         defaultsHelpMode = false;
4167*0Sstevel@tonic-gate     }
4168*0Sstevel@tonic-gate 
4169*0Sstevel@tonic-gate     public void setupDefaultsHelpListeners() {
4170*0Sstevel@tonic-gate         if (defaultsHelp == null) {
4171*0Sstevel@tonic-gate             defaultsHelp = new Vector(10, 10);
4172*0Sstevel@tonic-gate             MouseListener ml = new HelpListener();
4173*0Sstevel@tonic-gate             Association a;
4174*0Sstevel@tonic-gate             Object o;
4175*0Sstevel@tonic-gate 
4176*0Sstevel@tonic-gate             o = defaults.disableAccount;
4177*0Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
4178*0Sstevel@tonic-gate             defaultsHelp.addElement(a);
4179*0Sstevel@tonic-gate             defaults.disableAccount.setName("GlobalLockAcct" /* NOI18N */);
4180*0Sstevel@tonic-gate 
4181*0Sstevel@tonic-gate             o = defaults.forcePasswordChange;
4182*0Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
4183*0Sstevel@tonic-gate             defaultsHelp.addElement(a);
4184*0Sstevel@tonic-gate             defaults.forcePasswordChange.setName("GlobalForcePwChange"
4185*0Sstevel@tonic-gate 						 /* NOI18N */);
4186*0Sstevel@tonic-gate 
4187*0Sstevel@tonic-gate             o = defaults.allowPostdatedTix;
4188*0Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
4189*0Sstevel@tonic-gate             defaultsHelp.addElement(a);
4190*0Sstevel@tonic-gate             defaults.allowPostdatedTix.setName("GlobalAllowPostdated"
4191*0Sstevel@tonic-gate 					       /* NOI18N */);
4192*0Sstevel@tonic-gate 
4193*0Sstevel@tonic-gate             o = defaults.allowForwardableTix;
4194*0Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
4195*0Sstevel@tonic-gate             defaultsHelp.addElement(a);
4196*0Sstevel@tonic-gate             defaults.allowForwardableTix.setName("GlobalAllowForwardable"
4197*0Sstevel@tonic-gate 						 /* NOI18N */);
4198*0Sstevel@tonic-gate 
4199*0Sstevel@tonic-gate             o = defaults.allowRenewableTix;
4200*0Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
4201*0Sstevel@tonic-gate             defaultsHelp.addElement(a);
4202*0Sstevel@tonic-gate             defaults.allowRenewableTix.setName("GlobalAllowRenewable"
4203*0Sstevel@tonic-gate 					       /* NOI18N */);
4204*0Sstevel@tonic-gate 
4205*0Sstevel@tonic-gate             o = defaults.allowProxiableTix;
4206*0Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
4207*0Sstevel@tonic-gate             defaultsHelp.addElement(a);
4208*0Sstevel@tonic-gate             defaults.allowProxiableTix.setName("GlobalAllowProxiable"
4209*0Sstevel@tonic-gate 					       /* NOI18N */);
4210*0Sstevel@tonic-gate 
4211*0Sstevel@tonic-gate             o = defaults.allowServiceTix;
4212*0Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
4213*0Sstevel@tonic-gate             defaultsHelp.addElement(a);
4214*0Sstevel@tonic-gate             defaults.allowServiceTix.setName("GlobalAllowSvr" /* NOI18N */);
4215*0Sstevel@tonic-gate 
4216*0Sstevel@tonic-gate             o = defaults.allowTGTAuth;
4217*0Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
4218*0Sstevel@tonic-gate             defaultsHelp.addElement(a);
4219*0Sstevel@tonic-gate             defaults.allowTGTAuth.setName("GlobalAllowTGT" /* NOI18N */);
4220*0Sstevel@tonic-gate 
4221*0Sstevel@tonic-gate             o = defaults.allowDupAuth;
4222*0Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
4223*0Sstevel@tonic-gate             defaultsHelp.addElement(a);
4224*0Sstevel@tonic-gate             defaults.allowDupAuth.setName("GlobalAllowDupAuth" /* NOI18N */);
4225*0Sstevel@tonic-gate 
4226*0Sstevel@tonic-gate             o = defaults.requirePreauth;
4227*0Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
4228*0Sstevel@tonic-gate             defaultsHelp.addElement(a);
4229*0Sstevel@tonic-gate             defaults.requirePreauth.setName("GlobalRequirePreAuth"
4230*0Sstevel@tonic-gate 					    /* NOI18N */);
4231*0Sstevel@tonic-gate 
4232*0Sstevel@tonic-gate             o = defaults.requireHWAuth;
4233*0Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
4234*0Sstevel@tonic-gate             defaultsHelp.addElement(a);
4235*0Sstevel@tonic-gate             defaults.requireHWAuth.setName("GlobalRequireHwPreAuth"
4236*0Sstevel@tonic-gate 					   /* NOI18N */);
4237*0Sstevel@tonic-gate 
4238*0Sstevel@tonic-gate             o = defaults.serverSide;
4239*0Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
4240*0Sstevel@tonic-gate             defaultsHelp.addElement(a);
4241*0Sstevel@tonic-gate             defaults.serverSide.setName("GlDefServerSide" /* NOI18N */);
4242*0Sstevel@tonic-gate 
4243*0Sstevel@tonic-gate             o = defaults.maxTicketRenewableLife;
4244*0Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
4245*0Sstevel@tonic-gate             defaultsHelp.addElement(a);
4246*0Sstevel@tonic-gate             defaults.maxTicketRenewableLife.setName("GlDefRenewableLife"
4247*0Sstevel@tonic-gate 						    /* NOI18N */);
4248*0Sstevel@tonic-gate 
4249*0Sstevel@tonic-gate             o = defaults.maxTicketRenewableLifeLabel;
4250*0Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
4251*0Sstevel@tonic-gate             defaultsHelp.addElement(a);
4252*0Sstevel@tonic-gate             defaults.maxTicketRenewableLifeLabel.setName("GlDefRenewableLife"
4253*0Sstevel@tonic-gate 							 /* NOI18N */);
4254*0Sstevel@tonic-gate 
4255*0Sstevel@tonic-gate             o = defaults.maxTicketLife;
4256*0Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
4257*0Sstevel@tonic-gate             defaultsHelp.addElement(a);
4258*0Sstevel@tonic-gate             defaults.maxTicketLife.setName("GlDefLife" /* NOI18N */);
4259*0Sstevel@tonic-gate 
4260*0Sstevel@tonic-gate             o = defaults.maxTicketLifeLabel;
4261*0Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
4262*0Sstevel@tonic-gate             defaultsHelp.addElement(a);
4263*0Sstevel@tonic-gate             defaults.maxTicketLifeLabel.setName("GlDefLife" /* NOI18N */);
4264*0Sstevel@tonic-gate 
4265*0Sstevel@tonic-gate             o = defaults.accountExpiryDate;
4266*0Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
4267*0Sstevel@tonic-gate             defaultsHelp.addElement(a);
4268*0Sstevel@tonic-gate             defaults.accountExpiryDate.setName("GlDefExpiry" /* NOI18N */);
4269*0Sstevel@tonic-gate 
4270*0Sstevel@tonic-gate             o = defaults.accountExpiryDateLabel;
4271*0Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
4272*0Sstevel@tonic-gate             defaultsHelp.addElement(a);
4273*0Sstevel@tonic-gate             defaults.accountExpiryDateLabel.setName("GlDefExpiry" /* NOI18N */);
4274*0Sstevel@tonic-gate 
4275*0Sstevel@tonic-gate             o = defaults.showLists;
4276*0Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
4277*0Sstevel@tonic-gate             defaultsHelp.addElement(a);
4278*0Sstevel@tonic-gate             defaults.showLists.setName("GlDefShowLists" /* NOI18N */);
4279*0Sstevel@tonic-gate 
4280*0Sstevel@tonic-gate             o = defaults.staticLists;
4281*0Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
4282*0Sstevel@tonic-gate             defaultsHelp.addElement(a);
4283*0Sstevel@tonic-gate             defaults.staticLists.setName("GlDefStaticLists" /* NOI18N */);
4284*0Sstevel@tonic-gate 
4285*0Sstevel@tonic-gate             o = defaults.cacheTime;
4286*0Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
4287*0Sstevel@tonic-gate             defaultsHelp.addElement(a);
4288*0Sstevel@tonic-gate             defaults.cacheTime.setName("GlDefCacheTime" /* NOI18N */);
4289*0Sstevel@tonic-gate 
4290*0Sstevel@tonic-gate             o = defaults.cacheTimeLabel;
4291*0Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
4292*0Sstevel@tonic-gate             defaultsHelp.addElement(a);
4293*0Sstevel@tonic-gate             defaults.cacheTimeLabel.setName("GlDefCacheTime" /* NOI18N */);
4294*0Sstevel@tonic-gate 
4295*0Sstevel@tonic-gate             o = defaults.saveButton;
4296*0Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
4297*0Sstevel@tonic-gate             defaultsHelp.addElement(a);
4298*0Sstevel@tonic-gate             defaults.saveButton.setName("GlobalSave" /* NOI18N */);
4299*0Sstevel@tonic-gate 
4300*0Sstevel@tonic-gate             o = defaults.applyButton;
4301*0Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
4302*0Sstevel@tonic-gate             defaultsHelp.addElement(a);
4303*0Sstevel@tonic-gate             defaults.applyButton.setName("GlobalApply" /* NOI18N */);
4304*0Sstevel@tonic-gate 
4305*0Sstevel@tonic-gate             o = defaults.cancelButton;
4306*0Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
4307*0Sstevel@tonic-gate             defaultsHelp.addElement(a);
4308*0Sstevel@tonic-gate             defaults.cancelButton.setName("GlobalCancel" /* NOI18N */);
4309*0Sstevel@tonic-gate 
4310*0Sstevel@tonic-gate             o = defaults.dateMoreButton;
4311*0Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
4312*0Sstevel@tonic-gate             defaultsHelp.addElement(a);
4313*0Sstevel@tonic-gate             defaults.dateMoreButton.setName("DateHelperButton" /* NOI18N */);
4314*0Sstevel@tonic-gate 
4315*0Sstevel@tonic-gate             o = defaults.lifeMoreButton;
4316*0Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
4317*0Sstevel@tonic-gate             defaultsHelp.addElement(a);
4318*0Sstevel@tonic-gate             defaults.lifeMoreButton.setName("DurationHelperButton"
4319*0Sstevel@tonic-gate 					    /* NOI18N */);
4320*0Sstevel@tonic-gate 
4321*0Sstevel@tonic-gate             o = defaults.renewalMoreButton;
4322*0Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
4323*0Sstevel@tonic-gate             defaultsHelp.addElement(a);
4324*0Sstevel@tonic-gate             defaults.renewalMoreButton.setName("DurationHelperButton"
4325*0Sstevel@tonic-gate 					       /* NOI18N */);
4326*0Sstevel@tonic-gate 
4327*0Sstevel@tonic-gate             o = defaults.cacheMoreButton;
4328*0Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
4329*0Sstevel@tonic-gate             defaultsHelp.addElement(a);
4330*0Sstevel@tonic-gate             defaults.cacheMoreButton.setName("DurationHelperButton"
4331*0Sstevel@tonic-gate 					     /* NOI18N */);
4332*0Sstevel@tonic-gate 
4333*0Sstevel@tonic-gate             setupDefaultsHelpFlagTogglers();
4334*0Sstevel@tonic-gate         }
4335*0Sstevel@tonic-gate 
4336*0Sstevel@tonic-gate         setListeners(defaultsNormal, false);
4337*0Sstevel@tonic-gate         setListeners(defaultsHelp, true);
4338*0Sstevel@tonic-gate         setupDefaultsHelpFixers();
4339*0Sstevel@tonic-gate         defaultsHelpMode = true;
4340*0Sstevel@tonic-gate     }
4341*0Sstevel@tonic-gate 
4342*0Sstevel@tonic-gate     /**
4343*0Sstevel@tonic-gate      * Helper method to setupDefaultsHelpListeners. Should be called from
4344*0Sstevel@tonic-gate      * only from there.
4345*0Sstevel@tonic-gate      */
4346*0Sstevel@tonic-gate     private void 	setupDefaultsHelpFlagTogglers() {
4347*0Sstevel@tonic-gate 
4348*0Sstevel@tonic-gate         if (defaultsHelp == null)
4349*0Sstevel@tonic-gate             return;
4350*0Sstevel@tonic-gate 
4351*0Sstevel@tonic-gate         CheckboxToggler ml = new CheckboxToggler();
4352*0Sstevel@tonic-gate         Object o;
4353*0Sstevel@tonic-gate         Association a;
4354*0Sstevel@tonic-gate 
4355*0Sstevel@tonic-gate         o = defaults.disableAccount;
4356*0Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
4357*0Sstevel@tonic-gate         defaultsHelp.addElement(a);
4358*0Sstevel@tonic-gate 
4359*0Sstevel@tonic-gate         o = defaults.forcePasswordChange;
4360*0Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
4361*0Sstevel@tonic-gate         defaultsHelp.addElement(a);
4362*0Sstevel@tonic-gate 
4363*0Sstevel@tonic-gate         o = defaults.allowPostdatedTix;
4364*0Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
4365*0Sstevel@tonic-gate         defaultsHelp.addElement(a);
4366*0Sstevel@tonic-gate 
4367*0Sstevel@tonic-gate         o = defaults.allowForwardableTix;
4368*0Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
4369*0Sstevel@tonic-gate         defaultsHelp.addElement(a);
4370*0Sstevel@tonic-gate 
4371*0Sstevel@tonic-gate         o = defaults.allowRenewableTix;
4372*0Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
4373*0Sstevel@tonic-gate         defaultsHelp.addElement(a);
4374*0Sstevel@tonic-gate 
4375*0Sstevel@tonic-gate         o = defaults.allowProxiableTix;
4376*0Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
4377*0Sstevel@tonic-gate         defaultsHelp.addElement(a);
4378*0Sstevel@tonic-gate 
4379*0Sstevel@tonic-gate         o = defaults.allowServiceTix;
4380*0Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
4381*0Sstevel@tonic-gate         defaultsHelp.addElement(a);
4382*0Sstevel@tonic-gate 
4383*0Sstevel@tonic-gate         o = defaults.allowTGTAuth;
4384*0Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
4385*0Sstevel@tonic-gate         defaultsHelp.addElement(a);
4386*0Sstevel@tonic-gate 
4387*0Sstevel@tonic-gate         o = defaults.allowDupAuth;
4388*0Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
4389*0Sstevel@tonic-gate         defaultsHelp.addElement(a);
4390*0Sstevel@tonic-gate 
4391*0Sstevel@tonic-gate         o = defaults.requirePreauth;
4392*0Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
4393*0Sstevel@tonic-gate         defaultsHelp.addElement(a);
4394*0Sstevel@tonic-gate 
4395*0Sstevel@tonic-gate         o = defaults.requireHWAuth;
4396*0Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
4397*0Sstevel@tonic-gate         defaultsHelp.addElement(a);
4398*0Sstevel@tonic-gate 
4399*0Sstevel@tonic-gate         o = defaults.showLists;
4400*0Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
4401*0Sstevel@tonic-gate         defaultsHelp.addElement(a);
4402*0Sstevel@tonic-gate 
4403*0Sstevel@tonic-gate         o = defaults.serverSide;
4404*0Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
4405*0Sstevel@tonic-gate         defaultsHelp.addElement(a);
4406*0Sstevel@tonic-gate 
4407*0Sstevel@tonic-gate         o = defaults.staticLists;
4408*0Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
4409*0Sstevel@tonic-gate         defaultsHelp.addElement(a);
4410*0Sstevel@tonic-gate     }
4411*0Sstevel@tonic-gate 
4412*0Sstevel@tonic-gate     public void setupDefaultsHelpFixers() {
4413*0Sstevel@tonic-gate         defaultsFixers = new Vector(10, 10);
4414*0Sstevel@tonic-gate         Association a;
4415*0Sstevel@tonic-gate         Object o;
4416*0Sstevel@tonic-gate         TextFixer tf;
4417*0Sstevel@tonic-gate 
4418*0Sstevel@tonic-gate         o = defaults.maxTicketRenewableLife;
4419*0Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
4420*0Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
4421*0Sstevel@tonic-gate         defaultsFixers.addElement(a);
4422*0Sstevel@tonic-gate 
4423*0Sstevel@tonic-gate         o = defaults.maxTicketLife;
4424*0Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
4425*0Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
4426*0Sstevel@tonic-gate         defaultsFixers.addElement(a);
4427*0Sstevel@tonic-gate 
4428*0Sstevel@tonic-gate         o = defaults.accountExpiryDate;
4429*0Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
4430*0Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
4431*0Sstevel@tonic-gate         defaultsFixers.addElement(a);
4432*0Sstevel@tonic-gate 
4433*0Sstevel@tonic-gate         o = defaults.cacheTime;
4434*0Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
4435*0Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
4436*0Sstevel@tonic-gate         defaultsFixers.addElement(a);
4437*0Sstevel@tonic-gate 
4438*0Sstevel@tonic-gate         setListeners(defaultsFixers, true);
4439*0Sstevel@tonic-gate     }
4440*0Sstevel@tonic-gate 
4441*0Sstevel@tonic-gate     /**
4442*0Sstevel@tonic-gate      * Set up listeners from a vector of Associations objects
4443*0Sstevel@tonic-gate      *
4444*0Sstevel@tonic-gate      */
4445*0Sstevel@tonic-gate     public void setListeners(Vector associations, boolean install) {
4446*0Sstevel@tonic-gate         setListeners(associations, install, false);
4447*0Sstevel@tonic-gate     }
4448*0Sstevel@tonic-gate 
4449*0Sstevel@tonic-gate     public void setListeners(Vector associations, boolean install, boolean loud)
4450*0Sstevel@tonic-gate     {
4451*0Sstevel@tonic-gate         Association a;
4452*0Sstevel@tonic-gate         Button b;
4453*0Sstevel@tonic-gate         TextField t;
4454*0Sstevel@tonic-gate         Choice c;
4455*0Sstevel@tonic-gate         Checkbox x;
4456*0Sstevel@tonic-gate         Label z;
4457*0Sstevel@tonic-gate         Window w;
4458*0Sstevel@tonic-gate 
4459*0Sstevel@tonic-gate         if (associations != null) {
4460*0Sstevel@tonic-gate             for (int i = 0; i < associations.size(); i++) {
4461*0Sstevel@tonic-gate                 a = (Association)associations.elementAt(i);
4462*0Sstevel@tonic-gate                 int type = a.Type;
4463*0Sstevel@tonic-gate                 EventListener el = a.Listener;
4464*0Sstevel@tonic-gate                 if (loud) {
4465*0Sstevel@tonic-gate                     Object o = a.Object;
4466*0Sstevel@tonic-gate                     String flag = install ? "install" : "deinstall";
4467*0Sstevel@tonic-gate                     System.out.println(flag+
4468*0Sstevel@tonic-gate 				       "ing listener "+el+" on component "+o);
4469*0Sstevel@tonic-gate                 }
4470*0Sstevel@tonic-gate 
4471*0Sstevel@tonic-gate                 switch (type) {
4472*0Sstevel@tonic-gate 		case BUTTON_ACTION:
4473*0Sstevel@tonic-gate                     b = (Button)a.Object;
4474*0Sstevel@tonic-gate                     if (install)
4475*0Sstevel@tonic-gate                         b.addActionListener((ActionListener)el);
4476*0Sstevel@tonic-gate                     else
4477*0Sstevel@tonic-gate                         b.removeActionListener((ActionListener)el);
4478*0Sstevel@tonic-gate                     break;
4479*0Sstevel@tonic-gate 
4480*0Sstevel@tonic-gate 		case BUTTON_MOUSE:
4481*0Sstevel@tonic-gate                     b = (Button)a.Object;
4482*0Sstevel@tonic-gate                     if (install)
4483*0Sstevel@tonic-gate                         b.addMouseListener((MouseListener)el);
4484*0Sstevel@tonic-gate                     else
4485*0Sstevel@tonic-gate                         b.removeMouseListener((MouseListener)el);
4486*0Sstevel@tonic-gate                     break;
4487*0Sstevel@tonic-gate 
4488*0Sstevel@tonic-gate 		case TEXTFIELD_ACTION:
4489*0Sstevel@tonic-gate                     t = (TextField)a.Object;
4490*0Sstevel@tonic-gate                     if (install)
4491*0Sstevel@tonic-gate                         t.addActionListener((ActionListener)el);
4492*0Sstevel@tonic-gate                     else
4493*0Sstevel@tonic-gate                         t.removeActionListener((ActionListener)el);
4494*0Sstevel@tonic-gate                     break;
4495*0Sstevel@tonic-gate 
4496*0Sstevel@tonic-gate 		case TEXTFIELD_MOUSE:
4497*0Sstevel@tonic-gate                     t = (TextField)a.Object;
4498*0Sstevel@tonic-gate                     if (install)
4499*0Sstevel@tonic-gate                         t.addMouseListener((MouseListener)el);
4500*0Sstevel@tonic-gate                     else
4501*0Sstevel@tonic-gate                         t.removeMouseListener((MouseListener)el);
4502*0Sstevel@tonic-gate                     break;
4503*0Sstevel@tonic-gate 
4504*0Sstevel@tonic-gate 		case TEXTFIELD_KEY:
4505*0Sstevel@tonic-gate                     t = (TextField)a.Object;
4506*0Sstevel@tonic-gate                     if (install)
4507*0Sstevel@tonic-gate                         t.addKeyListener((KeyListener)el);
4508*0Sstevel@tonic-gate                     else
4509*0Sstevel@tonic-gate                         t.removeKeyListener((KeyListener)el);
4510*0Sstevel@tonic-gate                     break;
4511*0Sstevel@tonic-gate 
4512*0Sstevel@tonic-gate 		case CHOICE_ITEM:
4513*0Sstevel@tonic-gate                     c = (Choice)a.Object;
4514*0Sstevel@tonic-gate                     if (install)
4515*0Sstevel@tonic-gate                         c.addItemListener((ItemListener)el);
4516*0Sstevel@tonic-gate                     else
4517*0Sstevel@tonic-gate                         c.removeItemListener((ItemListener)el);
4518*0Sstevel@tonic-gate                     break;
4519*0Sstevel@tonic-gate 
4520*0Sstevel@tonic-gate 		case CHOICE_MOUSE:
4521*0Sstevel@tonic-gate                     c = (Choice)a.Object;
4522*0Sstevel@tonic-gate                     if (install)
4523*0Sstevel@tonic-gate                         c.addMouseListener((MouseListener)el);
4524*0Sstevel@tonic-gate                     else
4525*0Sstevel@tonic-gate                         c.removeMouseListener((MouseListener)el);
4526*0Sstevel@tonic-gate                     break;
4527*0Sstevel@tonic-gate 
4528*0Sstevel@tonic-gate 		case CHECKBOX_ITEM:
4529*0Sstevel@tonic-gate                     x = (Checkbox)a.Object;
4530*0Sstevel@tonic-gate                     if (install)
4531*0Sstevel@tonic-gate                         x.addItemListener((ItemListener)el);
4532*0Sstevel@tonic-gate                     else
4533*0Sstevel@tonic-gate                         x.removeItemListener((ItemListener)el);
4534*0Sstevel@tonic-gate                     break;
4535*0Sstevel@tonic-gate 
4536*0Sstevel@tonic-gate 		case CHECKBOX_MOUSE:
4537*0Sstevel@tonic-gate                     x = (Checkbox)a.Object;
4538*0Sstevel@tonic-gate                     if (install)
4539*0Sstevel@tonic-gate                         x.addMouseListener((MouseListener)el);
4540*0Sstevel@tonic-gate                     else
4541*0Sstevel@tonic-gate                         x.removeMouseListener((MouseListener)el);
4542*0Sstevel@tonic-gate                     break;
4543*0Sstevel@tonic-gate 
4544*0Sstevel@tonic-gate 		case LABEL_MOUSE:
4545*0Sstevel@tonic-gate                     z = (Label)a.Object;
4546*0Sstevel@tonic-gate                     if (install)
4547*0Sstevel@tonic-gate                         z.addMouseListener((MouseListener)el);
4548*0Sstevel@tonic-gate                     else
4549*0Sstevel@tonic-gate                         z.removeMouseListener((MouseListener)el);
4550*0Sstevel@tonic-gate                     break;
4551*0Sstevel@tonic-gate 
4552*0Sstevel@tonic-gate 		case WINDOW_LISTENER:
4553*0Sstevel@tonic-gate                     w = (Window)a.Object;
4554*0Sstevel@tonic-gate                     if (install)
4555*0Sstevel@tonic-gate                         w.addWindowListener((WindowListener)el);
4556*0Sstevel@tonic-gate                     else
4557*0Sstevel@tonic-gate                         w.removeWindowListener((WindowListener)el);
4558*0Sstevel@tonic-gate                     break;
4559*0Sstevel@tonic-gate                 }
4560*0Sstevel@tonic-gate             }
4561*0Sstevel@tonic-gate         }
4562*0Sstevel@tonic-gate     }
4563*0Sstevel@tonic-gate 
4564*0Sstevel@tonic-gate     /*
4565*0Sstevel@tonic-gate      * About a million actions here ...
4566*0Sstevel@tonic-gate      */
4567*0Sstevel@tonic-gate     private class LoginOKAction implements ActionListener {
4568*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
4569*0Sstevel@tonic-gate             loginComplete();
4570*0Sstevel@tonic-gate         }
4571*0Sstevel@tonic-gate     }
4572*0Sstevel@tonic-gate 
4573*0Sstevel@tonic-gate     private class LoginStartOverAction implements ActionListener {
4574*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
4575*0Sstevel@tonic-gate             setLoginDefaults();
4576*0Sstevel@tonic-gate         }
4577*0Sstevel@tonic-gate     }
4578*0Sstevel@tonic-gate 
4579*0Sstevel@tonic-gate     private class LoginNameAction implements ActionListener {
4580*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
4581*0Sstevel@tonic-gate             nameComplete();
4582*0Sstevel@tonic-gate         }
4583*0Sstevel@tonic-gate     }
4584*0Sstevel@tonic-gate 
4585*0Sstevel@tonic-gate     private class LoginPassAction implements ActionListener {
4586*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
4587*0Sstevel@tonic-gate             loginComplete();
4588*0Sstevel@tonic-gate         }
4589*0Sstevel@tonic-gate     }
4590*0Sstevel@tonic-gate 
4591*0Sstevel@tonic-gate     private class LoginRealmAction implements ActionListener {
4592*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
4593*0Sstevel@tonic-gate             newRealm();
4594*0Sstevel@tonic-gate         }
4595*0Sstevel@tonic-gate     }
4596*0Sstevel@tonic-gate 
4597*0Sstevel@tonic-gate     private class LoginServerAction implements ActionListener {
4598*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
4599*0Sstevel@tonic-gate             newServer();
4600*0Sstevel@tonic-gate         }
4601*0Sstevel@tonic-gate     }
4602*0Sstevel@tonic-gate 
4603*0Sstevel@tonic-gate     private class MainWindowCloseAction extends WindowAdapter {
4604*0Sstevel@tonic-gate         public void windowClosing(WindowEvent e) {
4605*0Sstevel@tonic-gate             checkLogout();
4606*0Sstevel@tonic-gate         }
4607*0Sstevel@tonic-gate     };
4608*0Sstevel@tonic-gate 
4609*0Sstevel@tonic-gate     private class PrListPatternAction implements ActionListener {
4610*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
4611*0Sstevel@tonic-gate             prPatternComplete();
4612*0Sstevel@tonic-gate         }
4613*0Sstevel@tonic-gate     }
4614*0Sstevel@tonic-gate 
4615*0Sstevel@tonic-gate     private class PrListClearAction implements ActionListener {
4616*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
4617*0Sstevel@tonic-gate             prPatternClear();
4618*0Sstevel@tonic-gate         }
4619*0Sstevel@tonic-gate     }
4620*0Sstevel@tonic-gate 
4621*0Sstevel@tonic-gate     private class PrListModifyAction implements ActionListener {
4622*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
4623*0Sstevel@tonic-gate             prModify();
4624*0Sstevel@tonic-gate         }
4625*0Sstevel@tonic-gate     }
4626*0Sstevel@tonic-gate 
4627*0Sstevel@tonic-gate     private class PrListAddAction implements ActionListener {
4628*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
4629*0Sstevel@tonic-gate             prAdd();
4630*0Sstevel@tonic-gate         }
4631*0Sstevel@tonic-gate     }
4632*0Sstevel@tonic-gate 
4633*0Sstevel@tonic-gate     private class PrListDeleteAction implements ActionListener {
4634*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
4635*0Sstevel@tonic-gate             prDelete();
4636*0Sstevel@tonic-gate         }
4637*0Sstevel@tonic-gate     }
4638*0Sstevel@tonic-gate 
4639*0Sstevel@tonic-gate     private class PrListDuplicateAction implements ActionListener {
4640*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
4641*0Sstevel@tonic-gate             prDuplicate();
4642*0Sstevel@tonic-gate         }
4643*0Sstevel@tonic-gate     }
4644*0Sstevel@tonic-gate 
4645*0Sstevel@tonic-gate     private class PrCommentsAction implements ActionListener {
4646*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
4647*0Sstevel@tonic-gate             setPrComments();
4648*0Sstevel@tonic-gate             prSetNeedSave();
4649*0Sstevel@tonic-gate         }
4650*0Sstevel@tonic-gate     }
4651*0Sstevel@tonic-gate 
4652*0Sstevel@tonic-gate     private class PrPolicyAction implements ItemListener {
4653*0Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
4654*0Sstevel@tonic-gate             setPrPolicy();
4655*0Sstevel@tonic-gate             prSetNeedSave();
4656*0Sstevel@tonic-gate         }
4657*0Sstevel@tonic-gate     }
4658*0Sstevel@tonic-gate 
4659*0Sstevel@tonic-gate     private class PrPasswordAction implements ActionListener {
4660*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
4661*0Sstevel@tonic-gate             setPrPassword(!prin.isNew);
4662*0Sstevel@tonic-gate             prSetNeedSave();
4663*0Sstevel@tonic-gate         }
4664*0Sstevel@tonic-gate     }
4665*0Sstevel@tonic-gate 
4666*0Sstevel@tonic-gate     private class PrRandomPwAction implements ActionListener {
4667*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
4668*0Sstevel@tonic-gate             genRandomPassword();
4669*0Sstevel@tonic-gate             prSetNeedSave();
4670*0Sstevel@tonic-gate         }
4671*0Sstevel@tonic-gate     }
4672*0Sstevel@tonic-gate 
4673*0Sstevel@tonic-gate     private class PrExpiryAction implements ActionListener {
4674*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
4675*0Sstevel@tonic-gate             setPrExpiry();
4676*0Sstevel@tonic-gate             prSetNeedSave();
4677*0Sstevel@tonic-gate         }
4678*0Sstevel@tonic-gate     }
4679*0Sstevel@tonic-gate 
4680*0Sstevel@tonic-gate     private class PrSaveAction implements ActionListener {
4681*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
4682*0Sstevel@tonic-gate             prSave();
4683*0Sstevel@tonic-gate         }
4684*0Sstevel@tonic-gate     }
4685*0Sstevel@tonic-gate 
4686*0Sstevel@tonic-gate     private class PrCancelAction implements ActionListener {
4687*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
4688*0Sstevel@tonic-gate             prCancel();
4689*0Sstevel@tonic-gate         }
4690*0Sstevel@tonic-gate     }
4691*0Sstevel@tonic-gate 
4692*0Sstevel@tonic-gate     private class PrBasicPreviousAction implements ActionListener {
4693*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
4694*0Sstevel@tonic-gate             prBasicPrevious();
4695*0Sstevel@tonic-gate         }
4696*0Sstevel@tonic-gate     }
4697*0Sstevel@tonic-gate 
4698*0Sstevel@tonic-gate     private class PrBasicNextAction implements ActionListener {
4699*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
4700*0Sstevel@tonic-gate             prBasicNext();
4701*0Sstevel@tonic-gate         }
4702*0Sstevel@tonic-gate     }
4703*0Sstevel@tonic-gate 
4704*0Sstevel@tonic-gate     private class PrPwExpiryAction implements ActionListener {
4705*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
4706*0Sstevel@tonic-gate             setPrPwExpiry();
4707*0Sstevel@tonic-gate             prSetNeedSave();
4708*0Sstevel@tonic-gate         }
4709*0Sstevel@tonic-gate     }
4710*0Sstevel@tonic-gate 
4711*0Sstevel@tonic-gate     private class PrKvnoAction implements ActionListener {
4712*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
4713*0Sstevel@tonic-gate             setPrKvno();
4714*0Sstevel@tonic-gate             prSetNeedSave();
4715*0Sstevel@tonic-gate         }
4716*0Sstevel@tonic-gate     }
4717*0Sstevel@tonic-gate 
4718*0Sstevel@tonic-gate     private class PrMaxLifetimeAction implements ActionListener {
4719*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
4720*0Sstevel@tonic-gate             setPrMaxlife();
4721*0Sstevel@tonic-gate             prSetNeedSave();
4722*0Sstevel@tonic-gate         }
4723*0Sstevel@tonic-gate     }
4724*0Sstevel@tonic-gate 
4725*0Sstevel@tonic-gate     private class PrMaxRenewalAction implements ActionListener {
4726*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
4727*0Sstevel@tonic-gate             setPrMaxrenew();
4728*0Sstevel@tonic-gate             prSetNeedSave();
4729*0Sstevel@tonic-gate         }
4730*0Sstevel@tonic-gate     }
4731*0Sstevel@tonic-gate 
4732*0Sstevel@tonic-gate     private class PrDetailPreviousAction implements ActionListener {
4733*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
4734*0Sstevel@tonic-gate             prDetailPrevious();
4735*0Sstevel@tonic-gate         }
4736*0Sstevel@tonic-gate     }
4737*0Sstevel@tonic-gate 
4738*0Sstevel@tonic-gate     private class PrDetailNextAction implements ActionListener {
4739*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
4740*0Sstevel@tonic-gate             prDetailNext();
4741*0Sstevel@tonic-gate         }
4742*0Sstevel@tonic-gate     }
4743*0Sstevel@tonic-gate 
4744*0Sstevel@tonic-gate     private class PrFlagsPreviousAction implements ActionListener {
4745*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
4746*0Sstevel@tonic-gate             prFlagsPrevious();
4747*0Sstevel@tonic-gate         }
4748*0Sstevel@tonic-gate     }
4749*0Sstevel@tonic-gate 
4750*0Sstevel@tonic-gate     private class PrLockAcctAction implements ItemListener {
4751*0Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
4752*0Sstevel@tonic-gate             setPrFlag(Flags.DISALLOW_ALL_TIX);
4753*0Sstevel@tonic-gate             prSetNeedSave();
4754*0Sstevel@tonic-gate         }
4755*0Sstevel@tonic-gate     }
4756*0Sstevel@tonic-gate 
4757*0Sstevel@tonic-gate     private class PrForcePwChangeAction implements ItemListener {
4758*0Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
4759*0Sstevel@tonic-gate             setPrFlag(Flags.REQUIRES_PWCHANGE);
4760*0Sstevel@tonic-gate             prSetNeedSave();
4761*0Sstevel@tonic-gate         }
4762*0Sstevel@tonic-gate     }
4763*0Sstevel@tonic-gate 
4764*0Sstevel@tonic-gate     private class PrAllowPostdatedAction implements ItemListener {
4765*0Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
4766*0Sstevel@tonic-gate             setPrFlag(Flags.DISALLOW_POSTDATED);
4767*0Sstevel@tonic-gate             prSetNeedSave();
4768*0Sstevel@tonic-gate         }
4769*0Sstevel@tonic-gate     }
4770*0Sstevel@tonic-gate 
4771*0Sstevel@tonic-gate     private class PrAllowForwardableAction implements ItemListener {
4772*0Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
4773*0Sstevel@tonic-gate             setPrFlag(Flags.DISALLOW_FORWARDABLE);
4774*0Sstevel@tonic-gate             prSetNeedSave();
4775*0Sstevel@tonic-gate         }
4776*0Sstevel@tonic-gate     }
4777*0Sstevel@tonic-gate 
4778*0Sstevel@tonic-gate     private class PrAllowRenewableAction implements ItemListener {
4779*0Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
4780*0Sstevel@tonic-gate             setPrFlag(Flags.DISALLOW_RENEWABLE);
4781*0Sstevel@tonic-gate             prSetNeedSave();
4782*0Sstevel@tonic-gate         }
4783*0Sstevel@tonic-gate     }
4784*0Sstevel@tonic-gate 
4785*0Sstevel@tonic-gate     private class PrAllowProxiableAction implements ItemListener {
4786*0Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
4787*0Sstevel@tonic-gate             setPrFlag(Flags.DISALLOW_PROXIABLE);
4788*0Sstevel@tonic-gate             prSetNeedSave();
4789*0Sstevel@tonic-gate         }
4790*0Sstevel@tonic-gate     }
4791*0Sstevel@tonic-gate 
4792*0Sstevel@tonic-gate     private class PrAllowSvrAction implements ItemListener {
4793*0Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
4794*0Sstevel@tonic-gate             setPrFlag(Flags.DISALLOW_SVR);
4795*0Sstevel@tonic-gate             prSetNeedSave();
4796*0Sstevel@tonic-gate         }
4797*0Sstevel@tonic-gate     }
4798*0Sstevel@tonic-gate 
4799*0Sstevel@tonic-gate     private class PrAllowTGTAction implements ItemListener {
4800*0Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
4801*0Sstevel@tonic-gate             setPrFlag(Flags.DISALLOW_TGT_BASED);
4802*0Sstevel@tonic-gate             prSetNeedSave();
4803*0Sstevel@tonic-gate         }
4804*0Sstevel@tonic-gate     }
4805*0Sstevel@tonic-gate 
4806*0Sstevel@tonic-gate     private class PrAllowDupAuthAction implements ItemListener {
4807*0Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
4808*0Sstevel@tonic-gate             setPrFlag(Flags.DISALLOW_DUP_SKEY);
4809*0Sstevel@tonic-gate             prSetNeedSave();
4810*0Sstevel@tonic-gate         }
4811*0Sstevel@tonic-gate     }
4812*0Sstevel@tonic-gate 
4813*0Sstevel@tonic-gate     private class PrRequirePreAuthAction implements ItemListener {
4814*0Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
4815*0Sstevel@tonic-gate             setPrFlag(Flags.REQUIRE_PRE_AUTH);
4816*0Sstevel@tonic-gate             prSetNeedSave();
4817*0Sstevel@tonic-gate         }
4818*0Sstevel@tonic-gate     }
4819*0Sstevel@tonic-gate 
4820*0Sstevel@tonic-gate     private class PrRequireHwPreAuthAction implements ItemListener {
4821*0Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
4822*0Sstevel@tonic-gate             setPrFlag(Flags.REQUIRE_HW_AUTH);
4823*0Sstevel@tonic-gate             prSetNeedSave();
4824*0Sstevel@tonic-gate         }
4825*0Sstevel@tonic-gate     }
4826*0Sstevel@tonic-gate 
4827*0Sstevel@tonic-gate     private class PrFlagsNextAction implements ActionListener {
4828*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
4829*0Sstevel@tonic-gate             prFlagsDone();
4830*0Sstevel@tonic-gate         }
4831*0Sstevel@tonic-gate     }
4832*0Sstevel@tonic-gate 
4833*0Sstevel@tonic-gate     private class PoListPatternAction implements ActionListener {
4834*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
4835*0Sstevel@tonic-gate             poPatternComplete();
4836*0Sstevel@tonic-gate         }
4837*0Sstevel@tonic-gate     }
4838*0Sstevel@tonic-gate 
4839*0Sstevel@tonic-gate     private class PoListClearAction implements ActionListener {
4840*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
4841*0Sstevel@tonic-gate             poPatternClear();
4842*0Sstevel@tonic-gate         }
4843*0Sstevel@tonic-gate     }
4844*0Sstevel@tonic-gate 
4845*0Sstevel@tonic-gate     private class PoListModifyAction implements ActionListener {
4846*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
4847*0Sstevel@tonic-gate             poSelected();
4848*0Sstevel@tonic-gate         }
4849*0Sstevel@tonic-gate     }
4850*0Sstevel@tonic-gate 
4851*0Sstevel@tonic-gate     private class PoListAddAction implements ActionListener {
4852*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
4853*0Sstevel@tonic-gate             poAdd();
4854*0Sstevel@tonic-gate         }
4855*0Sstevel@tonic-gate     }
4856*0Sstevel@tonic-gate 
4857*0Sstevel@tonic-gate     private class PoListDeleteAction implements ActionListener {
4858*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
4859*0Sstevel@tonic-gate             poDelete();
4860*0Sstevel@tonic-gate         }
4861*0Sstevel@tonic-gate     }
4862*0Sstevel@tonic-gate 
4863*0Sstevel@tonic-gate     private class PoListDuplicateAction implements ActionListener {
4864*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
4865*0Sstevel@tonic-gate             poDuplicate();
4866*0Sstevel@tonic-gate         }
4867*0Sstevel@tonic-gate     }
4868*0Sstevel@tonic-gate 
4869*0Sstevel@tonic-gate     private class PoMinPwLengthAction implements ItemListener {
4870*0Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
4871*0Sstevel@tonic-gate             setPolPwLength();
4872*0Sstevel@tonic-gate             poSetNeedSave();
4873*0Sstevel@tonic-gate         }
4874*0Sstevel@tonic-gate     }
4875*0Sstevel@tonic-gate 
4876*0Sstevel@tonic-gate     private class PoMinPwClassAction implements ItemListener {
4877*0Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
4878*0Sstevel@tonic-gate             setPolPwClasses();
4879*0Sstevel@tonic-gate             poSetNeedSave();
4880*0Sstevel@tonic-gate         }
4881*0Sstevel@tonic-gate     }
4882*0Sstevel@tonic-gate 
4883*0Sstevel@tonic-gate     private class PoSavedPasswordsAction implements ItemListener {
4884*0Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
4885*0Sstevel@tonic-gate             setPolPwHistory();
4886*0Sstevel@tonic-gate             poSetNeedSave();
4887*0Sstevel@tonic-gate         }
4888*0Sstevel@tonic-gate     }
4889*0Sstevel@tonic-gate 
4890*0Sstevel@tonic-gate     private class PoMinTicketLifetimeAction implements ActionListener {
4891*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
4892*0Sstevel@tonic-gate             setPolMinlife();
4893*0Sstevel@tonic-gate             poSetNeedSave();
4894*0Sstevel@tonic-gate         }
4895*0Sstevel@tonic-gate     }
4896*0Sstevel@tonic-gate 
4897*0Sstevel@tonic-gate     private class PoMaxTicketLifetimeAction implements ActionListener {
4898*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
4899*0Sstevel@tonic-gate             setPolMaxlife();
4900*0Sstevel@tonic-gate             poSetNeedSave();
4901*0Sstevel@tonic-gate         }
4902*0Sstevel@tonic-gate     }
4903*0Sstevel@tonic-gate 
4904*0Sstevel@tonic-gate     private class PoSaveAction implements ActionListener {
4905*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
4906*0Sstevel@tonic-gate             poSave();
4907*0Sstevel@tonic-gate         }
4908*0Sstevel@tonic-gate     }
4909*0Sstevel@tonic-gate 
4910*0Sstevel@tonic-gate     private class PoCancelAction implements ActionListener {
4911*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
4912*0Sstevel@tonic-gate             poCancel();
4913*0Sstevel@tonic-gate         }
4914*0Sstevel@tonic-gate     }
4915*0Sstevel@tonic-gate 
4916*0Sstevel@tonic-gate     private class PoPreviousAction implements ActionListener {
4917*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
4918*0Sstevel@tonic-gate             polPrevious();
4919*0Sstevel@tonic-gate         }
4920*0Sstevel@tonic-gate     }
4921*0Sstevel@tonic-gate 
4922*0Sstevel@tonic-gate     private class PoDoneAction implements ActionListener {
4923*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
4924*0Sstevel@tonic-gate             polDone();
4925*0Sstevel@tonic-gate         }
4926*0Sstevel@tonic-gate     }
4927*0Sstevel@tonic-gate 
4928*0Sstevel@tonic-gate     private class GlobalLockAcctAction implements ItemListener {
4929*0Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
4930*0Sstevel@tonic-gate             setGlobalFlag(Flags.DISALLOW_ALL_TIX);
4931*0Sstevel@tonic-gate         }
4932*0Sstevel@tonic-gate     }
4933*0Sstevel@tonic-gate 
4934*0Sstevel@tonic-gate     private class GlobalForcePwChangeAction implements ItemListener {
4935*0Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
4936*0Sstevel@tonic-gate             setGlobalFlag(Flags.REQUIRES_PWCHANGE);
4937*0Sstevel@tonic-gate         }
4938*0Sstevel@tonic-gate     }
4939*0Sstevel@tonic-gate 
4940*0Sstevel@tonic-gate     private class GlobalAllowPostdatedAction implements ItemListener {
4941*0Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
4942*0Sstevel@tonic-gate             setGlobalFlag(Flags.DISALLOW_POSTDATED);
4943*0Sstevel@tonic-gate         }
4944*0Sstevel@tonic-gate     }
4945*0Sstevel@tonic-gate 
4946*0Sstevel@tonic-gate     private class GlobalAllowForwardableAction implements ItemListener {
4947*0Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
4948*0Sstevel@tonic-gate             setGlobalFlag(Flags.DISALLOW_FORWARDABLE);
4949*0Sstevel@tonic-gate         }
4950*0Sstevel@tonic-gate     }
4951*0Sstevel@tonic-gate 
4952*0Sstevel@tonic-gate     private class GlobalAllowRenewableAction implements ItemListener {
4953*0Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
4954*0Sstevel@tonic-gate             setGlobalFlag(Flags.DISALLOW_RENEWABLE);
4955*0Sstevel@tonic-gate         }
4956*0Sstevel@tonic-gate     }
4957*0Sstevel@tonic-gate 
4958*0Sstevel@tonic-gate     private class GlobalAllowProxiableAction implements ItemListener {
4959*0Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
4960*0Sstevel@tonic-gate             setGlobalFlag(Flags.DISALLOW_PROXIABLE);
4961*0Sstevel@tonic-gate         }
4962*0Sstevel@tonic-gate     }
4963*0Sstevel@tonic-gate 
4964*0Sstevel@tonic-gate     private class GlobalAllowSvrAction implements ItemListener {
4965*0Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
4966*0Sstevel@tonic-gate             setGlobalFlag(Flags.DISALLOW_SVR);
4967*0Sstevel@tonic-gate         }
4968*0Sstevel@tonic-gate     }
4969*0Sstevel@tonic-gate 
4970*0Sstevel@tonic-gate     private class GlobalAllowTGTAction implements ItemListener {
4971*0Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
4972*0Sstevel@tonic-gate             setGlobalFlag(Flags.DISALLOW_TGT_BASED);
4973*0Sstevel@tonic-gate         }
4974*0Sstevel@tonic-gate     }
4975*0Sstevel@tonic-gate 
4976*0Sstevel@tonic-gate     private class GlobalAllowDupAuthAction implements ItemListener {
4977*0Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
4978*0Sstevel@tonic-gate             setGlobalFlag(Flags.DISALLOW_DUP_SKEY);
4979*0Sstevel@tonic-gate         }
4980*0Sstevel@tonic-gate     }
4981*0Sstevel@tonic-gate 
4982*0Sstevel@tonic-gate     private class GlobalRequirePreAuthAction implements ItemListener {
4983*0Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
4984*0Sstevel@tonic-gate             setGlobalFlag(Flags.REQUIRE_PRE_AUTH);
4985*0Sstevel@tonic-gate         }
4986*0Sstevel@tonic-gate     }
4987*0Sstevel@tonic-gate 
4988*0Sstevel@tonic-gate     private class GlobalRequireHwPreAuthAction implements ItemListener {
4989*0Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
4990*0Sstevel@tonic-gate             setGlobalFlag(Flags.REQUIRE_HW_AUTH);
4991*0Sstevel@tonic-gate         }
4992*0Sstevel@tonic-gate     }
4993*0Sstevel@tonic-gate 
4994*0Sstevel@tonic-gate     private class GlobalDefaultServerSideAction implements ItemListener {
4995*0Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
4996*0Sstevel@tonic-gate             setServerSide();
4997*0Sstevel@tonic-gate         }
4998*0Sstevel@tonic-gate     }
4999*0Sstevel@tonic-gate 
5000*0Sstevel@tonic-gate     private class GlobalDefaultRenewableLifeAction implements ActionListener {
5001*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
5002*0Sstevel@tonic-gate             if (!setGlobalMaxrenew()) {
5003*0Sstevel@tonic-gate                 ((TextField)e.getSource()).requestFocus();
5004*0Sstevel@tonic-gate             }
5005*0Sstevel@tonic-gate         }
5006*0Sstevel@tonic-gate     }
5007*0Sstevel@tonic-gate 
5008*0Sstevel@tonic-gate     private class GlobalDefaultLifeAction implements ActionListener {
5009*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
5010*0Sstevel@tonic-gate             if (!setGlobalMaxlife()) {
5011*0Sstevel@tonic-gate                 ((TextField)e.getSource()).requestFocus();
5012*0Sstevel@tonic-gate             }
5013*0Sstevel@tonic-gate         }
5014*0Sstevel@tonic-gate     }
5015*0Sstevel@tonic-gate 
5016*0Sstevel@tonic-gate     private class GlobalDefaultExpiryAction implements ActionListener {
5017*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
5018*0Sstevel@tonic-gate             if (!setGlobalExpiry())
5019*0Sstevel@tonic-gate                 ((TextField)e.getSource()).requestFocus();
5020*0Sstevel@tonic-gate         }
5021*0Sstevel@tonic-gate     }
5022*0Sstevel@tonic-gate 
5023*0Sstevel@tonic-gate     private class GlobalDefaultShowListsAction implements ItemListener {
5024*0Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
5025*0Sstevel@tonic-gate             setShowLists();
5026*0Sstevel@tonic-gate         }
5027*0Sstevel@tonic-gate     }
5028*0Sstevel@tonic-gate 
5029*0Sstevel@tonic-gate     private class GlobalDefaultStaticListsAction implements ItemListener {
5030*0Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
5031*0Sstevel@tonic-gate             setStaticLists();
5032*0Sstevel@tonic-gate         }
5033*0Sstevel@tonic-gate     }
5034*0Sstevel@tonic-gate 
5035*0Sstevel@tonic-gate     private class GlobalDefaultCacheTimeAction implements ActionListener {
5036*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
5037*0Sstevel@tonic-gate             setCacheTime();
5038*0Sstevel@tonic-gate         }
5039*0Sstevel@tonic-gate     }
5040*0Sstevel@tonic-gate 
5041*0Sstevel@tonic-gate     private class GlobalSaveAction implements ActionListener {
5042*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
5043*0Sstevel@tonic-gate             glSave();
5044*0Sstevel@tonic-gate         }
5045*0Sstevel@tonic-gate     }
5046*0Sstevel@tonic-gate 
5047*0Sstevel@tonic-gate     private class GlobalApplyAction implements ActionListener {
5048*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
5049*0Sstevel@tonic-gate             glApply();
5050*0Sstevel@tonic-gate         }
5051*0Sstevel@tonic-gate     }
5052*0Sstevel@tonic-gate 
5053*0Sstevel@tonic-gate     private class GlobalCancelAction implements ActionListener {
5054*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
5055*0Sstevel@tonic-gate             glCancel();
5056*0Sstevel@tonic-gate         }
5057*0Sstevel@tonic-gate     }
5058*0Sstevel@tonic-gate 
5059*0Sstevel@tonic-gate     private class HelpListener extends MouseAdapter {
5060*0Sstevel@tonic-gate         public void mouseClicked(MouseEvent e) {
5061*0Sstevel@tonic-gate             showHelp(e.getComponent().getName());
5062*0Sstevel@tonic-gate         }
5063*0Sstevel@tonic-gate     }
5064*0Sstevel@tonic-gate 
5065*0Sstevel@tonic-gate     private class CheckboxToggler extends MouseAdapter {
5066*0Sstevel@tonic-gate         public void mouseClicked(MouseEvent e) {
5067*0Sstevel@tonic-gate             if (e.getComponent() instanceof Checkbox) {
5068*0Sstevel@tonic-gate                 Checkbox cb = (Checkbox)e.getComponent();
5069*0Sstevel@tonic-gate                 cb.setState(!cb.getState());
5070*0Sstevel@tonic-gate             }
5071*0Sstevel@tonic-gate         }
5072*0Sstevel@tonic-gate     }
5073*0Sstevel@tonic-gate 
5074*0Sstevel@tonic-gate     private class ChoiceFixer implements ItemListener {
5075*0Sstevel@tonic-gate         private Choice c;
5076*0Sstevel@tonic-gate         private String s;
5077*0Sstevel@tonic-gate 
5078*0Sstevel@tonic-gate         ChoiceFixer(Choice c) {
5079*0Sstevel@tonic-gate             this.c = c;
5080*0Sstevel@tonic-gate             s = c.getSelectedItem();
5081*0Sstevel@tonic-gate             // System.out.println("CF: Saving string "+s);
5082*0Sstevel@tonic-gate         }
5083*0Sstevel@tonic-gate 
5084*0Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
5085*0Sstevel@tonic-gate             if (e.getSource() == c && !c.getSelectedItem().equals(s))
5086*0Sstevel@tonic-gate                 c.select(s);
5087*0Sstevel@tonic-gate             // System.out.println("CF: Restoring string "+s);
5088*0Sstevel@tonic-gate         }
5089*0Sstevel@tonic-gate     }
5090*0Sstevel@tonic-gate 
5091*0Sstevel@tonic-gate     private class TextFixer extends KeyAdapter {
5092*0Sstevel@tonic-gate         private TextField t;
5093*0Sstevel@tonic-gate         private String s;
5094*0Sstevel@tonic-gate 
5095*0Sstevel@tonic-gate         TextFixer(TextField t) {
5096*0Sstevel@tonic-gate             this.t = t;
5097*0Sstevel@tonic-gate             s = t.getText();
5098*0Sstevel@tonic-gate             // System.out.println("TF: Saving string "+s);
5099*0Sstevel@tonic-gate         }
5100*0Sstevel@tonic-gate 
5101*0Sstevel@tonic-gate         public void keyTyped(KeyEvent e) {
5102*0Sstevel@tonic-gate             if (e.getSource() == t)
5103*0Sstevel@tonic-gate                 t.setText(s);
5104*0Sstevel@tonic-gate             // System.out.println("TF: Restoring string "+s);
5105*0Sstevel@tonic-gate         }
5106*0Sstevel@tonic-gate     }
5107*0Sstevel@tonic-gate 
5108*0Sstevel@tonic-gate     /*
5109*0Sstevel@tonic-gate      * End of the million listeners
5110*0Sstevel@tonic-gate      */
5111*0Sstevel@tonic-gate 
5112*0Sstevel@tonic-gate     /**
5113*0Sstevel@tonic-gate      * Call rb.getString(), but catch exception and returns English
5114*0Sstevel@tonic-gate      * key so that small spelling errors don't cripple the GUI
5115*0Sstevel@tonic-gate      *
5116*0Sstevel@tonic-gate      */
5117*0Sstevel@tonic-gate     private static final String getString(String key) {
5118*0Sstevel@tonic-gate         try {
5119*0Sstevel@tonic-gate             String res = rb.getString(key);
5120*0Sstevel@tonic-gate             return res;
5121*0Sstevel@tonic-gate         } catch (MissingResourceException e) {
5122*0Sstevel@tonic-gate             System.out.println("Missing resource "+key+", using English.");
5123*0Sstevel@tonic-gate             return key;
5124*0Sstevel@tonic-gate         }
5125*0Sstevel@tonic-gate     }
5126*0Sstevel@tonic-gate 
5127*0Sstevel@tonic-gate     private static final String getHelpString(String key) {
5128*0Sstevel@tonic-gate         String res;
5129*0Sstevel@tonic-gate         try {
5130*0Sstevel@tonic-gate             res = hrb.getString(key);
5131*0Sstevel@tonic-gate         } catch (MissingResourceException e) {
5132*0Sstevel@tonic-gate             res = "Missing help on key "+key;
5133*0Sstevel@tonic-gate         }
5134*0Sstevel@tonic-gate         return res;
5135*0Sstevel@tonic-gate     }
5136*0Sstevel@tonic-gate 
5137*0Sstevel@tonic-gate 
5138*0Sstevel@tonic-gate     /**
5139*0Sstevel@tonic-gate      * Check the privileges this principal has to see what we should not try.
5140*0Sstevel@tonic-gate      */
5141*0Sstevel@tonic-gate     private boolean checkPrivs() {
5142*0Sstevel@tonic-gate         boolean okay = true;
5143*0Sstevel@tonic-gate         String lpriv = (((privs & PRIV_ADD) == 0) ? "A" : "a")
5144*0Sstevel@tonic-gate 	    + (((privs & PRIV_DELETE) == 0) ? "D" : "d")
5145*0Sstevel@tonic-gate 	    + (((privs & PRIV_MODIFY) == 0) ? "M" : "m")
5146*0Sstevel@tonic-gate 	    + (((privs & PRIV_CHANGEPW) == 0) ? "C" : "c")
5147*0Sstevel@tonic-gate 	    + (((privs & PRIV_INQUIRE) == 0) ? "I" : "i")
5148*0Sstevel@tonic-gate 	    + (((privs & PRIV_LIST) == 0) ? "L" : "l");
5149*0Sstevel@tonic-gate         // System.out.println("Privileges are "+lpriv+" "
5150*0Sstevel@tonic-gate         // 			+(new Integer(privs).toString()));
5151*0Sstevel@tonic-gate         /**
5152*0Sstevel@tonic-gate          * Having modify is not useful if we can't either add or see
5153*0Sstevel@tonic-gate          * old values
5154*0Sstevel@tonic-gate          */
5155*0Sstevel@tonic-gate         if ((privs & (PRIV_MODIFY | PRIV_INQUIRE | PRIV_ADD)) == PRIV_MODIFY)
5156*0Sstevel@tonic-gate             okay = false;
5157*0Sstevel@tonic-gate         /* Having changepw without inquire is not useful */
5158*0Sstevel@tonic-gate         if (privs == PRIV_CHANGEPW)
5159*0Sstevel@tonic-gate             okay = false;
5160*0Sstevel@tonic-gate         if (!okay) {
5161*0Sstevel@tonic-gate             showLoginError(
5162*0Sstevel@tonic-gate 		   getString("Insufficient privileges to use gkadmin: ")+lpriv
5163*0Sstevel@tonic-gate 			   +getString(" Please try using another principal."));
5164*0Sstevel@tonic-gate             return false;
5165*0Sstevel@tonic-gate         }
5166*0Sstevel@tonic-gate         return true;
5167*0Sstevel@tonic-gate     }
5168*0Sstevel@tonic-gate 
5169*0Sstevel@tonic-gate     /*
5170*0Sstevel@tonic-gate      * Try to cope with the privileges we have.
5171*0Sstevel@tonic-gate      */
5172*0Sstevel@tonic-gate     private void reactToPrivs() {
5173*0Sstevel@tonic-gate         Boolean off = new Boolean(false);
5174*0Sstevel@tonic-gate 
5175*0Sstevel@tonic-gate         /*
5176*0Sstevel@tonic-gate          * If we don't have the Add privilege, we turn off "Create New"
5177*0Sstevel@tonic-gate          * and "Duplicate".  "Duplicate" is also handled in prSelValid/
5178*0Sstevel@tonic-gate          * poSelValid because it's sensitive to selection from the lists.
5179*0Sstevel@tonic-gate          */
5180*0Sstevel@tonic-gate         if ((privs & PRIV_ADD) == 0) {
5181*0Sstevel@tonic-gate             // System.out.println("Disabling Create New buttons");
5182*0Sstevel@tonic-gate             gui.PrListAdd.set("enabled" /* NOI18N */, off);
5183*0Sstevel@tonic-gate             gui.PoListAdd.set("enabled" /* NOI18N */, off);
5184*0Sstevel@tonic-gate             gui.PrListDuplicate.set("enabled" /* NOI18N */, off);
5185*0Sstevel@tonic-gate             gui.PoListDuplicate.set("enabled" /* NOI18N */, off);
5186*0Sstevel@tonic-gate         }
5187*0Sstevel@tonic-gate 
5188*0Sstevel@tonic-gate         /*
5189*0Sstevel@tonic-gate          * If we don't have the Delete privilege, we turn off "Delete".
5190*0Sstevel@tonic-gate          * This is also done in prSelValid/poSelValid because it is
5191*0Sstevel@tonic-gate          * thought about when a list item is selected.
5192*0Sstevel@tonic-gate          */
5193*0Sstevel@tonic-gate         if ((privs & PRIV_DELETE) == 0) {
5194*0Sstevel@tonic-gate             // System.out.println("Disabling Delete buttons");
5195*0Sstevel@tonic-gate             gui.PrListDelete.set("enabled" /* NOI18N */, off);
5196*0Sstevel@tonic-gate             gui.PoListDelete.set("enabled" /* NOI18N */, off);
5197*0Sstevel@tonic-gate         }
5198*0Sstevel@tonic-gate 
5199*0Sstevel@tonic-gate         /*
5200*0Sstevel@tonic-gate          * If we don't have changepw, disable textfield and random button.
5201*0Sstevel@tonic-gate          * Add needs to turn this on again for an add operation only.
5202*0Sstevel@tonic-gate          */
5203*0Sstevel@tonic-gate         if ((privs & PRIV_CHANGEPW) == 0) {
5204*0Sstevel@tonic-gate             // System.out.println("Disabling password components");
5205*0Sstevel@tonic-gate             gui.PrPassword.set("enabled" /* NOI18N */, off);
5206*0Sstevel@tonic-gate             gui.PrBasicRandomPw.set("enabled" /* NOI18N */, off);
5207*0Sstevel@tonic-gate         }
5208*0Sstevel@tonic-gate 
5209*0Sstevel@tonic-gate         /*
5210*0Sstevel@tonic-gate          * If we don't have inquire, we can't get an existing principal
5211*0Sstevel@tonic-gate          * to duplicate, and permitting modification seems a bad idea.
5212*0Sstevel@tonic-gate          * We can still use the panels if we can add.  These will also
5213*0Sstevel@tonic-gate          * get dealt with in prSelValid/poSelValid.
5214*0Sstevel@tonic-gate          */
5215*0Sstevel@tonic-gate         if ((privs & PRIV_INQUIRE) == 0) {
5216*0Sstevel@tonic-gate             // System.out.println("Disabling Modify buttons");
5217*0Sstevel@tonic-gate             gui.PrListModify.set("enabled" /* NOI18N */, off);
5218*0Sstevel@tonic-gate             gui.PoListModify.set("enabled" /* NOI18N */, off);
5219*0Sstevel@tonic-gate             gui.PrListDuplicate.set("enabled" /* NOI18N */, off);
5220*0Sstevel@tonic-gate             gui.PoListDuplicate.set("enabled" /* NOI18N */, off);
5221*0Sstevel@tonic-gate         }
5222*0Sstevel@tonic-gate 
5223*0Sstevel@tonic-gate         /*
5224*0Sstevel@tonic-gate          * If we don't have Modify or Add but do have Inquire, we want to
5225*0Sstevel@tonic-gate          * turn off save and cancel buttons, as well as all principal and
5226*0Sstevel@tonic-gate          * policy components to prevent any changes.
5227*0Sstevel@tonic-gate          */
5228*0Sstevel@tonic-gate         if ((privs & (PRIV_MODIFY | PRIV_ADD)) == 0) {
5229*0Sstevel@tonic-gate             // System.out.println("Disabling attribute components");
5230*0Sstevel@tonic-gate             enablePrAttributes(off);
5231*0Sstevel@tonic-gate             enablePoAttributes(off);
5232*0Sstevel@tonic-gate         }
5233*0Sstevel@tonic-gate 
5234*0Sstevel@tonic-gate         /*
5235*0Sstevel@tonic-gate          * We may have no list privs, or we may have turned off lists.
5236*0Sstevel@tonic-gate          * Set things up accordingly.
5237*0Sstevel@tonic-gate          */
5238*0Sstevel@tonic-gate         noLists = ((privs & PRIV_LIST) == 0 || !defaults.getShowLists());
5239*0Sstevel@tonic-gate         fixListPanels();
5240*0Sstevel@tonic-gate     }
5241*0Sstevel@tonic-gate 
5242*0Sstevel@tonic-gate     private void fixListPanels() {
5243*0Sstevel@tonic-gate         /*
5244*0Sstevel@tonic-gate          * If we can't use lists, we won't fetch lists, which means the
5245*0Sstevel@tonic-gate          * only way to get a principal is to type something into the
5246*0Sstevel@tonic-gate          * list pattern field.  Relabel those so they work better.
5247*0Sstevel@tonic-gate          */
5248*0Sstevel@tonic-gate         String s;
5249*0Sstevel@tonic-gate         Boolean yes = new Boolean(true);
5250*0Sstevel@tonic-gate         Boolean no = new Boolean(false);
5251*0Sstevel@tonic-gate         if (noLists) {
5252*0Sstevel@tonic-gate             // System.out.println("Hijacking list pattern stuff");
5253*0Sstevel@tonic-gate             gui.PrListLabel.set("enabled" /* NOI18N */, no);
5254*0Sstevel@tonic-gate             gui.PoListLabel.set("enabled" /* NOI18N */, no);
5255*0Sstevel@tonic-gate             s = getString("Principal Name:");
5256*0Sstevel@tonic-gate             gui.PrSearchLab.set("text" /* NOI18N */, s);
5257*0Sstevel@tonic-gate             s = getString("Policy Name:");
5258*0Sstevel@tonic-gate             gui.PoListPatternLabel.set("text" /* NOI18N */, s);
5259*0Sstevel@tonic-gate             s = getString("Clear Name");
5260*0Sstevel@tonic-gate             gui.PrListClear.set("text" /* NOI18N */, s);
5261*0Sstevel@tonic-gate             gui.PoListClear.set("text" /* NOI18N */, s);
5262*0Sstevel@tonic-gate             gui.Prlist.set("enabled", no);
5263*0Sstevel@tonic-gate             gui.Pollist.set("enabled", no);
5264*0Sstevel@tonic-gate             gui.refreshPrincipals.set("enabled", no);
5265*0Sstevel@tonic-gate             gui.refreshPolicies.set("enabled", no);
5266*0Sstevel@tonic-gate             gui.Prlist.set("selectedItem" /* NOI18N */, null);
5267*0Sstevel@tonic-gate             gui.Pollist.set("selectedItem" /* NOI18N */, null);
5268*0Sstevel@tonic-gate             gui.PrintPrlist.set("enabled" /* NOI18N */, no);
5269*0Sstevel@tonic-gate             gui.PrintPollist.set("enabled" /* NOI18N */, no);
5270*0Sstevel@tonic-gate         } else {
5271*0Sstevel@tonic-gate             gui.PrListLabel.set("enabled" /* NOI18N */, yes);
5272*0Sstevel@tonic-gate             gui.PoListLabel.set("enabled" /* NOI18N */, yes);
5273*0Sstevel@tonic-gate             s = getString("Filter Pattern:");
5274*0Sstevel@tonic-gate             gui.PrSearchLab.set("text" /* NOI18N */, s);
5275*0Sstevel@tonic-gate             gui.PoListPatternLabel.set("text" /* NOI18N */, s);
5276*0Sstevel@tonic-gate             s = getString("Clear Filter");
5277*0Sstevel@tonic-gate             gui.PrListClear.set("text" /* NOI18N */, s);
5278*0Sstevel@tonic-gate             gui.PoListClear.set("text" /* NOI18N */, s);
5279*0Sstevel@tonic-gate             gui.Prlist.set("enabled", yes);
5280*0Sstevel@tonic-gate             gui.Pollist.set("enabled", yes);
5281*0Sstevel@tonic-gate             gui.refreshPrincipals.set("enabled", yes);
5282*0Sstevel@tonic-gate             gui.refreshPolicies.set("enabled", yes);
5283*0Sstevel@tonic-gate             gui.PrintPrlist.set("enabled", yes);
5284*0Sstevel@tonic-gate             gui.PrintPollist.set("enabled", yes);
5285*0Sstevel@tonic-gate         }
5286*0Sstevel@tonic-gate     }
5287*0Sstevel@tonic-gate 
5288*0Sstevel@tonic-gate     private void enablePrAttributes(Boolean sense) {
5289*0Sstevel@tonic-gate         // Basics
5290*0Sstevel@tonic-gate         gui.PrPolicy.set("enabled" /* NOI18N */, sense);
5291*0Sstevel@tonic-gate         gui.PrExpiry.set("enabled" /* NOI18N */, sense);
5292*0Sstevel@tonic-gate         gui.PrComments.set("enabled" /* NOI18N */, sense);
5293*0Sstevel@tonic-gate         // Details
5294*0Sstevel@tonic-gate         gui.PrPwExpiry.set("enabled" /* NOI18N */, sense);
5295*0Sstevel@tonic-gate         gui.PrKvno.set("enabled" /* NOI18N */, sense);
5296*0Sstevel@tonic-gate         gui.PrMaxLifetime.set("enabled" /* NOI18N */, sense);
5297*0Sstevel@tonic-gate         gui.PrMaxRenewal.set("enabled" /* NOI18N */, sense);
5298*0Sstevel@tonic-gate         // Flags
5299*0Sstevel@tonic-gate         gui.PrLockAcct.set("enabled" /* NOI18N */, sense);
5300*0Sstevel@tonic-gate         gui.PrForcePwChange.set("enabled" /* NOI18N */, sense);
5301*0Sstevel@tonic-gate         gui.PrAllowPostdated.set("enabled" /* NOI18N */, sense);
5302*0Sstevel@tonic-gate         gui.PrAllowForwardable.set("enabled" /* NOI18N */, sense);
5303*0Sstevel@tonic-gate         gui.PrAllowRenewable.set("enabled" /* NOI18N */, sense);
5304*0Sstevel@tonic-gate         gui.PrAllowProxiable.set("enabled" /* NOI18N */, sense);
5305*0Sstevel@tonic-gate         gui.PrAllowSvr.set("enabled" /* NOI18N */, sense);
5306*0Sstevel@tonic-gate         gui.PrAllowTGT.set("enabled" /* NOI18N */, sense);
5307*0Sstevel@tonic-gate         gui.PrAllowDupAuth.set("enabled" /* NOI18N */, sense);
5308*0Sstevel@tonic-gate         gui.PrRequirePreAuth.set("enabled" /* NOI18N */, sense);
5309*0Sstevel@tonic-gate         gui.PrRequireHwPreAuth.set("enabled" /* NOI18N */, sense);
5310*0Sstevel@tonic-gate     }
5311*0Sstevel@tonic-gate 
5312*0Sstevel@tonic-gate     private void enablePoAttributes(Boolean sense) {
5313*0Sstevel@tonic-gate         // Policy
5314*0Sstevel@tonic-gate         gui.PoMinPwLength.set("enabled" /* NOI18N */, sense);
5315*0Sstevel@tonic-gate         gui.PoMinPwClass.set("enabled" /* NOI18N */, sense);
5316*0Sstevel@tonic-gate         gui.PoSavedPasswords.set("enabled" /* NOI18N */, sense);
5317*0Sstevel@tonic-gate         gui.PoMinTicketLifetime.set("enabled" /* NOI18N */, sense);
5318*0Sstevel@tonic-gate         gui.PoMaxTicketLifetime.set("enabled" /* NOI18N */, sense);
5319*0Sstevel@tonic-gate     }
5320*0Sstevel@tonic-gate 
5321*0Sstevel@tonic-gate     /**
5322*0Sstevel@tonic-gate      * Show context-sensitive help from HelpData class
5323*0Sstevel@tonic-gate      *
5324*0Sstevel@tonic-gate      */
5325*0Sstevel@tonic-gate     public void showHelp(String what) {
5326*0Sstevel@tonic-gate         String res;
5327*0Sstevel@tonic-gate 
5328*0Sstevel@tonic-gate         // System.out.println("Help on "+what);
5329*0Sstevel@tonic-gate         if (cHelp == null) {
5330*0Sstevel@tonic-gate             // System.out.println("showHelp called without context.");
5331*0Sstevel@tonic-gate             return;
5332*0Sstevel@tonic-gate         }
5333*0Sstevel@tonic-gate         res = getHelpString(what);
5334*0Sstevel@tonic-gate         cHelp.setText(res);
5335*0Sstevel@tonic-gate         cHelp.setVisible(true);
5336*0Sstevel@tonic-gate     }
5337*0Sstevel@tonic-gate 
5338*0Sstevel@tonic-gate     /**
5339*0Sstevel@tonic-gate      * Holds an association between an object and a listener, keeping
5340*0Sstevel@tonic-gate      * track of the types so that they can be assigned en masse later
5341*0Sstevel@tonic-gate      *
5342*0Sstevel@tonic-gate      */
5343*0Sstevel@tonic-gate     private class Association extends Object {
5344*0Sstevel@tonic-gate         Object Object;
5345*0Sstevel@tonic-gate         EventListener Listener;
5346*0Sstevel@tonic-gate         int Type;
5347*0Sstevel@tonic-gate 
5348*0Sstevel@tonic-gate         public Association(Object obj, EventListener list, int type) {
5349*0Sstevel@tonic-gate             Object = obj;
5350*0Sstevel@tonic-gate             Listener = list;
5351*0Sstevel@tonic-gate             Type = type;
5352*0Sstevel@tonic-gate         }
5353*0Sstevel@tonic-gate     }
5354*0Sstevel@tonic-gate 
5355*0Sstevel@tonic-gate     /**
5356*0Sstevel@tonic-gate      * Action listeners for the defaults editing frame.
5357*0Sstevel@tonic-gate      */
5358*0Sstevel@tonic-gate 
5359*0Sstevel@tonic-gate     private class DefaultsContextSensitiveHelpListener
5360*0Sstevel@tonic-gate 	implements ActionListener {
5361*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
5362*0Sstevel@tonic-gate             if (defaultsHelpMode)
5363*0Sstevel@tonic-gate                 showHelp("ContextSensitiveHelp");
5364*0Sstevel@tonic-gate             else
5365*0Sstevel@tonic-gate                 contextHelp(defaultsEditingFrame);
5366*0Sstevel@tonic-gate         }
5367*0Sstevel@tonic-gate     }
5368*0Sstevel@tonic-gate 
5369*0Sstevel@tonic-gate     /**
5370*0Sstevel@tonic-gate      * This class launches the dateTimeDialog box when the user presses
5371*0Sstevel@tonic-gate      * the "..." button. An instance of this is shared by all the
5372*0Sstevel@tonic-gate      * buttons that are meant to do this.
5373*0Sstevel@tonic-gate      */
5374*0Sstevel@tonic-gate     private class DateTimeListener  implements ActionListener {
5375*0Sstevel@tonic-gate 
5376*0Sstevel@tonic-gate         private TextField tf;
5377*0Sstevel@tonic-gate         private Frame frame;
5378*0Sstevel@tonic-gate 
5379*0Sstevel@tonic-gate         DateTimeListener(TextField tf, Frame frame) {
5380*0Sstevel@tonic-gate             this.tf = tf;
5381*0Sstevel@tonic-gate             this.frame = frame;
5382*0Sstevel@tonic-gate         }
5383*0Sstevel@tonic-gate 
5384*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
5385*0Sstevel@tonic-gate             if (mainHelpMode && frame == realMainFrame)
5386*0Sstevel@tonic-gate                 showHelp("DateTime...");
5387*0Sstevel@tonic-gate             else
5388*0Sstevel@tonic-gate                 if (defaultsHelpMode && frame == defaultsEditingFrame)
5389*0Sstevel@tonic-gate 		    showHelp("DateTime...");
5390*0Sstevel@tonic-gate 		else
5391*0Sstevel@tonic-gate 		    getDateTimeFromDialogBox(tf, frame);
5392*0Sstevel@tonic-gate         } // actionPerformed
5393*0Sstevel@tonic-gate     } // class DateTimeListener
5394*0Sstevel@tonic-gate 
5395*0Sstevel@tonic-gate     /**
5396*0Sstevel@tonic-gate      * This class launches the durrationHelper dialog box when the user presses
5397*0Sstevel@tonic-gate      * the "..." button. An instance of this is shared by all the
5398*0Sstevel@tonic-gate      * buttons that are meant to do this.
5399*0Sstevel@tonic-gate      */
5400*0Sstevel@tonic-gate     private class DurationListener implements ActionListener {
5401*0Sstevel@tonic-gate 
5402*0Sstevel@tonic-gate         private TextField tf;
5403*0Sstevel@tonic-gate         private Frame frame;
5404*0Sstevel@tonic-gate 
5405*0Sstevel@tonic-gate         DurationListener(TextField tf, Frame frame) {
5406*0Sstevel@tonic-gate             this.tf = tf;
5407*0Sstevel@tonic-gate             this.frame = frame;
5408*0Sstevel@tonic-gate         }
5409*0Sstevel@tonic-gate 
5410*0Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
5411*0Sstevel@tonic-gate             if (mainHelpMode && frame == realMainFrame)
5412*0Sstevel@tonic-gate                 showHelp("Duration...");
5413*0Sstevel@tonic-gate             else
5414*0Sstevel@tonic-gate                 if (defaultsHelpMode && frame == defaultsEditingFrame)
5415*0Sstevel@tonic-gate 		    showHelp("Duration...");
5416*0Sstevel@tonic-gate 		else
5417*0Sstevel@tonic-gate 		    getDurationFromDialogBox(tf, frame);
5418*0Sstevel@tonic-gate         }
5419*0Sstevel@tonic-gate     }
5420*0Sstevel@tonic-gate 
5421*0Sstevel@tonic-gate 
5422*0Sstevel@tonic-gate     private class KeystrokeDetector extends KeyAdapter {
5423*0Sstevel@tonic-gate 
5424*0Sstevel@tonic-gate         private int changeType; // principal or policy change
5425*0Sstevel@tonic-gate 
5426*0Sstevel@tonic-gate         public KeystrokeDetector(int type) {
5427*0Sstevel@tonic-gate             changeType = type;
5428*0Sstevel@tonic-gate         }
5429*0Sstevel@tonic-gate 
5430*0Sstevel@tonic-gate         public void keyTyped(KeyEvent e) {
5431*0Sstevel@tonic-gate             reactToKey(changeType);
5432*0Sstevel@tonic-gate             ((TextField)e.getComponent()).requestFocus();
5433*0Sstevel@tonic-gate         }
5434*0Sstevel@tonic-gate     }
5435*0Sstevel@tonic-gate 
5436*0Sstevel@tonic-gate     private void reactToKey(int changeType) {
5437*0Sstevel@tonic-gate         switch (changeType) {
5438*0Sstevel@tonic-gate 	case PRINCIPAL_EDITING:
5439*0Sstevel@tonic-gate             prSetNeedSave();
5440*0Sstevel@tonic-gate             break;
5441*0Sstevel@tonic-gate 
5442*0Sstevel@tonic-gate 	case POLICY_EDITING:
5443*0Sstevel@tonic-gate             poSetNeedSave();
5444*0Sstevel@tonic-gate             break;
5445*0Sstevel@tonic-gate 
5446*0Sstevel@tonic-gate 	case DEFAULTS_EDITING:
5447*0Sstevel@tonic-gate             glSetNeedSave();
5448*0Sstevel@tonic-gate             break;
5449*0Sstevel@tonic-gate 
5450*0Sstevel@tonic-gate 	case PRINCIPAL_LIST:
5451*0Sstevel@tonic-gate             if (noLists)
5452*0Sstevel@tonic-gate                 prSelValid(true);
5453*0Sstevel@tonic-gate             break;
5454*0Sstevel@tonic-gate 
5455*0Sstevel@tonic-gate 	case POLICY_LIST:
5456*0Sstevel@tonic-gate             if (noLists)
5457*0Sstevel@tonic-gate                 poSelValid(true);
5458*0Sstevel@tonic-gate             break;
5459*0Sstevel@tonic-gate         }
5460*0Sstevel@tonic-gate     }
5461*0Sstevel@tonic-gate 
5462*0Sstevel@tonic-gate     private static String enclose(String value) {
5463*0Sstevel@tonic-gate         return new StringBuffer("\"").append(value).append("\"").toString();
5464*0Sstevel@tonic-gate     }
5465*0Sstevel@tonic-gate 
5466*0Sstevel@tonic-gate     private static String constructDurationExample() {
5467*0Sstevel@tonic-gate         StringBuffer result = new StringBuffer(getString("Example: "));
5468*0Sstevel@tonic-gate         result.append(enclose(nf.format(28800)));
5469*0Sstevel@tonic-gate         return result.toString();
5470*0Sstevel@tonic-gate     }
5471*0Sstevel@tonic-gate 
5472*0Sstevel@tonic-gate     private static String constructDateExample() {
5473*0Sstevel@tonic-gate         StringBuffer result = new StringBuffer(getString("Example: "));
5474*0Sstevel@tonic-gate         result.append(enclose(df.format(new Date())));
5475*0Sstevel@tonic-gate         result.append(' ').append(getString("or")).append(' ');
5476*0Sstevel@tonic-gate         result.append(enclose(neverString));
5477*0Sstevel@tonic-gate         return result.toString();
5478*0Sstevel@tonic-gate     }
5479*0Sstevel@tonic-gate 
5480*0Sstevel@tonic-gate     private static String constructNumberExample() {
5481*0Sstevel@tonic-gate         StringBuffer result =  new StringBuffer(getString("Example: "));
5482*0Sstevel@tonic-gate         result.append(enclose(nf.format(4)));
5483*0Sstevel@tonic-gate         return result.toString();
5484*0Sstevel@tonic-gate     }
5485*0Sstevel@tonic-gate 
5486*0Sstevel@tonic-gate     static {
5487*0Sstevel@tonic-gate         rb = ResourceBundle.getBundle("GuiResource" /* NOI18N */);
5488*0Sstevel@tonic-gate         hrb = ResourceBundle.getBundle("HelpData" /* NOI18N */);
5489*0Sstevel@tonic-gate         df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM,
5490*0Sstevel@tonic-gate 					    DateFormat.MEDIUM);
5491*0Sstevel@tonic-gate         nf = NumberFormat.getInstance();
5492*0Sstevel@tonic-gate 
5493*0Sstevel@tonic-gate         neverString = getString("Never");
5494*0Sstevel@tonic-gate 
5495*0Sstevel@tonic-gate         toolkit = Toolkit.getDefaultToolkit();
5496*0Sstevel@tonic-gate 
5497*0Sstevel@tonic-gate         durationErrorText = new String[] {getHelpString("Bad Duration"),
5498*0Sstevel@tonic-gate 					  constructDurationExample()};
5499*0Sstevel@tonic-gate         dateErrorText = new String[] {getHelpString("Bad Date"),
5500*0Sstevel@tonic-gate 				      constructDateExample()};
5501*0Sstevel@tonic-gate         numberErrorText = new String[] {getHelpString("Bad Number"),
5502*0Sstevel@tonic-gate 					constructNumberExample()};
5503*0Sstevel@tonic-gate     }
5504*0Sstevel@tonic-gate 
5505*0Sstevel@tonic-gate }
5506