10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
50Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
60Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
70Sstevel@tonic-gate  * with the License.
80Sstevel@tonic-gate  *
90Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
100Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
110Sstevel@tonic-gate  * See the License for the specific language governing permissions
120Sstevel@tonic-gate  * and limitations under the License.
130Sstevel@tonic-gate  *
140Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
150Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
160Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
170Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
180Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
190Sstevel@tonic-gate  *
200Sstevel@tonic-gate  * CDDL HEADER END
210Sstevel@tonic-gate  */
220Sstevel@tonic-gate /*
230Sstevel@tonic-gate  * ident	"%Z%%M%	%I%	%E% SMI"
240Sstevel@tonic-gate  *
25*96Ssemery  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
260Sstevel@tonic-gate  * Use is subject to license terms.
270Sstevel@tonic-gate  */
280Sstevel@tonic-gate 
290Sstevel@tonic-gate /**
300Sstevel@tonic-gate  * GUI interface for Kerberos KDC
310Sstevel@tonic-gate  */
320Sstevel@tonic-gate 
330Sstevel@tonic-gate // Java Workshop stuff
340Sstevel@tonic-gate import sunsoft.jws.visual.rt.base.*;
350Sstevel@tonic-gate import sunsoft.jws.visual.rt.base.Global;
360Sstevel@tonic-gate import sunsoft.jws.visual.rt.awt.TabbedFolder;
370Sstevel@tonic-gate import sunsoft.jws.visual.rt.awt.TextList;
380Sstevel@tonic-gate import sunsoft.jws.visual.rt.awt.StringVector;
390Sstevel@tonic-gate import sunsoft.jws.visual.rt.shadow.java.awt.*;
400Sstevel@tonic-gate 
410Sstevel@tonic-gate // Regular JDK stuff
420Sstevel@tonic-gate import java.awt.*;
430Sstevel@tonic-gate import java.awt.event.*;
440Sstevel@tonic-gate import java.util.EventListener;
450Sstevel@tonic-gate import java.util.Properties;
460Sstevel@tonic-gate import java.util.Vector;
470Sstevel@tonic-gate import java.util.Random;
480Sstevel@tonic-gate import java.util.StringTokenizer;
490Sstevel@tonic-gate import java.io.IOException;
500Sstevel@tonic-gate import java.io.File;
510Sstevel@tonic-gate import java.io.InputStream;
520Sstevel@tonic-gate import java.net.URL;
530Sstevel@tonic-gate 
540Sstevel@tonic-gate // Stuff to support I18N
550Sstevel@tonic-gate import java.util.Date;
560Sstevel@tonic-gate import java.util.Calendar;
570Sstevel@tonic-gate import java.util.GregorianCalendar;
580Sstevel@tonic-gate import java.util.Locale;
590Sstevel@tonic-gate import java.text.DateFormat;
600Sstevel@tonic-gate import java.text.ParseException;
610Sstevel@tonic-gate import java.text.DateFormatSymbols;
620Sstevel@tonic-gate import java.text.NumberFormat;
630Sstevel@tonic-gate import java.util.ResourceBundle;
640Sstevel@tonic-gate import java.util.ListResourceBundle;
650Sstevel@tonic-gate import java.util.MissingResourceException;
660Sstevel@tonic-gate import java.util.Enumeration;
670Sstevel@tonic-gate 
680Sstevel@tonic-gate public class KdcGui extends Group {
690Sstevel@tonic-gate 
700Sstevel@tonic-gate     // Basics
710Sstevel@tonic-gate     private KdcGuiRoot gui;
720Sstevel@tonic-gate     private Krb5Conf kc;
730Sstevel@tonic-gate     private Principal prin = null;
740Sstevel@tonic-gate     private Policy pol = null;
750Sstevel@tonic-gate     private Defaults defaults = null;
760Sstevel@tonic-gate     private Defaults olddefaults = null;
770Sstevel@tonic-gate     public Frame defaultsEditingFrame = null; // public since used
780Sstevel@tonic-gate     // by ContextHelp class
790Sstevel@tonic-gate     public Frame realMainFrame = null;
800Sstevel@tonic-gate     public Frame realLoginFrame = null;
810Sstevel@tonic-gate 
820Sstevel@tonic-gate     public Kadmin Kadmin = null;
830Sstevel@tonic-gate 
840Sstevel@tonic-gate     // Privileges stuff: corresponds to ADMCIL set in kdc.conf
850Sstevel@tonic-gate     public int privs = 0;
860Sstevel@tonic-gate     public static final int PRIV_ADD	= 0x02;		// KADM5_PRIV_ADD
870Sstevel@tonic-gate     public static final int PRIV_DELETE	= 0x08;		// KADM5_PRIV_DELETE
880Sstevel@tonic-gate     public static final int PRIV_MODIFY	= 0x04;		// KADM5_PRIV_MODIFY
890Sstevel@tonic-gate     public static final int PRIV_CHANGEPW	= 0x20;	// KADM5_PRIV_CPW
900Sstevel@tonic-gate     public static final int PRIV_INQUIRE	= 0x01;	// KADM5_PRIV_GET
910Sstevel@tonic-gate     public static final int PRIV_LIST	= 0x10;		// KADM5_PRIV_LIST
920Sstevel@tonic-gate     public boolean noLists = false;
930Sstevel@tonic-gate 
940Sstevel@tonic-gate     // For modal warning dialog and context-sensitive help dialog
950Sstevel@tonic-gate     private Dialog dialog;
960Sstevel@tonic-gate     public ContextHelp cHelp = null; // tweaked from ContextHelp when
970Sstevel@tonic-gate     // it is dismissed
980Sstevel@tonic-gate 
990Sstevel@tonic-gate     private static Toolkit toolkit;
1000Sstevel@tonic-gate 
1010Sstevel@tonic-gate     // For showDataFormatError() to determine what kind of error to show
1020Sstevel@tonic-gate 
1030Sstevel@tonic-gate     public static final int DURATION_DATA = 1;
1040Sstevel@tonic-gate     public static final int DATE_DATA = 2;
1050Sstevel@tonic-gate     public static final int NUMBER_DATA = 3;
1060Sstevel@tonic-gate 
1070Sstevel@tonic-gate     private static String[] durationErrorText = null;
1080Sstevel@tonic-gate     private static String[] dateErrorText = null;
1090Sstevel@tonic-gate     private static String[] numberErrorText = null;
1100Sstevel@tonic-gate 
1110Sstevel@tonic-gate     // For date & time helper dialogs
1120Sstevel@tonic-gate     private DateTimeDialog dateTimeDialog = null;
1130Sstevel@tonic-gate     private DurationHelper durationHelper = null;
114*96Ssemery 
115*96Ssemery     // For the encryption list helper dialog
116*96Ssemery     private EncListDialog encListDialog = null;
1170Sstevel@tonic-gate 
1180Sstevel@tonic-gate     // Important defaults and current settings
1190Sstevel@tonic-gate     private String DefName = null;
1200Sstevel@tonic-gate     private String DefRealm = null;
1210Sstevel@tonic-gate     private String DefServer = null;
1220Sstevel@tonic-gate     private String DefPort = "0";
1230Sstevel@tonic-gate     private String CurName, CurPass, CurRealm, CurServer;
1240Sstevel@tonic-gate     private int CurPort;
1250Sstevel@tonic-gate     private String CurPrincipal;
1260Sstevel@tonic-gate     private String CurPolicy;
1270Sstevel@tonic-gate     private String curPrPattern = "";
1280Sstevel@tonic-gate     private String curPoPattern = "";
1290Sstevel@tonic-gate     private int curPrListPos = 0;
1300Sstevel@tonic-gate     private int curPoListPos = 0;
1310Sstevel@tonic-gate     private String[] principalList = null;
1320Sstevel@tonic-gate     private Date principalListDate = new Date(0);
1330Sstevel@tonic-gate     private String[] policyList = null;
1340Sstevel@tonic-gate     private Date policyListDate = new Date(0);
1350Sstevel@tonic-gate     private static final long A_LONG_TIME = 1000 * 60 * 60 * 24 * 365;
1360Sstevel@tonic-gate 
1370Sstevel@tonic-gate     // General state variables
1380Sstevel@tonic-gate     private boolean prSelValid = false;
1390Sstevel@tonic-gate     private String[] prMulti = null;
1400Sstevel@tonic-gate     private boolean prNeedSave = false;
1410Sstevel@tonic-gate     private boolean poSelValid = false;
1420Sstevel@tonic-gate     private String[] poMulti = null;
1430Sstevel@tonic-gate     private boolean poNeedSave = false;
1440Sstevel@tonic-gate     private boolean glNeedSave = false;
1450Sstevel@tonic-gate     private boolean firsttime = true;
1460Sstevel@tonic-gate     private boolean prnameEditable = false;
1470Sstevel@tonic-gate     private boolean ponameEditable = false;
1480Sstevel@tonic-gate 
1490Sstevel@tonic-gate     // Support for context-sensitive help
1500Sstevel@tonic-gate     private static final int BUTTON_ACTION = 1;
1510Sstevel@tonic-gate     private static final int BUTTON_MOUSE = 2;
1520Sstevel@tonic-gate     private static final int TEXTFIELD_ACTION = 3;
1530Sstevel@tonic-gate     private static final int TEXTFIELD_MOUSE = 4;
1540Sstevel@tonic-gate     private static final int TEXTFIELD_KEY = 5;
1550Sstevel@tonic-gate     private static final int CHOICE_ITEM = 6;
1560Sstevel@tonic-gate     private static final int CHOICE_MOUSE = 7;
1570Sstevel@tonic-gate     private static final int CHECKBOX_ITEM = 8;
1580Sstevel@tonic-gate     private static final int CHECKBOX_MOUSE = 9;
1590Sstevel@tonic-gate     private static final int LABEL_MOUSE = 10;
1600Sstevel@tonic-gate     private static final int WINDOW_LISTENER = 11;
1610Sstevel@tonic-gate 
1620Sstevel@tonic-gate     private boolean loginListeners = false;
1630Sstevel@tonic-gate     private Vector LoginNormal = null;
1640Sstevel@tonic-gate     private Vector LoginHelp = null;
1650Sstevel@tonic-gate     private Vector LoginFixers = null;
1660Sstevel@tonic-gate     private Vector MainNormal = null;
1670Sstevel@tonic-gate     private Vector MainHelp = null;
1680Sstevel@tonic-gate     private Vector MainFixers = null;
1690Sstevel@tonic-gate     private Vector defaultsNormal = null;
1700Sstevel@tonic-gate     private Vector defaultsHelp = null;
1710Sstevel@tonic-gate     private Vector defaultsFixers = null;
1720Sstevel@tonic-gate     public boolean loginHelpMode = false;
1730Sstevel@tonic-gate     public boolean mainHelpMode = false;
1740Sstevel@tonic-gate     public boolean defaultsHelpMode = false;
1750Sstevel@tonic-gate 
1760Sstevel@tonic-gate     // For Principal and Policy Keystroke listeners
1770Sstevel@tonic-gate     private static final int PRINCIPAL_EDITING = 1;
1780Sstevel@tonic-gate     private static final int POLICY_EDITING = 2;
1790Sstevel@tonic-gate     private static final int DEFAULTS_EDITING = 3;
1800Sstevel@tonic-gate     private static final int PRINCIPAL_LIST = 4;
1810Sstevel@tonic-gate     private static final int POLICY_LIST = 5;
1820Sstevel@tonic-gate 
1830Sstevel@tonic-gate     // For status line
1840Sstevel@tonic-gate     private String OpString = "";
1850Sstevel@tonic-gate     private String ModeString = "";
1860Sstevel@tonic-gate     private String SaveString = "";
1870Sstevel@tonic-gate 
1880Sstevel@tonic-gate     // For I18N
1890Sstevel@tonic-gate     private static ResourceBundle rb;
1900Sstevel@tonic-gate     private static ResourceBundle hrb;
1910Sstevel@tonic-gate     private static DateFormat df;
1920Sstevel@tonic-gate     private static NumberFormat nf;
1930Sstevel@tonic-gate 
1940Sstevel@tonic-gate     private static String neverString;
1950Sstevel@tonic-gate 
1960Sstevel@tonic-gate     // For general pupose help
1970Sstevel@tonic-gate     Process browserProcess;
1980Sstevel@tonic-gate     String helpIndexFile = "file:/usr/lib/krb5/HelpIndex.html";
1990Sstevel@tonic-gate 
2000Sstevel@tonic-gate     // For performance monitoring
2010Sstevel@tonic-gate     boolean perfmon = false;
2020Sstevel@tonic-gate     Date pdateFirst;
2030Sstevel@tonic-gate     Date pdateAfterKrb5Conf;
2040Sstevel@tonic-gate     Date pdateEndGuiRoot;
2050Sstevel@tonic-gate     Date pdateBeginStartGroup;
2060Sstevel@tonic-gate     Date pdateStringsDone;
2070Sstevel@tonic-gate     Date pdateLoginReady;
2080Sstevel@tonic-gate     Date pdateLoginDone;
2090Sstevel@tonic-gate     Date pdateSessionUp;
2100Sstevel@tonic-gate     Date pdatePreMainShow;
2110Sstevel@tonic-gate     Date pdatePostMainShow;
2120Sstevel@tonic-gate     Date pdateMainActive;
2130Sstevel@tonic-gate     Date pdateStartPlist;
2140Sstevel@tonic-gate     Date pdateHavePlist;
2150Sstevel@tonic-gate     Date pdateEmptyPlist;
2160Sstevel@tonic-gate     Date pdateDonePlist;
2170Sstevel@tonic-gate 
2180Sstevel@tonic-gate     public void reportTime(String s0, Date curr, Date prev) {
2190Sstevel@tonic-gate         if (!perfmon)
2200Sstevel@tonic-gate             return;
2210Sstevel@tonic-gate         String s1 = curr.toString();
2220Sstevel@tonic-gate         long curdiff = curr.getTime() - prev.getTime();
2230Sstevel@tonic-gate         String s2 = (new Long(curdiff)).toString();
2240Sstevel@tonic-gate         long cumdiff = curr.getTime() - pdateFirst.getTime();
2250Sstevel@tonic-gate         String s3 = (new Long(cumdiff)).toString();
2260Sstevel@tonic-gate         System.out.println(s0+s1+" delta "+s2+" cume "+s3);
2270Sstevel@tonic-gate     }
2280Sstevel@tonic-gate 
2290Sstevel@tonic-gate     public void reportStartTimes() {
2300Sstevel@tonic-gate         if (!perfmon)
2310Sstevel@tonic-gate             return;
2320Sstevel@tonic-gate         System.out.println("");
2330Sstevel@tonic-gate         reportTime("First timestamp: ", pdateFirst, pdateFirst);
2340Sstevel@tonic-gate         reportTime("After krb5.conf: ", pdateAfterKrb5Conf, pdateFirst);
2350Sstevel@tonic-gate         reportTime("KdcGuiRoot done: ", pdateEndGuiRoot, pdateAfterKrb5Conf);
2360Sstevel@tonic-gate         reportTime("At startGroup  : ", pdateBeginStartGroup, pdateEndGuiRoot);
2370Sstevel@tonic-gate         reportTime("Strings set up : ", pdateStringsDone, pdateBeginStartGroup);
2380Sstevel@tonic-gate         reportTime("Login ready    : ", pdateLoginReady, pdateStringsDone);
2390Sstevel@tonic-gate         reportTime("Login complete : ", pdateLoginDone, pdateLoginReady);
2400Sstevel@tonic-gate         reportTime("Session set up : ", pdateSessionUp, pdateLoginDone);
2410Sstevel@tonic-gate         reportTime("Start main win : ", pdatePreMainShow, pdateSessionUp);
2420Sstevel@tonic-gate         reportTime("Done main win  : ", pdatePostMainShow, pdatePreMainShow);
2430Sstevel@tonic-gate         reportTime("Main win active: ", pdateMainActive, pdatePostMainShow);
2440Sstevel@tonic-gate     }
2450Sstevel@tonic-gate 
2460Sstevel@tonic-gate     /**
2470Sstevel@tonic-gate      * Sample method call ordering during a group's lifetime:
2480Sstevel@tonic-gate      *
2490Sstevel@tonic-gate      * Constructor
2500Sstevel@tonic-gate      * initRoot
2510Sstevel@tonic-gate      * initGroup
2520Sstevel@tonic-gate      * (setOnGroup and getOnGroup may be called at any time in any
2530Sstevel@tonic-gate      *  order after initGroup has been called)
2540Sstevel@tonic-gate      * createGroup
2550Sstevel@tonic-gate      * showGroup/hideGroup + startGroup/stopGroup
2560Sstevel@tonic-gate      * destroyGroup
2570Sstevel@tonic-gate      */
2580Sstevel@tonic-gate 
2590Sstevel@tonic-gate     /**
2600Sstevel@tonic-gate      * The constructor sets up defaults for login screen
2610Sstevel@tonic-gate      *
2620Sstevel@tonic-gate      */
2630Sstevel@tonic-gate     public KdcGui() {
2640Sstevel@tonic-gate 
2650Sstevel@tonic-gate         /*
2660Sstevel@tonic-gate          * Set up defaults from /etc/krb5/krb5.conf
2670Sstevel@tonic-gate          */
2680Sstevel@tonic-gate 
2690Sstevel@tonic-gate         pdateFirst = new Date();
2700Sstevel@tonic-gate         DefName = System.getProperty("user.name" /* NOI18N */)+
2710Sstevel@tonic-gate 	    "/admin" /* NOI18N */;
2720Sstevel@tonic-gate         kc = new Krb5Conf();
2730Sstevel@tonic-gate         DefRealm = kc.getDefaultRealm();
2740Sstevel@tonic-gate         DefServer = kc.getRealmServer(DefRealm);
2750Sstevel@tonic-gate         DefPort = kc.getRealmPort(DefRealm);
2760Sstevel@tonic-gate         pdateAfterKrb5Conf = new Date();
2770Sstevel@tonic-gate 
2780Sstevel@tonic-gate         /*
2790Sstevel@tonic-gate          * Take care of Java Workshop attribute plumbing
2800Sstevel@tonic-gate          */
2810Sstevel@tonic-gate         addForwardedAttributes();
2820Sstevel@tonic-gate     }
2830Sstevel@tonic-gate 
2840Sstevel@tonic-gate     /**
2850Sstevel@tonic-gate      * Inherited from the Java Workshop skeleton
2860Sstevel@tonic-gate      *
2870Sstevel@tonic-gate      */
2880Sstevel@tonic-gate     protected Root initRoot() {
2890Sstevel@tonic-gate         /*
2900Sstevel@tonic-gate          * Initialize the gui components
2910Sstevel@tonic-gate          */
2920Sstevel@tonic-gate         gui = new KdcGuiRoot(this);
2930Sstevel@tonic-gate         pdateEndGuiRoot = new Date();
2940Sstevel@tonic-gate 
2950Sstevel@tonic-gate         /*
2960Sstevel@tonic-gate          * Take care of Java Workshop attribute plumbing.
2970Sstevel@tonic-gate          */
2980Sstevel@tonic-gate         addAttributeForward(gui.getMainChild());
2990Sstevel@tonic-gate 
3000Sstevel@tonic-gate         initLoginStrings();
3010Sstevel@tonic-gate         initMainStrings();
3020Sstevel@tonic-gate         pdateStringsDone = new Date();
3030Sstevel@tonic-gate         return gui;
3040Sstevel@tonic-gate     }
3050Sstevel@tonic-gate 
3060Sstevel@tonic-gate     /**
3070Sstevel@tonic-gate      * Set up the login screen properly.
3080Sstevel@tonic-gate      *
3090Sstevel@tonic-gate      */
3100Sstevel@tonic-gate     protected void startGroup() {
3110Sstevel@tonic-gate         pdateBeginStartGroup = new Date();
3120Sstevel@tonic-gate         realLoginFrame = (Frame)gui.loginframe.getBody();
3130Sstevel@tonic-gate         realLoginFrame.setTitle(getString("SEAM Administration Login"));
3140Sstevel@tonic-gate         setLoginDefaults();
3150Sstevel@tonic-gate         pdateLoginReady = new Date();
3160Sstevel@tonic-gate     }
3170Sstevel@tonic-gate 
3180Sstevel@tonic-gate     /**
3190Sstevel@tonic-gate      * All cleanup done here.
3200Sstevel@tonic-gate      */
3210Sstevel@tonic-gate     protected void stopGroup() {
3220Sstevel@tonic-gate         killHelpBrowser();
3230Sstevel@tonic-gate     }
3240Sstevel@tonic-gate 
3250Sstevel@tonic-gate 
3260Sstevel@tonic-gate     /**
3270Sstevel@tonic-gate      * Callbacks from Java workshop to decide whether to take the action
3280Sstevel@tonic-gate      * or show appropriate help for it.
3290Sstevel@tonic-gate      *
3300Sstevel@tonic-gate      * 1. Actions that are triggered from all three - mainframe,
3310Sstevel@tonic-gate      *    loginframe, and defaultsEditingFrame - are: context sensitive help.
3320Sstevel@tonic-gate      * 2. Actions that are triggered only from mainframe are: printing,
3330Sstevel@tonic-gate      *    logging out, edit preferences.
3340Sstevel@tonic-gate      * 3. Actions that are triggered from mainframe and loginframe are:
3350Sstevel@tonic-gate      *    exit, general help, context sensitive help, about.
3360Sstevel@tonic-gate      */
3370Sstevel@tonic-gate 
3380Sstevel@tonic-gate 
3390Sstevel@tonic-gate     // All three frames
3400Sstevel@tonic-gate 
3410Sstevel@tonic-gate     public void checkContextSensitiveHelp(Frame frame) {
3420Sstevel@tonic-gate         if ((loginHelpMode && frame == realLoginFrame)
3430Sstevel@tonic-gate             || (mainHelpMode && frame == realMainFrame)
3440Sstevel@tonic-gate 	    || (defaultsHelpMode && frame == defaultsEditingFrame))
3450Sstevel@tonic-gate 	    showHelp("ContextSensitiveHelp");
3460Sstevel@tonic-gate         else
3470Sstevel@tonic-gate             contextHelp(frame);
3480Sstevel@tonic-gate     }
3490Sstevel@tonic-gate 
3500Sstevel@tonic-gate     // Mainframe only
3510Sstevel@tonic-gate 
3520Sstevel@tonic-gate     public void checkPrintCurPr() {
3530Sstevel@tonic-gate         if (mainHelpMode)
3540Sstevel@tonic-gate             showHelp("PrintCurrentPrincipal");
3550Sstevel@tonic-gate         else
3560Sstevel@tonic-gate             printCurPr();
3570Sstevel@tonic-gate     }
3580Sstevel@tonic-gate 
3590Sstevel@tonic-gate     public void checkPrintCurPol() {
3600Sstevel@tonic-gate         if (mainHelpMode)
3610Sstevel@tonic-gate             showHelp("PrintCurrentPolicy");
3620Sstevel@tonic-gate         else
3630Sstevel@tonic-gate             printCurPol();
3640Sstevel@tonic-gate     }
3650Sstevel@tonic-gate 
3660Sstevel@tonic-gate     public void checkPrintPrList() {
3670Sstevel@tonic-gate         if (mainHelpMode)
3680Sstevel@tonic-gate             showHelp("PrintPrincipalList");
3690Sstevel@tonic-gate         else
3700Sstevel@tonic-gate             printPrList();
3710Sstevel@tonic-gate     }
3720Sstevel@tonic-gate 
3730Sstevel@tonic-gate     public void checkPrintPoList() {
3740Sstevel@tonic-gate         if (mainHelpMode)
3750Sstevel@tonic-gate             showHelp("PrintPolicyList");
3760Sstevel@tonic-gate         else
3770Sstevel@tonic-gate             printPoList();
3780Sstevel@tonic-gate     }
3790Sstevel@tonic-gate 
3800Sstevel@tonic-gate     public void checkLogout() {
3810Sstevel@tonic-gate         if (mainHelpMode)
3820Sstevel@tonic-gate             showHelp("Logout");
3830Sstevel@tonic-gate         else if (okayToLeave(realMainFrame))
3840Sstevel@tonic-gate             logout();
3850Sstevel@tonic-gate     }
3860Sstevel@tonic-gate 
3870Sstevel@tonic-gate     public void checkEditPreferences() {
3880Sstevel@tonic-gate         if (mainHelpMode)
3890Sstevel@tonic-gate             showHelp("EditPreferences");
3900Sstevel@tonic-gate         else
3910Sstevel@tonic-gate             editPreferences();
3920Sstevel@tonic-gate     }
3930Sstevel@tonic-gate 
3940Sstevel@tonic-gate     public void checkRefreshPrincipals() {
3950Sstevel@tonic-gate         if (mainHelpMode)
3960Sstevel@tonic-gate             showHelp("RefreshPrincipals");
3970Sstevel@tonic-gate         else {
3980Sstevel@tonic-gate             principalList = null;
3990Sstevel@tonic-gate             fillPrincipalList(curPrPattern);
4000Sstevel@tonic-gate         }
4010Sstevel@tonic-gate     }
4020Sstevel@tonic-gate 
4030Sstevel@tonic-gate     public void checkRefreshPolicies() {
4040Sstevel@tonic-gate         if (mainHelpMode)
4050Sstevel@tonic-gate             showHelp("RefreshPolicies");
4060Sstevel@tonic-gate         else {
4070Sstevel@tonic-gate             policyList = null;
4080Sstevel@tonic-gate             fillPolicyList(curPoPattern);
4090Sstevel@tonic-gate         }
4100Sstevel@tonic-gate     }
4110Sstevel@tonic-gate 
4120Sstevel@tonic-gate     // Mainframe and loginframe
4130Sstevel@tonic-gate 
4140Sstevel@tonic-gate     public void checkExit(Frame frame) {
4150Sstevel@tonic-gate         if ((loginHelpMode && frame == realLoginFrame)
4160Sstevel@tonic-gate             || (mainHelpMode && frame == realMainFrame))
4170Sstevel@tonic-gate 	    showHelp("Exit");
4180Sstevel@tonic-gate         else if (okayToLeave(frame))
4190Sstevel@tonic-gate             exit();
4200Sstevel@tonic-gate     }
4210Sstevel@tonic-gate 
4220Sstevel@tonic-gate     public void checkHelp(Frame frame) {
4230Sstevel@tonic-gate         if ((loginHelpMode && frame == realLoginFrame)
4240Sstevel@tonic-gate             || (mainHelpMode && frame == realMainFrame))
4250Sstevel@tonic-gate 	    showHelp("HelpBrowser");
4260Sstevel@tonic-gate         else
4270Sstevel@tonic-gate             showHelpBrowser(frame);
4280Sstevel@tonic-gate     }
4290Sstevel@tonic-gate 
4300Sstevel@tonic-gate     public void checkAbout(Frame frame) {
4310Sstevel@tonic-gate         if ((loginHelpMode && frame == realLoginFrame)
4320Sstevel@tonic-gate             || (mainHelpMode && frame == realMainFrame))
4330Sstevel@tonic-gate 	    showHelp("About");
4340Sstevel@tonic-gate         else
4350Sstevel@tonic-gate             doAbout(frame);
4360Sstevel@tonic-gate     }
4370Sstevel@tonic-gate 
4380Sstevel@tonic-gate     public boolean okayToLeave(Frame frame) {
4390Sstevel@tonic-gate         if (prNeedSave || poNeedSave || glNeedSave) {
4400Sstevel@tonic-gate             String text[] = {getString("You are about to lose changes."),
4410Sstevel@tonic-gate 			     getString("Click Save to commit changes, "
4420Sstevel@tonic-gate 				       +"Discard to discard changes, "
4430Sstevel@tonic-gate 				       +"or Cancel to continue editing.")};
4440Sstevel@tonic-gate             String resp = confirmSave(frame, text);
4450Sstevel@tonic-gate             if (resp.equals(getString("Cancel")))
4460Sstevel@tonic-gate                 return false;
4470Sstevel@tonic-gate             else if (resp.equals(getString("Save"))) {
4480Sstevel@tonic-gate                 if (prNeedSave)
4490Sstevel@tonic-gate                     if (!prDoSave())
4500Sstevel@tonic-gate 			return false; // found an error so cannot leave
4510Sstevel@tonic-gate                 if (poNeedSave)
4520Sstevel@tonic-gate                     if (!poDoSave())
4530Sstevel@tonic-gate 			return false; // found an error so cannot leave
4540Sstevel@tonic-gate                 if (glNeedSave)
4550Sstevel@tonic-gate                     glDoSave(true);
4560Sstevel@tonic-gate             } else
4570Sstevel@tonic-gate                 prNeedSave = poNeedSave = glNeedSave = false;
4580Sstevel@tonic-gate         }
4590Sstevel@tonic-gate         return true;
4600Sstevel@tonic-gate     }
4610Sstevel@tonic-gate 
4620Sstevel@tonic-gate     /**
4630Sstevel@tonic-gate      * We use the JDK 1.1 event model for most of our events, but
4640Sstevel@tonic-gate      * we do still need to handle old-style events because the
4650Sstevel@tonic-gate      * tabbed folder and the card panel(supplied by Java Workshop)
4660Sstevel@tonic-gate      * are not compatible with the new event model.  We use the
4670Sstevel@tonic-gate      * callouts from Java Workshop to deal with the card panel,
4680Sstevel@tonic-gate      * but we need to have some code here to do the right thing
4690Sstevel@tonic-gate      * when the user selects a new tab in the tabbed folder.
4700Sstevel@tonic-gate      *
4710Sstevel@tonic-gate      * It is important that not too many conditions are tested here,
4720Sstevel@tonic-gate      * because all events flow through this code path.
4730Sstevel@tonic-gate      *
4740Sstevel@tonic-gate      */
4750Sstevel@tonic-gate     public boolean handleEvent(Message msg, Event evt) {
4760Sstevel@tonic-gate 
4770Sstevel@tonic-gate         /*
4780Sstevel@tonic-gate          * Look for events from the principal and policy list.
4790Sstevel@tonic-gate          */
4800Sstevel@tonic-gate 
4810Sstevel@tonic-gate         if (evt.target == gui.Prlist.getBody()) {
4820Sstevel@tonic-gate             if (mainHelpMode) {
4830Sstevel@tonic-gate                 if (evt.id == Event.ACTION_EVENT
4840Sstevel@tonic-gate 		    || evt.id == Event.LIST_SELECT) {
4850Sstevel@tonic-gate                     restorePrListSelection();
4860Sstevel@tonic-gate                     showHelp(((Component)gui.Prlist.getBody()).getName());
4870Sstevel@tonic-gate                 }
4880Sstevel@tonic-gate             } // end of help mode
4890Sstevel@tonic-gate             else if (evt.id == Event.ACTION_EVENT)
4900Sstevel@tonic-gate                 prModify();
4910Sstevel@tonic-gate             else if (evt.id == Event.LIST_SELECT)
4920Sstevel@tonic-gate                 lookAtPrList();
4930Sstevel@tonic-gate             return true;
4940Sstevel@tonic-gate         } // end of Prlist
4950Sstevel@tonic-gate 
4960Sstevel@tonic-gate         if (evt.target == gui.Pollist.getBody()) {
4970Sstevel@tonic-gate             if (mainHelpMode) {
4980Sstevel@tonic-gate                 if (evt.id == Event.ACTION_EVENT
4990Sstevel@tonic-gate 		    || evt.id == Event.LIST_SELECT) {
5000Sstevel@tonic-gate                     restorePoListSelection();
5010Sstevel@tonic-gate                     showHelp(((Component)gui.Pollist.getBody()).getName());
5020Sstevel@tonic-gate                 }
5030Sstevel@tonic-gate             } // end of help mode
5040Sstevel@tonic-gate             else if (evt.id == Event.ACTION_EVENT)
5050Sstevel@tonic-gate                 poSelected();
5060Sstevel@tonic-gate             else if (evt.id == Event.LIST_SELECT)
5070Sstevel@tonic-gate                 lookAtPoList();
5080Sstevel@tonic-gate             return true;
5090Sstevel@tonic-gate         } // end of Pollist
5100Sstevel@tonic-gate 
5110Sstevel@tonic-gate         /*
5120Sstevel@tonic-gate          * Look for a unique event from the tabbed folder component;
5130Sstevel@tonic-gate          * if I see it, I know I have a chance to disallow a switch.
5140Sstevel@tonic-gate          * This makes sure data is saved before leaving a tab.
5150Sstevel@tonic-gate          */
5160Sstevel@tonic-gate         if (evt.id == TabbedFolder.CONFIRM_SWITCH) {
5170Sstevel@tonic-gate             // System.out.println("Got confirm for "+evt.arg);
5180Sstevel@tonic-gate             String e = (String)evt.arg;
5190Sstevel@tonic-gate             if (!mainHelpMode && okayToLeave(realMainFrame) == false) {
5200Sstevel@tonic-gate                 // System.out.println("Denying switch");
5210Sstevel@tonic-gate                 ((TabbedFolder)gui.tabbedfolder1.getBody()).cancelSwitch();
5220Sstevel@tonic-gate             }
5230Sstevel@tonic-gate             /*
5240Sstevel@tonic-gate              * Okay with switch; make sure the data is up to date
5250Sstevel@tonic-gate              */
5260Sstevel@tonic-gate             else if (e.compareTo(getString("Principals")) == 0) {
5270Sstevel@tonic-gate                 if (mainHelpMode) {
5280Sstevel@tonic-gate                     showHelp("PrincipalTab");
5290Sstevel@tonic-gate                     ((TabbedFolder)gui.tabbedfolder1.getBody()).cancelSwitch();
5300Sstevel@tonic-gate                 } else {
5310Sstevel@tonic-gate                     showPrincipalList(curPrPattern);
5320Sstevel@tonic-gate                     disablePolicyPrinting();
5330Sstevel@tonic-gate                 }
5340Sstevel@tonic-gate             } else if (e.compareTo(getString("Policies")) == 0) {
5350Sstevel@tonic-gate                 if (mainHelpMode) {
5360Sstevel@tonic-gate                     showHelp("PolicyTab");
5370Sstevel@tonic-gate                     ((TabbedFolder)gui.tabbedfolder1.getBody()).cancelSwitch();
5380Sstevel@tonic-gate                 } else {
5390Sstevel@tonic-gate                     showPolicyList(curPoPattern);
5400Sstevel@tonic-gate                     disablePrincipalPrinting();
5410Sstevel@tonic-gate                 }
5420Sstevel@tonic-gate             }
5430Sstevel@tonic-gate         }
5440Sstevel@tonic-gate         return super.handleEvent(msg, evt);
5450Sstevel@tonic-gate     }
5460Sstevel@tonic-gate 
5470Sstevel@tonic-gate     /*
5480Sstevel@tonic-gate      * New methods for the admin gui login screen.
5490Sstevel@tonic-gate      */
5500Sstevel@tonic-gate 
5510Sstevel@tonic-gate     /**
5520Sstevel@tonic-gate      * Set strings on login screen to their I18N'd values
5530Sstevel@tonic-gate      *
5540Sstevel@tonic-gate      */
5550Sstevel@tonic-gate     public void initLoginStrings() {
5560Sstevel@tonic-gate         gui.File2.set("text" /* NOI18N */, getString("File"));
5570Sstevel@tonic-gate         gui.Exit2.set("text" /* NOI18N */, getString("Exit"));
5580Sstevel@tonic-gate         gui.menu1.set("text" /* NOI18N */, getString("Help"));
5590Sstevel@tonic-gate         gui.browserHelp1.set("text" /* NOI18N */, getString("Help Contents"));
5600Sstevel@tonic-gate         gui.Context2.set("text" /* NOI18N */,
5610Sstevel@tonic-gate 			 getString("Context-Sensitive Help"));
5620Sstevel@tonic-gate         gui.About2.set("text" /* NOI18N */, getString("About"));
5630Sstevel@tonic-gate         gui.LoginNameLabel.set("text" /* NOI18N */,
5640Sstevel@tonic-gate 			       getString("Principal Name:"));
5650Sstevel@tonic-gate         gui.LoginPassLabel.set("text" /* NOI18N */, getString("Password:"));
5660Sstevel@tonic-gate         gui.LoginRealmLabel.set("text" /* NOI18N */, getString("Realm:"));
5670Sstevel@tonic-gate         gui.LoginServerLabel.set("text" /* NOI18N */, getString("Master KDC:"));
5680Sstevel@tonic-gate         gui.LoginOK.set("text" /* NOI18N */, getString("OK"));
5690Sstevel@tonic-gate         gui.LoginStartOver.set("text" /* NOI18N */, getString("Start Over"));
5700Sstevel@tonic-gate     }
5710Sstevel@tonic-gate 
5720Sstevel@tonic-gate     /**
5730Sstevel@tonic-gate      * Set strings on main screen to their I18N'd values
5740Sstevel@tonic-gate      *
5750Sstevel@tonic-gate      */
5760Sstevel@tonic-gate     public void initMainStrings() {
5770Sstevel@tonic-gate         gui.mainframe.set("title" /* NOI18N */,
5780Sstevel@tonic-gate 			  getString("SEAM Administration Tool"));
5790Sstevel@tonic-gate         gui.File.set("text" /* NOI18N */, getString("File"));
5800Sstevel@tonic-gate         gui.Print.set("text" /* NOI18N */, getString("Print"));
5810Sstevel@tonic-gate         gui.PrintCurPr.set("text" /* NOI18N */, getString("Current Principal"));
5820Sstevel@tonic-gate         gui.PrintCurPol.set("text" /* NOI18N */, getString("Current Policy"));
5830Sstevel@tonic-gate         gui.PrintPrlist.set("text" /* NOI18N */, getString("Principal List"));
5840Sstevel@tonic-gate         gui.PrintPollist.set("text" /* NOI18N */, getString("Policy List"));
5850Sstevel@tonic-gate         gui.logout.set("text" /* NOI18N */, getString("Log Out"));
5860Sstevel@tonic-gate         gui.Exit.set("text" /* NOI18N */, getString("Exit"));
5870Sstevel@tonic-gate         gui.editMenu.set("text" /* NOI18N */, getString("Edit"));
5880Sstevel@tonic-gate         gui.editPreferences.set("text" /* NOI18N */,
5890Sstevel@tonic-gate 				getString("Properties..."));
5900Sstevel@tonic-gate         gui.menu2.set("text" /* NOI18N */, getString("Refresh"));
5910Sstevel@tonic-gate         gui.refreshPrincipals.set("text" /* NOI18N */,
5920Sstevel@tonic-gate 				  getString("Principal List"));
5930Sstevel@tonic-gate         gui.refreshPolicies.set("text" /* NOI18N */, getString("Policy List"));
5940Sstevel@tonic-gate         gui.Help.set("text" /* NOI18N */, getString("Help"));
5950Sstevel@tonic-gate         gui.browserHelp2.set("text" /* NOI18N */, getString("Help Contents"));
5960Sstevel@tonic-gate         gui.Context.set("text" /* NOI18N */,
5970Sstevel@tonic-gate 			getString("Context-Sensitive Help"));
5980Sstevel@tonic-gate         gui.About.set("text" /* NOI18N */, getString("About"));
5990Sstevel@tonic-gate 
6000Sstevel@tonic-gate         gui.Prlisttab.set("layoutName", getString("Principals"));
6010Sstevel@tonic-gate         gui.Pollisttab.set("layoutName", getString("Policies"));
6020Sstevel@tonic-gate 
6030Sstevel@tonic-gate         gui.PrListLabel.set("text" /* NOI18N */, getString("Principal List"));
6040Sstevel@tonic-gate         gui.PrSearchLab.set("text" /* NOI18N */, getString("Filter Pattern:"));
6050Sstevel@tonic-gate         gui.PrListClear.set("text" /* NOI18N */, getString("Clear Filter"));
6060Sstevel@tonic-gate         gui.PrListModify.set("text" /* NOI18N */, getString("Modify"));
6070Sstevel@tonic-gate         gui.PrListAdd.set("text" /* NOI18N */, getString("Create New"));
6080Sstevel@tonic-gate         gui.PrListDelete.set("text" /* NOI18N */, getString("Delete"));
6090Sstevel@tonic-gate         gui.PrListDuplicate.set("text" /* NOI18N */, getString("Duplicate"));
6100Sstevel@tonic-gate 
6110Sstevel@tonic-gate         gui.PrBasicLabel.set("text" /* NOI18N */,
6120Sstevel@tonic-gate 			     getString("Principal Basics"));
6130Sstevel@tonic-gate         gui.PrNameLabel1.set("text" /* NOI18N */, getString("Principal Name:"));
6140Sstevel@tonic-gate         gui.LabelBarGeneral.set("text" /* NOI18N */, getString("General"));
6150Sstevel@tonic-gate         gui.PrCommentsLabel.set("text" /* NOI18N */, getString("Comments:"));
6160Sstevel@tonic-gate         gui.PrPolicyLabel.set("text" /* NOI18N */, getString("Policy:"));
6170Sstevel@tonic-gate         gui.PrPasswordLabel.set("text" /* NOI18N */, getString("Password:"));
6180Sstevel@tonic-gate         gui.PrBasicRandomPw.set("text" /* NOI18N */,
6190Sstevel@tonic-gate 				getString("Generate Random Password"));
620*96Ssemery         gui.EncListLabel.set("text" /* NOI18N */,
621*96Ssemery 			getString("Encryption Key Types:"));
6220Sstevel@tonic-gate         gui.LabelBarPrincipal.set("text" /* NOI18N */,
6230Sstevel@tonic-gate 				  getString("Admin History"));
6240Sstevel@tonic-gate         gui.PrLastChangedTimeLabel.set("text" /* NOI18N */,
6250Sstevel@tonic-gate 				       getString("Last Principal Change:"));
6260Sstevel@tonic-gate         gui.PrLastChangedByLabel.set("text" /* NOI18N */,
6270Sstevel@tonic-gate 				     getString("Last Changed By:"));
6280Sstevel@tonic-gate         gui.PrExpiryLabel.set("text" /* NOI18N */,
6290Sstevel@tonic-gate 			      getString("Account Expires:"));
6300Sstevel@tonic-gate         gui.PrBasicSave.set("text" /* NOI18N */, getString("Save"));
6310Sstevel@tonic-gate         gui.PrBasicPrevious.set("text" /* NOI18N */, getString("Previous"));
6320Sstevel@tonic-gate         gui.PrBasicNext.set("text" /* NOI18N */, getString("Next"));
6330Sstevel@tonic-gate         gui.PrBasicCancel.set("text" /* NOI18N */, getString("Cancel"));
6340Sstevel@tonic-gate 
6350Sstevel@tonic-gate         gui.PrDetailLabel.set("text" /* NOI18N */,
6360Sstevel@tonic-gate 			      getString("Principal Details"));
6370Sstevel@tonic-gate         gui.LabelBarPassword.set("text" /* NOI18N */, getString("Password"));
6380Sstevel@tonic-gate         gui.PrLastSuccessLabel.set("text" /* NOI18N */,
6390Sstevel@tonic-gate 				   getString("Last Success:"));
6400Sstevel@tonic-gate         gui.PrLastFailureLabel.set("text" /* NOI18N */,
6410Sstevel@tonic-gate 				   getString("Last Failure:"));
6420Sstevel@tonic-gate         gui.PrFailureCountLabel.set("text" /* NOI18N */,
6430Sstevel@tonic-gate 				    getString("Failure Count:"));
6440Sstevel@tonic-gate         gui.PrPwLastChangedLabel.set("text" /* NOI18N */,
6450Sstevel@tonic-gate 				     getString("Last Password Change:"));
6460Sstevel@tonic-gate         gui.PrPwExpiryLabel.set("text" /* NOI18N */,
6470Sstevel@tonic-gate 				getString("Password Expires:"));
6480Sstevel@tonic-gate         gui.PrKvnoLabel.set("text" /* NOI18N */, getString("Key Version:"));
6490Sstevel@tonic-gate         gui.LabelBarTicket.set("text" /* NOI18N */,
6500Sstevel@tonic-gate 			       getString("Ticket Lifetimes"));
6510Sstevel@tonic-gate         gui.PrMaxTicketLifetimeLabel.set("text" /* NOI18N */,
6520Sstevel@tonic-gate 				 getString("Maximum Lifetime (seconds):"));
6530Sstevel@tonic-gate         gui.PrMaxTicketRenewalLabel.set("text" /* NOI18N */,
6540Sstevel@tonic-gate 				getString("Maximum Renewal (seconds):"));
6550Sstevel@tonic-gate         gui.PrDetailSave.set("text" /* NOI18N */, getString("Save"));
6560Sstevel@tonic-gate         gui.PrDetailPrevious.set("text" /* NOI18N */, getString("Previous"));
6570Sstevel@tonic-gate         gui.PrDetailNext.set("text" /* NOI18N */, getString("Next"));
6580Sstevel@tonic-gate         gui.PrDetailCancel.set("text" /* NOI18N */, getString("Cancel"));
6590Sstevel@tonic-gate 
6600Sstevel@tonic-gate         gui.PrFlagLabel.set("text" /* NOI18N */, getString("Principal Flags"));
6610Sstevel@tonic-gate         gui.LabelBarSecurity.set("text" /* NOI18N */, getString("Security"));
6620Sstevel@tonic-gate 
6630Sstevel@tonic-gate         gui.PrLockAcct.set("text" /* NOI18N */,
6640Sstevel@tonic-gate 			   Flags.getLabel(Flags.DISALLOW_ALL_TIX));
6650Sstevel@tonic-gate         gui.PrForcePwChange.set("text" /* NOI18N */,
6660Sstevel@tonic-gate 				Flags.getLabel(Flags.REQUIRES_PWCHANGE));
6670Sstevel@tonic-gate         gui.LabelBarTickets.set("text" /* NOI18N */, getString("Ticket"));
6680Sstevel@tonic-gate         gui.PrAllowPostdated.set("text" /* NOI18N */,
6690Sstevel@tonic-gate 				 Flags.getLabel(Flags.DISALLOW_POSTDATED));
6700Sstevel@tonic-gate         gui.PrAllowForwardable.set("text" /* NOI18N */,
6710Sstevel@tonic-gate 				   Flags.getLabel(Flags.DISALLOW_FORWARDABLE));
6720Sstevel@tonic-gate         gui.PrAllowRenewable.set("text" /* NOI18N */,
6730Sstevel@tonic-gate 				 Flags.getLabel(Flags.DISALLOW_RENEWABLE));
6740Sstevel@tonic-gate         gui.PrAllowProxiable.set("text" /* NOI18N */,
6750Sstevel@tonic-gate 				 Flags.getLabel(Flags.DISALLOW_PROXIABLE));
6760Sstevel@tonic-gate         gui.PrAllowSvr.set("text" /* NOI18N */,
6770Sstevel@tonic-gate 			   Flags.getLabel(Flags.DISALLOW_SVR));
6780Sstevel@tonic-gate         gui.LabelBarMiscellany.set("text" /* NOI18N */,
6790Sstevel@tonic-gate 				   getString("Miscellaneous"));
6800Sstevel@tonic-gate         gui.PrAllowTGT.set("text" /* NOI18N */,
6810Sstevel@tonic-gate 			   Flags.getLabel(Flags.DISALLOW_TGT_BASED));
6820Sstevel@tonic-gate         gui.PrAllowDupAuth.set("text" /* NOI18N */,
6830Sstevel@tonic-gate 			       Flags.getLabel(Flags.DISALLOW_DUP_SKEY));
6840Sstevel@tonic-gate         gui.PrRequirePreAuth.set("text" /* NOI18N */,
6850Sstevel@tonic-gate 				 Flags.getLabel(Flags.REQUIRE_PRE_AUTH));
6860Sstevel@tonic-gate         gui.PrRequireHwPreAuth.set("text" /* NOI18N */,
6870Sstevel@tonic-gate 				   Flags.getLabel(Flags.REQUIRE_HW_AUTH));
6880Sstevel@tonic-gate         gui.PrFlagsSave.set("text" /* NOI18N */, getString("Save"));
6890Sstevel@tonic-gate         gui.PrFlagsPrevious.set("text" /* NOI18N */, getString("Previous"));
6900Sstevel@tonic-gate         gui.PrFlagsNext.set("text" /* NOI18N */, getString("Done"));
6910Sstevel@tonic-gate         gui.PrFlagsCancel.set("text" /* NOI18N */, getString("Cancel"));
6920Sstevel@tonic-gate 
6930Sstevel@tonic-gate         gui.PoListLabel.set("text" /* NOI18N */, getString("Policy List"));
6940Sstevel@tonic-gate         gui.PoListPatternLabel.set("text" /* NOI18N */,
6950Sstevel@tonic-gate 				   getString("Filter Pattern:"));
6960Sstevel@tonic-gate         gui.PoListClear.set("text" /* NOI18N */, getString("Clear Filter"));
6970Sstevel@tonic-gate         gui.PoListModify.set("text" /* NOI18N */, getString("Modify"));
6980Sstevel@tonic-gate         gui.PoListAdd.set("text" /* NOI18N */, getString("Create New"));
6990Sstevel@tonic-gate         gui.PoListDelete.set("text" /* NOI18N */, getString("Delete"));
7000Sstevel@tonic-gate         gui.PoListDuplicate.set("text" /* NOI18N */, getString("Duplicate"));
7010Sstevel@tonic-gate 
7020Sstevel@tonic-gate         gui.PoDetailLabel.set("text" /* NOI18N */, getString("Policy Details"));
7030Sstevel@tonic-gate         gui.PoNameLabel.set("text" /* NOI18N */, getString("Policy Name:"));
7040Sstevel@tonic-gate         gui.PoMinPwLengthLabel.set("text" /* NOI18N */,
7050Sstevel@tonic-gate 				   getString("Minimum Password Length:"));
7060Sstevel@tonic-gate         gui.PoMinPwClassLabel.set("text" /* NOI18N */,
7070Sstevel@tonic-gate 				  getString("Minimum Password Classes:"));
7080Sstevel@tonic-gate         gui.PoSavedPasswordsLabel.set("text" /* NOI18N */,
7090Sstevel@tonic-gate 				      getString("Saved Password History:"));
7100Sstevel@tonic-gate         gui.PoMinTicketLifetimeLabel.set("text" /* NOI18N */,
7110Sstevel@tonic-gate 			 getString("Minimum Password Lifetime (seconds):"));
7120Sstevel@tonic-gate         gui.PoMaxTicketLifetimeLabel.set("text" /* NOI18N */,
7130Sstevel@tonic-gate 			 getString("Maximum Password Lifetime (seconds):"));
7140Sstevel@tonic-gate         gui.PoReferencesLabel.set("text" /* NOI18N */,
7150Sstevel@tonic-gate 				  getString("Principals Using This Policy:"));
7160Sstevel@tonic-gate         gui.PoDetailSave.set("text" /* NOI18N */, getString("Save"));
7170Sstevel@tonic-gate         gui.PoDetailPrevious.set("text" /* NOI18N */, getString("Previous"));
7180Sstevel@tonic-gate         gui.PoDetailDone.set("text" /* NOI18N */, getString("Done"));
7190Sstevel@tonic-gate         gui.PoDetailCancel.set("text" /* NOI18N */, getString("Cancel"));
7200Sstevel@tonic-gate     }
7210Sstevel@tonic-gate 
7220Sstevel@tonic-gate     /**
7230Sstevel@tonic-gate      * Allow user to see a fatal error before exiting
7240Sstevel@tonic-gate      */
7250Sstevel@tonic-gate     public void fatalError(Frame frame, String[] text) {
7260Sstevel@tonic-gate         String title = getString("Error");
7270Sstevel@tonic-gate         String[] buttons = new String[1];
7280Sstevel@tonic-gate         buttons[0] = getString("OK");
7290Sstevel@tonic-gate         ChoiceDialog cd = new ChoiceDialog(frame, title, text, buttons);
7300Sstevel@tonic-gate         cd.getSelection();
7310Sstevel@tonic-gate         exit();
7320Sstevel@tonic-gate     }
7330Sstevel@tonic-gate 
7340Sstevel@tonic-gate     /**
7350Sstevel@tonic-gate      * Set the defaults for the login screen.  Called on startup,
7360Sstevel@tonic-gate      * when "Start Over" is pressed, or when "Log Out" is chosen
7370Sstevel@tonic-gate      * from the main screen's menu.
7380Sstevel@tonic-gate      *
7390Sstevel@tonic-gate      */
7400Sstevel@tonic-gate     public void setLoginDefaults() {
7410Sstevel@tonic-gate         CurName = DefName;
7420Sstevel@tonic-gate         CurPass = "";
7430Sstevel@tonic-gate         if (DefRealm != null)
7440Sstevel@tonic-gate             CurRealm = DefRealm;
7450Sstevel@tonic-gate         else {
7460Sstevel@tonic-gate             CurRealm = "";
7470Sstevel@tonic-gate             if (firsttime) {
7480Sstevel@tonic-gate                 showLoginWarning(getString("Cannot find default realm; "
7490Sstevel@tonic-gate 					   +"check /etc/krb5/krb5.conf"));
7500Sstevel@tonic-gate                 firsttime = false;
7510Sstevel@tonic-gate             }
7520Sstevel@tonic-gate         }
7530Sstevel@tonic-gate         if (DefServer != null)
7540Sstevel@tonic-gate             CurServer = DefServer;
7550Sstevel@tonic-gate         else
7560Sstevel@tonic-gate             CurServer = "";
7570Sstevel@tonic-gate         CurPort = 0;
7580Sstevel@tonic-gate         try {
7590Sstevel@tonic-gate             Integer i = new Integer(DefPort);
7600Sstevel@tonic-gate             CurPort = i.intValue();
7610Sstevel@tonic-gate         } catch (NumberFormatException e) {}
7620Sstevel@tonic-gate         gui.LoginName.set("text" /* NOI18N */, CurName);
7630Sstevel@tonic-gate         gui.LoginPass.set("text" /* NOI18N */, CurPass);
7640Sstevel@tonic-gate         gui.LoginRealm.set("text" /* NOI18N */, CurRealm);
7650Sstevel@tonic-gate         gui.LoginServer.set("text" /* NOI18N */, CurServer);
7660Sstevel@tonic-gate         if (CurRealm.equals("___default_realm___")) {
7670Sstevel@tonic-gate             String[] error = new String[1];
7680Sstevel@tonic-gate             error[0] = getString(
7690Sstevel@tonic-gate 				 "Kerberos /etc/krb5/krb5.conf configuration"
7700Sstevel@tonic-gate 				 +" file not configured; exiting");
7710Sstevel@tonic-gate             fatalError(realLoginFrame, error);
7720Sstevel@tonic-gate         }
7730Sstevel@tonic-gate         if (!loginListeners)
7740Sstevel@tonic-gate             setupLoginNormalListeners();
7750Sstevel@tonic-gate         loginListeners = true;
7760Sstevel@tonic-gate         TextField name = (TextField)gui.LoginName.getBody();
7770Sstevel@tonic-gate         name.selectAll();
7780Sstevel@tonic-gate         name.requestFocus();
7790Sstevel@tonic-gate     }
7800Sstevel@tonic-gate 
7810Sstevel@tonic-gate     /**
7820Sstevel@tonic-gate      * React after new realm entered
7830Sstevel@tonic-gate      *
7840Sstevel@tonic-gate      */
7850Sstevel@tonic-gate     public void newRealm() {
7860Sstevel@tonic-gate         CurRealm = (String)gui.LoginRealm.get("text" /* NOI18N */);
7870Sstevel@tonic-gate         String s = kc.getRealmServer(CurRealm);
7880Sstevel@tonic-gate         if (s != null) {
7890Sstevel@tonic-gate             CurServer = s;
7900Sstevel@tonic-gate             gui.LoginServer.set("text" /* NOI18N */, CurServer);
7910Sstevel@tonic-gate 
7920Sstevel@tonic-gate         } else {
7930Sstevel@tonic-gate             showLoginWarning(getString("Cannot find default server for realm"));
7940Sstevel@tonic-gate             CurServer = "";
7950Sstevel@tonic-gate             gui.LoginServer.set("text" /* NOI18N */, CurServer);
7960Sstevel@tonic-gate             ((TextField)gui.LoginServer.getBody()).requestFocus();
7970Sstevel@tonic-gate         }
7980Sstevel@tonic-gate     }
7990Sstevel@tonic-gate 
8000Sstevel@tonic-gate     /**
8010Sstevel@tonic-gate      * React after new server entered
8020Sstevel@tonic-gate      *
8030Sstevel@tonic-gate      */
8040Sstevel@tonic-gate     public void newServer() {
8050Sstevel@tonic-gate         CurServer = (String)gui.LoginServer.get("text" /* NOI18N */);
8060Sstevel@tonic-gate         if (CurPass.compareTo("") != 0)
8070Sstevel@tonic-gate             loginComplete();
8080Sstevel@tonic-gate     }
8090Sstevel@tonic-gate 
8100Sstevel@tonic-gate     /**
8110Sstevel@tonic-gate      * React after username is complete
8120Sstevel@tonic-gate      *
8130Sstevel@tonic-gate      */
8140Sstevel@tonic-gate     public void nameComplete() {
8150Sstevel@tonic-gate         ((TextField)gui.LoginName.getBody()).select(0, 0);
8160Sstevel@tonic-gate         ((TextField)gui.LoginPass.getBody()).requestFocus();
8170Sstevel@tonic-gate     }
8180Sstevel@tonic-gate 
8190Sstevel@tonic-gate     /**
8200Sstevel@tonic-gate      * React after password is complete or "OK" button is pressed.
8210Sstevel@tonic-gate      * We insist that the realm and server are set here separately
8220Sstevel@tonic-gate      * so that we can permit field-to-field motion if /etc/krb5/krb5.conf
8230Sstevel@tonic-gate      * does not exist.
8240Sstevel@tonic-gate      *
8250Sstevel@tonic-gate      */
8260Sstevel@tonic-gate     public void passwordComplete() {
8270Sstevel@tonic-gate         CurPass = (String)gui.LoginPass.get("text" /* NOI18N */);
8280Sstevel@tonic-gate         if (CurRealm.compareTo("") == 0) {
8290Sstevel@tonic-gate             ((TextField)gui.LoginRealm.getBody()).requestFocus();
8300Sstevel@tonic-gate             return;
8310Sstevel@tonic-gate         }
8320Sstevel@tonic-gate         if (CurServer.compareTo("") == 0) {
8330Sstevel@tonic-gate             ((TextField)gui.LoginServer.getBody()).requestFocus();
8340Sstevel@tonic-gate             return;
8350Sstevel@tonic-gate         }
8360Sstevel@tonic-gate         loginComplete();
8370Sstevel@tonic-gate     }
8380Sstevel@tonic-gate 
8390Sstevel@tonic-gate     /**
8400Sstevel@tonic-gate      * Check to see if we're happy with the login information.
8410Sstevel@tonic-gate      * We may want to go to the main screen, principal list tab.
8420Sstevel@tonic-gate      *
8430Sstevel@tonic-gate      */
8440Sstevel@tonic-gate     public void loginComplete() {
8450Sstevel@tonic-gate         pdateLoginDone = new Date();
8460Sstevel@tonic-gate         CurName   = (String)gui.LoginName.get("text" /* NOI18N */);
8470Sstevel@tonic-gate         CurPass   = (String)gui.LoginPass.get("text" /* NOI18N */);
8480Sstevel@tonic-gate         CurRealm  = (String)gui.LoginRealm.get("text" /* NOI18N */);
8490Sstevel@tonic-gate         CurServer = (String)gui.LoginServer.get("text" /* NOI18N */);
8500Sstevel@tonic-gate         if (CurPass.compareTo("") == 0) {
8510Sstevel@tonic-gate             showLoginWarning(getString("A password must be specified"));
8520Sstevel@tonic-gate             ((TextField)gui.LoginPass.getBody()).requestFocus();
8530Sstevel@tonic-gate             return;
8540Sstevel@tonic-gate         }
8550Sstevel@tonic-gate         if (CurRealm.compareTo("") == 0) {
8560Sstevel@tonic-gate             showLoginWarning(getString("A realm entry must be specified"));
8570Sstevel@tonic-gate             ((TextField)gui.LoginRealm.getBody()).requestFocus();
8580Sstevel@tonic-gate             return;
8590Sstevel@tonic-gate         }
8600Sstevel@tonic-gate         if (CurServer.compareTo("") == 0) {
8610Sstevel@tonic-gate             showLoginWarning(getString("A master KDC entry must be specified"));
8620Sstevel@tonic-gate             ((TextField)gui.LoginServer.getBody()).requestFocus();
8630Sstevel@tonic-gate             return;
8640Sstevel@tonic-gate         }
8650Sstevel@tonic-gate 
8660Sstevel@tonic-gate         realLoginFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
8670Sstevel@tonic-gate         Kadmin = new Kadmin();
8680Sstevel@tonic-gate         boolean b;
8690Sstevel@tonic-gate         try {
8700Sstevel@tonic-gate             b = Kadmin.sessionInit(CurName, CurPass, CurRealm, CurServer,
8710Sstevel@tonic-gate 				   CurPort);
8720Sstevel@tonic-gate         } catch (Exception e) {
8730Sstevel@tonic-gate             b = false;
8740Sstevel@tonic-gate             realLoginFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
8750Sstevel@tonic-gate             showLoginError(e.getMessage());
8760Sstevel@tonic-gate             return;
8770Sstevel@tonic-gate         }
8780Sstevel@tonic-gate         realLoginFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
8790Sstevel@tonic-gate         if (b == false) {
8800Sstevel@tonic-gate             showLoginError(getString("Invalid login, please try again"));
8810Sstevel@tonic-gate             return;
8820Sstevel@tonic-gate         }
8830Sstevel@tonic-gate         pdateSessionUp = new Date();
8840Sstevel@tonic-gate 
8850Sstevel@tonic-gate         // Instantiate defaults for this user
8860Sstevel@tonic-gate         if (defaults == null)
8870Sstevel@tonic-gate             defaults = new Defaults(System.getProperty("user.home" /* NOI18N */)
8880Sstevel@tonic-gate 				    + "/.gkadmin" /* NOI18N */,
8890Sstevel@tonic-gate 			    (java.awt.Color)gui.mainframe.get("background"));
8900Sstevel@tonic-gate         else
8910Sstevel@tonic-gate             defaults.refreshDefaults();
8920Sstevel@tonic-gate 
8930Sstevel@tonic-gate         // Figure out what privileges we have
8940Sstevel@tonic-gate         try {
8950Sstevel@tonic-gate             privs = Kadmin.getPrivs();
8960Sstevel@tonic-gate         } catch (Exception e) {
8970Sstevel@tonic-gate             showLoginError(e.getMessage());
8980Sstevel@tonic-gate         }
8990Sstevel@tonic-gate 
9000Sstevel@tonic-gate         // Check privileges; if bad enough, we'll just give up.
9010Sstevel@tonic-gate         if (checkPrivs() == false) {
9020Sstevel@tonic-gate             try {
9030Sstevel@tonic-gate                 Kadmin.sessionExit();
9040Sstevel@tonic-gate             } catch (Exception e) {}
9050Sstevel@tonic-gate             return;
9060Sstevel@tonic-gate         }
9070Sstevel@tonic-gate         reactToPrivs();
9080Sstevel@tonic-gate 
9090Sstevel@tonic-gate         prSetEditable(false);
9100Sstevel@tonic-gate         prSetCanSave(false);
9110Sstevel@tonic-gate         poSetEditable(false);
9120Sstevel@tonic-gate         poSetCanSave(false);
9130Sstevel@tonic-gate         prSelValid(false);
9140Sstevel@tonic-gate         poSelValid(false);
9150Sstevel@tonic-gate         gui.PrListPattern.set("text" /* NOI18N */, "");
9160Sstevel@tonic-gate         gui.PoListPattern.set("text" /* NOI18N */, "");
9170Sstevel@tonic-gate 
9180Sstevel@tonic-gate         // Disable login frame
9190Sstevel@tonic-gate         setListeners(LoginNormal, false);
9200Sstevel@tonic-gate         loginListeners = false;
9210Sstevel@tonic-gate 
9220Sstevel@tonic-gate         pdatePreMainShow = new Date();
9230Sstevel@tonic-gate         realLoginFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
9240Sstevel@tonic-gate         gui.mainframe.show(true);	/* XXX - done waaay too early, fix */
9250Sstevel@tonic-gate         realLoginFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
9260Sstevel@tonic-gate         pdatePostMainShow = new Date();
9270Sstevel@tonic-gate         realMainFrame  = (Frame)gui.mainframe.getBody();
9280Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
9290Sstevel@tonic-gate         gui.tabbedfolder1.show(getString("Principals"));
9300Sstevel@tonic-gate         gui.cardpanel2.show("List" /* NOI18N */);
9310Sstevel@tonic-gate         setupMainNormalListeners();
9320Sstevel@tonic-gate         setupDefaultsEditingFrame();
9330Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
9340Sstevel@tonic-gate         pdateMainActive = new Date();
9350Sstevel@tonic-gate         reportStartTimes();
9360Sstevel@tonic-gate 
9370Sstevel@tonic-gate         showPolicyList("");
9380Sstevel@tonic-gate         showPrincipalList("");
9390Sstevel@tonic-gate         setPolicyChoice();
9400Sstevel@tonic-gate         /* XXX - disabled multiple selection until double-click works */
9410Sstevel@tonic-gate         gui.Prlist.set("allowMultipleSelections" /* NOI18N */,
9420Sstevel@tonic-gate 		       new Boolean(false));
9430Sstevel@tonic-gate         gui.Pollist.set("allowMultipleSelections" /* NOI18N */,
9440Sstevel@tonic-gate 			new Boolean(false));
9450Sstevel@tonic-gate         if ((privs & PRIV_LIST) == 0) {
9460Sstevel@tonic-gate             showWarning(
9470Sstevel@tonic-gate 	getString("Unable to access lists;please use the Name field."));
9480Sstevel@tonic-gate             ((TextField)gui.PrListPattern.getBody()).requestFocus();
9490Sstevel@tonic-gate         }
9500Sstevel@tonic-gate     }
9510Sstevel@tonic-gate 
9520Sstevel@tonic-gate     /**
9530Sstevel@tonic-gate      * React to main screen's "Log Out" choice by going back to login screen.
9540Sstevel@tonic-gate      *
9550Sstevel@tonic-gate      */
9560Sstevel@tonic-gate     public void logout() {
9570Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
9580Sstevel@tonic-gate         setListeners(MainNormal, false);
9590Sstevel@tonic-gate         setListeners(defaultsNormal, false);
9600Sstevel@tonic-gate         try {
9610Sstevel@tonic-gate             Kadmin.sessionExit();
9620Sstevel@tonic-gate             Kadmin = null;
9630Sstevel@tonic-gate         } catch (Exception e) {
9640Sstevel@tonic-gate             realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
9650Sstevel@tonic-gate             showError(e.getMessage());
9660Sstevel@tonic-gate             return;
9670Sstevel@tonic-gate         }
9680Sstevel@tonic-gate         setLoginDefaults();
9690Sstevel@tonic-gate         principalList = null;
9700Sstevel@tonic-gate         gui.Prlist.set("items" /* NOI18N */, null);
9710Sstevel@tonic-gate         policyList = null;
9720Sstevel@tonic-gate         gui.Pollist.set("items" /* NOI18N */, null);
9730Sstevel@tonic-gate         gui.mainframe.show(false);
9740Sstevel@tonic-gate         curPrListPos = 0;
9750Sstevel@tonic-gate         curPrPattern = "";
9760Sstevel@tonic-gate         curPoListPos = 0;
9770Sstevel@tonic-gate         curPoPattern = "";
9780Sstevel@tonic-gate 
9790Sstevel@tonic-gate         // Forget this user's print preferences
9800Sstevel@tonic-gate         PrintUtil.reinitialize();
9810Sstevel@tonic-gate 
9820Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
9830Sstevel@tonic-gate     }
9840Sstevel@tonic-gate 
9850Sstevel@tonic-gate     public void exit() {
9860Sstevel@tonic-gate         try {
9870Sstevel@tonic-gate             if (Kadmin != null)
9880Sstevel@tonic-gate                 Kadmin.sessionExit();
9890Sstevel@tonic-gate         } catch (Exception e) {}
9900Sstevel@tonic-gate         super.exit();
9910Sstevel@tonic-gate     }
9920Sstevel@tonic-gate 
9930Sstevel@tonic-gate     /*
9940Sstevel@tonic-gate      * Methods for the principal list panel
9950Sstevel@tonic-gate      */
9960Sstevel@tonic-gate 
9970Sstevel@tonic-gate     /**
9980Sstevel@tonic-gate      * Update all principal text fields from gui.
9990Sstevel@tonic-gate      * Check to see if anyone of them had a parse error.
10000Sstevel@tonic-gate      * @param nullPasswdOK true if the password can be null. This is
10010Sstevel@tonic-gate      * allowed only when the operation is a modify on an existing
10020Sstevel@tonic-gate      * principal or if it is an attempt to print a new principal still
10030Sstevel@tonic-gate      * in creation.
10040Sstevel@tonic-gate      * @returns true if all is ok,  false if an error occurs
10050Sstevel@tonic-gate      */
10060Sstevel@tonic-gate     // Quits as soon as the first error is detected. The method that
10070Sstevel@tonic-gate     // detects the error also shows a dialog box with a message.
10080Sstevel@tonic-gate     public boolean prUpdateFromGui(boolean nullPasswdOK) {
10090Sstevel@tonic-gate         return (setPrName1() && setPrPassword(nullPasswdOK) && setPrExpiry() &&
10100Sstevel@tonic-gate 		setPrComments() && setPrPwExpiry() && setPrKvno() &&
1011*96Ssemery 		setPrMaxlife() && setPrMaxrenew() && setEncType());
10120Sstevel@tonic-gate     }
10130Sstevel@tonic-gate 
10140Sstevel@tonic-gate     /**
10150Sstevel@tonic-gate      * Is the principal name field editable?
10160Sstevel@tonic-gate      *
10170Sstevel@tonic-gate      */
10180Sstevel@tonic-gate     public void prSetEditable(boolean editable) {
10190Sstevel@tonic-gate         prnameEditable = editable;
10200Sstevel@tonic-gate         Boolean b = new Boolean(editable);
10210Sstevel@tonic-gate         gui.PrName1.set("editable" /* NOI18N */, b);
10220Sstevel@tonic-gate     }
10230Sstevel@tonic-gate 
10240Sstevel@tonic-gate     /**
10250Sstevel@tonic-gate      * React to a change in the principal search pattern
10260Sstevel@tonic-gate      *
10270Sstevel@tonic-gate      */
10280Sstevel@tonic-gate     public void prPatternComplete() {
10290Sstevel@tonic-gate         curPrListPos = 0;
10300Sstevel@tonic-gate         String pattern = (String)gui.PrListPattern.get("text" /* NOI18N */);
10310Sstevel@tonic-gate         if (!noLists)
10320Sstevel@tonic-gate             showPrincipalList(pattern);
10330Sstevel@tonic-gate         else
10340Sstevel@tonic-gate             setCurPrincipal(pattern);
10350Sstevel@tonic-gate     }
10360Sstevel@tonic-gate 
10370Sstevel@tonic-gate     /**
10380Sstevel@tonic-gate      * Clear principal search pattern
10390Sstevel@tonic-gate      *
10400Sstevel@tonic-gate      */
10410Sstevel@tonic-gate     public void prPatternClear() {
10420Sstevel@tonic-gate         if (noLists) {
10430Sstevel@tonic-gate             gui.PrListPattern.set("text" /* NOI18N */, "");
10440Sstevel@tonic-gate             ((TextField)gui.PrListPattern.getBody()).requestFocus();
10450Sstevel@tonic-gate         } else {
10460Sstevel@tonic-gate             String tempName = CurPrincipal;
10470Sstevel@tonic-gate             fillPrincipalList("");
10480Sstevel@tonic-gate             selectPrincipal(tempName);
10490Sstevel@tonic-gate         }
10500Sstevel@tonic-gate     }
10510Sstevel@tonic-gate 
10520Sstevel@tonic-gate     /**
10530Sstevel@tonic-gate      * Show the principal list after applying the filter passed in.
10540Sstevel@tonic-gate      */
10550Sstevel@tonic-gate     public void showPrincipalList(String pattern) {
10560Sstevel@tonic-gate         prin = null; // we are not editing a principal
10570Sstevel@tonic-gate         fillPrincipalList(pattern);
10580Sstevel@tonic-gate         ModeString = "";
10590Sstevel@tonic-gate         OpString = "";
10600Sstevel@tonic-gate         updateStatus();
10610Sstevel@tonic-gate         gui.cardpanel1.show("List" /* NOI18N */);
10620Sstevel@tonic-gate         if (noLists)
10630Sstevel@tonic-gate             ((TextField)gui.PrListPattern.getBody()).requestFocus();
10640Sstevel@tonic-gate     }
10650Sstevel@tonic-gate 
10660Sstevel@tonic-gate     /**
10670Sstevel@tonic-gate      * Generate the principal list for the first time or after a pattern
10680Sstevel@tonic-gate      * has been chosen.
10690Sstevel@tonic-gate      *
10700Sstevel@tonic-gate      */
10710Sstevel@tonic-gate     public void fillPrincipalList(String pattern) {
10720Sstevel@tonic-gate         if (noLists) {
10730Sstevel@tonic-gate             setCurPrincipal((String)gui.PrListPattern.get("text" /* NOI18N */));
10740Sstevel@tonic-gate             ((TextField)gui.PrListPattern.getBody()).requestFocus();
10750Sstevel@tonic-gate             disablePrincipalPrinting();
10760Sstevel@tonic-gate             return;
10770Sstevel@tonic-gate         }
10780Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
10790Sstevel@tonic-gate         pdateStartPlist = new Date();
10800Sstevel@tonic-gate         // Do we still want to cache the principal list?
10810Sstevel@tonic-gate         long cachetime = A_LONG_TIME;
10820Sstevel@tonic-gate         if (!defaults.getStaticLists())
10830Sstevel@tonic-gate             cachetime = defaults.getCacheTime() * 1000;
10840Sstevel@tonic-gate         if (principalList != null
10850Sstevel@tonic-gate 	    && ((new Date()).getTime() - principalListDate.getTime())
10860Sstevel@tonic-gate 	    <= cachetime) {
10870Sstevel@tonic-gate 
10880Sstevel@tonic-gate             // Has the pattern changed?
10890Sstevel@tonic-gate             if (pattern.compareTo(curPrPattern) != 0)
10900Sstevel@tonic-gate                 newPrPattern(pattern);
10910Sstevel@tonic-gate             realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
10920Sstevel@tonic-gate             selectPrincipal(curPrListPos);
10930Sstevel@tonic-gate             return;
10940Sstevel@tonic-gate 
10950Sstevel@tonic-gate         }
10960Sstevel@tonic-gate         PrincipalList p = new PrincipalList(Kadmin);
10970Sstevel@tonic-gate         gui.StatusLine.set("text" /* NOI18N */,
10980Sstevel@tonic-gate 			   getString("Loading principal list"));
10990Sstevel@tonic-gate         try {
11000Sstevel@tonic-gate             principalList = p.getPrincipalList(CurRealm);
11010Sstevel@tonic-gate             principalListDate = new Date();
11020Sstevel@tonic-gate         } catch (Exception e) {
11030Sstevel@tonic-gate             realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
11040Sstevel@tonic-gate             showError(e.getMessage());
11050Sstevel@tonic-gate             updateStatus();
11060Sstevel@tonic-gate             return;
11070Sstevel@tonic-gate         }
11080Sstevel@tonic-gate         updateStatus();
11090Sstevel@tonic-gate         pdateHavePlist = new Date();
11100Sstevel@tonic-gate         reportTime("Fetched Plist  : ", pdateHavePlist, pdateStartPlist);
11110Sstevel@tonic-gate         newPrPattern(pattern);
11120Sstevel@tonic-gate         selectPrincipal(curPrListPos);
11130Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
11140Sstevel@tonic-gate         pdateDonePlist = new Date();
11150Sstevel@tonic-gate         reportTime("Completed Plist: ", pdateDonePlist, pdateHavePlist);
11160Sstevel@tonic-gate         if (perfmon)
11170Sstevel@tonic-gate             System.out.println("Principal list has "
11180Sstevel@tonic-gate 	       +(new Integer(principalList.length)).toString()+" items");
11190Sstevel@tonic-gate     }
11200Sstevel@tonic-gate 
11210Sstevel@tonic-gate     private void newPrPattern(String pattern) {
11220Sstevel@tonic-gate         curPrPattern = pattern;
11230Sstevel@tonic-gate         gui.PrListPattern.set("text" /* NOI18N */, pattern);
11240Sstevel@tonic-gate         refreshPrincipalList();
11250Sstevel@tonic-gate     }
11260Sstevel@tonic-gate 
11270Sstevel@tonic-gate     private void refreshPrincipalList() {
11280Sstevel@tonic-gate         if (noLists)
11290Sstevel@tonic-gate             return;
11300Sstevel@tonic-gate         Filter f = new Filter(principalList, curPrPattern);
11310Sstevel@tonic-gate         gui.Prlist.set("items" /* NOI18N */, f.out);
11320Sstevel@tonic-gate     }
11330Sstevel@tonic-gate 
11340Sstevel@tonic-gate     private void selectPrincipal(int pos) {
11350Sstevel@tonic-gate         TextList list = (TextList)gui.Prlist.getBody();
11360Sstevel@tonic-gate         if (list.countItems() == 0) {
11370Sstevel@tonic-gate             setCurPrincipal("");
11380Sstevel@tonic-gate             return;
11390Sstevel@tonic-gate         }
11400Sstevel@tonic-gate 
11410Sstevel@tonic-gate         if (pos < 0)
11420Sstevel@tonic-gate             pos = 0;
11430Sstevel@tonic-gate         else if (pos >= list.countItems())
11440Sstevel@tonic-gate             pos = list.countItems() - 1;
11450Sstevel@tonic-gate 
11460Sstevel@tonic-gate         list.select(pos);
11470Sstevel@tonic-gate         enablePrincipalPrinting();
11480Sstevel@tonic-gate         list.makeVisible(pos);
11490Sstevel@tonic-gate         setCurPrincipal(list.getItem(pos));
11500Sstevel@tonic-gate     }
11510Sstevel@tonic-gate 
11520Sstevel@tonic-gate     private void selectPrincipal(String name) {
11530Sstevel@tonic-gate         String[] list = getItemsFromTextList(((TextList)gui.Prlist.getBody()));
11540Sstevel@tonic-gate         selectPrincipal(search(list, name));
11550Sstevel@tonic-gate     }
11560Sstevel@tonic-gate 
11570Sstevel@tonic-gate     private String[] getItemsFromTextList(TextList list) {
11580Sstevel@tonic-gate         StringVector v = list.items();
11590Sstevel@tonic-gate         String [] ret = new String[v.size()];
11600Sstevel@tonic-gate         v.copyInto(ret);
11610Sstevel@tonic-gate         return ret;
11620Sstevel@tonic-gate     }
11630Sstevel@tonic-gate 
11640Sstevel@tonic-gate     /**
11650Sstevel@tonic-gate      * Find index where "name" might go in a sorted string array;
11660Sstevel@tonic-gate      * returns either the element which matches "name" exactly
11670Sstevel@tonic-gate      * or the element just lexographically greater than "name".
11680Sstevel@tonic-gate      */
11690Sstevel@tonic-gate     private int search(String[] array, String name) {
11700Sstevel@tonic-gate         int lo = 0;
11710Sstevel@tonic-gate         int hi = array.length;
11720Sstevel@tonic-gate         int mid = hi;
11730Sstevel@tonic-gate         while (lo < hi) {
11740Sstevel@tonic-gate             mid = (lo + hi) / 2;
11750Sstevel@tonic-gate             int cmp = name.concat("@").compareTo(array[mid].concat("@"));
11760Sstevel@tonic-gate             if (hi - lo == 1) {
11770Sstevel@tonic-gate                 if (cmp > 0)
11780Sstevel@tonic-gate                     mid = hi;
11790Sstevel@tonic-gate                 break;
11800Sstevel@tonic-gate             }
11810Sstevel@tonic-gate             if (cmp == 0)
11820Sstevel@tonic-gate                 break;
11830Sstevel@tonic-gate             if (cmp < 0)
11840Sstevel@tonic-gate                 hi = mid;
11850Sstevel@tonic-gate             else if (cmp > 0)
11860Sstevel@tonic-gate                 lo = mid;
11870Sstevel@tonic-gate         }
11880Sstevel@tonic-gate         return mid;
11890Sstevel@tonic-gate     }
11900Sstevel@tonic-gate 
11910Sstevel@tonic-gate     private String[] addToList(String[] list, String name) {
11920Sstevel@tonic-gate         if (list == null)
11930Sstevel@tonic-gate             return null;
11940Sstevel@tonic-gate         int index = search(list, name);
11950Sstevel@tonic-gate         int rem = list.length - index;
11960Sstevel@tonic-gate         String[] newlist = new String[list.length+1];
11970Sstevel@tonic-gate         if (index > 0)
11980Sstevel@tonic-gate             System.arraycopy(list, 0, newlist, 0, index);
11990Sstevel@tonic-gate         newlist[index] = name;
12000Sstevel@tonic-gate         if (rem > 0)
12010Sstevel@tonic-gate             System.arraycopy(list, index, newlist, index+1, rem);
12020Sstevel@tonic-gate         return newlist;
12030Sstevel@tonic-gate     }
12040Sstevel@tonic-gate 
12050Sstevel@tonic-gate     private String[] delFromList(String[] list, String name) {
12060Sstevel@tonic-gate         if (list == null)
12070Sstevel@tonic-gate             return null;
12080Sstevel@tonic-gate         int index = search(list, name);
12090Sstevel@tonic-gate         int rem = list.length - index;
12100Sstevel@tonic-gate         String[] newlist = new String[list.length-1];
12110Sstevel@tonic-gate         if (index > 0)
12120Sstevel@tonic-gate             System.arraycopy(list, 0, newlist, 0, index);
12130Sstevel@tonic-gate         if (rem > 1)
12140Sstevel@tonic-gate             System.arraycopy(list, index+1, newlist, index, rem-1);
12150Sstevel@tonic-gate         return newlist;
12160Sstevel@tonic-gate     }
12170Sstevel@tonic-gate 
12180Sstevel@tonic-gate     /**
12190Sstevel@tonic-gate      * Collect the policy choice entries
12200Sstevel@tonic-gate      *
12210Sstevel@tonic-gate      */
12220Sstevel@tonic-gate     public void setPolicyChoice() {
12230Sstevel@tonic-gate         String[] pols = null;
12240Sstevel@tonic-gate         if (!noLists) {
12250Sstevel@tonic-gate             PolicyList p = new PolicyList(Kadmin);
12260Sstevel@tonic-gate             try {
12270Sstevel@tonic-gate                 pols = p.getPolicyList();
12280Sstevel@tonic-gate             } catch (Exception e) {
12290Sstevel@tonic-gate                 showError(e.getMessage());
12300Sstevel@tonic-gate                 return;
12310Sstevel@tonic-gate             }
12320Sstevel@tonic-gate         }
12330Sstevel@tonic-gate         Choice c = (Choice)gui.PrPolicy.getBody();
12340Sstevel@tonic-gate         c.removeAll();
12350Sstevel@tonic-gate         c.add(getString("(no policy)"));
12360Sstevel@tonic-gate         for (int i = 0; pols != null && i < pols.length; i++)
12370Sstevel@tonic-gate             c.add(pols[i]);
12380Sstevel@tonic-gate     }
12390Sstevel@tonic-gate 
12400Sstevel@tonic-gate     /**
12410Sstevel@tonic-gate      * Look at the principal list to see what's selected
12420Sstevel@tonic-gate      *
12430Sstevel@tonic-gate      */
12440Sstevel@tonic-gate     public void lookAtPrList() {
12450Sstevel@tonic-gate         if (noLists)
12460Sstevel@tonic-gate             return;
12470Sstevel@tonic-gate         TextList list = (TextList) gui.Prlist.getBody();
12480Sstevel@tonic-gate         prMulti = null;
12490Sstevel@tonic-gate         String[] sel = list.getSelectedItems();
12500Sstevel@tonic-gate         if (sel.length == 1) {
12510Sstevel@tonic-gate             setCurPrincipal(sel[0]);
12520Sstevel@tonic-gate             curPrListPos = list.getSelectedIndex();
12530Sstevel@tonic-gate         } else {
12540Sstevel@tonic-gate             if (sel.length > 0)
12550Sstevel@tonic-gate                 prMulti = sel;
12560Sstevel@tonic-gate             setCurPrincipal("");
12570Sstevel@tonic-gate         }
12580Sstevel@tonic-gate     }
12590Sstevel@tonic-gate 
12600Sstevel@tonic-gate     private void restorePrListSelection() {
12610Sstevel@tonic-gate         if (noLists)
12620Sstevel@tonic-gate             return;
12630Sstevel@tonic-gate         TextList list = (TextList) gui.Prlist.getBody();
12640Sstevel@tonic-gate         list.select(curPrListPos);
12650Sstevel@tonic-gate     }
12660Sstevel@tonic-gate 
12670Sstevel@tonic-gate     /**
12680Sstevel@tonic-gate      * When the principal name choice changes, we want to reflect
12690Sstevel@tonic-gate      * the name in the other principal tabs.  We can also use this
12700Sstevel@tonic-gate      * opportunity to enable/disable buttons.
12710Sstevel@tonic-gate      *
12720Sstevel@tonic-gate      */
12730Sstevel@tonic-gate     public void setCurPrincipal(String name) {
12740Sstevel@tonic-gate         CurPrincipal = name;
12750Sstevel@tonic-gate         gui.PrName1.set("text" /* NOI18N */, name);
12760Sstevel@tonic-gate         gui.PrName2.set("text" /* NOI18N */, name);
12770Sstevel@tonic-gate         gui.PrName3.set("text" /* NOI18N */, name);
12780Sstevel@tonic-gate         if (name.compareTo("") == 0) {
12790Sstevel@tonic-gate             prSelValid(false);
12800Sstevel@tonic-gate             return;
12810Sstevel@tonic-gate         }
12820Sstevel@tonic-gate         prSelValid(true);
12830Sstevel@tonic-gate     }
12840Sstevel@tonic-gate 
12850Sstevel@tonic-gate     /**
12860Sstevel@tonic-gate      * Make Modify, Delete and Duplicate buttons react to what is selected.
12870Sstevel@tonic-gate      * Privileges:
12880Sstevel@tonic-gate      * If we have neither modify or inquire, we keep Modify disabled;
12890Sstevel@tonic-gate      * if we have no modify privileges, we permit Modify to see info,
12900Sstevel@tonic-gate      * but the principal panel components are disabled in reactToPrivs().
12910Sstevel@tonic-gate      * If we have add and inquire privileges, we can permit Duplicate;
12920Sstevel@tonic-gate      * no add also means Create New is permanently disabled in reactToPrivs().
12930Sstevel@tonic-gate      * If we have no delete privileges, we keep Delete disabled.
12940Sstevel@tonic-gate      */
12950Sstevel@tonic-gate     public void prSelValid(boolean selected) {
12960Sstevel@tonic-gate         prSelValid = selected;
12970Sstevel@tonic-gate         Boolean b = new Boolean(selected && (privs & PRIV_INQUIRE) != 0);
12980Sstevel@tonic-gate         gui.PrListModify.set("enabled" /* NOI18N */, b);
12990Sstevel@tonic-gate         int want = (PRIV_ADD | PRIV_INQUIRE);
13000Sstevel@tonic-gate         b = new Boolean(selected && (privs & want) == want);
13010Sstevel@tonic-gate         gui.PrListDuplicate.set("enabled" /* NOI18N */, b);
13020Sstevel@tonic-gate         b = new Boolean((selected || prMulti != null)
13030Sstevel@tonic-gate 			&&(privs & PRIV_DELETE) != 0);
13040Sstevel@tonic-gate         gui.PrListDelete.set("enabled" /* NOI18N */, b);
13050Sstevel@tonic-gate     }
13060Sstevel@tonic-gate 
13070Sstevel@tonic-gate     /**
13080Sstevel@tonic-gate      * Make the Save button do the right thing.
13090Sstevel@tonic-gate      *
13100Sstevel@tonic-gate      */
13110Sstevel@tonic-gate     public void prSetCanSave(boolean ok) {
13120Sstevel@tonic-gate         Boolean b = new Boolean(ok);
13130Sstevel@tonic-gate         gui.PrBasicSave.set("enabled" /* NOI18N */, b);
13140Sstevel@tonic-gate         gui.PrDetailSave.set("enabled" /* NOI18N */, b);
13150Sstevel@tonic-gate         gui.PrFlagsSave.set("enabled" /* NOI18N */, b);
13160Sstevel@tonic-gate     }
13170Sstevel@tonic-gate 
13180Sstevel@tonic-gate     /**
13190Sstevel@tonic-gate      * Update status line with current information.
13200Sstevel@tonic-gate      *
13210Sstevel@tonic-gate      */
13220Sstevel@tonic-gate     public void updateStatus() {
13230Sstevel@tonic-gate         gui.StatusLine.set("text" /* NOI18N */, ModeString+OpString+SaveString);
13240Sstevel@tonic-gate     }
13250Sstevel@tonic-gate 
13260Sstevel@tonic-gate     /**
13270Sstevel@tonic-gate      * This is a way for the data modification actions to note that
13280Sstevel@tonic-gate      * the principal has edits outstanding.
13290Sstevel@tonic-gate      *
13300Sstevel@tonic-gate      */
13310Sstevel@tonic-gate     public void prSetNeedSave() {
13320Sstevel@tonic-gate         prNeedSave = true;
13330Sstevel@tonic-gate         prSetCanSave(true);
13340Sstevel@tonic-gate         SaveString = getString("- *CHANGES*");
13350Sstevel@tonic-gate         updateStatus();
13360Sstevel@tonic-gate     }
13370Sstevel@tonic-gate 
13380Sstevel@tonic-gate     public boolean prDoSave() {
13390Sstevel@tonic-gate 
13400Sstevel@tonic-gate         // before attempting to save make sure all text fields are in order
13410Sstevel@tonic-gate         if (prUpdateFromGui(!prin.isNew) == false)
13420Sstevel@tonic-gate             return false;
13430Sstevel@tonic-gate 
13440Sstevel@tonic-gate         boolean b = true;
13450Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
13460Sstevel@tonic-gate         try {
13470Sstevel@tonic-gate             b = prin.savePrincipal();
13480Sstevel@tonic-gate         } catch (Exception e) {
13490Sstevel@tonic-gate             b = false;
13500Sstevel@tonic-gate             showError(e.getMessage());
13510Sstevel@tonic-gate         }
13520Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
13530Sstevel@tonic-gate         if (!b)
13540Sstevel@tonic-gate             return false;
13550Sstevel@tonic-gate         if (prin.isNew) {
13560Sstevel@tonic-gate             principalList = addToList(principalList, prin.PrName);
13570Sstevel@tonic-gate             refreshPrincipalList();
13580Sstevel@tonic-gate             selectPrincipal(prin.PrName);
13590Sstevel@tonic-gate         }
13600Sstevel@tonic-gate         prin.isNew = false;
13610Sstevel@tonic-gate         gui.PrPassword.set("text" /* NOI18N */, "");
13620Sstevel@tonic-gate         prin.setPassword("");
13630Sstevel@tonic-gate         prSetEditable(false);
13640Sstevel@tonic-gate         prSetCanSave(false);
13650Sstevel@tonic-gate         prNeedSave = false;
13660Sstevel@tonic-gate         SaveString = "";
13670Sstevel@tonic-gate         updateStatus();
13680Sstevel@tonic-gate         return true;
13690Sstevel@tonic-gate     }
13700Sstevel@tonic-gate 
13710Sstevel@tonic-gate     /**
13720Sstevel@tonic-gate      * React to a choice from the principal list via double-click or
13730Sstevel@tonic-gate      * single-click+Modify; we want to go to the next tab in each case.
13740Sstevel@tonic-gate      * If we don't have modify privileges, we need to simply show values.
13750Sstevel@tonic-gate      */
13760Sstevel@tonic-gate     public void prModify() {
13770Sstevel@tonic-gate         enablePrincipalPrinting();
13780Sstevel@tonic-gate         if (!prNeedSave) {
13790Sstevel@tonic-gate             prSetEditable(false);
13800Sstevel@tonic-gate             prSetCanSave(false);
13810Sstevel@tonic-gate         }
13820Sstevel@tonic-gate         if (noLists)
13830Sstevel@tonic-gate             CurPrincipal = (String)gui.PrListPattern.get("text" /* NOI18N */);
13840Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
13850Sstevel@tonic-gate         enablePrAttributes(new Boolean((privs & (PRIV_ADD|PRIV_MODIFY)) != 0));
13860Sstevel@tonic-gate         Boolean b = new Boolean((privs & PRIV_CHANGEPW) != 0);
13870Sstevel@tonic-gate         gui.PrPassword.set("enabled" /* NOI18N */, b);
13880Sstevel@tonic-gate         gui.PrBasicRandomPw.set("enabled" /* NOI18N */, b);
1389*96Ssemery         gui.EncList.set("enabled" /* NOI18N */, b);
13900Sstevel@tonic-gate         try {
13910Sstevel@tonic-gate             prin = new Principal(Kadmin, CurPrincipal);
13920Sstevel@tonic-gate         } catch (Exception e) {
13930Sstevel@tonic-gate             showError(e.getMessage());
13940Sstevel@tonic-gate             realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
13950Sstevel@tonic-gate             return;
13960Sstevel@tonic-gate         }
13970Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
13980Sstevel@tonic-gate         showPrincipal(prin);
13990Sstevel@tonic-gate         String policy = (String)gui.PrPolicy.get("selectedItem" /* NOI18N */);
14000Sstevel@tonic-gate         if (policy.compareTo(getString("(no policy)")) == 0)
14010Sstevel@tonic-gate             policy = "";
14020Sstevel@tonic-gate         else
14030Sstevel@tonic-gate             setDefaultPolicy(policy);
14040Sstevel@tonic-gate         ModeString = getString("Modify")+" ";
14050Sstevel@tonic-gate         OpString = getString("Principal");
14060Sstevel@tonic-gate         updateStatus();
14070Sstevel@tonic-gate         gui.cardpanel1.show("Basics" /* NOI18N */);
14080Sstevel@tonic-gate     }
14090Sstevel@tonic-gate 
14100Sstevel@tonic-gate     /**
14110Sstevel@tonic-gate      * React to add principal button
14120Sstevel@tonic-gate      * If we got here, we need to enable attributes since we have privs.
14130Sstevel@tonic-gate      */
14140Sstevel@tonic-gate     public void prAdd() {
14150Sstevel@tonic-gate         enablePrincipalPrinting();
14160Sstevel@tonic-gate         setCurPrincipal("");
14170Sstevel@tonic-gate         prSelValid = true;
14180Sstevel@tonic-gate         prSetEditable(true);
14190Sstevel@tonic-gate         prSetNeedSave();
14200Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
14210Sstevel@tonic-gate         Boolean b = new Boolean(true);
14220Sstevel@tonic-gate         enablePrAttributes(b);
14230Sstevel@tonic-gate         gui.PrPassword.set("enabled" /* NOI18N */, b);
14240Sstevel@tonic-gate         gui.PrBasicRandomPw.set("enabled" /* NOI18N */, b);
1425*96Ssemery         gui.EncList.set("enabled" /* NOI18N */, b);
14260Sstevel@tonic-gate         try {
14270Sstevel@tonic-gate             prin = new Principal(Kadmin, defaults);
14280Sstevel@tonic-gate         } catch (Exception e) {
14290Sstevel@tonic-gate             showError(e.getMessage());
14300Sstevel@tonic-gate             realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
14310Sstevel@tonic-gate             return;
14320Sstevel@tonic-gate         }
14330Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
14340Sstevel@tonic-gate         showPrincipal(prin);
14350Sstevel@tonic-gate         ModeString = getString("Create New")+" ";
14360Sstevel@tonic-gate         OpString = getString("Principal");
14370Sstevel@tonic-gate         updateStatus();
14380Sstevel@tonic-gate         gui.cardpanel1.show("Basics" /* NOI18N */);
14390Sstevel@tonic-gate         ((TextField)gui.PrName1.getBody()).requestFocus();
14400Sstevel@tonic-gate     }
14410Sstevel@tonic-gate 
14420Sstevel@tonic-gate     /**
14430Sstevel@tonic-gate      * React to duplicate principal button
14440Sstevel@tonic-gate      *
14450Sstevel@tonic-gate      */
14460Sstevel@tonic-gate     public void prDuplicate() {
14470Sstevel@tonic-gate         enablePrincipalPrinting();
14480Sstevel@tonic-gate         if (noLists)
14490Sstevel@tonic-gate             CurPrincipal = (String)gui.PrListPattern.get("text" /* NOI18N */);
14500Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
14510Sstevel@tonic-gate         try {
14520Sstevel@tonic-gate             prin = new Principal(Kadmin, CurPrincipal);
14530Sstevel@tonic-gate         } catch (Exception e) {
14540Sstevel@tonic-gate             showError(e.getMessage());
14550Sstevel@tonic-gate             realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
14560Sstevel@tonic-gate             return;
14570Sstevel@tonic-gate         }
14580Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
14590Sstevel@tonic-gate         setCurPrincipal("");
14600Sstevel@tonic-gate         prSelValid = true;
14610Sstevel@tonic-gate         prSetEditable(true);
14620Sstevel@tonic-gate         prSetNeedSave();
14630Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
14640Sstevel@tonic-gate         Boolean b = new Boolean(true);
14650Sstevel@tonic-gate         enablePrAttributes(b);
14660Sstevel@tonic-gate         gui.PrPassword.set("enabled" /* NOI18N */, b);
14670Sstevel@tonic-gate         gui.PrBasicRandomPw.set("enabled" /* NOI18N */, b);
1468*96Ssemery         gui.PrBasicRandomPw.set("enabled" /* NOI18N */, b);
14690Sstevel@tonic-gate         try {
14700Sstevel@tonic-gate             prin = new Principal(Kadmin, prin);
14710Sstevel@tonic-gate         } catch (Exception e) {
14720Sstevel@tonic-gate             showError(e.getMessage());
14730Sstevel@tonic-gate             realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
14740Sstevel@tonic-gate             return;
14750Sstevel@tonic-gate         }
14760Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
14770Sstevel@tonic-gate         prin.PrName = "";
14780Sstevel@tonic-gate         showPrincipal(prin);
14790Sstevel@tonic-gate         ModeString = getString("Duplicate")+" ";
14800Sstevel@tonic-gate         OpString = getString("Principal");
14810Sstevel@tonic-gate         updateStatus();
14820Sstevel@tonic-gate         gui.cardpanel1.show("Basics" /* NOI18N */);
14830Sstevel@tonic-gate         ((TextField)gui.PrName1.getBody()).requestFocus();
14840Sstevel@tonic-gate     }
14850Sstevel@tonic-gate 
14860Sstevel@tonic-gate     /**
14870Sstevel@tonic-gate      * React to delete principal button
14880Sstevel@tonic-gate      */
14890Sstevel@tonic-gate     public void prDelete() {
14900Sstevel@tonic-gate         String text[] = {getString("You are about to destroy data."),
14910Sstevel@tonic-gate 			 getString("Click OK to proceed or"
14920Sstevel@tonic-gate 				   +" Cancel to continue editing.")};
14930Sstevel@tonic-gate         String resp = confirmAction(realMainFrame, text);
14940Sstevel@tonic-gate         if (resp.equals(getString("Cancel")))
14950Sstevel@tonic-gate             return;
14960Sstevel@tonic-gate         if (noLists)
14970Sstevel@tonic-gate             CurPrincipal = (String)gui.PrListPattern.get("text" /* NOI18N */);
14980Sstevel@tonic-gate         boolean b = false;
14990Sstevel@tonic-gate         try {
15000Sstevel@tonic-gate             b = Kadmin.deletePrincipal(CurPrincipal);
15010Sstevel@tonic-gate         } catch (Exception e) {
15020Sstevel@tonic-gate             showError(e.getMessage());
15030Sstevel@tonic-gate             return;
15040Sstevel@tonic-gate         }
15050Sstevel@tonic-gate         if (!b)
15060Sstevel@tonic-gate             return;
15070Sstevel@tonic-gate         principalList = delFromList(principalList, CurPrincipal);
15080Sstevel@tonic-gate         refreshPrincipalList();
15090Sstevel@tonic-gate         setCurPrincipal("");
15100Sstevel@tonic-gate         prSelValid = true;
15110Sstevel@tonic-gate         prSetEditable(true);
15120Sstevel@tonic-gate         if (curPrListPos == ((TextList)gui.Prlist.getBody()).countItems())
15130Sstevel@tonic-gate             curPrListPos--;
15140Sstevel@tonic-gate         showPrincipalList(curPrPattern);
15150Sstevel@tonic-gate     }
15160Sstevel@tonic-gate 
15170Sstevel@tonic-gate     /**
15180Sstevel@tonic-gate      * React to Previous button on basic screen
15190Sstevel@tonic-gate      *
15200Sstevel@tonic-gate      */
15210Sstevel@tonic-gate     public void prBasicPrevious() {
15220Sstevel@tonic-gate         prCancel();
15230Sstevel@tonic-gate     }
15240Sstevel@tonic-gate 
15250Sstevel@tonic-gate     /**
15260Sstevel@tonic-gate      * React to Next button on basic screen. If some changes were made
15270Sstevel@tonic-gate      * then check to see if they contain a parse error. If so, do
15280Sstevel@tonic-gate      * nothing. The method that checks for error messages also displays
15290Sstevel@tonic-gate      * the error message.
15300Sstevel@tonic-gate      *
15310Sstevel@tonic-gate      */
15320Sstevel@tonic-gate     public void prBasicNext() {
15330Sstevel@tonic-gate         if (prNeedSave)
15340Sstevel@tonic-gate             if (!prUpdateFromGui(!prin.isNew))
15350Sstevel@tonic-gate 		return;
15360Sstevel@tonic-gate 
15370Sstevel@tonic-gate         updateStatus();
15380Sstevel@tonic-gate         gui.cardpanel1.show("Details" /* NOI18N */);
15390Sstevel@tonic-gate     }
15400Sstevel@tonic-gate 
15410Sstevel@tonic-gate     /**
15420Sstevel@tonic-gate      * React to Previous button on detail screen. If some changes were made
15430Sstevel@tonic-gate      * then check to see if they contain a parse error. If so, do
15440Sstevel@tonic-gate      * nothing. The method that checks for error messages also displays
15450Sstevel@tonic-gate      * the error message.
15460Sstevel@tonic-gate      */
15470Sstevel@tonic-gate     public void prDetailPrevious() {
15480Sstevel@tonic-gate         if (prNeedSave)
15490Sstevel@tonic-gate             if (!prUpdateFromGui(!prin.isNew))
15500Sstevel@tonic-gate 		return;
15510Sstevel@tonic-gate 
15520Sstevel@tonic-gate         updateStatus();
15530Sstevel@tonic-gate         gui.cardpanel1.show("Basics" /* NOI18N */);
15540Sstevel@tonic-gate     }
15550Sstevel@tonic-gate 
15560Sstevel@tonic-gate     /**
15570Sstevel@tonic-gate      * React to Next button on detail screen. If some changes were made
15580Sstevel@tonic-gate      * then check to see if they contain a parse error. If so, do
15590Sstevel@tonic-gate      * nothing. The method that checks for error messages also displays
15600Sstevel@tonic-gate      * the error message.
15610Sstevel@tonic-gate      *
15620Sstevel@tonic-gate      */
15630Sstevel@tonic-gate     public void prDetailNext() {
15640Sstevel@tonic-gate         if (prNeedSave)
15650Sstevel@tonic-gate             if (!prUpdateFromGui(!prin.isNew))
15660Sstevel@tonic-gate 		return;
15670Sstevel@tonic-gate 
15680Sstevel@tonic-gate         updateStatus();
15690Sstevel@tonic-gate         gui.cardpanel1.show("Flags" /* NOI18N */);
15700Sstevel@tonic-gate     }
15710Sstevel@tonic-gate 
15720Sstevel@tonic-gate     /**
15730Sstevel@tonic-gate      * React to Previous button on flags screen
15740Sstevel@tonic-gate      *
15750Sstevel@tonic-gate      */
15760Sstevel@tonic-gate     public void prFlagsPrevious() {
15770Sstevel@tonic-gate         updateStatus();
15780Sstevel@tonic-gate         gui.cardpanel1.show("Details" /* NOI18N */);
15790Sstevel@tonic-gate     }
15800Sstevel@tonic-gate 
15810Sstevel@tonic-gate     /**
15820Sstevel@tonic-gate      * React to Done button on flags screen. If any changes were made to
15830Sstevel@tonic-gate      * the principal, then try to save them. If the save fails for any
15840Sstevel@tonic-gate      * reason, do not return to the principal list.
15850Sstevel@tonic-gate      *
15860Sstevel@tonic-gate      */
15870Sstevel@tonic-gate     public void prFlagsDone() {
15880Sstevel@tonic-gate         if (prNeedSave && prDoSave() == false)
15890Sstevel@tonic-gate             return;
15900Sstevel@tonic-gate         showPrincipalList(curPrPattern);
15910Sstevel@tonic-gate     }
15920Sstevel@tonic-gate 
15930Sstevel@tonic-gate     /**
15940Sstevel@tonic-gate      * React to save principal button
15950Sstevel@tonic-gate      *
15960Sstevel@tonic-gate      */
15970Sstevel@tonic-gate     public void prSave() {
15980Sstevel@tonic-gate         prDoSave();
15990Sstevel@tonic-gate     }
16000Sstevel@tonic-gate 
16010Sstevel@tonic-gate     /**
16020Sstevel@tonic-gate      * React to cancel principal button
16030Sstevel@tonic-gate      *
16040Sstevel@tonic-gate      */
16050Sstevel@tonic-gate     public void prCancel() {
16060Sstevel@tonic-gate         if (prNeedSave) {
16070Sstevel@tonic-gate             String text[] = {getString("You are about to lose changes."),
16080Sstevel@tonic-gate 			     getString("Click Save to commit changes, "
16090Sstevel@tonic-gate 				       +"Discard to discard changes, "
16100Sstevel@tonic-gate 				       +"or Cancel to continue editing.")};
16110Sstevel@tonic-gate             String resp = confirmSave(realMainFrame, text);
16120Sstevel@tonic-gate             if (resp.equals(getString("Cancel")))
16130Sstevel@tonic-gate                 return;
16140Sstevel@tonic-gate             if (resp.equals(getString("Save")))
16150Sstevel@tonic-gate                 if (!prDoSave())
16160Sstevel@tonic-gate 		    return;
16170Sstevel@tonic-gate         }
16180Sstevel@tonic-gate         prSetEditable(false);
16190Sstevel@tonic-gate         prSetCanSave(false);
16200Sstevel@tonic-gate         prNeedSave = false;
16210Sstevel@tonic-gate         lookAtPrList();
16220Sstevel@tonic-gate         SaveString = "";
16230Sstevel@tonic-gate         showPrincipalList(curPrPattern);
16240Sstevel@tonic-gate     }
16250Sstevel@tonic-gate 
16260Sstevel@tonic-gate     /*
16270Sstevel@tonic-gate      * Methods for the principal attribute panels
16280Sstevel@tonic-gate      */
16290Sstevel@tonic-gate 
16300Sstevel@tonic-gate     public boolean setPrName1() {
16310Sstevel@tonic-gate         if (!prnameEditable)
16320Sstevel@tonic-gate             return true;
16330Sstevel@tonic-gate 
16340Sstevel@tonic-gate         String p = ((String)gui.PrName1.get("text" /* NOI18N */)).trim();
16350Sstevel@tonic-gate         if (p.compareTo("") == 0) {
16360Sstevel@tonic-gate             showError(getString("Please enter a principal name or cancel"));
16370Sstevel@tonic-gate             ((TextField)gui.PrName1.getBody()).requestFocus();
16380Sstevel@tonic-gate             return false;
16390Sstevel@tonic-gate         }
16400Sstevel@tonic-gate         // visually delete any white space that was at the start or end
16410Sstevel@tonic-gate         // by resetting the field to the trimmmed String.
16420Sstevel@tonic-gate         gui.PrName1.set("text" /* NOI18N */, p);
16430Sstevel@tonic-gate         setCurPrincipal(p);
16440Sstevel@tonic-gate         prin.setName(p);
16450Sstevel@tonic-gate         return true;
16460Sstevel@tonic-gate     }
16470Sstevel@tonic-gate 
16480Sstevel@tonic-gate     public boolean setPrComments() {
16490Sstevel@tonic-gate         prin.setComments((String)gui.PrComments.get("text" /* NOI18N */));
16500Sstevel@tonic-gate         return true;
16510Sstevel@tonic-gate     }
16520Sstevel@tonic-gate 
1653*96Ssemery     public boolean setEncType() {
1654*96Ssemery         if (prin.setEncType((String)gui.EncList.get("text" /* NOI18N */))) {
1655*96Ssemery             // visually delete any extraneous data that was ignored in the
1656*96Ssemery             // parsing by resetting the gui data
1657*96Ssemery             gui.EncList.set("text" /* NOI18N */,  prin.getEncType());
1658*96Ssemery             return true;
1659*96Ssemery         } else
1660*96Ssemery             return false;
1661*96Ssemery     }
1662*96Ssemery 
16630Sstevel@tonic-gate     public boolean setPrExpiry() {
16640Sstevel@tonic-gate         if (prin.setExpiry((String)gui.PrExpiry.get("text" /* NOI18N */))) {
16650Sstevel@tonic-gate             // visually delete any extraneous data that was ignored in the
16660Sstevel@tonic-gate             // parsing by resetting the gui data
16670Sstevel@tonic-gate             gui.PrExpiry.set("text" /* NOI18N */,  prin.getExpiry());
16680Sstevel@tonic-gate             return true;
16690Sstevel@tonic-gate         } else {
16700Sstevel@tonic-gate             showDataFormatError(((TextField)gui.PrExpiry.getBody()),
16710Sstevel@tonic-gate 				DATE_DATA);
16720Sstevel@tonic-gate             return false;
16730Sstevel@tonic-gate         }
16740Sstevel@tonic-gate     }
16750Sstevel@tonic-gate 
16760Sstevel@tonic-gate     public boolean setPrPassword(boolean nullOK) {
16770Sstevel@tonic-gate         String p = (String)gui.PrPassword.get("text" /* NOI18N */);
16780Sstevel@tonic-gate         if (p.compareTo("") == 0) {
16790Sstevel@tonic-gate             if (!nullOK) {
16800Sstevel@tonic-gate                 showError(getString("Please enter a password or cancel"));
16810Sstevel@tonic-gate                 ((TextField)gui.PrPassword.getBody()).requestFocus();
16820Sstevel@tonic-gate                 return false;
16830Sstevel@tonic-gate             } else return true;
16840Sstevel@tonic-gate 	}
16850Sstevel@tonic-gate 
16860Sstevel@tonic-gate         prin.setPassword(p);
16870Sstevel@tonic-gate         return true;
16880Sstevel@tonic-gate     }
16890Sstevel@tonic-gate 
16900Sstevel@tonic-gate     public void genRandomPassword() {
16910Sstevel@tonic-gate         int n, count = 0;
16920Sstevel@tonic-gate         byte[] buf = new byte[20];
16930Sstevel@tonic-gate         byte b;
16940Sstevel@tonic-gate         Random r = new Random();
16950Sstevel@tonic-gate         String passlist = "abcdefghijklmnopqrstuvwxyz1234567890!#$%&*+@"
16960Sstevel@tonic-gate 	    /* NOI18N */;
16970Sstevel@tonic-gate 
16980Sstevel@tonic-gate         gui.PrPassword.set("text" /* NOI18N */, "");
16990Sstevel@tonic-gate         while (count < 10) {
17000Sstevel@tonic-gate             n = r.nextInt() & 0x7F;
17010Sstevel@tonic-gate             b = (byte)n;
17020Sstevel@tonic-gate             if (passlist.indexOf(b) == -1)
17030Sstevel@tonic-gate                 continue;
17040Sstevel@tonic-gate             buf[count++] = b;
17050Sstevel@tonic-gate         }
17060Sstevel@tonic-gate         buf[count] = 0;
17070Sstevel@tonic-gate         CurPass = new String(buf);
17080Sstevel@tonic-gate         gui.PrPassword.set("text" /* NOI18N */, CurPass);
17090Sstevel@tonic-gate         prin.setPassword((String)gui.PrPassword.get("text" /* NOI18N */));
17100Sstevel@tonic-gate     }
17110Sstevel@tonic-gate 
17120Sstevel@tonic-gate     public void setPrPolicy() {
17130Sstevel@tonic-gate         if (prin == null)
17140Sstevel@tonic-gate                 return;
17150Sstevel@tonic-gate         String policy = (String)gui.PrPolicy.get("selectedItem" /* NOI18N */);
17160Sstevel@tonic-gate         if (policy.compareTo(getString("(no policy)")) == 0)
17170Sstevel@tonic-gate             policy = "";
17180Sstevel@tonic-gate         try {
17190Sstevel@tonic-gate                 prin.setPolicy(policy);
17200Sstevel@tonic-gate         } catch (Exception e) {};
17210Sstevel@tonic-gate         setDefaultPolicy(policy);
17220Sstevel@tonic-gate     }
17230Sstevel@tonic-gate 
17240Sstevel@tonic-gate     public boolean setPrMaxlife() {
17250Sstevel@tonic-gate         if (prin.setMaxlife((String)gui.PrMaxLifetime.get("text"
17260Sstevel@tonic-gate 							  /* NOI18N */))) {
17270Sstevel@tonic-gate             // visually delete any extraneous data that was ignored in the
17280Sstevel@tonic-gate             // parsing by resetting the gui data
17290Sstevel@tonic-gate             gui.PrMaxLifetime.set("text" /* NOI18N */, prin.getMaxLife());
17300Sstevel@tonic-gate             return true;
17310Sstevel@tonic-gate         } else {
17320Sstevel@tonic-gate             showDataFormatError(((TextField)gui.PrMaxLifetime.getBody()),
17330Sstevel@tonic-gate 				DURATION_DATA);
17340Sstevel@tonic-gate             return false;
17350Sstevel@tonic-gate         }
17360Sstevel@tonic-gate     }
17370Sstevel@tonic-gate 
17380Sstevel@tonic-gate     public boolean setPrMaxrenew() {
17390Sstevel@tonic-gate         if (prin.setMaxrenew((String)gui.PrMaxRenewal.get(
17400Sstevel@tonic-gate 						  "text" /* NOI18N */))) {
17410Sstevel@tonic-gate             // visually delete any extraneous data that was ignored in the
17420Sstevel@tonic-gate             // parsing  by resetting the gui data
17430Sstevel@tonic-gate             gui.PrMaxRenewal.set("text" /* NOI18N */, prin.getMaxRenew());
17440Sstevel@tonic-gate             return true;
17450Sstevel@tonic-gate         } else {
17460Sstevel@tonic-gate             showDataFormatError(((TextField)gui.PrMaxRenewal.getBody()),
17470Sstevel@tonic-gate 				DURATION_DATA);
17480Sstevel@tonic-gate             return false;
17490Sstevel@tonic-gate         }
17500Sstevel@tonic-gate     }
17510Sstevel@tonic-gate 
17520Sstevel@tonic-gate     public boolean setPrKvno() {
17530Sstevel@tonic-gate         if (prin.setKvno((String)gui.PrKvno.get("text" /* NOI18N */))) {
17540Sstevel@tonic-gate             // visually delete any extraneous data that was ignored in the
17550Sstevel@tonic-gate             // parsing by resetting the gui data
17560Sstevel@tonic-gate             gui.PrKvno.set("text" /* NOI18N */, nf.format(prin.Kvno));
17570Sstevel@tonic-gate             return true;
17580Sstevel@tonic-gate         } else {
17590Sstevel@tonic-gate             showDataFormatError(((TextField)gui.PrKvno.getBody()), NUMBER_DATA);
17600Sstevel@tonic-gate             return false;
17610Sstevel@tonic-gate         }
17620Sstevel@tonic-gate     }
17630Sstevel@tonic-gate 
17640Sstevel@tonic-gate     public boolean setPrPwExpiry() {
17650Sstevel@tonic-gate         if (prin.setPwExpiry((String)gui.PrPwExpiry.get("text" /* NOI18N */))) {
17660Sstevel@tonic-gate             // visually delete any extraneous data that was ignored in the
17670Sstevel@tonic-gate             // parsing by resetting the gui data
17680Sstevel@tonic-gate             gui.PrPwExpiry.set("text" /* NOI18N */, prin.getPwExpireTime());
17690Sstevel@tonic-gate             return true;
17700Sstevel@tonic-gate         } else {
17710Sstevel@tonic-gate             showDataFormatError(((TextField)gui.PrPwExpiry.getBody()),
17720Sstevel@tonic-gate 				DATE_DATA);
17730Sstevel@tonic-gate             return false;
17740Sstevel@tonic-gate         }
17750Sstevel@tonic-gate     }
17760Sstevel@tonic-gate 
17770Sstevel@tonic-gate     public void setPrFlag(int bitmask) {
17780Sstevel@tonic-gate         prin.flags.toggleFlags(bitmask);
17790Sstevel@tonic-gate     }
17800Sstevel@tonic-gate 
17810Sstevel@tonic-gate     /**
17820Sstevel@tonic-gate      * Update components to reflect data in this principal
17830Sstevel@tonic-gate      *
17840Sstevel@tonic-gate      */
17850Sstevel@tonic-gate     public void showPrincipal(Principal p) {
17860Sstevel@tonic-gate 
17870Sstevel@tonic-gate         gui.PrName1.set("text" /* NOI18N */, p.PrName);
17880Sstevel@tonic-gate         gui.PrName2.set("text" /* NOI18N */, p.PrName);
17890Sstevel@tonic-gate         gui.PrName3.set("text" /* NOI18N */, p.PrName);
17900Sstevel@tonic-gate         gui.PrComments.set("text" /* NOI18N */, p.Comments);
17910Sstevel@tonic-gate         String policy = p.Policy;
17920Sstevel@tonic-gate         if (policy.compareTo("") == 0)
17930Sstevel@tonic-gate             policy = getString("(no policy)");
17940Sstevel@tonic-gate         gui.PrPolicy.set("selectedItem" /* NOI18N */, policy);
17950Sstevel@tonic-gate         gui.PrPassword.set("text" /* NOI18N */, "");
17960Sstevel@tonic-gate 
17970Sstevel@tonic-gate         gui.PrLastChangedTime.set("text" /* NOI18N */, p.getModTime());
17980Sstevel@tonic-gate         gui.PrLastChangedBy.set("text" /* NOI18N */,   p.ModName);
17990Sstevel@tonic-gate         gui.PrExpiry.set("text" /* NOI18N */,          p.getExpiry());
1800*96Ssemery         gui.EncList.set("text" /* NOI18N */,           p.getEncType());
18010Sstevel@tonic-gate         gui.PrLastSuccess.set("text" /* NOI18N */,     p.getLastSuccess());
18020Sstevel@tonic-gate         gui.PrLastFailure.set("text" /* NOI18N */,     p.getLastFailure());
18030Sstevel@tonic-gate         gui.PrFailCount.set("text" /* NOI18N */, nf.format(p.NumFailures));
18040Sstevel@tonic-gate         gui.PrLastPwChange.set("text" /* NOI18N */,    p.getLastPwChange());
18050Sstevel@tonic-gate         gui.PrPwExpiry.set("text" /* NOI18N */,        p.getPwExpireTime());
18060Sstevel@tonic-gate         gui.PrKvno.set("text" /* NOI18N */, nf.format(p.Kvno));
18070Sstevel@tonic-gate         gui.PrMaxLifetime.set("text" /* NOI18N */, p.getMaxLife());
18080Sstevel@tonic-gate         gui.PrMaxRenewal.set("text" /* NOI18N */, p.getMaxRenew());
18090Sstevel@tonic-gate 
18100Sstevel@tonic-gate         gui.PrLockAcct.set("state" /* NOI18N */,
18110Sstevel@tonic-gate 		   new Boolean(p.flags.getFlag(Flags.DISALLOW_ALL_TIX)));
18120Sstevel@tonic-gate         gui.PrForcePwChange.set("state" /* NOI18N */,
18130Sstevel@tonic-gate 			new Boolean(p.flags.getFlag(Flags.REQUIRES_PWCHANGE)));
18140Sstevel@tonic-gate         gui.PrAllowPostdated.set("state" /* NOI18N */,
18150Sstevel@tonic-gate 		 new Boolean(!p.flags.getFlag(Flags.DISALLOW_POSTDATED)));
18160Sstevel@tonic-gate         gui.PrAllowForwardable.set("state" /* NOI18N */,
18170Sstevel@tonic-gate 		   new Boolean(!p.flags.getFlag(Flags.DISALLOW_FORWARDABLE)));
18180Sstevel@tonic-gate         gui.PrAllowRenewable.set("state" /* NOI18N */,
18190Sstevel@tonic-gate 		 new Boolean(!p.flags.getFlag(Flags.DISALLOW_RENEWABLE)));
18200Sstevel@tonic-gate         gui.PrAllowProxiable.set("state" /* NOI18N */,
18210Sstevel@tonic-gate 		 new Boolean(!p.flags.getFlag(Flags.DISALLOW_PROXIABLE)));
18220Sstevel@tonic-gate         gui.PrAllowSvr.set("state" /* NOI18N */,
18230Sstevel@tonic-gate 			   new Boolean(!p.flags.getFlag(Flags.DISALLOW_SVR)));
18240Sstevel@tonic-gate         gui.PrAllowTGT.set("state" /* NOI18N */,
18250Sstevel@tonic-gate 		   new Boolean(!p.flags.getFlag(Flags.DISALLOW_TGT_BASED)));
18260Sstevel@tonic-gate         gui.PrAllowDupAuth.set("state" /* NOI18N */,
18270Sstevel@tonic-gate 		       new Boolean(!p.flags.getFlag(Flags.DISALLOW_DUP_SKEY)));
18280Sstevel@tonic-gate         gui.PrRequirePreAuth.set("state" /* NOI18N */,
18290Sstevel@tonic-gate 			 new Boolean(p.flags.getFlag(Flags.REQUIRE_PRE_AUTH)));
18300Sstevel@tonic-gate         gui.PrRequireHwPreAuth.set("state" /* NOI18N */,
18310Sstevel@tonic-gate 			   new Boolean(p.flags.getFlag(Flags.REQUIRE_HW_AUTH)));
18320Sstevel@tonic-gate     }
18330Sstevel@tonic-gate 
18340Sstevel@tonic-gate     /**
18350Sstevel@tonic-gate      * Format a time duration for printing, using I18N formats
18360Sstevel@tonic-gate      *
18370Sstevel@tonic-gate      */
18380Sstevel@tonic-gate     public String showDuration(Integer seconds) {
18390Sstevel@tonic-gate         return nf.format(seconds.longValue());
18400Sstevel@tonic-gate     }
18410Sstevel@tonic-gate 
18420Sstevel@tonic-gate     /*
18430Sstevel@tonic-gate      * Methods for the policy list panel
18440Sstevel@tonic-gate      */
18450Sstevel@tonic-gate 
18460Sstevel@tonic-gate     /**
18470Sstevel@tonic-gate      * Update all policy text fields from gui.
18480Sstevel@tonic-gate      * Check to see if anyone of them had a parse error.
18490Sstevel@tonic-gate      * @returns true if all is ok,  false if an error occurs
18500Sstevel@tonic-gate      */
18510Sstevel@tonic-gate     // Quits as soon as the first error is detected. The method that
18520Sstevel@tonic-gate     // detects the error also shows a dialog box with a message.
18530Sstevel@tonic-gate     public boolean poUpdateFromGui() {
18540Sstevel@tonic-gate         return (setPolName() && setPolMinlife() && setPolMaxlife());
18550Sstevel@tonic-gate     }
18560Sstevel@tonic-gate 
18570Sstevel@tonic-gate     /**
18580Sstevel@tonic-gate      * If we have edited a principal, select their policy by default
18590Sstevel@tonic-gate      *
18600Sstevel@tonic-gate      */
18610Sstevel@tonic-gate     public void setDefaultPolicy(String name) {
18620Sstevel@tonic-gate         setCurPolicy(name);
18630Sstevel@tonic-gate         fillPolicyList("");
18640Sstevel@tonic-gate         TextList l = (TextList)gui.Pollist.getBody();
18650Sstevel@tonic-gate         int itemcount = l.countItems();
18660Sstevel@tonic-gate         for (int i = 0; i < itemcount; i++)
18670Sstevel@tonic-gate             if (l.getItem(i).compareTo(name) == 0) {
18680Sstevel@tonic-gate 		curPoListPos = i;
18690Sstevel@tonic-gate 		break;
18700Sstevel@tonic-gate 	    }
18710Sstevel@tonic-gate     }
18720Sstevel@tonic-gate 
18730Sstevel@tonic-gate     /**
18740Sstevel@tonic-gate      * Is the policy name field editable?
18750Sstevel@tonic-gate      *
18760Sstevel@tonic-gate      */
18770Sstevel@tonic-gate     public void poSetEditable(boolean editable) {
18780Sstevel@tonic-gate         ponameEditable = editable;
18790Sstevel@tonic-gate         Boolean b = new Boolean(editable);
18800Sstevel@tonic-gate         gui.PoName.set("editable" /* NOI18N */, b);
18810Sstevel@tonic-gate     }
18820Sstevel@tonic-gate 
18830Sstevel@tonic-gate     /**
18840Sstevel@tonic-gate      * React to a change in the policy list pattern
18850Sstevel@tonic-gate      *
18860Sstevel@tonic-gate      */
18870Sstevel@tonic-gate     public void poPatternComplete() {
18880Sstevel@tonic-gate         curPoListPos = 0;
18890Sstevel@tonic-gate         String pattern = (String)gui.PoListPattern.get("text" /* NOI18N */);
18900Sstevel@tonic-gate         if (!noLists)
18910Sstevel@tonic-gate             showPolicyList(pattern);
18920Sstevel@tonic-gate         else
18930Sstevel@tonic-gate             setCurPolicy(pattern);
18940Sstevel@tonic-gate     }
18950Sstevel@tonic-gate 
18960Sstevel@tonic-gate     /**
18970Sstevel@tonic-gate      * Clear policy list pattern
18980Sstevel@tonic-gate      *
18990Sstevel@tonic-gate      */
19000Sstevel@tonic-gate     public void poPatternClear() {
19010Sstevel@tonic-gate         if (noLists) {
19020Sstevel@tonic-gate             gui.PoListPattern.set("text" /* NOI18N */, "");
19030Sstevel@tonic-gate             ((TextField)gui.PoListPattern.getBody()).requestFocus();
19040Sstevel@tonic-gate         } else {
19050Sstevel@tonic-gate             String tempName = CurPolicy;
19060Sstevel@tonic-gate             fillPolicyList("");
19070Sstevel@tonic-gate             selectPolicy(tempName);
19080Sstevel@tonic-gate         }
19090Sstevel@tonic-gate     }
19100Sstevel@tonic-gate 
19110Sstevel@tonic-gate     /**
19120Sstevel@tonic-gate      * Show the policy list after applying the filter passed in.
19130Sstevel@tonic-gate      */
19140Sstevel@tonic-gate     public void showPolicyList(String pattern) {
19150Sstevel@tonic-gate         pol = null; // we are not editing a policy
19160Sstevel@tonic-gate         fillPolicyList(pattern);
19170Sstevel@tonic-gate         ModeString = "";
19180Sstevel@tonic-gate         OpString = "";
19190Sstevel@tonic-gate         updateStatus();
19200Sstevel@tonic-gate         gui.cardpanel2.show("List" /* NOI18N */);
19210Sstevel@tonic-gate         if (noLists)
19220Sstevel@tonic-gate             ((TextField)gui.PoListPattern.getBody()).requestFocus();
19230Sstevel@tonic-gate     }
19240Sstevel@tonic-gate 
19250Sstevel@tonic-gate     /**
19260Sstevel@tonic-gate      * Generate the policy list for the first time or after a pattern
19270Sstevel@tonic-gate      * has been chosen.
19280Sstevel@tonic-gate      *
19290Sstevel@tonic-gate      */
19300Sstevel@tonic-gate     public void fillPolicyList(String pattern) {
19310Sstevel@tonic-gate         if (noLists) {
19320Sstevel@tonic-gate             setCurPolicy((String)gui.PoListPattern.get("text" /* NOI18N */));
19330Sstevel@tonic-gate             ((TextField)gui.PoListPattern.getBody()).requestFocus();
19340Sstevel@tonic-gate             disablePolicyPrinting();
19350Sstevel@tonic-gate             return;
19360Sstevel@tonic-gate         }
19370Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
19380Sstevel@tonic-gate         long cachetime = A_LONG_TIME;
19390Sstevel@tonic-gate         if (!defaults.getStaticLists())
19400Sstevel@tonic-gate             cachetime = defaults.getCacheTime() * 1000;
19410Sstevel@tonic-gate         if (policyList != null
19420Sstevel@tonic-gate 	    && ((new Date()).getTime() - policyListDate.getTime())
19430Sstevel@tonic-gate 	    <= cachetime) {
19440Sstevel@tonic-gate             if (pattern.compareTo(curPoPattern) != 0)
19450Sstevel@tonic-gate                 newPoPattern(pattern);
19460Sstevel@tonic-gate             realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
19470Sstevel@tonic-gate             selectPolicy(curPoListPos);
19480Sstevel@tonic-gate             return;
19490Sstevel@tonic-gate         }
19500Sstevel@tonic-gate         PolicyList p = new PolicyList(Kadmin);
19510Sstevel@tonic-gate         gui.StatusLine.set("text" /* NOI18N */,
19520Sstevel@tonic-gate 			   getString("Loading policy list"));
19530Sstevel@tonic-gate         try {
19540Sstevel@tonic-gate             policyList = p.getPolicyList();
19550Sstevel@tonic-gate             policyListDate = new Date();
19560Sstevel@tonic-gate         } catch (Exception e) {
19570Sstevel@tonic-gate             realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
19580Sstevel@tonic-gate             showError(e.getMessage());
19590Sstevel@tonic-gate             updateStatus();
19600Sstevel@tonic-gate             return;
19610Sstevel@tonic-gate         }
19620Sstevel@tonic-gate         updateStatus();
19630Sstevel@tonic-gate         newPoPattern(pattern);
19640Sstevel@tonic-gate         selectPolicy(curPoListPos);
19650Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
19660Sstevel@tonic-gate     }
19670Sstevel@tonic-gate 
19680Sstevel@tonic-gate     private void newPoPattern(String pattern) {
19690Sstevel@tonic-gate         curPoPattern = pattern;
19700Sstevel@tonic-gate         gui.PoListPattern.set("text" /* NOI18N */, pattern);
19710Sstevel@tonic-gate         refreshPolicyList();
19720Sstevel@tonic-gate     }
19730Sstevel@tonic-gate 
19740Sstevel@tonic-gate     private void refreshPolicyList() {
19750Sstevel@tonic-gate         if (noLists)
19760Sstevel@tonic-gate             return;
19770Sstevel@tonic-gate         Filter f = new Filter(policyList, curPoPattern);
19780Sstevel@tonic-gate         gui.Pollist.set("items" /* NOI18N */, f.out);
19790Sstevel@tonic-gate     }
19800Sstevel@tonic-gate 
19810Sstevel@tonic-gate     private void selectPolicy(int pos) {
19820Sstevel@tonic-gate         TextList list = (TextList)gui.Pollist.getBody();
19830Sstevel@tonic-gate         if (list.countItems() == 0) {
19840Sstevel@tonic-gate             setCurPolicy("");
19850Sstevel@tonic-gate             return;
19860Sstevel@tonic-gate         }
19870Sstevel@tonic-gate 
19880Sstevel@tonic-gate         if (pos < 0)
19890Sstevel@tonic-gate             pos = 0;
19900Sstevel@tonic-gate         else if (pos >= list.countItems())
19910Sstevel@tonic-gate             pos = list.countItems() - 1;
19920Sstevel@tonic-gate 
19930Sstevel@tonic-gate         list.select(pos);
19940Sstevel@tonic-gate         enablePolicyPrinting();
19950Sstevel@tonic-gate         list.makeVisible(pos);
19960Sstevel@tonic-gate         setCurPolicy(list.getItem(pos));
19970Sstevel@tonic-gate     }
19980Sstevel@tonic-gate 
19990Sstevel@tonic-gate     private void selectPolicy(String name) {
20000Sstevel@tonic-gate         String[] list = getItemsFromTextList((TextList)gui.Pollist.getBody());
20010Sstevel@tonic-gate         selectPolicy(search(list, name));
20020Sstevel@tonic-gate     }
20030Sstevel@tonic-gate 
20040Sstevel@tonic-gate     /**
20050Sstevel@tonic-gate      * When the policy name choice changes, we want to reflect
20060Sstevel@tonic-gate      * the name in the policy detail tab.
20070Sstevel@tonic-gate      *
20080Sstevel@tonic-gate      */
20090Sstevel@tonic-gate     public void setCurPolicy(String name) {
20100Sstevel@tonic-gate         CurPolicy = name;
20110Sstevel@tonic-gate         gui.PoName.set("text" /* NOI18N */, CurPolicy);
20120Sstevel@tonic-gate         if (name.compareTo("") == 0) {
20130Sstevel@tonic-gate             poSelValid(false);
20140Sstevel@tonic-gate             return;
20150Sstevel@tonic-gate         }
20160Sstevel@tonic-gate         poSelValid(true);
20170Sstevel@tonic-gate     }
20180Sstevel@tonic-gate 
20190Sstevel@tonic-gate     /**
20200Sstevel@tonic-gate      * Look at the policy list to see what's selected
20210Sstevel@tonic-gate      *
20220Sstevel@tonic-gate      */
20230Sstevel@tonic-gate     public void lookAtPoList() {
20240Sstevel@tonic-gate         if (noLists)
20250Sstevel@tonic-gate             return;
20260Sstevel@tonic-gate         TextList list = (TextList) gui.Pollist.getBody();
20270Sstevel@tonic-gate         poMulti = null;
20280Sstevel@tonic-gate         String[] sel = list.getSelectedItems();
20290Sstevel@tonic-gate         if (sel.length == 1) {
20300Sstevel@tonic-gate             setCurPolicy(sel[0]);
20310Sstevel@tonic-gate             curPoListPos = list.getSelectedIndex();
20320Sstevel@tonic-gate         } else {
20330Sstevel@tonic-gate             if (sel.length > 0)
20340Sstevel@tonic-gate                 poMulti = sel;
20350Sstevel@tonic-gate             setCurPolicy("");
20360Sstevel@tonic-gate         }
20370Sstevel@tonic-gate     }
20380Sstevel@tonic-gate 
20390Sstevel@tonic-gate     private void restorePoListSelection() {
20400Sstevel@tonic-gate         if (noLists)
20410Sstevel@tonic-gate             return;
20420Sstevel@tonic-gate         TextList list = (TextList) gui.Pollist.getBody();
20430Sstevel@tonic-gate         list.select(curPoListPos);
20440Sstevel@tonic-gate     }
20450Sstevel@tonic-gate 
20460Sstevel@tonic-gate     /**
20470Sstevel@tonic-gate      * Make Modify, Delete and Duplicate buttons react to what is selected.
20480Sstevel@tonic-gate      *
20490Sstevel@tonic-gate      */
20500Sstevel@tonic-gate     public void poSelValid(boolean selected) {
20510Sstevel@tonic-gate         poSelValid = selected;
20520Sstevel@tonic-gate         Boolean b = new Boolean(selected && (privs & PRIV_INQUIRE) != 0);
20530Sstevel@tonic-gate         gui.PoListModify.set("enabled" /* NOI18N */, b);
20540Sstevel@tonic-gate         int want = (PRIV_ADD | PRIV_INQUIRE);
20550Sstevel@tonic-gate         b = new Boolean(selected && (privs & want) == want);
20560Sstevel@tonic-gate         gui.PoListDuplicate.set("enabled" /* NOI18N */, b);
20570Sstevel@tonic-gate         b = new Boolean((selected || poMulti != null)
20580Sstevel@tonic-gate 			&&(privs & PRIV_DELETE) != 0);
20590Sstevel@tonic-gate         gui.PoListDelete.set("enabled" /* NOI18N */, b);
20600Sstevel@tonic-gate     }
20610Sstevel@tonic-gate 
20620Sstevel@tonic-gate     /**
20630Sstevel@tonic-gate      * Make the Save button do the right thing.
20640Sstevel@tonic-gate      *
20650Sstevel@tonic-gate      */
20660Sstevel@tonic-gate     public void poSetCanSave(boolean ok) {
20670Sstevel@tonic-gate         Boolean b = new Boolean(ok);
20680Sstevel@tonic-gate         gui.PoDetailSave.set("enabled"  /* NOI18N */, b);
20690Sstevel@tonic-gate     }
20700Sstevel@tonic-gate 
20710Sstevel@tonic-gate     /**
20720Sstevel@tonic-gate      * This is a way for the data modification actions to note that
20730Sstevel@tonic-gate      * the principal has edits outstanding.
20740Sstevel@tonic-gate      *
20750Sstevel@tonic-gate      */
20760Sstevel@tonic-gate     public void poSetNeedSave() {
20770Sstevel@tonic-gate         poNeedSave = true;
20780Sstevel@tonic-gate         poSetCanSave(true);
20790Sstevel@tonic-gate         SaveString = getString("- *CHANGES*");
20800Sstevel@tonic-gate         updateStatus();
20810Sstevel@tonic-gate     }
20820Sstevel@tonic-gate 
20830Sstevel@tonic-gate     public boolean poDoSave() {
20840Sstevel@tonic-gate 
20850Sstevel@tonic-gate         // before attempting to save make sure all text fields are in order
20860Sstevel@tonic-gate         if (poUpdateFromGui() == false)
20870Sstevel@tonic-gate             return false;
20880Sstevel@tonic-gate 
20890Sstevel@tonic-gate         boolean b = true;
20900Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
20910Sstevel@tonic-gate         try {
20920Sstevel@tonic-gate             b = pol.savePolicy();
20930Sstevel@tonic-gate         } catch (Exception e) {
20940Sstevel@tonic-gate             b = false;
20950Sstevel@tonic-gate             showError(e.getMessage());
20960Sstevel@tonic-gate         }
20970Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
20980Sstevel@tonic-gate         if (!b)
20990Sstevel@tonic-gate             return false;
21000Sstevel@tonic-gate         if (pol.isNew) {
21010Sstevel@tonic-gate             policyList = addToList(policyList, pol.PolicyName);
21020Sstevel@tonic-gate             refreshPolicyList();
21030Sstevel@tonic-gate             selectPolicy(pol.PolicyName);
21040Sstevel@tonic-gate             setPolicyChoice();
21050Sstevel@tonic-gate         }
21060Sstevel@tonic-gate         pol.isNew = false;
21070Sstevel@tonic-gate         poSetEditable(false);
21080Sstevel@tonic-gate         poSetCanSave(false);
21090Sstevel@tonic-gate         poNeedSave = false;
21100Sstevel@tonic-gate         SaveString = "";
21110Sstevel@tonic-gate         updateStatus();
21120Sstevel@tonic-gate         return true;
21130Sstevel@tonic-gate     }
21140Sstevel@tonic-gate 
21150Sstevel@tonic-gate     /**
21160Sstevel@tonic-gate      * React to a choice from the policy list via double-click or
21170Sstevel@tonic-gate      * single-click+Modify; we want to go to the next tab in each case.
21180Sstevel@tonic-gate      * If we don't have modify privileges, we need to simply show values.
21190Sstevel@tonic-gate      */
21200Sstevel@tonic-gate     public void poSelected() {
21210Sstevel@tonic-gate         enablePolicyPrinting();
21220Sstevel@tonic-gate         lookAtPoList();
21230Sstevel@tonic-gate         if (!poNeedSave) {
21240Sstevel@tonic-gate             poSetEditable(false);
21250Sstevel@tonic-gate             poSetCanSave(false);
21260Sstevel@tonic-gate         }
21270Sstevel@tonic-gate         if (noLists)
21280Sstevel@tonic-gate             CurPolicy = (String)gui.PoListPattern.get("text" /* NOI18N */);
21290Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
21300Sstevel@tonic-gate         enablePoAttributes(new Boolean((privs & (PRIV_ADD|PRIV_MODIFY)) != 0));
21310Sstevel@tonic-gate         try {
21320Sstevel@tonic-gate             pol = new Policy(Kadmin, CurPolicy);
21330Sstevel@tonic-gate         } catch (Exception e) {
21340Sstevel@tonic-gate             showError(e.getMessage());
21350Sstevel@tonic-gate             realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
21360Sstevel@tonic-gate             return;
21370Sstevel@tonic-gate         }
21380Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
21390Sstevel@tonic-gate         showPolicy(pol);
21400Sstevel@tonic-gate         ModeString = getString("Modify")+" ";
21410Sstevel@tonic-gate         OpString = getString("Policy");
21420Sstevel@tonic-gate         updateStatus();
21430Sstevel@tonic-gate         gui.cardpanel2.show("Details" /* NOI18N */);
21440Sstevel@tonic-gate     }
21450Sstevel@tonic-gate 
21460Sstevel@tonic-gate     /**
21470Sstevel@tonic-gate      * React to add policy button
21480Sstevel@tonic-gate      * If we got here, we need to enable attributes since we have privs.
21490Sstevel@tonic-gate      */
21500Sstevel@tonic-gate     public void poAdd() {
21510Sstevel@tonic-gate         enablePolicyPrinting();
21520Sstevel@tonic-gate         setCurPolicy("");
21530Sstevel@tonic-gate         poSelValid = true;
21540Sstevel@tonic-gate         poSetEditable(true);
21550Sstevel@tonic-gate         poSetNeedSave();
21560Sstevel@tonic-gate         enablePoAttributes(new Boolean(true));
21570Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
21580Sstevel@tonic-gate         try {
21590Sstevel@tonic-gate             pol = new Policy(Kadmin);
21600Sstevel@tonic-gate         } catch (Exception e) {
21610Sstevel@tonic-gate             showError(e.getMessage());
21620Sstevel@tonic-gate             realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
21630Sstevel@tonic-gate             return;
21640Sstevel@tonic-gate         }
21650Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
21660Sstevel@tonic-gate         showPolicy(pol);
21670Sstevel@tonic-gate         ModeString = getString("Create New")+" ";
21680Sstevel@tonic-gate         OpString = getString("Policy");
21690Sstevel@tonic-gate         updateStatus();
21700Sstevel@tonic-gate         gui.cardpanel2.show("Details" /* NOI18N */);
21710Sstevel@tonic-gate         ((TextField)gui.PoName.getBody()).requestFocus();
21720Sstevel@tonic-gate     }
21730Sstevel@tonic-gate 
21740Sstevel@tonic-gate     /**
21750Sstevel@tonic-gate      * React to duplicate policy button
21760Sstevel@tonic-gate      *
21770Sstevel@tonic-gate      */
21780Sstevel@tonic-gate     public void poDuplicate() {
21790Sstevel@tonic-gate         enablePolicyPrinting();
21800Sstevel@tonic-gate         if (noLists)
21810Sstevel@tonic-gate             CurPolicy = (String)gui.PoListPattern.get("text" /* NOI18N */);
21820Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
21830Sstevel@tonic-gate         try {
21840Sstevel@tonic-gate             pol = new Policy(Kadmin, CurPolicy);
21850Sstevel@tonic-gate         } catch (Exception e) {
21860Sstevel@tonic-gate             showError(e.getMessage());
21870Sstevel@tonic-gate             realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
21880Sstevel@tonic-gate             return;
21890Sstevel@tonic-gate         }
21900Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
21910Sstevel@tonic-gate         setCurPolicy("");
21920Sstevel@tonic-gate         poSelValid = true;
21930Sstevel@tonic-gate         poSetEditable(true);
21940Sstevel@tonic-gate         poSetNeedSave();
21950Sstevel@tonic-gate         try {
21960Sstevel@tonic-gate             pol = new Policy(Kadmin, pol);
21970Sstevel@tonic-gate         } catch (Exception e) {
21980Sstevel@tonic-gate             showError(e.getMessage());
21990Sstevel@tonic-gate             return;
22000Sstevel@tonic-gate         }
22010Sstevel@tonic-gate         pol.PolicyName = "";
22020Sstevel@tonic-gate         showPolicy(pol);
22030Sstevel@tonic-gate         ModeString = getString("Duplicate")+" ";
22040Sstevel@tonic-gate         OpString = getString("Policy");
22050Sstevel@tonic-gate         updateStatus();
22060Sstevel@tonic-gate         gui.cardpanel2.show("Details" /* NOI18N */);
22070Sstevel@tonic-gate         ((TextField)gui.PoName.getBody()).requestFocus();
22080Sstevel@tonic-gate     }
22090Sstevel@tonic-gate 
22100Sstevel@tonic-gate     /**
22110Sstevel@tonic-gate      * React to delete policy button
22120Sstevel@tonic-gate      */
22130Sstevel@tonic-gate     public void poDelete() {
22140Sstevel@tonic-gate         String text[] = {getString("You are about to destroy data."),
22150Sstevel@tonic-gate 			 getString("Click OK to proceed or"
22160Sstevel@tonic-gate 				   +" Cancel to continue editing.")};
22170Sstevel@tonic-gate         String resp = confirmAction(realMainFrame, text);
22180Sstevel@tonic-gate         if (resp.equals(getString("Cancel")))
22190Sstevel@tonic-gate             return;
22200Sstevel@tonic-gate         boolean b;
22210Sstevel@tonic-gate         if (noLists)
22220Sstevel@tonic-gate             CurPolicy = (String)gui.PoListPattern.get("text" /* NOI18N */);
22230Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
22240Sstevel@tonic-gate         try {
22250Sstevel@tonic-gate             b = Kadmin.deletePolicy(CurPolicy);
22260Sstevel@tonic-gate         } catch (Exception e) {
22270Sstevel@tonic-gate             showError(e.getMessage());
22280Sstevel@tonic-gate             realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
22290Sstevel@tonic-gate             return;
22300Sstevel@tonic-gate         }
22310Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
22320Sstevel@tonic-gate         if (!b)
22330Sstevel@tonic-gate             return;
22340Sstevel@tonic-gate         policyList = delFromList(policyList, CurPolicy);
22350Sstevel@tonic-gate         refreshPolicyList();
22360Sstevel@tonic-gate         setPolicyChoice();
22370Sstevel@tonic-gate         setCurPolicy("");
22380Sstevel@tonic-gate         poSelValid = true;
22390Sstevel@tonic-gate         poSetEditable(true);
22400Sstevel@tonic-gate         if (curPoListPos == ((TextList)gui.Pollist.getBody()).countItems())
22410Sstevel@tonic-gate             curPoListPos--;
22420Sstevel@tonic-gate         showPolicyList(curPoPattern);
22430Sstevel@tonic-gate     }
22440Sstevel@tonic-gate 
22450Sstevel@tonic-gate     /**
22460Sstevel@tonic-gate      * React to save policy button
22470Sstevel@tonic-gate      *
22480Sstevel@tonic-gate      */
22490Sstevel@tonic-gate     public void poSave() {
22500Sstevel@tonic-gate         poDoSave();
22510Sstevel@tonic-gate     }
22520Sstevel@tonic-gate 
22530Sstevel@tonic-gate     /**
22540Sstevel@tonic-gate      * React to cancel policy button
22550Sstevel@tonic-gate      *
22560Sstevel@tonic-gate      */
22570Sstevel@tonic-gate     public void poCancel() {
22580Sstevel@tonic-gate         if (poNeedSave) {
22590Sstevel@tonic-gate             String text[] = {getString("You are about to lose changes."),
22600Sstevel@tonic-gate 			     getString("Click Save to commit changes, "
22610Sstevel@tonic-gate 				       +"Discard to discard changes, "
22620Sstevel@tonic-gate 				       +"or Cancel to continue editing.")};
22630Sstevel@tonic-gate             String resp = confirmSave(realMainFrame, text);
22640Sstevel@tonic-gate             if (resp.equals(getString("Cancel")))
22650Sstevel@tonic-gate                 return;
22660Sstevel@tonic-gate             if (resp.equals(getString("Save")))
22670Sstevel@tonic-gate                 if (!poDoSave())
22680Sstevel@tonic-gate 		    return;
22690Sstevel@tonic-gate         }
22700Sstevel@tonic-gate         poSetEditable(false);
22710Sstevel@tonic-gate         poSetCanSave(false);
22720Sstevel@tonic-gate         poNeedSave = false;
22730Sstevel@tonic-gate         lookAtPoList();
22740Sstevel@tonic-gate         SaveString = "";
22750Sstevel@tonic-gate         showPolicyList(curPoPattern);
22760Sstevel@tonic-gate     }
22770Sstevel@tonic-gate 
22780Sstevel@tonic-gate     /**
22790Sstevel@tonic-gate      * React to previous button on policy detail screen
22800Sstevel@tonic-gate      *
22810Sstevel@tonic-gate      */
22820Sstevel@tonic-gate     public void polPrevious() {
22830Sstevel@tonic-gate         poCancel();
22840Sstevel@tonic-gate     }
22850Sstevel@tonic-gate 
22860Sstevel@tonic-gate     /**
22870Sstevel@tonic-gate      * React to done button on policy detail screen
22880Sstevel@tonic-gate      *
22890Sstevel@tonic-gate      */
22900Sstevel@tonic-gate     public void polDone() {
22910Sstevel@tonic-gate         if (poNeedSave && poDoSave() == false)
22920Sstevel@tonic-gate             return;
22930Sstevel@tonic-gate         showPolicyList(curPoPattern);
22940Sstevel@tonic-gate     }
22950Sstevel@tonic-gate 
22960Sstevel@tonic-gate     /*
22970Sstevel@tonic-gate      * Methods for the policy details panel
22980Sstevel@tonic-gate      */
22990Sstevel@tonic-gate 
23000Sstevel@tonic-gate     public boolean setPolName() {
23010Sstevel@tonic-gate         if (!ponameEditable)
23020Sstevel@tonic-gate             return true;
23030Sstevel@tonic-gate 
23040Sstevel@tonic-gate         String p = (String)gui.PoName.get("text" /* NOI18N */);
23050Sstevel@tonic-gate         if (p.compareTo(getString("(no policy)")) == 0) {
23060Sstevel@tonic-gate             showError(getString("Policy name already exists. Please choose "
23070Sstevel@tonic-gate 				+"a different policy name or cancel"));
23080Sstevel@tonic-gate             gui.PoName.set("text" /* NOI18N */, "");
23090Sstevel@tonic-gate             ((TextField)gui.PoName.getBody()).requestFocus();
23100Sstevel@tonic-gate             return false;
23110Sstevel@tonic-gate         }
23120Sstevel@tonic-gate         if (p.compareTo("") == 0) {
23130Sstevel@tonic-gate             showError(getString("Please enter a policy name or cancel"));
23140Sstevel@tonic-gate             ((TextField)gui.PoName.getBody()).requestFocus();
23150Sstevel@tonic-gate             return false;
23160Sstevel@tonic-gate         }
23170Sstevel@tonic-gate 
23180Sstevel@tonic-gate         setCurPolicy(p);
23190Sstevel@tonic-gate         pol.setName(p);
23200Sstevel@tonic-gate         return true;
23210Sstevel@tonic-gate     }
23220Sstevel@tonic-gate 
23230Sstevel@tonic-gate     public void setPolPwLength() {
23240Sstevel@tonic-gate         if (pol == null)
23250Sstevel@tonic-gate                 return;
23260Sstevel@tonic-gate         try {
23270Sstevel@tonic-gate             pol.setPolPwLength((String)gui.PoMinPwLength.get("selectedItem"
23280Sstevel@tonic-gate 							 /* NOI18N */));
23290Sstevel@tonic-gate         } catch (Exception e) {};
23300Sstevel@tonic-gate     }
23310Sstevel@tonic-gate 
23320Sstevel@tonic-gate     public void setPolPwClasses() {
23330Sstevel@tonic-gate         if (pol == null)
23340Sstevel@tonic-gate                 return;
23350Sstevel@tonic-gate         try {
23360Sstevel@tonic-gate             pol.setPolPwClasses((String)gui.PoMinPwClass.get("selectedItem"
23370Sstevel@tonic-gate 							 /* NOI18N */));
23380Sstevel@tonic-gate         } catch (Exception e) {};
23390Sstevel@tonic-gate     }
23400Sstevel@tonic-gate 
23410Sstevel@tonic-gate     public void setPolPwHistory() {
23420Sstevel@tonic-gate         if (pol == null)
23430Sstevel@tonic-gate                 return;
23440Sstevel@tonic-gate         try {
23450Sstevel@tonic-gate             pol.setPolPwHistory((String)gui.PoSavedPasswords.get("selectedItem"
23460Sstevel@tonic-gate 							     /* NOI18N */));
23470Sstevel@tonic-gate         } catch (Exception e) {};
23480Sstevel@tonic-gate     }
23490Sstevel@tonic-gate 
23500Sstevel@tonic-gate     public boolean setPolMinlife() {
23510Sstevel@tonic-gate         if (pol.setPolMinlife((String)gui.PoMinTicketLifetime.get("text"
23520Sstevel@tonic-gate 							  /* NOI18N */))) {
23530Sstevel@tonic-gate             // visually delete any extraneous data that was ignored in the
23540Sstevel@tonic-gate             // parsing by resetting the gui data
23550Sstevel@tonic-gate             gui.PoMinTicketLifetime.set("text" /* NOI18N */,
23560Sstevel@tonic-gate 					showDuration(pol.PwMinLife));
23570Sstevel@tonic-gate             return true;
23580Sstevel@tonic-gate         } else {
23590Sstevel@tonic-gate             showDataFormatError(((TextField)gui.PoMinTicketLifetime.getBody()),
23600Sstevel@tonic-gate 				DURATION_DATA);
23610Sstevel@tonic-gate             return false;
23620Sstevel@tonic-gate         }
23630Sstevel@tonic-gate     }
23640Sstevel@tonic-gate 
23650Sstevel@tonic-gate     public boolean setPolMaxlife() {
23660Sstevel@tonic-gate         if (pol.setPolMaxlife((String)gui.PoMaxTicketLifetime.get(
23670Sstevel@tonic-gate 						  "text" /* NOI18N */))) {
23680Sstevel@tonic-gate             // visually delete any extraneous data that was ignored in the
23690Sstevel@tonic-gate             // parsing by resetting the gui data
23700Sstevel@tonic-gate             gui.PoMaxTicketLifetime.set("text" /* NOI18N */,
23710Sstevel@tonic-gate 					showDuration(pol.PwMaxLife));
23720Sstevel@tonic-gate             return true;
23730Sstevel@tonic-gate         } else {
23740Sstevel@tonic-gate             showDataFormatError(((TextField)gui.PoMaxTicketLifetime.getBody()),
23750Sstevel@tonic-gate 				DURATION_DATA);
23760Sstevel@tonic-gate             return false;
23770Sstevel@tonic-gate         }
23780Sstevel@tonic-gate     }
23790Sstevel@tonic-gate 
23800Sstevel@tonic-gate     /**
23810Sstevel@tonic-gate      * Update components to reflect data in this policy
23820Sstevel@tonic-gate      *
23830Sstevel@tonic-gate      */
23840Sstevel@tonic-gate     public void showPolicy(Policy p) {
23850Sstevel@tonic-gate         gui.PoName.set("text" /* NOI18N */, p.PolicyName);
23860Sstevel@tonic-gate         gui.PoMinPwLength.set("selectedItem" /* NOI18N */,
23870Sstevel@tonic-gate 			      nf.format(p.PwMinLength));
23880Sstevel@tonic-gate         gui.PoMinPwClass.set("selectedItem" /* NOI18N */,
23890Sstevel@tonic-gate 			     nf.format(p.PwMinClasses));
23900Sstevel@tonic-gate         gui.PoSavedPasswords.set("selectedItem" /* NOI18N */,
23910Sstevel@tonic-gate 				 nf.format(p.PwSaveCount));
23920Sstevel@tonic-gate         gui.PoMinTicketLifetime.set("text" /* NOI18N */,
23930Sstevel@tonic-gate 				    showDuration(p.PwMinLife));
23940Sstevel@tonic-gate         gui.PoMaxTicketLifetime.set("text" /* NOI18N */,
23950Sstevel@tonic-gate 				    showDuration(p.PwMaxLife));
23960Sstevel@tonic-gate         gui.PoReferences.set("text" /* NOI18N */, nf.format(p.RefCount));
23970Sstevel@tonic-gate     }
23980Sstevel@tonic-gate 
23990Sstevel@tonic-gate     /*
24000Sstevel@tonic-gate      * Methods for defaults tab
24010Sstevel@tonic-gate      */
24020Sstevel@tonic-gate 
24030Sstevel@tonic-gate     /**
24040Sstevel@tonic-gate      * React to save button
24050Sstevel@tonic-gate      *
24060Sstevel@tonic-gate      */
24070Sstevel@tonic-gate     public void glSave() {
24080Sstevel@tonic-gate         if (defaults.updateFromGui()) {
24090Sstevel@tonic-gate             glDoSave(true);
24100Sstevel@tonic-gate             glUpdate();
24110Sstevel@tonic-gate         }
24120Sstevel@tonic-gate     }
24130Sstevel@tonic-gate 
24140Sstevel@tonic-gate     /**
24150Sstevel@tonic-gate      * React to apply button
24160Sstevel@tonic-gate      *
24170Sstevel@tonic-gate      */
24180Sstevel@tonic-gate     public void glApply() {
24190Sstevel@tonic-gate         if (defaults.updateFromGui()) {
24200Sstevel@tonic-gate             glDoSave(false);
24210Sstevel@tonic-gate             glUpdate();
24220Sstevel@tonic-gate         }
24230Sstevel@tonic-gate     }
24240Sstevel@tonic-gate 
24250Sstevel@tonic-gate     /**
24260Sstevel@tonic-gate      * React to cancel button
24270Sstevel@tonic-gate      *
24280Sstevel@tonic-gate      */
24290Sstevel@tonic-gate     public void glCancel() {
24300Sstevel@tonic-gate         if (glNeedSave) {
24310Sstevel@tonic-gate             String text[] = {getString("You are about to lose changes."),
24320Sstevel@tonic-gate 			     getString("Click Save to commit changes, "
24330Sstevel@tonic-gate 				       +"Discard to discard changes, "
24340Sstevel@tonic-gate 				       +"or Cancel to continue editing.")};
24350Sstevel@tonic-gate             String resp = confirmSave(defaultsEditingFrame, text);
24360Sstevel@tonic-gate             if (resp.equals(getString("Cancel")))
24370Sstevel@tonic-gate                 return;
24380Sstevel@tonic-gate             if (resp.equals(getString("Discard")))
24390Sstevel@tonic-gate                 defaults.restoreValues(olddefaults);
24400Sstevel@tonic-gate             if (resp.equals(getString("Save"))) {
24410Sstevel@tonic-gate                 glDoSave(true);
24420Sstevel@tonic-gate                 glUpdate();
24430Sstevel@tonic-gate                 return;
24440Sstevel@tonic-gate             }
24450Sstevel@tonic-gate         }
24460Sstevel@tonic-gate         glDoSave(false);
24470Sstevel@tonic-gate     }
24480Sstevel@tonic-gate 
24490Sstevel@tonic-gate     public void glDoSave(boolean save) {
24500Sstevel@tonic-gate         defaults.close(save);
24510Sstevel@tonic-gate         glSetCanSave(false);
24520Sstevel@tonic-gate         glNeedSave = false;
24530Sstevel@tonic-gate         SaveString = "";
24540Sstevel@tonic-gate         updateStatus();
24550Sstevel@tonic-gate     }
24560Sstevel@tonic-gate 
24570Sstevel@tonic-gate     public void glUpdate() {
24580Sstevel@tonic-gate         noLists = ((privs & PRIV_LIST) == 0 || !defaults.getShowLists());
24590Sstevel@tonic-gate         fixHelpTags();
24600Sstevel@tonic-gate         fixListPanels();
24610Sstevel@tonic-gate         // Load principal list if we are in the principal tab and are not
24620Sstevel@tonic-gate         // editing a principal
24630Sstevel@tonic-gate         if (gui.tabbedfolder1.get("currentCard" /* NO18N */) ==
24640Sstevel@tonic-gate 	    getString("Principals") && prin == null)
24650Sstevel@tonic-gate 	    fillPrincipalList(curPrPattern);
24660Sstevel@tonic-gate         // Load policy list if we are in the policy tab and are not
24670Sstevel@tonic-gate         // editing a policy
24680Sstevel@tonic-gate         if (gui.tabbedfolder1.get("currentCard" /* NO18N */) ==
24690Sstevel@tonic-gate 	    getString("Policies") && pol == null)
24700Sstevel@tonic-gate 	    fillPolicyList(curPoPattern);
24710Sstevel@tonic-gate     }
24720Sstevel@tonic-gate 
24730Sstevel@tonic-gate     /**
24740Sstevel@tonic-gate      * This is a way for the data modification actions to note that
24750Sstevel@tonic-gate      * the principal has edits outstanding.
24760Sstevel@tonic-gate      *
24770Sstevel@tonic-gate      */
24780Sstevel@tonic-gate     public void glSetNeedSave() {
24790Sstevel@tonic-gate         glNeedSave = true;
24800Sstevel@tonic-gate         glSetCanSave(true);
24810Sstevel@tonic-gate     }
24820Sstevel@tonic-gate 
24830Sstevel@tonic-gate     /**
24840Sstevel@tonic-gate      * Make the Save button do the right thing.
24850Sstevel@tonic-gate      *
24860Sstevel@tonic-gate      */
24870Sstevel@tonic-gate     public void glSetCanSave(boolean ok) {
24880Sstevel@tonic-gate         defaults.saveButton.setEnabled(ok);
24890Sstevel@tonic-gate         defaults.applyButton.setEnabled(ok);
24900Sstevel@tonic-gate     }
24910Sstevel@tonic-gate 
24920Sstevel@tonic-gate     public boolean setGlobalMaxrenew() {
24930Sstevel@tonic-gate         boolean done = defaults.setMaxTicketRenewableLife();
24940Sstevel@tonic-gate         glSetNeedSave();
24950Sstevel@tonic-gate         return done;
24960Sstevel@tonic-gate     }
24970Sstevel@tonic-gate 
24980Sstevel@tonic-gate     public boolean setGlobalMaxlife() {
24990Sstevel@tonic-gate         boolean done = defaults.setMaxTicketLife();
25000Sstevel@tonic-gate         glSetNeedSave();
25010Sstevel@tonic-gate         return done;
25020Sstevel@tonic-gate     }
25030Sstevel@tonic-gate 
25040Sstevel@tonic-gate     public boolean setGlobalExpiry() {
25050Sstevel@tonic-gate         boolean done = defaults.setAccountExpiryDate();
25060Sstevel@tonic-gate         glSetNeedSave();
25070Sstevel@tonic-gate         return done;
25080Sstevel@tonic-gate     }
25090Sstevel@tonic-gate 
25100Sstevel@tonic-gate     public boolean setServerSide() {
25110Sstevel@tonic-gate         boolean done = defaults.setServerSide();
25120Sstevel@tonic-gate         glSetNeedSave();
25130Sstevel@tonic-gate         return done;
25140Sstevel@tonic-gate     }
25150Sstevel@tonic-gate 
25160Sstevel@tonic-gate     public boolean setShowLists() {
25170Sstevel@tonic-gate         boolean done = defaults.setShowLists();
25180Sstevel@tonic-gate         glSetNeedSave();
25190Sstevel@tonic-gate         return done;
25200Sstevel@tonic-gate     }
25210Sstevel@tonic-gate 
25220Sstevel@tonic-gate     public boolean setStaticLists() {
25230Sstevel@tonic-gate         boolean done = defaults.setStaticLists();
25240Sstevel@tonic-gate         glSetNeedSave();
25250Sstevel@tonic-gate         return done;
25260Sstevel@tonic-gate     }
25270Sstevel@tonic-gate 
25280Sstevel@tonic-gate     public boolean setCacheTime() {
25290Sstevel@tonic-gate         boolean done = defaults.setCacheTime();
25300Sstevel@tonic-gate         glSetNeedSave();
25310Sstevel@tonic-gate         return done;
25320Sstevel@tonic-gate     }
25330Sstevel@tonic-gate 
25340Sstevel@tonic-gate     public void setGlobalFlag(int bitfield) {
25350Sstevel@tonic-gate         defaults.toggleFlag(bitfield);
25360Sstevel@tonic-gate         glSetNeedSave();
25370Sstevel@tonic-gate     }
25380Sstevel@tonic-gate 
25390Sstevel@tonic-gate     /*
25400Sstevel@tonic-gate      * Miscellany
25410Sstevel@tonic-gate      */
25420Sstevel@tonic-gate     public void printPrList() {
25430Sstevel@tonic-gate         String title = getString("Principal List");
25440Sstevel@tonic-gate         if (curPrPattern.length() > 0)
25450Sstevel@tonic-gate             title = title.concat(" (" + getString("Filter Pattern:") + " "
25460Sstevel@tonic-gate 				 + curPrPattern + ")");
25470Sstevel@tonic-gate         if (principalList == null)
25480Sstevel@tonic-gate             fillPrincipalList(curPrPattern);
25490Sstevel@tonic-gate         printList((TextList)gui.Prlist.getBody(), title);
25500Sstevel@tonic-gate     }
25510Sstevel@tonic-gate 
25520Sstevel@tonic-gate     public void printCurPr() {
25530Sstevel@tonic-gate         Principal toPrint;
25540Sstevel@tonic-gate 
25550Sstevel@tonic-gate         if (prin == null) {
25560Sstevel@tonic-gate             // We are viewing the principal list. Instantiate a new
25570Sstevel@tonic-gate             // principal using the current name.
25580Sstevel@tonic-gate             toPrint =  new Principal(Kadmin, CurPrincipal);
25590Sstevel@tonic-gate         } else {
25600Sstevel@tonic-gate             // We are in the middle of editing a principal. Update the
25610Sstevel@tonic-gate             // current principal object with the current contents of the
25620Sstevel@tonic-gate             // gui. It's ok for the password to be null, we are not printing
25630Sstevel@tonic-gate             // it anyway.
25640Sstevel@tonic-gate             if (!prUpdateFromGui(true))
25650Sstevel@tonic-gate                 return;
25660Sstevel@tonic-gate             toPrint = prin;
25670Sstevel@tonic-gate         }
25680Sstevel@tonic-gate 
25690Sstevel@tonic-gate         PrintUtil.dump(realMainFrame, toPrint);
25700Sstevel@tonic-gate     }
25710Sstevel@tonic-gate 
25720Sstevel@tonic-gate     public void printPoList() {
25730Sstevel@tonic-gate         String title = getString("Policy List");
25740Sstevel@tonic-gate         if (curPoPattern.length() > 0)
25750Sstevel@tonic-gate             title = title.concat(" (" + getString("Filter Pattern:") + " "
25760Sstevel@tonic-gate 				 + curPoPattern + ")");
25770Sstevel@tonic-gate         if (policyList == null)
25780Sstevel@tonic-gate             fillPolicyList(curPoPattern);
25790Sstevel@tonic-gate         printList((TextList)gui.Pollist.getBody(), title);
25800Sstevel@tonic-gate     }
25810Sstevel@tonic-gate 
25820Sstevel@tonic-gate     public void printCurPol() {
25830Sstevel@tonic-gate         Policy toPrint;
25840Sstevel@tonic-gate 
25850Sstevel@tonic-gate         if (pol == null) {
25860Sstevel@tonic-gate             // We are viewing the policy list. Instantiate a new
25870Sstevel@tonic-gate             // policy using the current name.
25880Sstevel@tonic-gate             toPrint = new Policy(Kadmin, CurPolicy);
25890Sstevel@tonic-gate         } else {
25900Sstevel@tonic-gate             // We are in the middle of editing a policy. Update the current
25910Sstevel@tonic-gate             // policy object with the current contents of the gui.
25920Sstevel@tonic-gate             if (!poUpdateFromGui())
25930Sstevel@tonic-gate                 return;
25940Sstevel@tonic-gate             toPrint = pol;
25950Sstevel@tonic-gate         }
25960Sstevel@tonic-gate 
25970Sstevel@tonic-gate         PrintUtil.dump(realMainFrame, toPrint);
25980Sstevel@tonic-gate 
25990Sstevel@tonic-gate     }
26000Sstevel@tonic-gate 
26010Sstevel@tonic-gate     private void printList(TextList guiList, String title) {
26020Sstevel@tonic-gate         String[] list = getItemsFromTextList(guiList);
26030Sstevel@tonic-gate         StringBuffer sb = new StringBuffer(title).append('\n');
26040Sstevel@tonic-gate 
26050Sstevel@tonic-gate         for (int i = 0; i < list.length; i++) {
26060Sstevel@tonic-gate             sb.append(list[i]).append('\n');
26070Sstevel@tonic-gate         }
26080Sstevel@tonic-gate 
26090Sstevel@tonic-gate         PrintUtil.dump(realMainFrame, sb);
26100Sstevel@tonic-gate     }
26110Sstevel@tonic-gate 
26120Sstevel@tonic-gate     public void showHelpBrowser(Frame frame) {
26130Sstevel@tonic-gate         try {
26140Sstevel@tonic-gate 
26150Sstevel@tonic-gate             File file = new File("/usr/dt/bin/sdtwebclient");
26160Sstevel@tonic-gate             if (!file.exists()) {
26170Sstevel@tonic-gate                 showDialog(frame, getString("Error"),
26180Sstevel@tonic-gate 			   getString("Can't run /usr/dt/bin/sdtwebclient."));
26190Sstevel@tonic-gate                 return;
26200Sstevel@tonic-gate             }
26210Sstevel@tonic-gate             String url = kc.getHelpURL();
26220Sstevel@tonic-gate             if (url == null)
26230Sstevel@tonic-gate                 url = helpIndexFile;
26240Sstevel@tonic-gate             URL help = new URL(url);
26250Sstevel@tonic-gate             InputStream is = null;
26260Sstevel@tonic-gate             try {
26270Sstevel@tonic-gate                 is = help.openStream();
26280Sstevel@tonic-gate             } catch (IOException e) {}
26290Sstevel@tonic-gate             if (is == null) {
26300Sstevel@tonic-gate                 showDialog(frame, getString("Error"),
26310Sstevel@tonic-gate 			   getString("Invalid URL: ")+url);
26320Sstevel@tonic-gate                 return;
26330Sstevel@tonic-gate             }
26340Sstevel@tonic-gate 
26350Sstevel@tonic-gate             if (browserProcess != null) {
26360Sstevel@tonic-gate                 // Will throw IllegalThreadStateException if thread not exited
26370Sstevel@tonic-gate                 // yet
26380Sstevel@tonic-gate                 int i = browserProcess.exitValue();
26390Sstevel@tonic-gate             }
26400Sstevel@tonic-gate 
26410Sstevel@tonic-gate             // Thread has exited or never existed
26420Sstevel@tonic-gate             browserProcess =
26430Sstevel@tonic-gate 		Runtime.getRuntime().exec("/usr/dt/bin/sdtwebclient" +url);
26440Sstevel@tonic-gate 
26450Sstevel@tonic-gate         } catch (IOException e) {
26460Sstevel@tonic-gate             showDialog(frame, getString("Error"), e.getMessage());
26470Sstevel@tonic-gate         } catch (IllegalThreadStateException e) {
26480Sstevel@tonic-gate             // Ok. All this mean is that a previous instance of the browser
26490Sstevel@tonic-gate             // exists
26500Sstevel@tonic-gate         }
26510Sstevel@tonic-gate     }
26520Sstevel@tonic-gate 
26530Sstevel@tonic-gate     private void killHelpBrowser() {
26540Sstevel@tonic-gate         if (browserProcess != null) {
26550Sstevel@tonic-gate             browserProcess.destroy();
26560Sstevel@tonic-gate         }
26570Sstevel@tonic-gate     }
26580Sstevel@tonic-gate 
26590Sstevel@tonic-gate     private void setupDefaultsEditingFrame() {
26600Sstevel@tonic-gate         defaultsEditingFrame = defaults.getEditingFrame();
26610Sstevel@tonic-gate         glSetCanSave(false);
26620Sstevel@tonic-gate         setupDefaultsNormalListeners();
26630Sstevel@tonic-gate         defaults.csHelp.addActionListener
26640Sstevel@tonic-gate 	    (new DefaultsContextSensitiveHelpListener());
26650Sstevel@tonic-gate     }
26660Sstevel@tonic-gate 
26670Sstevel@tonic-gate     public void editPreferences() {
26680Sstevel@tonic-gate         olddefaults = new Defaults(defaults);
26690Sstevel@tonic-gate         defaults.updateGuiComponents();
26700Sstevel@tonic-gate         defaultsEditingFrame.setVisible(true);
26710Sstevel@tonic-gate     }
26720Sstevel@tonic-gate 
26730Sstevel@tonic-gate     static Frame getFrame(Component c) {
26740Sstevel@tonic-gate         Frame frame = null;
26750Sstevel@tonic-gate 
26760Sstevel@tonic-gate         while ((c = c.getParent()) != null)
26770Sstevel@tonic-gate             if (c instanceof Frame)
26780Sstevel@tonic-gate 		frame = (Frame)c;
26790Sstevel@tonic-gate         return frame;
26800Sstevel@tonic-gate     }
26810Sstevel@tonic-gate 
26820Sstevel@tonic-gate     /**
26830Sstevel@tonic-gate      * General purpose dialog with title and a label settable
26840Sstevel@tonic-gate      */
26850Sstevel@tonic-gate     public void showDialog(Frame frame, String title, String text) {
26860Sstevel@tonic-gate         String[] lines = new String[1];
26870Sstevel@tonic-gate         lines[0] = text;
26880Sstevel@tonic-gate         String[] buttons = new String[1];
26890Sstevel@tonic-gate         buttons[0] = getString("OK");
26900Sstevel@tonic-gate         ChoiceDialog cd = new ChoiceDialog(frame, title, lines, buttons);
26910Sstevel@tonic-gate     }
26920Sstevel@tonic-gate 
26930Sstevel@tonic-gate     public void showLoginWarning(String err) {
26940Sstevel@tonic-gate         showDialog(realLoginFrame, getString("Warning"), err);
26950Sstevel@tonic-gate     }
26960Sstevel@tonic-gate 
26970Sstevel@tonic-gate     public void showLoginError(String err) {
26980Sstevel@tonic-gate         showDialog(realLoginFrame, getString("Error"), err);
26990Sstevel@tonic-gate     }
27000Sstevel@tonic-gate 
27010Sstevel@tonic-gate     public void showWarning(String err) {
27020Sstevel@tonic-gate         showDialog(realMainFrame, getString("Warning"), err);
27030Sstevel@tonic-gate     }
27040Sstevel@tonic-gate 
27050Sstevel@tonic-gate     public void showError(String err) {
27060Sstevel@tonic-gate         showDialog(realMainFrame, getString("Error"), err);
27070Sstevel@tonic-gate     }
27080Sstevel@tonic-gate 
27090Sstevel@tonic-gate     public static void showDataFormatError(TextField tf, int dataType) {
27100Sstevel@tonic-gate 
27110Sstevel@tonic-gate         Frame parent = getFrame(tf);
27120Sstevel@tonic-gate 
27130Sstevel@tonic-gate         tf.selectAll();
27140Sstevel@tonic-gate         toolkit.beep();
27150Sstevel@tonic-gate 
27160Sstevel@tonic-gate         String title = getString("Error");
27170Sstevel@tonic-gate 
27180Sstevel@tonic-gate         String[] lines = null;
27190Sstevel@tonic-gate         String[] buttons = {getString("OK")};
27200Sstevel@tonic-gate 
27210Sstevel@tonic-gate         switch (dataType) {
27220Sstevel@tonic-gate 	case DURATION_DATA:
27230Sstevel@tonic-gate             lines = durationErrorText;
27240Sstevel@tonic-gate             break;
27250Sstevel@tonic-gate 	case DATE_DATA:
27260Sstevel@tonic-gate             lines = dateErrorText;
27270Sstevel@tonic-gate             break;
27280Sstevel@tonic-gate 	case NUMBER_DATA:
27290Sstevel@tonic-gate             lines = numberErrorText;
27300Sstevel@tonic-gate             break;
27310Sstevel@tonic-gate         }
27320Sstevel@tonic-gate 
27330Sstevel@tonic-gate         Point p = tf.getLocationOnScreen();
27340Sstevel@tonic-gate         ChoiceDialog cd = new ChoiceDialog(parent, title, lines,
27350Sstevel@tonic-gate 					   buttons, p.x, p.y);
27360Sstevel@tonic-gate 
27370Sstevel@tonic-gate         tf.requestFocus();
27380Sstevel@tonic-gate 
27390Sstevel@tonic-gate     }
27400Sstevel@tonic-gate 
27410Sstevel@tonic-gate     /**
27420Sstevel@tonic-gate      * Confirm a destructive user action
27430Sstevel@tonic-gate      */
27440Sstevel@tonic-gate     public String confirmAction(Frame frame, String[] text) {
27450Sstevel@tonic-gate         String title = getString("Confirm Action");
27460Sstevel@tonic-gate         String[] buttons = new String[2];
27470Sstevel@tonic-gate         buttons[0] = getString("OK");
27480Sstevel@tonic-gate         buttons[1] = getString("Cancel");
27490Sstevel@tonic-gate         ChoiceDialog cd = new ChoiceDialog(frame, title, text, buttons);
27500Sstevel@tonic-gate         return (cd.getSelection() == null? getString("Cancel")
27510Sstevel@tonic-gate 		:cd.getSelection());
27520Sstevel@tonic-gate     }
27530Sstevel@tonic-gate 
27540Sstevel@tonic-gate     /**
27550Sstevel@tonic-gate      * Confirm a destructive user action, offering choice of saving
27560Sstevel@tonic-gate      */
27570Sstevel@tonic-gate     public String confirmSave(Frame frame, String[] text) {
27580Sstevel@tonic-gate         String title = getString("Confirm Action");
27590Sstevel@tonic-gate         String[] buttons = new String[3];
27600Sstevel@tonic-gate         buttons[0] = getString("Save");
27610Sstevel@tonic-gate         buttons[1] = getString("Discard");
27620Sstevel@tonic-gate         buttons[2] = getString("Cancel");
27630Sstevel@tonic-gate         ChoiceDialog cd = new ChoiceDialog(frame, title, text, buttons);
27640Sstevel@tonic-gate         return (cd.getSelection() == null? getString("Cancel")
27650Sstevel@tonic-gate 		: cd.getSelection());
27660Sstevel@tonic-gate     }
27670Sstevel@tonic-gate 
27680Sstevel@tonic-gate     /**
27690Sstevel@tonic-gate      * Show version info
27700Sstevel@tonic-gate      */
27710Sstevel@tonic-gate     public void doAbout(Frame frame) {
27720Sstevel@tonic-gate         String title = getString("About SEAM Adminstration Tool");
27730Sstevel@tonic-gate         String[] text = new String[7];
27740Sstevel@tonic-gate         text[0] = getString("Sun Enterprise Authentication"
27750Sstevel@tonic-gate 			    +" Mechanism Administration Tool");
27760Sstevel@tonic-gate         text[1] = System.getProperty("SEAM_VERS" /* NOI18N */);
2777*96Ssemery         text[2] = getString("Copyright 2005 Sun Microsystems, Inc.  "
2778*96Ssemery 				+"All rights reserved.");
2779*96Ssemery         text[3] = getString("Use is subject to license terms.");
27800Sstevel@tonic-gate         text[4] = System.getProperty("os.name" /* NOI18N */);
27810Sstevel@tonic-gate         text[5] = System.getProperty("os.arch" /* NOI18N */);
27820Sstevel@tonic-gate         text[6] = System.getProperty("os.version" /* NOI18N */);
27830Sstevel@tonic-gate         String[] button = new String[1];
27840Sstevel@tonic-gate         button[0] = getString("Dismiss");
27850Sstevel@tonic-gate         ChoiceDialog cd = new ChoiceDialog(frame, title, text, button);
27860Sstevel@tonic-gate     }
27870Sstevel@tonic-gate 
27880Sstevel@tonic-gate     private void getDateTimeFromDialogBox(TextField tf, Frame frame) {
27890Sstevel@tonic-gate         tf.select(0, 0);
27900Sstevel@tonic-gate         dateTimeDialog = new DateTimeDialog(frame, tf.getBackground(),
27910Sstevel@tonic-gate 					    tf.getForeground());
27920Sstevel@tonic-gate 
27930Sstevel@tonic-gate         if (!tf.getText().equalsIgnoreCase(neverString)) {
27940Sstevel@tonic-gate             try {
27950Sstevel@tonic-gate                 Date currVal = df.parse(tf.getText());
27960Sstevel@tonic-gate                 dateTimeDialog.setDate(currVal);
27970Sstevel@tonic-gate                 /*
27980Sstevel@tonic-gate                  * In case an exception occurs, let the dialog box be
27990Sstevel@tonic-gate                  * initialized to its default date (viz current time).
28000Sstevel@tonic-gate                  */
28010Sstevel@tonic-gate             } catch (ParseException e) {
28020Sstevel@tonic-gate             } catch (NullPointerException e) {
28030Sstevel@tonic-gate                 // gets thrown when parse string begins with text
28040Sstevel@tonic-gate                 // probable JDK bug
28050Sstevel@tonic-gate             }
28060Sstevel@tonic-gate             catch (StringIndexOutOfBoundsException e) {
28070Sstevel@tonic-gate                 // gets thrown when parse string contains only one number
28080Sstevel@tonic-gate                 // probable JDK bug
28090Sstevel@tonic-gate             }
28100Sstevel@tonic-gate         }
28110Sstevel@tonic-gate         dateTimeDialog.setVisible(true);
28120Sstevel@tonic-gate 
28130Sstevel@tonic-gate         // Modal dialog box so this is after dialog box disappers
28140Sstevel@tonic-gate         if (dateTimeDialog.isSaved()) {
28150Sstevel@tonic-gate             tf.setText(dateTimeDialog.toString());
28160Sstevel@tonic-gate             tf.dispatchEvent(new ActionEvent(tf, ActionEvent.ACTION_PERFORMED,
28170Sstevel@tonic-gate 				     "setFromDateTimeDialog" /* NOI18N */));
28180Sstevel@tonic-gate         }
28190Sstevel@tonic-gate     }
2820*96Ssemery 
28210Sstevel@tonic-gate     private void getDurationFromDialogBox(TextField tf, Frame frame) {
28220Sstevel@tonic-gate         tf.select(0, 0);
28230Sstevel@tonic-gate         durationHelper = new DurationHelper(frame, tf.getBackground(),
28240Sstevel@tonic-gate 					    tf.getForeground());
28250Sstevel@tonic-gate         durationHelper.setVisible(true);
28260Sstevel@tonic-gate 
28270Sstevel@tonic-gate         // Modal dialog box so this is after dialog box disappers
28280Sstevel@tonic-gate         if (durationHelper.isSaved()) {
28290Sstevel@tonic-gate             tf.setText(durationHelper.toString());
28300Sstevel@tonic-gate             tf.dispatchEvent(new ActionEvent(tf, ActionEvent.ACTION_PERFORMED,
28310Sstevel@tonic-gate 				     "setFromDurationHelper" /* NOI18N */));
28320Sstevel@tonic-gate         }
28330Sstevel@tonic-gate     }
2834*96Ssemery 
2835*96Ssemery     private void getEncListFromDialogBox(TextField tf, Frame frame) {
2836*96Ssemery 	tf.select(0, 0);
2837*96Ssemery 	encListDialog = new EncListDialog(frame, tf.getBackground(),
2838*96Ssemery 	    tf.getForeground(), Kadmin);
2839*96Ssemery 
2840*96Ssemery 	encListDialog.setEncTypes(tf.getText());
2841*96Ssemery 	encListDialog.setVisible(true);
2842*96Ssemery 
2843*96Ssemery 	// Modal dialog box so this is after dialog box disappers
2844*96Ssemery 	if (encListDialog.isSaved()) {
2845*96Ssemery 		String e = encListDialog.toString();
2846*96Ssemery 
2847*96Ssemery 		if (e.compareTo("") != 0) {
2848*96Ssemery 	    	    String p = (String)gui.PrPassword.get("text" /* NOI18N */);
2849*96Ssemery 
2850*96Ssemery 		    // In order to change the key encryption type(s) the admin
2851*96Ssemery 		    // will have to supply a password.
2852*96Ssemery 	    	    if (p.compareTo("") == 0) {
2853*96Ssemery 			showWarning(getString(
2854*96Ssemery 			"If changing the key encryption types then specify a" +
2855*96Ssemery 			" new password for the principal whose keys are" +
2856*96Ssemery 			" being changed"));
2857*96Ssemery 			((TextField)gui.PrPassword.getBody()).requestFocus();
2858*96Ssemery 	    	    }
2859*96Ssemery 		}
2860*96Ssemery 		tf.setText(e);
2861*96Ssemery 		tf.dispatchEvent(new ActionEvent(tf,
2862*96Ssemery 		    ActionEvent.ACTION_PERFORMED,
2863*96Ssemery 		    "setFromEncListDialog" /* NOI18N */));
2864*96Ssemery 	}
2865*96Ssemery     }
28660Sstevel@tonic-gate 
28670Sstevel@tonic-gate     /**
28680Sstevel@tonic-gate      * By going into context-sensitive help mode, normal listeners will
28690Sstevel@tonic-gate      * be removed and replaced with help listeners, so that help will
28700Sstevel@tonic-gate      * be shown for the object.
28710Sstevel@tonic-gate      *
28720Sstevel@tonic-gate      */
28730Sstevel@tonic-gate     public void contextHelp(Frame frame) {
28740Sstevel@tonic-gate 
28750Sstevel@tonic-gate         if (cHelp == null) {
28760Sstevel@tonic-gate             cHelp = new ContextHelp(frame, this);
28770Sstevel@tonic-gate             cHelp.setVisible(true);
28780Sstevel@tonic-gate         }
28790Sstevel@tonic-gate 
28800Sstevel@tonic-gate         if (frame == realLoginFrame)
28810Sstevel@tonic-gate             setupLoginHelpListeners();
28820Sstevel@tonic-gate         else if (frame == realMainFrame)
28830Sstevel@tonic-gate             setupMainHelpListeners();
28840Sstevel@tonic-gate         else if (frame == defaultsEditingFrame)
28850Sstevel@tonic-gate             setupDefaultsHelpListeners();
28860Sstevel@tonic-gate 
28870Sstevel@tonic-gate         frame.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
28880Sstevel@tonic-gate     }
28890Sstevel@tonic-gate 
28900Sstevel@tonic-gate 
28910Sstevel@tonic-gate     /**
28920Sstevel@tonic-gate      * Enables the print menu for printing principal related info.
28930Sstevel@tonic-gate      */
28940Sstevel@tonic-gate     private void enablePrincipalPrinting() {
28950Sstevel@tonic-gate         ((MenuItem)gui.PrintCurPr.getBody()).setEnabled(true);
28960Sstevel@tonic-gate     }
28970Sstevel@tonic-gate 
28980Sstevel@tonic-gate     /**
28990Sstevel@tonic-gate      * Enables the print menu for printing policy related info.
29000Sstevel@tonic-gate      */
29010Sstevel@tonic-gate     private void enablePolicyPrinting() {
29020Sstevel@tonic-gate         ((MenuItem)gui.PrintCurPol.getBody()).setEnabled(true);
29030Sstevel@tonic-gate     }
29040Sstevel@tonic-gate 
29050Sstevel@tonic-gate     /**
29060Sstevel@tonic-gate      * Disables the print menu for printing principal related info.
29070Sstevel@tonic-gate      */
29080Sstevel@tonic-gate     private void disablePrincipalPrinting() {
29090Sstevel@tonic-gate         ((MenuItem)gui.PrintCurPr.getBody()).setEnabled(false);
29100Sstevel@tonic-gate     }
29110Sstevel@tonic-gate 
29120Sstevel@tonic-gate     /**
29130Sstevel@tonic-gate      * Disables the print menu for printing policy related info.
29140Sstevel@tonic-gate      */
29150Sstevel@tonic-gate     private void disablePolicyPrinting() {
29160Sstevel@tonic-gate         ((MenuItem)gui.PrintCurPol.getBody()).setEnabled(false);
29170Sstevel@tonic-gate     }
29180Sstevel@tonic-gate 
29190Sstevel@tonic-gate     /**
29200Sstevel@tonic-gate      * Set up the listeners for the objects on the login screen in normal mode
29210Sstevel@tonic-gate      *
29220Sstevel@tonic-gate      */
29230Sstevel@tonic-gate     public void setupLoginNormalListeners() {
29240Sstevel@tonic-gate         if (LoginNormal == null) {
29250Sstevel@tonic-gate             LoginNormal = new Vector(10, 10);
29260Sstevel@tonic-gate             ActionListener al;
29270Sstevel@tonic-gate             Association a;
29280Sstevel@tonic-gate             Object o;
29290Sstevel@tonic-gate 
29300Sstevel@tonic-gate             al = new LoginNameAction();
29310Sstevel@tonic-gate             o = gui.LoginName.getBody();
29320Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
29330Sstevel@tonic-gate             LoginNormal.addElement(a);
29340Sstevel@tonic-gate 
29350Sstevel@tonic-gate             al = new LoginPassAction();
29360Sstevel@tonic-gate             o = gui.LoginPass.getBody();
29370Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
29380Sstevel@tonic-gate             LoginNormal.addElement(a);
29390Sstevel@tonic-gate 
29400Sstevel@tonic-gate             al = new LoginRealmAction();
29410Sstevel@tonic-gate             o = gui.LoginRealm.getBody();
29420Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
29430Sstevel@tonic-gate             LoginNormal.addElement(a);
29440Sstevel@tonic-gate 
29450Sstevel@tonic-gate             al = new LoginServerAction();
29460Sstevel@tonic-gate             o = gui.LoginServer.getBody();
29470Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
29480Sstevel@tonic-gate             LoginNormal.addElement(a);
29490Sstevel@tonic-gate 
29500Sstevel@tonic-gate             al = new LoginOKAction();
29510Sstevel@tonic-gate             o = gui.LoginOK.getBody();
29520Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
29530Sstevel@tonic-gate             LoginNormal.addElement(a);
29540Sstevel@tonic-gate 
29550Sstevel@tonic-gate             al = new LoginStartOverAction();
29560Sstevel@tonic-gate             o = gui.LoginStartOver.getBody();
29570Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
29580Sstevel@tonic-gate             LoginNormal.addElement(a);
29590Sstevel@tonic-gate         }
29600Sstevel@tonic-gate         setListeners(LoginHelp, false);
29610Sstevel@tonic-gate         setListeners(LoginFixers, false);
29620Sstevel@tonic-gate         setListeners(LoginNormal, true);
29630Sstevel@tonic-gate         loginHelpMode = false;
29640Sstevel@tonic-gate     }
29650Sstevel@tonic-gate 
29660Sstevel@tonic-gate     /**
29670Sstevel@tonic-gate      * Set up the listeners for the objects on the login screen in help mode
29680Sstevel@tonic-gate      *
29690Sstevel@tonic-gate      */
29700Sstevel@tonic-gate     public void setupLoginHelpListeners() {
29710Sstevel@tonic-gate         if (LoginHelp == null) {
29720Sstevel@tonic-gate             LoginHelp = new Vector(10, 10);
29730Sstevel@tonic-gate             MouseListener ml = new HelpListener();
29740Sstevel@tonic-gate             Association a;
29750Sstevel@tonic-gate             Object o;
29760Sstevel@tonic-gate 
29770Sstevel@tonic-gate             o = gui.LoginName.getBody();
29780Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
29790Sstevel@tonic-gate             LoginHelp.addElement(a);
29800Sstevel@tonic-gate             ((TextField)o).setName("LoginName" /* NOI18N */);
29810Sstevel@tonic-gate 
29820Sstevel@tonic-gate             o = gui.LoginNameLabel.getBody();
29830Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
29840Sstevel@tonic-gate             LoginHelp.addElement(a);
29850Sstevel@tonic-gate             ((Label)o).setName("LoginName" /* NOI18N */);
29860Sstevel@tonic-gate 
29870Sstevel@tonic-gate             o = gui.LoginPass.getBody();
29880Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
29890Sstevel@tonic-gate             LoginHelp.addElement(a);
29900Sstevel@tonic-gate             ((TextField)o).setName("LoginPass" /* NOI18N */);
29910Sstevel@tonic-gate 
29920Sstevel@tonic-gate             o = gui.LoginPassLabel.getBody();
29930Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
29940Sstevel@tonic-gate             LoginHelp.addElement(a);
29950Sstevel@tonic-gate             ((Label)o).setName("LoginPass" /* NOI18N */);
29960Sstevel@tonic-gate 
29970Sstevel@tonic-gate             o = gui.LoginRealm.getBody();
29980Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
29990Sstevel@tonic-gate             LoginHelp.addElement(a);
30000Sstevel@tonic-gate             ((TextField)o).setName("LoginRealm" /* NOI18N */);
30010Sstevel@tonic-gate 
30020Sstevel@tonic-gate             o = gui.LoginRealmLabel.getBody();
30030Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
30040Sstevel@tonic-gate             LoginHelp.addElement(a);
30050Sstevel@tonic-gate             ((Label)o).setName("LoginRealm" /* NOI18N */);
30060Sstevel@tonic-gate 
30070Sstevel@tonic-gate             o = gui.LoginServer.getBody();
30080Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
30090Sstevel@tonic-gate             LoginHelp.addElement(a);
30100Sstevel@tonic-gate             ((TextField)o).setName("LoginServer" /* NOI18N */);
30110Sstevel@tonic-gate 
30120Sstevel@tonic-gate             o = gui.LoginServerLabel.getBody();
30130Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
30140Sstevel@tonic-gate             LoginHelp.addElement(a);
30150Sstevel@tonic-gate             ((Label)o).setName("LoginServer" /* NOI18N */);
30160Sstevel@tonic-gate 
30170Sstevel@tonic-gate             o = gui.LoginOK.getBody();
30180Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
30190Sstevel@tonic-gate             LoginHelp.addElement(a);
30200Sstevel@tonic-gate             ((Button)o).setName("LoginOK" /* NOI18N */);
30210Sstevel@tonic-gate 
30220Sstevel@tonic-gate             o = gui.LoginStartOver.getBody();
30230Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
30240Sstevel@tonic-gate             LoginHelp.addElement(a);
30250Sstevel@tonic-gate             ((Button)o).setName("LoginStartOver" /* NOI18N */);
30260Sstevel@tonic-gate         }
30270Sstevel@tonic-gate         setListeners(LoginNormal, false);
30280Sstevel@tonic-gate         setListeners(LoginHelp, true);
30290Sstevel@tonic-gate         setupLoginHelpFixers();
30300Sstevel@tonic-gate         loginHelpMode = true;
30310Sstevel@tonic-gate     }
30320Sstevel@tonic-gate 
30330Sstevel@tonic-gate     public void setupLoginHelpFixers() {
30340Sstevel@tonic-gate         LoginFixers = new Vector(10, 10);
30350Sstevel@tonic-gate         Object o;
30360Sstevel@tonic-gate         Association a;
30370Sstevel@tonic-gate         TextFixer tf;
30380Sstevel@tonic-gate 
30390Sstevel@tonic-gate         o = gui.LoginName.getBody();
30400Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
30410Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
30420Sstevel@tonic-gate         LoginFixers.addElement(a);
30430Sstevel@tonic-gate 
30440Sstevel@tonic-gate         o = gui.LoginPass.getBody();
30450Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
30460Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
30470Sstevel@tonic-gate         LoginFixers.addElement(a);
30480Sstevel@tonic-gate 
30490Sstevel@tonic-gate         o = gui.LoginRealm.getBody();
30500Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
30510Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
30520Sstevel@tonic-gate         LoginFixers.addElement(a);
30530Sstevel@tonic-gate 
30540Sstevel@tonic-gate         o = gui.LoginServer.getBody();
30550Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
30560Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
30570Sstevel@tonic-gate         LoginFixers.addElement(a);
30580Sstevel@tonic-gate 
30590Sstevel@tonic-gate         setListeners(LoginFixers, true);
30600Sstevel@tonic-gate     }
30610Sstevel@tonic-gate 
30620Sstevel@tonic-gate     /**
30630Sstevel@tonic-gate      * Set up the listeners for the objects on the main screen in normal mode
30640Sstevel@tonic-gate      *
30650Sstevel@tonic-gate      */
30660Sstevel@tonic-gate     public void setupMainNormalListeners() {
30670Sstevel@tonic-gate         if (MainNormal == null) {
30680Sstevel@tonic-gate             Frame fr = realMainFrame;
30690Sstevel@tonic-gate             MainNormal = new Vector(10, 10);
30700Sstevel@tonic-gate             ActionListener al;
30710Sstevel@tonic-gate             ItemListener il;
30720Sstevel@tonic-gate             DateTimeListener dtl;
30730Sstevel@tonic-gate             DurationListener dl;
3074*96Ssemery             EncListListener ell;
30750Sstevel@tonic-gate             KeyListener kl1 = new KeystrokeDetector(PRINCIPAL_EDITING);
30760Sstevel@tonic-gate             KeyListener kl2 = new KeystrokeDetector(POLICY_EDITING);
30770Sstevel@tonic-gate             KeyListener kl3 = new KeystrokeDetector(PRINCIPAL_LIST);
30780Sstevel@tonic-gate             KeyListener kl4 = new KeystrokeDetector(POLICY_LIST);
30790Sstevel@tonic-gate             Association a;
30800Sstevel@tonic-gate             Object o;
30810Sstevel@tonic-gate 
30820Sstevel@tonic-gate             WindowListener wl = new MainWindowCloseAction();
30830Sstevel@tonic-gate             o = realMainFrame;
30840Sstevel@tonic-gate             a = new Association(o, wl, WINDOW_LISTENER);
30850Sstevel@tonic-gate             MainNormal.addElement(a);
30860Sstevel@tonic-gate 
30870Sstevel@tonic-gate             al = new PrListPatternAction();
30880Sstevel@tonic-gate             o = gui.PrListPattern.getBody();
30890Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
30900Sstevel@tonic-gate             MainNormal.addElement(a);
30910Sstevel@tonic-gate             a = new Association(o, kl3, TEXTFIELD_KEY);
30920Sstevel@tonic-gate             MainNormal.addElement(a);
30930Sstevel@tonic-gate 
30940Sstevel@tonic-gate             al = new PrListClearAction();
30950Sstevel@tonic-gate             o = gui.PrListClear.getBody();
30960Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
30970Sstevel@tonic-gate             MainNormal.addElement(a);
30980Sstevel@tonic-gate 
30990Sstevel@tonic-gate             al = new PrListModifyAction();
31000Sstevel@tonic-gate             o = gui.PrListModify.getBody();
31010Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
31020Sstevel@tonic-gate             MainNormal.addElement(a);
31030Sstevel@tonic-gate 
31040Sstevel@tonic-gate             al = new PrListAddAction();
31050Sstevel@tonic-gate             o = gui.PrListAdd.getBody();
31060Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
31070Sstevel@tonic-gate             MainNormal.addElement(a);
31080Sstevel@tonic-gate 
31090Sstevel@tonic-gate             al = new PrListDeleteAction();
31100Sstevel@tonic-gate             o = gui.PrListDelete.getBody();
31110Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
31120Sstevel@tonic-gate             MainNormal.addElement(a);
31130Sstevel@tonic-gate 
31140Sstevel@tonic-gate             al = new PrListDuplicateAction();
31150Sstevel@tonic-gate             o = gui.PrListDuplicate.getBody();
31160Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
31170Sstevel@tonic-gate             MainNormal.addElement(a);
31180Sstevel@tonic-gate 
31190Sstevel@tonic-gate             al = new PrSaveAction();
31200Sstevel@tonic-gate             o = gui.PrBasicSave.getBody();
31210Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
31220Sstevel@tonic-gate             MainNormal.addElement(a);
31230Sstevel@tonic-gate             o = gui.PrDetailSave.getBody();
31240Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
31250Sstevel@tonic-gate             MainNormal.addElement(a);
31260Sstevel@tonic-gate             o = gui.PrFlagsSave.getBody();
31270Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
31280Sstevel@tonic-gate             MainNormal.addElement(a);
31290Sstevel@tonic-gate 
31300Sstevel@tonic-gate             al = new PrCancelAction();
31310Sstevel@tonic-gate             o = gui.PrBasicCancel.getBody();
31320Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
31330Sstevel@tonic-gate             MainNormal.addElement(a);
31340Sstevel@tonic-gate             o = gui.PrDetailCancel.getBody();
31350Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
31360Sstevel@tonic-gate             MainNormal.addElement(a);
31370Sstevel@tonic-gate             o = gui.PrFlagsCancel.getBody();
31380Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
31390Sstevel@tonic-gate             MainNormal.addElement(a);
31400Sstevel@tonic-gate 
31410Sstevel@tonic-gate             al = new PrCommentsAction();
31420Sstevel@tonic-gate             o = gui.PrComments.getBody();
31430Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
31440Sstevel@tonic-gate             MainNormal.addElement(a);
31450Sstevel@tonic-gate             a = new Association(o, kl1, TEXTFIELD_KEY);
31460Sstevel@tonic-gate             MainNormal.addElement(a);
31470Sstevel@tonic-gate 
31480Sstevel@tonic-gate             il = new PrPolicyAction();
31490Sstevel@tonic-gate             o = gui.PrPolicy.getBody();
31500Sstevel@tonic-gate             a = new Association(o, il, CHOICE_ITEM);
31510Sstevel@tonic-gate             MainNormal.addElement(a);
31520Sstevel@tonic-gate 
31530Sstevel@tonic-gate             al = new PrPasswordAction();
31540Sstevel@tonic-gate             o = gui.PrPassword.getBody();
31550Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
31560Sstevel@tonic-gate             MainNormal.addElement(a);
31570Sstevel@tonic-gate             a = new Association(o, kl1, TEXTFIELD_KEY);
31580Sstevel@tonic-gate             MainNormal.addElement(a);
31590Sstevel@tonic-gate 
31600Sstevel@tonic-gate             al = new PrRandomPwAction();
31610Sstevel@tonic-gate             o = gui.PrBasicRandomPw.getBody();
31620Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
31630Sstevel@tonic-gate             MainNormal.addElement(a);
3164*96Ssemery 
3165*96Ssemery             al = new EncListAction();
3166*96Ssemery             o = gui.EncList.getBody();
3167*96Ssemery             a = new Association(o, al, TEXTFIELD_ACTION);
3168*96Ssemery             MainNormal.addElement(a);
3169*96Ssemery             a = new Association(o, kl1, TEXTFIELD_KEY);
3170*96Ssemery             MainNormal.addElement(a);
3171*96Ssemery 
3172*96Ssemery             ell = new EncListListener((TextField)gui.EncList.getBody(), fr);
3173*96Ssemery             o = gui.EncListMoreButton.getBody();
3174*96Ssemery             a = new Association(o, ell, BUTTON_ACTION);
3175*96Ssemery             MainNormal.addElement(a);
3176*96Ssemery 
31770Sstevel@tonic-gate             al = new PrExpiryAction();
31780Sstevel@tonic-gate             o = gui.PrExpiry.getBody();
31790Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
31800Sstevel@tonic-gate             MainNormal.addElement(a);
31810Sstevel@tonic-gate             a = new Association(o, kl1, TEXTFIELD_KEY);
31820Sstevel@tonic-gate             MainNormal.addElement(a);
31830Sstevel@tonic-gate 
31840Sstevel@tonic-gate             dtl = new DateTimeListener((TextField)gui.PrExpiry.getBody(), fr);
31850Sstevel@tonic-gate             o = gui.PrExpiryMoreButton.getBody();
31860Sstevel@tonic-gate             a = new Association(o, dtl, BUTTON_ACTION);
31870Sstevel@tonic-gate             MainNormal.addElement(a);
31880Sstevel@tonic-gate 
31890Sstevel@tonic-gate             al = new PrBasicPreviousAction();
31900Sstevel@tonic-gate             o = gui.PrBasicPrevious.getBody();
31910Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
31920Sstevel@tonic-gate             MainNormal.addElement(a);
31930Sstevel@tonic-gate 
31940Sstevel@tonic-gate             al = new PrBasicNextAction();
31950Sstevel@tonic-gate             o = gui.PrBasicNext.getBody();
31960Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
31970Sstevel@tonic-gate             MainNormal.addElement(a);
31980Sstevel@tonic-gate 
31990Sstevel@tonic-gate             al = new PrPwExpiryAction();
32000Sstevel@tonic-gate             o = gui.PrPwExpiry.getBody();
32010Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
32020Sstevel@tonic-gate             MainNormal.addElement(a);
32030Sstevel@tonic-gate             a = new Association(o, kl1, TEXTFIELD_KEY);
32040Sstevel@tonic-gate             MainNormal.addElement(a);
32050Sstevel@tonic-gate 
32060Sstevel@tonic-gate             dtl = new DateTimeListener((TextField)gui.PrPwExpiry.getBody(), fr);
32070Sstevel@tonic-gate             o = gui.PrPwExpiryMoreButton.getBody();
32080Sstevel@tonic-gate             a = new Association(o, dtl, BUTTON_ACTION);
32090Sstevel@tonic-gate             MainNormal.addElement(a);
32100Sstevel@tonic-gate 
32110Sstevel@tonic-gate             al = new PrKvnoAction();
32120Sstevel@tonic-gate             o = gui.PrKvno.getBody();
32130Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
32140Sstevel@tonic-gate             MainNormal.addElement(a);
32150Sstevel@tonic-gate             a = new Association(o, kl1, TEXTFIELD_KEY);
32160Sstevel@tonic-gate             MainNormal.addElement(a);
32170Sstevel@tonic-gate 
32180Sstevel@tonic-gate             al = new PrMaxLifetimeAction();
32190Sstevel@tonic-gate             o = gui.PrMaxLifetime.getBody();
32200Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
32210Sstevel@tonic-gate             MainNormal.addElement(a);
32220Sstevel@tonic-gate             a = new Association(o, kl1, TEXTFIELD_KEY);
32230Sstevel@tonic-gate             MainNormal.addElement(a);
32240Sstevel@tonic-gate 
32250Sstevel@tonic-gate             dl = new DurationListener((TextField)gui.PrMaxLifetime.getBody(),
32260Sstevel@tonic-gate 				      fr);
32270Sstevel@tonic-gate             o = gui.PrMaxLifetimeMoreButton.getBody();
32280Sstevel@tonic-gate             a = new Association(o, dl, BUTTON_ACTION);
32290Sstevel@tonic-gate             MainNormal.addElement(a);
32300Sstevel@tonic-gate 
32310Sstevel@tonic-gate             al = new PrMaxRenewalAction();
32320Sstevel@tonic-gate             o = gui.PrMaxRenewal.getBody();
32330Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
32340Sstevel@tonic-gate             MainNormal.addElement(a);
32350Sstevel@tonic-gate             a = new Association(o, kl1, TEXTFIELD_KEY);
32360Sstevel@tonic-gate             MainNormal.addElement(a);
32370Sstevel@tonic-gate 
32380Sstevel@tonic-gate             dl = new DurationListener((TextField)gui.PrMaxRenewal.getBody(),
32390Sstevel@tonic-gate 				      fr);
32400Sstevel@tonic-gate             o = gui.PrMaxRenewalMoreButton.getBody();
32410Sstevel@tonic-gate             a = new Association(o, dl, BUTTON_ACTION);
32420Sstevel@tonic-gate             MainNormal.addElement(a);
32430Sstevel@tonic-gate 
32440Sstevel@tonic-gate             al = new PrDetailPreviousAction();
32450Sstevel@tonic-gate             o = gui.PrDetailPrevious.getBody();
32460Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
32470Sstevel@tonic-gate             MainNormal.addElement(a);
32480Sstevel@tonic-gate 
32490Sstevel@tonic-gate             al = new PrDetailNextAction();
32500Sstevel@tonic-gate             o = gui.PrDetailNext.getBody();
32510Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
32520Sstevel@tonic-gate             MainNormal.addElement(a);
32530Sstevel@tonic-gate 
32540Sstevel@tonic-gate             al = new PrFlagsPreviousAction();
32550Sstevel@tonic-gate             o = gui.PrFlagsPrevious.getBody();
32560Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
32570Sstevel@tonic-gate             MainNormal.addElement(a);
32580Sstevel@tonic-gate 
32590Sstevel@tonic-gate             al = new PrFlagsNextAction();
32600Sstevel@tonic-gate             o = gui.PrFlagsNext.getBody();
32610Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
32620Sstevel@tonic-gate             MainNormal.addElement(a);
32630Sstevel@tonic-gate 
32640Sstevel@tonic-gate             il = new PrLockAcctAction();
32650Sstevel@tonic-gate             o = gui.PrLockAcct.getBody();
32660Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
32670Sstevel@tonic-gate             MainNormal.addElement(a);
32680Sstevel@tonic-gate 
32690Sstevel@tonic-gate             il = new PrForcePwChangeAction();
32700Sstevel@tonic-gate             o = gui.PrForcePwChange.getBody();
32710Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
32720Sstevel@tonic-gate             MainNormal.addElement(a);
32730Sstevel@tonic-gate 
32740Sstevel@tonic-gate             il = new PrAllowPostdatedAction();
32750Sstevel@tonic-gate             o = gui.PrAllowPostdated.getBody();
32760Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
32770Sstevel@tonic-gate             MainNormal.addElement(a);
32780Sstevel@tonic-gate 
32790Sstevel@tonic-gate             il = new PrAllowForwardableAction();
32800Sstevel@tonic-gate             o = gui.PrAllowForwardable.getBody();
32810Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
32820Sstevel@tonic-gate             MainNormal.addElement(a);
32830Sstevel@tonic-gate 
32840Sstevel@tonic-gate             il = new PrAllowRenewableAction();
32850Sstevel@tonic-gate             o = gui.PrAllowRenewable.getBody();
32860Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
32870Sstevel@tonic-gate             MainNormal.addElement(a);
32880Sstevel@tonic-gate 
32890Sstevel@tonic-gate             il = new PrAllowProxiableAction();
32900Sstevel@tonic-gate             o = gui.PrAllowProxiable.getBody();
32910Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
32920Sstevel@tonic-gate             MainNormal.addElement(a);
32930Sstevel@tonic-gate 
32940Sstevel@tonic-gate             il = new PrAllowSvrAction();
32950Sstevel@tonic-gate             o = gui.PrAllowSvr.getBody();
32960Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
32970Sstevel@tonic-gate             MainNormal.addElement(a);
32980Sstevel@tonic-gate 
32990Sstevel@tonic-gate             il = new PrAllowTGTAction();
33000Sstevel@tonic-gate             o = gui.PrAllowTGT.getBody();
33010Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
33020Sstevel@tonic-gate             MainNormal.addElement(a);
33030Sstevel@tonic-gate 
33040Sstevel@tonic-gate             il = new PrAllowDupAuthAction();
33050Sstevel@tonic-gate             o = gui.PrAllowDupAuth.getBody();
33060Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
33070Sstevel@tonic-gate             MainNormal.addElement(a);
33080Sstevel@tonic-gate 
33090Sstevel@tonic-gate             il = new PrRequirePreAuthAction();
33100Sstevel@tonic-gate             o = gui.PrRequirePreAuth.getBody();
33110Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
33120Sstevel@tonic-gate             MainNormal.addElement(a);
33130Sstevel@tonic-gate 
33140Sstevel@tonic-gate             il = new PrRequireHwPreAuthAction();
33150Sstevel@tonic-gate             o = gui.PrRequireHwPreAuth.getBody();
33160Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
33170Sstevel@tonic-gate             MainNormal.addElement(a);
33180Sstevel@tonic-gate 
33190Sstevel@tonic-gate             al = new PoListPatternAction();
33200Sstevel@tonic-gate             o = gui.PoListPattern.getBody();
33210Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
33220Sstevel@tonic-gate             MainNormal.addElement(a);
33230Sstevel@tonic-gate             a = new Association(o, kl4, TEXTFIELD_KEY);
33240Sstevel@tonic-gate             MainNormal.addElement(a);
33250Sstevel@tonic-gate 
33260Sstevel@tonic-gate             al = new PoListClearAction();
33270Sstevel@tonic-gate             o = gui.PoListClear.getBody();
33280Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
33290Sstevel@tonic-gate             MainNormal.addElement(a);
33300Sstevel@tonic-gate 
33310Sstevel@tonic-gate             al = new PoListModifyAction();
33320Sstevel@tonic-gate             o = gui.PoListModify.getBody();
33330Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
33340Sstevel@tonic-gate             MainNormal.addElement(a);
33350Sstevel@tonic-gate 
33360Sstevel@tonic-gate             al = new PoListAddAction();
33370Sstevel@tonic-gate             o = gui.PoListAdd.getBody();
33380Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
33390Sstevel@tonic-gate             MainNormal.addElement(a);
33400Sstevel@tonic-gate 
33410Sstevel@tonic-gate             al = new PoListDeleteAction();
33420Sstevel@tonic-gate             o = gui.PoListDelete.getBody();
33430Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
33440Sstevel@tonic-gate             MainNormal.addElement(a);
33450Sstevel@tonic-gate 
33460Sstevel@tonic-gate             al = new PoListDuplicateAction();
33470Sstevel@tonic-gate             o = gui.PoListDuplicate.getBody();
33480Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
33490Sstevel@tonic-gate             MainNormal.addElement(a);
33500Sstevel@tonic-gate 
33510Sstevel@tonic-gate             il = new PoMinPwLengthAction();
33520Sstevel@tonic-gate             o = gui.PoMinPwLength.getBody();
33530Sstevel@tonic-gate             a = new Association(o, il, CHOICE_ITEM);
33540Sstevel@tonic-gate             MainNormal.addElement(a);
33550Sstevel@tonic-gate 
33560Sstevel@tonic-gate             il = new PoMinPwClassAction();
33570Sstevel@tonic-gate             o = gui.PoMinPwClass.getBody();
33580Sstevel@tonic-gate             a = new Association(o, il, CHOICE_ITEM);
33590Sstevel@tonic-gate             MainNormal.addElement(a);
33600Sstevel@tonic-gate 
33610Sstevel@tonic-gate             il = new PoSavedPasswordsAction();
33620Sstevel@tonic-gate             o = gui.PoSavedPasswords.getBody();
33630Sstevel@tonic-gate             a = new Association(o, il, CHOICE_ITEM);
33640Sstevel@tonic-gate             MainNormal.addElement(a);
33650Sstevel@tonic-gate 
33660Sstevel@tonic-gate             al = new PoMinTicketLifetimeAction();
33670Sstevel@tonic-gate             o = gui.PoMinTicketLifetime.getBody();
33680Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
33690Sstevel@tonic-gate             MainNormal.addElement(a);
33700Sstevel@tonic-gate             a = new Association(o, kl2, TEXTFIELD_KEY);
33710Sstevel@tonic-gate             MainNormal.addElement(a);
33720Sstevel@tonic-gate 
33730Sstevel@tonic-gate             dl = new DurationListener(
33740Sstevel@tonic-gate 			      (TextField)gui.PoMinTicketLifetime.getBody(), fr);
33750Sstevel@tonic-gate             o = gui.PoMinTicketLifetimeMoreButton.getBody();
33760Sstevel@tonic-gate             a = new Association(o, dl, BUTTON_ACTION);
33770Sstevel@tonic-gate             MainNormal.addElement(a);
33780Sstevel@tonic-gate 
33790Sstevel@tonic-gate             al = new PoMaxTicketLifetimeAction();
33800Sstevel@tonic-gate             o = gui.PoMaxTicketLifetime.getBody();
33810Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
33820Sstevel@tonic-gate             MainNormal.addElement(a);
33830Sstevel@tonic-gate             a = new Association(o, kl2, TEXTFIELD_KEY);
33840Sstevel@tonic-gate             MainNormal.addElement(a);
33850Sstevel@tonic-gate 
33860Sstevel@tonic-gate             dl = new DurationListener(
33870Sstevel@tonic-gate 			      (TextField)gui.PoMaxTicketLifetime.getBody(), fr);
33880Sstevel@tonic-gate             o = gui.PoMaxTicketLifetimeMoreButton.getBody();
33890Sstevel@tonic-gate             a = new Association(o, dl, BUTTON_ACTION);
33900Sstevel@tonic-gate             MainNormal.addElement(a);
33910Sstevel@tonic-gate 
33920Sstevel@tonic-gate             al = new PoSaveAction();
33930Sstevel@tonic-gate             o = gui.PoDetailSave.getBody();
33940Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
33950Sstevel@tonic-gate             MainNormal.addElement(a);
33960Sstevel@tonic-gate 
33970Sstevel@tonic-gate             al = new PoCancelAction();
33980Sstevel@tonic-gate             o = gui.PoDetailCancel.getBody();
33990Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
34000Sstevel@tonic-gate             MainNormal.addElement(a);
34010Sstevel@tonic-gate 
34020Sstevel@tonic-gate             al = new PoPreviousAction();
34030Sstevel@tonic-gate             o = gui.PoDetailPrevious.getBody();
34040Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
34050Sstevel@tonic-gate             MainNormal.addElement(a);
34060Sstevel@tonic-gate 
34070Sstevel@tonic-gate             al = new PoDoneAction();
34080Sstevel@tonic-gate             o = gui.PoDetailDone.getBody();
34090Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
34100Sstevel@tonic-gate             MainNormal.addElement(a);
34110Sstevel@tonic-gate 
34120Sstevel@tonic-gate         }
34130Sstevel@tonic-gate         setListeners(MainHelp, false);
34140Sstevel@tonic-gate         setListeners(MainFixers, false);
34150Sstevel@tonic-gate         setListeners(MainNormal, true);
34160Sstevel@tonic-gate         mainHelpMode = false;
34170Sstevel@tonic-gate     }
34180Sstevel@tonic-gate 
34190Sstevel@tonic-gate     /**
34200Sstevel@tonic-gate      * Set up the listeners for the objects on the main screen in help mode
34210Sstevel@tonic-gate      *
34220Sstevel@tonic-gate      */
34230Sstevel@tonic-gate     public void setupMainHelpListeners() {
34240Sstevel@tonic-gate         if (MainHelp == null) {
34250Sstevel@tonic-gate             MainHelp = new Vector(10, 10);
34260Sstevel@tonic-gate             MouseListener ml = new HelpListener();
34270Sstevel@tonic-gate             Association a;
34280Sstevel@tonic-gate             Object o;
34290Sstevel@tonic-gate 
34300Sstevel@tonic-gate             o = gui.PrListPattern.getBody();
34310Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
34320Sstevel@tonic-gate             MainHelp.addElement(a);
34330Sstevel@tonic-gate             ((TextField)o).setName("PrListPattern" /* NOI18N */);
34340Sstevel@tonic-gate 
34350Sstevel@tonic-gate             o = gui.PrSearchLab.getBody();
34360Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
34370Sstevel@tonic-gate             MainHelp.addElement(a);
34380Sstevel@tonic-gate             ((Label)o).setName("PrListPattern" /* NOI18N */);
34390Sstevel@tonic-gate 
34400Sstevel@tonic-gate             o = gui.PrListClear.getBody();
34410Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
34420Sstevel@tonic-gate             MainHelp.addElement(a);
34430Sstevel@tonic-gate             ((Button)o).setName("PrListClear" /* NOI18N */);
34440Sstevel@tonic-gate 
34450Sstevel@tonic-gate             o = gui.PrListModify.getBody();
34460Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
34470Sstevel@tonic-gate             MainHelp.addElement(a);
34480Sstevel@tonic-gate             ((Button)o).setName("PrListModify" /* NOI18N */);
34490Sstevel@tonic-gate 
34500Sstevel@tonic-gate             o = gui.PrListAdd.getBody();
34510Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
34520Sstevel@tonic-gate             MainHelp.addElement(a);
34530Sstevel@tonic-gate             ((Button)o).setName("PrListAdd" /* NOI18N */);
34540Sstevel@tonic-gate 
34550Sstevel@tonic-gate             o = gui.PrListDelete.getBody();
34560Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
34570Sstevel@tonic-gate             MainHelp.addElement(a);
34580Sstevel@tonic-gate             ((Button)o).setName("PrListDelete" /* NOI18N */);
34590Sstevel@tonic-gate 
34600Sstevel@tonic-gate             o = gui.PrListDuplicate.getBody();
34610Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
34620Sstevel@tonic-gate             MainHelp.addElement(a);
34630Sstevel@tonic-gate             ((Button)o).setName("PrListDuplicate" /* NOI18N */);
34640Sstevel@tonic-gate 
34650Sstevel@tonic-gate             o = gui.PrBasicSave.getBody();
34660Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
34670Sstevel@tonic-gate             MainHelp.addElement(a);
34680Sstevel@tonic-gate             ((Button)o).setName("PrSave" /* NOI18N */);
34690Sstevel@tonic-gate 
34700Sstevel@tonic-gate             o = gui.PrDetailSave.getBody();
34710Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
34720Sstevel@tonic-gate             MainHelp.addElement(a);
34730Sstevel@tonic-gate             ((Button)o).setName("PrSave" /* NOI18N */);
34740Sstevel@tonic-gate 
34750Sstevel@tonic-gate             o = gui.PrFlagsSave.getBody();
34760Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
34770Sstevel@tonic-gate             MainHelp.addElement(a);
34780Sstevel@tonic-gate             ((Button)o).setName("PrSave" /* NOI18N */);
34790Sstevel@tonic-gate 
34800Sstevel@tonic-gate             o = gui.PrBasicCancel.getBody();
34810Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
34820Sstevel@tonic-gate             MainHelp.addElement(a);
34830Sstevel@tonic-gate             ((Button)o).setName("PrCancel" /* NOI18N */);
34840Sstevel@tonic-gate 
34850Sstevel@tonic-gate             o = gui.PrDetailCancel.getBody();
34860Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
34870Sstevel@tonic-gate             MainHelp.addElement(a);
34880Sstevel@tonic-gate             ((Button)o).setName("PrCancel" /* NOI18N */);
34890Sstevel@tonic-gate 
34900Sstevel@tonic-gate             o = gui.PrFlagsCancel.getBody();
34910Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
34920Sstevel@tonic-gate             MainHelp.addElement(a);
34930Sstevel@tonic-gate             ((Button)o).setName("PrCancel" /* NOI18N */);
34940Sstevel@tonic-gate 
34950Sstevel@tonic-gate             o = gui.PrName1.getBody();
34960Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
34970Sstevel@tonic-gate             MainHelp.addElement(a);
34980Sstevel@tonic-gate             ((TextField)o).setName("PrName" /* NOI18N */);
34990Sstevel@tonic-gate 
35000Sstevel@tonic-gate             o = gui.PrNameLabel1.getBody();
35010Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
35020Sstevel@tonic-gate             MainHelp.addElement(a);
35030Sstevel@tonic-gate             ((Label)o).setName("PrName" /* NOI18N */);
35040Sstevel@tonic-gate 
35050Sstevel@tonic-gate             o = gui.PrComments.getBody();
35060Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
35070Sstevel@tonic-gate             MainHelp.addElement(a);
35080Sstevel@tonic-gate             ((TextField)o).setName("PrComments" /* NOI18N */);
35090Sstevel@tonic-gate 
35100Sstevel@tonic-gate             o = gui.PrCommentsLabel.getBody();
35110Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
35120Sstevel@tonic-gate             MainHelp.addElement(a);
35130Sstevel@tonic-gate             ((Label)o).setName("PrComments" /* NOI18N */);
35140Sstevel@tonic-gate 
35150Sstevel@tonic-gate             o = gui.PrPolicy.getBody();
35160Sstevel@tonic-gate             a = new Association(o, ml, CHOICE_MOUSE);
35170Sstevel@tonic-gate             MainHelp.addElement(a);
35180Sstevel@tonic-gate             ((Choice)o).setName("PrPolicy" /* NOI18N */);
35190Sstevel@tonic-gate 
35200Sstevel@tonic-gate             o = gui.PrPolicyLabel.getBody();
35210Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
35220Sstevel@tonic-gate             MainHelp.addElement(a);
35230Sstevel@tonic-gate             ((Label)o).setName("PrPolicy" /* NOI18N */);
35240Sstevel@tonic-gate 
35250Sstevel@tonic-gate             o = gui.PrPassword.getBody();
35260Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
35270Sstevel@tonic-gate             MainHelp.addElement(a);
35280Sstevel@tonic-gate             ((TextField)o).setName("PrPassword" /* NOI18N */);
35290Sstevel@tonic-gate 
35300Sstevel@tonic-gate             o = gui.PrPasswordLabel.getBody();
35310Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
35320Sstevel@tonic-gate             MainHelp.addElement(a);
35330Sstevel@tonic-gate             ((Label)o).setName("PrPassword" /* NOI18N */);
35340Sstevel@tonic-gate 
35350Sstevel@tonic-gate             o = gui.PrBasicRandomPw.getBody();
35360Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
35370Sstevel@tonic-gate             MainHelp.addElement(a);
35380Sstevel@tonic-gate             ((Button)o).setName("PrBasicRandomPw" /* NOI18N */);
3539*96Ssemery 
3540*96Ssemery             o = gui.EncList.getBody();
3541*96Ssemery             a = new Association(o, ml, TEXTFIELD_MOUSE);
3542*96Ssemery             MainHelp.addElement(a);
3543*96Ssemery             ((TextField)o).setName("EncList" /* NOI18N */);
3544*96Ssemery 
3545*96Ssemery             o = gui.EncListLabel.getBody();
3546*96Ssemery             a = new Association(o, ml, LABEL_MOUSE);
3547*96Ssemery             MainHelp.addElement(a);
3548*96Ssemery             ((Label)o).setName("EncList" /* NOI18N */);
3549*96Ssemery 
3550*96Ssemery             o = gui.EncListMoreButton.getBody();
3551*96Ssemery             a = new Association(o, ml, BUTTON_MOUSE);
3552*96Ssemery             MainHelp.addElement(a);
3553*96Ssemery             ((Button)o).setName("EncListHelperButton" /* NOI18N */);
3554*96Ssemery 
35550Sstevel@tonic-gate             o = gui.PrExpiry.getBody();
35560Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
35570Sstevel@tonic-gate             MainHelp.addElement(a);
35580Sstevel@tonic-gate             ((TextField)o).setName("PrExpiry" /* NOI18N */);
35590Sstevel@tonic-gate 
35600Sstevel@tonic-gate             o = gui.PrExpiryLabel.getBody();
35610Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
35620Sstevel@tonic-gate             MainHelp.addElement(a);
35630Sstevel@tonic-gate             ((Label)o).setName("PrExpiry" /* NOI18N */);
35640Sstevel@tonic-gate 
35650Sstevel@tonic-gate             o = gui.PrExpiryMoreButton.getBody();
35660Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
35670Sstevel@tonic-gate             MainHelp.addElement(a);
35680Sstevel@tonic-gate             ((Button)o).setName("DateHelperButton" /* NOI18N */);
35690Sstevel@tonic-gate 
35700Sstevel@tonic-gate             o = gui.PrLastChangedTime.getBody();
35710Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
35720Sstevel@tonic-gate             MainHelp.addElement(a);
35730Sstevel@tonic-gate             ((Label)o).setName("PrinBasLastPrincipalChange" /* NOI18N */);
35740Sstevel@tonic-gate 
35750Sstevel@tonic-gate             o = gui.PrLastChangedTimeLabel.getBody();
35760Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
35770Sstevel@tonic-gate             MainHelp.addElement(a);
35780Sstevel@tonic-gate             ((Label)o).setName("PrinBasLastPrincipalChange" /* NOI18N */);
35790Sstevel@tonic-gate 
35800Sstevel@tonic-gate             o = gui.PrLastChangedBy.getBody();
35810Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
35820Sstevel@tonic-gate             MainHelp.addElement(a);
35830Sstevel@tonic-gate             ((Label)o).setName("PrinBasLastChangedBy" /* NOI18N */);
35840Sstevel@tonic-gate 
35850Sstevel@tonic-gate             o = gui.PrLastChangedByLabel.getBody();
35860Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
35870Sstevel@tonic-gate             MainHelp.addElement(a);
35880Sstevel@tonic-gate             ((Label)o).setName("PrinBasLastChangedBy" /* NOI18N */);
35890Sstevel@tonic-gate 
35900Sstevel@tonic-gate             o = gui.PrBasicPrevious.getBody();
35910Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
35920Sstevel@tonic-gate             MainHelp.addElement(a);
35930Sstevel@tonic-gate             ((Button)o).setName("PrBasicPrevious" /* NOI18N */);
35940Sstevel@tonic-gate 
35950Sstevel@tonic-gate             o = gui.PrBasicNext.getBody();
35960Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
35970Sstevel@tonic-gate             MainHelp.addElement(a);
35980Sstevel@tonic-gate             ((Button)o).setName("PrBasicNext" /* NOI18N */);
35990Sstevel@tonic-gate 
36000Sstevel@tonic-gate             o = gui.PrLastSuccess.getBody();
36010Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
36020Sstevel@tonic-gate             MainHelp.addElement(a);
36030Sstevel@tonic-gate             ((Label)o).setName("PrinDetLastSuccess" /* NOI18N */);
36040Sstevel@tonic-gate 
36050Sstevel@tonic-gate             o = gui.PrLastSuccessLabel.getBody();
36060Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
36070Sstevel@tonic-gate             MainHelp.addElement(a);
36080Sstevel@tonic-gate             ((Label)o).setName("PrinDetLastSuccess" /* NOI18N */);
36090Sstevel@tonic-gate 
36100Sstevel@tonic-gate             o = gui.PrLastFailure.getBody();
36110Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
36120Sstevel@tonic-gate             MainHelp.addElement(a);
36130Sstevel@tonic-gate             ((Label)o).setName("PrinDetLastFailure" /* NOI18N */);
36140Sstevel@tonic-gate 
36150Sstevel@tonic-gate             o = gui.PrLastFailureLabel.getBody();
36160Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
36170Sstevel@tonic-gate             MainHelp.addElement(a);
36180Sstevel@tonic-gate             ((Label)o).setName("PrinDetLastFailure" /* NOI18N */);
36190Sstevel@tonic-gate 
36200Sstevel@tonic-gate             o = gui.PrFailCount.getBody();
36210Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
36220Sstevel@tonic-gate             MainHelp.addElement(a);
36230Sstevel@tonic-gate             ((Label)o).setName("PrinDetFailureCount" /* NOI18N */);
36240Sstevel@tonic-gate 
36250Sstevel@tonic-gate             o = gui.PrFailureCountLabel.getBody();
36260Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
36270Sstevel@tonic-gate             MainHelp.addElement(a);
36280Sstevel@tonic-gate             ((Label)o).setName("PrinDetFailureCount" /* NOI18N */);
36290Sstevel@tonic-gate 
36300Sstevel@tonic-gate             o = gui.PrLastPwChange.getBody();
36310Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
36320Sstevel@tonic-gate             MainHelp.addElement(a);
36330Sstevel@tonic-gate             ((Label)o).setName("PrinDetLastPasswordChange" /* NOI18N */);
36340Sstevel@tonic-gate 
36350Sstevel@tonic-gate             o = gui.PrPwLastChangedLabel.getBody();
36360Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
36370Sstevel@tonic-gate             MainHelp.addElement(a);
36380Sstevel@tonic-gate             ((Label)o).setName("PrinDetLastPasswordChange" /* NOI18N */);
36390Sstevel@tonic-gate 
36400Sstevel@tonic-gate             o = gui.PrPwExpiry.getBody();
36410Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
36420Sstevel@tonic-gate             MainHelp.addElement(a);
36430Sstevel@tonic-gate             ((TextField)o).setName("PrPwExpiry" /* NOI18N */);
36440Sstevel@tonic-gate 
36450Sstevel@tonic-gate             o = gui.PrPwExpiryLabel.getBody();
36460Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
36470Sstevel@tonic-gate             MainHelp.addElement(a);
36480Sstevel@tonic-gate             ((Label)o).setName("PrPwExpiry" /* NOI18N */);
36490Sstevel@tonic-gate 
36500Sstevel@tonic-gate             o = gui.PrPwExpiryMoreButton.getBody();
36510Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
36520Sstevel@tonic-gate             MainHelp.addElement(a);
36530Sstevel@tonic-gate             ((Button)o).setName("DateHelperButton" /* NOI18N */);
36540Sstevel@tonic-gate 
36550Sstevel@tonic-gate             o = gui.PrKvno.getBody();
36560Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
36570Sstevel@tonic-gate             MainHelp.addElement(a);
36580Sstevel@tonic-gate             ((TextField)o).setName("PrKvno" /* NOI18N */);
36590Sstevel@tonic-gate 
36600Sstevel@tonic-gate             o = gui.PrKvnoLabel.getBody();
36610Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
36620Sstevel@tonic-gate             MainHelp.addElement(a);
36630Sstevel@tonic-gate             ((Label)o).setName("PrKvno" /* NOI18N */);
36640Sstevel@tonic-gate 
36650Sstevel@tonic-gate             o = gui.PrMaxLifetime.getBody();
36660Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
36670Sstevel@tonic-gate             MainHelp.addElement(a);
36680Sstevel@tonic-gate             ((TextField)o).setName("PrMaxLifetime" /* NOI18N */);
36690Sstevel@tonic-gate 
36700Sstevel@tonic-gate             o = gui.PrMaxTicketLifetimeLabel.getBody();
36710Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
36720Sstevel@tonic-gate             MainHelp.addElement(a);
36730Sstevel@tonic-gate             ((Label)o).setName("PrMaxLifetime" /* NOI18N */);
36740Sstevel@tonic-gate 
36750Sstevel@tonic-gate             o = gui.PrMaxLifetimeMoreButton.getBody();
36760Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
36770Sstevel@tonic-gate             MainHelp.addElement(a);
36780Sstevel@tonic-gate             ((Button)o).setName("DurationHelperButton" /* NOI18N */);
36790Sstevel@tonic-gate 
36800Sstevel@tonic-gate             o = gui.PrMaxRenewal.getBody();
36810Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
36820Sstevel@tonic-gate             MainHelp.addElement(a);
36830Sstevel@tonic-gate             ((TextField)o).setName("PrMaxRenewal" /* NOI18N */);
36840Sstevel@tonic-gate 
36850Sstevel@tonic-gate             o = gui.PrMaxTicketRenewalLabel.getBody();
36860Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
36870Sstevel@tonic-gate             MainHelp.addElement(a);
36880Sstevel@tonic-gate             ((Label)o).setName("PrMaxRenewal" /* NOI18N */);
36890Sstevel@tonic-gate 
36900Sstevel@tonic-gate             o = gui.PrMaxRenewalMoreButton.getBody();
36910Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
36920Sstevel@tonic-gate             MainHelp.addElement(a);
36930Sstevel@tonic-gate             ((Button)o).setName("DurationHelperButton" /* NOI18N */);
36940Sstevel@tonic-gate 
36950Sstevel@tonic-gate             o = gui.PrDetailPrevious.getBody();
36960Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
36970Sstevel@tonic-gate             MainHelp.addElement(a);
36980Sstevel@tonic-gate             ((Button)o).setName("PrDetailPrevious" /* NOI18N */);
36990Sstevel@tonic-gate 
37000Sstevel@tonic-gate             o = gui.PrDetailNext.getBody();
37010Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
37020Sstevel@tonic-gate             MainHelp.addElement(a);
37030Sstevel@tonic-gate             ((Button)o).setName("PrDetailNext" /* NOI18N */);
37040Sstevel@tonic-gate 
37050Sstevel@tonic-gate             o = gui.PrFlagsPrevious.getBody();
37060Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
37070Sstevel@tonic-gate             MainHelp.addElement(a);
37080Sstevel@tonic-gate             ((Button)o).setName("PrFlagsPrevious" /* NOI18N */);
37090Sstevel@tonic-gate 
37100Sstevel@tonic-gate             o = gui.PrFlagsNext.getBody();
37110Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
37120Sstevel@tonic-gate             MainHelp.addElement(a);
37130Sstevel@tonic-gate             ((Button)o).setName("PrFlagsNext" /* NOI18N */);
37140Sstevel@tonic-gate 
37150Sstevel@tonic-gate             o = gui.PrLockAcct.getBody();
37160Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
37170Sstevel@tonic-gate             MainHelp.addElement(a);
37180Sstevel@tonic-gate             ((Checkbox)o).setName("PrLockAcct" /* NOI18N */);
37190Sstevel@tonic-gate 
37200Sstevel@tonic-gate             o = gui.PrForcePwChange.getBody();
37210Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
37220Sstevel@tonic-gate             MainHelp.addElement(a);
37230Sstevel@tonic-gate             ((Checkbox)o).setName("PrForcePwChange" /* NOI18N */);
37240Sstevel@tonic-gate 
37250Sstevel@tonic-gate             o = gui.PrAllowPostdated.getBody();
37260Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
37270Sstevel@tonic-gate             MainHelp.addElement(a);
37280Sstevel@tonic-gate             ((Checkbox)o).setName("PrAllowPostdated" /* NOI18N */);
37290Sstevel@tonic-gate 
37300Sstevel@tonic-gate             o = gui.PrAllowForwardable.getBody();
37310Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
37320Sstevel@tonic-gate             MainHelp.addElement(a);
37330Sstevel@tonic-gate             ((Checkbox)o).setName("PrAllowForwardable" /* NOI18N */);
37340Sstevel@tonic-gate 
37350Sstevel@tonic-gate             o = gui.PrAllowRenewable.getBody();
37360Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
37370Sstevel@tonic-gate             MainHelp.addElement(a);
37380Sstevel@tonic-gate             ((Checkbox)o).setName("PrAllowRenewable" /* NOI18N */);
37390Sstevel@tonic-gate 
37400Sstevel@tonic-gate             o = gui.PrAllowProxiable.getBody();
37410Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
37420Sstevel@tonic-gate             MainHelp.addElement(a);
37430Sstevel@tonic-gate             ((Checkbox)o).setName("PrAllowProxiable" /* NOI18N */);
37440Sstevel@tonic-gate 
37450Sstevel@tonic-gate             o = gui.PrAllowSvr.getBody();
37460Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
37470Sstevel@tonic-gate             MainHelp.addElement(a);
37480Sstevel@tonic-gate             ((Checkbox)o).setName("PrAllowSvr" /* NOI18N */);
37490Sstevel@tonic-gate 
37500Sstevel@tonic-gate             o = gui.PrAllowTGT.getBody();
37510Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
37520Sstevel@tonic-gate             MainHelp.addElement(a);
37530Sstevel@tonic-gate             ((Checkbox)o).setName("PrAllowTGT" /* NOI18N */);
37540Sstevel@tonic-gate 
37550Sstevel@tonic-gate             o = gui.PrAllowDupAuth.getBody();
37560Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
37570Sstevel@tonic-gate             MainHelp.addElement(a);
37580Sstevel@tonic-gate             ((Checkbox)o).setName("PrAllowDupAuth" /* NOI18N */);
37590Sstevel@tonic-gate 
37600Sstevel@tonic-gate             o = gui.PrRequirePreAuth.getBody();
37610Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
37620Sstevel@tonic-gate             MainHelp.addElement(a);
37630Sstevel@tonic-gate             ((Checkbox)o).setName("PrRequirePreAuth" /* NOI18N */);
37640Sstevel@tonic-gate 
37650Sstevel@tonic-gate             o = gui.PrRequireHwPreAuth.getBody();
37660Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
37670Sstevel@tonic-gate             MainHelp.addElement(a);
37680Sstevel@tonic-gate             ((Checkbox)o).setName("PrRequireHwPreAuth" /* NOI18N */);
37690Sstevel@tonic-gate 
37700Sstevel@tonic-gate             o = gui.PoListPattern.getBody();
37710Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
37720Sstevel@tonic-gate             MainHelp.addElement(a);
37730Sstevel@tonic-gate             ((TextField)o).setName("PoListPattern" /* NOI18N */);
37740Sstevel@tonic-gate 
37750Sstevel@tonic-gate             o = gui.PoListPatternLabel.getBody();
37760Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
37770Sstevel@tonic-gate             MainHelp.addElement(a);
37780Sstevel@tonic-gate             ((Label)o).setName("PoListPattern" /* NOI18N */);
37790Sstevel@tonic-gate 
37800Sstevel@tonic-gate             o = gui.PoListClear.getBody();
37810Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
37820Sstevel@tonic-gate             MainHelp.addElement(a);
37830Sstevel@tonic-gate             ((Button)o).setName("PoListClear" /* NOI18N */);
37840Sstevel@tonic-gate 
37850Sstevel@tonic-gate             o = gui.PoListModify.getBody();
37860Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
37870Sstevel@tonic-gate             MainHelp.addElement(a);
37880Sstevel@tonic-gate             ((Button)o).setName("PoListModify" /* NOI18N */);
37890Sstevel@tonic-gate 
37900Sstevel@tonic-gate             o = gui.PoListAdd.getBody();
37910Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
37920Sstevel@tonic-gate             MainHelp.addElement(a);
37930Sstevel@tonic-gate             ((Button)o).setName("PoListAdd" /* NOI18N */);
37940Sstevel@tonic-gate 
37950Sstevel@tonic-gate             o = gui.PoListDelete.getBody();
37960Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
37970Sstevel@tonic-gate             MainHelp.addElement(a);
37980Sstevel@tonic-gate             ((Button)o).setName("PoListDelete" /* NOI18N */);
37990Sstevel@tonic-gate 
38000Sstevel@tonic-gate             o = gui.PoListDuplicate.getBody();
38010Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
38020Sstevel@tonic-gate             MainHelp.addElement(a);
38030Sstevel@tonic-gate             ((Button)o).setName("PoListDuplicate" /* NOI18N */);
38040Sstevel@tonic-gate 
38050Sstevel@tonic-gate             o = gui.PoName.getBody();
38060Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
38070Sstevel@tonic-gate             MainHelp.addElement(a);
38080Sstevel@tonic-gate             ((TextField)o).setName("PoName" /* NOI18N */);
38090Sstevel@tonic-gate 
38100Sstevel@tonic-gate             o = gui.PoNameLabel.getBody();
38110Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
38120Sstevel@tonic-gate             MainHelp.addElement(a);
38130Sstevel@tonic-gate             ((Label)o).setName("PoName" /* NOI18N */);
38140Sstevel@tonic-gate 
38150Sstevel@tonic-gate             o = gui.PoMinPwLength.getBody();
38160Sstevel@tonic-gate             a = new Association(o, ml, CHOICE_MOUSE);
38170Sstevel@tonic-gate             MainHelp.addElement(a);
38180Sstevel@tonic-gate             ((Choice)o).setName("PoMinPwLength" /* NOI18N */);
38190Sstevel@tonic-gate 
38200Sstevel@tonic-gate             o = gui.PoMinPwLengthLabel.getBody();
38210Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
38220Sstevel@tonic-gate             MainHelp.addElement(a);
38230Sstevel@tonic-gate             ((Label)o).setName("PoMinPwLength" /* NOI18N */);
38240Sstevel@tonic-gate 
38250Sstevel@tonic-gate             o = gui.PoMinPwClass.getBody();
38260Sstevel@tonic-gate             a = new Association(o, ml, CHOICE_MOUSE);
38270Sstevel@tonic-gate             MainHelp.addElement(a);
38280Sstevel@tonic-gate             ((Choice)o).setName("PoMinPwClass" /* NOI18N */);
38290Sstevel@tonic-gate 
38300Sstevel@tonic-gate             o = gui.PoMinPwClassLabel.getBody();
38310Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
38320Sstevel@tonic-gate             MainHelp.addElement(a);
38330Sstevel@tonic-gate             ((Label)o).setName("PoMinPwClass" /* NOI18N */);
38340Sstevel@tonic-gate 
38350Sstevel@tonic-gate             o = gui.PoSavedPasswords.getBody();
38360Sstevel@tonic-gate             a = new Association(o, ml, CHOICE_MOUSE);
38370Sstevel@tonic-gate             MainHelp.addElement(a);
38380Sstevel@tonic-gate             ((Choice)o).setName("PoSavedPasswords" /* NOI18N */);
38390Sstevel@tonic-gate 
38400Sstevel@tonic-gate             o = gui.PoSavedPasswordsLabel.getBody();
38410Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
38420Sstevel@tonic-gate             MainHelp.addElement(a);
38430Sstevel@tonic-gate             ((Label)o).setName("PoSavedPasswords" /* NOI18N */);
38440Sstevel@tonic-gate 
38450Sstevel@tonic-gate             o = gui.PoMinTicketLifetime.getBody();
38460Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
38470Sstevel@tonic-gate             MainHelp.addElement(a);
38480Sstevel@tonic-gate             ((TextField)o).setName("PoMinTicketLifetime" /* NOI18N */);
38490Sstevel@tonic-gate 
38500Sstevel@tonic-gate             o = gui.PoMinTicketLifetimeLabel.getBody();
38510Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
38520Sstevel@tonic-gate             MainHelp.addElement(a);
38530Sstevel@tonic-gate             ((Label)o).setName("PoMinTicketLifetime" /* NOI18N */);
38540Sstevel@tonic-gate 
38550Sstevel@tonic-gate             o = gui.PoMinTicketLifetimeMoreButton.getBody();
38560Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
38570Sstevel@tonic-gate             MainHelp.addElement(a);
38580Sstevel@tonic-gate             ((Button)o).setName("DurationHelperButton" /* NOI18N */);
38590Sstevel@tonic-gate 
38600Sstevel@tonic-gate             o = gui.PoMaxTicketLifetime.getBody();
38610Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
38620Sstevel@tonic-gate             MainHelp.addElement(a);
38630Sstevel@tonic-gate             ((TextField)o).setName("PoMaxTicketLifetime" /* NOI18N */);
38640Sstevel@tonic-gate 
38650Sstevel@tonic-gate             o = gui.PoMaxTicketLifetimeLabel.getBody();
38660Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
38670Sstevel@tonic-gate             MainHelp.addElement(a);
38680Sstevel@tonic-gate             ((Label)o).setName("PoMaxTicketLifetime" /* NOI18N */);
38690Sstevel@tonic-gate 
38700Sstevel@tonic-gate             o = gui.PoMaxTicketLifetimeMoreButton.getBody();
38710Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
38720Sstevel@tonic-gate             MainHelp.addElement(a);
38730Sstevel@tonic-gate             ((Button)o).setName("DurationHelperButton" /* NOI18N */);
38740Sstevel@tonic-gate 
38750Sstevel@tonic-gate             o = gui.PoReferences.getBody();
38760Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
38770Sstevel@tonic-gate             MainHelp.addElement(a);
38780Sstevel@tonic-gate             ((Label)o).setName("PolDetPrincipalsUsingThisPolicy" /* NOI18N */);
38790Sstevel@tonic-gate 
38800Sstevel@tonic-gate             o = gui.PoReferencesLabel.getBody();
38810Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
38820Sstevel@tonic-gate             MainHelp.addElement(a);
38830Sstevel@tonic-gate             ((Label)o).setName("PolDetPrincipalsUsingThisPolicy" /* NOI18N */);
38840Sstevel@tonic-gate 
38850Sstevel@tonic-gate             o = gui.PoDetailSave.getBody();
38860Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
38870Sstevel@tonic-gate             MainHelp.addElement(a);
38880Sstevel@tonic-gate             ((Button)o).setName("PoSave" /* NOI18N */);
38890Sstevel@tonic-gate 
38900Sstevel@tonic-gate             o = gui.PoDetailCancel.getBody();
38910Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
38920Sstevel@tonic-gate             MainHelp.addElement(a);
38930Sstevel@tonic-gate             ((Button)o).setName("PoCancel" /* NOI18N */);
38940Sstevel@tonic-gate 
38950Sstevel@tonic-gate             o = gui.PoDetailPrevious.getBody();
38960Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
38970Sstevel@tonic-gate             MainHelp.addElement(a);
38980Sstevel@tonic-gate             ((Button)o).setName("PoDetailPrevious" /* NOI18N */);
38990Sstevel@tonic-gate 
39000Sstevel@tonic-gate             o = gui.PoDetailDone.getBody();
39010Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
39020Sstevel@tonic-gate             MainHelp.addElement(a);
39030Sstevel@tonic-gate             ((Button)o).setName("PoDetailDone" /* NOI18N */);
39040Sstevel@tonic-gate 
39050Sstevel@tonic-gate             setupMainHelpFlagTogglers();
39060Sstevel@tonic-gate         }
39070Sstevel@tonic-gate 
39080Sstevel@tonic-gate         fixHelpTags();
39090Sstevel@tonic-gate         setListeners(MainNormal, false);
39100Sstevel@tonic-gate         setListeners(MainHelp, true);
39110Sstevel@tonic-gate         setupMainHelpFixers();
39120Sstevel@tonic-gate         mainHelpMode = true;
39130Sstevel@tonic-gate     }
39140Sstevel@tonic-gate 
39150Sstevel@tonic-gate     public void fixHelpTags() {
39160Sstevel@tonic-gate         if (noLists) {
39170Sstevel@tonic-gate             ((TextList)gui.Prlist.getBody()).setName("PrNoList" /* NOI18N */);
39180Sstevel@tonic-gate             ((TextField)gui.PrListPattern.getBody()).setName("PrNameNoList"
39190Sstevel@tonic-gate 							     /* NOI18N */);
39200Sstevel@tonic-gate             ((Button)gui.PrListClear.getBody()).setName("PrNoListClear"
39210Sstevel@tonic-gate 							/* NOI18N */);
39220Sstevel@tonic-gate             ((TextList)gui.Pollist.getBody()).setName("PolNoList" /* NOI18N */);
39230Sstevel@tonic-gate             ((TextField)gui.PoListPattern.getBody()).setName("PoNameNoList"
39240Sstevel@tonic-gate 							     /* NOI18N */);
39250Sstevel@tonic-gate             ((Button)gui.PoListClear.getBody()).setName("PoNoListClear"
39260Sstevel@tonic-gate 							/* NOI18N */);
39270Sstevel@tonic-gate         } else {
39280Sstevel@tonic-gate             ((TextList)gui.Prlist.getBody()).setName("PrList" /* NOI18N */);
39290Sstevel@tonic-gate             ((TextField)gui.PrListPattern.getBody()).setName("PrListPattern"
39300Sstevel@tonic-gate 							     /* NOI18N */);
39310Sstevel@tonic-gate             ((Button)gui.PrListClear.getBody()).setName("PrListClear"
39320Sstevel@tonic-gate 							/* NOI18N */);
39330Sstevel@tonic-gate             ((TextList)gui.Pollist.getBody()).setName("Pollist" /* NOI18N */);
39340Sstevel@tonic-gate             ((TextField)gui.PoListPattern.getBody()).setName("PoListPattern"
39350Sstevel@tonic-gate 							     /* NOI18N */);
39360Sstevel@tonic-gate             ((Button)gui.PoListClear.getBody()).setName("PoListClear"
39370Sstevel@tonic-gate 							/* NOI18N */);
39380Sstevel@tonic-gate         }
39390Sstevel@tonic-gate     }
39400Sstevel@tonic-gate 
39410Sstevel@tonic-gate     /**
39420Sstevel@tonic-gate      * Helper method to setupMainHelpListeners. Should be called from
39430Sstevel@tonic-gate      * only from there.
39440Sstevel@tonic-gate      */
39450Sstevel@tonic-gate     private void 	setupMainHelpFlagTogglers() {
39460Sstevel@tonic-gate 
39470Sstevel@tonic-gate         if (MainHelp == null)
39480Sstevel@tonic-gate             return;
39490Sstevel@tonic-gate 
39500Sstevel@tonic-gate         CheckboxToggler ml = new CheckboxToggler();
39510Sstevel@tonic-gate         Object o;
39520Sstevel@tonic-gate         Association a;
39530Sstevel@tonic-gate 
39540Sstevel@tonic-gate         o = gui.PrLockAcct.getBody();
39550Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
39560Sstevel@tonic-gate         MainHelp.addElement(a);
39570Sstevel@tonic-gate 
39580Sstevel@tonic-gate         o = gui.PrForcePwChange.getBody();
39590Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
39600Sstevel@tonic-gate         MainHelp.addElement(a);
39610Sstevel@tonic-gate 
39620Sstevel@tonic-gate         o = gui.PrAllowPostdated.getBody();
39630Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
39640Sstevel@tonic-gate         MainHelp.addElement(a);
39650Sstevel@tonic-gate 
39660Sstevel@tonic-gate         o = gui.PrAllowForwardable.getBody();
39670Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
39680Sstevel@tonic-gate         MainHelp.addElement(a);
39690Sstevel@tonic-gate 
39700Sstevel@tonic-gate         o = gui.PrAllowRenewable.getBody();
39710Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
39720Sstevel@tonic-gate         MainHelp.addElement(a);
39730Sstevel@tonic-gate 
39740Sstevel@tonic-gate         o = gui.PrAllowProxiable.getBody();
39750Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
39760Sstevel@tonic-gate         MainHelp.addElement(a);
39770Sstevel@tonic-gate 
39780Sstevel@tonic-gate         o = gui.PrAllowSvr.getBody();
39790Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
39800Sstevel@tonic-gate         MainHelp.addElement(a);
39810Sstevel@tonic-gate 
39820Sstevel@tonic-gate         o = gui.PrAllowTGT.getBody();
39830Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
39840Sstevel@tonic-gate         MainHelp.addElement(a);
39850Sstevel@tonic-gate 
39860Sstevel@tonic-gate         o = gui.PrAllowDupAuth.getBody();
39870Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
39880Sstevel@tonic-gate         MainHelp.addElement(a);
39890Sstevel@tonic-gate 
39900Sstevel@tonic-gate         o = gui.PrRequirePreAuth.getBody();
39910Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
39920Sstevel@tonic-gate         MainHelp.addElement(a);
39930Sstevel@tonic-gate 
39940Sstevel@tonic-gate         o = gui.PrRequireHwPreAuth.getBody();
39950Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
39960Sstevel@tonic-gate         MainHelp.addElement(a);
39970Sstevel@tonic-gate     }
39980Sstevel@tonic-gate 
39990Sstevel@tonic-gate     public void setupMainHelpFixers() {
40000Sstevel@tonic-gate         MainFixers = new Vector(10, 10);
40010Sstevel@tonic-gate         Object o;
40020Sstevel@tonic-gate         Association a;
40030Sstevel@tonic-gate         TextFixer tf;
40040Sstevel@tonic-gate         ChoiceFixer cf;
40050Sstevel@tonic-gate 
40060Sstevel@tonic-gate         o = gui.PrListPattern.getBody();
40070Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
40080Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
40090Sstevel@tonic-gate         MainFixers.addElement(a);
40100Sstevel@tonic-gate 
40110Sstevel@tonic-gate         o = gui.PrName1.getBody();
40120Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
40130Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
40140Sstevel@tonic-gate         MainFixers.addElement(a);
40150Sstevel@tonic-gate 
40160Sstevel@tonic-gate         o = gui.PrComments.getBody();
40170Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
40180Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
40190Sstevel@tonic-gate         MainFixers.addElement(a);
40200Sstevel@tonic-gate 
40210Sstevel@tonic-gate         o = gui.PrPolicy.getBody();
40220Sstevel@tonic-gate         cf = new ChoiceFixer((Choice)o);
40230Sstevel@tonic-gate         a = new Association(o, cf, CHOICE_ITEM);
40240Sstevel@tonic-gate         MainFixers.addElement(a);
40250Sstevel@tonic-gate 
40260Sstevel@tonic-gate         o = gui.PrPassword.getBody();
40270Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
40280Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
40290Sstevel@tonic-gate         MainFixers.addElement(a);
40300Sstevel@tonic-gate 
40310Sstevel@tonic-gate         o = gui.PrExpiry.getBody();
40320Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
40330Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
40340Sstevel@tonic-gate         MainFixers.addElement(a);
4035*96Ssemery 
4036*96Ssemery         o = gui.EncList.getBody();
4037*96Ssemery         tf = new TextFixer((TextField)o);
4038*96Ssemery         a = new Association(o, tf, TEXTFIELD_KEY);
4039*96Ssemery         MainFixers.addElement(a);
40400Sstevel@tonic-gate 
40410Sstevel@tonic-gate         o = gui.PrPwExpiry.getBody();
40420Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
40430Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
40440Sstevel@tonic-gate         MainFixers.addElement(a);
40450Sstevel@tonic-gate 
40460Sstevel@tonic-gate         o = gui.PrKvno.getBody();
40470Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
40480Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
40490Sstevel@tonic-gate         MainFixers.addElement(a);
40500Sstevel@tonic-gate 
40510Sstevel@tonic-gate         o = gui.PrMaxLifetime.getBody();
40520Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
40530Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
40540Sstevel@tonic-gate         MainFixers.addElement(a);
40550Sstevel@tonic-gate 
40560Sstevel@tonic-gate         o = gui.PrMaxRenewal.getBody();
40570Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
40580Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
40590Sstevel@tonic-gate         MainFixers.addElement(a);
40600Sstevel@tonic-gate 
40610Sstevel@tonic-gate         o = gui.PoListPattern.getBody();
40620Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
40630Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
40640Sstevel@tonic-gate         MainFixers.addElement(a);
40650Sstevel@tonic-gate 
40660Sstevel@tonic-gate         o = gui.PoName.getBody();
40670Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
40680Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
40690Sstevel@tonic-gate         MainFixers.addElement(a);
40700Sstevel@tonic-gate 
40710Sstevel@tonic-gate         o = gui.PoMinPwLength.getBody();
40720Sstevel@tonic-gate         cf = new ChoiceFixer((Choice)o);
40730Sstevel@tonic-gate         a = new Association(o, cf, CHOICE_ITEM);
40740Sstevel@tonic-gate         MainFixers.addElement(a);
40750Sstevel@tonic-gate 
40760Sstevel@tonic-gate         o = gui.PoMinPwClass.getBody();
40770Sstevel@tonic-gate         cf = new ChoiceFixer((Choice)o);
40780Sstevel@tonic-gate         a = new Association(o, cf, CHOICE_ITEM);
40790Sstevel@tonic-gate         MainFixers.addElement(a);
40800Sstevel@tonic-gate 
40810Sstevel@tonic-gate         o = gui.PoSavedPasswords.getBody();
40820Sstevel@tonic-gate         cf = new ChoiceFixer((Choice)o);
40830Sstevel@tonic-gate         a = new Association(o, cf, CHOICE_ITEM);
40840Sstevel@tonic-gate         MainFixers.addElement(a);
40850Sstevel@tonic-gate 
40860Sstevel@tonic-gate         o = gui.PoMinTicketLifetime.getBody();
40870Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
40880Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
40890Sstevel@tonic-gate         MainFixers.addElement(a);
40900Sstevel@tonic-gate 
40910Sstevel@tonic-gate         o = gui.PoMaxTicketLifetime.getBody();
40920Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
40930Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
40940Sstevel@tonic-gate         MainFixers.addElement(a);
40950Sstevel@tonic-gate 
40960Sstevel@tonic-gate         setListeners(MainFixers, true);
40970Sstevel@tonic-gate     }
40980Sstevel@tonic-gate 
40990Sstevel@tonic-gate     public void setupDefaultsNormalListeners() {
41000Sstevel@tonic-gate 
41010Sstevel@tonic-gate         if (defaultsNormal == null) {
41020Sstevel@tonic-gate             defaultsNormal = new Vector(10, 10);
41030Sstevel@tonic-gate             ActionListener al;
41040Sstevel@tonic-gate             ItemListener il;
41050Sstevel@tonic-gate             KeyListener kl = new KeystrokeDetector(DEFAULTS_EDITING);
41060Sstevel@tonic-gate             Association a;
41070Sstevel@tonic-gate             Object o;
41080Sstevel@tonic-gate 
41090Sstevel@tonic-gate             // Action listeners for Defaults
41100Sstevel@tonic-gate 
41110Sstevel@tonic-gate             il = new GlobalLockAcctAction();
41120Sstevel@tonic-gate             o = defaults.disableAccount;
41130Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
41140Sstevel@tonic-gate             defaultsNormal.addElement(a);
41150Sstevel@tonic-gate 
41160Sstevel@tonic-gate             il = new GlobalForcePwChangeAction();
41170Sstevel@tonic-gate             o = defaults.forcePasswordChange;
41180Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
41190Sstevel@tonic-gate             defaultsNormal.addElement(a);
41200Sstevel@tonic-gate 
41210Sstevel@tonic-gate             il = new GlobalAllowPostdatedAction();
41220Sstevel@tonic-gate             o = defaults.allowPostdatedTix;
41230Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
41240Sstevel@tonic-gate             defaultsNormal.addElement(a);
41250Sstevel@tonic-gate 
41260Sstevel@tonic-gate             il = new GlobalAllowForwardableAction();
41270Sstevel@tonic-gate             o = defaults.allowForwardableTix;
41280Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
41290Sstevel@tonic-gate             defaultsNormal.addElement(a);
41300Sstevel@tonic-gate 
41310Sstevel@tonic-gate             il = new GlobalAllowRenewableAction();
41320Sstevel@tonic-gate             o = defaults.allowRenewableTix;
41330Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
41340Sstevel@tonic-gate             defaultsNormal.addElement(a);
41350Sstevel@tonic-gate 
41360Sstevel@tonic-gate             il = new GlobalAllowProxiableAction();
41370Sstevel@tonic-gate             o = defaults.allowProxiableTix;
41380Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
41390Sstevel@tonic-gate             defaultsNormal.addElement(a);
41400Sstevel@tonic-gate 
41410Sstevel@tonic-gate             il = new GlobalAllowSvrAction();
41420Sstevel@tonic-gate             o = defaults.allowServiceTix;
41430Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
41440Sstevel@tonic-gate             defaultsNormal.addElement(a);
41450Sstevel@tonic-gate 
41460Sstevel@tonic-gate             il = new GlobalAllowTGTAction();
41470Sstevel@tonic-gate             o = defaults.allowTGTAuth;
41480Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
41490Sstevel@tonic-gate             defaultsNormal.addElement(a);
41500Sstevel@tonic-gate 
41510Sstevel@tonic-gate             il = new GlobalAllowDupAuthAction();
41520Sstevel@tonic-gate             o = defaults.allowDupAuth;
41530Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
41540Sstevel@tonic-gate             defaultsNormal.addElement(a);
41550Sstevel@tonic-gate 
41560Sstevel@tonic-gate             il = new GlobalRequirePreAuthAction();
41570Sstevel@tonic-gate             o = defaults.requirePreauth;
41580Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
41590Sstevel@tonic-gate             defaultsNormal.addElement(a);
41600Sstevel@tonic-gate 
41610Sstevel@tonic-gate             il = new GlobalRequireHwPreAuthAction();
41620Sstevel@tonic-gate             o = defaults.requireHWAuth;
41630Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
41640Sstevel@tonic-gate             defaultsNormal.addElement(a);
41650Sstevel@tonic-gate 
41660Sstevel@tonic-gate             il = new GlobalDefaultServerSideAction();
41670Sstevel@tonic-gate             o = defaults.serverSide;
41680Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
41690Sstevel@tonic-gate             defaultsNormal.addElement(a);
41700Sstevel@tonic-gate 
41710Sstevel@tonic-gate             al = new GlobalDefaultRenewableLifeAction();
41720Sstevel@tonic-gate             o = defaults.maxTicketRenewableLife;
41730Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
41740Sstevel@tonic-gate             defaultsNormal.addElement(a);
41750Sstevel@tonic-gate             a = new Association(o, kl, TEXTFIELD_KEY);
41760Sstevel@tonic-gate             defaultsNormal.addElement(a);
41770Sstevel@tonic-gate 
41780Sstevel@tonic-gate             al = new GlobalDefaultLifeAction();
41790Sstevel@tonic-gate             o = defaults.maxTicketLife;
41800Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
41810Sstevel@tonic-gate             defaultsNormal.addElement(a);
41820Sstevel@tonic-gate             a = new Association(o, kl, TEXTFIELD_KEY);
41830Sstevel@tonic-gate             defaultsNormal.addElement(a);
41840Sstevel@tonic-gate 
41850Sstevel@tonic-gate             al = new GlobalDefaultExpiryAction();
41860Sstevel@tonic-gate             o = defaults.accountExpiryDate;
41870Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
41880Sstevel@tonic-gate             defaultsNormal.addElement(a);
41890Sstevel@tonic-gate             a = new Association(o, kl, TEXTFIELD_KEY);
41900Sstevel@tonic-gate             defaultsNormal.addElement(a);
41910Sstevel@tonic-gate 
41920Sstevel@tonic-gate             il = new GlobalDefaultShowListsAction();
41930Sstevel@tonic-gate             o = defaults.showLists;
41940Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
41950Sstevel@tonic-gate             defaultsNormal.addElement(a);
41960Sstevel@tonic-gate 
41970Sstevel@tonic-gate             il = new GlobalDefaultStaticListsAction();
41980Sstevel@tonic-gate             o = defaults.staticLists;
41990Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
42000Sstevel@tonic-gate             defaultsNormal.addElement(a);
42010Sstevel@tonic-gate 
42020Sstevel@tonic-gate             al = new GlobalDefaultCacheTimeAction();
42030Sstevel@tonic-gate             o = defaults.cacheTime;
42040Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
42050Sstevel@tonic-gate             defaultsNormal.addElement(a);
42060Sstevel@tonic-gate             a = new Association(o, kl, TEXTFIELD_KEY);
42070Sstevel@tonic-gate             defaultsNormal.addElement(a);
42080Sstevel@tonic-gate 
42090Sstevel@tonic-gate             al = new GlobalSaveAction();
42100Sstevel@tonic-gate             o = defaults.saveButton;
42110Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
42120Sstevel@tonic-gate             defaultsNormal.addElement(a);
42130Sstevel@tonic-gate 
42140Sstevel@tonic-gate             al = new GlobalApplyAction();
42150Sstevel@tonic-gate             o = defaults.applyButton;
42160Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
42170Sstevel@tonic-gate             defaultsNormal.addElement(a);
42180Sstevel@tonic-gate 
42190Sstevel@tonic-gate             al = new GlobalCancelAction();
42200Sstevel@tonic-gate             o = defaults.cancelButton;
42210Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
42220Sstevel@tonic-gate             defaultsNormal.addElement(a);
42230Sstevel@tonic-gate 
42240Sstevel@tonic-gate             DateTimeListener dtl = new DateTimeListener(
42250Sstevel@tonic-gate 			defaults.accountExpiryDate, defaultsEditingFrame);
42260Sstevel@tonic-gate             o = defaults.dateMoreButton;
42270Sstevel@tonic-gate             a = new Association(o, dtl, BUTTON_ACTION);
42280Sstevel@tonic-gate             defaultsNormal.addElement(a);
42290Sstevel@tonic-gate 
42300Sstevel@tonic-gate             DurationListener dl = new DurationListener(
42310Sstevel@tonic-gate 		       defaults.maxTicketRenewableLife, defaultsEditingFrame);
42320Sstevel@tonic-gate             o = defaults.renewalMoreButton;
42330Sstevel@tonic-gate             a = new Association(o, dl, BUTTON_ACTION);
42340Sstevel@tonic-gate             defaultsNormal.addElement(a);
42350Sstevel@tonic-gate 
42360Sstevel@tonic-gate             dl = new DurationListener(defaults.maxTicketLife,
42370Sstevel@tonic-gate 				      defaultsEditingFrame);
42380Sstevel@tonic-gate             o = defaults.lifeMoreButton;
42390Sstevel@tonic-gate             a = new Association(o, dl, BUTTON_ACTION);
42400Sstevel@tonic-gate             defaultsNormal.addElement(a);
42410Sstevel@tonic-gate 
42420Sstevel@tonic-gate             dl = new DurationListener(defaults.cacheTime, defaultsEditingFrame);
42430Sstevel@tonic-gate             o = defaults.cacheMoreButton;
42440Sstevel@tonic-gate             a = new Association(o, dl, BUTTON_ACTION);
42450Sstevel@tonic-gate             defaultsNormal.addElement(a);
42460Sstevel@tonic-gate 
42470Sstevel@tonic-gate         }
42480Sstevel@tonic-gate         setListeners(defaultsHelp, false);
42490Sstevel@tonic-gate         setListeners(defaultsFixers, false);
42500Sstevel@tonic-gate         setListeners(defaultsNormal, true);
42510Sstevel@tonic-gate         defaultsHelpMode = false;
42520Sstevel@tonic-gate     }
42530Sstevel@tonic-gate 
42540Sstevel@tonic-gate     public void setupDefaultsHelpListeners() {
42550Sstevel@tonic-gate         if (defaultsHelp == null) {
42560Sstevel@tonic-gate             defaultsHelp = new Vector(10, 10);
42570Sstevel@tonic-gate             MouseListener ml = new HelpListener();
42580Sstevel@tonic-gate             Association a;
42590Sstevel@tonic-gate             Object o;
42600Sstevel@tonic-gate 
42610Sstevel@tonic-gate             o = defaults.disableAccount;
42620Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
42630Sstevel@tonic-gate             defaultsHelp.addElement(a);
42640Sstevel@tonic-gate             defaults.disableAccount.setName("GlobalLockAcct" /* NOI18N */);
42650Sstevel@tonic-gate 
42660Sstevel@tonic-gate             o = defaults.forcePasswordChange;
42670Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
42680Sstevel@tonic-gate             defaultsHelp.addElement(a);
42690Sstevel@tonic-gate             defaults.forcePasswordChange.setName("GlobalForcePwChange"
42700Sstevel@tonic-gate 						 /* NOI18N */);
42710Sstevel@tonic-gate 
42720Sstevel@tonic-gate             o = defaults.allowPostdatedTix;
42730Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
42740Sstevel@tonic-gate             defaultsHelp.addElement(a);
42750Sstevel@tonic-gate             defaults.allowPostdatedTix.setName("GlobalAllowPostdated"
42760Sstevel@tonic-gate 					       /* NOI18N */);
42770Sstevel@tonic-gate 
42780Sstevel@tonic-gate             o = defaults.allowForwardableTix;
42790Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
42800Sstevel@tonic-gate             defaultsHelp.addElement(a);
42810Sstevel@tonic-gate             defaults.allowForwardableTix.setName("GlobalAllowForwardable"
42820Sstevel@tonic-gate 						 /* NOI18N */);
42830Sstevel@tonic-gate 
42840Sstevel@tonic-gate             o = defaults.allowRenewableTix;
42850Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
42860Sstevel@tonic-gate             defaultsHelp.addElement(a);
42870Sstevel@tonic-gate             defaults.allowRenewableTix.setName("GlobalAllowRenewable"
42880Sstevel@tonic-gate 					       /* NOI18N */);
42890Sstevel@tonic-gate 
42900Sstevel@tonic-gate             o = defaults.allowProxiableTix;
42910Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
42920Sstevel@tonic-gate             defaultsHelp.addElement(a);
42930Sstevel@tonic-gate             defaults.allowProxiableTix.setName("GlobalAllowProxiable"
42940Sstevel@tonic-gate 					       /* NOI18N */);
42950Sstevel@tonic-gate 
42960Sstevel@tonic-gate             o = defaults.allowServiceTix;
42970Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
42980Sstevel@tonic-gate             defaultsHelp.addElement(a);
42990Sstevel@tonic-gate             defaults.allowServiceTix.setName("GlobalAllowSvr" /* NOI18N */);
43000Sstevel@tonic-gate 
43010Sstevel@tonic-gate             o = defaults.allowTGTAuth;
43020Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
43030Sstevel@tonic-gate             defaultsHelp.addElement(a);
43040Sstevel@tonic-gate             defaults.allowTGTAuth.setName("GlobalAllowTGT" /* NOI18N */);
43050Sstevel@tonic-gate 
43060Sstevel@tonic-gate             o = defaults.allowDupAuth;
43070Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
43080Sstevel@tonic-gate             defaultsHelp.addElement(a);
43090Sstevel@tonic-gate             defaults.allowDupAuth.setName("GlobalAllowDupAuth" /* NOI18N */);
43100Sstevel@tonic-gate 
43110Sstevel@tonic-gate             o = defaults.requirePreauth;
43120Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
43130Sstevel@tonic-gate             defaultsHelp.addElement(a);
43140Sstevel@tonic-gate             defaults.requirePreauth.setName("GlobalRequirePreAuth"
43150Sstevel@tonic-gate 					    /* NOI18N */);
43160Sstevel@tonic-gate 
43170Sstevel@tonic-gate             o = defaults.requireHWAuth;
43180Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
43190Sstevel@tonic-gate             defaultsHelp.addElement(a);
43200Sstevel@tonic-gate             defaults.requireHWAuth.setName("GlobalRequireHwPreAuth"
43210Sstevel@tonic-gate 					   /* NOI18N */);
43220Sstevel@tonic-gate 
43230Sstevel@tonic-gate             o = defaults.serverSide;
43240Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
43250Sstevel@tonic-gate             defaultsHelp.addElement(a);
43260Sstevel@tonic-gate             defaults.serverSide.setName("GlDefServerSide" /* NOI18N */);
43270Sstevel@tonic-gate 
43280Sstevel@tonic-gate             o = defaults.maxTicketRenewableLife;
43290Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
43300Sstevel@tonic-gate             defaultsHelp.addElement(a);
43310Sstevel@tonic-gate             defaults.maxTicketRenewableLife.setName("GlDefRenewableLife"
43320Sstevel@tonic-gate 						    /* NOI18N */);
43330Sstevel@tonic-gate 
43340Sstevel@tonic-gate             o = defaults.maxTicketRenewableLifeLabel;
43350Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
43360Sstevel@tonic-gate             defaultsHelp.addElement(a);
43370Sstevel@tonic-gate             defaults.maxTicketRenewableLifeLabel.setName("GlDefRenewableLife"
43380Sstevel@tonic-gate 							 /* NOI18N */);
43390Sstevel@tonic-gate 
43400Sstevel@tonic-gate             o = defaults.maxTicketLife;
43410Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
43420Sstevel@tonic-gate             defaultsHelp.addElement(a);
43430Sstevel@tonic-gate             defaults.maxTicketLife.setName("GlDefLife" /* NOI18N */);
43440Sstevel@tonic-gate 
43450Sstevel@tonic-gate             o = defaults.maxTicketLifeLabel;
43460Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
43470Sstevel@tonic-gate             defaultsHelp.addElement(a);
43480Sstevel@tonic-gate             defaults.maxTicketLifeLabel.setName("GlDefLife" /* NOI18N */);
43490Sstevel@tonic-gate 
43500Sstevel@tonic-gate             o = defaults.accountExpiryDate;
43510Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
43520Sstevel@tonic-gate             defaultsHelp.addElement(a);
43530Sstevel@tonic-gate             defaults.accountExpiryDate.setName("GlDefExpiry" /* NOI18N */);
43540Sstevel@tonic-gate 
43550Sstevel@tonic-gate             o = defaults.accountExpiryDateLabel;
43560Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
43570Sstevel@tonic-gate             defaultsHelp.addElement(a);
43580Sstevel@tonic-gate             defaults.accountExpiryDateLabel.setName("GlDefExpiry" /* NOI18N */);
43590Sstevel@tonic-gate 
43600Sstevel@tonic-gate             o = defaults.showLists;
43610Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
43620Sstevel@tonic-gate             defaultsHelp.addElement(a);
43630Sstevel@tonic-gate             defaults.showLists.setName("GlDefShowLists" /* NOI18N */);
43640Sstevel@tonic-gate 
43650Sstevel@tonic-gate             o = defaults.staticLists;
43660Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
43670Sstevel@tonic-gate             defaultsHelp.addElement(a);
43680Sstevel@tonic-gate             defaults.staticLists.setName("GlDefStaticLists" /* NOI18N */);
43690Sstevel@tonic-gate 
43700Sstevel@tonic-gate             o = defaults.cacheTime;
43710Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
43720Sstevel@tonic-gate             defaultsHelp.addElement(a);
43730Sstevel@tonic-gate             defaults.cacheTime.setName("GlDefCacheTime" /* NOI18N */);
43740Sstevel@tonic-gate 
43750Sstevel@tonic-gate             o = defaults.cacheTimeLabel;
43760Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
43770Sstevel@tonic-gate             defaultsHelp.addElement(a);
43780Sstevel@tonic-gate             defaults.cacheTimeLabel.setName("GlDefCacheTime" /* NOI18N */);
43790Sstevel@tonic-gate 
43800Sstevel@tonic-gate             o = defaults.saveButton;
43810Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
43820Sstevel@tonic-gate             defaultsHelp.addElement(a);
43830Sstevel@tonic-gate             defaults.saveButton.setName("GlobalSave" /* NOI18N */);
43840Sstevel@tonic-gate 
43850Sstevel@tonic-gate             o = defaults.applyButton;
43860Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
43870Sstevel@tonic-gate             defaultsHelp.addElement(a);
43880Sstevel@tonic-gate             defaults.applyButton.setName("GlobalApply" /* NOI18N */);
43890Sstevel@tonic-gate 
43900Sstevel@tonic-gate             o = defaults.cancelButton;
43910Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
43920Sstevel@tonic-gate             defaultsHelp.addElement(a);
43930Sstevel@tonic-gate             defaults.cancelButton.setName("GlobalCancel" /* NOI18N */);
43940Sstevel@tonic-gate 
43950Sstevel@tonic-gate             o = defaults.dateMoreButton;
43960Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
43970Sstevel@tonic-gate             defaultsHelp.addElement(a);
43980Sstevel@tonic-gate             defaults.dateMoreButton.setName("DateHelperButton" /* NOI18N */);
43990Sstevel@tonic-gate 
44000Sstevel@tonic-gate             o = defaults.lifeMoreButton;
44010Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
44020Sstevel@tonic-gate             defaultsHelp.addElement(a);
44030Sstevel@tonic-gate             defaults.lifeMoreButton.setName("DurationHelperButton"
44040Sstevel@tonic-gate 					    /* NOI18N */);
44050Sstevel@tonic-gate 
44060Sstevel@tonic-gate             o = defaults.renewalMoreButton;
44070Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
44080Sstevel@tonic-gate             defaultsHelp.addElement(a);
44090Sstevel@tonic-gate             defaults.renewalMoreButton.setName("DurationHelperButton"
44100Sstevel@tonic-gate 					       /* NOI18N */);
44110Sstevel@tonic-gate 
44120Sstevel@tonic-gate             o = defaults.cacheMoreButton;
44130Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
44140Sstevel@tonic-gate             defaultsHelp.addElement(a);
44150Sstevel@tonic-gate             defaults.cacheMoreButton.setName("DurationHelperButton"
44160Sstevel@tonic-gate 					     /* NOI18N */);
44170Sstevel@tonic-gate 
44180Sstevel@tonic-gate             setupDefaultsHelpFlagTogglers();
44190Sstevel@tonic-gate         }
44200Sstevel@tonic-gate 
44210Sstevel@tonic-gate         setListeners(defaultsNormal, false);
44220Sstevel@tonic-gate         setListeners(defaultsHelp, true);
44230Sstevel@tonic-gate         setupDefaultsHelpFixers();
44240Sstevel@tonic-gate         defaultsHelpMode = true;
44250Sstevel@tonic-gate     }
44260Sstevel@tonic-gate 
44270Sstevel@tonic-gate     /**
44280Sstevel@tonic-gate      * Helper method to setupDefaultsHelpListeners. Should be called from
44290Sstevel@tonic-gate      * only from there.
44300Sstevel@tonic-gate      */
44310Sstevel@tonic-gate     private void 	setupDefaultsHelpFlagTogglers() {
44320Sstevel@tonic-gate 
44330Sstevel@tonic-gate         if (defaultsHelp == null)
44340Sstevel@tonic-gate             return;
44350Sstevel@tonic-gate 
44360Sstevel@tonic-gate         CheckboxToggler ml = new CheckboxToggler();
44370Sstevel@tonic-gate         Object o;
44380Sstevel@tonic-gate         Association a;
44390Sstevel@tonic-gate 
44400Sstevel@tonic-gate         o = defaults.disableAccount;
44410Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
44420Sstevel@tonic-gate         defaultsHelp.addElement(a);
44430Sstevel@tonic-gate 
44440Sstevel@tonic-gate         o = defaults.forcePasswordChange;
44450Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
44460Sstevel@tonic-gate         defaultsHelp.addElement(a);
44470Sstevel@tonic-gate 
44480Sstevel@tonic-gate         o = defaults.allowPostdatedTix;
44490Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
44500Sstevel@tonic-gate         defaultsHelp.addElement(a);
44510Sstevel@tonic-gate 
44520Sstevel@tonic-gate         o = defaults.allowForwardableTix;
44530Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
44540Sstevel@tonic-gate         defaultsHelp.addElement(a);
44550Sstevel@tonic-gate 
44560Sstevel@tonic-gate         o = defaults.allowRenewableTix;
44570Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
44580Sstevel@tonic-gate         defaultsHelp.addElement(a);
44590Sstevel@tonic-gate 
44600Sstevel@tonic-gate         o = defaults.allowProxiableTix;
44610Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
44620Sstevel@tonic-gate         defaultsHelp.addElement(a);
44630Sstevel@tonic-gate 
44640Sstevel@tonic-gate         o = defaults.allowServiceTix;
44650Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
44660Sstevel@tonic-gate         defaultsHelp.addElement(a);
44670Sstevel@tonic-gate 
44680Sstevel@tonic-gate         o = defaults.allowTGTAuth;
44690Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
44700Sstevel@tonic-gate         defaultsHelp.addElement(a);
44710Sstevel@tonic-gate 
44720Sstevel@tonic-gate         o = defaults.allowDupAuth;
44730Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
44740Sstevel@tonic-gate         defaultsHelp.addElement(a);
44750Sstevel@tonic-gate 
44760Sstevel@tonic-gate         o = defaults.requirePreauth;
44770Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
44780Sstevel@tonic-gate         defaultsHelp.addElement(a);
44790Sstevel@tonic-gate 
44800Sstevel@tonic-gate         o = defaults.requireHWAuth;
44810Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
44820Sstevel@tonic-gate         defaultsHelp.addElement(a);
44830Sstevel@tonic-gate 
44840Sstevel@tonic-gate         o = defaults.showLists;
44850Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
44860Sstevel@tonic-gate         defaultsHelp.addElement(a);
44870Sstevel@tonic-gate 
44880Sstevel@tonic-gate         o = defaults.serverSide;
44890Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
44900Sstevel@tonic-gate         defaultsHelp.addElement(a);
44910Sstevel@tonic-gate 
44920Sstevel@tonic-gate         o = defaults.staticLists;
44930Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
44940Sstevel@tonic-gate         defaultsHelp.addElement(a);
44950Sstevel@tonic-gate     }
44960Sstevel@tonic-gate 
44970Sstevel@tonic-gate     public void setupDefaultsHelpFixers() {
44980Sstevel@tonic-gate         defaultsFixers = new Vector(10, 10);
44990Sstevel@tonic-gate         Association a;
45000Sstevel@tonic-gate         Object o;
45010Sstevel@tonic-gate         TextFixer tf;
45020Sstevel@tonic-gate 
45030Sstevel@tonic-gate         o = defaults.maxTicketRenewableLife;
45040Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
45050Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
45060Sstevel@tonic-gate         defaultsFixers.addElement(a);
45070Sstevel@tonic-gate 
45080Sstevel@tonic-gate         o = defaults.maxTicketLife;
45090Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
45100Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
45110Sstevel@tonic-gate         defaultsFixers.addElement(a);
45120Sstevel@tonic-gate 
45130Sstevel@tonic-gate         o = defaults.accountExpiryDate;
45140Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
45150Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
45160Sstevel@tonic-gate         defaultsFixers.addElement(a);
45170Sstevel@tonic-gate 
45180Sstevel@tonic-gate         o = defaults.cacheTime;
45190Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
45200Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
45210Sstevel@tonic-gate         defaultsFixers.addElement(a);
45220Sstevel@tonic-gate 
45230Sstevel@tonic-gate         setListeners(defaultsFixers, true);
45240Sstevel@tonic-gate     }
45250Sstevel@tonic-gate 
45260Sstevel@tonic-gate     /**
45270Sstevel@tonic-gate      * Set up listeners from a vector of Associations objects
45280Sstevel@tonic-gate      *
45290Sstevel@tonic-gate      */
45300Sstevel@tonic-gate     public void setListeners(Vector associations, boolean install) {
45310Sstevel@tonic-gate         setListeners(associations, install, false);
45320Sstevel@tonic-gate     }
45330Sstevel@tonic-gate 
45340Sstevel@tonic-gate     public void setListeners(Vector associations, boolean install, boolean loud)
45350Sstevel@tonic-gate     {
45360Sstevel@tonic-gate         Association a;
45370Sstevel@tonic-gate         Button b;
45380Sstevel@tonic-gate         TextField t;
45390Sstevel@tonic-gate         Choice c;
45400Sstevel@tonic-gate         Checkbox x;
45410Sstevel@tonic-gate         Label z;
45420Sstevel@tonic-gate         Window w;
45430Sstevel@tonic-gate 
45440Sstevel@tonic-gate         if (associations != null) {
45450Sstevel@tonic-gate             for (int i = 0; i < associations.size(); i++) {
45460Sstevel@tonic-gate                 a = (Association)associations.elementAt(i);
45470Sstevel@tonic-gate                 int type = a.Type;
45480Sstevel@tonic-gate                 EventListener el = a.Listener;
45490Sstevel@tonic-gate                 if (loud) {
45500Sstevel@tonic-gate                     Object o = a.Object;
45510Sstevel@tonic-gate                     String flag = install ? "install" : "deinstall";
45520Sstevel@tonic-gate                     System.out.println(flag+
45530Sstevel@tonic-gate 				       "ing listener "+el+" on component "+o);
45540Sstevel@tonic-gate                 }
45550Sstevel@tonic-gate 
45560Sstevel@tonic-gate                 switch (type) {
45570Sstevel@tonic-gate 		case BUTTON_ACTION:
45580Sstevel@tonic-gate                     b = (Button)a.Object;
45590Sstevel@tonic-gate                     if (install)
45600Sstevel@tonic-gate                         b.addActionListener((ActionListener)el);
45610Sstevel@tonic-gate                     else
45620Sstevel@tonic-gate                         b.removeActionListener((ActionListener)el);
45630Sstevel@tonic-gate                     break;
45640Sstevel@tonic-gate 
45650Sstevel@tonic-gate 		case BUTTON_MOUSE:
45660Sstevel@tonic-gate                     b = (Button)a.Object;
45670Sstevel@tonic-gate                     if (install)
45680Sstevel@tonic-gate                         b.addMouseListener((MouseListener)el);
45690Sstevel@tonic-gate                     else
45700Sstevel@tonic-gate                         b.removeMouseListener((MouseListener)el);
45710Sstevel@tonic-gate                     break;
45720Sstevel@tonic-gate 
45730Sstevel@tonic-gate 		case TEXTFIELD_ACTION:
45740Sstevel@tonic-gate                     t = (TextField)a.Object;
45750Sstevel@tonic-gate                     if (install)
45760Sstevel@tonic-gate                         t.addActionListener((ActionListener)el);
45770Sstevel@tonic-gate                     else
45780Sstevel@tonic-gate                         t.removeActionListener((ActionListener)el);
45790Sstevel@tonic-gate                     break;
45800Sstevel@tonic-gate 
45810Sstevel@tonic-gate 		case TEXTFIELD_MOUSE:
45820Sstevel@tonic-gate                     t = (TextField)a.Object;
45830Sstevel@tonic-gate                     if (install)
45840Sstevel@tonic-gate                         t.addMouseListener((MouseListener)el);
45850Sstevel@tonic-gate                     else
45860Sstevel@tonic-gate                         t.removeMouseListener((MouseListener)el);
45870Sstevel@tonic-gate                     break;
45880Sstevel@tonic-gate 
45890Sstevel@tonic-gate 		case TEXTFIELD_KEY:
45900Sstevel@tonic-gate                     t = (TextField)a.Object;
45910Sstevel@tonic-gate                     if (install)
45920Sstevel@tonic-gate                         t.addKeyListener((KeyListener)el);
45930Sstevel@tonic-gate                     else
45940Sstevel@tonic-gate                         t.removeKeyListener((KeyListener)el);
45950Sstevel@tonic-gate                     break;
45960Sstevel@tonic-gate 
45970Sstevel@tonic-gate 		case CHOICE_ITEM:
45980Sstevel@tonic-gate                     c = (Choice)a.Object;
45990Sstevel@tonic-gate                     if (install)
46000Sstevel@tonic-gate                         c.addItemListener((ItemListener)el);
46010Sstevel@tonic-gate                     else
46020Sstevel@tonic-gate                         c.removeItemListener((ItemListener)el);
46030Sstevel@tonic-gate                     break;
46040Sstevel@tonic-gate 
46050Sstevel@tonic-gate 		case CHOICE_MOUSE:
46060Sstevel@tonic-gate                     c = (Choice)a.Object;
46070Sstevel@tonic-gate                     if (install)
46080Sstevel@tonic-gate                         c.addMouseListener((MouseListener)el);
46090Sstevel@tonic-gate                     else
46100Sstevel@tonic-gate                         c.removeMouseListener((MouseListener)el);
46110Sstevel@tonic-gate                     break;
46120Sstevel@tonic-gate 
46130Sstevel@tonic-gate 		case CHECKBOX_ITEM:
46140Sstevel@tonic-gate                     x = (Checkbox)a.Object;
46150Sstevel@tonic-gate                     if (install)
46160Sstevel@tonic-gate                         x.addItemListener((ItemListener)el);
46170Sstevel@tonic-gate                     else
46180Sstevel@tonic-gate                         x.removeItemListener((ItemListener)el);
46190Sstevel@tonic-gate                     break;
46200Sstevel@tonic-gate 
46210Sstevel@tonic-gate 		case CHECKBOX_MOUSE:
46220Sstevel@tonic-gate                     x = (Checkbox)a.Object;
46230Sstevel@tonic-gate                     if (install)
46240Sstevel@tonic-gate                         x.addMouseListener((MouseListener)el);
46250Sstevel@tonic-gate                     else
46260Sstevel@tonic-gate                         x.removeMouseListener((MouseListener)el);
46270Sstevel@tonic-gate                     break;
46280Sstevel@tonic-gate 
46290Sstevel@tonic-gate 		case LABEL_MOUSE:
46300Sstevel@tonic-gate                     z = (Label)a.Object;
46310Sstevel@tonic-gate                     if (install)
46320Sstevel@tonic-gate                         z.addMouseListener((MouseListener)el);
46330Sstevel@tonic-gate                     else
46340Sstevel@tonic-gate                         z.removeMouseListener((MouseListener)el);
46350Sstevel@tonic-gate                     break;
46360Sstevel@tonic-gate 
46370Sstevel@tonic-gate 		case WINDOW_LISTENER:
46380Sstevel@tonic-gate                     w = (Window)a.Object;
46390Sstevel@tonic-gate                     if (install)
46400Sstevel@tonic-gate                         w.addWindowListener((WindowListener)el);
46410Sstevel@tonic-gate                     else
46420Sstevel@tonic-gate                         w.removeWindowListener((WindowListener)el);
46430Sstevel@tonic-gate                     break;
46440Sstevel@tonic-gate                 }
46450Sstevel@tonic-gate             }
46460Sstevel@tonic-gate         }
46470Sstevel@tonic-gate     }
46480Sstevel@tonic-gate 
46490Sstevel@tonic-gate     /*
46500Sstevel@tonic-gate      * About a million actions here ...
46510Sstevel@tonic-gate      */
46520Sstevel@tonic-gate     private class LoginOKAction implements ActionListener {
46530Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
46540Sstevel@tonic-gate             loginComplete();
46550Sstevel@tonic-gate         }
46560Sstevel@tonic-gate     }
46570Sstevel@tonic-gate 
46580Sstevel@tonic-gate     private class LoginStartOverAction implements ActionListener {
46590Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
46600Sstevel@tonic-gate             setLoginDefaults();
46610Sstevel@tonic-gate         }
46620Sstevel@tonic-gate     }
46630Sstevel@tonic-gate 
46640Sstevel@tonic-gate     private class LoginNameAction implements ActionListener {
46650Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
46660Sstevel@tonic-gate             nameComplete();
46670Sstevel@tonic-gate         }
46680Sstevel@tonic-gate     }
46690Sstevel@tonic-gate 
46700Sstevel@tonic-gate     private class LoginPassAction implements ActionListener {
46710Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
46720Sstevel@tonic-gate             loginComplete();
46730Sstevel@tonic-gate         }
46740Sstevel@tonic-gate     }
46750Sstevel@tonic-gate 
46760Sstevel@tonic-gate     private class LoginRealmAction implements ActionListener {
46770Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
46780Sstevel@tonic-gate             newRealm();
46790Sstevel@tonic-gate         }
46800Sstevel@tonic-gate     }
46810Sstevel@tonic-gate 
46820Sstevel@tonic-gate     private class LoginServerAction implements ActionListener {
46830Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
46840Sstevel@tonic-gate             newServer();
46850Sstevel@tonic-gate         }
46860Sstevel@tonic-gate     }
46870Sstevel@tonic-gate 
46880Sstevel@tonic-gate     private class MainWindowCloseAction extends WindowAdapter {
46890Sstevel@tonic-gate         public void windowClosing(WindowEvent e) {
46900Sstevel@tonic-gate             checkLogout();
46910Sstevel@tonic-gate         }
46920Sstevel@tonic-gate     };
46930Sstevel@tonic-gate 
46940Sstevel@tonic-gate     private class PrListPatternAction implements ActionListener {
46950Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
46960Sstevel@tonic-gate             prPatternComplete();
46970Sstevel@tonic-gate         }
46980Sstevel@tonic-gate     }
46990Sstevel@tonic-gate 
47000Sstevel@tonic-gate     private class PrListClearAction implements ActionListener {
47010Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
47020Sstevel@tonic-gate             prPatternClear();
47030Sstevel@tonic-gate         }
47040Sstevel@tonic-gate     }
47050Sstevel@tonic-gate 
47060Sstevel@tonic-gate     private class PrListModifyAction implements ActionListener {
47070Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
47080Sstevel@tonic-gate             prModify();
47090Sstevel@tonic-gate         }
47100Sstevel@tonic-gate     }
47110Sstevel@tonic-gate 
47120Sstevel@tonic-gate     private class PrListAddAction implements ActionListener {
47130Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
47140Sstevel@tonic-gate             prAdd();
47150Sstevel@tonic-gate         }
47160Sstevel@tonic-gate     }
47170Sstevel@tonic-gate 
47180Sstevel@tonic-gate     private class PrListDeleteAction implements ActionListener {
47190Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
47200Sstevel@tonic-gate             prDelete();
47210Sstevel@tonic-gate         }
47220Sstevel@tonic-gate     }
47230Sstevel@tonic-gate 
47240Sstevel@tonic-gate     private class PrListDuplicateAction implements ActionListener {
47250Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
47260Sstevel@tonic-gate             prDuplicate();
47270Sstevel@tonic-gate         }
47280Sstevel@tonic-gate     }
47290Sstevel@tonic-gate 
47300Sstevel@tonic-gate     private class PrCommentsAction implements ActionListener {
47310Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
47320Sstevel@tonic-gate             setPrComments();
47330Sstevel@tonic-gate             prSetNeedSave();
47340Sstevel@tonic-gate         }
47350Sstevel@tonic-gate     }
47360Sstevel@tonic-gate 
47370Sstevel@tonic-gate     private class PrPolicyAction implements ItemListener {
47380Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
47390Sstevel@tonic-gate             setPrPolicy();
47400Sstevel@tonic-gate             prSetNeedSave();
47410Sstevel@tonic-gate         }
47420Sstevel@tonic-gate     }
47430Sstevel@tonic-gate 
47440Sstevel@tonic-gate     private class PrPasswordAction implements ActionListener {
47450Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
47460Sstevel@tonic-gate             setPrPassword(!prin.isNew);
47470Sstevel@tonic-gate             prSetNeedSave();
47480Sstevel@tonic-gate         }
47490Sstevel@tonic-gate     }
47500Sstevel@tonic-gate 
47510Sstevel@tonic-gate     private class PrRandomPwAction implements ActionListener {
47520Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
47530Sstevel@tonic-gate             genRandomPassword();
47540Sstevel@tonic-gate             prSetNeedSave();
47550Sstevel@tonic-gate         }
47560Sstevel@tonic-gate     }
4757*96Ssemery 
4758*96Ssemery     private class EncListAction implements ActionListener {
4759*96Ssemery         public void actionPerformed(ActionEvent e) {
4760*96Ssemery             setEncType();
4761*96Ssemery             prSetNeedSave();
4762*96Ssemery         }
4763*96Ssemery     }
47640Sstevel@tonic-gate 
47650Sstevel@tonic-gate     private class PrExpiryAction implements ActionListener {
47660Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
47670Sstevel@tonic-gate             setPrExpiry();
47680Sstevel@tonic-gate             prSetNeedSave();
47690Sstevel@tonic-gate         }
47700Sstevel@tonic-gate     }
47710Sstevel@tonic-gate 
47720Sstevel@tonic-gate     private class PrSaveAction implements ActionListener {
47730Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
47740Sstevel@tonic-gate             prSave();
47750Sstevel@tonic-gate         }
47760Sstevel@tonic-gate     }
47770Sstevel@tonic-gate 
47780Sstevel@tonic-gate     private class PrCancelAction implements ActionListener {
47790Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
47800Sstevel@tonic-gate             prCancel();
47810Sstevel@tonic-gate         }
47820Sstevel@tonic-gate     }
47830Sstevel@tonic-gate 
47840Sstevel@tonic-gate     private class PrBasicPreviousAction implements ActionListener {
47850Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
47860Sstevel@tonic-gate             prBasicPrevious();
47870Sstevel@tonic-gate         }
47880Sstevel@tonic-gate     }
47890Sstevel@tonic-gate 
47900Sstevel@tonic-gate     private class PrBasicNextAction implements ActionListener {
47910Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
47920Sstevel@tonic-gate             prBasicNext();
47930Sstevel@tonic-gate         }
47940Sstevel@tonic-gate     }
47950Sstevel@tonic-gate 
47960Sstevel@tonic-gate     private class PrPwExpiryAction implements ActionListener {
47970Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
47980Sstevel@tonic-gate             setPrPwExpiry();
47990Sstevel@tonic-gate             prSetNeedSave();
48000Sstevel@tonic-gate         }
48010Sstevel@tonic-gate     }
48020Sstevel@tonic-gate 
48030Sstevel@tonic-gate     private class PrKvnoAction implements ActionListener {
48040Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
48050Sstevel@tonic-gate             setPrKvno();
48060Sstevel@tonic-gate             prSetNeedSave();
48070Sstevel@tonic-gate         }
48080Sstevel@tonic-gate     }
48090Sstevel@tonic-gate 
48100Sstevel@tonic-gate     private class PrMaxLifetimeAction implements ActionListener {
48110Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
48120Sstevel@tonic-gate             setPrMaxlife();
48130Sstevel@tonic-gate             prSetNeedSave();
48140Sstevel@tonic-gate         }
48150Sstevel@tonic-gate     }
48160Sstevel@tonic-gate 
48170Sstevel@tonic-gate     private class PrMaxRenewalAction implements ActionListener {
48180Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
48190Sstevel@tonic-gate             setPrMaxrenew();
48200Sstevel@tonic-gate             prSetNeedSave();
48210Sstevel@tonic-gate         }
48220Sstevel@tonic-gate     }
48230Sstevel@tonic-gate 
48240Sstevel@tonic-gate     private class PrDetailPreviousAction implements ActionListener {
48250Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
48260Sstevel@tonic-gate             prDetailPrevious();
48270Sstevel@tonic-gate         }
48280Sstevel@tonic-gate     }
48290Sstevel@tonic-gate 
48300Sstevel@tonic-gate     private class PrDetailNextAction implements ActionListener {
48310Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
48320Sstevel@tonic-gate             prDetailNext();
48330Sstevel@tonic-gate         }
48340Sstevel@tonic-gate     }
48350Sstevel@tonic-gate 
48360Sstevel@tonic-gate     private class PrFlagsPreviousAction implements ActionListener {
48370Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
48380Sstevel@tonic-gate             prFlagsPrevious();
48390Sstevel@tonic-gate         }
48400Sstevel@tonic-gate     }
48410Sstevel@tonic-gate 
48420Sstevel@tonic-gate     private class PrLockAcctAction implements ItemListener {
48430Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
48440Sstevel@tonic-gate             setPrFlag(Flags.DISALLOW_ALL_TIX);
48450Sstevel@tonic-gate             prSetNeedSave();
48460Sstevel@tonic-gate         }
48470Sstevel@tonic-gate     }
48480Sstevel@tonic-gate 
48490Sstevel@tonic-gate     private class PrForcePwChangeAction implements ItemListener {
48500Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
48510Sstevel@tonic-gate             setPrFlag(Flags.REQUIRES_PWCHANGE);
48520Sstevel@tonic-gate             prSetNeedSave();
48530Sstevel@tonic-gate         }
48540Sstevel@tonic-gate     }
48550Sstevel@tonic-gate 
48560Sstevel@tonic-gate     private class PrAllowPostdatedAction implements ItemListener {
48570Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
48580Sstevel@tonic-gate             setPrFlag(Flags.DISALLOW_POSTDATED);
48590Sstevel@tonic-gate             prSetNeedSave();
48600Sstevel@tonic-gate         }
48610Sstevel@tonic-gate     }
48620Sstevel@tonic-gate 
48630Sstevel@tonic-gate     private class PrAllowForwardableAction implements ItemListener {
48640Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
48650Sstevel@tonic-gate             setPrFlag(Flags.DISALLOW_FORWARDABLE);
48660Sstevel@tonic-gate             prSetNeedSave();
48670Sstevel@tonic-gate         }
48680Sstevel@tonic-gate     }
48690Sstevel@tonic-gate 
48700Sstevel@tonic-gate     private class PrAllowRenewableAction implements ItemListener {
48710Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
48720Sstevel@tonic-gate             setPrFlag(Flags.DISALLOW_RENEWABLE);
48730Sstevel@tonic-gate             prSetNeedSave();
48740Sstevel@tonic-gate         }
48750Sstevel@tonic-gate     }
48760Sstevel@tonic-gate 
48770Sstevel@tonic-gate     private class PrAllowProxiableAction implements ItemListener {
48780Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
48790Sstevel@tonic-gate             setPrFlag(Flags.DISALLOW_PROXIABLE);
48800Sstevel@tonic-gate             prSetNeedSave();
48810Sstevel@tonic-gate         }
48820Sstevel@tonic-gate     }
48830Sstevel@tonic-gate 
48840Sstevel@tonic-gate     private class PrAllowSvrAction implements ItemListener {
48850Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
48860Sstevel@tonic-gate             setPrFlag(Flags.DISALLOW_SVR);
48870Sstevel@tonic-gate             prSetNeedSave();
48880Sstevel@tonic-gate         }
48890Sstevel@tonic-gate     }
48900Sstevel@tonic-gate 
48910Sstevel@tonic-gate     private class PrAllowTGTAction implements ItemListener {
48920Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
48930Sstevel@tonic-gate             setPrFlag(Flags.DISALLOW_TGT_BASED);
48940Sstevel@tonic-gate             prSetNeedSave();
48950Sstevel@tonic-gate         }
48960Sstevel@tonic-gate     }
48970Sstevel@tonic-gate 
48980Sstevel@tonic-gate     private class PrAllowDupAuthAction implements ItemListener {
48990Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
49000Sstevel@tonic-gate             setPrFlag(Flags.DISALLOW_DUP_SKEY);
49010Sstevel@tonic-gate             prSetNeedSave();
49020Sstevel@tonic-gate         }
49030Sstevel@tonic-gate     }
49040Sstevel@tonic-gate 
49050Sstevel@tonic-gate     private class PrRequirePreAuthAction implements ItemListener {
49060Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
49070Sstevel@tonic-gate             setPrFlag(Flags.REQUIRE_PRE_AUTH);
49080Sstevel@tonic-gate             prSetNeedSave();
49090Sstevel@tonic-gate         }
49100Sstevel@tonic-gate     }
49110Sstevel@tonic-gate 
49120Sstevel@tonic-gate     private class PrRequireHwPreAuthAction implements ItemListener {
49130Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
49140Sstevel@tonic-gate             setPrFlag(Flags.REQUIRE_HW_AUTH);
49150Sstevel@tonic-gate             prSetNeedSave();
49160Sstevel@tonic-gate         }
49170Sstevel@tonic-gate     }
49180Sstevel@tonic-gate 
49190Sstevel@tonic-gate     private class PrFlagsNextAction implements ActionListener {
49200Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
49210Sstevel@tonic-gate             prFlagsDone();
49220Sstevel@tonic-gate         }
49230Sstevel@tonic-gate     }
49240Sstevel@tonic-gate 
49250Sstevel@tonic-gate     private class PoListPatternAction implements ActionListener {
49260Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
49270Sstevel@tonic-gate             poPatternComplete();
49280Sstevel@tonic-gate         }
49290Sstevel@tonic-gate     }
49300Sstevel@tonic-gate 
49310Sstevel@tonic-gate     private class PoListClearAction implements ActionListener {
49320Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
49330Sstevel@tonic-gate             poPatternClear();
49340Sstevel@tonic-gate         }
49350Sstevel@tonic-gate     }
49360Sstevel@tonic-gate 
49370Sstevel@tonic-gate     private class PoListModifyAction implements ActionListener {
49380Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
49390Sstevel@tonic-gate             poSelected();
49400Sstevel@tonic-gate         }
49410Sstevel@tonic-gate     }
49420Sstevel@tonic-gate 
49430Sstevel@tonic-gate     private class PoListAddAction implements ActionListener {
49440Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
49450Sstevel@tonic-gate             poAdd();
49460Sstevel@tonic-gate         }
49470Sstevel@tonic-gate     }
49480Sstevel@tonic-gate 
49490Sstevel@tonic-gate     private class PoListDeleteAction implements ActionListener {
49500Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
49510Sstevel@tonic-gate             poDelete();
49520Sstevel@tonic-gate         }
49530Sstevel@tonic-gate     }
49540Sstevel@tonic-gate 
49550Sstevel@tonic-gate     private class PoListDuplicateAction implements ActionListener {
49560Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
49570Sstevel@tonic-gate             poDuplicate();
49580Sstevel@tonic-gate         }
49590Sstevel@tonic-gate     }
49600Sstevel@tonic-gate 
49610Sstevel@tonic-gate     private class PoMinPwLengthAction implements ItemListener {
49620Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
49630Sstevel@tonic-gate             setPolPwLength();
49640Sstevel@tonic-gate             poSetNeedSave();
49650Sstevel@tonic-gate         }
49660Sstevel@tonic-gate     }
49670Sstevel@tonic-gate 
49680Sstevel@tonic-gate     private class PoMinPwClassAction implements ItemListener {
49690Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
49700Sstevel@tonic-gate             setPolPwClasses();
49710Sstevel@tonic-gate             poSetNeedSave();
49720Sstevel@tonic-gate         }
49730Sstevel@tonic-gate     }
49740Sstevel@tonic-gate 
49750Sstevel@tonic-gate     private class PoSavedPasswordsAction implements ItemListener {
49760Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
49770Sstevel@tonic-gate             setPolPwHistory();
49780Sstevel@tonic-gate             poSetNeedSave();
49790Sstevel@tonic-gate         }
49800Sstevel@tonic-gate     }
49810Sstevel@tonic-gate 
49820Sstevel@tonic-gate     private class PoMinTicketLifetimeAction implements ActionListener {
49830Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
49840Sstevel@tonic-gate             setPolMinlife();
49850Sstevel@tonic-gate             poSetNeedSave();
49860Sstevel@tonic-gate         }
49870Sstevel@tonic-gate     }
49880Sstevel@tonic-gate 
49890Sstevel@tonic-gate     private class PoMaxTicketLifetimeAction implements ActionListener {
49900Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
49910Sstevel@tonic-gate             setPolMaxlife();
49920Sstevel@tonic-gate             poSetNeedSave();
49930Sstevel@tonic-gate         }
49940Sstevel@tonic-gate     }
49950Sstevel@tonic-gate 
49960Sstevel@tonic-gate     private class PoSaveAction implements ActionListener {
49970Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
49980Sstevel@tonic-gate             poSave();
49990Sstevel@tonic-gate         }
50000Sstevel@tonic-gate     }
50010Sstevel@tonic-gate 
50020Sstevel@tonic-gate     private class PoCancelAction implements ActionListener {
50030Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
50040Sstevel@tonic-gate             poCancel();
50050Sstevel@tonic-gate         }
50060Sstevel@tonic-gate     }
50070Sstevel@tonic-gate 
50080Sstevel@tonic-gate     private class PoPreviousAction implements ActionListener {
50090Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
50100Sstevel@tonic-gate             polPrevious();
50110Sstevel@tonic-gate         }
50120Sstevel@tonic-gate     }
50130Sstevel@tonic-gate 
50140Sstevel@tonic-gate     private class PoDoneAction implements ActionListener {
50150Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
50160Sstevel@tonic-gate             polDone();
50170Sstevel@tonic-gate         }
50180Sstevel@tonic-gate     }
50190Sstevel@tonic-gate 
50200Sstevel@tonic-gate     private class GlobalLockAcctAction implements ItemListener {
50210Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
50220Sstevel@tonic-gate             setGlobalFlag(Flags.DISALLOW_ALL_TIX);
50230Sstevel@tonic-gate         }
50240Sstevel@tonic-gate     }
50250Sstevel@tonic-gate 
50260Sstevel@tonic-gate     private class GlobalForcePwChangeAction implements ItemListener {
50270Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
50280Sstevel@tonic-gate             setGlobalFlag(Flags.REQUIRES_PWCHANGE);
50290Sstevel@tonic-gate         }
50300Sstevel@tonic-gate     }
50310Sstevel@tonic-gate 
50320Sstevel@tonic-gate     private class GlobalAllowPostdatedAction implements ItemListener {
50330Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
50340Sstevel@tonic-gate             setGlobalFlag(Flags.DISALLOW_POSTDATED);
50350Sstevel@tonic-gate         }
50360Sstevel@tonic-gate     }
50370Sstevel@tonic-gate 
50380Sstevel@tonic-gate     private class GlobalAllowForwardableAction implements ItemListener {
50390Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
50400Sstevel@tonic-gate             setGlobalFlag(Flags.DISALLOW_FORWARDABLE);
50410Sstevel@tonic-gate         }
50420Sstevel@tonic-gate     }
50430Sstevel@tonic-gate 
50440Sstevel@tonic-gate     private class GlobalAllowRenewableAction implements ItemListener {
50450Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
50460Sstevel@tonic-gate             setGlobalFlag(Flags.DISALLOW_RENEWABLE);
50470Sstevel@tonic-gate         }
50480Sstevel@tonic-gate     }
50490Sstevel@tonic-gate 
50500Sstevel@tonic-gate     private class GlobalAllowProxiableAction implements ItemListener {
50510Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
50520Sstevel@tonic-gate             setGlobalFlag(Flags.DISALLOW_PROXIABLE);
50530Sstevel@tonic-gate         }
50540Sstevel@tonic-gate     }
50550Sstevel@tonic-gate 
50560Sstevel@tonic-gate     private class GlobalAllowSvrAction implements ItemListener {
50570Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
50580Sstevel@tonic-gate             setGlobalFlag(Flags.DISALLOW_SVR);
50590Sstevel@tonic-gate         }
50600Sstevel@tonic-gate     }
50610Sstevel@tonic-gate 
50620Sstevel@tonic-gate     private class GlobalAllowTGTAction implements ItemListener {
50630Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
50640Sstevel@tonic-gate             setGlobalFlag(Flags.DISALLOW_TGT_BASED);
50650Sstevel@tonic-gate         }
50660Sstevel@tonic-gate     }
50670Sstevel@tonic-gate 
50680Sstevel@tonic-gate     private class GlobalAllowDupAuthAction implements ItemListener {
50690Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
50700Sstevel@tonic-gate             setGlobalFlag(Flags.DISALLOW_DUP_SKEY);
50710Sstevel@tonic-gate         }
50720Sstevel@tonic-gate     }
50730Sstevel@tonic-gate 
50740Sstevel@tonic-gate     private class GlobalRequirePreAuthAction implements ItemListener {
50750Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
50760Sstevel@tonic-gate             setGlobalFlag(Flags.REQUIRE_PRE_AUTH);
50770Sstevel@tonic-gate         }
50780Sstevel@tonic-gate     }
50790Sstevel@tonic-gate 
50800Sstevel@tonic-gate     private class GlobalRequireHwPreAuthAction implements ItemListener {
50810Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
50820Sstevel@tonic-gate             setGlobalFlag(Flags.REQUIRE_HW_AUTH);
50830Sstevel@tonic-gate         }
50840Sstevel@tonic-gate     }
50850Sstevel@tonic-gate 
50860Sstevel@tonic-gate     private class GlobalDefaultServerSideAction implements ItemListener {
50870Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
50880Sstevel@tonic-gate             setServerSide();
50890Sstevel@tonic-gate         }
50900Sstevel@tonic-gate     }
50910Sstevel@tonic-gate 
50920Sstevel@tonic-gate     private class GlobalDefaultRenewableLifeAction implements ActionListener {
50930Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
50940Sstevel@tonic-gate             if (!setGlobalMaxrenew()) {
50950Sstevel@tonic-gate                 ((TextField)e.getSource()).requestFocus();
50960Sstevel@tonic-gate             }
50970Sstevel@tonic-gate         }
50980Sstevel@tonic-gate     }
50990Sstevel@tonic-gate 
51000Sstevel@tonic-gate     private class GlobalDefaultLifeAction implements ActionListener {
51010Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
51020Sstevel@tonic-gate             if (!setGlobalMaxlife()) {
51030Sstevel@tonic-gate                 ((TextField)e.getSource()).requestFocus();
51040Sstevel@tonic-gate             }
51050Sstevel@tonic-gate         }
51060Sstevel@tonic-gate     }
51070Sstevel@tonic-gate 
51080Sstevel@tonic-gate     private class GlobalDefaultExpiryAction implements ActionListener {
51090Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
51100Sstevel@tonic-gate             if (!setGlobalExpiry())
51110Sstevel@tonic-gate                 ((TextField)e.getSource()).requestFocus();
51120Sstevel@tonic-gate         }
51130Sstevel@tonic-gate     }
51140Sstevel@tonic-gate 
51150Sstevel@tonic-gate     private class GlobalDefaultShowListsAction implements ItemListener {
51160Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
51170Sstevel@tonic-gate             setShowLists();
51180Sstevel@tonic-gate         }
51190Sstevel@tonic-gate     }
51200Sstevel@tonic-gate 
51210Sstevel@tonic-gate     private class GlobalDefaultStaticListsAction implements ItemListener {
51220Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
51230Sstevel@tonic-gate             setStaticLists();
51240Sstevel@tonic-gate         }
51250Sstevel@tonic-gate     }
51260Sstevel@tonic-gate 
51270Sstevel@tonic-gate     private class GlobalDefaultCacheTimeAction implements ActionListener {
51280Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
51290Sstevel@tonic-gate             setCacheTime();
51300Sstevel@tonic-gate         }
51310Sstevel@tonic-gate     }
51320Sstevel@tonic-gate 
51330Sstevel@tonic-gate     private class GlobalSaveAction implements ActionListener {
51340Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
51350Sstevel@tonic-gate             glSave();
51360Sstevel@tonic-gate         }
51370Sstevel@tonic-gate     }
51380Sstevel@tonic-gate 
51390Sstevel@tonic-gate     private class GlobalApplyAction implements ActionListener {
51400Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
51410Sstevel@tonic-gate             glApply();
51420Sstevel@tonic-gate         }
51430Sstevel@tonic-gate     }
51440Sstevel@tonic-gate 
51450Sstevel@tonic-gate     private class GlobalCancelAction implements ActionListener {
51460Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
51470Sstevel@tonic-gate             glCancel();
51480Sstevel@tonic-gate         }
51490Sstevel@tonic-gate     }
51500Sstevel@tonic-gate 
51510Sstevel@tonic-gate     private class HelpListener extends MouseAdapter {
51520Sstevel@tonic-gate         public void mouseClicked(MouseEvent e) {
51530Sstevel@tonic-gate             showHelp(e.getComponent().getName());
51540Sstevel@tonic-gate         }
51550Sstevel@tonic-gate     }
51560Sstevel@tonic-gate 
51570Sstevel@tonic-gate     private class CheckboxToggler extends MouseAdapter {
51580Sstevel@tonic-gate         public void mouseClicked(MouseEvent e) {
51590Sstevel@tonic-gate             if (e.getComponent() instanceof Checkbox) {
51600Sstevel@tonic-gate                 Checkbox cb = (Checkbox)e.getComponent();
51610Sstevel@tonic-gate                 cb.setState(!cb.getState());
51620Sstevel@tonic-gate             }
51630Sstevel@tonic-gate         }
51640Sstevel@tonic-gate     }
51650Sstevel@tonic-gate 
51660Sstevel@tonic-gate     private class ChoiceFixer implements ItemListener {
51670Sstevel@tonic-gate         private Choice c;
51680Sstevel@tonic-gate         private String s;
51690Sstevel@tonic-gate 
51700Sstevel@tonic-gate         ChoiceFixer(Choice c) {
51710Sstevel@tonic-gate             this.c = c;
51720Sstevel@tonic-gate             s = c.getSelectedItem();
51730Sstevel@tonic-gate             // System.out.println("CF: Saving string "+s);
51740Sstevel@tonic-gate         }
51750Sstevel@tonic-gate 
51760Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
51770Sstevel@tonic-gate             if (e.getSource() == c && !c.getSelectedItem().equals(s))
51780Sstevel@tonic-gate                 c.select(s);
51790Sstevel@tonic-gate             // System.out.println("CF: Restoring string "+s);
51800Sstevel@tonic-gate         }
51810Sstevel@tonic-gate     }
51820Sstevel@tonic-gate 
51830Sstevel@tonic-gate     private class TextFixer extends KeyAdapter {
51840Sstevel@tonic-gate         private TextField t;
51850Sstevel@tonic-gate         private String s;
51860Sstevel@tonic-gate 
51870Sstevel@tonic-gate         TextFixer(TextField t) {
51880Sstevel@tonic-gate             this.t = t;
51890Sstevel@tonic-gate             s = t.getText();
51900Sstevel@tonic-gate             // System.out.println("TF: Saving string "+s);
51910Sstevel@tonic-gate         }
51920Sstevel@tonic-gate 
51930Sstevel@tonic-gate         public void keyTyped(KeyEvent e) {
51940Sstevel@tonic-gate             if (e.getSource() == t)
51950Sstevel@tonic-gate                 t.setText(s);
51960Sstevel@tonic-gate             // System.out.println("TF: Restoring string "+s);
51970Sstevel@tonic-gate         }
51980Sstevel@tonic-gate     }
51990Sstevel@tonic-gate 
52000Sstevel@tonic-gate     /*
52010Sstevel@tonic-gate      * End of the million listeners
52020Sstevel@tonic-gate      */
52030Sstevel@tonic-gate 
52040Sstevel@tonic-gate     /**
52050Sstevel@tonic-gate      * Call rb.getString(), but catch exception and returns English
52060Sstevel@tonic-gate      * key so that small spelling errors don't cripple the GUI
52070Sstevel@tonic-gate      *
52080Sstevel@tonic-gate      */
52090Sstevel@tonic-gate     private static final String getString(String key) {
52100Sstevel@tonic-gate         try {
52110Sstevel@tonic-gate             String res = rb.getString(key);
52120Sstevel@tonic-gate             return res;
52130Sstevel@tonic-gate         } catch (MissingResourceException e) {
52140Sstevel@tonic-gate             System.out.println("Missing resource "+key+", using English.");
52150Sstevel@tonic-gate             return key;
52160Sstevel@tonic-gate         }
52170Sstevel@tonic-gate     }
52180Sstevel@tonic-gate 
52190Sstevel@tonic-gate     private static final String getHelpString(String key) {
52200Sstevel@tonic-gate         String res;
52210Sstevel@tonic-gate         try {
52220Sstevel@tonic-gate             res = hrb.getString(key);
52230Sstevel@tonic-gate         } catch (MissingResourceException e) {
52240Sstevel@tonic-gate             res = "Missing help on key "+key;
52250Sstevel@tonic-gate         }
52260Sstevel@tonic-gate         return res;
52270Sstevel@tonic-gate     }
52280Sstevel@tonic-gate 
52290Sstevel@tonic-gate 
52300Sstevel@tonic-gate     /**
52310Sstevel@tonic-gate      * Check the privileges this principal has to see what we should not try.
52320Sstevel@tonic-gate      */
52330Sstevel@tonic-gate     private boolean checkPrivs() {
52340Sstevel@tonic-gate         boolean okay = true;
52350Sstevel@tonic-gate         String lpriv = (((privs & PRIV_ADD) == 0) ? "A" : "a")
52360Sstevel@tonic-gate 	    + (((privs & PRIV_DELETE) == 0) ? "D" : "d")
52370Sstevel@tonic-gate 	    + (((privs & PRIV_MODIFY) == 0) ? "M" : "m")
52380Sstevel@tonic-gate 	    + (((privs & PRIV_CHANGEPW) == 0) ? "C" : "c")
52390Sstevel@tonic-gate 	    + (((privs & PRIV_INQUIRE) == 0) ? "I" : "i")
52400Sstevel@tonic-gate 	    + (((privs & PRIV_LIST) == 0) ? "L" : "l");
52410Sstevel@tonic-gate         // System.out.println("Privileges are "+lpriv+" "
52420Sstevel@tonic-gate         // 			+(new Integer(privs).toString()));
52430Sstevel@tonic-gate         /**
52440Sstevel@tonic-gate          * Having modify is not useful if we can't either add or see
52450Sstevel@tonic-gate          * old values
52460Sstevel@tonic-gate          */
52470Sstevel@tonic-gate         if ((privs & (PRIV_MODIFY | PRIV_INQUIRE | PRIV_ADD)) == PRIV_MODIFY)
52480Sstevel@tonic-gate             okay = false;
52490Sstevel@tonic-gate         /* Having changepw without inquire is not useful */
52500Sstevel@tonic-gate         if (privs == PRIV_CHANGEPW)
52510Sstevel@tonic-gate             okay = false;
52520Sstevel@tonic-gate         if (!okay) {
52530Sstevel@tonic-gate             showLoginError(
52540Sstevel@tonic-gate 		   getString("Insufficient privileges to use gkadmin: ")+lpriv
52550Sstevel@tonic-gate 			   +getString(" Please try using another principal."));
52560Sstevel@tonic-gate             return false;
52570Sstevel@tonic-gate         }
52580Sstevel@tonic-gate         return true;
52590Sstevel@tonic-gate     }
52600Sstevel@tonic-gate 
52610Sstevel@tonic-gate     /*
52620Sstevel@tonic-gate      * Try to cope with the privileges we have.
52630Sstevel@tonic-gate      */
52640Sstevel@tonic-gate     private void reactToPrivs() {
52650Sstevel@tonic-gate         Boolean off = new Boolean(false);
52660Sstevel@tonic-gate 
52670Sstevel@tonic-gate         /*
52680Sstevel@tonic-gate          * If we don't have the Add privilege, we turn off "Create New"
52690Sstevel@tonic-gate          * and "Duplicate".  "Duplicate" is also handled in prSelValid/
52700Sstevel@tonic-gate          * poSelValid because it's sensitive to selection from the lists.
52710Sstevel@tonic-gate          */
52720Sstevel@tonic-gate         if ((privs & PRIV_ADD) == 0) {
52730Sstevel@tonic-gate             // System.out.println("Disabling Create New buttons");
52740Sstevel@tonic-gate             gui.PrListAdd.set("enabled" /* NOI18N */, off);
52750Sstevel@tonic-gate             gui.PoListAdd.set("enabled" /* NOI18N */, off);
52760Sstevel@tonic-gate             gui.PrListDuplicate.set("enabled" /* NOI18N */, off);
52770Sstevel@tonic-gate             gui.PoListDuplicate.set("enabled" /* NOI18N */, off);
52780Sstevel@tonic-gate         }
52790Sstevel@tonic-gate 
52800Sstevel@tonic-gate         /*
52810Sstevel@tonic-gate          * If we don't have the Delete privilege, we turn off "Delete".
52820Sstevel@tonic-gate          * This is also done in prSelValid/poSelValid because it is
52830Sstevel@tonic-gate          * thought about when a list item is selected.
52840Sstevel@tonic-gate          */
52850Sstevel@tonic-gate         if ((privs & PRIV_DELETE) == 0) {
52860Sstevel@tonic-gate             // System.out.println("Disabling Delete buttons");
52870Sstevel@tonic-gate             gui.PrListDelete.set("enabled" /* NOI18N */, off);
52880Sstevel@tonic-gate             gui.PoListDelete.set("enabled" /* NOI18N */, off);
52890Sstevel@tonic-gate         }
52900Sstevel@tonic-gate 
52910Sstevel@tonic-gate         /*
52920Sstevel@tonic-gate          * If we don't have changepw, disable textfield and random button.
52930Sstevel@tonic-gate          * Add needs to turn this on again for an add operation only.
52940Sstevel@tonic-gate          */
52950Sstevel@tonic-gate         if ((privs & PRIV_CHANGEPW) == 0) {
52960Sstevel@tonic-gate             // System.out.println("Disabling password components");
52970Sstevel@tonic-gate             gui.PrPassword.set("enabled" /* NOI18N */, off);
52980Sstevel@tonic-gate             gui.PrBasicRandomPw.set("enabled" /* NOI18N */, off);
5299*96Ssemery             gui.EncList.set("enabled" /* NOI18N */, off);
53000Sstevel@tonic-gate         }
53010Sstevel@tonic-gate 
53020Sstevel@tonic-gate         /*
53030Sstevel@tonic-gate          * If we don't have inquire, we can't get an existing principal
53040Sstevel@tonic-gate          * to duplicate, and permitting modification seems a bad idea.
53050Sstevel@tonic-gate          * We can still use the panels if we can add.  These will also
53060Sstevel@tonic-gate          * get dealt with in prSelValid/poSelValid.
53070Sstevel@tonic-gate          */
53080Sstevel@tonic-gate         if ((privs & PRIV_INQUIRE) == 0) {
53090Sstevel@tonic-gate             // System.out.println("Disabling Modify buttons");
53100Sstevel@tonic-gate             gui.PrListModify.set("enabled" /* NOI18N */, off);
53110Sstevel@tonic-gate             gui.PoListModify.set("enabled" /* NOI18N */, off);
53120Sstevel@tonic-gate             gui.PrListDuplicate.set("enabled" /* NOI18N */, off);
53130Sstevel@tonic-gate             gui.PoListDuplicate.set("enabled" /* NOI18N */, off);
53140Sstevel@tonic-gate         }
53150Sstevel@tonic-gate 
53160Sstevel@tonic-gate         /*
53170Sstevel@tonic-gate          * If we don't have Modify or Add but do have Inquire, we want to
53180Sstevel@tonic-gate          * turn off save and cancel buttons, as well as all principal and
53190Sstevel@tonic-gate          * policy components to prevent any changes.
53200Sstevel@tonic-gate          */
53210Sstevel@tonic-gate         if ((privs & (PRIV_MODIFY | PRIV_ADD)) == 0) {
53220Sstevel@tonic-gate             // System.out.println("Disabling attribute components");
53230Sstevel@tonic-gate             enablePrAttributes(off);
53240Sstevel@tonic-gate             enablePoAttributes(off);
53250Sstevel@tonic-gate         }
53260Sstevel@tonic-gate 
53270Sstevel@tonic-gate         /*
53280Sstevel@tonic-gate          * We may have no list privs, or we may have turned off lists.
53290Sstevel@tonic-gate          * Set things up accordingly.
53300Sstevel@tonic-gate          */
53310Sstevel@tonic-gate         noLists = ((privs & PRIV_LIST) == 0 || !defaults.getShowLists());
53320Sstevel@tonic-gate         fixListPanels();
53330Sstevel@tonic-gate     }
53340Sstevel@tonic-gate 
53350Sstevel@tonic-gate     private void fixListPanels() {
53360Sstevel@tonic-gate         /*
53370Sstevel@tonic-gate          * If we can't use lists, we won't fetch lists, which means the
53380Sstevel@tonic-gate          * only way to get a principal is to type something into the
53390Sstevel@tonic-gate          * list pattern field.  Relabel those so they work better.
53400Sstevel@tonic-gate          */
53410Sstevel@tonic-gate         String s;
53420Sstevel@tonic-gate         Boolean yes = new Boolean(true);
53430Sstevel@tonic-gate         Boolean no = new Boolean(false);
53440Sstevel@tonic-gate         if (noLists) {
53450Sstevel@tonic-gate             // System.out.println("Hijacking list pattern stuff");
53460Sstevel@tonic-gate             gui.PrListLabel.set("enabled" /* NOI18N */, no);
53470Sstevel@tonic-gate             gui.PoListLabel.set("enabled" /* NOI18N */, no);
53480Sstevel@tonic-gate             s = getString("Principal Name:");
53490Sstevel@tonic-gate             gui.PrSearchLab.set("text" /* NOI18N */, s);
53500Sstevel@tonic-gate             s = getString("Policy Name:");
53510Sstevel@tonic-gate             gui.PoListPatternLabel.set("text" /* NOI18N */, s);
53520Sstevel@tonic-gate             s = getString("Clear Name");
53530Sstevel@tonic-gate             gui.PrListClear.set("text" /* NOI18N */, s);
53540Sstevel@tonic-gate             gui.PoListClear.set("text" /* NOI18N */, s);
53550Sstevel@tonic-gate             gui.Prlist.set("enabled", no);
53560Sstevel@tonic-gate             gui.Pollist.set("enabled", no);
53570Sstevel@tonic-gate             gui.refreshPrincipals.set("enabled", no);
53580Sstevel@tonic-gate             gui.refreshPolicies.set("enabled", no);
53590Sstevel@tonic-gate             gui.Prlist.set("selectedItem" /* NOI18N */, null);
53600Sstevel@tonic-gate             gui.Pollist.set("selectedItem" /* NOI18N */, null);
53610Sstevel@tonic-gate             gui.PrintPrlist.set("enabled" /* NOI18N */, no);
53620Sstevel@tonic-gate             gui.PrintPollist.set("enabled" /* NOI18N */, no);
53630Sstevel@tonic-gate         } else {
53640Sstevel@tonic-gate             gui.PrListLabel.set("enabled" /* NOI18N */, yes);
53650Sstevel@tonic-gate             gui.PoListLabel.set("enabled" /* NOI18N */, yes);
53660Sstevel@tonic-gate             s = getString("Filter Pattern:");
53670Sstevel@tonic-gate             gui.PrSearchLab.set("text" /* NOI18N */, s);
53680Sstevel@tonic-gate             gui.PoListPatternLabel.set("text" /* NOI18N */, s);
53690Sstevel@tonic-gate             s = getString("Clear Filter");
53700Sstevel@tonic-gate             gui.PrListClear.set("text" /* NOI18N */, s);
53710Sstevel@tonic-gate             gui.PoListClear.set("text" /* NOI18N */, s);
53720Sstevel@tonic-gate             gui.Prlist.set("enabled", yes);
53730Sstevel@tonic-gate             gui.Pollist.set("enabled", yes);
53740Sstevel@tonic-gate             gui.refreshPrincipals.set("enabled", yes);
53750Sstevel@tonic-gate             gui.refreshPolicies.set("enabled", yes);
53760Sstevel@tonic-gate             gui.PrintPrlist.set("enabled", yes);
53770Sstevel@tonic-gate             gui.PrintPollist.set("enabled", yes);
53780Sstevel@tonic-gate         }
53790Sstevel@tonic-gate     }
53800Sstevel@tonic-gate 
53810Sstevel@tonic-gate     private void enablePrAttributes(Boolean sense) {
53820Sstevel@tonic-gate         // Basics
53830Sstevel@tonic-gate         gui.PrPolicy.set("enabled" /* NOI18N */, sense);
53840Sstevel@tonic-gate         gui.PrExpiry.set("enabled" /* NOI18N */, sense);
5385*96Ssemery         gui.EncList.set("enabled" /* NOI18N */, sense);
53860Sstevel@tonic-gate         gui.PrComments.set("enabled" /* NOI18N */, sense);
53870Sstevel@tonic-gate         // Details
53880Sstevel@tonic-gate         gui.PrPwExpiry.set("enabled" /* NOI18N */, sense);
53890Sstevel@tonic-gate         gui.PrKvno.set("enabled" /* NOI18N */, sense);
53900Sstevel@tonic-gate         gui.PrMaxLifetime.set("enabled" /* NOI18N */, sense);
53910Sstevel@tonic-gate         gui.PrMaxRenewal.set("enabled" /* NOI18N */, sense);
53920Sstevel@tonic-gate         // Flags
53930Sstevel@tonic-gate         gui.PrLockAcct.set("enabled" /* NOI18N */, sense);
53940Sstevel@tonic-gate         gui.PrForcePwChange.set("enabled" /* NOI18N */, sense);
53950Sstevel@tonic-gate         gui.PrAllowPostdated.set("enabled" /* NOI18N */, sense);
53960Sstevel@tonic-gate         gui.PrAllowForwardable.set("enabled" /* NOI18N */, sense);
53970Sstevel@tonic-gate         gui.PrAllowRenewable.set("enabled" /* NOI18N */, sense);
53980Sstevel@tonic-gate         gui.PrAllowProxiable.set("enabled" /* NOI18N */, sense);
53990Sstevel@tonic-gate         gui.PrAllowSvr.set("enabled" /* NOI18N */, sense);
54000Sstevel@tonic-gate         gui.PrAllowTGT.set("enabled" /* NOI18N */, sense);
54010Sstevel@tonic-gate         gui.PrAllowDupAuth.set("enabled" /* NOI18N */, sense);
54020Sstevel@tonic-gate         gui.PrRequirePreAuth.set("enabled" /* NOI18N */, sense);
54030Sstevel@tonic-gate         gui.PrRequireHwPreAuth.set("enabled" /* NOI18N */, sense);
54040Sstevel@tonic-gate     }
54050Sstevel@tonic-gate 
54060Sstevel@tonic-gate     private void enablePoAttributes(Boolean sense) {
54070Sstevel@tonic-gate         // Policy
54080Sstevel@tonic-gate         gui.PoMinPwLength.set("enabled" /* NOI18N */, sense);
54090Sstevel@tonic-gate         gui.PoMinPwClass.set("enabled" /* NOI18N */, sense);
54100Sstevel@tonic-gate         gui.PoSavedPasswords.set("enabled" /* NOI18N */, sense);
54110Sstevel@tonic-gate         gui.PoMinTicketLifetime.set("enabled" /* NOI18N */, sense);
54120Sstevel@tonic-gate         gui.PoMaxTicketLifetime.set("enabled" /* NOI18N */, sense);
54130Sstevel@tonic-gate     }
54140Sstevel@tonic-gate 
54150Sstevel@tonic-gate     /**
54160Sstevel@tonic-gate      * Show context-sensitive help from HelpData class
54170Sstevel@tonic-gate      *
54180Sstevel@tonic-gate      */
54190Sstevel@tonic-gate     public void showHelp(String what) {
54200Sstevel@tonic-gate         String res;
54210Sstevel@tonic-gate 
54220Sstevel@tonic-gate         // System.out.println("Help on "+what);
54230Sstevel@tonic-gate         if (cHelp == null) {
54240Sstevel@tonic-gate             // System.out.println("showHelp called without context.");
54250Sstevel@tonic-gate             return;
54260Sstevel@tonic-gate         }
54270Sstevel@tonic-gate         res = getHelpString(what);
54280Sstevel@tonic-gate         cHelp.setText(res);
54290Sstevel@tonic-gate         cHelp.setVisible(true);
54300Sstevel@tonic-gate     }
54310Sstevel@tonic-gate 
54320Sstevel@tonic-gate     /**
54330Sstevel@tonic-gate      * Holds an association between an object and a listener, keeping
54340Sstevel@tonic-gate      * track of the types so that they can be assigned en masse later
54350Sstevel@tonic-gate      *
54360Sstevel@tonic-gate      */
54370Sstevel@tonic-gate     private class Association extends Object {
54380Sstevel@tonic-gate         Object Object;
54390Sstevel@tonic-gate         EventListener Listener;
54400Sstevel@tonic-gate         int Type;
54410Sstevel@tonic-gate 
54420Sstevel@tonic-gate         public Association(Object obj, EventListener list, int type) {
54430Sstevel@tonic-gate             Object = obj;
54440Sstevel@tonic-gate             Listener = list;
54450Sstevel@tonic-gate             Type = type;
54460Sstevel@tonic-gate         }
54470Sstevel@tonic-gate     }
54480Sstevel@tonic-gate 
54490Sstevel@tonic-gate     /**
54500Sstevel@tonic-gate      * Action listeners for the defaults editing frame.
54510Sstevel@tonic-gate      */
54520Sstevel@tonic-gate 
54530Sstevel@tonic-gate     private class DefaultsContextSensitiveHelpListener
54540Sstevel@tonic-gate 	implements ActionListener {
54550Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
54560Sstevel@tonic-gate             if (defaultsHelpMode)
54570Sstevel@tonic-gate                 showHelp("ContextSensitiveHelp");
54580Sstevel@tonic-gate             else
54590Sstevel@tonic-gate                 contextHelp(defaultsEditingFrame);
54600Sstevel@tonic-gate         }
54610Sstevel@tonic-gate     }
54620Sstevel@tonic-gate 
54630Sstevel@tonic-gate     /**
54640Sstevel@tonic-gate      * This class launches the dateTimeDialog box when the user presses
54650Sstevel@tonic-gate      * the "..." button. An instance of this is shared by all the
54660Sstevel@tonic-gate      * buttons that are meant to do this.
54670Sstevel@tonic-gate      */
54680Sstevel@tonic-gate     private class DateTimeListener  implements ActionListener {
54690Sstevel@tonic-gate 
54700Sstevel@tonic-gate         private TextField tf;
54710Sstevel@tonic-gate         private Frame frame;
54720Sstevel@tonic-gate 
54730Sstevel@tonic-gate         DateTimeListener(TextField tf, Frame frame) {
54740Sstevel@tonic-gate             this.tf = tf;
54750Sstevel@tonic-gate             this.frame = frame;
54760Sstevel@tonic-gate         }
54770Sstevel@tonic-gate 
54780Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
54790Sstevel@tonic-gate             if (mainHelpMode && frame == realMainFrame)
54800Sstevel@tonic-gate                 showHelp("DateTime...");
54810Sstevel@tonic-gate             else
54820Sstevel@tonic-gate                 if (defaultsHelpMode && frame == defaultsEditingFrame)
54830Sstevel@tonic-gate 		    showHelp("DateTime...");
54840Sstevel@tonic-gate 		else
54850Sstevel@tonic-gate 		    getDateTimeFromDialogBox(tf, frame);
54860Sstevel@tonic-gate         } // actionPerformed
54870Sstevel@tonic-gate     } // class DateTimeListener
5488*96Ssemery 
5489*96Ssemery     /**
5490*96Ssemery      * This class launches the EncListDialog box when the user presses
5491*96Ssemery      * the "..." button. An instance of this is shared by all the
5492*96Ssemery      * buttons that are meant to do this.
5493*96Ssemery      */
5494*96Ssemery     private class EncListListener implements ActionListener {
5495*96Ssemery 
5496*96Ssemery         private TextField tf;
5497*96Ssemery         private Frame frame;
5498*96Ssemery 
5499*96Ssemery         EncListListener(TextField tf, Frame frame) {
5500*96Ssemery             this.tf = tf;
5501*96Ssemery             this.frame = frame;
5502*96Ssemery         }
5503*96Ssemery 
5504*96Ssemery         public void actionPerformed(ActionEvent e) {
5505*96Ssemery             if (mainHelpMode && frame == realMainFrame)
5506*96Ssemery                 showHelp("EncList...");
5507*96Ssemery             else
5508*96Ssemery                 if (defaultsHelpMode && frame == defaultsEditingFrame)
5509*96Ssemery 		    showHelp("EncList...");
5510*96Ssemery 		else
5511*96Ssemery 		    getEncListFromDialogBox(tf, frame);
5512*96Ssemery         } // actionPerformed
5513*96Ssemery     } // class EncListListener
55140Sstevel@tonic-gate 
55150Sstevel@tonic-gate     /**
55160Sstevel@tonic-gate      * This class launches the durrationHelper dialog box when the user presses
55170Sstevel@tonic-gate      * the "..." button. An instance of this is shared by all the
55180Sstevel@tonic-gate      * buttons that are meant to do this.
55190Sstevel@tonic-gate      */
55200Sstevel@tonic-gate     private class DurationListener implements ActionListener {
55210Sstevel@tonic-gate 
55220Sstevel@tonic-gate         private TextField tf;
55230Sstevel@tonic-gate         private Frame frame;
55240Sstevel@tonic-gate 
55250Sstevel@tonic-gate         DurationListener(TextField tf, Frame frame) {
55260Sstevel@tonic-gate             this.tf = tf;
55270Sstevel@tonic-gate             this.frame = frame;
55280Sstevel@tonic-gate         }
55290Sstevel@tonic-gate 
55300Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
55310Sstevel@tonic-gate             if (mainHelpMode && frame == realMainFrame)
55320Sstevel@tonic-gate                 showHelp("Duration...");
55330Sstevel@tonic-gate             else
55340Sstevel@tonic-gate                 if (defaultsHelpMode && frame == defaultsEditingFrame)
55350Sstevel@tonic-gate 		    showHelp("Duration...");
55360Sstevel@tonic-gate 		else
55370Sstevel@tonic-gate 		    getDurationFromDialogBox(tf, frame);
55380Sstevel@tonic-gate         }
55390Sstevel@tonic-gate     }
55400Sstevel@tonic-gate 
55410Sstevel@tonic-gate 
55420Sstevel@tonic-gate     private class KeystrokeDetector extends KeyAdapter {
55430Sstevel@tonic-gate 
55440Sstevel@tonic-gate         private int changeType; // principal or policy change
55450Sstevel@tonic-gate 
55460Sstevel@tonic-gate         public KeystrokeDetector(int type) {
55470Sstevel@tonic-gate             changeType = type;
55480Sstevel@tonic-gate         }
55490Sstevel@tonic-gate 
55500Sstevel@tonic-gate         public void keyTyped(KeyEvent e) {
55510Sstevel@tonic-gate             reactToKey(changeType);
55520Sstevel@tonic-gate             ((TextField)e.getComponent()).requestFocus();
55530Sstevel@tonic-gate         }
55540Sstevel@tonic-gate     }
55550Sstevel@tonic-gate 
55560Sstevel@tonic-gate     private void reactToKey(int changeType) {
55570Sstevel@tonic-gate         switch (changeType) {
55580Sstevel@tonic-gate 	case PRINCIPAL_EDITING:
55590Sstevel@tonic-gate             prSetNeedSave();
55600Sstevel@tonic-gate             break;
55610Sstevel@tonic-gate 
55620Sstevel@tonic-gate 	case POLICY_EDITING:
55630Sstevel@tonic-gate             poSetNeedSave();
55640Sstevel@tonic-gate             break;
55650Sstevel@tonic-gate 
55660Sstevel@tonic-gate 	case DEFAULTS_EDITING:
55670Sstevel@tonic-gate             glSetNeedSave();
55680Sstevel@tonic-gate             break;
55690Sstevel@tonic-gate 
55700Sstevel@tonic-gate 	case PRINCIPAL_LIST:
55710Sstevel@tonic-gate             if (noLists)
55720Sstevel@tonic-gate                 prSelValid(true);
55730Sstevel@tonic-gate             break;
55740Sstevel@tonic-gate 
55750Sstevel@tonic-gate 	case POLICY_LIST:
55760Sstevel@tonic-gate             if (noLists)
55770Sstevel@tonic-gate                 poSelValid(true);
55780Sstevel@tonic-gate             break;
55790Sstevel@tonic-gate         }
55800Sstevel@tonic-gate     }
55810Sstevel@tonic-gate 
55820Sstevel@tonic-gate     private static String enclose(String value) {
55830Sstevel@tonic-gate         return new StringBuffer("\"").append(value).append("\"").toString();
55840Sstevel@tonic-gate     }
55850Sstevel@tonic-gate 
55860Sstevel@tonic-gate     private static String constructDurationExample() {
55870Sstevel@tonic-gate         StringBuffer result = new StringBuffer(getString("Example: "));
55880Sstevel@tonic-gate         result.append(enclose(nf.format(28800)));
55890Sstevel@tonic-gate         return result.toString();
55900Sstevel@tonic-gate     }
55910Sstevel@tonic-gate 
55920Sstevel@tonic-gate     private static String constructDateExample() {
55930Sstevel@tonic-gate         StringBuffer result = new StringBuffer(getString("Example: "));
55940Sstevel@tonic-gate         result.append(enclose(df.format(new Date())));
55950Sstevel@tonic-gate         result.append(' ').append(getString("or")).append(' ');
55960Sstevel@tonic-gate         result.append(enclose(neverString));
55970Sstevel@tonic-gate         return result.toString();
55980Sstevel@tonic-gate     }
55990Sstevel@tonic-gate 
56000Sstevel@tonic-gate     private static String constructNumberExample() {
56010Sstevel@tonic-gate         StringBuffer result =  new StringBuffer(getString("Example: "));
56020Sstevel@tonic-gate         result.append(enclose(nf.format(4)));
56030Sstevel@tonic-gate         return result.toString();
56040Sstevel@tonic-gate     }
56050Sstevel@tonic-gate 
56060Sstevel@tonic-gate     static {
56070Sstevel@tonic-gate         rb = ResourceBundle.getBundle("GuiResource" /* NOI18N */);
56080Sstevel@tonic-gate         hrb = ResourceBundle.getBundle("HelpData" /* NOI18N */);
56090Sstevel@tonic-gate         df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM,
56100Sstevel@tonic-gate 					    DateFormat.MEDIUM);
56110Sstevel@tonic-gate         nf = NumberFormat.getInstance();
56120Sstevel@tonic-gate 
56130Sstevel@tonic-gate         neverString = getString("Never");
56140Sstevel@tonic-gate 
56150Sstevel@tonic-gate         toolkit = Toolkit.getDefaultToolkit();
56160Sstevel@tonic-gate 
56170Sstevel@tonic-gate         durationErrorText = new String[] {getHelpString("Bad Duration"),
56180Sstevel@tonic-gate 					  constructDurationExample()};
56190Sstevel@tonic-gate         dateErrorText = new String[] {getHelpString("Bad Date"),
56200Sstevel@tonic-gate 				      constructDateExample()};
56210Sstevel@tonic-gate         numberErrorText = new String[] {getHelpString("Bad Number"),
56220Sstevel@tonic-gate 					constructNumberExample()};
56230Sstevel@tonic-gate     }
56240Sstevel@tonic-gate 
56250Sstevel@tonic-gate }
5626