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