xref: /titanic_44/usr/src/cmd/krb5/kadmin/gui/KdcGui.java (revision a0e56b0eb1fdc159ff8348ca0e77d884bb7d126b)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*a0e56b0eSsemery  * Common Development and Distribution License (the "License").
6*a0e56b0eSsemery  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
227c478bd9Sstevel@tonic-gate  * ident	"%Z%%M%	%I%	%E% SMI"
237c478bd9Sstevel@tonic-gate  *
24*a0e56b0eSsemery  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
257c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
267c478bd9Sstevel@tonic-gate  */
277c478bd9Sstevel@tonic-gate 
287c478bd9Sstevel@tonic-gate /**
297c478bd9Sstevel@tonic-gate  * GUI interface for Kerberos KDC
307c478bd9Sstevel@tonic-gate  */
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate // Java Workshop stuff
337c478bd9Sstevel@tonic-gate import sunsoft.jws.visual.rt.base.*;
347c478bd9Sstevel@tonic-gate import sunsoft.jws.visual.rt.base.Global;
357c478bd9Sstevel@tonic-gate import sunsoft.jws.visual.rt.awt.TabbedFolder;
367c478bd9Sstevel@tonic-gate import sunsoft.jws.visual.rt.awt.TextList;
377c478bd9Sstevel@tonic-gate import sunsoft.jws.visual.rt.awt.StringVector;
387c478bd9Sstevel@tonic-gate import sunsoft.jws.visual.rt.shadow.java.awt.*;
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate // Regular JDK stuff
417c478bd9Sstevel@tonic-gate import java.awt.*;
427c478bd9Sstevel@tonic-gate import java.awt.event.*;
437c478bd9Sstevel@tonic-gate import java.util.EventListener;
447c478bd9Sstevel@tonic-gate import java.util.Properties;
457c478bd9Sstevel@tonic-gate import java.util.Vector;
467c478bd9Sstevel@tonic-gate import java.util.Random;
477c478bd9Sstevel@tonic-gate import java.util.StringTokenizer;
487c478bd9Sstevel@tonic-gate import java.io.IOException;
497c478bd9Sstevel@tonic-gate import java.io.File;
507c478bd9Sstevel@tonic-gate import java.io.InputStream;
517c478bd9Sstevel@tonic-gate import java.net.URL;
527c478bd9Sstevel@tonic-gate 
537c478bd9Sstevel@tonic-gate // Stuff to support I18N
547c478bd9Sstevel@tonic-gate import java.util.Date;
557c478bd9Sstevel@tonic-gate import java.util.Calendar;
567c478bd9Sstevel@tonic-gate import java.util.GregorianCalendar;
577c478bd9Sstevel@tonic-gate import java.util.Locale;
587c478bd9Sstevel@tonic-gate import java.text.DateFormat;
597c478bd9Sstevel@tonic-gate import java.text.ParseException;
607c478bd9Sstevel@tonic-gate import java.text.DateFormatSymbols;
617c478bd9Sstevel@tonic-gate import java.text.NumberFormat;
627c478bd9Sstevel@tonic-gate import java.util.ResourceBundle;
637c478bd9Sstevel@tonic-gate import java.util.ListResourceBundle;
647c478bd9Sstevel@tonic-gate import java.util.MissingResourceException;
657c478bd9Sstevel@tonic-gate import java.util.Enumeration;
667c478bd9Sstevel@tonic-gate 
677c478bd9Sstevel@tonic-gate public class KdcGui extends Group {
687c478bd9Sstevel@tonic-gate 
697c478bd9Sstevel@tonic-gate     // Basics
707c478bd9Sstevel@tonic-gate     private KdcGuiRoot gui;
717c478bd9Sstevel@tonic-gate     private Krb5Conf kc;
727c478bd9Sstevel@tonic-gate     private Principal prin = null;
737c478bd9Sstevel@tonic-gate     private Policy pol = null;
747c478bd9Sstevel@tonic-gate     private Defaults defaults = null;
757c478bd9Sstevel@tonic-gate     private Defaults olddefaults = null;
767c478bd9Sstevel@tonic-gate     public Frame defaultsEditingFrame = null; // public since used
777c478bd9Sstevel@tonic-gate     // by ContextHelp class
787c478bd9Sstevel@tonic-gate     public Frame realMainFrame = null;
797c478bd9Sstevel@tonic-gate     public Frame realLoginFrame = null;
807c478bd9Sstevel@tonic-gate 
817c478bd9Sstevel@tonic-gate     public Kadmin Kadmin = null;
827c478bd9Sstevel@tonic-gate 
837c478bd9Sstevel@tonic-gate     // Privileges stuff: corresponds to ADMCIL set in kdc.conf
847c478bd9Sstevel@tonic-gate     public int privs = 0;
857c478bd9Sstevel@tonic-gate     public static final int PRIV_ADD	= 0x02;		// KADM5_PRIV_ADD
867c478bd9Sstevel@tonic-gate     public static final int PRIV_DELETE	= 0x08;		// KADM5_PRIV_DELETE
877c478bd9Sstevel@tonic-gate     public static final int PRIV_MODIFY	= 0x04;		// KADM5_PRIV_MODIFY
887c478bd9Sstevel@tonic-gate     public static final int PRIV_CHANGEPW	= 0x20;	// KADM5_PRIV_CPW
897c478bd9Sstevel@tonic-gate     public static final int PRIV_INQUIRE	= 0x01;	// KADM5_PRIV_GET
907c478bd9Sstevel@tonic-gate     public static final int PRIV_LIST	= 0x10;		// KADM5_PRIV_LIST
917c478bd9Sstevel@tonic-gate     public boolean noLists = false;
927c478bd9Sstevel@tonic-gate 
937c478bd9Sstevel@tonic-gate     // For modal warning dialog and context-sensitive help dialog
947c478bd9Sstevel@tonic-gate     private Dialog dialog;
957c478bd9Sstevel@tonic-gate     public ContextHelp cHelp = null; // tweaked from ContextHelp when
967c478bd9Sstevel@tonic-gate     // it is dismissed
977c478bd9Sstevel@tonic-gate 
987c478bd9Sstevel@tonic-gate     private static Toolkit toolkit;
997c478bd9Sstevel@tonic-gate 
1007c478bd9Sstevel@tonic-gate     // For showDataFormatError() to determine what kind of error to show
1017c478bd9Sstevel@tonic-gate 
1027c478bd9Sstevel@tonic-gate     public static final int DURATION_DATA = 1;
1037c478bd9Sstevel@tonic-gate     public static final int DATE_DATA = 2;
1047c478bd9Sstevel@tonic-gate     public static final int NUMBER_DATA = 3;
1057c478bd9Sstevel@tonic-gate 
1067c478bd9Sstevel@tonic-gate     private static String[] durationErrorText = null;
1077c478bd9Sstevel@tonic-gate     private static String[] dateErrorText = null;
1087c478bd9Sstevel@tonic-gate     private static String[] numberErrorText = null;
1097c478bd9Sstevel@tonic-gate 
1107c478bd9Sstevel@tonic-gate     // For date & time helper dialogs
1117c478bd9Sstevel@tonic-gate     private DateTimeDialog dateTimeDialog = null;
1127c478bd9Sstevel@tonic-gate     private DurationHelper durationHelper = null;
1137c478bd9Sstevel@tonic-gate 
11445526e97Ssemery     // For the encryption list helper dialog
11545526e97Ssemery     private EncListDialog encListDialog = null;
11645526e97Ssemery 
1177c478bd9Sstevel@tonic-gate     // Important defaults and current settings
1187c478bd9Sstevel@tonic-gate     private String DefName = null;
1197c478bd9Sstevel@tonic-gate     private String DefRealm = null;
1207c478bd9Sstevel@tonic-gate     private String DefServer = null;
1217c478bd9Sstevel@tonic-gate     private String DefPort = "0";
1227c478bd9Sstevel@tonic-gate     private String CurName, CurPass, CurRealm, CurServer;
1237c478bd9Sstevel@tonic-gate     private int CurPort;
1247c478bd9Sstevel@tonic-gate     private String CurPrincipal;
1257c478bd9Sstevel@tonic-gate     private String CurPolicy;
1267c478bd9Sstevel@tonic-gate     private String curPrPattern = "";
1277c478bd9Sstevel@tonic-gate     private String curPoPattern = "";
1287c478bd9Sstevel@tonic-gate     private int curPrListPos = 0;
1297c478bd9Sstevel@tonic-gate     private int curPoListPos = 0;
1307c478bd9Sstevel@tonic-gate     private String[] principalList = null;
1317c478bd9Sstevel@tonic-gate     private Date principalListDate = new Date(0);
1327c478bd9Sstevel@tonic-gate     private String[] policyList = null;
1337c478bd9Sstevel@tonic-gate     private Date policyListDate = new Date(0);
1347c478bd9Sstevel@tonic-gate     private static final long A_LONG_TIME = 1000 * 60 * 60 * 24 * 365;
1357c478bd9Sstevel@tonic-gate 
1367c478bd9Sstevel@tonic-gate     // General state variables
1377c478bd9Sstevel@tonic-gate     private boolean prSelValid = false;
1387c478bd9Sstevel@tonic-gate     private String[] prMulti = null;
1397c478bd9Sstevel@tonic-gate     private boolean prNeedSave = false;
1407c478bd9Sstevel@tonic-gate     private boolean poSelValid = false;
1417c478bd9Sstevel@tonic-gate     private String[] poMulti = null;
1427c478bd9Sstevel@tonic-gate     private boolean poNeedSave = false;
1437c478bd9Sstevel@tonic-gate     private boolean glNeedSave = false;
1447c478bd9Sstevel@tonic-gate     private boolean firsttime = true;
1457c478bd9Sstevel@tonic-gate     private boolean prnameEditable = false;
1467c478bd9Sstevel@tonic-gate     private boolean ponameEditable = false;
1477c478bd9Sstevel@tonic-gate 
1487c478bd9Sstevel@tonic-gate     // Support for context-sensitive help
1497c478bd9Sstevel@tonic-gate     private static final int BUTTON_ACTION = 1;
1507c478bd9Sstevel@tonic-gate     private static final int BUTTON_MOUSE = 2;
1517c478bd9Sstevel@tonic-gate     private static final int TEXTFIELD_ACTION = 3;
1527c478bd9Sstevel@tonic-gate     private static final int TEXTFIELD_MOUSE = 4;
1537c478bd9Sstevel@tonic-gate     private static final int TEXTFIELD_KEY = 5;
1547c478bd9Sstevel@tonic-gate     private static final int CHOICE_ITEM = 6;
1557c478bd9Sstevel@tonic-gate     private static final int CHOICE_MOUSE = 7;
1567c478bd9Sstevel@tonic-gate     private static final int CHECKBOX_ITEM = 8;
1577c478bd9Sstevel@tonic-gate     private static final int CHECKBOX_MOUSE = 9;
1587c478bd9Sstevel@tonic-gate     private static final int LABEL_MOUSE = 10;
1597c478bd9Sstevel@tonic-gate     private static final int WINDOW_LISTENER = 11;
1607c478bd9Sstevel@tonic-gate 
1617c478bd9Sstevel@tonic-gate     private boolean loginListeners = false;
1627c478bd9Sstevel@tonic-gate     private Vector LoginNormal = null;
1637c478bd9Sstevel@tonic-gate     private Vector LoginHelp = null;
1647c478bd9Sstevel@tonic-gate     private Vector LoginFixers = null;
1657c478bd9Sstevel@tonic-gate     private Vector MainNormal = null;
1667c478bd9Sstevel@tonic-gate     private Vector MainHelp = null;
1677c478bd9Sstevel@tonic-gate     private Vector MainFixers = null;
1687c478bd9Sstevel@tonic-gate     private Vector defaultsNormal = null;
1697c478bd9Sstevel@tonic-gate     private Vector defaultsHelp = null;
1707c478bd9Sstevel@tonic-gate     private Vector defaultsFixers = null;
1717c478bd9Sstevel@tonic-gate     public boolean loginHelpMode = false;
1727c478bd9Sstevel@tonic-gate     public boolean mainHelpMode = false;
1737c478bd9Sstevel@tonic-gate     public boolean defaultsHelpMode = false;
1747c478bd9Sstevel@tonic-gate 
1757c478bd9Sstevel@tonic-gate     // For Principal and Policy Keystroke listeners
1767c478bd9Sstevel@tonic-gate     private static final int PRINCIPAL_EDITING = 1;
1777c478bd9Sstevel@tonic-gate     private static final int POLICY_EDITING = 2;
1787c478bd9Sstevel@tonic-gate     private static final int DEFAULTS_EDITING = 3;
1797c478bd9Sstevel@tonic-gate     private static final int PRINCIPAL_LIST = 4;
1807c478bd9Sstevel@tonic-gate     private static final int POLICY_LIST = 5;
1817c478bd9Sstevel@tonic-gate 
1827c478bd9Sstevel@tonic-gate     // For status line
1837c478bd9Sstevel@tonic-gate     private String OpString = "";
1847c478bd9Sstevel@tonic-gate     private String ModeString = "";
1857c478bd9Sstevel@tonic-gate     private String SaveString = "";
1867c478bd9Sstevel@tonic-gate 
1877c478bd9Sstevel@tonic-gate     // For I18N
1887c478bd9Sstevel@tonic-gate     private static ResourceBundle rb;
1897c478bd9Sstevel@tonic-gate     private static ResourceBundle hrb;
1907c478bd9Sstevel@tonic-gate     private static DateFormat df;
1917c478bd9Sstevel@tonic-gate     private static NumberFormat nf;
1927c478bd9Sstevel@tonic-gate 
1937c478bd9Sstevel@tonic-gate     private static String neverString;
1947c478bd9Sstevel@tonic-gate 
1957c478bd9Sstevel@tonic-gate     // For general pupose help
1967c478bd9Sstevel@tonic-gate     Process browserProcess;
1977c478bd9Sstevel@tonic-gate     String helpIndexFile = "file:/usr/lib/krb5/HelpIndex.html";
1987c478bd9Sstevel@tonic-gate 
1997c478bd9Sstevel@tonic-gate     // For performance monitoring
2007c478bd9Sstevel@tonic-gate     boolean perfmon = false;
2017c478bd9Sstevel@tonic-gate     Date pdateFirst;
2027c478bd9Sstevel@tonic-gate     Date pdateAfterKrb5Conf;
2037c478bd9Sstevel@tonic-gate     Date pdateEndGuiRoot;
2047c478bd9Sstevel@tonic-gate     Date pdateBeginStartGroup;
2057c478bd9Sstevel@tonic-gate     Date pdateStringsDone;
2067c478bd9Sstevel@tonic-gate     Date pdateLoginReady;
2077c478bd9Sstevel@tonic-gate     Date pdateLoginDone;
2087c478bd9Sstevel@tonic-gate     Date pdateSessionUp;
2097c478bd9Sstevel@tonic-gate     Date pdatePreMainShow;
2107c478bd9Sstevel@tonic-gate     Date pdatePostMainShow;
2117c478bd9Sstevel@tonic-gate     Date pdateMainActive;
2127c478bd9Sstevel@tonic-gate     Date pdateStartPlist;
2137c478bd9Sstevel@tonic-gate     Date pdateHavePlist;
2147c478bd9Sstevel@tonic-gate     Date pdateEmptyPlist;
2157c478bd9Sstevel@tonic-gate     Date pdateDonePlist;
2167c478bd9Sstevel@tonic-gate 
reportTime(String s0, Date curr, Date prev)2177c478bd9Sstevel@tonic-gate     public void reportTime(String s0, Date curr, Date prev) {
2187c478bd9Sstevel@tonic-gate         if (!perfmon)
2197c478bd9Sstevel@tonic-gate             return;
2207c478bd9Sstevel@tonic-gate         String s1 = curr.toString();
2217c478bd9Sstevel@tonic-gate         long curdiff = curr.getTime() - prev.getTime();
2227c478bd9Sstevel@tonic-gate         String s2 = (new Long(curdiff)).toString();
2237c478bd9Sstevel@tonic-gate         long cumdiff = curr.getTime() - pdateFirst.getTime();
2247c478bd9Sstevel@tonic-gate         String s3 = (new Long(cumdiff)).toString();
2257c478bd9Sstevel@tonic-gate         System.out.println(s0+s1+" delta "+s2+" cume "+s3);
2267c478bd9Sstevel@tonic-gate     }
2277c478bd9Sstevel@tonic-gate 
reportStartTimes()2287c478bd9Sstevel@tonic-gate     public void reportStartTimes() {
2297c478bd9Sstevel@tonic-gate         if (!perfmon)
2307c478bd9Sstevel@tonic-gate             return;
2317c478bd9Sstevel@tonic-gate         System.out.println("");
2327c478bd9Sstevel@tonic-gate         reportTime("First timestamp: ", pdateFirst, pdateFirst);
2337c478bd9Sstevel@tonic-gate         reportTime("After krb5.conf: ", pdateAfterKrb5Conf, pdateFirst);
2347c478bd9Sstevel@tonic-gate         reportTime("KdcGuiRoot done: ", pdateEndGuiRoot, pdateAfterKrb5Conf);
2357c478bd9Sstevel@tonic-gate         reportTime("At startGroup  : ", pdateBeginStartGroup, pdateEndGuiRoot);
2367c478bd9Sstevel@tonic-gate         reportTime("Strings set up : ", pdateStringsDone, pdateBeginStartGroup);
2377c478bd9Sstevel@tonic-gate         reportTime("Login ready    : ", pdateLoginReady, pdateStringsDone);
2387c478bd9Sstevel@tonic-gate         reportTime("Login complete : ", pdateLoginDone, pdateLoginReady);
2397c478bd9Sstevel@tonic-gate         reportTime("Session set up : ", pdateSessionUp, pdateLoginDone);
2407c478bd9Sstevel@tonic-gate         reportTime("Start main win : ", pdatePreMainShow, pdateSessionUp);
2417c478bd9Sstevel@tonic-gate         reportTime("Done main win  : ", pdatePostMainShow, pdatePreMainShow);
2427c478bd9Sstevel@tonic-gate         reportTime("Main win active: ", pdateMainActive, pdatePostMainShow);
2437c478bd9Sstevel@tonic-gate     }
2447c478bd9Sstevel@tonic-gate 
2457c478bd9Sstevel@tonic-gate     /**
2467c478bd9Sstevel@tonic-gate      * Sample method call ordering during a group's lifetime:
2477c478bd9Sstevel@tonic-gate      *
2487c478bd9Sstevel@tonic-gate      * Constructor
2497c478bd9Sstevel@tonic-gate      * initRoot
2507c478bd9Sstevel@tonic-gate      * initGroup
2517c478bd9Sstevel@tonic-gate      * (setOnGroup and getOnGroup may be called at any time in any
2527c478bd9Sstevel@tonic-gate      *  order after initGroup has been called)
2537c478bd9Sstevel@tonic-gate      * createGroup
2547c478bd9Sstevel@tonic-gate      * showGroup/hideGroup + startGroup/stopGroup
2557c478bd9Sstevel@tonic-gate      * destroyGroup
2567c478bd9Sstevel@tonic-gate      */
2577c478bd9Sstevel@tonic-gate 
2587c478bd9Sstevel@tonic-gate     /**
2597c478bd9Sstevel@tonic-gate      * The constructor sets up defaults for login screen
2607c478bd9Sstevel@tonic-gate      *
2617c478bd9Sstevel@tonic-gate      */
KdcGui()2627c478bd9Sstevel@tonic-gate     public KdcGui() {
2637c478bd9Sstevel@tonic-gate 
2647c478bd9Sstevel@tonic-gate         /*
2657c478bd9Sstevel@tonic-gate          * Set up defaults from /etc/krb5/krb5.conf
2667c478bd9Sstevel@tonic-gate          */
2677c478bd9Sstevel@tonic-gate 
2687c478bd9Sstevel@tonic-gate         pdateFirst = new Date();
2697c478bd9Sstevel@tonic-gate         DefName = System.getProperty("user.name" /* NOI18N */)+
2707c478bd9Sstevel@tonic-gate 	    "/admin" /* NOI18N */;
2717c478bd9Sstevel@tonic-gate         kc = new Krb5Conf();
2727c478bd9Sstevel@tonic-gate         DefRealm = kc.getDefaultRealm();
2737c478bd9Sstevel@tonic-gate         DefServer = kc.getRealmServer(DefRealm);
2747c478bd9Sstevel@tonic-gate         DefPort = kc.getRealmPort(DefRealm);
2757c478bd9Sstevel@tonic-gate         pdateAfterKrb5Conf = new Date();
2767c478bd9Sstevel@tonic-gate 
2777c478bd9Sstevel@tonic-gate         /*
2787c478bd9Sstevel@tonic-gate          * Take care of Java Workshop attribute plumbing
2797c478bd9Sstevel@tonic-gate          */
2807c478bd9Sstevel@tonic-gate         addForwardedAttributes();
2817c478bd9Sstevel@tonic-gate     }
2827c478bd9Sstevel@tonic-gate 
2837c478bd9Sstevel@tonic-gate     /**
2847c478bd9Sstevel@tonic-gate      * Inherited from the Java Workshop skeleton
2857c478bd9Sstevel@tonic-gate      *
2867c478bd9Sstevel@tonic-gate      */
initRoot()2877c478bd9Sstevel@tonic-gate     protected Root initRoot() {
2887c478bd9Sstevel@tonic-gate         /*
2897c478bd9Sstevel@tonic-gate          * Initialize the gui components
2907c478bd9Sstevel@tonic-gate          */
2917c478bd9Sstevel@tonic-gate         gui = new KdcGuiRoot(this);
2927c478bd9Sstevel@tonic-gate         pdateEndGuiRoot = new Date();
2937c478bd9Sstevel@tonic-gate 
2947c478bd9Sstevel@tonic-gate         /*
2957c478bd9Sstevel@tonic-gate          * Take care of Java Workshop attribute plumbing.
2967c478bd9Sstevel@tonic-gate          */
2977c478bd9Sstevel@tonic-gate         addAttributeForward(gui.getMainChild());
2987c478bd9Sstevel@tonic-gate 
2997c478bd9Sstevel@tonic-gate         initLoginStrings();
3007c478bd9Sstevel@tonic-gate         initMainStrings();
3017c478bd9Sstevel@tonic-gate         pdateStringsDone = new Date();
3027c478bd9Sstevel@tonic-gate         return gui;
3037c478bd9Sstevel@tonic-gate     }
3047c478bd9Sstevel@tonic-gate 
3057c478bd9Sstevel@tonic-gate     /**
3067c478bd9Sstevel@tonic-gate      * Set up the login screen properly.
3077c478bd9Sstevel@tonic-gate      *
3087c478bd9Sstevel@tonic-gate      */
startGroup()3097c478bd9Sstevel@tonic-gate     protected void startGroup() {
3107c478bd9Sstevel@tonic-gate         pdateBeginStartGroup = new Date();
3117c478bd9Sstevel@tonic-gate         realLoginFrame = (Frame)gui.loginframe.getBody();
3127c478bd9Sstevel@tonic-gate         realLoginFrame.setTitle(getString("SEAM Administration Login"));
3137c478bd9Sstevel@tonic-gate         setLoginDefaults();
3147c478bd9Sstevel@tonic-gate         pdateLoginReady = new Date();
3157c478bd9Sstevel@tonic-gate     }
3167c478bd9Sstevel@tonic-gate 
3177c478bd9Sstevel@tonic-gate     /**
3187c478bd9Sstevel@tonic-gate      * All cleanup done here.
3197c478bd9Sstevel@tonic-gate      */
stopGroup()3207c478bd9Sstevel@tonic-gate     protected void stopGroup() {
3217c478bd9Sstevel@tonic-gate         killHelpBrowser();
3227c478bd9Sstevel@tonic-gate     }
3237c478bd9Sstevel@tonic-gate 
3247c478bd9Sstevel@tonic-gate 
3257c478bd9Sstevel@tonic-gate     /**
3267c478bd9Sstevel@tonic-gate      * Callbacks from Java workshop to decide whether to take the action
3277c478bd9Sstevel@tonic-gate      * or show appropriate help for it.
3287c478bd9Sstevel@tonic-gate      *
3297c478bd9Sstevel@tonic-gate      * 1. Actions that are triggered from all three - mainframe,
3307c478bd9Sstevel@tonic-gate      *    loginframe, and defaultsEditingFrame - are: context sensitive help.
3317c478bd9Sstevel@tonic-gate      * 2. Actions that are triggered only from mainframe are: printing,
3327c478bd9Sstevel@tonic-gate      *    logging out, edit preferences.
3337c478bd9Sstevel@tonic-gate      * 3. Actions that are triggered from mainframe and loginframe are:
3347c478bd9Sstevel@tonic-gate      *    exit, general help, context sensitive help, about.
3357c478bd9Sstevel@tonic-gate      */
3367c478bd9Sstevel@tonic-gate 
3377c478bd9Sstevel@tonic-gate 
3387c478bd9Sstevel@tonic-gate     // All three frames
3397c478bd9Sstevel@tonic-gate 
checkContextSensitiveHelp(Frame frame)3407c478bd9Sstevel@tonic-gate     public void checkContextSensitiveHelp(Frame frame) {
3417c478bd9Sstevel@tonic-gate         if ((loginHelpMode && frame == realLoginFrame)
3427c478bd9Sstevel@tonic-gate             || (mainHelpMode && frame == realMainFrame)
3437c478bd9Sstevel@tonic-gate 	    || (defaultsHelpMode && frame == defaultsEditingFrame))
3447c478bd9Sstevel@tonic-gate 	    showHelp("ContextSensitiveHelp");
3457c478bd9Sstevel@tonic-gate         else
3467c478bd9Sstevel@tonic-gate             contextHelp(frame);
3477c478bd9Sstevel@tonic-gate     }
3487c478bd9Sstevel@tonic-gate 
3497c478bd9Sstevel@tonic-gate     // Mainframe only
3507c478bd9Sstevel@tonic-gate 
checkPrintCurPr()3517c478bd9Sstevel@tonic-gate     public void checkPrintCurPr() {
3527c478bd9Sstevel@tonic-gate         if (mainHelpMode)
3537c478bd9Sstevel@tonic-gate             showHelp("PrintCurrentPrincipal");
3547c478bd9Sstevel@tonic-gate         else
3557c478bd9Sstevel@tonic-gate             printCurPr();
3567c478bd9Sstevel@tonic-gate     }
3577c478bd9Sstevel@tonic-gate 
checkPrintCurPol()3587c478bd9Sstevel@tonic-gate     public void checkPrintCurPol() {
3597c478bd9Sstevel@tonic-gate         if (mainHelpMode)
3607c478bd9Sstevel@tonic-gate             showHelp("PrintCurrentPolicy");
3617c478bd9Sstevel@tonic-gate         else
3627c478bd9Sstevel@tonic-gate             printCurPol();
3637c478bd9Sstevel@tonic-gate     }
3647c478bd9Sstevel@tonic-gate 
checkPrintPrList()3657c478bd9Sstevel@tonic-gate     public void checkPrintPrList() {
3667c478bd9Sstevel@tonic-gate         if (mainHelpMode)
3677c478bd9Sstevel@tonic-gate             showHelp("PrintPrincipalList");
3687c478bd9Sstevel@tonic-gate         else
3697c478bd9Sstevel@tonic-gate             printPrList();
3707c478bd9Sstevel@tonic-gate     }
3717c478bd9Sstevel@tonic-gate 
checkPrintPoList()3727c478bd9Sstevel@tonic-gate     public void checkPrintPoList() {
3737c478bd9Sstevel@tonic-gate         if (mainHelpMode)
3747c478bd9Sstevel@tonic-gate             showHelp("PrintPolicyList");
3757c478bd9Sstevel@tonic-gate         else
3767c478bd9Sstevel@tonic-gate             printPoList();
3777c478bd9Sstevel@tonic-gate     }
3787c478bd9Sstevel@tonic-gate 
checkLogout()3797c478bd9Sstevel@tonic-gate     public void checkLogout() {
3807c478bd9Sstevel@tonic-gate         if (mainHelpMode)
3817c478bd9Sstevel@tonic-gate             showHelp("Logout");
3827c478bd9Sstevel@tonic-gate         else if (okayToLeave(realMainFrame))
3837c478bd9Sstevel@tonic-gate             logout();
3847c478bd9Sstevel@tonic-gate     }
3857c478bd9Sstevel@tonic-gate 
checkEditPreferences()3867c478bd9Sstevel@tonic-gate     public void checkEditPreferences() {
3877c478bd9Sstevel@tonic-gate         if (mainHelpMode)
3887c478bd9Sstevel@tonic-gate             showHelp("EditPreferences");
3897c478bd9Sstevel@tonic-gate         else
3907c478bd9Sstevel@tonic-gate             editPreferences();
3917c478bd9Sstevel@tonic-gate     }
3927c478bd9Sstevel@tonic-gate 
checkRefreshPrincipals()3937c478bd9Sstevel@tonic-gate     public void checkRefreshPrincipals() {
3947c478bd9Sstevel@tonic-gate         if (mainHelpMode)
3957c478bd9Sstevel@tonic-gate             showHelp("RefreshPrincipals");
3967c478bd9Sstevel@tonic-gate         else {
3977c478bd9Sstevel@tonic-gate             principalList = null;
3987c478bd9Sstevel@tonic-gate             fillPrincipalList(curPrPattern);
3997c478bd9Sstevel@tonic-gate         }
4007c478bd9Sstevel@tonic-gate     }
4017c478bd9Sstevel@tonic-gate 
checkRefreshPolicies()4027c478bd9Sstevel@tonic-gate     public void checkRefreshPolicies() {
4037c478bd9Sstevel@tonic-gate         if (mainHelpMode)
4047c478bd9Sstevel@tonic-gate             showHelp("RefreshPolicies");
4057c478bd9Sstevel@tonic-gate         else {
4067c478bd9Sstevel@tonic-gate             policyList = null;
4077c478bd9Sstevel@tonic-gate             fillPolicyList(curPoPattern);
4087c478bd9Sstevel@tonic-gate         }
4097c478bd9Sstevel@tonic-gate     }
4107c478bd9Sstevel@tonic-gate 
4117c478bd9Sstevel@tonic-gate     // Mainframe and loginframe
4127c478bd9Sstevel@tonic-gate 
checkExit(Frame frame)4137c478bd9Sstevel@tonic-gate     public void checkExit(Frame frame) {
4147c478bd9Sstevel@tonic-gate         if ((loginHelpMode && frame == realLoginFrame)
4157c478bd9Sstevel@tonic-gate             || (mainHelpMode && frame == realMainFrame))
4167c478bd9Sstevel@tonic-gate 	    showHelp("Exit");
4177c478bd9Sstevel@tonic-gate         else if (okayToLeave(frame))
4187c478bd9Sstevel@tonic-gate             exit();
4197c478bd9Sstevel@tonic-gate     }
4207c478bd9Sstevel@tonic-gate 
checkHelp(Frame frame)4217c478bd9Sstevel@tonic-gate     public void checkHelp(Frame frame) {
4227c478bd9Sstevel@tonic-gate         if ((loginHelpMode && frame == realLoginFrame)
4237c478bd9Sstevel@tonic-gate             || (mainHelpMode && frame == realMainFrame))
4247c478bd9Sstevel@tonic-gate 	    showHelp("HelpBrowser");
4257c478bd9Sstevel@tonic-gate         else
4267c478bd9Sstevel@tonic-gate             showHelpBrowser(frame);
4277c478bd9Sstevel@tonic-gate     }
4287c478bd9Sstevel@tonic-gate 
checkAbout(Frame frame)4297c478bd9Sstevel@tonic-gate     public void checkAbout(Frame frame) {
4307c478bd9Sstevel@tonic-gate         if ((loginHelpMode && frame == realLoginFrame)
4317c478bd9Sstevel@tonic-gate             || (mainHelpMode && frame == realMainFrame))
4327c478bd9Sstevel@tonic-gate 	    showHelp("About");
4337c478bd9Sstevel@tonic-gate         else
4347c478bd9Sstevel@tonic-gate             doAbout(frame);
4357c478bd9Sstevel@tonic-gate     }
4367c478bd9Sstevel@tonic-gate 
okayToLeave(Frame frame)4377c478bd9Sstevel@tonic-gate     public boolean okayToLeave(Frame frame) {
4387c478bd9Sstevel@tonic-gate         if (prNeedSave || poNeedSave || glNeedSave) {
4397c478bd9Sstevel@tonic-gate             String text[] = {getString("You are about to lose changes."),
4407c478bd9Sstevel@tonic-gate 			     getString("Click Save to commit changes, "
4417c478bd9Sstevel@tonic-gate 				       +"Discard to discard changes, "
4427c478bd9Sstevel@tonic-gate 				       +"or Cancel to continue editing.")};
4437c478bd9Sstevel@tonic-gate             String resp = confirmSave(frame, text);
4447c478bd9Sstevel@tonic-gate             if (resp.equals(getString("Cancel")))
4457c478bd9Sstevel@tonic-gate                 return false;
4467c478bd9Sstevel@tonic-gate             else if (resp.equals(getString("Save"))) {
4477c478bd9Sstevel@tonic-gate                 if (prNeedSave)
4487c478bd9Sstevel@tonic-gate                     if (!prDoSave())
4497c478bd9Sstevel@tonic-gate 			return false; // found an error so cannot leave
4507c478bd9Sstevel@tonic-gate                 if (poNeedSave)
4517c478bd9Sstevel@tonic-gate                     if (!poDoSave())
4527c478bd9Sstevel@tonic-gate 			return false; // found an error so cannot leave
4537c478bd9Sstevel@tonic-gate                 if (glNeedSave)
4547c478bd9Sstevel@tonic-gate                     glDoSave(true);
4557c478bd9Sstevel@tonic-gate             } else
4567c478bd9Sstevel@tonic-gate                 prNeedSave = poNeedSave = glNeedSave = false;
4577c478bd9Sstevel@tonic-gate         }
4587c478bd9Sstevel@tonic-gate         return true;
4597c478bd9Sstevel@tonic-gate     }
4607c478bd9Sstevel@tonic-gate 
4617c478bd9Sstevel@tonic-gate     /**
4627c478bd9Sstevel@tonic-gate      * We use the JDK 1.1 event model for most of our events, but
4637c478bd9Sstevel@tonic-gate      * we do still need to handle old-style events because the
4647c478bd9Sstevel@tonic-gate      * tabbed folder and the card panel(supplied by Java Workshop)
4657c478bd9Sstevel@tonic-gate      * are not compatible with the new event model.  We use the
4667c478bd9Sstevel@tonic-gate      * callouts from Java Workshop to deal with the card panel,
4677c478bd9Sstevel@tonic-gate      * but we need to have some code here to do the right thing
4687c478bd9Sstevel@tonic-gate      * when the user selects a new tab in the tabbed folder.
4697c478bd9Sstevel@tonic-gate      *
4707c478bd9Sstevel@tonic-gate      * It is important that not too many conditions are tested here,
4717c478bd9Sstevel@tonic-gate      * because all events flow through this code path.
4727c478bd9Sstevel@tonic-gate      *
4737c478bd9Sstevel@tonic-gate      */
handleEvent(Message msg, Event evt)4747c478bd9Sstevel@tonic-gate     public boolean handleEvent(Message msg, Event evt) {
4757c478bd9Sstevel@tonic-gate 
4767c478bd9Sstevel@tonic-gate         /*
4777c478bd9Sstevel@tonic-gate          * Look for events from the principal and policy list.
4787c478bd9Sstevel@tonic-gate          */
4797c478bd9Sstevel@tonic-gate 
4807c478bd9Sstevel@tonic-gate         if (evt.target == gui.Prlist.getBody()) {
4817c478bd9Sstevel@tonic-gate             if (mainHelpMode) {
4827c478bd9Sstevel@tonic-gate                 if (evt.id == Event.ACTION_EVENT
4837c478bd9Sstevel@tonic-gate 		    || evt.id == Event.LIST_SELECT) {
4847c478bd9Sstevel@tonic-gate                     restorePrListSelection();
4857c478bd9Sstevel@tonic-gate                     showHelp(((Component)gui.Prlist.getBody()).getName());
4867c478bd9Sstevel@tonic-gate                 }
4877c478bd9Sstevel@tonic-gate             } // end of help mode
4887c478bd9Sstevel@tonic-gate             else if (evt.id == Event.ACTION_EVENT)
4897c478bd9Sstevel@tonic-gate                 prModify();
4907c478bd9Sstevel@tonic-gate             else if (evt.id == Event.LIST_SELECT)
4917c478bd9Sstevel@tonic-gate                 lookAtPrList();
4927c478bd9Sstevel@tonic-gate             return true;
4937c478bd9Sstevel@tonic-gate         } // end of Prlist
4947c478bd9Sstevel@tonic-gate 
4957c478bd9Sstevel@tonic-gate         if (evt.target == gui.Pollist.getBody()) {
4967c478bd9Sstevel@tonic-gate             if (mainHelpMode) {
4977c478bd9Sstevel@tonic-gate                 if (evt.id == Event.ACTION_EVENT
4987c478bd9Sstevel@tonic-gate 		    || evt.id == Event.LIST_SELECT) {
4997c478bd9Sstevel@tonic-gate                     restorePoListSelection();
5007c478bd9Sstevel@tonic-gate                     showHelp(((Component)gui.Pollist.getBody()).getName());
5017c478bd9Sstevel@tonic-gate                 }
5027c478bd9Sstevel@tonic-gate             } // end of help mode
5037c478bd9Sstevel@tonic-gate             else if (evt.id == Event.ACTION_EVENT)
5047c478bd9Sstevel@tonic-gate                 poSelected();
5057c478bd9Sstevel@tonic-gate             else if (evt.id == Event.LIST_SELECT)
5067c478bd9Sstevel@tonic-gate                 lookAtPoList();
5077c478bd9Sstevel@tonic-gate             return true;
5087c478bd9Sstevel@tonic-gate         } // end of Pollist
5097c478bd9Sstevel@tonic-gate 
5107c478bd9Sstevel@tonic-gate         /*
5117c478bd9Sstevel@tonic-gate          * Look for a unique event from the tabbed folder component;
5127c478bd9Sstevel@tonic-gate          * if I see it, I know I have a chance to disallow a switch.
5137c478bd9Sstevel@tonic-gate          * This makes sure data is saved before leaving a tab.
5147c478bd9Sstevel@tonic-gate          */
5157c478bd9Sstevel@tonic-gate         if (evt.id == TabbedFolder.CONFIRM_SWITCH) {
5167c478bd9Sstevel@tonic-gate             // System.out.println("Got confirm for "+evt.arg);
5177c478bd9Sstevel@tonic-gate             String e = (String)evt.arg;
5187c478bd9Sstevel@tonic-gate             if (!mainHelpMode && okayToLeave(realMainFrame) == false) {
5197c478bd9Sstevel@tonic-gate                 // System.out.println("Denying switch");
5207c478bd9Sstevel@tonic-gate                 ((TabbedFolder)gui.tabbedfolder1.getBody()).cancelSwitch();
5217c478bd9Sstevel@tonic-gate             }
5227c478bd9Sstevel@tonic-gate             /*
5237c478bd9Sstevel@tonic-gate              * Okay with switch; make sure the data is up to date
5247c478bd9Sstevel@tonic-gate              */
5257c478bd9Sstevel@tonic-gate             else if (e.compareTo(getString("Principals")) == 0) {
5267c478bd9Sstevel@tonic-gate                 if (mainHelpMode) {
5277c478bd9Sstevel@tonic-gate                     showHelp("PrincipalTab");
5287c478bd9Sstevel@tonic-gate                     ((TabbedFolder)gui.tabbedfolder1.getBody()).cancelSwitch();
5297c478bd9Sstevel@tonic-gate                 } else {
5307c478bd9Sstevel@tonic-gate                     showPrincipalList(curPrPattern);
5317c478bd9Sstevel@tonic-gate                     disablePolicyPrinting();
5327c478bd9Sstevel@tonic-gate                 }
5337c478bd9Sstevel@tonic-gate             } else if (e.compareTo(getString("Policies")) == 0) {
5347c478bd9Sstevel@tonic-gate                 if (mainHelpMode) {
5357c478bd9Sstevel@tonic-gate                     showHelp("PolicyTab");
5367c478bd9Sstevel@tonic-gate                     ((TabbedFolder)gui.tabbedfolder1.getBody()).cancelSwitch();
5377c478bd9Sstevel@tonic-gate                 } else {
5387c478bd9Sstevel@tonic-gate                     showPolicyList(curPoPattern);
5397c478bd9Sstevel@tonic-gate                     disablePrincipalPrinting();
5407c478bd9Sstevel@tonic-gate                 }
5417c478bd9Sstevel@tonic-gate             }
5427c478bd9Sstevel@tonic-gate         }
5437c478bd9Sstevel@tonic-gate         return super.handleEvent(msg, evt);
5447c478bd9Sstevel@tonic-gate     }
5457c478bd9Sstevel@tonic-gate 
5467c478bd9Sstevel@tonic-gate     /*
5477c478bd9Sstevel@tonic-gate      * New methods for the admin gui login screen.
5487c478bd9Sstevel@tonic-gate      */
5497c478bd9Sstevel@tonic-gate 
5507c478bd9Sstevel@tonic-gate     /**
5517c478bd9Sstevel@tonic-gate      * Set strings on login screen to their I18N'd values
5527c478bd9Sstevel@tonic-gate      *
5537c478bd9Sstevel@tonic-gate      */
initLoginStrings()5547c478bd9Sstevel@tonic-gate     public void initLoginStrings() {
5557c478bd9Sstevel@tonic-gate         gui.File2.set("text" /* NOI18N */, getString("File"));
5567c478bd9Sstevel@tonic-gate         gui.Exit2.set("text" /* NOI18N */, getString("Exit"));
5577c478bd9Sstevel@tonic-gate         gui.menu1.set("text" /* NOI18N */, getString("Help"));
5587c478bd9Sstevel@tonic-gate         gui.browserHelp1.set("text" /* NOI18N */, getString("Help Contents"));
5597c478bd9Sstevel@tonic-gate         gui.Context2.set("text" /* NOI18N */,
5607c478bd9Sstevel@tonic-gate 			 getString("Context-Sensitive Help"));
5617c478bd9Sstevel@tonic-gate         gui.About2.set("text" /* NOI18N */, getString("About"));
5627c478bd9Sstevel@tonic-gate         gui.LoginNameLabel.set("text" /* NOI18N */,
5637c478bd9Sstevel@tonic-gate 			       getString("Principal Name:"));
5647c478bd9Sstevel@tonic-gate         gui.LoginPassLabel.set("text" /* NOI18N */, getString("Password:"));
5657c478bd9Sstevel@tonic-gate         gui.LoginRealmLabel.set("text" /* NOI18N */, getString("Realm:"));
5667c478bd9Sstevel@tonic-gate         gui.LoginServerLabel.set("text" /* NOI18N */, getString("Master KDC:"));
5677c478bd9Sstevel@tonic-gate         gui.LoginOK.set("text" /* NOI18N */, getString("OK"));
5687c478bd9Sstevel@tonic-gate         gui.LoginStartOver.set("text" /* NOI18N */, getString("Start Over"));
5697c478bd9Sstevel@tonic-gate     }
5707c478bd9Sstevel@tonic-gate 
5717c478bd9Sstevel@tonic-gate     /**
5727c478bd9Sstevel@tonic-gate      * Set strings on main screen to their I18N'd values
5737c478bd9Sstevel@tonic-gate      *
5747c478bd9Sstevel@tonic-gate      */
initMainStrings()5757c478bd9Sstevel@tonic-gate     public void initMainStrings() {
5767c478bd9Sstevel@tonic-gate         gui.mainframe.set("title" /* NOI18N */,
5777c478bd9Sstevel@tonic-gate 			  getString("SEAM Administration Tool"));
5787c478bd9Sstevel@tonic-gate         gui.File.set("text" /* NOI18N */, getString("File"));
5797c478bd9Sstevel@tonic-gate         gui.Print.set("text" /* NOI18N */, getString("Print"));
5807c478bd9Sstevel@tonic-gate         gui.PrintCurPr.set("text" /* NOI18N */, getString("Current Principal"));
5817c478bd9Sstevel@tonic-gate         gui.PrintCurPol.set("text" /* NOI18N */, getString("Current Policy"));
5827c478bd9Sstevel@tonic-gate         gui.PrintPrlist.set("text" /* NOI18N */, getString("Principal List"));
5837c478bd9Sstevel@tonic-gate         gui.PrintPollist.set("text" /* NOI18N */, getString("Policy List"));
5847c478bd9Sstevel@tonic-gate         gui.logout.set("text" /* NOI18N */, getString("Log Out"));
5857c478bd9Sstevel@tonic-gate         gui.Exit.set("text" /* NOI18N */, getString("Exit"));
5867c478bd9Sstevel@tonic-gate         gui.editMenu.set("text" /* NOI18N */, getString("Edit"));
5877c478bd9Sstevel@tonic-gate         gui.editPreferences.set("text" /* NOI18N */,
5887c478bd9Sstevel@tonic-gate 				getString("Properties..."));
5897c478bd9Sstevel@tonic-gate         gui.menu2.set("text" /* NOI18N */, getString("Refresh"));
5907c478bd9Sstevel@tonic-gate         gui.refreshPrincipals.set("text" /* NOI18N */,
5917c478bd9Sstevel@tonic-gate 				  getString("Principal List"));
5927c478bd9Sstevel@tonic-gate         gui.refreshPolicies.set("text" /* NOI18N */, getString("Policy List"));
5937c478bd9Sstevel@tonic-gate         gui.Help.set("text" /* NOI18N */, getString("Help"));
5947c478bd9Sstevel@tonic-gate         gui.browserHelp2.set("text" /* NOI18N */, getString("Help Contents"));
5957c478bd9Sstevel@tonic-gate         gui.Context.set("text" /* NOI18N */,
5967c478bd9Sstevel@tonic-gate 			getString("Context-Sensitive Help"));
5977c478bd9Sstevel@tonic-gate         gui.About.set("text" /* NOI18N */, getString("About"));
5987c478bd9Sstevel@tonic-gate 
5997c478bd9Sstevel@tonic-gate         gui.Prlisttab.set("layoutName", getString("Principals"));
6007c478bd9Sstevel@tonic-gate         gui.Pollisttab.set("layoutName", getString("Policies"));
6017c478bd9Sstevel@tonic-gate 
6027c478bd9Sstevel@tonic-gate         gui.PrListLabel.set("text" /* NOI18N */, getString("Principal List"));
6037c478bd9Sstevel@tonic-gate         gui.PrSearchLab.set("text" /* NOI18N */, getString("Filter Pattern:"));
6047c478bd9Sstevel@tonic-gate         gui.PrListClear.set("text" /* NOI18N */, getString("Clear Filter"));
6057c478bd9Sstevel@tonic-gate         gui.PrListModify.set("text" /* NOI18N */, getString("Modify"));
6067c478bd9Sstevel@tonic-gate         gui.PrListAdd.set("text" /* NOI18N */, getString("Create New"));
6077c478bd9Sstevel@tonic-gate         gui.PrListDelete.set("text" /* NOI18N */, getString("Delete"));
6087c478bd9Sstevel@tonic-gate         gui.PrListDuplicate.set("text" /* NOI18N */, getString("Duplicate"));
6097c478bd9Sstevel@tonic-gate 
6107c478bd9Sstevel@tonic-gate         gui.PrBasicLabel.set("text" /* NOI18N */,
6117c478bd9Sstevel@tonic-gate 			     getString("Principal Basics"));
6127c478bd9Sstevel@tonic-gate         gui.PrNameLabel1.set("text" /* NOI18N */, getString("Principal Name:"));
6137c478bd9Sstevel@tonic-gate         gui.LabelBarGeneral.set("text" /* NOI18N */, getString("General"));
6147c478bd9Sstevel@tonic-gate         gui.PrCommentsLabel.set("text" /* NOI18N */, getString("Comments:"));
6157c478bd9Sstevel@tonic-gate         gui.PrPolicyLabel.set("text" /* NOI18N */, getString("Policy:"));
6167c478bd9Sstevel@tonic-gate         gui.PrPasswordLabel.set("text" /* NOI18N */, getString("Password:"));
6177c478bd9Sstevel@tonic-gate         gui.PrBasicRandomPw.set("text" /* NOI18N */,
6187c478bd9Sstevel@tonic-gate 				getString("Generate Random Password"));
61945526e97Ssemery         gui.EncListLabel.set("text" /* NOI18N */,
62045526e97Ssemery 			getString("Encryption Key Types:"));
6217c478bd9Sstevel@tonic-gate         gui.LabelBarPrincipal.set("text" /* NOI18N */,
6227c478bd9Sstevel@tonic-gate 				  getString("Admin History"));
6237c478bd9Sstevel@tonic-gate         gui.PrLastChangedTimeLabel.set("text" /* NOI18N */,
6247c478bd9Sstevel@tonic-gate 				       getString("Last Principal Change:"));
6257c478bd9Sstevel@tonic-gate         gui.PrLastChangedByLabel.set("text" /* NOI18N */,
6267c478bd9Sstevel@tonic-gate 				     getString("Last Changed By:"));
6277c478bd9Sstevel@tonic-gate         gui.PrExpiryLabel.set("text" /* NOI18N */,
6287c478bd9Sstevel@tonic-gate 			      getString("Account Expires:"));
6297c478bd9Sstevel@tonic-gate         gui.PrBasicSave.set("text" /* NOI18N */, getString("Save"));
6307c478bd9Sstevel@tonic-gate         gui.PrBasicPrevious.set("text" /* NOI18N */, getString("Previous"));
6317c478bd9Sstevel@tonic-gate         gui.PrBasicNext.set("text" /* NOI18N */, getString("Next"));
6327c478bd9Sstevel@tonic-gate         gui.PrBasicCancel.set("text" /* NOI18N */, getString("Cancel"));
6337c478bd9Sstevel@tonic-gate 
6347c478bd9Sstevel@tonic-gate         gui.PrDetailLabel.set("text" /* NOI18N */,
6357c478bd9Sstevel@tonic-gate 			      getString("Principal Details"));
6367c478bd9Sstevel@tonic-gate         gui.LabelBarPassword.set("text" /* NOI18N */, getString("Password"));
6377c478bd9Sstevel@tonic-gate         gui.PrLastSuccessLabel.set("text" /* NOI18N */,
6387c478bd9Sstevel@tonic-gate 				   getString("Last Success:"));
6397c478bd9Sstevel@tonic-gate         gui.PrLastFailureLabel.set("text" /* NOI18N */,
6407c478bd9Sstevel@tonic-gate 				   getString("Last Failure:"));
6417c478bd9Sstevel@tonic-gate         gui.PrFailureCountLabel.set("text" /* NOI18N */,
6427c478bd9Sstevel@tonic-gate 				    getString("Failure Count:"));
6437c478bd9Sstevel@tonic-gate         gui.PrPwLastChangedLabel.set("text" /* NOI18N */,
6447c478bd9Sstevel@tonic-gate 				     getString("Last Password Change:"));
6457c478bd9Sstevel@tonic-gate         gui.PrPwExpiryLabel.set("text" /* NOI18N */,
6467c478bd9Sstevel@tonic-gate 				getString("Password Expires:"));
6477c478bd9Sstevel@tonic-gate         gui.PrKvnoLabel.set("text" /* NOI18N */, getString("Key Version:"));
6487c478bd9Sstevel@tonic-gate         gui.LabelBarTicket.set("text" /* NOI18N */,
6497c478bd9Sstevel@tonic-gate 			       getString("Ticket Lifetimes"));
6507c478bd9Sstevel@tonic-gate         gui.PrMaxTicketLifetimeLabel.set("text" /* NOI18N */,
6517c478bd9Sstevel@tonic-gate 				 getString("Maximum Lifetime (seconds):"));
6527c478bd9Sstevel@tonic-gate         gui.PrMaxTicketRenewalLabel.set("text" /* NOI18N */,
6537c478bd9Sstevel@tonic-gate 				getString("Maximum Renewal (seconds):"));
6547c478bd9Sstevel@tonic-gate         gui.PrDetailSave.set("text" /* NOI18N */, getString("Save"));
6557c478bd9Sstevel@tonic-gate         gui.PrDetailPrevious.set("text" /* NOI18N */, getString("Previous"));
6567c478bd9Sstevel@tonic-gate         gui.PrDetailNext.set("text" /* NOI18N */, getString("Next"));
6577c478bd9Sstevel@tonic-gate         gui.PrDetailCancel.set("text" /* NOI18N */, getString("Cancel"));
6587c478bd9Sstevel@tonic-gate 
6597c478bd9Sstevel@tonic-gate         gui.PrFlagLabel.set("text" /* NOI18N */, getString("Principal Flags"));
6607c478bd9Sstevel@tonic-gate         gui.LabelBarSecurity.set("text" /* NOI18N */, getString("Security"));
6617c478bd9Sstevel@tonic-gate 
6627c478bd9Sstevel@tonic-gate         gui.PrLockAcct.set("text" /* NOI18N */,
6637c478bd9Sstevel@tonic-gate 			   Flags.getLabel(Flags.DISALLOW_ALL_TIX));
6647c478bd9Sstevel@tonic-gate         gui.PrForcePwChange.set("text" /* NOI18N */,
6657c478bd9Sstevel@tonic-gate 				Flags.getLabel(Flags.REQUIRES_PWCHANGE));
6667c478bd9Sstevel@tonic-gate         gui.LabelBarTickets.set("text" /* NOI18N */, getString("Ticket"));
6677c478bd9Sstevel@tonic-gate         gui.PrAllowPostdated.set("text" /* NOI18N */,
6687c478bd9Sstevel@tonic-gate 				 Flags.getLabel(Flags.DISALLOW_POSTDATED));
6697c478bd9Sstevel@tonic-gate         gui.PrAllowForwardable.set("text" /* NOI18N */,
6707c478bd9Sstevel@tonic-gate 				   Flags.getLabel(Flags.DISALLOW_FORWARDABLE));
6717c478bd9Sstevel@tonic-gate         gui.PrAllowRenewable.set("text" /* NOI18N */,
6727c478bd9Sstevel@tonic-gate 				 Flags.getLabel(Flags.DISALLOW_RENEWABLE));
6737c478bd9Sstevel@tonic-gate         gui.PrAllowProxiable.set("text" /* NOI18N */,
6747c478bd9Sstevel@tonic-gate 				 Flags.getLabel(Flags.DISALLOW_PROXIABLE));
6757c478bd9Sstevel@tonic-gate         gui.PrAllowSvr.set("text" /* NOI18N */,
6767c478bd9Sstevel@tonic-gate 			   Flags.getLabel(Flags.DISALLOW_SVR));
6777c478bd9Sstevel@tonic-gate         gui.LabelBarMiscellany.set("text" /* NOI18N */,
6787c478bd9Sstevel@tonic-gate 				   getString("Miscellaneous"));
6797c478bd9Sstevel@tonic-gate         gui.PrAllowTGT.set("text" /* NOI18N */,
6807c478bd9Sstevel@tonic-gate 			   Flags.getLabel(Flags.DISALLOW_TGT_BASED));
6817c478bd9Sstevel@tonic-gate         gui.PrAllowDupAuth.set("text" /* NOI18N */,
6827c478bd9Sstevel@tonic-gate 			       Flags.getLabel(Flags.DISALLOW_DUP_SKEY));
6837c478bd9Sstevel@tonic-gate         gui.PrRequirePreAuth.set("text" /* NOI18N */,
6847c478bd9Sstevel@tonic-gate 				 Flags.getLabel(Flags.REQUIRE_PRE_AUTH));
6857c478bd9Sstevel@tonic-gate         gui.PrRequireHwPreAuth.set("text" /* NOI18N */,
6867c478bd9Sstevel@tonic-gate 				   Flags.getLabel(Flags.REQUIRE_HW_AUTH));
6877c478bd9Sstevel@tonic-gate         gui.PrFlagsSave.set("text" /* NOI18N */, getString("Save"));
6887c478bd9Sstevel@tonic-gate         gui.PrFlagsPrevious.set("text" /* NOI18N */, getString("Previous"));
6897c478bd9Sstevel@tonic-gate         gui.PrFlagsNext.set("text" /* NOI18N */, getString("Done"));
6907c478bd9Sstevel@tonic-gate         gui.PrFlagsCancel.set("text" /* NOI18N */, getString("Cancel"));
6917c478bd9Sstevel@tonic-gate 
6927c478bd9Sstevel@tonic-gate         gui.PoListLabel.set("text" /* NOI18N */, getString("Policy List"));
6937c478bd9Sstevel@tonic-gate         gui.PoListPatternLabel.set("text" /* NOI18N */,
6947c478bd9Sstevel@tonic-gate 				   getString("Filter Pattern:"));
6957c478bd9Sstevel@tonic-gate         gui.PoListClear.set("text" /* NOI18N */, getString("Clear Filter"));
6967c478bd9Sstevel@tonic-gate         gui.PoListModify.set("text" /* NOI18N */, getString("Modify"));
6977c478bd9Sstevel@tonic-gate         gui.PoListAdd.set("text" /* NOI18N */, getString("Create New"));
6987c478bd9Sstevel@tonic-gate         gui.PoListDelete.set("text" /* NOI18N */, getString("Delete"));
6997c478bd9Sstevel@tonic-gate         gui.PoListDuplicate.set("text" /* NOI18N */, getString("Duplicate"));
7007c478bd9Sstevel@tonic-gate 
7017c478bd9Sstevel@tonic-gate         gui.PoDetailLabel.set("text" /* NOI18N */, getString("Policy Details"));
7027c478bd9Sstevel@tonic-gate         gui.PoNameLabel.set("text" /* NOI18N */, getString("Policy Name:"));
7037c478bd9Sstevel@tonic-gate         gui.PoMinPwLengthLabel.set("text" /* NOI18N */,
7047c478bd9Sstevel@tonic-gate 				   getString("Minimum Password Length:"));
7057c478bd9Sstevel@tonic-gate         gui.PoMinPwClassLabel.set("text" /* NOI18N */,
7067c478bd9Sstevel@tonic-gate 				  getString("Minimum Password Classes:"));
7077c478bd9Sstevel@tonic-gate         gui.PoSavedPasswordsLabel.set("text" /* NOI18N */,
7087c478bd9Sstevel@tonic-gate 				      getString("Saved Password History:"));
7097c478bd9Sstevel@tonic-gate         gui.PoMinTicketLifetimeLabel.set("text" /* NOI18N */,
7107c478bd9Sstevel@tonic-gate 			 getString("Minimum Password Lifetime (seconds):"));
7117c478bd9Sstevel@tonic-gate         gui.PoMaxTicketLifetimeLabel.set("text" /* NOI18N */,
7127c478bd9Sstevel@tonic-gate 			 getString("Maximum Password Lifetime (seconds):"));
7137c478bd9Sstevel@tonic-gate         gui.PoReferencesLabel.set("text" /* NOI18N */,
7147c478bd9Sstevel@tonic-gate 				  getString("Principals Using This Policy:"));
7157c478bd9Sstevel@tonic-gate         gui.PoDetailSave.set("text" /* NOI18N */, getString("Save"));
7167c478bd9Sstevel@tonic-gate         gui.PoDetailPrevious.set("text" /* NOI18N */, getString("Previous"));
7177c478bd9Sstevel@tonic-gate         gui.PoDetailDone.set("text" /* NOI18N */, getString("Done"));
7187c478bd9Sstevel@tonic-gate         gui.PoDetailCancel.set("text" /* NOI18N */, getString("Cancel"));
7197c478bd9Sstevel@tonic-gate     }
7207c478bd9Sstevel@tonic-gate 
7217c478bd9Sstevel@tonic-gate     /**
7227c478bd9Sstevel@tonic-gate      * Allow user to see a fatal error before exiting
7237c478bd9Sstevel@tonic-gate      */
fatalError(Frame frame, String[] text)7247c478bd9Sstevel@tonic-gate     public void fatalError(Frame frame, String[] text) {
7257c478bd9Sstevel@tonic-gate         String title = getString("Error");
7267c478bd9Sstevel@tonic-gate         String[] buttons = new String[1];
7277c478bd9Sstevel@tonic-gate         buttons[0] = getString("OK");
7287c478bd9Sstevel@tonic-gate         ChoiceDialog cd = new ChoiceDialog(frame, title, text, buttons);
7297c478bd9Sstevel@tonic-gate         cd.getSelection();
7307c478bd9Sstevel@tonic-gate         exit();
7317c478bd9Sstevel@tonic-gate     }
7327c478bd9Sstevel@tonic-gate 
7337c478bd9Sstevel@tonic-gate     /**
7347c478bd9Sstevel@tonic-gate      * Set the defaults for the login screen.  Called on startup,
7357c478bd9Sstevel@tonic-gate      * when "Start Over" is pressed, or when "Log Out" is chosen
7367c478bd9Sstevel@tonic-gate      * from the main screen's menu.
7377c478bd9Sstevel@tonic-gate      *
7387c478bd9Sstevel@tonic-gate      */
setLoginDefaults()7397c478bd9Sstevel@tonic-gate     public void setLoginDefaults() {
7407c478bd9Sstevel@tonic-gate         CurName = DefName;
7417c478bd9Sstevel@tonic-gate         CurPass = "";
7427c478bd9Sstevel@tonic-gate         if (DefRealm != null)
7437c478bd9Sstevel@tonic-gate             CurRealm = DefRealm;
7447c478bd9Sstevel@tonic-gate         else {
7457c478bd9Sstevel@tonic-gate             CurRealm = "";
7467c478bd9Sstevel@tonic-gate             if (firsttime) {
7477c478bd9Sstevel@tonic-gate                 showLoginWarning(getString("Cannot find default realm; "
7487c478bd9Sstevel@tonic-gate 					   +"check /etc/krb5/krb5.conf"));
7497c478bd9Sstevel@tonic-gate                 firsttime = false;
7507c478bd9Sstevel@tonic-gate             }
7517c478bd9Sstevel@tonic-gate         }
7527c478bd9Sstevel@tonic-gate         if (DefServer != null)
7537c478bd9Sstevel@tonic-gate             CurServer = DefServer;
7547c478bd9Sstevel@tonic-gate         else
7557c478bd9Sstevel@tonic-gate             CurServer = "";
7567c478bd9Sstevel@tonic-gate         CurPort = 0;
7577c478bd9Sstevel@tonic-gate         try {
7587c478bd9Sstevel@tonic-gate             Integer i = new Integer(DefPort);
7597c478bd9Sstevel@tonic-gate             CurPort = i.intValue();
7607c478bd9Sstevel@tonic-gate         } catch (NumberFormatException e) {}
7617c478bd9Sstevel@tonic-gate         gui.LoginName.set("text" /* NOI18N */, CurName);
7627c478bd9Sstevel@tonic-gate         gui.LoginPass.set("text" /* NOI18N */, CurPass);
7637c478bd9Sstevel@tonic-gate         gui.LoginRealm.set("text" /* NOI18N */, CurRealm);
7647c478bd9Sstevel@tonic-gate         gui.LoginServer.set("text" /* NOI18N */, CurServer);
7657c478bd9Sstevel@tonic-gate         if (CurRealm.equals("___default_realm___")) {
7667c478bd9Sstevel@tonic-gate             String[] error = new String[1];
7677c478bd9Sstevel@tonic-gate             error[0] = getString(
7687c478bd9Sstevel@tonic-gate 				 "Kerberos /etc/krb5/krb5.conf configuration"
7697c478bd9Sstevel@tonic-gate 				 +" file not configured; exiting");
7707c478bd9Sstevel@tonic-gate             fatalError(realLoginFrame, error);
7717c478bd9Sstevel@tonic-gate         }
7727c478bd9Sstevel@tonic-gate         if (!loginListeners)
7737c478bd9Sstevel@tonic-gate             setupLoginNormalListeners();
7747c478bd9Sstevel@tonic-gate         loginListeners = true;
7757c478bd9Sstevel@tonic-gate         TextField name = (TextField)gui.LoginName.getBody();
7767c478bd9Sstevel@tonic-gate         name.selectAll();
7777c478bd9Sstevel@tonic-gate         name.requestFocus();
7787c478bd9Sstevel@tonic-gate     }
7797c478bd9Sstevel@tonic-gate 
7807c478bd9Sstevel@tonic-gate     /**
7817c478bd9Sstevel@tonic-gate      * React after new realm entered
7827c478bd9Sstevel@tonic-gate      *
7837c478bd9Sstevel@tonic-gate      */
newRealm()7847c478bd9Sstevel@tonic-gate     public void newRealm() {
7857c478bd9Sstevel@tonic-gate         CurRealm = (String)gui.LoginRealm.get("text" /* NOI18N */);
7867c478bd9Sstevel@tonic-gate         String s = kc.getRealmServer(CurRealm);
7877c478bd9Sstevel@tonic-gate         if (s != null) {
7887c478bd9Sstevel@tonic-gate             CurServer = s;
7897c478bd9Sstevel@tonic-gate             gui.LoginServer.set("text" /* NOI18N */, CurServer);
7907c478bd9Sstevel@tonic-gate 
7917c478bd9Sstevel@tonic-gate         } else {
7927c478bd9Sstevel@tonic-gate             showLoginWarning(getString("Cannot find default server for realm"));
7937c478bd9Sstevel@tonic-gate             CurServer = "";
7947c478bd9Sstevel@tonic-gate             gui.LoginServer.set("text" /* NOI18N */, CurServer);
7957c478bd9Sstevel@tonic-gate             ((TextField)gui.LoginServer.getBody()).requestFocus();
7967c478bd9Sstevel@tonic-gate         }
7977c478bd9Sstevel@tonic-gate     }
7987c478bd9Sstevel@tonic-gate 
7997c478bd9Sstevel@tonic-gate     /**
8007c478bd9Sstevel@tonic-gate      * React after new server entered
8017c478bd9Sstevel@tonic-gate      *
8027c478bd9Sstevel@tonic-gate      */
newServer()8037c478bd9Sstevel@tonic-gate     public void newServer() {
8047c478bd9Sstevel@tonic-gate         CurServer = (String)gui.LoginServer.get("text" /* NOI18N */);
8057c478bd9Sstevel@tonic-gate         if (CurPass.compareTo("") != 0)
8067c478bd9Sstevel@tonic-gate             loginComplete();
8077c478bd9Sstevel@tonic-gate     }
8087c478bd9Sstevel@tonic-gate 
8097c478bd9Sstevel@tonic-gate     /**
8107c478bd9Sstevel@tonic-gate      * React after username is complete
8117c478bd9Sstevel@tonic-gate      *
8127c478bd9Sstevel@tonic-gate      */
nameComplete()8137c478bd9Sstevel@tonic-gate     public void nameComplete() {
8147c478bd9Sstevel@tonic-gate         ((TextField)gui.LoginName.getBody()).select(0, 0);
8157c478bd9Sstevel@tonic-gate         ((TextField)gui.LoginPass.getBody()).requestFocus();
8167c478bd9Sstevel@tonic-gate     }
8177c478bd9Sstevel@tonic-gate 
8187c478bd9Sstevel@tonic-gate     /**
8197c478bd9Sstevel@tonic-gate      * React after password is complete or "OK" button is pressed.
8207c478bd9Sstevel@tonic-gate      * We insist that the realm and server are set here separately
8217c478bd9Sstevel@tonic-gate      * so that we can permit field-to-field motion if /etc/krb5/krb5.conf
8227c478bd9Sstevel@tonic-gate      * does not exist.
8237c478bd9Sstevel@tonic-gate      *
8247c478bd9Sstevel@tonic-gate      */
passwordComplete()8257c478bd9Sstevel@tonic-gate     public void passwordComplete() {
8267c478bd9Sstevel@tonic-gate         CurPass = (String)gui.LoginPass.get("text" /* NOI18N */);
8277c478bd9Sstevel@tonic-gate         if (CurRealm.compareTo("") == 0) {
8287c478bd9Sstevel@tonic-gate             ((TextField)gui.LoginRealm.getBody()).requestFocus();
8297c478bd9Sstevel@tonic-gate             return;
8307c478bd9Sstevel@tonic-gate         }
8317c478bd9Sstevel@tonic-gate         if (CurServer.compareTo("") == 0) {
8327c478bd9Sstevel@tonic-gate             ((TextField)gui.LoginServer.getBody()).requestFocus();
8337c478bd9Sstevel@tonic-gate             return;
8347c478bd9Sstevel@tonic-gate         }
8357c478bd9Sstevel@tonic-gate         loginComplete();
8367c478bd9Sstevel@tonic-gate     }
8377c478bd9Sstevel@tonic-gate 
8387c478bd9Sstevel@tonic-gate     /**
8397c478bd9Sstevel@tonic-gate      * Check to see if we're happy with the login information.
8407c478bd9Sstevel@tonic-gate      * We may want to go to the main screen, principal list tab.
8417c478bd9Sstevel@tonic-gate      *
8427c478bd9Sstevel@tonic-gate      */
loginComplete()8437c478bd9Sstevel@tonic-gate     public void loginComplete() {
8447c478bd9Sstevel@tonic-gate         pdateLoginDone = new Date();
8457c478bd9Sstevel@tonic-gate         CurName   = (String)gui.LoginName.get("text" /* NOI18N */);
8467c478bd9Sstevel@tonic-gate         CurPass   = (String)gui.LoginPass.get("text" /* NOI18N */);
8477c478bd9Sstevel@tonic-gate         CurRealm  = (String)gui.LoginRealm.get("text" /* NOI18N */);
8487c478bd9Sstevel@tonic-gate         CurServer = (String)gui.LoginServer.get("text" /* NOI18N */);
8497c478bd9Sstevel@tonic-gate         if (CurPass.compareTo("") == 0) {
8507c478bd9Sstevel@tonic-gate             showLoginWarning(getString("A password must be specified"));
8517c478bd9Sstevel@tonic-gate             ((TextField)gui.LoginPass.getBody()).requestFocus();
8527c478bd9Sstevel@tonic-gate             return;
8537c478bd9Sstevel@tonic-gate         }
8547c478bd9Sstevel@tonic-gate         if (CurRealm.compareTo("") == 0) {
8557c478bd9Sstevel@tonic-gate             showLoginWarning(getString("A realm entry must be specified"));
8567c478bd9Sstevel@tonic-gate             ((TextField)gui.LoginRealm.getBody()).requestFocus();
8577c478bd9Sstevel@tonic-gate             return;
8587c478bd9Sstevel@tonic-gate         }
8597c478bd9Sstevel@tonic-gate         if (CurServer.compareTo("") == 0) {
8607c478bd9Sstevel@tonic-gate             showLoginWarning(getString("A master KDC entry must be specified"));
8617c478bd9Sstevel@tonic-gate             ((TextField)gui.LoginServer.getBody()).requestFocus();
8627c478bd9Sstevel@tonic-gate             return;
8637c478bd9Sstevel@tonic-gate         }
8647c478bd9Sstevel@tonic-gate 
8657c478bd9Sstevel@tonic-gate         realLoginFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
8667c478bd9Sstevel@tonic-gate         Kadmin = new Kadmin();
8677c478bd9Sstevel@tonic-gate         boolean b;
8687c478bd9Sstevel@tonic-gate         try {
8697c478bd9Sstevel@tonic-gate             b = Kadmin.sessionInit(CurName, CurPass, CurRealm, CurServer,
8707c478bd9Sstevel@tonic-gate 				   CurPort);
8717c478bd9Sstevel@tonic-gate         } catch (Exception e) {
8727c478bd9Sstevel@tonic-gate             b = false;
8737c478bd9Sstevel@tonic-gate             realLoginFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
8747c478bd9Sstevel@tonic-gate             showLoginError(e.getMessage());
8757c478bd9Sstevel@tonic-gate             return;
8767c478bd9Sstevel@tonic-gate         }
8777c478bd9Sstevel@tonic-gate         realLoginFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
8787c478bd9Sstevel@tonic-gate         if (b == false) {
8797c478bd9Sstevel@tonic-gate             showLoginError(getString("Invalid login, please try again"));
8807c478bd9Sstevel@tonic-gate             return;
8817c478bd9Sstevel@tonic-gate         }
8827c478bd9Sstevel@tonic-gate         pdateSessionUp = new Date();
8837c478bd9Sstevel@tonic-gate 
8847c478bd9Sstevel@tonic-gate         // Instantiate defaults for this user
8857c478bd9Sstevel@tonic-gate         if (defaults == null)
8867c478bd9Sstevel@tonic-gate             defaults = new Defaults(System.getProperty("user.home" /* NOI18N */)
8877c478bd9Sstevel@tonic-gate 				    + "/.gkadmin" /* NOI18N */,
8887c478bd9Sstevel@tonic-gate 			    (java.awt.Color)gui.mainframe.get("background"));
8897c478bd9Sstevel@tonic-gate         else
8907c478bd9Sstevel@tonic-gate             defaults.refreshDefaults();
8917c478bd9Sstevel@tonic-gate 
8927c478bd9Sstevel@tonic-gate         // Figure out what privileges we have
8937c478bd9Sstevel@tonic-gate         try {
8947c478bd9Sstevel@tonic-gate             privs = Kadmin.getPrivs();
8957c478bd9Sstevel@tonic-gate         } catch (Exception e) {
8967c478bd9Sstevel@tonic-gate             showLoginError(e.getMessage());
8977c478bd9Sstevel@tonic-gate         }
8987c478bd9Sstevel@tonic-gate 
8997c478bd9Sstevel@tonic-gate         // Check privileges; if bad enough, we'll just give up.
9007c478bd9Sstevel@tonic-gate         if (checkPrivs() == false) {
9017c478bd9Sstevel@tonic-gate             try {
9027c478bd9Sstevel@tonic-gate                 Kadmin.sessionExit();
9037c478bd9Sstevel@tonic-gate             } catch (Exception e) {}
9047c478bd9Sstevel@tonic-gate             return;
9057c478bd9Sstevel@tonic-gate         }
9067c478bd9Sstevel@tonic-gate         reactToPrivs();
9077c478bd9Sstevel@tonic-gate 
9087c478bd9Sstevel@tonic-gate         prSetEditable(false);
9097c478bd9Sstevel@tonic-gate         prSetCanSave(false);
9107c478bd9Sstevel@tonic-gate         poSetEditable(false);
9117c478bd9Sstevel@tonic-gate         poSetCanSave(false);
9127c478bd9Sstevel@tonic-gate         prSelValid(false);
9137c478bd9Sstevel@tonic-gate         poSelValid(false);
9147c478bd9Sstevel@tonic-gate         gui.PrListPattern.set("text" /* NOI18N */, "");
9157c478bd9Sstevel@tonic-gate         gui.PoListPattern.set("text" /* NOI18N */, "");
9167c478bd9Sstevel@tonic-gate 
9177c478bd9Sstevel@tonic-gate         // Disable login frame
9187c478bd9Sstevel@tonic-gate         setListeners(LoginNormal, false);
9197c478bd9Sstevel@tonic-gate         loginListeners = false;
9207c478bd9Sstevel@tonic-gate 
9217c478bd9Sstevel@tonic-gate         pdatePreMainShow = new Date();
9227c478bd9Sstevel@tonic-gate         realLoginFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
9237c478bd9Sstevel@tonic-gate         gui.mainframe.show(true);	/* XXX - done waaay too early, fix */
9247c478bd9Sstevel@tonic-gate         realLoginFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
9257c478bd9Sstevel@tonic-gate         pdatePostMainShow = new Date();
9267c478bd9Sstevel@tonic-gate         realMainFrame  = (Frame)gui.mainframe.getBody();
9277c478bd9Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
9287c478bd9Sstevel@tonic-gate         gui.tabbedfolder1.show(getString("Principals"));
9297c478bd9Sstevel@tonic-gate         gui.cardpanel2.show("List" /* NOI18N */);
9307c478bd9Sstevel@tonic-gate         setupMainNormalListeners();
9317c478bd9Sstevel@tonic-gate         setupDefaultsEditingFrame();
9327c478bd9Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
9337c478bd9Sstevel@tonic-gate         pdateMainActive = new Date();
9347c478bd9Sstevel@tonic-gate         reportStartTimes();
9357c478bd9Sstevel@tonic-gate 
9367c478bd9Sstevel@tonic-gate         showPolicyList("");
9377c478bd9Sstevel@tonic-gate         showPrincipalList("");
9387c478bd9Sstevel@tonic-gate         setPolicyChoice();
9397c478bd9Sstevel@tonic-gate         /* XXX - disabled multiple selection until double-click works */
9407c478bd9Sstevel@tonic-gate         gui.Prlist.set("allowMultipleSelections" /* NOI18N */,
9417c478bd9Sstevel@tonic-gate 		       new Boolean(false));
9427c478bd9Sstevel@tonic-gate         gui.Pollist.set("allowMultipleSelections" /* NOI18N */,
9437c478bd9Sstevel@tonic-gate 			new Boolean(false));
9447c478bd9Sstevel@tonic-gate         if ((privs & PRIV_LIST) == 0) {
9457c478bd9Sstevel@tonic-gate             showWarning(
9467c478bd9Sstevel@tonic-gate 	getString("Unable to access lists; please use the Name field."));
9477c478bd9Sstevel@tonic-gate             ((TextField)gui.PrListPattern.getBody()).requestFocus();
9487c478bd9Sstevel@tonic-gate         }
9497c478bd9Sstevel@tonic-gate     }
9507c478bd9Sstevel@tonic-gate 
9517c478bd9Sstevel@tonic-gate     /**
9527c478bd9Sstevel@tonic-gate      * React to main screen's "Log Out" choice by going back to login screen.
9537c478bd9Sstevel@tonic-gate      *
9547c478bd9Sstevel@tonic-gate      */
logout()9557c478bd9Sstevel@tonic-gate     public void logout() {
9567c478bd9Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
9577c478bd9Sstevel@tonic-gate         setListeners(MainNormal, false);
9587c478bd9Sstevel@tonic-gate         setListeners(defaultsNormal, false);
9597c478bd9Sstevel@tonic-gate         try {
9607c478bd9Sstevel@tonic-gate             Kadmin.sessionExit();
9617c478bd9Sstevel@tonic-gate             Kadmin = null;
9627c478bd9Sstevel@tonic-gate         } catch (Exception e) {
9637c478bd9Sstevel@tonic-gate             realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
9647c478bd9Sstevel@tonic-gate             showError(e.getMessage());
9657c478bd9Sstevel@tonic-gate             return;
9667c478bd9Sstevel@tonic-gate         }
9677c478bd9Sstevel@tonic-gate         setLoginDefaults();
9687c478bd9Sstevel@tonic-gate         principalList = null;
9697c478bd9Sstevel@tonic-gate         gui.Prlist.set("items" /* NOI18N */, null);
9707c478bd9Sstevel@tonic-gate         policyList = null;
9717c478bd9Sstevel@tonic-gate         gui.Pollist.set("items" /* NOI18N */, null);
9727c478bd9Sstevel@tonic-gate         gui.mainframe.show(false);
9737c478bd9Sstevel@tonic-gate         curPrListPos = 0;
9747c478bd9Sstevel@tonic-gate         curPrPattern = "";
9757c478bd9Sstevel@tonic-gate         curPoListPos = 0;
9767c478bd9Sstevel@tonic-gate         curPoPattern = "";
9777c478bd9Sstevel@tonic-gate 
9787c478bd9Sstevel@tonic-gate         // Forget this user's print preferences
9797c478bd9Sstevel@tonic-gate         PrintUtil.reinitialize();
9807c478bd9Sstevel@tonic-gate 
9817c478bd9Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
9827c478bd9Sstevel@tonic-gate     }
9837c478bd9Sstevel@tonic-gate 
exit()9847c478bd9Sstevel@tonic-gate     public void exit() {
9857c478bd9Sstevel@tonic-gate         try {
9867c478bd9Sstevel@tonic-gate             if (Kadmin != null)
9877c478bd9Sstevel@tonic-gate                 Kadmin.sessionExit();
9887c478bd9Sstevel@tonic-gate         } catch (Exception e) {}
9897c478bd9Sstevel@tonic-gate         super.exit();
9907c478bd9Sstevel@tonic-gate     }
9917c478bd9Sstevel@tonic-gate 
9927c478bd9Sstevel@tonic-gate     /*
9937c478bd9Sstevel@tonic-gate      * Methods for the principal list panel
9947c478bd9Sstevel@tonic-gate      */
9957c478bd9Sstevel@tonic-gate 
9967c478bd9Sstevel@tonic-gate     /**
9977c478bd9Sstevel@tonic-gate      * Update all principal text fields from gui.
9987c478bd9Sstevel@tonic-gate      * Check to see if anyone of them had a parse error.
9997c478bd9Sstevel@tonic-gate      * @param nullPasswdOK true if the password can be null. This is
10007c478bd9Sstevel@tonic-gate      * allowed only when the operation is a modify on an existing
10017c478bd9Sstevel@tonic-gate      * principal or if it is an attempt to print a new principal still
10027c478bd9Sstevel@tonic-gate      * in creation.
10037c478bd9Sstevel@tonic-gate      * @returns true if all is ok,  false if an error occurs
10047c478bd9Sstevel@tonic-gate      */
10057c478bd9Sstevel@tonic-gate     // Quits as soon as the first error is detected. The method that
10067c478bd9Sstevel@tonic-gate     // detects the error also shows a dialog box with a message.
prUpdateFromGui(boolean nullPasswdOK)10077c478bd9Sstevel@tonic-gate     public boolean prUpdateFromGui(boolean nullPasswdOK) {
10087c478bd9Sstevel@tonic-gate         return (setPrName1() && setPrPassword(nullPasswdOK) && setPrExpiry() &&
10097c478bd9Sstevel@tonic-gate 		setPrComments() && setPrPwExpiry() && setPrKvno() &&
101045526e97Ssemery 		setPrMaxlife() && setPrMaxrenew() && setEncType());
10117c478bd9Sstevel@tonic-gate     }
10127c478bd9Sstevel@tonic-gate 
10137c478bd9Sstevel@tonic-gate     /**
10147c478bd9Sstevel@tonic-gate      * Is the principal name field editable?
10157c478bd9Sstevel@tonic-gate      *
10167c478bd9Sstevel@tonic-gate      */
prSetEditable(boolean editable)10177c478bd9Sstevel@tonic-gate     public void prSetEditable(boolean editable) {
10187c478bd9Sstevel@tonic-gate         prnameEditable = editable;
10197c478bd9Sstevel@tonic-gate         Boolean b = new Boolean(editable);
10207c478bd9Sstevel@tonic-gate         gui.PrName1.set("editable" /* NOI18N */, b);
10217c478bd9Sstevel@tonic-gate     }
10227c478bd9Sstevel@tonic-gate 
10237c478bd9Sstevel@tonic-gate     /**
10247c478bd9Sstevel@tonic-gate      * React to a change in the principal search pattern
10257c478bd9Sstevel@tonic-gate      *
10267c478bd9Sstevel@tonic-gate      */
prPatternComplete()10277c478bd9Sstevel@tonic-gate     public void prPatternComplete() {
10287c478bd9Sstevel@tonic-gate         curPrListPos = 0;
10297c478bd9Sstevel@tonic-gate         String pattern = (String)gui.PrListPattern.get("text" /* NOI18N */);
10307c478bd9Sstevel@tonic-gate         if (!noLists)
10317c478bd9Sstevel@tonic-gate             showPrincipalList(pattern);
10327c478bd9Sstevel@tonic-gate         else
10337c478bd9Sstevel@tonic-gate             setCurPrincipal(pattern);
10347c478bd9Sstevel@tonic-gate     }
10357c478bd9Sstevel@tonic-gate 
10367c478bd9Sstevel@tonic-gate     /**
10377c478bd9Sstevel@tonic-gate      * Clear principal search pattern
10387c478bd9Sstevel@tonic-gate      *
10397c478bd9Sstevel@tonic-gate      */
prPatternClear()10407c478bd9Sstevel@tonic-gate     public void prPatternClear() {
10417c478bd9Sstevel@tonic-gate         if (noLists) {
10427c478bd9Sstevel@tonic-gate             gui.PrListPattern.set("text" /* NOI18N */, "");
10437c478bd9Sstevel@tonic-gate             ((TextField)gui.PrListPattern.getBody()).requestFocus();
10447c478bd9Sstevel@tonic-gate         } else {
10457c478bd9Sstevel@tonic-gate             String tempName = CurPrincipal;
10467c478bd9Sstevel@tonic-gate             fillPrincipalList("");
10477c478bd9Sstevel@tonic-gate             selectPrincipal(tempName);
10487c478bd9Sstevel@tonic-gate         }
10497c478bd9Sstevel@tonic-gate     }
10507c478bd9Sstevel@tonic-gate 
10517c478bd9Sstevel@tonic-gate     /**
10527c478bd9Sstevel@tonic-gate      * Show the principal list after applying the filter passed in.
10537c478bd9Sstevel@tonic-gate      */
showPrincipalList(String pattern)10547c478bd9Sstevel@tonic-gate     public void showPrincipalList(String pattern) {
10557c478bd9Sstevel@tonic-gate         prin = null; // we are not editing a principal
10567c478bd9Sstevel@tonic-gate         fillPrincipalList(pattern);
10577c478bd9Sstevel@tonic-gate         ModeString = "";
10587c478bd9Sstevel@tonic-gate         OpString = "";
10597c478bd9Sstevel@tonic-gate         updateStatus();
10607c478bd9Sstevel@tonic-gate         gui.cardpanel1.show("List" /* NOI18N */);
10617c478bd9Sstevel@tonic-gate         if (noLists)
10627c478bd9Sstevel@tonic-gate             ((TextField)gui.PrListPattern.getBody()).requestFocus();
10637c478bd9Sstevel@tonic-gate     }
10647c478bd9Sstevel@tonic-gate 
10657c478bd9Sstevel@tonic-gate     /**
10667c478bd9Sstevel@tonic-gate      * Generate the principal list for the first time or after a pattern
10677c478bd9Sstevel@tonic-gate      * has been chosen.
10687c478bd9Sstevel@tonic-gate      *
10697c478bd9Sstevel@tonic-gate      */
fillPrincipalList(String pattern)10707c478bd9Sstevel@tonic-gate     public void fillPrincipalList(String pattern) {
10717c478bd9Sstevel@tonic-gate         if (noLists) {
10727c478bd9Sstevel@tonic-gate             setCurPrincipal((String)gui.PrListPattern.get("text" /* NOI18N */));
10737c478bd9Sstevel@tonic-gate             ((TextField)gui.PrListPattern.getBody()).requestFocus();
10747c478bd9Sstevel@tonic-gate             disablePrincipalPrinting();
10757c478bd9Sstevel@tonic-gate             return;
10767c478bd9Sstevel@tonic-gate         }
10777c478bd9Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
10787c478bd9Sstevel@tonic-gate         pdateStartPlist = new Date();
10797c478bd9Sstevel@tonic-gate         // Do we still want to cache the principal list?
10807c478bd9Sstevel@tonic-gate         long cachetime = A_LONG_TIME;
10817c478bd9Sstevel@tonic-gate         if (!defaults.getStaticLists())
10827c478bd9Sstevel@tonic-gate             cachetime = defaults.getCacheTime() * 1000;
10837c478bd9Sstevel@tonic-gate         if (principalList != null
10847c478bd9Sstevel@tonic-gate 	    && ((new Date()).getTime() - principalListDate.getTime())
10857c478bd9Sstevel@tonic-gate 	    <= cachetime) {
10867c478bd9Sstevel@tonic-gate 
10877c478bd9Sstevel@tonic-gate             // Has the pattern changed?
10887c478bd9Sstevel@tonic-gate             if (pattern.compareTo(curPrPattern) != 0)
10897c478bd9Sstevel@tonic-gate                 newPrPattern(pattern);
10907c478bd9Sstevel@tonic-gate             realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
10917c478bd9Sstevel@tonic-gate             selectPrincipal(curPrListPos);
10927c478bd9Sstevel@tonic-gate             return;
10937c478bd9Sstevel@tonic-gate 
10947c478bd9Sstevel@tonic-gate         }
10957c478bd9Sstevel@tonic-gate         PrincipalList p = new PrincipalList(Kadmin);
10967c478bd9Sstevel@tonic-gate         gui.StatusLine.set("text" /* NOI18N */,
10977c478bd9Sstevel@tonic-gate 			   getString("Loading principal list"));
10987c478bd9Sstevel@tonic-gate         try {
10997c478bd9Sstevel@tonic-gate             principalList = p.getPrincipalList(CurRealm);
11007c478bd9Sstevel@tonic-gate             principalListDate = new Date();
11017c478bd9Sstevel@tonic-gate         } catch (Exception e) {
11027c478bd9Sstevel@tonic-gate             realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
11037c478bd9Sstevel@tonic-gate             showError(e.getMessage());
11047c478bd9Sstevel@tonic-gate             updateStatus();
11057c478bd9Sstevel@tonic-gate             return;
11067c478bd9Sstevel@tonic-gate         }
11077c478bd9Sstevel@tonic-gate         updateStatus();
11087c478bd9Sstevel@tonic-gate         pdateHavePlist = new Date();
11097c478bd9Sstevel@tonic-gate         reportTime("Fetched Plist  : ", pdateHavePlist, pdateStartPlist);
11107c478bd9Sstevel@tonic-gate         newPrPattern(pattern);
11117c478bd9Sstevel@tonic-gate         selectPrincipal(curPrListPos);
11127c478bd9Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
11137c478bd9Sstevel@tonic-gate         pdateDonePlist = new Date();
11147c478bd9Sstevel@tonic-gate         reportTime("Completed Plist: ", pdateDonePlist, pdateHavePlist);
11157c478bd9Sstevel@tonic-gate         if (perfmon)
11167c478bd9Sstevel@tonic-gate             System.out.println("Principal list has "
11177c478bd9Sstevel@tonic-gate 	       +(new Integer(principalList.length)).toString()+" items");
11187c478bd9Sstevel@tonic-gate     }
11197c478bd9Sstevel@tonic-gate 
newPrPattern(String pattern)11207c478bd9Sstevel@tonic-gate     private void newPrPattern(String pattern) {
11217c478bd9Sstevel@tonic-gate         curPrPattern = pattern;
11227c478bd9Sstevel@tonic-gate         gui.PrListPattern.set("text" /* NOI18N */, pattern);
11237c478bd9Sstevel@tonic-gate         refreshPrincipalList();
11247c478bd9Sstevel@tonic-gate     }
11257c478bd9Sstevel@tonic-gate 
refreshPrincipalList()11267c478bd9Sstevel@tonic-gate     private void refreshPrincipalList() {
11277c478bd9Sstevel@tonic-gate         if (noLists)
11287c478bd9Sstevel@tonic-gate             return;
11297c478bd9Sstevel@tonic-gate         Filter f = new Filter(principalList, curPrPattern);
11307c478bd9Sstevel@tonic-gate         gui.Prlist.set("items" /* NOI18N */, f.out);
11317c478bd9Sstevel@tonic-gate     }
11327c478bd9Sstevel@tonic-gate 
selectPrincipal(int pos)11337c478bd9Sstevel@tonic-gate     private void selectPrincipal(int pos) {
11347c478bd9Sstevel@tonic-gate         TextList list = (TextList)gui.Prlist.getBody();
11357c478bd9Sstevel@tonic-gate         if (list.countItems() == 0) {
11367c478bd9Sstevel@tonic-gate             setCurPrincipal("");
11377c478bd9Sstevel@tonic-gate             return;
11387c478bd9Sstevel@tonic-gate         }
11397c478bd9Sstevel@tonic-gate 
11407c478bd9Sstevel@tonic-gate         if (pos < 0)
11417c478bd9Sstevel@tonic-gate             pos = 0;
11427c478bd9Sstevel@tonic-gate         else if (pos >= list.countItems())
11437c478bd9Sstevel@tonic-gate             pos = list.countItems() - 1;
11447c478bd9Sstevel@tonic-gate 
11457c478bd9Sstevel@tonic-gate         list.select(pos);
11467c478bd9Sstevel@tonic-gate         enablePrincipalPrinting();
11477c478bd9Sstevel@tonic-gate         list.makeVisible(pos);
11487c478bd9Sstevel@tonic-gate         setCurPrincipal(list.getItem(pos));
11497c478bd9Sstevel@tonic-gate     }
11507c478bd9Sstevel@tonic-gate 
selectPrincipal(String name)11517c478bd9Sstevel@tonic-gate     private void selectPrincipal(String name) {
11527c478bd9Sstevel@tonic-gate         String[] list = getItemsFromTextList(((TextList)gui.Prlist.getBody()));
11537c478bd9Sstevel@tonic-gate         selectPrincipal(search(list, name));
11547c478bd9Sstevel@tonic-gate     }
11557c478bd9Sstevel@tonic-gate 
getItemsFromTextList(TextList list)11567c478bd9Sstevel@tonic-gate     private String[] getItemsFromTextList(TextList list) {
11577c478bd9Sstevel@tonic-gate         StringVector v = list.items();
11587c478bd9Sstevel@tonic-gate         String [] ret = new String[v.size()];
11597c478bd9Sstevel@tonic-gate         v.copyInto(ret);
11607c478bd9Sstevel@tonic-gate         return ret;
11617c478bd9Sstevel@tonic-gate     }
11627c478bd9Sstevel@tonic-gate 
11637c478bd9Sstevel@tonic-gate     /**
11647c478bd9Sstevel@tonic-gate      * Find index where "name" might go in a sorted string array;
11657c478bd9Sstevel@tonic-gate      * returns either the element which matches "name" exactly
11667c478bd9Sstevel@tonic-gate      * or the element just lexographically greater than "name".
11677c478bd9Sstevel@tonic-gate      */
search(String[] array, String name)11687c478bd9Sstevel@tonic-gate     private int search(String[] array, String name) {
11697c478bd9Sstevel@tonic-gate         int lo = 0;
11707c478bd9Sstevel@tonic-gate         int hi = array.length;
11717c478bd9Sstevel@tonic-gate         int mid = hi;
11727c478bd9Sstevel@tonic-gate         while (lo < hi) {
11737c478bd9Sstevel@tonic-gate             mid = (lo + hi) / 2;
11747c478bd9Sstevel@tonic-gate             int cmp = name.concat("@").compareTo(array[mid].concat("@"));
11757c478bd9Sstevel@tonic-gate             if (hi - lo == 1) {
11767c478bd9Sstevel@tonic-gate                 if (cmp > 0)
11777c478bd9Sstevel@tonic-gate                     mid = hi;
11787c478bd9Sstevel@tonic-gate                 break;
11797c478bd9Sstevel@tonic-gate             }
11807c478bd9Sstevel@tonic-gate             if (cmp == 0)
11817c478bd9Sstevel@tonic-gate                 break;
11827c478bd9Sstevel@tonic-gate             if (cmp < 0)
11837c478bd9Sstevel@tonic-gate                 hi = mid;
11847c478bd9Sstevel@tonic-gate             else if (cmp > 0)
11857c478bd9Sstevel@tonic-gate                 lo = mid;
11867c478bd9Sstevel@tonic-gate         }
11877c478bd9Sstevel@tonic-gate         return mid;
11887c478bd9Sstevel@tonic-gate     }
11897c478bd9Sstevel@tonic-gate 
addToList(String[] list, String name)11907c478bd9Sstevel@tonic-gate     private String[] addToList(String[] list, String name) {
11917c478bd9Sstevel@tonic-gate         if (list == null)
11927c478bd9Sstevel@tonic-gate             return null;
11937c478bd9Sstevel@tonic-gate         int index = search(list, name);
11947c478bd9Sstevel@tonic-gate         int rem = list.length - index;
11957c478bd9Sstevel@tonic-gate         String[] newlist = new String[list.length+1];
11967c478bd9Sstevel@tonic-gate         if (index > 0)
11977c478bd9Sstevel@tonic-gate             System.arraycopy(list, 0, newlist, 0, index);
11987c478bd9Sstevel@tonic-gate         newlist[index] = name;
11997c478bd9Sstevel@tonic-gate         if (rem > 0)
12007c478bd9Sstevel@tonic-gate             System.arraycopy(list, index, newlist, index+1, rem);
12017c478bd9Sstevel@tonic-gate         return newlist;
12027c478bd9Sstevel@tonic-gate     }
12037c478bd9Sstevel@tonic-gate 
delFromList(String[] list, String name)12047c478bd9Sstevel@tonic-gate     private String[] delFromList(String[] list, String name) {
12057c478bd9Sstevel@tonic-gate         if (list == null)
12067c478bd9Sstevel@tonic-gate             return null;
12077c478bd9Sstevel@tonic-gate         int index = search(list, name);
12087c478bd9Sstevel@tonic-gate         int rem = list.length - index;
12097c478bd9Sstevel@tonic-gate         String[] newlist = new String[list.length-1];
12107c478bd9Sstevel@tonic-gate         if (index > 0)
12117c478bd9Sstevel@tonic-gate             System.arraycopy(list, 0, newlist, 0, index);
12127c478bd9Sstevel@tonic-gate         if (rem > 1)
12137c478bd9Sstevel@tonic-gate             System.arraycopy(list, index+1, newlist, index, rem-1);
12147c478bd9Sstevel@tonic-gate         return newlist;
12157c478bd9Sstevel@tonic-gate     }
12167c478bd9Sstevel@tonic-gate 
12177c478bd9Sstevel@tonic-gate     /**
12187c478bd9Sstevel@tonic-gate      * Collect the policy choice entries
12197c478bd9Sstevel@tonic-gate      *
12207c478bd9Sstevel@tonic-gate      */
setPolicyChoice()12217c478bd9Sstevel@tonic-gate     public void setPolicyChoice() {
12227c478bd9Sstevel@tonic-gate         String[] pols = null;
12237c478bd9Sstevel@tonic-gate         if (!noLists) {
12247c478bd9Sstevel@tonic-gate             PolicyList p = new PolicyList(Kadmin);
12257c478bd9Sstevel@tonic-gate             try {
12267c478bd9Sstevel@tonic-gate                 pols = p.getPolicyList();
12277c478bd9Sstevel@tonic-gate             } catch (Exception e) {
12287c478bd9Sstevel@tonic-gate                 showError(e.getMessage());
12297c478bd9Sstevel@tonic-gate                 return;
12307c478bd9Sstevel@tonic-gate             }
12317c478bd9Sstevel@tonic-gate         }
12327c478bd9Sstevel@tonic-gate         Choice c = (Choice)gui.PrPolicy.getBody();
12337c478bd9Sstevel@tonic-gate         c.removeAll();
12347c478bd9Sstevel@tonic-gate         c.add(getString("(no policy)"));
12357c478bd9Sstevel@tonic-gate         for (int i = 0; pols != null && i < pols.length; i++)
12367c478bd9Sstevel@tonic-gate             c.add(pols[i]);
12377c478bd9Sstevel@tonic-gate     }
12387c478bd9Sstevel@tonic-gate 
12397c478bd9Sstevel@tonic-gate     /**
12407c478bd9Sstevel@tonic-gate      * Look at the principal list to see what's selected
12417c478bd9Sstevel@tonic-gate      *
12427c478bd9Sstevel@tonic-gate      */
lookAtPrList()12437c478bd9Sstevel@tonic-gate     public void lookAtPrList() {
12447c478bd9Sstevel@tonic-gate         if (noLists)
12457c478bd9Sstevel@tonic-gate             return;
12467c478bd9Sstevel@tonic-gate         TextList list = (TextList) gui.Prlist.getBody();
12477c478bd9Sstevel@tonic-gate         prMulti = null;
12487c478bd9Sstevel@tonic-gate         String[] sel = list.getSelectedItems();
12497c478bd9Sstevel@tonic-gate         if (sel.length == 1) {
12507c478bd9Sstevel@tonic-gate             setCurPrincipal(sel[0]);
12517c478bd9Sstevel@tonic-gate             curPrListPos = list.getSelectedIndex();
12527c478bd9Sstevel@tonic-gate         } else {
12537c478bd9Sstevel@tonic-gate             if (sel.length > 0)
12547c478bd9Sstevel@tonic-gate                 prMulti = sel;
12557c478bd9Sstevel@tonic-gate             setCurPrincipal("");
12567c478bd9Sstevel@tonic-gate         }
12577c478bd9Sstevel@tonic-gate     }
12587c478bd9Sstevel@tonic-gate 
restorePrListSelection()12597c478bd9Sstevel@tonic-gate     private void restorePrListSelection() {
12607c478bd9Sstevel@tonic-gate         if (noLists)
12617c478bd9Sstevel@tonic-gate             return;
12627c478bd9Sstevel@tonic-gate         TextList list = (TextList) gui.Prlist.getBody();
12637c478bd9Sstevel@tonic-gate         list.select(curPrListPos);
12647c478bd9Sstevel@tonic-gate     }
12657c478bd9Sstevel@tonic-gate 
12667c478bd9Sstevel@tonic-gate     /**
12677c478bd9Sstevel@tonic-gate      * When the principal name choice changes, we want to reflect
12687c478bd9Sstevel@tonic-gate      * the name in the other principal tabs.  We can also use this
12697c478bd9Sstevel@tonic-gate      * opportunity to enable/disable buttons.
12707c478bd9Sstevel@tonic-gate      *
12717c478bd9Sstevel@tonic-gate      */
setCurPrincipal(String name)12727c478bd9Sstevel@tonic-gate     public void setCurPrincipal(String name) {
12737c478bd9Sstevel@tonic-gate         CurPrincipal = name;
12747c478bd9Sstevel@tonic-gate         gui.PrName1.set("text" /* NOI18N */, name);
12757c478bd9Sstevel@tonic-gate         gui.PrName2.set("text" /* NOI18N */, name);
12767c478bd9Sstevel@tonic-gate         gui.PrName3.set("text" /* NOI18N */, name);
12777c478bd9Sstevel@tonic-gate         if (name.compareTo("") == 0) {
12787c478bd9Sstevel@tonic-gate             prSelValid(false);
12797c478bd9Sstevel@tonic-gate             return;
12807c478bd9Sstevel@tonic-gate         }
12817c478bd9Sstevel@tonic-gate         prSelValid(true);
12827c478bd9Sstevel@tonic-gate     }
12837c478bd9Sstevel@tonic-gate 
12847c478bd9Sstevel@tonic-gate     /**
12857c478bd9Sstevel@tonic-gate      * Make Modify, Delete and Duplicate buttons react to what is selected.
12867c478bd9Sstevel@tonic-gate      * Privileges:
12877c478bd9Sstevel@tonic-gate      * If we have neither modify or inquire, we keep Modify disabled;
12887c478bd9Sstevel@tonic-gate      * if we have no modify privileges, we permit Modify to see info,
12897c478bd9Sstevel@tonic-gate      * but the principal panel components are disabled in reactToPrivs().
12907c478bd9Sstevel@tonic-gate      * If we have add and inquire privileges, we can permit Duplicate;
12917c478bd9Sstevel@tonic-gate      * no add also means Create New is permanently disabled in reactToPrivs().
12927c478bd9Sstevel@tonic-gate      * If we have no delete privileges, we keep Delete disabled.
12937c478bd9Sstevel@tonic-gate      */
prSelValid(boolean selected)12947c478bd9Sstevel@tonic-gate     public void prSelValid(boolean selected) {
12957c478bd9Sstevel@tonic-gate         prSelValid = selected;
12967c478bd9Sstevel@tonic-gate         Boolean b = new Boolean(selected && (privs & PRIV_INQUIRE) != 0);
12977c478bd9Sstevel@tonic-gate         gui.PrListModify.set("enabled" /* NOI18N */, b);
12987c478bd9Sstevel@tonic-gate         int want = (PRIV_ADD | PRIV_INQUIRE);
12997c478bd9Sstevel@tonic-gate         b = new Boolean(selected && (privs & want) == want);
13007c478bd9Sstevel@tonic-gate         gui.PrListDuplicate.set("enabled" /* NOI18N */, b);
13017c478bd9Sstevel@tonic-gate         b = new Boolean((selected || prMulti != null)
13027c478bd9Sstevel@tonic-gate 			&&(privs & PRIV_DELETE) != 0);
13037c478bd9Sstevel@tonic-gate         gui.PrListDelete.set("enabled" /* NOI18N */, b);
13047c478bd9Sstevel@tonic-gate     }
13057c478bd9Sstevel@tonic-gate 
13067c478bd9Sstevel@tonic-gate     /**
13077c478bd9Sstevel@tonic-gate      * Make the Save button do the right thing.
13087c478bd9Sstevel@tonic-gate      *
13097c478bd9Sstevel@tonic-gate      */
prSetCanSave(boolean ok)13107c478bd9Sstevel@tonic-gate     public void prSetCanSave(boolean ok) {
13117c478bd9Sstevel@tonic-gate         Boolean b = new Boolean(ok);
13127c478bd9Sstevel@tonic-gate         gui.PrBasicSave.set("enabled" /* NOI18N */, b);
13137c478bd9Sstevel@tonic-gate         gui.PrDetailSave.set("enabled" /* NOI18N */, b);
13147c478bd9Sstevel@tonic-gate         gui.PrFlagsSave.set("enabled" /* NOI18N */, b);
13157c478bd9Sstevel@tonic-gate     }
13167c478bd9Sstevel@tonic-gate 
13177c478bd9Sstevel@tonic-gate     /**
13187c478bd9Sstevel@tonic-gate      * Update status line with current information.
13197c478bd9Sstevel@tonic-gate      *
13207c478bd9Sstevel@tonic-gate      */
updateStatus()13217c478bd9Sstevel@tonic-gate     public void updateStatus() {
13227c478bd9Sstevel@tonic-gate         gui.StatusLine.set("text" /* NOI18N */, ModeString+OpString+SaveString);
13237c478bd9Sstevel@tonic-gate     }
13247c478bd9Sstevel@tonic-gate 
13257c478bd9Sstevel@tonic-gate     /**
13267c478bd9Sstevel@tonic-gate      * This is a way for the data modification actions to note that
13277c478bd9Sstevel@tonic-gate      * the principal has edits outstanding.
13287c478bd9Sstevel@tonic-gate      *
13297c478bd9Sstevel@tonic-gate      */
prSetNeedSave()13307c478bd9Sstevel@tonic-gate     public void prSetNeedSave() {
13317c478bd9Sstevel@tonic-gate         prNeedSave = true;
13327c478bd9Sstevel@tonic-gate         prSetCanSave(true);
13337c478bd9Sstevel@tonic-gate         SaveString = getString("- *CHANGES*");
13347c478bd9Sstevel@tonic-gate         updateStatus();
13357c478bd9Sstevel@tonic-gate     }
13367c478bd9Sstevel@tonic-gate 
prDoSave()13377c478bd9Sstevel@tonic-gate     public boolean prDoSave() {
13387c478bd9Sstevel@tonic-gate 
13397c478bd9Sstevel@tonic-gate         // before attempting to save make sure all text fields are in order
13407c478bd9Sstevel@tonic-gate         if (prUpdateFromGui(!prin.isNew) == false)
13417c478bd9Sstevel@tonic-gate             return false;
13427c478bd9Sstevel@tonic-gate 
13437c478bd9Sstevel@tonic-gate         boolean b = true;
13447c478bd9Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
13457c478bd9Sstevel@tonic-gate         try {
13467c478bd9Sstevel@tonic-gate             b = prin.savePrincipal();
13477c478bd9Sstevel@tonic-gate         } catch (Exception e) {
13487c478bd9Sstevel@tonic-gate             b = false;
13497c478bd9Sstevel@tonic-gate             showError(e.getMessage());
13507c478bd9Sstevel@tonic-gate         }
13517c478bd9Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
13527c478bd9Sstevel@tonic-gate         if (!b)
13537c478bd9Sstevel@tonic-gate             return false;
13547c478bd9Sstevel@tonic-gate         if (prin.isNew) {
13557c478bd9Sstevel@tonic-gate             principalList = addToList(principalList, prin.PrName);
13567c478bd9Sstevel@tonic-gate             refreshPrincipalList();
13577c478bd9Sstevel@tonic-gate             selectPrincipal(prin.PrName);
13587c478bd9Sstevel@tonic-gate         }
13597c478bd9Sstevel@tonic-gate         prin.isNew = false;
13607c478bd9Sstevel@tonic-gate         gui.PrPassword.set("text" /* NOI18N */, "");
13617c478bd9Sstevel@tonic-gate         prin.setPassword("");
13627c478bd9Sstevel@tonic-gate         prSetEditable(false);
13637c478bd9Sstevel@tonic-gate         prSetCanSave(false);
13647c478bd9Sstevel@tonic-gate         prNeedSave = false;
13657c478bd9Sstevel@tonic-gate         SaveString = "";
13667c478bd9Sstevel@tonic-gate         updateStatus();
13677c478bd9Sstevel@tonic-gate         return true;
13687c478bd9Sstevel@tonic-gate     }
13697c478bd9Sstevel@tonic-gate 
13707c478bd9Sstevel@tonic-gate     /**
13717c478bd9Sstevel@tonic-gate      * React to a choice from the principal list via double-click or
13727c478bd9Sstevel@tonic-gate      * single-click+Modify; we want to go to the next tab in each case.
13737c478bd9Sstevel@tonic-gate      * If we don't have modify privileges, we need to simply show values.
13747c478bd9Sstevel@tonic-gate      */
prModify()13757c478bd9Sstevel@tonic-gate     public void prModify() {
13767c478bd9Sstevel@tonic-gate         enablePrincipalPrinting();
13777c478bd9Sstevel@tonic-gate         if (!prNeedSave) {
13787c478bd9Sstevel@tonic-gate             prSetEditable(false);
13797c478bd9Sstevel@tonic-gate             prSetCanSave(false);
13807c478bd9Sstevel@tonic-gate         }
13817c478bd9Sstevel@tonic-gate         if (noLists)
13827c478bd9Sstevel@tonic-gate             CurPrincipal = (String)gui.PrListPattern.get("text" /* NOI18N */);
13837c478bd9Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
13847c478bd9Sstevel@tonic-gate         enablePrAttributes(new Boolean((privs & (PRIV_ADD|PRIV_MODIFY)) != 0));
13857c478bd9Sstevel@tonic-gate         Boolean b = new Boolean((privs & PRIV_CHANGEPW) != 0);
13867c478bd9Sstevel@tonic-gate         gui.PrPassword.set("enabled" /* NOI18N */, b);
13877c478bd9Sstevel@tonic-gate         gui.PrBasicRandomPw.set("enabled" /* NOI18N */, b);
138845526e97Ssemery         gui.EncList.set("enabled" /* NOI18N */, b);
13897c478bd9Sstevel@tonic-gate         try {
13907c478bd9Sstevel@tonic-gate             prin = new Principal(Kadmin, CurPrincipal);
13917c478bd9Sstevel@tonic-gate         } catch (Exception e) {
13927c478bd9Sstevel@tonic-gate             showError(e.getMessage());
13937c478bd9Sstevel@tonic-gate             realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
13947c478bd9Sstevel@tonic-gate             return;
13957c478bd9Sstevel@tonic-gate         }
13967c478bd9Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
13977c478bd9Sstevel@tonic-gate         showPrincipal(prin);
13987c478bd9Sstevel@tonic-gate         String policy = (String)gui.PrPolicy.get("selectedItem" /* NOI18N */);
13997c478bd9Sstevel@tonic-gate         if (policy.compareTo(getString("(no policy)")) == 0)
14007c478bd9Sstevel@tonic-gate             policy = "";
14017c478bd9Sstevel@tonic-gate         else
14027c478bd9Sstevel@tonic-gate             setDefaultPolicy(policy);
14037c478bd9Sstevel@tonic-gate         ModeString = getString("Modify")+" ";
14047c478bd9Sstevel@tonic-gate         OpString = getString("Principal");
14057c478bd9Sstevel@tonic-gate         updateStatus();
14067c478bd9Sstevel@tonic-gate         gui.cardpanel1.show("Basics" /* NOI18N */);
14077c478bd9Sstevel@tonic-gate     }
14087c478bd9Sstevel@tonic-gate 
14097c478bd9Sstevel@tonic-gate     /**
14107c478bd9Sstevel@tonic-gate      * React to add principal button
14117c478bd9Sstevel@tonic-gate      * If we got here, we need to enable attributes since we have privs.
14127c478bd9Sstevel@tonic-gate      */
prAdd()14137c478bd9Sstevel@tonic-gate     public void prAdd() {
14147c478bd9Sstevel@tonic-gate         enablePrincipalPrinting();
14157c478bd9Sstevel@tonic-gate         setCurPrincipal("");
14167c478bd9Sstevel@tonic-gate         prSelValid = true;
14177c478bd9Sstevel@tonic-gate         prSetEditable(true);
14187c478bd9Sstevel@tonic-gate         prSetNeedSave();
14197c478bd9Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
14207c478bd9Sstevel@tonic-gate         Boolean b = new Boolean(true);
14217c478bd9Sstevel@tonic-gate         enablePrAttributes(b);
14227c478bd9Sstevel@tonic-gate         gui.PrPassword.set("enabled" /* NOI18N */, b);
14237c478bd9Sstevel@tonic-gate         gui.PrBasicRandomPw.set("enabled" /* NOI18N */, b);
142445526e97Ssemery         gui.EncList.set("enabled" /* NOI18N */, b);
14257c478bd9Sstevel@tonic-gate         try {
14267c478bd9Sstevel@tonic-gate             prin = new Principal(Kadmin, defaults);
14277c478bd9Sstevel@tonic-gate         } catch (Exception e) {
14287c478bd9Sstevel@tonic-gate             showError(e.getMessage());
14297c478bd9Sstevel@tonic-gate             realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
14307c478bd9Sstevel@tonic-gate             return;
14317c478bd9Sstevel@tonic-gate         }
14327c478bd9Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
14337c478bd9Sstevel@tonic-gate         showPrincipal(prin);
14347c478bd9Sstevel@tonic-gate         ModeString = getString("Create New")+" ";
14357c478bd9Sstevel@tonic-gate         OpString = getString("Principal");
14367c478bd9Sstevel@tonic-gate         updateStatus();
14377c478bd9Sstevel@tonic-gate         gui.cardpanel1.show("Basics" /* NOI18N */);
14387c478bd9Sstevel@tonic-gate         ((TextField)gui.PrName1.getBody()).requestFocus();
14397c478bd9Sstevel@tonic-gate     }
14407c478bd9Sstevel@tonic-gate 
14417c478bd9Sstevel@tonic-gate     /**
14427c478bd9Sstevel@tonic-gate      * React to duplicate principal button
14437c478bd9Sstevel@tonic-gate      *
14447c478bd9Sstevel@tonic-gate      */
prDuplicate()14457c478bd9Sstevel@tonic-gate     public void prDuplicate() {
14467c478bd9Sstevel@tonic-gate         enablePrincipalPrinting();
14477c478bd9Sstevel@tonic-gate         if (noLists)
14487c478bd9Sstevel@tonic-gate             CurPrincipal = (String)gui.PrListPattern.get("text" /* NOI18N */);
14497c478bd9Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
14507c478bd9Sstevel@tonic-gate         try {
14517c478bd9Sstevel@tonic-gate             prin = new Principal(Kadmin, CurPrincipal);
14527c478bd9Sstevel@tonic-gate         } catch (Exception e) {
14537c478bd9Sstevel@tonic-gate             showError(e.getMessage());
14547c478bd9Sstevel@tonic-gate             realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
14557c478bd9Sstevel@tonic-gate             return;
14567c478bd9Sstevel@tonic-gate         }
14577c478bd9Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
14587c478bd9Sstevel@tonic-gate         setCurPrincipal("");
14597c478bd9Sstevel@tonic-gate         prSelValid = true;
14607c478bd9Sstevel@tonic-gate         prSetEditable(true);
14617c478bd9Sstevel@tonic-gate         prSetNeedSave();
14627c478bd9Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
14637c478bd9Sstevel@tonic-gate         Boolean b = new Boolean(true);
14647c478bd9Sstevel@tonic-gate         enablePrAttributes(b);
14657c478bd9Sstevel@tonic-gate         gui.PrPassword.set("enabled" /* NOI18N */, b);
14667c478bd9Sstevel@tonic-gate         gui.PrBasicRandomPw.set("enabled" /* NOI18N */, b);
146745526e97Ssemery         gui.PrBasicRandomPw.set("enabled" /* NOI18N */, b);
14687c478bd9Sstevel@tonic-gate         try {
14697c478bd9Sstevel@tonic-gate             prin = new Principal(Kadmin, prin);
14707c478bd9Sstevel@tonic-gate         } catch (Exception e) {
14717c478bd9Sstevel@tonic-gate             showError(e.getMessage());
14727c478bd9Sstevel@tonic-gate             realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
14737c478bd9Sstevel@tonic-gate             return;
14747c478bd9Sstevel@tonic-gate         }
14757c478bd9Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
14767c478bd9Sstevel@tonic-gate         prin.PrName = "";
14777c478bd9Sstevel@tonic-gate         showPrincipal(prin);
14787c478bd9Sstevel@tonic-gate         ModeString = getString("Duplicate")+" ";
14797c478bd9Sstevel@tonic-gate         OpString = getString("Principal");
14807c478bd9Sstevel@tonic-gate         updateStatus();
14817c478bd9Sstevel@tonic-gate         gui.cardpanel1.show("Basics" /* NOI18N */);
14827c478bd9Sstevel@tonic-gate         ((TextField)gui.PrName1.getBody()).requestFocus();
14837c478bd9Sstevel@tonic-gate     }
14847c478bd9Sstevel@tonic-gate 
14857c478bd9Sstevel@tonic-gate     /**
14867c478bd9Sstevel@tonic-gate      * React to delete principal button
14877c478bd9Sstevel@tonic-gate      */
prDelete()14887c478bd9Sstevel@tonic-gate     public void prDelete() {
14897c478bd9Sstevel@tonic-gate         String text[] = {getString("You are about to destroy data."),
14907c478bd9Sstevel@tonic-gate 			 getString("Click OK to proceed or"
14917c478bd9Sstevel@tonic-gate 				   +" Cancel to continue editing.")};
14927c478bd9Sstevel@tonic-gate         String resp = confirmAction(realMainFrame, text);
14937c478bd9Sstevel@tonic-gate         if (resp.equals(getString("Cancel")))
14947c478bd9Sstevel@tonic-gate             return;
14957c478bd9Sstevel@tonic-gate         if (noLists)
14967c478bd9Sstevel@tonic-gate             CurPrincipal = (String)gui.PrListPattern.get("text" /* NOI18N */);
14977c478bd9Sstevel@tonic-gate         boolean b = false;
14987c478bd9Sstevel@tonic-gate         try {
14997c478bd9Sstevel@tonic-gate             b = Kadmin.deletePrincipal(CurPrincipal);
15007c478bd9Sstevel@tonic-gate         } catch (Exception e) {
15017c478bd9Sstevel@tonic-gate             showError(e.getMessage());
15027c478bd9Sstevel@tonic-gate             return;
15037c478bd9Sstevel@tonic-gate         }
15047c478bd9Sstevel@tonic-gate         if (!b)
15057c478bd9Sstevel@tonic-gate             return;
15067c478bd9Sstevel@tonic-gate         principalList = delFromList(principalList, CurPrincipal);
15077c478bd9Sstevel@tonic-gate         refreshPrincipalList();
15087c478bd9Sstevel@tonic-gate         setCurPrincipal("");
15097c478bd9Sstevel@tonic-gate         prSelValid = true;
15107c478bd9Sstevel@tonic-gate         prSetEditable(true);
15117c478bd9Sstevel@tonic-gate         if (curPrListPos == ((TextList)gui.Prlist.getBody()).countItems())
15127c478bd9Sstevel@tonic-gate             curPrListPos--;
15137c478bd9Sstevel@tonic-gate         showPrincipalList(curPrPattern);
15147c478bd9Sstevel@tonic-gate     }
15157c478bd9Sstevel@tonic-gate 
15167c478bd9Sstevel@tonic-gate     /**
15177c478bd9Sstevel@tonic-gate      * React to Previous button on basic screen
15187c478bd9Sstevel@tonic-gate      *
15197c478bd9Sstevel@tonic-gate      */
prBasicPrevious()15207c478bd9Sstevel@tonic-gate     public void prBasicPrevious() {
15217c478bd9Sstevel@tonic-gate         prCancel();
15227c478bd9Sstevel@tonic-gate     }
15237c478bd9Sstevel@tonic-gate 
15247c478bd9Sstevel@tonic-gate     /**
15257c478bd9Sstevel@tonic-gate      * React to Next button on basic screen. If some changes were made
15267c478bd9Sstevel@tonic-gate      * then check to see if they contain a parse error. If so, do
15277c478bd9Sstevel@tonic-gate      * nothing. The method that checks for error messages also displays
15287c478bd9Sstevel@tonic-gate      * the error message.
15297c478bd9Sstevel@tonic-gate      *
15307c478bd9Sstevel@tonic-gate      */
prBasicNext()15317c478bd9Sstevel@tonic-gate     public void prBasicNext() {
15327c478bd9Sstevel@tonic-gate         if (prNeedSave)
15337c478bd9Sstevel@tonic-gate             if (!prUpdateFromGui(!prin.isNew))
15347c478bd9Sstevel@tonic-gate 		return;
15357c478bd9Sstevel@tonic-gate 
15367c478bd9Sstevel@tonic-gate         updateStatus();
15377c478bd9Sstevel@tonic-gate         gui.cardpanel1.show("Details" /* NOI18N */);
15387c478bd9Sstevel@tonic-gate     }
15397c478bd9Sstevel@tonic-gate 
15407c478bd9Sstevel@tonic-gate     /**
15417c478bd9Sstevel@tonic-gate      * React to Previous button on detail screen. If some changes were made
15427c478bd9Sstevel@tonic-gate      * then check to see if they contain a parse error. If so, do
15437c478bd9Sstevel@tonic-gate      * nothing. The method that checks for error messages also displays
15447c478bd9Sstevel@tonic-gate      * the error message.
15457c478bd9Sstevel@tonic-gate      */
prDetailPrevious()15467c478bd9Sstevel@tonic-gate     public void prDetailPrevious() {
15477c478bd9Sstevel@tonic-gate         if (prNeedSave)
15487c478bd9Sstevel@tonic-gate             if (!prUpdateFromGui(!prin.isNew))
15497c478bd9Sstevel@tonic-gate 		return;
15507c478bd9Sstevel@tonic-gate 
15517c478bd9Sstevel@tonic-gate         updateStatus();
15527c478bd9Sstevel@tonic-gate         gui.cardpanel1.show("Basics" /* NOI18N */);
15537c478bd9Sstevel@tonic-gate     }
15547c478bd9Sstevel@tonic-gate 
15557c478bd9Sstevel@tonic-gate     /**
15567c478bd9Sstevel@tonic-gate      * React to Next button on detail screen. If some changes were made
15577c478bd9Sstevel@tonic-gate      * then check to see if they contain a parse error. If so, do
15587c478bd9Sstevel@tonic-gate      * nothing. The method that checks for error messages also displays
15597c478bd9Sstevel@tonic-gate      * the error message.
15607c478bd9Sstevel@tonic-gate      *
15617c478bd9Sstevel@tonic-gate      */
prDetailNext()15627c478bd9Sstevel@tonic-gate     public void prDetailNext() {
15637c478bd9Sstevel@tonic-gate         if (prNeedSave)
15647c478bd9Sstevel@tonic-gate             if (!prUpdateFromGui(!prin.isNew))
15657c478bd9Sstevel@tonic-gate 		return;
15667c478bd9Sstevel@tonic-gate 
15677c478bd9Sstevel@tonic-gate         updateStatus();
15687c478bd9Sstevel@tonic-gate         gui.cardpanel1.show("Flags" /* NOI18N */);
15697c478bd9Sstevel@tonic-gate     }
15707c478bd9Sstevel@tonic-gate 
15717c478bd9Sstevel@tonic-gate     /**
15727c478bd9Sstevel@tonic-gate      * React to Previous button on flags screen
15737c478bd9Sstevel@tonic-gate      *
15747c478bd9Sstevel@tonic-gate      */
prFlagsPrevious()15757c478bd9Sstevel@tonic-gate     public void prFlagsPrevious() {
15767c478bd9Sstevel@tonic-gate         updateStatus();
15777c478bd9Sstevel@tonic-gate         gui.cardpanel1.show("Details" /* NOI18N */);
15787c478bd9Sstevel@tonic-gate     }
15797c478bd9Sstevel@tonic-gate 
15807c478bd9Sstevel@tonic-gate     /**
15817c478bd9Sstevel@tonic-gate      * React to Done button on flags screen. If any changes were made to
15827c478bd9Sstevel@tonic-gate      * the principal, then try to save them. If the save fails for any
15837c478bd9Sstevel@tonic-gate      * reason, do not return to the principal list.
15847c478bd9Sstevel@tonic-gate      *
15857c478bd9Sstevel@tonic-gate      */
prFlagsDone()15867c478bd9Sstevel@tonic-gate     public void prFlagsDone() {
15877c478bd9Sstevel@tonic-gate         if (prNeedSave && prDoSave() == false)
15887c478bd9Sstevel@tonic-gate             return;
15897c478bd9Sstevel@tonic-gate         showPrincipalList(curPrPattern);
15907c478bd9Sstevel@tonic-gate     }
15917c478bd9Sstevel@tonic-gate 
15927c478bd9Sstevel@tonic-gate     /**
15937c478bd9Sstevel@tonic-gate      * React to save principal button
15947c478bd9Sstevel@tonic-gate      *
15957c478bd9Sstevel@tonic-gate      */
prSave()15967c478bd9Sstevel@tonic-gate     public void prSave() {
15977c478bd9Sstevel@tonic-gate         prDoSave();
15987c478bd9Sstevel@tonic-gate     }
15997c478bd9Sstevel@tonic-gate 
16007c478bd9Sstevel@tonic-gate     /**
16017c478bd9Sstevel@tonic-gate      * React to cancel principal button
16027c478bd9Sstevel@tonic-gate      *
16037c478bd9Sstevel@tonic-gate      */
prCancel()16047c478bd9Sstevel@tonic-gate     public void prCancel() {
16057c478bd9Sstevel@tonic-gate         if (prNeedSave) {
16067c478bd9Sstevel@tonic-gate             String text[] = {getString("You are about to lose changes."),
16077c478bd9Sstevel@tonic-gate 			     getString("Click Save to commit changes, "
16087c478bd9Sstevel@tonic-gate 				       +"Discard to discard changes, "
16097c478bd9Sstevel@tonic-gate 				       +"or Cancel to continue editing.")};
16107c478bd9Sstevel@tonic-gate             String resp = confirmSave(realMainFrame, text);
16117c478bd9Sstevel@tonic-gate             if (resp.equals(getString("Cancel")))
16127c478bd9Sstevel@tonic-gate                 return;
16137c478bd9Sstevel@tonic-gate             if (resp.equals(getString("Save")))
16147c478bd9Sstevel@tonic-gate                 if (!prDoSave())
16157c478bd9Sstevel@tonic-gate 		    return;
16167c478bd9Sstevel@tonic-gate         }
16177c478bd9Sstevel@tonic-gate         prSetEditable(false);
16187c478bd9Sstevel@tonic-gate         prSetCanSave(false);
16197c478bd9Sstevel@tonic-gate         prNeedSave = false;
16207c478bd9Sstevel@tonic-gate         lookAtPrList();
16217c478bd9Sstevel@tonic-gate         SaveString = "";
16227c478bd9Sstevel@tonic-gate         showPrincipalList(curPrPattern);
16237c478bd9Sstevel@tonic-gate     }
16247c478bd9Sstevel@tonic-gate 
16257c478bd9Sstevel@tonic-gate     /*
16267c478bd9Sstevel@tonic-gate      * Methods for the principal attribute panels
16277c478bd9Sstevel@tonic-gate      */
16287c478bd9Sstevel@tonic-gate 
setPrName1()16297c478bd9Sstevel@tonic-gate     public boolean setPrName1() {
16307c478bd9Sstevel@tonic-gate         if (!prnameEditable)
16317c478bd9Sstevel@tonic-gate             return true;
16327c478bd9Sstevel@tonic-gate 
16337c478bd9Sstevel@tonic-gate         String p = ((String)gui.PrName1.get("text" /* NOI18N */)).trim();
16347c478bd9Sstevel@tonic-gate         if (p.compareTo("") == 0) {
16357c478bd9Sstevel@tonic-gate             showError(getString("Please enter a principal name or cancel"));
16367c478bd9Sstevel@tonic-gate             ((TextField)gui.PrName1.getBody()).requestFocus();
16377c478bd9Sstevel@tonic-gate             return false;
16387c478bd9Sstevel@tonic-gate         }
16397c478bd9Sstevel@tonic-gate         // visually delete any white space that was at the start or end
16407c478bd9Sstevel@tonic-gate         // by resetting the field to the trimmmed String.
16417c478bd9Sstevel@tonic-gate         gui.PrName1.set("text" /* NOI18N */, p);
16427c478bd9Sstevel@tonic-gate         setCurPrincipal(p);
16437c478bd9Sstevel@tonic-gate         prin.setName(p);
16447c478bd9Sstevel@tonic-gate         return true;
16457c478bd9Sstevel@tonic-gate     }
16467c478bd9Sstevel@tonic-gate 
setPrComments()16477c478bd9Sstevel@tonic-gate     public boolean setPrComments() {
16487c478bd9Sstevel@tonic-gate         prin.setComments((String)gui.PrComments.get("text" /* NOI18N */));
16497c478bd9Sstevel@tonic-gate         return true;
16507c478bd9Sstevel@tonic-gate     }
16517c478bd9Sstevel@tonic-gate 
setEncType()165245526e97Ssemery     public boolean setEncType() {
165345526e97Ssemery         if (prin.setEncType((String)gui.EncList.get("text" /* NOI18N */))) {
165445526e97Ssemery             // visually delete any extraneous data that was ignored in the
165545526e97Ssemery             // parsing by resetting the gui data
165645526e97Ssemery             gui.EncList.set("text" /* NOI18N */,  prin.getEncType());
165745526e97Ssemery             return true;
165845526e97Ssemery         } else
165945526e97Ssemery             return false;
166045526e97Ssemery     }
166145526e97Ssemery 
setPrExpiry()16627c478bd9Sstevel@tonic-gate     public boolean setPrExpiry() {
16637c478bd9Sstevel@tonic-gate         if (prin.setExpiry((String)gui.PrExpiry.get("text" /* NOI18N */))) {
16647c478bd9Sstevel@tonic-gate             // visually delete any extraneous data that was ignored in the
16657c478bd9Sstevel@tonic-gate             // parsing by resetting the gui data
16667c478bd9Sstevel@tonic-gate             gui.PrExpiry.set("text" /* NOI18N */,  prin.getExpiry());
16677c478bd9Sstevel@tonic-gate             return true;
16687c478bd9Sstevel@tonic-gate         } else {
16697c478bd9Sstevel@tonic-gate             showDataFormatError(((TextField)gui.PrExpiry.getBody()),
16707c478bd9Sstevel@tonic-gate 				DATE_DATA);
16717c478bd9Sstevel@tonic-gate             return false;
16727c478bd9Sstevel@tonic-gate         }
16737c478bd9Sstevel@tonic-gate     }
16747c478bd9Sstevel@tonic-gate 
setPrPassword(boolean nullOK)16757c478bd9Sstevel@tonic-gate     public boolean setPrPassword(boolean nullOK) {
16767c478bd9Sstevel@tonic-gate         String p = (String)gui.PrPassword.get("text" /* NOI18N */);
16777c478bd9Sstevel@tonic-gate         if (p.compareTo("") == 0) {
16787c478bd9Sstevel@tonic-gate             if (!nullOK) {
16797c478bd9Sstevel@tonic-gate                 showError(getString("Please enter a password or cancel"));
16807c478bd9Sstevel@tonic-gate                 ((TextField)gui.PrPassword.getBody()).requestFocus();
16817c478bd9Sstevel@tonic-gate                 return false;
16827c478bd9Sstevel@tonic-gate             } else return true;
16837c478bd9Sstevel@tonic-gate 	}
16847c478bd9Sstevel@tonic-gate 
16857c478bd9Sstevel@tonic-gate         prin.setPassword(p);
16867c478bd9Sstevel@tonic-gate         return true;
16877c478bd9Sstevel@tonic-gate     }
16887c478bd9Sstevel@tonic-gate 
genRandomPassword()16897c478bd9Sstevel@tonic-gate     public void genRandomPassword() {
16907c478bd9Sstevel@tonic-gate         int n, count = 0;
16917c478bd9Sstevel@tonic-gate         byte[] buf = new byte[20];
16927c478bd9Sstevel@tonic-gate         byte b;
16937c478bd9Sstevel@tonic-gate         Random r = new Random();
16947c478bd9Sstevel@tonic-gate         String passlist = "abcdefghijklmnopqrstuvwxyz1234567890!#$%&*+@"
16957c478bd9Sstevel@tonic-gate 	    /* NOI18N */;
16967c478bd9Sstevel@tonic-gate 
16977c478bd9Sstevel@tonic-gate         gui.PrPassword.set("text" /* NOI18N */, "");
16987c478bd9Sstevel@tonic-gate         while (count < 10) {
16997c478bd9Sstevel@tonic-gate             n = r.nextInt() & 0x7F;
17007c478bd9Sstevel@tonic-gate             b = (byte)n;
17017c478bd9Sstevel@tonic-gate             if (passlist.indexOf(b) == -1)
17027c478bd9Sstevel@tonic-gate                 continue;
17037c478bd9Sstevel@tonic-gate             buf[count++] = b;
17047c478bd9Sstevel@tonic-gate         }
17057c478bd9Sstevel@tonic-gate         buf[count] = 0;
17067c478bd9Sstevel@tonic-gate         CurPass = new String(buf);
17077c478bd9Sstevel@tonic-gate         gui.PrPassword.set("text" /* NOI18N */, CurPass);
17087c478bd9Sstevel@tonic-gate         prin.setPassword((String)gui.PrPassword.get("text" /* NOI18N */));
17097c478bd9Sstevel@tonic-gate     }
17107c478bd9Sstevel@tonic-gate 
setPrPolicy()17117c478bd9Sstevel@tonic-gate     public void setPrPolicy() {
17127c478bd9Sstevel@tonic-gate         if (prin == null)
17137c478bd9Sstevel@tonic-gate                 return;
17147c478bd9Sstevel@tonic-gate         String policy = (String)gui.PrPolicy.get("selectedItem" /* NOI18N */);
17157c478bd9Sstevel@tonic-gate         if (policy.compareTo(getString("(no policy)")) == 0)
17167c478bd9Sstevel@tonic-gate             policy = "";
17177c478bd9Sstevel@tonic-gate         try {
17187c478bd9Sstevel@tonic-gate                 prin.setPolicy(policy);
17197c478bd9Sstevel@tonic-gate         } catch (Exception e) {};
17207c478bd9Sstevel@tonic-gate         setDefaultPolicy(policy);
17217c478bd9Sstevel@tonic-gate     }
17227c478bd9Sstevel@tonic-gate 
setPrMaxlife()17237c478bd9Sstevel@tonic-gate     public boolean setPrMaxlife() {
17247c478bd9Sstevel@tonic-gate         if (prin.setMaxlife((String)gui.PrMaxLifetime.get("text"
17257c478bd9Sstevel@tonic-gate 							  /* NOI18N */))) {
17267c478bd9Sstevel@tonic-gate             // visually delete any extraneous data that was ignored in the
17277c478bd9Sstevel@tonic-gate             // parsing by resetting the gui data
17287c478bd9Sstevel@tonic-gate             gui.PrMaxLifetime.set("text" /* NOI18N */, prin.getMaxLife());
17297c478bd9Sstevel@tonic-gate             return true;
17307c478bd9Sstevel@tonic-gate         } else {
17317c478bd9Sstevel@tonic-gate             showDataFormatError(((TextField)gui.PrMaxLifetime.getBody()),
17327c478bd9Sstevel@tonic-gate 				DURATION_DATA);
17337c478bd9Sstevel@tonic-gate             return false;
17347c478bd9Sstevel@tonic-gate         }
17357c478bd9Sstevel@tonic-gate     }
17367c478bd9Sstevel@tonic-gate 
setPrMaxrenew()17377c478bd9Sstevel@tonic-gate     public boolean setPrMaxrenew() {
17387c478bd9Sstevel@tonic-gate         if (prin.setMaxrenew((String)gui.PrMaxRenewal.get(
17397c478bd9Sstevel@tonic-gate 						  "text" /* NOI18N */))) {
17407c478bd9Sstevel@tonic-gate             // visually delete any extraneous data that was ignored in the
17417c478bd9Sstevel@tonic-gate             // parsing  by resetting the gui data
17427c478bd9Sstevel@tonic-gate             gui.PrMaxRenewal.set("text" /* NOI18N */, prin.getMaxRenew());
17437c478bd9Sstevel@tonic-gate             return true;
17447c478bd9Sstevel@tonic-gate         } else {
17457c478bd9Sstevel@tonic-gate             showDataFormatError(((TextField)gui.PrMaxRenewal.getBody()),
17467c478bd9Sstevel@tonic-gate 				DURATION_DATA);
17477c478bd9Sstevel@tonic-gate             return false;
17487c478bd9Sstevel@tonic-gate         }
17497c478bd9Sstevel@tonic-gate     }
17507c478bd9Sstevel@tonic-gate 
setPrKvno()17517c478bd9Sstevel@tonic-gate     public boolean setPrKvno() {
17527c478bd9Sstevel@tonic-gate         if (prin.setKvno((String)gui.PrKvno.get("text" /* NOI18N */))) {
17537c478bd9Sstevel@tonic-gate             // visually delete any extraneous data that was ignored in the
17547c478bd9Sstevel@tonic-gate             // parsing by resetting the gui data
17557c478bd9Sstevel@tonic-gate             gui.PrKvno.set("text" /* NOI18N */, nf.format(prin.Kvno));
17567c478bd9Sstevel@tonic-gate             return true;
17577c478bd9Sstevel@tonic-gate         } else {
17587c478bd9Sstevel@tonic-gate             showDataFormatError(((TextField)gui.PrKvno.getBody()), NUMBER_DATA);
17597c478bd9Sstevel@tonic-gate             return false;
17607c478bd9Sstevel@tonic-gate         }
17617c478bd9Sstevel@tonic-gate     }
17627c478bd9Sstevel@tonic-gate 
setPrPwExpiry()17637c478bd9Sstevel@tonic-gate     public boolean setPrPwExpiry() {
17647c478bd9Sstevel@tonic-gate         if (prin.setPwExpiry((String)gui.PrPwExpiry.get("text" /* NOI18N */))) {
17657c478bd9Sstevel@tonic-gate             // visually delete any extraneous data that was ignored in the
17667c478bd9Sstevel@tonic-gate             // parsing by resetting the gui data
17677c478bd9Sstevel@tonic-gate             gui.PrPwExpiry.set("text" /* NOI18N */, prin.getPwExpireTime());
17687c478bd9Sstevel@tonic-gate             return true;
17697c478bd9Sstevel@tonic-gate         } else {
17707c478bd9Sstevel@tonic-gate             showDataFormatError(((TextField)gui.PrPwExpiry.getBody()),
17717c478bd9Sstevel@tonic-gate 				DATE_DATA);
17727c478bd9Sstevel@tonic-gate             return false;
17737c478bd9Sstevel@tonic-gate         }
17747c478bd9Sstevel@tonic-gate     }
17757c478bd9Sstevel@tonic-gate 
setPrFlag(int bitmask)17767c478bd9Sstevel@tonic-gate     public void setPrFlag(int bitmask) {
17777c478bd9Sstevel@tonic-gate         prin.flags.toggleFlags(bitmask);
17787c478bd9Sstevel@tonic-gate     }
17797c478bd9Sstevel@tonic-gate 
17807c478bd9Sstevel@tonic-gate     /**
17817c478bd9Sstevel@tonic-gate      * Update components to reflect data in this principal
17827c478bd9Sstevel@tonic-gate      *
17837c478bd9Sstevel@tonic-gate      */
showPrincipal(Principal p)17847c478bd9Sstevel@tonic-gate     public void showPrincipal(Principal p) {
17857c478bd9Sstevel@tonic-gate 
17867c478bd9Sstevel@tonic-gate         gui.PrName1.set("text" /* NOI18N */, p.PrName);
17877c478bd9Sstevel@tonic-gate         gui.PrName2.set("text" /* NOI18N */, p.PrName);
17887c478bd9Sstevel@tonic-gate         gui.PrName3.set("text" /* NOI18N */, p.PrName);
17897c478bd9Sstevel@tonic-gate         gui.PrComments.set("text" /* NOI18N */, p.Comments);
17907c478bd9Sstevel@tonic-gate         String policy = p.Policy;
17917c478bd9Sstevel@tonic-gate         if (policy.compareTo("") == 0)
17927c478bd9Sstevel@tonic-gate             policy = getString("(no policy)");
17937c478bd9Sstevel@tonic-gate         gui.PrPolicy.set("selectedItem" /* NOI18N */, policy);
17947c478bd9Sstevel@tonic-gate         gui.PrPassword.set("text" /* NOI18N */, "");
17957c478bd9Sstevel@tonic-gate 
17967c478bd9Sstevel@tonic-gate         gui.PrLastChangedTime.set("text" /* NOI18N */, p.getModTime());
17977c478bd9Sstevel@tonic-gate         gui.PrLastChangedBy.set("text" /* NOI18N */,   p.ModName);
17987c478bd9Sstevel@tonic-gate         gui.PrExpiry.set("text" /* NOI18N */,          p.getExpiry());
179945526e97Ssemery         gui.EncList.set("text" /* NOI18N */,           p.getEncType());
18007c478bd9Sstevel@tonic-gate         gui.PrLastSuccess.set("text" /* NOI18N */,     p.getLastSuccess());
18017c478bd9Sstevel@tonic-gate         gui.PrLastFailure.set("text" /* NOI18N */,     p.getLastFailure());
18027c478bd9Sstevel@tonic-gate         gui.PrFailCount.set("text" /* NOI18N */, nf.format(p.NumFailures));
18037c478bd9Sstevel@tonic-gate         gui.PrLastPwChange.set("text" /* NOI18N */,    p.getLastPwChange());
18047c478bd9Sstevel@tonic-gate         gui.PrPwExpiry.set("text" /* NOI18N */,        p.getPwExpireTime());
18057c478bd9Sstevel@tonic-gate         gui.PrKvno.set("text" /* NOI18N */, nf.format(p.Kvno));
18067c478bd9Sstevel@tonic-gate         gui.PrMaxLifetime.set("text" /* NOI18N */, p.getMaxLife());
18077c478bd9Sstevel@tonic-gate         gui.PrMaxRenewal.set("text" /* NOI18N */, p.getMaxRenew());
18087c478bd9Sstevel@tonic-gate 
18097c478bd9Sstevel@tonic-gate         gui.PrLockAcct.set("state" /* NOI18N */,
18107c478bd9Sstevel@tonic-gate 		   new Boolean(p.flags.getFlag(Flags.DISALLOW_ALL_TIX)));
18117c478bd9Sstevel@tonic-gate         gui.PrForcePwChange.set("state" /* NOI18N */,
18127c478bd9Sstevel@tonic-gate 			new Boolean(p.flags.getFlag(Flags.REQUIRES_PWCHANGE)));
18137c478bd9Sstevel@tonic-gate         gui.PrAllowPostdated.set("state" /* NOI18N */,
18147c478bd9Sstevel@tonic-gate 		 new Boolean(!p.flags.getFlag(Flags.DISALLOW_POSTDATED)));
18157c478bd9Sstevel@tonic-gate         gui.PrAllowForwardable.set("state" /* NOI18N */,
18167c478bd9Sstevel@tonic-gate 		   new Boolean(!p.flags.getFlag(Flags.DISALLOW_FORWARDABLE)));
18177c478bd9Sstevel@tonic-gate         gui.PrAllowRenewable.set("state" /* NOI18N */,
18187c478bd9Sstevel@tonic-gate 		 new Boolean(!p.flags.getFlag(Flags.DISALLOW_RENEWABLE)));
18197c478bd9Sstevel@tonic-gate         gui.PrAllowProxiable.set("state" /* NOI18N */,
18207c478bd9Sstevel@tonic-gate 		 new Boolean(!p.flags.getFlag(Flags.DISALLOW_PROXIABLE)));
18217c478bd9Sstevel@tonic-gate         gui.PrAllowSvr.set("state" /* NOI18N */,
18227c478bd9Sstevel@tonic-gate 			   new Boolean(!p.flags.getFlag(Flags.DISALLOW_SVR)));
18237c478bd9Sstevel@tonic-gate         gui.PrAllowTGT.set("state" /* NOI18N */,
18247c478bd9Sstevel@tonic-gate 		   new Boolean(!p.flags.getFlag(Flags.DISALLOW_TGT_BASED)));
18257c478bd9Sstevel@tonic-gate         gui.PrAllowDupAuth.set("state" /* NOI18N */,
18267c478bd9Sstevel@tonic-gate 		       new Boolean(!p.flags.getFlag(Flags.DISALLOW_DUP_SKEY)));
18277c478bd9Sstevel@tonic-gate         gui.PrRequirePreAuth.set("state" /* NOI18N */,
18287c478bd9Sstevel@tonic-gate 			 new Boolean(p.flags.getFlag(Flags.REQUIRE_PRE_AUTH)));
18297c478bd9Sstevel@tonic-gate         gui.PrRequireHwPreAuth.set("state" /* NOI18N */,
18307c478bd9Sstevel@tonic-gate 			   new Boolean(p.flags.getFlag(Flags.REQUIRE_HW_AUTH)));
18317c478bd9Sstevel@tonic-gate     }
18327c478bd9Sstevel@tonic-gate 
18337c478bd9Sstevel@tonic-gate     /**
18347c478bd9Sstevel@tonic-gate      * Format a time duration for printing, using I18N formats
18357c478bd9Sstevel@tonic-gate      *
18367c478bd9Sstevel@tonic-gate      */
showDuration(Integer seconds)18377c478bd9Sstevel@tonic-gate     public String showDuration(Integer seconds) {
18387c478bd9Sstevel@tonic-gate         return nf.format(seconds.longValue());
18397c478bd9Sstevel@tonic-gate     }
18407c478bd9Sstevel@tonic-gate 
18417c478bd9Sstevel@tonic-gate     /*
18427c478bd9Sstevel@tonic-gate      * Methods for the policy list panel
18437c478bd9Sstevel@tonic-gate      */
18447c478bd9Sstevel@tonic-gate 
18457c478bd9Sstevel@tonic-gate     /**
18467c478bd9Sstevel@tonic-gate      * Update all policy text fields from gui.
18477c478bd9Sstevel@tonic-gate      * Check to see if anyone of them had a parse error.
18487c478bd9Sstevel@tonic-gate      * @returns true if all is ok,  false if an error occurs
18497c478bd9Sstevel@tonic-gate      */
18507c478bd9Sstevel@tonic-gate     // Quits as soon as the first error is detected. The method that
18517c478bd9Sstevel@tonic-gate     // detects the error also shows a dialog box with a message.
poUpdateFromGui()18527c478bd9Sstevel@tonic-gate     public boolean poUpdateFromGui() {
18537c478bd9Sstevel@tonic-gate         return (setPolName() && setPolMinlife() && setPolMaxlife());
18547c478bd9Sstevel@tonic-gate     }
18557c478bd9Sstevel@tonic-gate 
18567c478bd9Sstevel@tonic-gate     /**
18577c478bd9Sstevel@tonic-gate      * If we have edited a principal, select their policy by default
18587c478bd9Sstevel@tonic-gate      *
18597c478bd9Sstevel@tonic-gate      */
setDefaultPolicy(String name)18607c478bd9Sstevel@tonic-gate     public void setDefaultPolicy(String name) {
18617c478bd9Sstevel@tonic-gate         setCurPolicy(name);
18627c478bd9Sstevel@tonic-gate         fillPolicyList("");
18637c478bd9Sstevel@tonic-gate         TextList l = (TextList)gui.Pollist.getBody();
18647c478bd9Sstevel@tonic-gate         int itemcount = l.countItems();
18657c478bd9Sstevel@tonic-gate         for (int i = 0; i < itemcount; i++)
18667c478bd9Sstevel@tonic-gate             if (l.getItem(i).compareTo(name) == 0) {
18677c478bd9Sstevel@tonic-gate 		curPoListPos = i;
18687c478bd9Sstevel@tonic-gate 		break;
18697c478bd9Sstevel@tonic-gate 	    }
18707c478bd9Sstevel@tonic-gate     }
18717c478bd9Sstevel@tonic-gate 
18727c478bd9Sstevel@tonic-gate     /**
18737c478bd9Sstevel@tonic-gate      * Is the policy name field editable?
18747c478bd9Sstevel@tonic-gate      *
18757c478bd9Sstevel@tonic-gate      */
poSetEditable(boolean editable)18767c478bd9Sstevel@tonic-gate     public void poSetEditable(boolean editable) {
18777c478bd9Sstevel@tonic-gate         ponameEditable = editable;
18787c478bd9Sstevel@tonic-gate         Boolean b = new Boolean(editable);
18797c478bd9Sstevel@tonic-gate         gui.PoName.set("editable" /* NOI18N */, b);
18807c478bd9Sstevel@tonic-gate     }
18817c478bd9Sstevel@tonic-gate 
18827c478bd9Sstevel@tonic-gate     /**
18837c478bd9Sstevel@tonic-gate      * React to a change in the policy list pattern
18847c478bd9Sstevel@tonic-gate      *
18857c478bd9Sstevel@tonic-gate      */
poPatternComplete()18867c478bd9Sstevel@tonic-gate     public void poPatternComplete() {
18877c478bd9Sstevel@tonic-gate         curPoListPos = 0;
18887c478bd9Sstevel@tonic-gate         String pattern = (String)gui.PoListPattern.get("text" /* NOI18N */);
18897c478bd9Sstevel@tonic-gate         if (!noLists)
18907c478bd9Sstevel@tonic-gate             showPolicyList(pattern);
18917c478bd9Sstevel@tonic-gate         else
18927c478bd9Sstevel@tonic-gate             setCurPolicy(pattern);
18937c478bd9Sstevel@tonic-gate     }
18947c478bd9Sstevel@tonic-gate 
18957c478bd9Sstevel@tonic-gate     /**
18967c478bd9Sstevel@tonic-gate      * Clear policy list pattern
18977c478bd9Sstevel@tonic-gate      *
18987c478bd9Sstevel@tonic-gate      */
poPatternClear()18997c478bd9Sstevel@tonic-gate     public void poPatternClear() {
19007c478bd9Sstevel@tonic-gate         if (noLists) {
19017c478bd9Sstevel@tonic-gate             gui.PoListPattern.set("text" /* NOI18N */, "");
19027c478bd9Sstevel@tonic-gate             ((TextField)gui.PoListPattern.getBody()).requestFocus();
19037c478bd9Sstevel@tonic-gate         } else {
19047c478bd9Sstevel@tonic-gate             String tempName = CurPolicy;
19057c478bd9Sstevel@tonic-gate             fillPolicyList("");
19067c478bd9Sstevel@tonic-gate             selectPolicy(tempName);
19077c478bd9Sstevel@tonic-gate         }
19087c478bd9Sstevel@tonic-gate     }
19097c478bd9Sstevel@tonic-gate 
19107c478bd9Sstevel@tonic-gate     /**
19117c478bd9Sstevel@tonic-gate      * Show the policy list after applying the filter passed in.
19127c478bd9Sstevel@tonic-gate      */
showPolicyList(String pattern)19137c478bd9Sstevel@tonic-gate     public void showPolicyList(String pattern) {
19147c478bd9Sstevel@tonic-gate         pol = null; // we are not editing a policy
19157c478bd9Sstevel@tonic-gate         fillPolicyList(pattern);
19167c478bd9Sstevel@tonic-gate         ModeString = "";
19177c478bd9Sstevel@tonic-gate         OpString = "";
19187c478bd9Sstevel@tonic-gate         updateStatus();
19197c478bd9Sstevel@tonic-gate         gui.cardpanel2.show("List" /* NOI18N */);
19207c478bd9Sstevel@tonic-gate         if (noLists)
19217c478bd9Sstevel@tonic-gate             ((TextField)gui.PoListPattern.getBody()).requestFocus();
19227c478bd9Sstevel@tonic-gate     }
19237c478bd9Sstevel@tonic-gate 
19247c478bd9Sstevel@tonic-gate     /**
19257c478bd9Sstevel@tonic-gate      * Generate the policy list for the first time or after a pattern
19267c478bd9Sstevel@tonic-gate      * has been chosen.
19277c478bd9Sstevel@tonic-gate      *
19287c478bd9Sstevel@tonic-gate      */
fillPolicyList(String pattern)19297c478bd9Sstevel@tonic-gate     public void fillPolicyList(String pattern) {
19307c478bd9Sstevel@tonic-gate         if (noLists) {
19317c478bd9Sstevel@tonic-gate             setCurPolicy((String)gui.PoListPattern.get("text" /* NOI18N */));
19327c478bd9Sstevel@tonic-gate             ((TextField)gui.PoListPattern.getBody()).requestFocus();
19337c478bd9Sstevel@tonic-gate             disablePolicyPrinting();
19347c478bd9Sstevel@tonic-gate             return;
19357c478bd9Sstevel@tonic-gate         }
19367c478bd9Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
19377c478bd9Sstevel@tonic-gate         long cachetime = A_LONG_TIME;
19387c478bd9Sstevel@tonic-gate         if (!defaults.getStaticLists())
19397c478bd9Sstevel@tonic-gate             cachetime = defaults.getCacheTime() * 1000;
19407c478bd9Sstevel@tonic-gate         if (policyList != null
19417c478bd9Sstevel@tonic-gate 	    && ((new Date()).getTime() - policyListDate.getTime())
19427c478bd9Sstevel@tonic-gate 	    <= cachetime) {
19437c478bd9Sstevel@tonic-gate             if (pattern.compareTo(curPoPattern) != 0)
19447c478bd9Sstevel@tonic-gate                 newPoPattern(pattern);
19457c478bd9Sstevel@tonic-gate             realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
19467c478bd9Sstevel@tonic-gate             selectPolicy(curPoListPos);
19477c478bd9Sstevel@tonic-gate             return;
19487c478bd9Sstevel@tonic-gate         }
19497c478bd9Sstevel@tonic-gate         PolicyList p = new PolicyList(Kadmin);
19507c478bd9Sstevel@tonic-gate         gui.StatusLine.set("text" /* NOI18N */,
19517c478bd9Sstevel@tonic-gate 			   getString("Loading policy list"));
19527c478bd9Sstevel@tonic-gate         try {
19537c478bd9Sstevel@tonic-gate             policyList = p.getPolicyList();
19547c478bd9Sstevel@tonic-gate             policyListDate = new Date();
19557c478bd9Sstevel@tonic-gate         } catch (Exception e) {
19567c478bd9Sstevel@tonic-gate             realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
19577c478bd9Sstevel@tonic-gate             showError(e.getMessage());
19587c478bd9Sstevel@tonic-gate             updateStatus();
19597c478bd9Sstevel@tonic-gate             return;
19607c478bd9Sstevel@tonic-gate         }
19617c478bd9Sstevel@tonic-gate         updateStatus();
19627c478bd9Sstevel@tonic-gate         newPoPattern(pattern);
19637c478bd9Sstevel@tonic-gate         selectPolicy(curPoListPos);
19647c478bd9Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
19657c478bd9Sstevel@tonic-gate     }
19667c478bd9Sstevel@tonic-gate 
newPoPattern(String pattern)19677c478bd9Sstevel@tonic-gate     private void newPoPattern(String pattern) {
19687c478bd9Sstevel@tonic-gate         curPoPattern = pattern;
19697c478bd9Sstevel@tonic-gate         gui.PoListPattern.set("text" /* NOI18N */, pattern);
19707c478bd9Sstevel@tonic-gate         refreshPolicyList();
19717c478bd9Sstevel@tonic-gate     }
19727c478bd9Sstevel@tonic-gate 
refreshPolicyList()19737c478bd9Sstevel@tonic-gate     private void refreshPolicyList() {
19747c478bd9Sstevel@tonic-gate         if (noLists)
19757c478bd9Sstevel@tonic-gate             return;
19767c478bd9Sstevel@tonic-gate         Filter f = new Filter(policyList, curPoPattern);
19777c478bd9Sstevel@tonic-gate         gui.Pollist.set("items" /* NOI18N */, f.out);
19787c478bd9Sstevel@tonic-gate     }
19797c478bd9Sstevel@tonic-gate 
selectPolicy(int pos)19807c478bd9Sstevel@tonic-gate     private void selectPolicy(int pos) {
19817c478bd9Sstevel@tonic-gate         TextList list = (TextList)gui.Pollist.getBody();
19827c478bd9Sstevel@tonic-gate         if (list.countItems() == 0) {
19837c478bd9Sstevel@tonic-gate             setCurPolicy("");
19847c478bd9Sstevel@tonic-gate             return;
19857c478bd9Sstevel@tonic-gate         }
19867c478bd9Sstevel@tonic-gate 
19877c478bd9Sstevel@tonic-gate         if (pos < 0)
19887c478bd9Sstevel@tonic-gate             pos = 0;
19897c478bd9Sstevel@tonic-gate         else if (pos >= list.countItems())
19907c478bd9Sstevel@tonic-gate             pos = list.countItems() - 1;
19917c478bd9Sstevel@tonic-gate 
19927c478bd9Sstevel@tonic-gate         list.select(pos);
19937c478bd9Sstevel@tonic-gate         enablePolicyPrinting();
19947c478bd9Sstevel@tonic-gate         list.makeVisible(pos);
19957c478bd9Sstevel@tonic-gate         setCurPolicy(list.getItem(pos));
19967c478bd9Sstevel@tonic-gate     }
19977c478bd9Sstevel@tonic-gate 
selectPolicy(String name)19987c478bd9Sstevel@tonic-gate     private void selectPolicy(String name) {
19997c478bd9Sstevel@tonic-gate         String[] list = getItemsFromTextList((TextList)gui.Pollist.getBody());
20007c478bd9Sstevel@tonic-gate         selectPolicy(search(list, name));
20017c478bd9Sstevel@tonic-gate     }
20027c478bd9Sstevel@tonic-gate 
20037c478bd9Sstevel@tonic-gate     /**
20047c478bd9Sstevel@tonic-gate      * When the policy name choice changes, we want to reflect
20057c478bd9Sstevel@tonic-gate      * the name in the policy detail tab.
20067c478bd9Sstevel@tonic-gate      *
20077c478bd9Sstevel@tonic-gate      */
setCurPolicy(String name)20087c478bd9Sstevel@tonic-gate     public void setCurPolicy(String name) {
20097c478bd9Sstevel@tonic-gate         CurPolicy = name;
20107c478bd9Sstevel@tonic-gate         gui.PoName.set("text" /* NOI18N */, CurPolicy);
20117c478bd9Sstevel@tonic-gate         if (name.compareTo("") == 0) {
20127c478bd9Sstevel@tonic-gate             poSelValid(false);
20137c478bd9Sstevel@tonic-gate             return;
20147c478bd9Sstevel@tonic-gate         }
20157c478bd9Sstevel@tonic-gate         poSelValid(true);
20167c478bd9Sstevel@tonic-gate     }
20177c478bd9Sstevel@tonic-gate 
20187c478bd9Sstevel@tonic-gate     /**
20197c478bd9Sstevel@tonic-gate      * Look at the policy list to see what's selected
20207c478bd9Sstevel@tonic-gate      *
20217c478bd9Sstevel@tonic-gate      */
lookAtPoList()20227c478bd9Sstevel@tonic-gate     public void lookAtPoList() {
20237c478bd9Sstevel@tonic-gate         if (noLists)
20247c478bd9Sstevel@tonic-gate             return;
20257c478bd9Sstevel@tonic-gate         TextList list = (TextList) gui.Pollist.getBody();
20267c478bd9Sstevel@tonic-gate         poMulti = null;
20277c478bd9Sstevel@tonic-gate         String[] sel = list.getSelectedItems();
20287c478bd9Sstevel@tonic-gate         if (sel.length == 1) {
20297c478bd9Sstevel@tonic-gate             setCurPolicy(sel[0]);
20307c478bd9Sstevel@tonic-gate             curPoListPos = list.getSelectedIndex();
20317c478bd9Sstevel@tonic-gate         } else {
20327c478bd9Sstevel@tonic-gate             if (sel.length > 0)
20337c478bd9Sstevel@tonic-gate                 poMulti = sel;
20347c478bd9Sstevel@tonic-gate             setCurPolicy("");
20357c478bd9Sstevel@tonic-gate         }
20367c478bd9Sstevel@tonic-gate     }
20377c478bd9Sstevel@tonic-gate 
restorePoListSelection()20387c478bd9Sstevel@tonic-gate     private void restorePoListSelection() {
20397c478bd9Sstevel@tonic-gate         if (noLists)
20407c478bd9Sstevel@tonic-gate             return;
20417c478bd9Sstevel@tonic-gate         TextList list = (TextList) gui.Pollist.getBody();
20427c478bd9Sstevel@tonic-gate         list.select(curPoListPos);
20437c478bd9Sstevel@tonic-gate     }
20447c478bd9Sstevel@tonic-gate 
20457c478bd9Sstevel@tonic-gate     /**
20467c478bd9Sstevel@tonic-gate      * Make Modify, Delete and Duplicate buttons react to what is selected.
20477c478bd9Sstevel@tonic-gate      *
20487c478bd9Sstevel@tonic-gate      */
poSelValid(boolean selected)20497c478bd9Sstevel@tonic-gate     public void poSelValid(boolean selected) {
20507c478bd9Sstevel@tonic-gate         poSelValid = selected;
20517c478bd9Sstevel@tonic-gate         Boolean b = new Boolean(selected && (privs & PRIV_INQUIRE) != 0);
20527c478bd9Sstevel@tonic-gate         gui.PoListModify.set("enabled" /* NOI18N */, b);
20537c478bd9Sstevel@tonic-gate         int want = (PRIV_ADD | PRIV_INQUIRE);
20547c478bd9Sstevel@tonic-gate         b = new Boolean(selected && (privs & want) == want);
20557c478bd9Sstevel@tonic-gate         gui.PoListDuplicate.set("enabled" /* NOI18N */, b);
20567c478bd9Sstevel@tonic-gate         b = new Boolean((selected || poMulti != null)
20577c478bd9Sstevel@tonic-gate 			&&(privs & PRIV_DELETE) != 0);
20587c478bd9Sstevel@tonic-gate         gui.PoListDelete.set("enabled" /* NOI18N */, b);
20597c478bd9Sstevel@tonic-gate     }
20607c478bd9Sstevel@tonic-gate 
20617c478bd9Sstevel@tonic-gate     /**
20627c478bd9Sstevel@tonic-gate      * Make the Save button do the right thing.
20637c478bd9Sstevel@tonic-gate      *
20647c478bd9Sstevel@tonic-gate      */
poSetCanSave(boolean ok)20657c478bd9Sstevel@tonic-gate     public void poSetCanSave(boolean ok) {
20667c478bd9Sstevel@tonic-gate         Boolean b = new Boolean(ok);
20677c478bd9Sstevel@tonic-gate         gui.PoDetailSave.set("enabled"  /* NOI18N */, b);
20687c478bd9Sstevel@tonic-gate     }
20697c478bd9Sstevel@tonic-gate 
20707c478bd9Sstevel@tonic-gate     /**
20717c478bd9Sstevel@tonic-gate      * This is a way for the data modification actions to note that
20727c478bd9Sstevel@tonic-gate      * the principal has edits outstanding.
20737c478bd9Sstevel@tonic-gate      *
20747c478bd9Sstevel@tonic-gate      */
poSetNeedSave()20757c478bd9Sstevel@tonic-gate     public void poSetNeedSave() {
20767c478bd9Sstevel@tonic-gate         poNeedSave = true;
20777c478bd9Sstevel@tonic-gate         poSetCanSave(true);
20787c478bd9Sstevel@tonic-gate         SaveString = getString("- *CHANGES*");
20797c478bd9Sstevel@tonic-gate         updateStatus();
20807c478bd9Sstevel@tonic-gate     }
20817c478bd9Sstevel@tonic-gate 
poDoSave()20827c478bd9Sstevel@tonic-gate     public boolean poDoSave() {
20837c478bd9Sstevel@tonic-gate 
20847c478bd9Sstevel@tonic-gate         // before attempting to save make sure all text fields are in order
20857c478bd9Sstevel@tonic-gate         if (poUpdateFromGui() == false)
20867c478bd9Sstevel@tonic-gate             return false;
20877c478bd9Sstevel@tonic-gate 
20887c478bd9Sstevel@tonic-gate         boolean b = true;
20897c478bd9Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
20907c478bd9Sstevel@tonic-gate         try {
20917c478bd9Sstevel@tonic-gate             b = pol.savePolicy();
20927c478bd9Sstevel@tonic-gate         } catch (Exception e) {
20937c478bd9Sstevel@tonic-gate             b = false;
20947c478bd9Sstevel@tonic-gate             showError(e.getMessage());
20957c478bd9Sstevel@tonic-gate         }
20967c478bd9Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
20977c478bd9Sstevel@tonic-gate         if (!b)
20987c478bd9Sstevel@tonic-gate             return false;
20997c478bd9Sstevel@tonic-gate         if (pol.isNew) {
21007c478bd9Sstevel@tonic-gate             policyList = addToList(policyList, pol.PolicyName);
21017c478bd9Sstevel@tonic-gate             refreshPolicyList();
21027c478bd9Sstevel@tonic-gate             selectPolicy(pol.PolicyName);
21037c478bd9Sstevel@tonic-gate             setPolicyChoice();
21047c478bd9Sstevel@tonic-gate         }
21057c478bd9Sstevel@tonic-gate         pol.isNew = false;
21067c478bd9Sstevel@tonic-gate         poSetEditable(false);
21077c478bd9Sstevel@tonic-gate         poSetCanSave(false);
21087c478bd9Sstevel@tonic-gate         poNeedSave = false;
21097c478bd9Sstevel@tonic-gate         SaveString = "";
21107c478bd9Sstevel@tonic-gate         updateStatus();
21117c478bd9Sstevel@tonic-gate         return true;
21127c478bd9Sstevel@tonic-gate     }
21137c478bd9Sstevel@tonic-gate 
21147c478bd9Sstevel@tonic-gate     /**
21157c478bd9Sstevel@tonic-gate      * React to a choice from the policy list via double-click or
21167c478bd9Sstevel@tonic-gate      * single-click+Modify; we want to go to the next tab in each case.
21177c478bd9Sstevel@tonic-gate      * If we don't have modify privileges, we need to simply show values.
21187c478bd9Sstevel@tonic-gate      */
poSelected()21197c478bd9Sstevel@tonic-gate     public void poSelected() {
21207c478bd9Sstevel@tonic-gate         enablePolicyPrinting();
21217c478bd9Sstevel@tonic-gate         lookAtPoList();
21227c478bd9Sstevel@tonic-gate         if (!poNeedSave) {
21237c478bd9Sstevel@tonic-gate             poSetEditable(false);
21247c478bd9Sstevel@tonic-gate             poSetCanSave(false);
21257c478bd9Sstevel@tonic-gate         }
21267c478bd9Sstevel@tonic-gate         if (noLists)
21277c478bd9Sstevel@tonic-gate             CurPolicy = (String)gui.PoListPattern.get("text" /* NOI18N */);
21287c478bd9Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
21297c478bd9Sstevel@tonic-gate         enablePoAttributes(new Boolean((privs & (PRIV_ADD|PRIV_MODIFY)) != 0));
21307c478bd9Sstevel@tonic-gate         try {
21317c478bd9Sstevel@tonic-gate             pol = new Policy(Kadmin, CurPolicy);
21327c478bd9Sstevel@tonic-gate         } catch (Exception e) {
21337c478bd9Sstevel@tonic-gate             showError(e.getMessage());
21347c478bd9Sstevel@tonic-gate             realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
21357c478bd9Sstevel@tonic-gate             return;
21367c478bd9Sstevel@tonic-gate         }
21377c478bd9Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
21387c478bd9Sstevel@tonic-gate         showPolicy(pol);
21397c478bd9Sstevel@tonic-gate         ModeString = getString("Modify")+" ";
21407c478bd9Sstevel@tonic-gate         OpString = getString("Policy");
21417c478bd9Sstevel@tonic-gate         updateStatus();
21427c478bd9Sstevel@tonic-gate         gui.cardpanel2.show("Details" /* NOI18N */);
21437c478bd9Sstevel@tonic-gate     }
21447c478bd9Sstevel@tonic-gate 
21457c478bd9Sstevel@tonic-gate     /**
21467c478bd9Sstevel@tonic-gate      * React to add policy button
21477c478bd9Sstevel@tonic-gate      * If we got here, we need to enable attributes since we have privs.
21487c478bd9Sstevel@tonic-gate      */
poAdd()21497c478bd9Sstevel@tonic-gate     public void poAdd() {
21507c478bd9Sstevel@tonic-gate         enablePolicyPrinting();
21517c478bd9Sstevel@tonic-gate         setCurPolicy("");
21527c478bd9Sstevel@tonic-gate         poSelValid = true;
21537c478bd9Sstevel@tonic-gate         poSetEditable(true);
21547c478bd9Sstevel@tonic-gate         poSetNeedSave();
21557c478bd9Sstevel@tonic-gate         enablePoAttributes(new Boolean(true));
21567c478bd9Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
21577c478bd9Sstevel@tonic-gate         try {
21587c478bd9Sstevel@tonic-gate             pol = new Policy(Kadmin);
21597c478bd9Sstevel@tonic-gate         } catch (Exception e) {
21607c478bd9Sstevel@tonic-gate             showError(e.getMessage());
21617c478bd9Sstevel@tonic-gate             realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
21627c478bd9Sstevel@tonic-gate             return;
21637c478bd9Sstevel@tonic-gate         }
21647c478bd9Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
21657c478bd9Sstevel@tonic-gate         showPolicy(pol);
21667c478bd9Sstevel@tonic-gate         ModeString = getString("Create New")+" ";
21677c478bd9Sstevel@tonic-gate         OpString = getString("Policy");
21687c478bd9Sstevel@tonic-gate         updateStatus();
21697c478bd9Sstevel@tonic-gate         gui.cardpanel2.show("Details" /* NOI18N */);
21707c478bd9Sstevel@tonic-gate         ((TextField)gui.PoName.getBody()).requestFocus();
21717c478bd9Sstevel@tonic-gate     }
21727c478bd9Sstevel@tonic-gate 
21737c478bd9Sstevel@tonic-gate     /**
21747c478bd9Sstevel@tonic-gate      * React to duplicate policy button
21757c478bd9Sstevel@tonic-gate      *
21767c478bd9Sstevel@tonic-gate      */
poDuplicate()21777c478bd9Sstevel@tonic-gate     public void poDuplicate() {
21787c478bd9Sstevel@tonic-gate         enablePolicyPrinting();
21797c478bd9Sstevel@tonic-gate         if (noLists)
21807c478bd9Sstevel@tonic-gate             CurPolicy = (String)gui.PoListPattern.get("text" /* NOI18N */);
21817c478bd9Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
21827c478bd9Sstevel@tonic-gate         try {
21837c478bd9Sstevel@tonic-gate             pol = new Policy(Kadmin, CurPolicy);
21847c478bd9Sstevel@tonic-gate         } catch (Exception e) {
21857c478bd9Sstevel@tonic-gate             showError(e.getMessage());
21867c478bd9Sstevel@tonic-gate             realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
21877c478bd9Sstevel@tonic-gate             return;
21887c478bd9Sstevel@tonic-gate         }
21897c478bd9Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
21907c478bd9Sstevel@tonic-gate         setCurPolicy("");
21917c478bd9Sstevel@tonic-gate         poSelValid = true;
21927c478bd9Sstevel@tonic-gate         poSetEditable(true);
21937c478bd9Sstevel@tonic-gate         poSetNeedSave();
21947c478bd9Sstevel@tonic-gate         try {
21957c478bd9Sstevel@tonic-gate             pol = new Policy(Kadmin, pol);
21967c478bd9Sstevel@tonic-gate         } catch (Exception e) {
21977c478bd9Sstevel@tonic-gate             showError(e.getMessage());
21987c478bd9Sstevel@tonic-gate             return;
21997c478bd9Sstevel@tonic-gate         }
22007c478bd9Sstevel@tonic-gate         pol.PolicyName = "";
22017c478bd9Sstevel@tonic-gate         showPolicy(pol);
22027c478bd9Sstevel@tonic-gate         ModeString = getString("Duplicate")+" ";
22037c478bd9Sstevel@tonic-gate         OpString = getString("Policy");
22047c478bd9Sstevel@tonic-gate         updateStatus();
22057c478bd9Sstevel@tonic-gate         gui.cardpanel2.show("Details" /* NOI18N */);
22067c478bd9Sstevel@tonic-gate         ((TextField)gui.PoName.getBody()).requestFocus();
22077c478bd9Sstevel@tonic-gate     }
22087c478bd9Sstevel@tonic-gate 
22097c478bd9Sstevel@tonic-gate     /**
22107c478bd9Sstevel@tonic-gate      * React to delete policy button
22117c478bd9Sstevel@tonic-gate      */
poDelete()22127c478bd9Sstevel@tonic-gate     public void poDelete() {
22137c478bd9Sstevel@tonic-gate         String text[] = {getString("You are about to destroy data."),
22147c478bd9Sstevel@tonic-gate 			 getString("Click OK to proceed or"
22157c478bd9Sstevel@tonic-gate 				   +" Cancel to continue editing.")};
22167c478bd9Sstevel@tonic-gate         String resp = confirmAction(realMainFrame, text);
22177c478bd9Sstevel@tonic-gate         if (resp.equals(getString("Cancel")))
22187c478bd9Sstevel@tonic-gate             return;
22197c478bd9Sstevel@tonic-gate         boolean b;
22207c478bd9Sstevel@tonic-gate         if (noLists)
22217c478bd9Sstevel@tonic-gate             CurPolicy = (String)gui.PoListPattern.get("text" /* NOI18N */);
22227c478bd9Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.WAIT_CURSOR));
22237c478bd9Sstevel@tonic-gate         try {
22247c478bd9Sstevel@tonic-gate             b = Kadmin.deletePolicy(CurPolicy);
22257c478bd9Sstevel@tonic-gate         } catch (Exception e) {
22267c478bd9Sstevel@tonic-gate             showError(e.getMessage());
22277c478bd9Sstevel@tonic-gate             realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
22287c478bd9Sstevel@tonic-gate             return;
22297c478bd9Sstevel@tonic-gate         }
22307c478bd9Sstevel@tonic-gate         realMainFrame.setCursor(new Cursor(Cursor.DEFAULT_CURSOR));
22317c478bd9Sstevel@tonic-gate         if (!b)
22327c478bd9Sstevel@tonic-gate             return;
22337c478bd9Sstevel@tonic-gate         policyList = delFromList(policyList, CurPolicy);
22347c478bd9Sstevel@tonic-gate         refreshPolicyList();
22357c478bd9Sstevel@tonic-gate         setPolicyChoice();
22367c478bd9Sstevel@tonic-gate         setCurPolicy("");
22377c478bd9Sstevel@tonic-gate         poSelValid = true;
22387c478bd9Sstevel@tonic-gate         poSetEditable(true);
22397c478bd9Sstevel@tonic-gate         if (curPoListPos == ((TextList)gui.Pollist.getBody()).countItems())
22407c478bd9Sstevel@tonic-gate             curPoListPos--;
22417c478bd9Sstevel@tonic-gate         showPolicyList(curPoPattern);
22427c478bd9Sstevel@tonic-gate     }
22437c478bd9Sstevel@tonic-gate 
22447c478bd9Sstevel@tonic-gate     /**
22457c478bd9Sstevel@tonic-gate      * React to save policy button
22467c478bd9Sstevel@tonic-gate      *
22477c478bd9Sstevel@tonic-gate      */
poSave()22487c478bd9Sstevel@tonic-gate     public void poSave() {
22497c478bd9Sstevel@tonic-gate         poDoSave();
22507c478bd9Sstevel@tonic-gate     }
22517c478bd9Sstevel@tonic-gate 
22527c478bd9Sstevel@tonic-gate     /**
22537c478bd9Sstevel@tonic-gate      * React to cancel policy button
22547c478bd9Sstevel@tonic-gate      *
22557c478bd9Sstevel@tonic-gate      */
poCancel()22567c478bd9Sstevel@tonic-gate     public void poCancel() {
22577c478bd9Sstevel@tonic-gate         if (poNeedSave) {
22587c478bd9Sstevel@tonic-gate             String text[] = {getString("You are about to lose changes."),
22597c478bd9Sstevel@tonic-gate 			     getString("Click Save to commit changes, "
22607c478bd9Sstevel@tonic-gate 				       +"Discard to discard changes, "
22617c478bd9Sstevel@tonic-gate 				       +"or Cancel to continue editing.")};
22627c478bd9Sstevel@tonic-gate             String resp = confirmSave(realMainFrame, text);
22637c478bd9Sstevel@tonic-gate             if (resp.equals(getString("Cancel")))
22647c478bd9Sstevel@tonic-gate                 return;
22657c478bd9Sstevel@tonic-gate             if (resp.equals(getString("Save")))
22667c478bd9Sstevel@tonic-gate                 if (!poDoSave())
22677c478bd9Sstevel@tonic-gate 		    return;
22687c478bd9Sstevel@tonic-gate         }
22697c478bd9Sstevel@tonic-gate         poSetEditable(false);
22707c478bd9Sstevel@tonic-gate         poSetCanSave(false);
22717c478bd9Sstevel@tonic-gate         poNeedSave = false;
22727c478bd9Sstevel@tonic-gate         lookAtPoList();
22737c478bd9Sstevel@tonic-gate         SaveString = "";
22747c478bd9Sstevel@tonic-gate         showPolicyList(curPoPattern);
22757c478bd9Sstevel@tonic-gate     }
22767c478bd9Sstevel@tonic-gate 
22777c478bd9Sstevel@tonic-gate     /**
22787c478bd9Sstevel@tonic-gate      * React to previous button on policy detail screen
22797c478bd9Sstevel@tonic-gate      *
22807c478bd9Sstevel@tonic-gate      */
polPrevious()22817c478bd9Sstevel@tonic-gate     public void polPrevious() {
22827c478bd9Sstevel@tonic-gate         poCancel();
22837c478bd9Sstevel@tonic-gate     }
22847c478bd9Sstevel@tonic-gate 
22857c478bd9Sstevel@tonic-gate     /**
22867c478bd9Sstevel@tonic-gate      * React to done button on policy detail screen
22877c478bd9Sstevel@tonic-gate      *
22887c478bd9Sstevel@tonic-gate      */
polDone()22897c478bd9Sstevel@tonic-gate     public void polDone() {
22907c478bd9Sstevel@tonic-gate         if (poNeedSave && poDoSave() == false)
22917c478bd9Sstevel@tonic-gate             return;
22927c478bd9Sstevel@tonic-gate         showPolicyList(curPoPattern);
22937c478bd9Sstevel@tonic-gate     }
22947c478bd9Sstevel@tonic-gate 
22957c478bd9Sstevel@tonic-gate     /*
22967c478bd9Sstevel@tonic-gate      * Methods for the policy details panel
22977c478bd9Sstevel@tonic-gate      */
22987c478bd9Sstevel@tonic-gate 
setPolName()22997c478bd9Sstevel@tonic-gate     public boolean setPolName() {
23007c478bd9Sstevel@tonic-gate         if (!ponameEditable)
23017c478bd9Sstevel@tonic-gate             return true;
23027c478bd9Sstevel@tonic-gate 
23037c478bd9Sstevel@tonic-gate         String p = (String)gui.PoName.get("text" /* NOI18N */);
23047c478bd9Sstevel@tonic-gate         if (p.compareTo(getString("(no policy)")) == 0) {
23057c478bd9Sstevel@tonic-gate             showError(getString("Policy name already exists. Please choose "
23067c478bd9Sstevel@tonic-gate 				+"a different policy name or cancel"));
23077c478bd9Sstevel@tonic-gate             gui.PoName.set("text" /* NOI18N */, "");
23087c478bd9Sstevel@tonic-gate             ((TextField)gui.PoName.getBody()).requestFocus();
23097c478bd9Sstevel@tonic-gate             return false;
23107c478bd9Sstevel@tonic-gate         }
23117c478bd9Sstevel@tonic-gate         if (p.compareTo("") == 0) {
23127c478bd9Sstevel@tonic-gate             showError(getString("Please enter a policy name or cancel"));
23137c478bd9Sstevel@tonic-gate             ((TextField)gui.PoName.getBody()).requestFocus();
23147c478bd9Sstevel@tonic-gate             return false;
23157c478bd9Sstevel@tonic-gate         }
23167c478bd9Sstevel@tonic-gate 
23177c478bd9Sstevel@tonic-gate         setCurPolicy(p);
23187c478bd9Sstevel@tonic-gate         pol.setName(p);
23197c478bd9Sstevel@tonic-gate         return true;
23207c478bd9Sstevel@tonic-gate     }
23217c478bd9Sstevel@tonic-gate 
setPolPwLength()23227c478bd9Sstevel@tonic-gate     public void setPolPwLength() {
23237c478bd9Sstevel@tonic-gate         if (pol == null)
23247c478bd9Sstevel@tonic-gate                 return;
23257c478bd9Sstevel@tonic-gate         try {
23267c478bd9Sstevel@tonic-gate             pol.setPolPwLength((String)gui.PoMinPwLength.get("selectedItem"
23277c478bd9Sstevel@tonic-gate 							 /* NOI18N */));
23287c478bd9Sstevel@tonic-gate         } catch (Exception e) {};
23297c478bd9Sstevel@tonic-gate     }
23307c478bd9Sstevel@tonic-gate 
setPolPwClasses()23317c478bd9Sstevel@tonic-gate     public void setPolPwClasses() {
23327c478bd9Sstevel@tonic-gate         if (pol == null)
23337c478bd9Sstevel@tonic-gate                 return;
23347c478bd9Sstevel@tonic-gate         try {
23357c478bd9Sstevel@tonic-gate             pol.setPolPwClasses((String)gui.PoMinPwClass.get("selectedItem"
23367c478bd9Sstevel@tonic-gate 							 /* NOI18N */));
23377c478bd9Sstevel@tonic-gate         } catch (Exception e) {};
23387c478bd9Sstevel@tonic-gate     }
23397c478bd9Sstevel@tonic-gate 
setPolPwHistory()23407c478bd9Sstevel@tonic-gate     public void setPolPwHistory() {
23417c478bd9Sstevel@tonic-gate         if (pol == null)
23427c478bd9Sstevel@tonic-gate                 return;
23437c478bd9Sstevel@tonic-gate         try {
23447c478bd9Sstevel@tonic-gate             pol.setPolPwHistory((String)gui.PoSavedPasswords.get("selectedItem"
23457c478bd9Sstevel@tonic-gate 							     /* NOI18N */));
23467c478bd9Sstevel@tonic-gate         } catch (Exception e) {};
23477c478bd9Sstevel@tonic-gate     }
23487c478bd9Sstevel@tonic-gate 
setPolMinlife()23497c478bd9Sstevel@tonic-gate     public boolean setPolMinlife() {
23507c478bd9Sstevel@tonic-gate         if (pol.setPolMinlife((String)gui.PoMinTicketLifetime.get("text"
23517c478bd9Sstevel@tonic-gate 							  /* NOI18N */))) {
23527c478bd9Sstevel@tonic-gate             // visually delete any extraneous data that was ignored in the
23537c478bd9Sstevel@tonic-gate             // parsing by resetting the gui data
23547c478bd9Sstevel@tonic-gate             gui.PoMinTicketLifetime.set("text" /* NOI18N */,
23557c478bd9Sstevel@tonic-gate 					showDuration(pol.PwMinLife));
23567c478bd9Sstevel@tonic-gate             return true;
23577c478bd9Sstevel@tonic-gate         } else {
23587c478bd9Sstevel@tonic-gate             showDataFormatError(((TextField)gui.PoMinTicketLifetime.getBody()),
23597c478bd9Sstevel@tonic-gate 				DURATION_DATA);
23607c478bd9Sstevel@tonic-gate             return false;
23617c478bd9Sstevel@tonic-gate         }
23627c478bd9Sstevel@tonic-gate     }
23637c478bd9Sstevel@tonic-gate 
setPolMaxlife()23647c478bd9Sstevel@tonic-gate     public boolean setPolMaxlife() {
23657c478bd9Sstevel@tonic-gate         if (pol.setPolMaxlife((String)gui.PoMaxTicketLifetime.get(
23667c478bd9Sstevel@tonic-gate 						  "text" /* NOI18N */))) {
23677c478bd9Sstevel@tonic-gate             // visually delete any extraneous data that was ignored in the
23687c478bd9Sstevel@tonic-gate             // parsing by resetting the gui data
23697c478bd9Sstevel@tonic-gate             gui.PoMaxTicketLifetime.set("text" /* NOI18N */,
23707c478bd9Sstevel@tonic-gate 					showDuration(pol.PwMaxLife));
23717c478bd9Sstevel@tonic-gate             return true;
23727c478bd9Sstevel@tonic-gate         } else {
23737c478bd9Sstevel@tonic-gate             showDataFormatError(((TextField)gui.PoMaxTicketLifetime.getBody()),
23747c478bd9Sstevel@tonic-gate 				DURATION_DATA);
23757c478bd9Sstevel@tonic-gate             return false;
23767c478bd9Sstevel@tonic-gate         }
23777c478bd9Sstevel@tonic-gate     }
23787c478bd9Sstevel@tonic-gate 
23797c478bd9Sstevel@tonic-gate     /**
23807c478bd9Sstevel@tonic-gate      * Update components to reflect data in this policy
23817c478bd9Sstevel@tonic-gate      *
23827c478bd9Sstevel@tonic-gate      */
showPolicy(Policy p)23837c478bd9Sstevel@tonic-gate     public void showPolicy(Policy p) {
23847c478bd9Sstevel@tonic-gate         gui.PoName.set("text" /* NOI18N */, p.PolicyName);
23857c478bd9Sstevel@tonic-gate         gui.PoMinPwLength.set("selectedItem" /* NOI18N */,
23867c478bd9Sstevel@tonic-gate 			      nf.format(p.PwMinLength));
23877c478bd9Sstevel@tonic-gate         gui.PoMinPwClass.set("selectedItem" /* NOI18N */,
23887c478bd9Sstevel@tonic-gate 			     nf.format(p.PwMinClasses));
23897c478bd9Sstevel@tonic-gate         gui.PoSavedPasswords.set("selectedItem" /* NOI18N */,
23907c478bd9Sstevel@tonic-gate 				 nf.format(p.PwSaveCount));
23917c478bd9Sstevel@tonic-gate         gui.PoMinTicketLifetime.set("text" /* NOI18N */,
23927c478bd9Sstevel@tonic-gate 				    showDuration(p.PwMinLife));
23937c478bd9Sstevel@tonic-gate         gui.PoMaxTicketLifetime.set("text" /* NOI18N */,
23947c478bd9Sstevel@tonic-gate 				    showDuration(p.PwMaxLife));
23957c478bd9Sstevel@tonic-gate         gui.PoReferences.set("text" /* NOI18N */, nf.format(p.RefCount));
23967c478bd9Sstevel@tonic-gate     }
23977c478bd9Sstevel@tonic-gate 
23987c478bd9Sstevel@tonic-gate     /*
23997c478bd9Sstevel@tonic-gate      * Methods for defaults tab
24007c478bd9Sstevel@tonic-gate      */
24017c478bd9Sstevel@tonic-gate 
24027c478bd9Sstevel@tonic-gate     /**
24037c478bd9Sstevel@tonic-gate      * React to save button
24047c478bd9Sstevel@tonic-gate      *
24057c478bd9Sstevel@tonic-gate      */
glSave()24067c478bd9Sstevel@tonic-gate     public void glSave() {
24077c478bd9Sstevel@tonic-gate         if (defaults.updateFromGui()) {
24087c478bd9Sstevel@tonic-gate             glDoSave(true);
24097c478bd9Sstevel@tonic-gate             glUpdate();
24107c478bd9Sstevel@tonic-gate         }
24117c478bd9Sstevel@tonic-gate     }
24127c478bd9Sstevel@tonic-gate 
24137c478bd9Sstevel@tonic-gate     /**
24147c478bd9Sstevel@tonic-gate      * React to apply button
24157c478bd9Sstevel@tonic-gate      *
24167c478bd9Sstevel@tonic-gate      */
glApply()24177c478bd9Sstevel@tonic-gate     public void glApply() {
24187c478bd9Sstevel@tonic-gate         if (defaults.updateFromGui()) {
24197c478bd9Sstevel@tonic-gate             glDoSave(false);
24207c478bd9Sstevel@tonic-gate             glUpdate();
24217c478bd9Sstevel@tonic-gate         }
24227c478bd9Sstevel@tonic-gate     }
24237c478bd9Sstevel@tonic-gate 
24247c478bd9Sstevel@tonic-gate     /**
24257c478bd9Sstevel@tonic-gate      * React to cancel button
24267c478bd9Sstevel@tonic-gate      *
24277c478bd9Sstevel@tonic-gate      */
glCancel()24287c478bd9Sstevel@tonic-gate     public void glCancel() {
24297c478bd9Sstevel@tonic-gate         if (glNeedSave) {
24307c478bd9Sstevel@tonic-gate             String text[] = {getString("You are about to lose changes."),
24317c478bd9Sstevel@tonic-gate 			     getString("Click Save to commit changes, "
24327c478bd9Sstevel@tonic-gate 				       +"Discard to discard changes, "
24337c478bd9Sstevel@tonic-gate 				       +"or Cancel to continue editing.")};
24347c478bd9Sstevel@tonic-gate             String resp = confirmSave(defaultsEditingFrame, text);
24357c478bd9Sstevel@tonic-gate             if (resp.equals(getString("Cancel")))
24367c478bd9Sstevel@tonic-gate                 return;
24377c478bd9Sstevel@tonic-gate             if (resp.equals(getString("Discard")))
24387c478bd9Sstevel@tonic-gate                 defaults.restoreValues(olddefaults);
24397c478bd9Sstevel@tonic-gate             if (resp.equals(getString("Save"))) {
24407c478bd9Sstevel@tonic-gate                 glDoSave(true);
24417c478bd9Sstevel@tonic-gate                 glUpdate();
24427c478bd9Sstevel@tonic-gate                 return;
24437c478bd9Sstevel@tonic-gate             }
24447c478bd9Sstevel@tonic-gate         }
24457c478bd9Sstevel@tonic-gate         glDoSave(false);
24467c478bd9Sstevel@tonic-gate     }
24477c478bd9Sstevel@tonic-gate 
glDoSave(boolean save)24487c478bd9Sstevel@tonic-gate     public void glDoSave(boolean save) {
24497c478bd9Sstevel@tonic-gate         defaults.close(save);
24507c478bd9Sstevel@tonic-gate         glSetCanSave(false);
24517c478bd9Sstevel@tonic-gate         glNeedSave = false;
24527c478bd9Sstevel@tonic-gate         SaveString = "";
24537c478bd9Sstevel@tonic-gate         updateStatus();
24547c478bd9Sstevel@tonic-gate     }
24557c478bd9Sstevel@tonic-gate 
glUpdate()24567c478bd9Sstevel@tonic-gate     public void glUpdate() {
24577c478bd9Sstevel@tonic-gate         noLists = ((privs & PRIV_LIST) == 0 || !defaults.getShowLists());
24587c478bd9Sstevel@tonic-gate         fixHelpTags();
24597c478bd9Sstevel@tonic-gate         fixListPanels();
24607c478bd9Sstevel@tonic-gate         // Load principal list if we are in the principal tab and are not
24617c478bd9Sstevel@tonic-gate         // editing a principal
24627c478bd9Sstevel@tonic-gate         if (gui.tabbedfolder1.get("currentCard" /* NO18N */) ==
24637c478bd9Sstevel@tonic-gate 	    getString("Principals") && prin == null)
24647c478bd9Sstevel@tonic-gate 	    fillPrincipalList(curPrPattern);
24657c478bd9Sstevel@tonic-gate         // Load policy list if we are in the policy tab and are not
24667c478bd9Sstevel@tonic-gate         // editing a policy
24677c478bd9Sstevel@tonic-gate         if (gui.tabbedfolder1.get("currentCard" /* NO18N */) ==
24687c478bd9Sstevel@tonic-gate 	    getString("Policies") && pol == null)
24697c478bd9Sstevel@tonic-gate 	    fillPolicyList(curPoPattern);
24707c478bd9Sstevel@tonic-gate     }
24717c478bd9Sstevel@tonic-gate 
24727c478bd9Sstevel@tonic-gate     /**
24737c478bd9Sstevel@tonic-gate      * This is a way for the data modification actions to note that
24747c478bd9Sstevel@tonic-gate      * the principal has edits outstanding.
24757c478bd9Sstevel@tonic-gate      *
24767c478bd9Sstevel@tonic-gate      */
glSetNeedSave()24777c478bd9Sstevel@tonic-gate     public void glSetNeedSave() {
24787c478bd9Sstevel@tonic-gate         glNeedSave = true;
24797c478bd9Sstevel@tonic-gate         glSetCanSave(true);
24807c478bd9Sstevel@tonic-gate     }
24817c478bd9Sstevel@tonic-gate 
24827c478bd9Sstevel@tonic-gate     /**
24837c478bd9Sstevel@tonic-gate      * Make the Save button do the right thing.
24847c478bd9Sstevel@tonic-gate      *
24857c478bd9Sstevel@tonic-gate      */
glSetCanSave(boolean ok)24867c478bd9Sstevel@tonic-gate     public void glSetCanSave(boolean ok) {
24877c478bd9Sstevel@tonic-gate         defaults.saveButton.setEnabled(ok);
24887c478bd9Sstevel@tonic-gate         defaults.applyButton.setEnabled(ok);
24897c478bd9Sstevel@tonic-gate     }
24907c478bd9Sstevel@tonic-gate 
setGlobalMaxrenew()24917c478bd9Sstevel@tonic-gate     public boolean setGlobalMaxrenew() {
24927c478bd9Sstevel@tonic-gate         boolean done = defaults.setMaxTicketRenewableLife();
24937c478bd9Sstevel@tonic-gate         glSetNeedSave();
24947c478bd9Sstevel@tonic-gate         return done;
24957c478bd9Sstevel@tonic-gate     }
24967c478bd9Sstevel@tonic-gate 
setGlobalMaxlife()24977c478bd9Sstevel@tonic-gate     public boolean setGlobalMaxlife() {
24987c478bd9Sstevel@tonic-gate         boolean done = defaults.setMaxTicketLife();
24997c478bd9Sstevel@tonic-gate         glSetNeedSave();
25007c478bd9Sstevel@tonic-gate         return done;
25017c478bd9Sstevel@tonic-gate     }
25027c478bd9Sstevel@tonic-gate 
setGlobalExpiry()25037c478bd9Sstevel@tonic-gate     public boolean setGlobalExpiry() {
25047c478bd9Sstevel@tonic-gate         boolean done = defaults.setAccountExpiryDate();
25057c478bd9Sstevel@tonic-gate         glSetNeedSave();
25067c478bd9Sstevel@tonic-gate         return done;
25077c478bd9Sstevel@tonic-gate     }
25087c478bd9Sstevel@tonic-gate 
setServerSide()25097c478bd9Sstevel@tonic-gate     public boolean setServerSide() {
25107c478bd9Sstevel@tonic-gate         boolean done = defaults.setServerSide();
25117c478bd9Sstevel@tonic-gate         glSetNeedSave();
25127c478bd9Sstevel@tonic-gate         return done;
25137c478bd9Sstevel@tonic-gate     }
25147c478bd9Sstevel@tonic-gate 
setShowLists()25157c478bd9Sstevel@tonic-gate     public boolean setShowLists() {
25167c478bd9Sstevel@tonic-gate         boolean done = defaults.setShowLists();
25177c478bd9Sstevel@tonic-gate         glSetNeedSave();
25187c478bd9Sstevel@tonic-gate         return done;
25197c478bd9Sstevel@tonic-gate     }
25207c478bd9Sstevel@tonic-gate 
setStaticLists()25217c478bd9Sstevel@tonic-gate     public boolean setStaticLists() {
25227c478bd9Sstevel@tonic-gate         boolean done = defaults.setStaticLists();
25237c478bd9Sstevel@tonic-gate         glSetNeedSave();
25247c478bd9Sstevel@tonic-gate         return done;
25257c478bd9Sstevel@tonic-gate     }
25267c478bd9Sstevel@tonic-gate 
setCacheTime()25277c478bd9Sstevel@tonic-gate     public boolean setCacheTime() {
25287c478bd9Sstevel@tonic-gate         boolean done = defaults.setCacheTime();
25297c478bd9Sstevel@tonic-gate         glSetNeedSave();
25307c478bd9Sstevel@tonic-gate         return done;
25317c478bd9Sstevel@tonic-gate     }
25327c478bd9Sstevel@tonic-gate 
setGlobalFlag(int bitfield)25337c478bd9Sstevel@tonic-gate     public void setGlobalFlag(int bitfield) {
25347c478bd9Sstevel@tonic-gate         defaults.toggleFlag(bitfield);
25357c478bd9Sstevel@tonic-gate         glSetNeedSave();
25367c478bd9Sstevel@tonic-gate     }
25377c478bd9Sstevel@tonic-gate 
25387c478bd9Sstevel@tonic-gate     /*
25397c478bd9Sstevel@tonic-gate      * Miscellany
25407c478bd9Sstevel@tonic-gate      */
printPrList()25417c478bd9Sstevel@tonic-gate     public void printPrList() {
25427c478bd9Sstevel@tonic-gate         String title = getString("Principal List");
25437c478bd9Sstevel@tonic-gate         if (curPrPattern.length() > 0)
25447c478bd9Sstevel@tonic-gate             title = title.concat(" (" + getString("Filter Pattern:") + " "
25457c478bd9Sstevel@tonic-gate 				 + curPrPattern + ")");
25467c478bd9Sstevel@tonic-gate         if (principalList == null)
25477c478bd9Sstevel@tonic-gate             fillPrincipalList(curPrPattern);
25487c478bd9Sstevel@tonic-gate         printList((TextList)gui.Prlist.getBody(), title);
25497c478bd9Sstevel@tonic-gate     }
25507c478bd9Sstevel@tonic-gate 
printCurPr()25517c478bd9Sstevel@tonic-gate     public void printCurPr() {
25527c478bd9Sstevel@tonic-gate         Principal toPrint;
25537c478bd9Sstevel@tonic-gate 
25547c478bd9Sstevel@tonic-gate         if (prin == null) {
25557c478bd9Sstevel@tonic-gate             // We are viewing the principal list. Instantiate a new
25567c478bd9Sstevel@tonic-gate             // principal using the current name.
25577c478bd9Sstevel@tonic-gate             toPrint =  new Principal(Kadmin, CurPrincipal);
25587c478bd9Sstevel@tonic-gate         } else {
25597c478bd9Sstevel@tonic-gate             // We are in the middle of editing a principal. Update the
25607c478bd9Sstevel@tonic-gate             // current principal object with the current contents of the
25617c478bd9Sstevel@tonic-gate             // gui. It's ok for the password to be null, we are not printing
25627c478bd9Sstevel@tonic-gate             // it anyway.
25637c478bd9Sstevel@tonic-gate             if (!prUpdateFromGui(true))
25647c478bd9Sstevel@tonic-gate                 return;
25657c478bd9Sstevel@tonic-gate             toPrint = prin;
25667c478bd9Sstevel@tonic-gate         }
25677c478bd9Sstevel@tonic-gate 
25687c478bd9Sstevel@tonic-gate         PrintUtil.dump(realMainFrame, toPrint);
25697c478bd9Sstevel@tonic-gate     }
25707c478bd9Sstevel@tonic-gate 
printPoList()25717c478bd9Sstevel@tonic-gate     public void printPoList() {
25727c478bd9Sstevel@tonic-gate         String title = getString("Policy List");
25737c478bd9Sstevel@tonic-gate         if (curPoPattern.length() > 0)
25747c478bd9Sstevel@tonic-gate             title = title.concat(" (" + getString("Filter Pattern:") + " "
25757c478bd9Sstevel@tonic-gate 				 + curPoPattern + ")");
25767c478bd9Sstevel@tonic-gate         if (policyList == null)
25777c478bd9Sstevel@tonic-gate             fillPolicyList(curPoPattern);
25787c478bd9Sstevel@tonic-gate         printList((TextList)gui.Pollist.getBody(), title);
25797c478bd9Sstevel@tonic-gate     }
25807c478bd9Sstevel@tonic-gate 
printCurPol()25817c478bd9Sstevel@tonic-gate     public void printCurPol() {
25827c478bd9Sstevel@tonic-gate         Policy toPrint;
25837c478bd9Sstevel@tonic-gate 
25847c478bd9Sstevel@tonic-gate         if (pol == null) {
25857c478bd9Sstevel@tonic-gate             // We are viewing the policy list. Instantiate a new
25867c478bd9Sstevel@tonic-gate             // policy using the current name.
25877c478bd9Sstevel@tonic-gate             toPrint = new Policy(Kadmin, CurPolicy);
25887c478bd9Sstevel@tonic-gate         } else {
25897c478bd9Sstevel@tonic-gate             // We are in the middle of editing a policy. Update the current
25907c478bd9Sstevel@tonic-gate             // policy object with the current contents of the gui.
25917c478bd9Sstevel@tonic-gate             if (!poUpdateFromGui())
25927c478bd9Sstevel@tonic-gate                 return;
25937c478bd9Sstevel@tonic-gate             toPrint = pol;
25947c478bd9Sstevel@tonic-gate         }
25957c478bd9Sstevel@tonic-gate 
25967c478bd9Sstevel@tonic-gate         PrintUtil.dump(realMainFrame, toPrint);
25977c478bd9Sstevel@tonic-gate 
25987c478bd9Sstevel@tonic-gate     }
25997c478bd9Sstevel@tonic-gate 
printList(TextList guiList, String title)26007c478bd9Sstevel@tonic-gate     private void printList(TextList guiList, String title) {
26017c478bd9Sstevel@tonic-gate         String[] list = getItemsFromTextList(guiList);
26027c478bd9Sstevel@tonic-gate         StringBuffer sb = new StringBuffer(title).append('\n');
26037c478bd9Sstevel@tonic-gate 
26047c478bd9Sstevel@tonic-gate         for (int i = 0; i < list.length; i++) {
26057c478bd9Sstevel@tonic-gate             sb.append(list[i]).append('\n');
26067c478bd9Sstevel@tonic-gate         }
26077c478bd9Sstevel@tonic-gate 
26087c478bd9Sstevel@tonic-gate         PrintUtil.dump(realMainFrame, sb);
26097c478bd9Sstevel@tonic-gate     }
26107c478bd9Sstevel@tonic-gate 
showHelpBrowser(Frame frame)26117c478bd9Sstevel@tonic-gate     public void showHelpBrowser(Frame frame) {
26127c478bd9Sstevel@tonic-gate         try {
26137c478bd9Sstevel@tonic-gate 
26147c478bd9Sstevel@tonic-gate             File file = new File("/usr/dt/bin/sdtwebclient");
26157c478bd9Sstevel@tonic-gate             if (!file.exists()) {
26167c478bd9Sstevel@tonic-gate                 showDialog(frame, getString("Error"),
26177c478bd9Sstevel@tonic-gate 			   getString("Can't run /usr/dt/bin/sdtwebclient."));
26187c478bd9Sstevel@tonic-gate                 return;
26197c478bd9Sstevel@tonic-gate             }
26207c478bd9Sstevel@tonic-gate             String url = kc.getHelpURL();
26217c478bd9Sstevel@tonic-gate             if (url == null)
26227c478bd9Sstevel@tonic-gate                 url = helpIndexFile;
26237c478bd9Sstevel@tonic-gate             URL help = new URL(url);
26247c478bd9Sstevel@tonic-gate             InputStream is = null;
26257c478bd9Sstevel@tonic-gate             try {
26267c478bd9Sstevel@tonic-gate                 is = help.openStream();
26277c478bd9Sstevel@tonic-gate             } catch (IOException e) {}
26287c478bd9Sstevel@tonic-gate             if (is == null) {
26297c478bd9Sstevel@tonic-gate                 showDialog(frame, getString("Error"),
26307c478bd9Sstevel@tonic-gate 			   getString("Invalid URL: ")+url);
26317c478bd9Sstevel@tonic-gate                 return;
26327c478bd9Sstevel@tonic-gate             }
26337c478bd9Sstevel@tonic-gate 
26347c478bd9Sstevel@tonic-gate             if (browserProcess != null) {
26357c478bd9Sstevel@tonic-gate                 // Will throw IllegalThreadStateException if thread not exited
26367c478bd9Sstevel@tonic-gate                 // yet
26377c478bd9Sstevel@tonic-gate                 int i = browserProcess.exitValue();
26387c478bd9Sstevel@tonic-gate             }
26397c478bd9Sstevel@tonic-gate 
26407c478bd9Sstevel@tonic-gate             // Thread has exited or never existed
26417c478bd9Sstevel@tonic-gate             browserProcess =
26427c478bd9Sstevel@tonic-gate 		Runtime.getRuntime().exec("/usr/dt/bin/sdtwebclient" +url);
26437c478bd9Sstevel@tonic-gate 
26447c478bd9Sstevel@tonic-gate         } catch (IOException e) {
26457c478bd9Sstevel@tonic-gate             showDialog(frame, getString("Error"), e.getMessage());
26467c478bd9Sstevel@tonic-gate         } catch (IllegalThreadStateException e) {
26477c478bd9Sstevel@tonic-gate             // Ok. All this mean is that a previous instance of the browser
26487c478bd9Sstevel@tonic-gate             // exists
26497c478bd9Sstevel@tonic-gate         }
26507c478bd9Sstevel@tonic-gate     }
26517c478bd9Sstevel@tonic-gate 
killHelpBrowser()26527c478bd9Sstevel@tonic-gate     private void killHelpBrowser() {
26537c478bd9Sstevel@tonic-gate         if (browserProcess != null) {
26547c478bd9Sstevel@tonic-gate             browserProcess.destroy();
26557c478bd9Sstevel@tonic-gate         }
26567c478bd9Sstevel@tonic-gate     }
26577c478bd9Sstevel@tonic-gate 
setupDefaultsEditingFrame()26587c478bd9Sstevel@tonic-gate     private void setupDefaultsEditingFrame() {
26597c478bd9Sstevel@tonic-gate         defaultsEditingFrame = defaults.getEditingFrame();
26607c478bd9Sstevel@tonic-gate         glSetCanSave(false);
26617c478bd9Sstevel@tonic-gate         setupDefaultsNormalListeners();
26627c478bd9Sstevel@tonic-gate         defaults.csHelp.addActionListener
26637c478bd9Sstevel@tonic-gate 	    (new DefaultsContextSensitiveHelpListener());
26647c478bd9Sstevel@tonic-gate     }
26657c478bd9Sstevel@tonic-gate 
editPreferences()26667c478bd9Sstevel@tonic-gate     public void editPreferences() {
26677c478bd9Sstevel@tonic-gate         olddefaults = new Defaults(defaults);
26687c478bd9Sstevel@tonic-gate         defaults.updateGuiComponents();
26697c478bd9Sstevel@tonic-gate         defaultsEditingFrame.setVisible(true);
26707c478bd9Sstevel@tonic-gate     }
26717c478bd9Sstevel@tonic-gate 
getFrame(Component c)26727c478bd9Sstevel@tonic-gate     static Frame getFrame(Component c) {
26737c478bd9Sstevel@tonic-gate         Frame frame = null;
26747c478bd9Sstevel@tonic-gate 
26757c478bd9Sstevel@tonic-gate         while ((c = c.getParent()) != null)
26767c478bd9Sstevel@tonic-gate             if (c instanceof Frame)
26777c478bd9Sstevel@tonic-gate 		frame = (Frame)c;
26787c478bd9Sstevel@tonic-gate         return frame;
26797c478bd9Sstevel@tonic-gate     }
26807c478bd9Sstevel@tonic-gate 
26817c478bd9Sstevel@tonic-gate     /**
26827c478bd9Sstevel@tonic-gate      * General purpose dialog with title and a label settable
26837c478bd9Sstevel@tonic-gate      */
showDialog(Frame frame, String title, String text)26847c478bd9Sstevel@tonic-gate     public void showDialog(Frame frame, String title, String text) {
26857c478bd9Sstevel@tonic-gate         String[] lines = new String[1];
26867c478bd9Sstevel@tonic-gate         lines[0] = text;
26877c478bd9Sstevel@tonic-gate         String[] buttons = new String[1];
26887c478bd9Sstevel@tonic-gate         buttons[0] = getString("OK");
26897c478bd9Sstevel@tonic-gate         ChoiceDialog cd = new ChoiceDialog(frame, title, lines, buttons);
26907c478bd9Sstevel@tonic-gate     }
26917c478bd9Sstevel@tonic-gate 
showLoginWarning(String err)26927c478bd9Sstevel@tonic-gate     public void showLoginWarning(String err) {
26937c478bd9Sstevel@tonic-gate         showDialog(realLoginFrame, getString("Warning"), err);
26947c478bd9Sstevel@tonic-gate     }
26957c478bd9Sstevel@tonic-gate 
showLoginError(String err)26967c478bd9Sstevel@tonic-gate     public void showLoginError(String err) {
26977c478bd9Sstevel@tonic-gate         showDialog(realLoginFrame, getString("Error"), err);
26987c478bd9Sstevel@tonic-gate     }
26997c478bd9Sstevel@tonic-gate 
showWarning(String err)27007c478bd9Sstevel@tonic-gate     public void showWarning(String err) {
27017c478bd9Sstevel@tonic-gate         showDialog(realMainFrame, getString("Warning"), err);
27027c478bd9Sstevel@tonic-gate     }
27037c478bd9Sstevel@tonic-gate 
showError(String err)27047c478bd9Sstevel@tonic-gate     public void showError(String err) {
27057c478bd9Sstevel@tonic-gate         showDialog(realMainFrame, getString("Error"), err);
27067c478bd9Sstevel@tonic-gate     }
27077c478bd9Sstevel@tonic-gate 
showDataFormatError(TextField tf, int dataType)27087c478bd9Sstevel@tonic-gate     public static void showDataFormatError(TextField tf, int dataType) {
27097c478bd9Sstevel@tonic-gate 
27107c478bd9Sstevel@tonic-gate         Frame parent = getFrame(tf);
27117c478bd9Sstevel@tonic-gate 
27127c478bd9Sstevel@tonic-gate         tf.selectAll();
27137c478bd9Sstevel@tonic-gate         toolkit.beep();
27147c478bd9Sstevel@tonic-gate 
27157c478bd9Sstevel@tonic-gate         String title = getString("Error");
27167c478bd9Sstevel@tonic-gate 
27177c478bd9Sstevel@tonic-gate         String[] lines = null;
27187c478bd9Sstevel@tonic-gate         String[] buttons = {getString("OK")};
27197c478bd9Sstevel@tonic-gate 
27207c478bd9Sstevel@tonic-gate         switch (dataType) {
27217c478bd9Sstevel@tonic-gate 	case DURATION_DATA:
27227c478bd9Sstevel@tonic-gate             lines = durationErrorText;
27237c478bd9Sstevel@tonic-gate             break;
27247c478bd9Sstevel@tonic-gate 	case DATE_DATA:
27257c478bd9Sstevel@tonic-gate             lines = dateErrorText;
27267c478bd9Sstevel@tonic-gate             break;
27277c478bd9Sstevel@tonic-gate 	case NUMBER_DATA:
27287c478bd9Sstevel@tonic-gate             lines = numberErrorText;
27297c478bd9Sstevel@tonic-gate             break;
27307c478bd9Sstevel@tonic-gate         }
27317c478bd9Sstevel@tonic-gate 
27327c478bd9Sstevel@tonic-gate         Point p = tf.getLocationOnScreen();
27337c478bd9Sstevel@tonic-gate         ChoiceDialog cd = new ChoiceDialog(parent, title, lines,
27347c478bd9Sstevel@tonic-gate 					   buttons, p.x, p.y);
27357c478bd9Sstevel@tonic-gate 
27367c478bd9Sstevel@tonic-gate         tf.requestFocus();
27377c478bd9Sstevel@tonic-gate 
27387c478bd9Sstevel@tonic-gate     }
27397c478bd9Sstevel@tonic-gate 
27407c478bd9Sstevel@tonic-gate     /**
27417c478bd9Sstevel@tonic-gate      * Confirm a destructive user action
27427c478bd9Sstevel@tonic-gate      */
confirmAction(Frame frame, String[] text)27437c478bd9Sstevel@tonic-gate     public String confirmAction(Frame frame, String[] text) {
27447c478bd9Sstevel@tonic-gate         String title = getString("Confirm Action");
27457c478bd9Sstevel@tonic-gate         String[] buttons = new String[2];
27467c478bd9Sstevel@tonic-gate         buttons[0] = getString("OK");
27477c478bd9Sstevel@tonic-gate         buttons[1] = getString("Cancel");
27487c478bd9Sstevel@tonic-gate         ChoiceDialog cd = new ChoiceDialog(frame, title, text, buttons);
27497c478bd9Sstevel@tonic-gate         return (cd.getSelection() == null? getString("Cancel")
27507c478bd9Sstevel@tonic-gate 		:cd.getSelection());
27517c478bd9Sstevel@tonic-gate     }
27527c478bd9Sstevel@tonic-gate 
27537c478bd9Sstevel@tonic-gate     /**
27547c478bd9Sstevel@tonic-gate      * Confirm a destructive user action, offering choice of saving
27557c478bd9Sstevel@tonic-gate      */
confirmSave(Frame frame, String[] text)27567c478bd9Sstevel@tonic-gate     public String confirmSave(Frame frame, String[] text) {
27577c478bd9Sstevel@tonic-gate         String title = getString("Confirm Action");
27587c478bd9Sstevel@tonic-gate         String[] buttons = new String[3];
27597c478bd9Sstevel@tonic-gate         buttons[0] = getString("Save");
27607c478bd9Sstevel@tonic-gate         buttons[1] = getString("Discard");
27617c478bd9Sstevel@tonic-gate         buttons[2] = getString("Cancel");
27627c478bd9Sstevel@tonic-gate         ChoiceDialog cd = new ChoiceDialog(frame, title, text, buttons);
27637c478bd9Sstevel@tonic-gate         return (cd.getSelection() == null? getString("Cancel")
27647c478bd9Sstevel@tonic-gate 		: cd.getSelection());
27657c478bd9Sstevel@tonic-gate     }
27667c478bd9Sstevel@tonic-gate 
27677c478bd9Sstevel@tonic-gate     /**
27687c478bd9Sstevel@tonic-gate      * Show version info
27697c478bd9Sstevel@tonic-gate      */
doAbout(Frame frame)27707c478bd9Sstevel@tonic-gate     public void doAbout(Frame frame) {
27717c478bd9Sstevel@tonic-gate         String title = getString("About SEAM Adminstration Tool");
27727c478bd9Sstevel@tonic-gate         String[] text = new String[7];
27737c478bd9Sstevel@tonic-gate         text[0] = getString("Sun Enterprise Authentication"
27747c478bd9Sstevel@tonic-gate 			    +" Mechanism Administration Tool");
27757c478bd9Sstevel@tonic-gate         text[1] = System.getProperty("SEAM_VERS" /* NOI18N */);
277645526e97Ssemery         text[2] = getString("Copyright 2005 Sun Microsystems, Inc.  "
277745526e97Ssemery 				+"All rights reserved.");
277845526e97Ssemery         text[3] = getString("Use is subject to license terms.");
27797c478bd9Sstevel@tonic-gate         text[4] = System.getProperty("os.name" /* NOI18N */);
27807c478bd9Sstevel@tonic-gate         text[5] = System.getProperty("os.arch" /* NOI18N */);
27817c478bd9Sstevel@tonic-gate         text[6] = System.getProperty("os.version" /* NOI18N */);
27827c478bd9Sstevel@tonic-gate         String[] button = new String[1];
27837c478bd9Sstevel@tonic-gate         button[0] = getString("Dismiss");
27847c478bd9Sstevel@tonic-gate         ChoiceDialog cd = new ChoiceDialog(frame, title, text, button);
27857c478bd9Sstevel@tonic-gate     }
27867c478bd9Sstevel@tonic-gate 
getDateTimeFromDialogBox(TextField tf, Frame frame)27877c478bd9Sstevel@tonic-gate     private void getDateTimeFromDialogBox(TextField tf, Frame frame) {
27887c478bd9Sstevel@tonic-gate         tf.select(0, 0);
27897c478bd9Sstevel@tonic-gate         dateTimeDialog = new DateTimeDialog(frame, tf.getBackground(),
27907c478bd9Sstevel@tonic-gate 					    tf.getForeground());
27917c478bd9Sstevel@tonic-gate 
27927c478bd9Sstevel@tonic-gate         if (!tf.getText().equalsIgnoreCase(neverString)) {
27937c478bd9Sstevel@tonic-gate             try {
27947c478bd9Sstevel@tonic-gate                 Date currVal = df.parse(tf.getText());
27957c478bd9Sstevel@tonic-gate                 dateTimeDialog.setDate(currVal);
27967c478bd9Sstevel@tonic-gate                 /*
27977c478bd9Sstevel@tonic-gate                  * In case an exception occurs, let the dialog box be
27987c478bd9Sstevel@tonic-gate                  * initialized to its default date (viz current time).
27997c478bd9Sstevel@tonic-gate                  */
28007c478bd9Sstevel@tonic-gate             } catch (ParseException e) {
28017c478bd9Sstevel@tonic-gate             } catch (NullPointerException e) {
28027c478bd9Sstevel@tonic-gate                 // gets thrown when parse string begins with text
28037c478bd9Sstevel@tonic-gate                 // probable JDK bug
28047c478bd9Sstevel@tonic-gate             }
28057c478bd9Sstevel@tonic-gate             catch (StringIndexOutOfBoundsException e) {
28067c478bd9Sstevel@tonic-gate                 // gets thrown when parse string contains only one number
28077c478bd9Sstevel@tonic-gate                 // probable JDK bug
28087c478bd9Sstevel@tonic-gate             }
28097c478bd9Sstevel@tonic-gate         }
28107c478bd9Sstevel@tonic-gate         dateTimeDialog.setVisible(true);
28117c478bd9Sstevel@tonic-gate 
28127c478bd9Sstevel@tonic-gate         // Modal dialog box so this is after dialog box disappers
28137c478bd9Sstevel@tonic-gate         if (dateTimeDialog.isSaved()) {
28147c478bd9Sstevel@tonic-gate             tf.setText(dateTimeDialog.toString());
28157c478bd9Sstevel@tonic-gate             tf.dispatchEvent(new ActionEvent(tf, ActionEvent.ACTION_PERFORMED,
28167c478bd9Sstevel@tonic-gate 				     "setFromDateTimeDialog" /* NOI18N */));
28177c478bd9Sstevel@tonic-gate         }
28187c478bd9Sstevel@tonic-gate     }
28197c478bd9Sstevel@tonic-gate 
getDurationFromDialogBox(TextField tf, Frame frame)28207c478bd9Sstevel@tonic-gate     private void getDurationFromDialogBox(TextField tf, Frame frame) {
28217c478bd9Sstevel@tonic-gate         tf.select(0, 0);
28227c478bd9Sstevel@tonic-gate         durationHelper = new DurationHelper(frame, tf.getBackground(),
28237c478bd9Sstevel@tonic-gate 					    tf.getForeground());
28247c478bd9Sstevel@tonic-gate         durationHelper.setVisible(true);
28257c478bd9Sstevel@tonic-gate 
28267c478bd9Sstevel@tonic-gate         // Modal dialog box so this is after dialog box disappers
28277c478bd9Sstevel@tonic-gate         if (durationHelper.isSaved()) {
28287c478bd9Sstevel@tonic-gate             tf.setText(durationHelper.toString());
28297c478bd9Sstevel@tonic-gate             tf.dispatchEvent(new ActionEvent(tf, ActionEvent.ACTION_PERFORMED,
28307c478bd9Sstevel@tonic-gate 				     "setFromDurationHelper" /* NOI18N */));
28317c478bd9Sstevel@tonic-gate         }
28327c478bd9Sstevel@tonic-gate     }
28337c478bd9Sstevel@tonic-gate 
getEncListFromDialogBox(TextField tf, Frame frame)283445526e97Ssemery     private void getEncListFromDialogBox(TextField tf, Frame frame) {
283545526e97Ssemery 	tf.select(0, 0);
283645526e97Ssemery 	encListDialog = new EncListDialog(frame, tf.getBackground(),
283745526e97Ssemery 	    tf.getForeground(), Kadmin);
283845526e97Ssemery 
283945526e97Ssemery 	encListDialog.setEncTypes(tf.getText());
284045526e97Ssemery 	encListDialog.setVisible(true);
284145526e97Ssemery 
284245526e97Ssemery 	// Modal dialog box so this is after dialog box disappers
284345526e97Ssemery 	if (encListDialog.isSaved()) {
284445526e97Ssemery 		String e = encListDialog.toString();
284545526e97Ssemery 
284645526e97Ssemery 		if (e.compareTo("") != 0) {
284745526e97Ssemery 	    	    String p = (String)gui.PrPassword.get("text" /* NOI18N */);
284845526e97Ssemery 
284945526e97Ssemery 		    // In order to change the key encryption type(s) the admin
285045526e97Ssemery 		    // will have to supply a password.
285145526e97Ssemery 	    	    if (p.compareTo("") == 0) {
285245526e97Ssemery 			showWarning(getString(
285345526e97Ssemery 			"If changing the key encryption types then specify a" +
285445526e97Ssemery 			" new password for the principal whose keys are" +
285545526e97Ssemery 			" being changed"));
285645526e97Ssemery 			((TextField)gui.PrPassword.getBody()).requestFocus();
285745526e97Ssemery 	    	    }
285845526e97Ssemery 		}
285945526e97Ssemery 		tf.setText(e);
286045526e97Ssemery 		tf.dispatchEvent(new ActionEvent(tf,
286145526e97Ssemery 		    ActionEvent.ACTION_PERFORMED,
286245526e97Ssemery 		    "setFromEncListDialog" /* NOI18N */));
286345526e97Ssemery 	}
286445526e97Ssemery     }
286545526e97Ssemery 
28667c478bd9Sstevel@tonic-gate     /**
28677c478bd9Sstevel@tonic-gate      * By going into context-sensitive help mode, normal listeners will
28687c478bd9Sstevel@tonic-gate      * be removed and replaced with help listeners, so that help will
28697c478bd9Sstevel@tonic-gate      * be shown for the object.
28707c478bd9Sstevel@tonic-gate      *
28717c478bd9Sstevel@tonic-gate      */
contextHelp(Frame frame)28727c478bd9Sstevel@tonic-gate     public void contextHelp(Frame frame) {
28737c478bd9Sstevel@tonic-gate 
28747c478bd9Sstevel@tonic-gate         if (cHelp == null) {
28757c478bd9Sstevel@tonic-gate             cHelp = new ContextHelp(frame, this);
28767c478bd9Sstevel@tonic-gate             cHelp.setVisible(true);
28777c478bd9Sstevel@tonic-gate         }
28787c478bd9Sstevel@tonic-gate 
28797c478bd9Sstevel@tonic-gate         if (frame == realLoginFrame)
28807c478bd9Sstevel@tonic-gate             setupLoginHelpListeners();
28817c478bd9Sstevel@tonic-gate         else if (frame == realMainFrame)
28827c478bd9Sstevel@tonic-gate             setupMainHelpListeners();
28837c478bd9Sstevel@tonic-gate         else if (frame == defaultsEditingFrame)
28847c478bd9Sstevel@tonic-gate             setupDefaultsHelpListeners();
28857c478bd9Sstevel@tonic-gate 
28867c478bd9Sstevel@tonic-gate         frame.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR));
28877c478bd9Sstevel@tonic-gate     }
28887c478bd9Sstevel@tonic-gate 
28897c478bd9Sstevel@tonic-gate 
28907c478bd9Sstevel@tonic-gate     /**
28917c478bd9Sstevel@tonic-gate      * Enables the print menu for printing principal related info.
28927c478bd9Sstevel@tonic-gate      */
enablePrincipalPrinting()28937c478bd9Sstevel@tonic-gate     private void enablePrincipalPrinting() {
28947c478bd9Sstevel@tonic-gate         ((MenuItem)gui.PrintCurPr.getBody()).setEnabled(true);
28957c478bd9Sstevel@tonic-gate     }
28967c478bd9Sstevel@tonic-gate 
28977c478bd9Sstevel@tonic-gate     /**
28987c478bd9Sstevel@tonic-gate      * Enables the print menu for printing policy related info.
28997c478bd9Sstevel@tonic-gate      */
enablePolicyPrinting()29007c478bd9Sstevel@tonic-gate     private void enablePolicyPrinting() {
29017c478bd9Sstevel@tonic-gate         ((MenuItem)gui.PrintCurPol.getBody()).setEnabled(true);
29027c478bd9Sstevel@tonic-gate     }
29037c478bd9Sstevel@tonic-gate 
29047c478bd9Sstevel@tonic-gate     /**
29057c478bd9Sstevel@tonic-gate      * Disables the print menu for printing principal related info.
29067c478bd9Sstevel@tonic-gate      */
disablePrincipalPrinting()29077c478bd9Sstevel@tonic-gate     private void disablePrincipalPrinting() {
29087c478bd9Sstevel@tonic-gate         ((MenuItem)gui.PrintCurPr.getBody()).setEnabled(false);
29097c478bd9Sstevel@tonic-gate     }
29107c478bd9Sstevel@tonic-gate 
29117c478bd9Sstevel@tonic-gate     /**
29127c478bd9Sstevel@tonic-gate      * Disables the print menu for printing policy related info.
29137c478bd9Sstevel@tonic-gate      */
disablePolicyPrinting()29147c478bd9Sstevel@tonic-gate     private void disablePolicyPrinting() {
29157c478bd9Sstevel@tonic-gate         ((MenuItem)gui.PrintCurPol.getBody()).setEnabled(false);
29167c478bd9Sstevel@tonic-gate     }
29177c478bd9Sstevel@tonic-gate 
29187c478bd9Sstevel@tonic-gate     /**
29197c478bd9Sstevel@tonic-gate      * Set up the listeners for the objects on the login screen in normal mode
29207c478bd9Sstevel@tonic-gate      *
29217c478bd9Sstevel@tonic-gate      */
setupLoginNormalListeners()29227c478bd9Sstevel@tonic-gate     public void setupLoginNormalListeners() {
29237c478bd9Sstevel@tonic-gate         if (LoginNormal == null) {
29247c478bd9Sstevel@tonic-gate             LoginNormal = new Vector(10, 10);
29257c478bd9Sstevel@tonic-gate             ActionListener al;
29267c478bd9Sstevel@tonic-gate             Association a;
29277c478bd9Sstevel@tonic-gate             Object o;
29287c478bd9Sstevel@tonic-gate 
29297c478bd9Sstevel@tonic-gate             al = new LoginNameAction();
29307c478bd9Sstevel@tonic-gate             o = gui.LoginName.getBody();
29317c478bd9Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
29327c478bd9Sstevel@tonic-gate             LoginNormal.addElement(a);
29337c478bd9Sstevel@tonic-gate 
29347c478bd9Sstevel@tonic-gate             al = new LoginPassAction();
29357c478bd9Sstevel@tonic-gate             o = gui.LoginPass.getBody();
29367c478bd9Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
29377c478bd9Sstevel@tonic-gate             LoginNormal.addElement(a);
29387c478bd9Sstevel@tonic-gate 
29397c478bd9Sstevel@tonic-gate             al = new LoginRealmAction();
29407c478bd9Sstevel@tonic-gate             o = gui.LoginRealm.getBody();
29417c478bd9Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
29427c478bd9Sstevel@tonic-gate             LoginNormal.addElement(a);
29437c478bd9Sstevel@tonic-gate 
29447c478bd9Sstevel@tonic-gate             al = new LoginServerAction();
29457c478bd9Sstevel@tonic-gate             o = gui.LoginServer.getBody();
29467c478bd9Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
29477c478bd9Sstevel@tonic-gate             LoginNormal.addElement(a);
29487c478bd9Sstevel@tonic-gate 
29497c478bd9Sstevel@tonic-gate             al = new LoginOKAction();
29507c478bd9Sstevel@tonic-gate             o = gui.LoginOK.getBody();
29517c478bd9Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
29527c478bd9Sstevel@tonic-gate             LoginNormal.addElement(a);
29537c478bd9Sstevel@tonic-gate 
29547c478bd9Sstevel@tonic-gate             al = new LoginStartOverAction();
29557c478bd9Sstevel@tonic-gate             o = gui.LoginStartOver.getBody();
29567c478bd9Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
29577c478bd9Sstevel@tonic-gate             LoginNormal.addElement(a);
29587c478bd9Sstevel@tonic-gate         }
29597c478bd9Sstevel@tonic-gate         setListeners(LoginHelp, false);
29607c478bd9Sstevel@tonic-gate         setListeners(LoginFixers, false);
29617c478bd9Sstevel@tonic-gate         setListeners(LoginNormal, true);
29627c478bd9Sstevel@tonic-gate         loginHelpMode = false;
29637c478bd9Sstevel@tonic-gate     }
29647c478bd9Sstevel@tonic-gate 
29657c478bd9Sstevel@tonic-gate     /**
29667c478bd9Sstevel@tonic-gate      * Set up the listeners for the objects on the login screen in help mode
29677c478bd9Sstevel@tonic-gate      *
29687c478bd9Sstevel@tonic-gate      */
setupLoginHelpListeners()29697c478bd9Sstevel@tonic-gate     public void setupLoginHelpListeners() {
29707c478bd9Sstevel@tonic-gate         if (LoginHelp == null) {
29717c478bd9Sstevel@tonic-gate             LoginHelp = new Vector(10, 10);
29727c478bd9Sstevel@tonic-gate             MouseListener ml = new HelpListener();
29737c478bd9Sstevel@tonic-gate             Association a;
29747c478bd9Sstevel@tonic-gate             Object o;
29757c478bd9Sstevel@tonic-gate 
29767c478bd9Sstevel@tonic-gate             o = gui.LoginName.getBody();
29777c478bd9Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
29787c478bd9Sstevel@tonic-gate             LoginHelp.addElement(a);
29797c478bd9Sstevel@tonic-gate             ((TextField)o).setName("LoginName" /* NOI18N */);
29807c478bd9Sstevel@tonic-gate 
29817c478bd9Sstevel@tonic-gate             o = gui.LoginNameLabel.getBody();
29827c478bd9Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
29837c478bd9Sstevel@tonic-gate             LoginHelp.addElement(a);
29847c478bd9Sstevel@tonic-gate             ((Label)o).setName("LoginName" /* NOI18N */);
29857c478bd9Sstevel@tonic-gate 
29867c478bd9Sstevel@tonic-gate             o = gui.LoginPass.getBody();
29877c478bd9Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
29887c478bd9Sstevel@tonic-gate             LoginHelp.addElement(a);
29897c478bd9Sstevel@tonic-gate             ((TextField)o).setName("LoginPass" /* NOI18N */);
29907c478bd9Sstevel@tonic-gate 
29917c478bd9Sstevel@tonic-gate             o = gui.LoginPassLabel.getBody();
29927c478bd9Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
29937c478bd9Sstevel@tonic-gate             LoginHelp.addElement(a);
29947c478bd9Sstevel@tonic-gate             ((Label)o).setName("LoginPass" /* NOI18N */);
29957c478bd9Sstevel@tonic-gate 
29967c478bd9Sstevel@tonic-gate             o = gui.LoginRealm.getBody();
29977c478bd9Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
29987c478bd9Sstevel@tonic-gate             LoginHelp.addElement(a);
29997c478bd9Sstevel@tonic-gate             ((TextField)o).setName("LoginRealm" /* NOI18N */);
30007c478bd9Sstevel@tonic-gate 
30017c478bd9Sstevel@tonic-gate             o = gui.LoginRealmLabel.getBody();
30027c478bd9Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
30037c478bd9Sstevel@tonic-gate             LoginHelp.addElement(a);
30047c478bd9Sstevel@tonic-gate             ((Label)o).setName("LoginRealm" /* NOI18N */);
30057c478bd9Sstevel@tonic-gate 
30067c478bd9Sstevel@tonic-gate             o = gui.LoginServer.getBody();
30077c478bd9Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
30087c478bd9Sstevel@tonic-gate             LoginHelp.addElement(a);
30097c478bd9Sstevel@tonic-gate             ((TextField)o).setName("LoginServer" /* NOI18N */);
30107c478bd9Sstevel@tonic-gate 
30117c478bd9Sstevel@tonic-gate             o = gui.LoginServerLabel.getBody();
30127c478bd9Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
30137c478bd9Sstevel@tonic-gate             LoginHelp.addElement(a);
30147c478bd9Sstevel@tonic-gate             ((Label)o).setName("LoginServer" /* NOI18N */);
30157c478bd9Sstevel@tonic-gate 
30167c478bd9Sstevel@tonic-gate             o = gui.LoginOK.getBody();
30177c478bd9Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
30187c478bd9Sstevel@tonic-gate             LoginHelp.addElement(a);
30197c478bd9Sstevel@tonic-gate             ((Button)o).setName("LoginOK" /* NOI18N */);
30207c478bd9Sstevel@tonic-gate 
30217c478bd9Sstevel@tonic-gate             o = gui.LoginStartOver.getBody();
30227c478bd9Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
30237c478bd9Sstevel@tonic-gate             LoginHelp.addElement(a);
30247c478bd9Sstevel@tonic-gate             ((Button)o).setName("LoginStartOver" /* NOI18N */);
30257c478bd9Sstevel@tonic-gate         }
30267c478bd9Sstevel@tonic-gate         setListeners(LoginNormal, false);
30277c478bd9Sstevel@tonic-gate         setListeners(LoginHelp, true);
30287c478bd9Sstevel@tonic-gate         setupLoginHelpFixers();
30297c478bd9Sstevel@tonic-gate         loginHelpMode = true;
30307c478bd9Sstevel@tonic-gate     }
30317c478bd9Sstevel@tonic-gate 
setupLoginHelpFixers()30327c478bd9Sstevel@tonic-gate     public void setupLoginHelpFixers() {
30337c478bd9Sstevel@tonic-gate         LoginFixers = new Vector(10, 10);
30347c478bd9Sstevel@tonic-gate         Object o;
30357c478bd9Sstevel@tonic-gate         Association a;
30367c478bd9Sstevel@tonic-gate         TextFixer tf;
30377c478bd9Sstevel@tonic-gate 
30387c478bd9Sstevel@tonic-gate         o = gui.LoginName.getBody();
30397c478bd9Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
30407c478bd9Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
30417c478bd9Sstevel@tonic-gate         LoginFixers.addElement(a);
30427c478bd9Sstevel@tonic-gate 
30437c478bd9Sstevel@tonic-gate         o = gui.LoginPass.getBody();
30447c478bd9Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
30457c478bd9Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
30467c478bd9Sstevel@tonic-gate         LoginFixers.addElement(a);
30477c478bd9Sstevel@tonic-gate 
30487c478bd9Sstevel@tonic-gate         o = gui.LoginRealm.getBody();
30497c478bd9Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
30507c478bd9Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
30517c478bd9Sstevel@tonic-gate         LoginFixers.addElement(a);
30527c478bd9Sstevel@tonic-gate 
30537c478bd9Sstevel@tonic-gate         o = gui.LoginServer.getBody();
30547c478bd9Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
30557c478bd9Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
30567c478bd9Sstevel@tonic-gate         LoginFixers.addElement(a);
30577c478bd9Sstevel@tonic-gate 
30587c478bd9Sstevel@tonic-gate         setListeners(LoginFixers, true);
30597c478bd9Sstevel@tonic-gate     }
30607c478bd9Sstevel@tonic-gate 
30617c478bd9Sstevel@tonic-gate     /**
30627c478bd9Sstevel@tonic-gate      * Set up the listeners for the objects on the main screen in normal mode
30637c478bd9Sstevel@tonic-gate      *
30647c478bd9Sstevel@tonic-gate      */
setupMainNormalListeners()30657c478bd9Sstevel@tonic-gate     public void setupMainNormalListeners() {
30667c478bd9Sstevel@tonic-gate         if (MainNormal == null) {
30677c478bd9Sstevel@tonic-gate             Frame fr = realMainFrame;
30687c478bd9Sstevel@tonic-gate             MainNormal = new Vector(10, 10);
30697c478bd9Sstevel@tonic-gate             ActionListener al;
30707c478bd9Sstevel@tonic-gate             ItemListener il;
30717c478bd9Sstevel@tonic-gate             DateTimeListener dtl;
30727c478bd9Sstevel@tonic-gate             DurationListener dl;
307345526e97Ssemery             EncListListener ell;
30747c478bd9Sstevel@tonic-gate             KeyListener kl1 = new KeystrokeDetector(PRINCIPAL_EDITING);
30757c478bd9Sstevel@tonic-gate             KeyListener kl2 = new KeystrokeDetector(POLICY_EDITING);
30767c478bd9Sstevel@tonic-gate             KeyListener kl3 = new KeystrokeDetector(PRINCIPAL_LIST);
30777c478bd9Sstevel@tonic-gate             KeyListener kl4 = new KeystrokeDetector(POLICY_LIST);
30787c478bd9Sstevel@tonic-gate             Association a;
30797c478bd9Sstevel@tonic-gate             Object o;
30807c478bd9Sstevel@tonic-gate 
30817c478bd9Sstevel@tonic-gate             WindowListener wl = new MainWindowCloseAction();
30827c478bd9Sstevel@tonic-gate             o = realMainFrame;
30837c478bd9Sstevel@tonic-gate             a = new Association(o, wl, WINDOW_LISTENER);
30847c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
30857c478bd9Sstevel@tonic-gate 
30867c478bd9Sstevel@tonic-gate             al = new PrListPatternAction();
30877c478bd9Sstevel@tonic-gate             o = gui.PrListPattern.getBody();
30887c478bd9Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
30897c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
30907c478bd9Sstevel@tonic-gate             a = new Association(o, kl3, TEXTFIELD_KEY);
30917c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
30927c478bd9Sstevel@tonic-gate 
30937c478bd9Sstevel@tonic-gate             al = new PrListClearAction();
30947c478bd9Sstevel@tonic-gate             o = gui.PrListClear.getBody();
30957c478bd9Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
30967c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
30977c478bd9Sstevel@tonic-gate 
30987c478bd9Sstevel@tonic-gate             al = new PrListModifyAction();
30997c478bd9Sstevel@tonic-gate             o = gui.PrListModify.getBody();
31007c478bd9Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
31017c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
31027c478bd9Sstevel@tonic-gate 
31037c478bd9Sstevel@tonic-gate             al = new PrListAddAction();
31047c478bd9Sstevel@tonic-gate             o = gui.PrListAdd.getBody();
31057c478bd9Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
31067c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
31077c478bd9Sstevel@tonic-gate 
31087c478bd9Sstevel@tonic-gate             al = new PrListDeleteAction();
31097c478bd9Sstevel@tonic-gate             o = gui.PrListDelete.getBody();
31107c478bd9Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
31117c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
31127c478bd9Sstevel@tonic-gate 
31137c478bd9Sstevel@tonic-gate             al = new PrListDuplicateAction();
31147c478bd9Sstevel@tonic-gate             o = gui.PrListDuplicate.getBody();
31157c478bd9Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
31167c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
31177c478bd9Sstevel@tonic-gate 
31187c478bd9Sstevel@tonic-gate             al = new PrSaveAction();
31197c478bd9Sstevel@tonic-gate             o = gui.PrBasicSave.getBody();
31207c478bd9Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
31217c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
31227c478bd9Sstevel@tonic-gate             o = gui.PrDetailSave.getBody();
31237c478bd9Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
31247c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
31257c478bd9Sstevel@tonic-gate             o = gui.PrFlagsSave.getBody();
31267c478bd9Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
31277c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
31287c478bd9Sstevel@tonic-gate 
31297c478bd9Sstevel@tonic-gate             al = new PrCancelAction();
31307c478bd9Sstevel@tonic-gate             o = gui.PrBasicCancel.getBody();
31317c478bd9Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
31327c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
31337c478bd9Sstevel@tonic-gate             o = gui.PrDetailCancel.getBody();
31347c478bd9Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
31357c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
31367c478bd9Sstevel@tonic-gate             o = gui.PrFlagsCancel.getBody();
31377c478bd9Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
31387c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
31397c478bd9Sstevel@tonic-gate 
31407c478bd9Sstevel@tonic-gate             al = new PrCommentsAction();
31417c478bd9Sstevel@tonic-gate             o = gui.PrComments.getBody();
31427c478bd9Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
31437c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
31447c478bd9Sstevel@tonic-gate             a = new Association(o, kl1, TEXTFIELD_KEY);
31457c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
31467c478bd9Sstevel@tonic-gate 
31477c478bd9Sstevel@tonic-gate             il = new PrPolicyAction();
31487c478bd9Sstevel@tonic-gate             o = gui.PrPolicy.getBody();
31497c478bd9Sstevel@tonic-gate             a = new Association(o, il, CHOICE_ITEM);
31507c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
31517c478bd9Sstevel@tonic-gate 
31527c478bd9Sstevel@tonic-gate             al = new PrPasswordAction();
31537c478bd9Sstevel@tonic-gate             o = gui.PrPassword.getBody();
31547c478bd9Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
31557c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
31567c478bd9Sstevel@tonic-gate             a = new Association(o, kl1, TEXTFIELD_KEY);
31577c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
31587c478bd9Sstevel@tonic-gate 
31597c478bd9Sstevel@tonic-gate             al = new PrRandomPwAction();
31607c478bd9Sstevel@tonic-gate             o = gui.PrBasicRandomPw.getBody();
31617c478bd9Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
31627c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
31637c478bd9Sstevel@tonic-gate 
316445526e97Ssemery             al = new EncListAction();
316545526e97Ssemery             o = gui.EncList.getBody();
316645526e97Ssemery             a = new Association(o, al, TEXTFIELD_ACTION);
316745526e97Ssemery             MainNormal.addElement(a);
316845526e97Ssemery             a = new Association(o, kl1, TEXTFIELD_KEY);
316945526e97Ssemery             MainNormal.addElement(a);
317045526e97Ssemery 
317145526e97Ssemery             ell = new EncListListener((TextField)gui.EncList.getBody(), fr);
317245526e97Ssemery             o = gui.EncListMoreButton.getBody();
317345526e97Ssemery             a = new Association(o, ell, BUTTON_ACTION);
317445526e97Ssemery             MainNormal.addElement(a);
317545526e97Ssemery 
31767c478bd9Sstevel@tonic-gate             al = new PrExpiryAction();
31777c478bd9Sstevel@tonic-gate             o = gui.PrExpiry.getBody();
31787c478bd9Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
31797c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
31807c478bd9Sstevel@tonic-gate             a = new Association(o, kl1, TEXTFIELD_KEY);
31817c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
31827c478bd9Sstevel@tonic-gate 
31837c478bd9Sstevel@tonic-gate             dtl = new DateTimeListener((TextField)gui.PrExpiry.getBody(), fr);
31847c478bd9Sstevel@tonic-gate             o = gui.PrExpiryMoreButton.getBody();
31857c478bd9Sstevel@tonic-gate             a = new Association(o, dtl, BUTTON_ACTION);
31867c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
31877c478bd9Sstevel@tonic-gate 
31887c478bd9Sstevel@tonic-gate             al = new PrBasicPreviousAction();
31897c478bd9Sstevel@tonic-gate             o = gui.PrBasicPrevious.getBody();
31907c478bd9Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
31917c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
31927c478bd9Sstevel@tonic-gate 
31937c478bd9Sstevel@tonic-gate             al = new PrBasicNextAction();
31947c478bd9Sstevel@tonic-gate             o = gui.PrBasicNext.getBody();
31957c478bd9Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
31967c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
31977c478bd9Sstevel@tonic-gate 
31987c478bd9Sstevel@tonic-gate             al = new PrPwExpiryAction();
31997c478bd9Sstevel@tonic-gate             o = gui.PrPwExpiry.getBody();
32007c478bd9Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
32017c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
32027c478bd9Sstevel@tonic-gate             a = new Association(o, kl1, TEXTFIELD_KEY);
32037c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
32047c478bd9Sstevel@tonic-gate 
32057c478bd9Sstevel@tonic-gate             dtl = new DateTimeListener((TextField)gui.PrPwExpiry.getBody(), fr);
32067c478bd9Sstevel@tonic-gate             o = gui.PrPwExpiryMoreButton.getBody();
32077c478bd9Sstevel@tonic-gate             a = new Association(o, dtl, BUTTON_ACTION);
32087c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
32097c478bd9Sstevel@tonic-gate 
32107c478bd9Sstevel@tonic-gate             al = new PrKvnoAction();
32117c478bd9Sstevel@tonic-gate             o = gui.PrKvno.getBody();
32127c478bd9Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
32137c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
32147c478bd9Sstevel@tonic-gate             a = new Association(o, kl1, TEXTFIELD_KEY);
32157c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
32167c478bd9Sstevel@tonic-gate 
32177c478bd9Sstevel@tonic-gate             al = new PrMaxLifetimeAction();
32187c478bd9Sstevel@tonic-gate             o = gui.PrMaxLifetime.getBody();
32197c478bd9Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
32207c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
32217c478bd9Sstevel@tonic-gate             a = new Association(o, kl1, TEXTFIELD_KEY);
32227c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
32237c478bd9Sstevel@tonic-gate 
32247c478bd9Sstevel@tonic-gate             dl = new DurationListener((TextField)gui.PrMaxLifetime.getBody(),
32257c478bd9Sstevel@tonic-gate 				      fr);
32267c478bd9Sstevel@tonic-gate             o = gui.PrMaxLifetimeMoreButton.getBody();
32277c478bd9Sstevel@tonic-gate             a = new Association(o, dl, BUTTON_ACTION);
32287c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
32297c478bd9Sstevel@tonic-gate 
32307c478bd9Sstevel@tonic-gate             al = new PrMaxRenewalAction();
32317c478bd9Sstevel@tonic-gate             o = gui.PrMaxRenewal.getBody();
32327c478bd9Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
32337c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
32347c478bd9Sstevel@tonic-gate             a = new Association(o, kl1, TEXTFIELD_KEY);
32357c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
32367c478bd9Sstevel@tonic-gate 
32377c478bd9Sstevel@tonic-gate             dl = new DurationListener((TextField)gui.PrMaxRenewal.getBody(),
32387c478bd9Sstevel@tonic-gate 				      fr);
32397c478bd9Sstevel@tonic-gate             o = gui.PrMaxRenewalMoreButton.getBody();
32407c478bd9Sstevel@tonic-gate             a = new Association(o, dl, BUTTON_ACTION);
32417c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
32427c478bd9Sstevel@tonic-gate 
32437c478bd9Sstevel@tonic-gate             al = new PrDetailPreviousAction();
32447c478bd9Sstevel@tonic-gate             o = gui.PrDetailPrevious.getBody();
32457c478bd9Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
32467c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
32477c478bd9Sstevel@tonic-gate 
32487c478bd9Sstevel@tonic-gate             al = new PrDetailNextAction();
32497c478bd9Sstevel@tonic-gate             o = gui.PrDetailNext.getBody();
32507c478bd9Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
32517c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
32527c478bd9Sstevel@tonic-gate 
32537c478bd9Sstevel@tonic-gate             al = new PrFlagsPreviousAction();
32547c478bd9Sstevel@tonic-gate             o = gui.PrFlagsPrevious.getBody();
32557c478bd9Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
32567c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
32577c478bd9Sstevel@tonic-gate 
32587c478bd9Sstevel@tonic-gate             al = new PrFlagsNextAction();
32597c478bd9Sstevel@tonic-gate             o = gui.PrFlagsNext.getBody();
32607c478bd9Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
32617c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
32627c478bd9Sstevel@tonic-gate 
32637c478bd9Sstevel@tonic-gate             il = new PrLockAcctAction();
32647c478bd9Sstevel@tonic-gate             o = gui.PrLockAcct.getBody();
32657c478bd9Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
32667c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
32677c478bd9Sstevel@tonic-gate 
32687c478bd9Sstevel@tonic-gate             il = new PrForcePwChangeAction();
32697c478bd9Sstevel@tonic-gate             o = gui.PrForcePwChange.getBody();
32707c478bd9Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
32717c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
32727c478bd9Sstevel@tonic-gate 
32737c478bd9Sstevel@tonic-gate             il = new PrAllowPostdatedAction();
32747c478bd9Sstevel@tonic-gate             o = gui.PrAllowPostdated.getBody();
32757c478bd9Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
32767c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
32777c478bd9Sstevel@tonic-gate 
32787c478bd9Sstevel@tonic-gate             il = new PrAllowForwardableAction();
32797c478bd9Sstevel@tonic-gate             o = gui.PrAllowForwardable.getBody();
32807c478bd9Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
32817c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
32827c478bd9Sstevel@tonic-gate 
32837c478bd9Sstevel@tonic-gate             il = new PrAllowRenewableAction();
32847c478bd9Sstevel@tonic-gate             o = gui.PrAllowRenewable.getBody();
32857c478bd9Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
32867c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
32877c478bd9Sstevel@tonic-gate 
32887c478bd9Sstevel@tonic-gate             il = new PrAllowProxiableAction();
32897c478bd9Sstevel@tonic-gate             o = gui.PrAllowProxiable.getBody();
32907c478bd9Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
32917c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
32927c478bd9Sstevel@tonic-gate 
32937c478bd9Sstevel@tonic-gate             il = new PrAllowSvrAction();
32947c478bd9Sstevel@tonic-gate             o = gui.PrAllowSvr.getBody();
32957c478bd9Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
32967c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
32977c478bd9Sstevel@tonic-gate 
32987c478bd9Sstevel@tonic-gate             il = new PrAllowTGTAction();
32997c478bd9Sstevel@tonic-gate             o = gui.PrAllowTGT.getBody();
33007c478bd9Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
33017c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
33027c478bd9Sstevel@tonic-gate 
33037c478bd9Sstevel@tonic-gate             il = new PrAllowDupAuthAction();
33047c478bd9Sstevel@tonic-gate             o = gui.PrAllowDupAuth.getBody();
33057c478bd9Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
33067c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
33077c478bd9Sstevel@tonic-gate 
33087c478bd9Sstevel@tonic-gate             il = new PrRequirePreAuthAction();
33097c478bd9Sstevel@tonic-gate             o = gui.PrRequirePreAuth.getBody();
33107c478bd9Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
33117c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
33127c478bd9Sstevel@tonic-gate 
33137c478bd9Sstevel@tonic-gate             il = new PrRequireHwPreAuthAction();
33147c478bd9Sstevel@tonic-gate             o = gui.PrRequireHwPreAuth.getBody();
33157c478bd9Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
33167c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
33177c478bd9Sstevel@tonic-gate 
33187c478bd9Sstevel@tonic-gate             al = new PoListPatternAction();
33197c478bd9Sstevel@tonic-gate             o = gui.PoListPattern.getBody();
33207c478bd9Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
33217c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
33227c478bd9Sstevel@tonic-gate             a = new Association(o, kl4, TEXTFIELD_KEY);
33237c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
33247c478bd9Sstevel@tonic-gate 
33257c478bd9Sstevel@tonic-gate             al = new PoListClearAction();
33267c478bd9Sstevel@tonic-gate             o = gui.PoListClear.getBody();
33277c478bd9Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
33287c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
33297c478bd9Sstevel@tonic-gate 
33307c478bd9Sstevel@tonic-gate             al = new PoListModifyAction();
33317c478bd9Sstevel@tonic-gate             o = gui.PoListModify.getBody();
33327c478bd9Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
33337c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
33347c478bd9Sstevel@tonic-gate 
33357c478bd9Sstevel@tonic-gate             al = new PoListAddAction();
33367c478bd9Sstevel@tonic-gate             o = gui.PoListAdd.getBody();
33377c478bd9Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
33387c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
33397c478bd9Sstevel@tonic-gate 
33407c478bd9Sstevel@tonic-gate             al = new PoListDeleteAction();
33417c478bd9Sstevel@tonic-gate             o = gui.PoListDelete.getBody();
33427c478bd9Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
33437c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
33447c478bd9Sstevel@tonic-gate 
33457c478bd9Sstevel@tonic-gate             al = new PoListDuplicateAction();
33467c478bd9Sstevel@tonic-gate             o = gui.PoListDuplicate.getBody();
33477c478bd9Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
33487c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
33497c478bd9Sstevel@tonic-gate 
33507c478bd9Sstevel@tonic-gate             il = new PoMinPwLengthAction();
33517c478bd9Sstevel@tonic-gate             o = gui.PoMinPwLength.getBody();
33527c478bd9Sstevel@tonic-gate             a = new Association(o, il, CHOICE_ITEM);
33537c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
33547c478bd9Sstevel@tonic-gate 
33557c478bd9Sstevel@tonic-gate             il = new PoMinPwClassAction();
33567c478bd9Sstevel@tonic-gate             o = gui.PoMinPwClass.getBody();
33577c478bd9Sstevel@tonic-gate             a = new Association(o, il, CHOICE_ITEM);
33587c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
33597c478bd9Sstevel@tonic-gate 
33607c478bd9Sstevel@tonic-gate             il = new PoSavedPasswordsAction();
33617c478bd9Sstevel@tonic-gate             o = gui.PoSavedPasswords.getBody();
33627c478bd9Sstevel@tonic-gate             a = new Association(o, il, CHOICE_ITEM);
33637c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
33647c478bd9Sstevel@tonic-gate 
33657c478bd9Sstevel@tonic-gate             al = new PoMinTicketLifetimeAction();
33667c478bd9Sstevel@tonic-gate             o = gui.PoMinTicketLifetime.getBody();
33677c478bd9Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
33687c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
33697c478bd9Sstevel@tonic-gate             a = new Association(o, kl2, TEXTFIELD_KEY);
33707c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
33717c478bd9Sstevel@tonic-gate 
33727c478bd9Sstevel@tonic-gate             dl = new DurationListener(
33737c478bd9Sstevel@tonic-gate 			      (TextField)gui.PoMinTicketLifetime.getBody(), fr);
33747c478bd9Sstevel@tonic-gate             o = gui.PoMinTicketLifetimeMoreButton.getBody();
33757c478bd9Sstevel@tonic-gate             a = new Association(o, dl, BUTTON_ACTION);
33767c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
33777c478bd9Sstevel@tonic-gate 
33787c478bd9Sstevel@tonic-gate             al = new PoMaxTicketLifetimeAction();
33797c478bd9Sstevel@tonic-gate             o = gui.PoMaxTicketLifetime.getBody();
33807c478bd9Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
33817c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
33827c478bd9Sstevel@tonic-gate             a = new Association(o, kl2, TEXTFIELD_KEY);
33837c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
33847c478bd9Sstevel@tonic-gate 
33857c478bd9Sstevel@tonic-gate             dl = new DurationListener(
33867c478bd9Sstevel@tonic-gate 			      (TextField)gui.PoMaxTicketLifetime.getBody(), fr);
33877c478bd9Sstevel@tonic-gate             o = gui.PoMaxTicketLifetimeMoreButton.getBody();
33887c478bd9Sstevel@tonic-gate             a = new Association(o, dl, BUTTON_ACTION);
33897c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
33907c478bd9Sstevel@tonic-gate 
33917c478bd9Sstevel@tonic-gate             al = new PoSaveAction();
33927c478bd9Sstevel@tonic-gate             o = gui.PoDetailSave.getBody();
33937c478bd9Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
33947c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
33957c478bd9Sstevel@tonic-gate 
33967c478bd9Sstevel@tonic-gate             al = new PoCancelAction();
33977c478bd9Sstevel@tonic-gate             o = gui.PoDetailCancel.getBody();
33987c478bd9Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
33997c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
34007c478bd9Sstevel@tonic-gate 
34017c478bd9Sstevel@tonic-gate             al = new PoPreviousAction();
34027c478bd9Sstevel@tonic-gate             o = gui.PoDetailPrevious.getBody();
34037c478bd9Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
34047c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
34057c478bd9Sstevel@tonic-gate 
34067c478bd9Sstevel@tonic-gate             al = new PoDoneAction();
34077c478bd9Sstevel@tonic-gate             o = gui.PoDetailDone.getBody();
34087c478bd9Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
34097c478bd9Sstevel@tonic-gate             MainNormal.addElement(a);
34107c478bd9Sstevel@tonic-gate 
34117c478bd9Sstevel@tonic-gate         }
34127c478bd9Sstevel@tonic-gate         setListeners(MainHelp, false);
34137c478bd9Sstevel@tonic-gate         setListeners(MainFixers, false);
34147c478bd9Sstevel@tonic-gate         setListeners(MainNormal, true);
34157c478bd9Sstevel@tonic-gate         mainHelpMode = false;
34167c478bd9Sstevel@tonic-gate     }
34177c478bd9Sstevel@tonic-gate 
34187c478bd9Sstevel@tonic-gate     /**
34197c478bd9Sstevel@tonic-gate      * Set up the listeners for the objects on the main screen in help mode
34207c478bd9Sstevel@tonic-gate      *
34217c478bd9Sstevel@tonic-gate      */
setupMainHelpListeners()34227c478bd9Sstevel@tonic-gate     public void setupMainHelpListeners() {
34237c478bd9Sstevel@tonic-gate         if (MainHelp == null) {
34247c478bd9Sstevel@tonic-gate             MainHelp = new Vector(10, 10);
34257c478bd9Sstevel@tonic-gate             MouseListener ml = new HelpListener();
34267c478bd9Sstevel@tonic-gate             Association a;
34277c478bd9Sstevel@tonic-gate             Object o;
34287c478bd9Sstevel@tonic-gate 
34297c478bd9Sstevel@tonic-gate             o = gui.PrListPattern.getBody();
34307c478bd9Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
34317c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
34327c478bd9Sstevel@tonic-gate             ((TextField)o).setName("PrListPattern" /* NOI18N */);
34337c478bd9Sstevel@tonic-gate 
34347c478bd9Sstevel@tonic-gate             o = gui.PrSearchLab.getBody();
34357c478bd9Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
34367c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
34377c478bd9Sstevel@tonic-gate             ((Label)o).setName("PrListPattern" /* NOI18N */);
34387c478bd9Sstevel@tonic-gate 
34397c478bd9Sstevel@tonic-gate             o = gui.PrListClear.getBody();
34407c478bd9Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
34417c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
34427c478bd9Sstevel@tonic-gate             ((Button)o).setName("PrListClear" /* NOI18N */);
34437c478bd9Sstevel@tonic-gate 
34447c478bd9Sstevel@tonic-gate             o = gui.PrListModify.getBody();
34457c478bd9Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
34467c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
34477c478bd9Sstevel@tonic-gate             ((Button)o).setName("PrListModify" /* NOI18N */);
34487c478bd9Sstevel@tonic-gate 
34497c478bd9Sstevel@tonic-gate             o = gui.PrListAdd.getBody();
34507c478bd9Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
34517c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
34527c478bd9Sstevel@tonic-gate             ((Button)o).setName("PrListAdd" /* NOI18N */);
34537c478bd9Sstevel@tonic-gate 
34547c478bd9Sstevel@tonic-gate             o = gui.PrListDelete.getBody();
34557c478bd9Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
34567c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
34577c478bd9Sstevel@tonic-gate             ((Button)o).setName("PrListDelete" /* NOI18N */);
34587c478bd9Sstevel@tonic-gate 
34597c478bd9Sstevel@tonic-gate             o = gui.PrListDuplicate.getBody();
34607c478bd9Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
34617c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
34627c478bd9Sstevel@tonic-gate             ((Button)o).setName("PrListDuplicate" /* NOI18N */);
34637c478bd9Sstevel@tonic-gate 
34647c478bd9Sstevel@tonic-gate             o = gui.PrBasicSave.getBody();
34657c478bd9Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
34667c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
34677c478bd9Sstevel@tonic-gate             ((Button)o).setName("PrSave" /* NOI18N */);
34687c478bd9Sstevel@tonic-gate 
34697c478bd9Sstevel@tonic-gate             o = gui.PrDetailSave.getBody();
34707c478bd9Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
34717c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
34727c478bd9Sstevel@tonic-gate             ((Button)o).setName("PrSave" /* NOI18N */);
34737c478bd9Sstevel@tonic-gate 
34747c478bd9Sstevel@tonic-gate             o = gui.PrFlagsSave.getBody();
34757c478bd9Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
34767c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
34777c478bd9Sstevel@tonic-gate             ((Button)o).setName("PrSave" /* NOI18N */);
34787c478bd9Sstevel@tonic-gate 
34797c478bd9Sstevel@tonic-gate             o = gui.PrBasicCancel.getBody();
34807c478bd9Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
34817c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
34827c478bd9Sstevel@tonic-gate             ((Button)o).setName("PrCancel" /* NOI18N */);
34837c478bd9Sstevel@tonic-gate 
34847c478bd9Sstevel@tonic-gate             o = gui.PrDetailCancel.getBody();
34857c478bd9Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
34867c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
34877c478bd9Sstevel@tonic-gate             ((Button)o).setName("PrCancel" /* NOI18N */);
34887c478bd9Sstevel@tonic-gate 
34897c478bd9Sstevel@tonic-gate             o = gui.PrFlagsCancel.getBody();
34907c478bd9Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
34917c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
34927c478bd9Sstevel@tonic-gate             ((Button)o).setName("PrCancel" /* NOI18N */);
34937c478bd9Sstevel@tonic-gate 
34947c478bd9Sstevel@tonic-gate             o = gui.PrName1.getBody();
34957c478bd9Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
34967c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
34977c478bd9Sstevel@tonic-gate             ((TextField)o).setName("PrName" /* NOI18N */);
34987c478bd9Sstevel@tonic-gate 
34997c478bd9Sstevel@tonic-gate             o = gui.PrNameLabel1.getBody();
35007c478bd9Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
35017c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
35027c478bd9Sstevel@tonic-gate             ((Label)o).setName("PrName" /* NOI18N */);
35037c478bd9Sstevel@tonic-gate 
35047c478bd9Sstevel@tonic-gate             o = gui.PrComments.getBody();
35057c478bd9Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
35067c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
35077c478bd9Sstevel@tonic-gate             ((TextField)o).setName("PrComments" /* NOI18N */);
35087c478bd9Sstevel@tonic-gate 
35097c478bd9Sstevel@tonic-gate             o = gui.PrCommentsLabel.getBody();
35107c478bd9Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
35117c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
35127c478bd9Sstevel@tonic-gate             ((Label)o).setName("PrComments" /* NOI18N */);
35137c478bd9Sstevel@tonic-gate 
35147c478bd9Sstevel@tonic-gate             o = gui.PrPolicy.getBody();
35157c478bd9Sstevel@tonic-gate             a = new Association(o, ml, CHOICE_MOUSE);
35167c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
35177c478bd9Sstevel@tonic-gate             ((Choice)o).setName("PrPolicy" /* NOI18N */);
35187c478bd9Sstevel@tonic-gate 
35197c478bd9Sstevel@tonic-gate             o = gui.PrPolicyLabel.getBody();
35207c478bd9Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
35217c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
35227c478bd9Sstevel@tonic-gate             ((Label)o).setName("PrPolicy" /* NOI18N */);
35237c478bd9Sstevel@tonic-gate 
35247c478bd9Sstevel@tonic-gate             o = gui.PrPassword.getBody();
35257c478bd9Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
35267c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
35277c478bd9Sstevel@tonic-gate             ((TextField)o).setName("PrPassword" /* NOI18N */);
35287c478bd9Sstevel@tonic-gate 
35297c478bd9Sstevel@tonic-gate             o = gui.PrPasswordLabel.getBody();
35307c478bd9Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
35317c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
35327c478bd9Sstevel@tonic-gate             ((Label)o).setName("PrPassword" /* NOI18N */);
35337c478bd9Sstevel@tonic-gate 
35347c478bd9Sstevel@tonic-gate             o = gui.PrBasicRandomPw.getBody();
35357c478bd9Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
35367c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
35377c478bd9Sstevel@tonic-gate             ((Button)o).setName("PrBasicRandomPw" /* NOI18N */);
35387c478bd9Sstevel@tonic-gate 
353945526e97Ssemery             o = gui.EncList.getBody();
354045526e97Ssemery             a = new Association(o, ml, TEXTFIELD_MOUSE);
354145526e97Ssemery             MainHelp.addElement(a);
354245526e97Ssemery             ((TextField)o).setName("EncList" /* NOI18N */);
354345526e97Ssemery 
354445526e97Ssemery             o = gui.EncListLabel.getBody();
354545526e97Ssemery             a = new Association(o, ml, LABEL_MOUSE);
354645526e97Ssemery             MainHelp.addElement(a);
354745526e97Ssemery             ((Label)o).setName("EncList" /* NOI18N */);
354845526e97Ssemery 
354945526e97Ssemery             o = gui.EncListMoreButton.getBody();
355045526e97Ssemery             a = new Association(o, ml, BUTTON_MOUSE);
355145526e97Ssemery             MainHelp.addElement(a);
355245526e97Ssemery             ((Button)o).setName("EncListHelperButton" /* NOI18N */);
355345526e97Ssemery 
35547c478bd9Sstevel@tonic-gate             o = gui.PrExpiry.getBody();
35557c478bd9Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
35567c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
35577c478bd9Sstevel@tonic-gate             ((TextField)o).setName("PrExpiry" /* NOI18N */);
35587c478bd9Sstevel@tonic-gate 
35597c478bd9Sstevel@tonic-gate             o = gui.PrExpiryLabel.getBody();
35607c478bd9Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
35617c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
35627c478bd9Sstevel@tonic-gate             ((Label)o).setName("PrExpiry" /* NOI18N */);
35637c478bd9Sstevel@tonic-gate 
35647c478bd9Sstevel@tonic-gate             o = gui.PrExpiryMoreButton.getBody();
35657c478bd9Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
35667c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
35677c478bd9Sstevel@tonic-gate             ((Button)o).setName("DateHelperButton" /* NOI18N */);
35687c478bd9Sstevel@tonic-gate 
35697c478bd9Sstevel@tonic-gate             o = gui.PrLastChangedTime.getBody();
35707c478bd9Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
35717c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
35727c478bd9Sstevel@tonic-gate             ((Label)o).setName("PrinBasLastPrincipalChange" /* NOI18N */);
35737c478bd9Sstevel@tonic-gate 
35747c478bd9Sstevel@tonic-gate             o = gui.PrLastChangedTimeLabel.getBody();
35757c478bd9Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
35767c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
35777c478bd9Sstevel@tonic-gate             ((Label)o).setName("PrinBasLastPrincipalChange" /* NOI18N */);
35787c478bd9Sstevel@tonic-gate 
35797c478bd9Sstevel@tonic-gate             o = gui.PrLastChangedBy.getBody();
35807c478bd9Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
35817c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
35827c478bd9Sstevel@tonic-gate             ((Label)o).setName("PrinBasLastChangedBy" /* NOI18N */);
35837c478bd9Sstevel@tonic-gate 
35847c478bd9Sstevel@tonic-gate             o = gui.PrLastChangedByLabel.getBody();
35857c478bd9Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
35867c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
35877c478bd9Sstevel@tonic-gate             ((Label)o).setName("PrinBasLastChangedBy" /* NOI18N */);
35887c478bd9Sstevel@tonic-gate 
35897c478bd9Sstevel@tonic-gate             o = gui.PrBasicPrevious.getBody();
35907c478bd9Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
35917c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
35927c478bd9Sstevel@tonic-gate             ((Button)o).setName("PrBasicPrevious" /* NOI18N */);
35937c478bd9Sstevel@tonic-gate 
35947c478bd9Sstevel@tonic-gate             o = gui.PrBasicNext.getBody();
35957c478bd9Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
35967c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
35977c478bd9Sstevel@tonic-gate             ((Button)o).setName("PrBasicNext" /* NOI18N */);
35987c478bd9Sstevel@tonic-gate 
35997c478bd9Sstevel@tonic-gate             o = gui.PrLastSuccess.getBody();
36007c478bd9Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
36017c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
36027c478bd9Sstevel@tonic-gate             ((Label)o).setName("PrinDetLastSuccess" /* NOI18N */);
36037c478bd9Sstevel@tonic-gate 
36047c478bd9Sstevel@tonic-gate             o = gui.PrLastSuccessLabel.getBody();
36057c478bd9Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
36067c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
36077c478bd9Sstevel@tonic-gate             ((Label)o).setName("PrinDetLastSuccess" /* NOI18N */);
36087c478bd9Sstevel@tonic-gate 
36097c478bd9Sstevel@tonic-gate             o = gui.PrLastFailure.getBody();
36107c478bd9Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
36117c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
36127c478bd9Sstevel@tonic-gate             ((Label)o).setName("PrinDetLastFailure" /* NOI18N */);
36137c478bd9Sstevel@tonic-gate 
36147c478bd9Sstevel@tonic-gate             o = gui.PrLastFailureLabel.getBody();
36157c478bd9Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
36167c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
36177c478bd9Sstevel@tonic-gate             ((Label)o).setName("PrinDetLastFailure" /* NOI18N */);
36187c478bd9Sstevel@tonic-gate 
36197c478bd9Sstevel@tonic-gate             o = gui.PrFailCount.getBody();
36207c478bd9Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
36217c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
36227c478bd9Sstevel@tonic-gate             ((Label)o).setName("PrinDetFailureCount" /* NOI18N */);
36237c478bd9Sstevel@tonic-gate 
36247c478bd9Sstevel@tonic-gate             o = gui.PrFailureCountLabel.getBody();
36257c478bd9Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
36267c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
36277c478bd9Sstevel@tonic-gate             ((Label)o).setName("PrinDetFailureCount" /* NOI18N */);
36287c478bd9Sstevel@tonic-gate 
36297c478bd9Sstevel@tonic-gate             o = gui.PrLastPwChange.getBody();
36307c478bd9Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
36317c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
36327c478bd9Sstevel@tonic-gate             ((Label)o).setName("PrinDetLastPasswordChange" /* NOI18N */);
36337c478bd9Sstevel@tonic-gate 
36347c478bd9Sstevel@tonic-gate             o = gui.PrPwLastChangedLabel.getBody();
36357c478bd9Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
36367c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
36377c478bd9Sstevel@tonic-gate             ((Label)o).setName("PrinDetLastPasswordChange" /* NOI18N */);
36387c478bd9Sstevel@tonic-gate 
36397c478bd9Sstevel@tonic-gate             o = gui.PrPwExpiry.getBody();
36407c478bd9Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
36417c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
36427c478bd9Sstevel@tonic-gate             ((TextField)o).setName("PrPwExpiry" /* NOI18N */);
36437c478bd9Sstevel@tonic-gate 
36447c478bd9Sstevel@tonic-gate             o = gui.PrPwExpiryLabel.getBody();
36457c478bd9Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
36467c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
36477c478bd9Sstevel@tonic-gate             ((Label)o).setName("PrPwExpiry" /* NOI18N */);
36487c478bd9Sstevel@tonic-gate 
36497c478bd9Sstevel@tonic-gate             o = gui.PrPwExpiryMoreButton.getBody();
36507c478bd9Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
36517c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
36527c478bd9Sstevel@tonic-gate             ((Button)o).setName("DateHelperButton" /* NOI18N */);
36537c478bd9Sstevel@tonic-gate 
36547c478bd9Sstevel@tonic-gate             o = gui.PrKvno.getBody();
36557c478bd9Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
36567c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
36577c478bd9Sstevel@tonic-gate             ((TextField)o).setName("PrKvno" /* NOI18N */);
36587c478bd9Sstevel@tonic-gate 
36597c478bd9Sstevel@tonic-gate             o = gui.PrKvnoLabel.getBody();
36607c478bd9Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
36617c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
36627c478bd9Sstevel@tonic-gate             ((Label)o).setName("PrKvno" /* NOI18N */);
36637c478bd9Sstevel@tonic-gate 
36647c478bd9Sstevel@tonic-gate             o = gui.PrMaxLifetime.getBody();
36657c478bd9Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
36667c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
36677c478bd9Sstevel@tonic-gate             ((TextField)o).setName("PrMaxLifetime" /* NOI18N */);
36687c478bd9Sstevel@tonic-gate 
36697c478bd9Sstevel@tonic-gate             o = gui.PrMaxTicketLifetimeLabel.getBody();
36707c478bd9Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
36717c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
36727c478bd9Sstevel@tonic-gate             ((Label)o).setName("PrMaxLifetime" /* NOI18N */);
36737c478bd9Sstevel@tonic-gate 
36747c478bd9Sstevel@tonic-gate             o = gui.PrMaxLifetimeMoreButton.getBody();
36757c478bd9Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
36767c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
36777c478bd9Sstevel@tonic-gate             ((Button)o).setName("DurationHelperButton" /* NOI18N */);
36787c478bd9Sstevel@tonic-gate 
36797c478bd9Sstevel@tonic-gate             o = gui.PrMaxRenewal.getBody();
36807c478bd9Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
36817c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
36827c478bd9Sstevel@tonic-gate             ((TextField)o).setName("PrMaxRenewal" /* NOI18N */);
36837c478bd9Sstevel@tonic-gate 
36847c478bd9Sstevel@tonic-gate             o = gui.PrMaxTicketRenewalLabel.getBody();
36857c478bd9Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
36867c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
36877c478bd9Sstevel@tonic-gate             ((Label)o).setName("PrMaxRenewal" /* NOI18N */);
36887c478bd9Sstevel@tonic-gate 
36897c478bd9Sstevel@tonic-gate             o = gui.PrMaxRenewalMoreButton.getBody();
36907c478bd9Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
36917c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
36927c478bd9Sstevel@tonic-gate             ((Button)o).setName("DurationHelperButton" /* NOI18N */);
36937c478bd9Sstevel@tonic-gate 
36947c478bd9Sstevel@tonic-gate             o = gui.PrDetailPrevious.getBody();
36957c478bd9Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
36967c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
36977c478bd9Sstevel@tonic-gate             ((Button)o).setName("PrDetailPrevious" /* NOI18N */);
36987c478bd9Sstevel@tonic-gate 
36997c478bd9Sstevel@tonic-gate             o = gui.PrDetailNext.getBody();
37007c478bd9Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
37017c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
37027c478bd9Sstevel@tonic-gate             ((Button)o).setName("PrDetailNext" /* NOI18N */);
37037c478bd9Sstevel@tonic-gate 
37047c478bd9Sstevel@tonic-gate             o = gui.PrFlagsPrevious.getBody();
37057c478bd9Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
37067c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
37077c478bd9Sstevel@tonic-gate             ((Button)o).setName("PrFlagsPrevious" /* NOI18N */);
37087c478bd9Sstevel@tonic-gate 
37097c478bd9Sstevel@tonic-gate             o = gui.PrFlagsNext.getBody();
37107c478bd9Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
37117c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
37127c478bd9Sstevel@tonic-gate             ((Button)o).setName("PrFlagsNext" /* NOI18N */);
37137c478bd9Sstevel@tonic-gate 
37147c478bd9Sstevel@tonic-gate             o = gui.PrLockAcct.getBody();
37157c478bd9Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
37167c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
37177c478bd9Sstevel@tonic-gate             ((Checkbox)o).setName("PrLockAcct" /* NOI18N */);
37187c478bd9Sstevel@tonic-gate 
37197c478bd9Sstevel@tonic-gate             o = gui.PrForcePwChange.getBody();
37207c478bd9Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
37217c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
37227c478bd9Sstevel@tonic-gate             ((Checkbox)o).setName("PrForcePwChange" /* NOI18N */);
37237c478bd9Sstevel@tonic-gate 
37247c478bd9Sstevel@tonic-gate             o = gui.PrAllowPostdated.getBody();
37257c478bd9Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
37267c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
37277c478bd9Sstevel@tonic-gate             ((Checkbox)o).setName("PrAllowPostdated" /* NOI18N */);
37287c478bd9Sstevel@tonic-gate 
37297c478bd9Sstevel@tonic-gate             o = gui.PrAllowForwardable.getBody();
37307c478bd9Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
37317c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
37327c478bd9Sstevel@tonic-gate             ((Checkbox)o).setName("PrAllowForwardable" /* NOI18N */);
37337c478bd9Sstevel@tonic-gate 
37347c478bd9Sstevel@tonic-gate             o = gui.PrAllowRenewable.getBody();
37357c478bd9Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
37367c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
37377c478bd9Sstevel@tonic-gate             ((Checkbox)o).setName("PrAllowRenewable" /* NOI18N */);
37387c478bd9Sstevel@tonic-gate 
37397c478bd9Sstevel@tonic-gate             o = gui.PrAllowProxiable.getBody();
37407c478bd9Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
37417c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
37427c478bd9Sstevel@tonic-gate             ((Checkbox)o).setName("PrAllowProxiable" /* NOI18N */);
37437c478bd9Sstevel@tonic-gate 
37447c478bd9Sstevel@tonic-gate             o = gui.PrAllowSvr.getBody();
37457c478bd9Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
37467c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
37477c478bd9Sstevel@tonic-gate             ((Checkbox)o).setName("PrAllowSvr" /* NOI18N */);
37487c478bd9Sstevel@tonic-gate 
37497c478bd9Sstevel@tonic-gate             o = gui.PrAllowTGT.getBody();
37507c478bd9Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
37517c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
37527c478bd9Sstevel@tonic-gate             ((Checkbox)o).setName("PrAllowTGT" /* NOI18N */);
37537c478bd9Sstevel@tonic-gate 
37547c478bd9Sstevel@tonic-gate             o = gui.PrAllowDupAuth.getBody();
37557c478bd9Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
37567c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
37577c478bd9Sstevel@tonic-gate             ((Checkbox)o).setName("PrAllowDupAuth" /* NOI18N */);
37587c478bd9Sstevel@tonic-gate 
37597c478bd9Sstevel@tonic-gate             o = gui.PrRequirePreAuth.getBody();
37607c478bd9Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
37617c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
37627c478bd9Sstevel@tonic-gate             ((Checkbox)o).setName("PrRequirePreAuth" /* NOI18N */);
37637c478bd9Sstevel@tonic-gate 
37647c478bd9Sstevel@tonic-gate             o = gui.PrRequireHwPreAuth.getBody();
37657c478bd9Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
37667c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
37677c478bd9Sstevel@tonic-gate             ((Checkbox)o).setName("PrRequireHwPreAuth" /* NOI18N */);
37687c478bd9Sstevel@tonic-gate 
37697c478bd9Sstevel@tonic-gate             o = gui.PoListPattern.getBody();
37707c478bd9Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
37717c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
37727c478bd9Sstevel@tonic-gate             ((TextField)o).setName("PoListPattern" /* NOI18N */);
37737c478bd9Sstevel@tonic-gate 
37747c478bd9Sstevel@tonic-gate             o = gui.PoListPatternLabel.getBody();
37757c478bd9Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
37767c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
37777c478bd9Sstevel@tonic-gate             ((Label)o).setName("PoListPattern" /* NOI18N */);
37787c478bd9Sstevel@tonic-gate 
37797c478bd9Sstevel@tonic-gate             o = gui.PoListClear.getBody();
37807c478bd9Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
37817c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
37827c478bd9Sstevel@tonic-gate             ((Button)o).setName("PoListClear" /* NOI18N */);
37837c478bd9Sstevel@tonic-gate 
37847c478bd9Sstevel@tonic-gate             o = gui.PoListModify.getBody();
37857c478bd9Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
37867c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
37877c478bd9Sstevel@tonic-gate             ((Button)o).setName("PoListModify" /* NOI18N */);
37887c478bd9Sstevel@tonic-gate 
37897c478bd9Sstevel@tonic-gate             o = gui.PoListAdd.getBody();
37907c478bd9Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
37917c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
37927c478bd9Sstevel@tonic-gate             ((Button)o).setName("PoListAdd" /* NOI18N */);
37937c478bd9Sstevel@tonic-gate 
37947c478bd9Sstevel@tonic-gate             o = gui.PoListDelete.getBody();
37957c478bd9Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
37967c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
37977c478bd9Sstevel@tonic-gate             ((Button)o).setName("PoListDelete" /* NOI18N */);
37987c478bd9Sstevel@tonic-gate 
37997c478bd9Sstevel@tonic-gate             o = gui.PoListDuplicate.getBody();
38007c478bd9Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
38017c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
38027c478bd9Sstevel@tonic-gate             ((Button)o).setName("PoListDuplicate" /* NOI18N */);
38037c478bd9Sstevel@tonic-gate 
38047c478bd9Sstevel@tonic-gate             o = gui.PoName.getBody();
38057c478bd9Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
38067c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
38077c478bd9Sstevel@tonic-gate             ((TextField)o).setName("PoName" /* NOI18N */);
38087c478bd9Sstevel@tonic-gate 
38097c478bd9Sstevel@tonic-gate             o = gui.PoNameLabel.getBody();
38107c478bd9Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
38117c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
38127c478bd9Sstevel@tonic-gate             ((Label)o).setName("PoName" /* NOI18N */);
38137c478bd9Sstevel@tonic-gate 
38147c478bd9Sstevel@tonic-gate             o = gui.PoMinPwLength.getBody();
38157c478bd9Sstevel@tonic-gate             a = new Association(o, ml, CHOICE_MOUSE);
38167c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
38177c478bd9Sstevel@tonic-gate             ((Choice)o).setName("PoMinPwLength" /* NOI18N */);
38187c478bd9Sstevel@tonic-gate 
38197c478bd9Sstevel@tonic-gate             o = gui.PoMinPwLengthLabel.getBody();
38207c478bd9Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
38217c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
38227c478bd9Sstevel@tonic-gate             ((Label)o).setName("PoMinPwLength" /* NOI18N */);
38237c478bd9Sstevel@tonic-gate 
38247c478bd9Sstevel@tonic-gate             o = gui.PoMinPwClass.getBody();
38257c478bd9Sstevel@tonic-gate             a = new Association(o, ml, CHOICE_MOUSE);
38267c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
38277c478bd9Sstevel@tonic-gate             ((Choice)o).setName("PoMinPwClass" /* NOI18N */);
38287c478bd9Sstevel@tonic-gate 
38297c478bd9Sstevel@tonic-gate             o = gui.PoMinPwClassLabel.getBody();
38307c478bd9Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
38317c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
38327c478bd9Sstevel@tonic-gate             ((Label)o).setName("PoMinPwClass" /* NOI18N */);
38337c478bd9Sstevel@tonic-gate 
38347c478bd9Sstevel@tonic-gate             o = gui.PoSavedPasswords.getBody();
38357c478bd9Sstevel@tonic-gate             a = new Association(o, ml, CHOICE_MOUSE);
38367c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
38377c478bd9Sstevel@tonic-gate             ((Choice)o).setName("PoSavedPasswords" /* NOI18N */);
38387c478bd9Sstevel@tonic-gate 
38397c478bd9Sstevel@tonic-gate             o = gui.PoSavedPasswordsLabel.getBody();
38407c478bd9Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
38417c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
38427c478bd9Sstevel@tonic-gate             ((Label)o).setName("PoSavedPasswords" /* NOI18N */);
38437c478bd9Sstevel@tonic-gate 
38447c478bd9Sstevel@tonic-gate             o = gui.PoMinTicketLifetime.getBody();
38457c478bd9Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
38467c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
38477c478bd9Sstevel@tonic-gate             ((TextField)o).setName("PoMinTicketLifetime" /* NOI18N */);
38487c478bd9Sstevel@tonic-gate 
38497c478bd9Sstevel@tonic-gate             o = gui.PoMinTicketLifetimeLabel.getBody();
38507c478bd9Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
38517c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
38527c478bd9Sstevel@tonic-gate             ((Label)o).setName("PoMinTicketLifetime" /* NOI18N */);
38537c478bd9Sstevel@tonic-gate 
38547c478bd9Sstevel@tonic-gate             o = gui.PoMinTicketLifetimeMoreButton.getBody();
38557c478bd9Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
38567c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
38577c478bd9Sstevel@tonic-gate             ((Button)o).setName("DurationHelperButton" /* NOI18N */);
38587c478bd9Sstevel@tonic-gate 
38597c478bd9Sstevel@tonic-gate             o = gui.PoMaxTicketLifetime.getBody();
38607c478bd9Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
38617c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
38627c478bd9Sstevel@tonic-gate             ((TextField)o).setName("PoMaxTicketLifetime" /* NOI18N */);
38637c478bd9Sstevel@tonic-gate 
38647c478bd9Sstevel@tonic-gate             o = gui.PoMaxTicketLifetimeLabel.getBody();
38657c478bd9Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
38667c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
38677c478bd9Sstevel@tonic-gate             ((Label)o).setName("PoMaxTicketLifetime" /* NOI18N */);
38687c478bd9Sstevel@tonic-gate 
38697c478bd9Sstevel@tonic-gate             o = gui.PoMaxTicketLifetimeMoreButton.getBody();
38707c478bd9Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
38717c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
38727c478bd9Sstevel@tonic-gate             ((Button)o).setName("DurationHelperButton" /* NOI18N */);
38737c478bd9Sstevel@tonic-gate 
38747c478bd9Sstevel@tonic-gate             o = gui.PoReferences.getBody();
38757c478bd9Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
38767c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
38777c478bd9Sstevel@tonic-gate             ((Label)o).setName("PolDetPrincipalsUsingThisPolicy" /* NOI18N */);
38787c478bd9Sstevel@tonic-gate 
38797c478bd9Sstevel@tonic-gate             o = gui.PoReferencesLabel.getBody();
38807c478bd9Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
38817c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
38827c478bd9Sstevel@tonic-gate             ((Label)o).setName("PolDetPrincipalsUsingThisPolicy" /* NOI18N */);
38837c478bd9Sstevel@tonic-gate 
38847c478bd9Sstevel@tonic-gate             o = gui.PoDetailSave.getBody();
38857c478bd9Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
38867c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
38877c478bd9Sstevel@tonic-gate             ((Button)o).setName("PoSave" /* NOI18N */);
38887c478bd9Sstevel@tonic-gate 
38897c478bd9Sstevel@tonic-gate             o = gui.PoDetailCancel.getBody();
38907c478bd9Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
38917c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
38927c478bd9Sstevel@tonic-gate             ((Button)o).setName("PoCancel" /* NOI18N */);
38937c478bd9Sstevel@tonic-gate 
38947c478bd9Sstevel@tonic-gate             o = gui.PoDetailPrevious.getBody();
38957c478bd9Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
38967c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
38977c478bd9Sstevel@tonic-gate             ((Button)o).setName("PoDetailPrevious" /* NOI18N */);
38987c478bd9Sstevel@tonic-gate 
38997c478bd9Sstevel@tonic-gate             o = gui.PoDetailDone.getBody();
39007c478bd9Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
39017c478bd9Sstevel@tonic-gate             MainHelp.addElement(a);
39027c478bd9Sstevel@tonic-gate             ((Button)o).setName("PoDetailDone" /* NOI18N */);
39037c478bd9Sstevel@tonic-gate 
39047c478bd9Sstevel@tonic-gate             setupMainHelpFlagTogglers();
39057c478bd9Sstevel@tonic-gate         }
39067c478bd9Sstevel@tonic-gate 
39077c478bd9Sstevel@tonic-gate         fixHelpTags();
39087c478bd9Sstevel@tonic-gate         setListeners(MainNormal, false);
39097c478bd9Sstevel@tonic-gate         setListeners(MainHelp, true);
39107c478bd9Sstevel@tonic-gate         setupMainHelpFixers();
39117c478bd9Sstevel@tonic-gate         mainHelpMode = true;
39127c478bd9Sstevel@tonic-gate     }
39137c478bd9Sstevel@tonic-gate 
fixHelpTags()39147c478bd9Sstevel@tonic-gate     public void fixHelpTags() {
39157c478bd9Sstevel@tonic-gate         if (noLists) {
39167c478bd9Sstevel@tonic-gate             ((TextList)gui.Prlist.getBody()).setName("PrNoList" /* NOI18N */);
39177c478bd9Sstevel@tonic-gate             ((TextField)gui.PrListPattern.getBody()).setName("PrNameNoList"
39187c478bd9Sstevel@tonic-gate 							     /* NOI18N */);
39197c478bd9Sstevel@tonic-gate             ((Button)gui.PrListClear.getBody()).setName("PrNoListClear"
39207c478bd9Sstevel@tonic-gate 							/* NOI18N */);
39217c478bd9Sstevel@tonic-gate             ((TextList)gui.Pollist.getBody()).setName("PolNoList" /* NOI18N */);
39227c478bd9Sstevel@tonic-gate             ((TextField)gui.PoListPattern.getBody()).setName("PoNameNoList"
39237c478bd9Sstevel@tonic-gate 							     /* NOI18N */);
39247c478bd9Sstevel@tonic-gate             ((Button)gui.PoListClear.getBody()).setName("PoNoListClear"
39257c478bd9Sstevel@tonic-gate 							/* NOI18N */);
39267c478bd9Sstevel@tonic-gate         } else {
39277c478bd9Sstevel@tonic-gate             ((TextList)gui.Prlist.getBody()).setName("PrList" /* NOI18N */);
39287c478bd9Sstevel@tonic-gate             ((TextField)gui.PrListPattern.getBody()).setName("PrListPattern"
39297c478bd9Sstevel@tonic-gate 							     /* NOI18N */);
39307c478bd9Sstevel@tonic-gate             ((Button)gui.PrListClear.getBody()).setName("PrListClear"
39317c478bd9Sstevel@tonic-gate 							/* NOI18N */);
39327c478bd9Sstevel@tonic-gate             ((TextList)gui.Pollist.getBody()).setName("Pollist" /* NOI18N */);
39337c478bd9Sstevel@tonic-gate             ((TextField)gui.PoListPattern.getBody()).setName("PoListPattern"
39347c478bd9Sstevel@tonic-gate 							     /* NOI18N */);
39357c478bd9Sstevel@tonic-gate             ((Button)gui.PoListClear.getBody()).setName("PoListClear"
39367c478bd9Sstevel@tonic-gate 							/* NOI18N */);
39377c478bd9Sstevel@tonic-gate         }
39387c478bd9Sstevel@tonic-gate     }
39397c478bd9Sstevel@tonic-gate 
39407c478bd9Sstevel@tonic-gate     /**
39417c478bd9Sstevel@tonic-gate      * Helper method to setupMainHelpListeners. Should be called from
39427c478bd9Sstevel@tonic-gate      * only from there.
39437c478bd9Sstevel@tonic-gate      */
setupMainHelpFlagTogglers()39447c478bd9Sstevel@tonic-gate     private void 	setupMainHelpFlagTogglers() {
39457c478bd9Sstevel@tonic-gate 
39467c478bd9Sstevel@tonic-gate         if (MainHelp == null)
39477c478bd9Sstevel@tonic-gate             return;
39487c478bd9Sstevel@tonic-gate 
39497c478bd9Sstevel@tonic-gate         CheckboxToggler ml = new CheckboxToggler();
39507c478bd9Sstevel@tonic-gate         Object o;
39517c478bd9Sstevel@tonic-gate         Association a;
39527c478bd9Sstevel@tonic-gate 
39537c478bd9Sstevel@tonic-gate         o = gui.PrLockAcct.getBody();
39547c478bd9Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
39557c478bd9Sstevel@tonic-gate         MainHelp.addElement(a);
39567c478bd9Sstevel@tonic-gate 
39577c478bd9Sstevel@tonic-gate         o = gui.PrForcePwChange.getBody();
39587c478bd9Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
39597c478bd9Sstevel@tonic-gate         MainHelp.addElement(a);
39607c478bd9Sstevel@tonic-gate 
39617c478bd9Sstevel@tonic-gate         o = gui.PrAllowPostdated.getBody();
39627c478bd9Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
39637c478bd9Sstevel@tonic-gate         MainHelp.addElement(a);
39647c478bd9Sstevel@tonic-gate 
39657c478bd9Sstevel@tonic-gate         o = gui.PrAllowForwardable.getBody();
39667c478bd9Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
39677c478bd9Sstevel@tonic-gate         MainHelp.addElement(a);
39687c478bd9Sstevel@tonic-gate 
39697c478bd9Sstevel@tonic-gate         o = gui.PrAllowRenewable.getBody();
39707c478bd9Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
39717c478bd9Sstevel@tonic-gate         MainHelp.addElement(a);
39727c478bd9Sstevel@tonic-gate 
39737c478bd9Sstevel@tonic-gate         o = gui.PrAllowProxiable.getBody();
39747c478bd9Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
39757c478bd9Sstevel@tonic-gate         MainHelp.addElement(a);
39767c478bd9Sstevel@tonic-gate 
39777c478bd9Sstevel@tonic-gate         o = gui.PrAllowSvr.getBody();
39787c478bd9Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
39797c478bd9Sstevel@tonic-gate         MainHelp.addElement(a);
39807c478bd9Sstevel@tonic-gate 
39817c478bd9Sstevel@tonic-gate         o = gui.PrAllowTGT.getBody();
39827c478bd9Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
39837c478bd9Sstevel@tonic-gate         MainHelp.addElement(a);
39847c478bd9Sstevel@tonic-gate 
39857c478bd9Sstevel@tonic-gate         o = gui.PrAllowDupAuth.getBody();
39867c478bd9Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
39877c478bd9Sstevel@tonic-gate         MainHelp.addElement(a);
39887c478bd9Sstevel@tonic-gate 
39897c478bd9Sstevel@tonic-gate         o = gui.PrRequirePreAuth.getBody();
39907c478bd9Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
39917c478bd9Sstevel@tonic-gate         MainHelp.addElement(a);
39927c478bd9Sstevel@tonic-gate 
39937c478bd9Sstevel@tonic-gate         o = gui.PrRequireHwPreAuth.getBody();
39947c478bd9Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
39957c478bd9Sstevel@tonic-gate         MainHelp.addElement(a);
39967c478bd9Sstevel@tonic-gate     }
39977c478bd9Sstevel@tonic-gate 
setupMainHelpFixers()39987c478bd9Sstevel@tonic-gate     public void setupMainHelpFixers() {
39997c478bd9Sstevel@tonic-gate         MainFixers = new Vector(10, 10);
40007c478bd9Sstevel@tonic-gate         Object o;
40017c478bd9Sstevel@tonic-gate         Association a;
40027c478bd9Sstevel@tonic-gate         TextFixer tf;
40037c478bd9Sstevel@tonic-gate         ChoiceFixer cf;
40047c478bd9Sstevel@tonic-gate 
40057c478bd9Sstevel@tonic-gate         o = gui.PrListPattern.getBody();
40067c478bd9Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
40077c478bd9Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
40087c478bd9Sstevel@tonic-gate         MainFixers.addElement(a);
40097c478bd9Sstevel@tonic-gate 
40107c478bd9Sstevel@tonic-gate         o = gui.PrName1.getBody();
40117c478bd9Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
40127c478bd9Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
40137c478bd9Sstevel@tonic-gate         MainFixers.addElement(a);
40147c478bd9Sstevel@tonic-gate 
40157c478bd9Sstevel@tonic-gate         o = gui.PrComments.getBody();
40167c478bd9Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
40177c478bd9Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
40187c478bd9Sstevel@tonic-gate         MainFixers.addElement(a);
40197c478bd9Sstevel@tonic-gate 
40207c478bd9Sstevel@tonic-gate         o = gui.PrPolicy.getBody();
40217c478bd9Sstevel@tonic-gate         cf = new ChoiceFixer((Choice)o);
40227c478bd9Sstevel@tonic-gate         a = new Association(o, cf, CHOICE_ITEM);
40237c478bd9Sstevel@tonic-gate         MainFixers.addElement(a);
40247c478bd9Sstevel@tonic-gate 
40257c478bd9Sstevel@tonic-gate         o = gui.PrPassword.getBody();
40267c478bd9Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
40277c478bd9Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
40287c478bd9Sstevel@tonic-gate         MainFixers.addElement(a);
40297c478bd9Sstevel@tonic-gate 
40307c478bd9Sstevel@tonic-gate         o = gui.PrExpiry.getBody();
40317c478bd9Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
40327c478bd9Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
40337c478bd9Sstevel@tonic-gate         MainFixers.addElement(a);
40347c478bd9Sstevel@tonic-gate 
403545526e97Ssemery         o = gui.EncList.getBody();
403645526e97Ssemery         tf = new TextFixer((TextField)o);
403745526e97Ssemery         a = new Association(o, tf, TEXTFIELD_KEY);
403845526e97Ssemery         MainFixers.addElement(a);
403945526e97Ssemery 
40407c478bd9Sstevel@tonic-gate         o = gui.PrPwExpiry.getBody();
40417c478bd9Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
40427c478bd9Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
40437c478bd9Sstevel@tonic-gate         MainFixers.addElement(a);
40447c478bd9Sstevel@tonic-gate 
40457c478bd9Sstevel@tonic-gate         o = gui.PrKvno.getBody();
40467c478bd9Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
40477c478bd9Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
40487c478bd9Sstevel@tonic-gate         MainFixers.addElement(a);
40497c478bd9Sstevel@tonic-gate 
40507c478bd9Sstevel@tonic-gate         o = gui.PrMaxLifetime.getBody();
40517c478bd9Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
40527c478bd9Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
40537c478bd9Sstevel@tonic-gate         MainFixers.addElement(a);
40547c478bd9Sstevel@tonic-gate 
40557c478bd9Sstevel@tonic-gate         o = gui.PrMaxRenewal.getBody();
40567c478bd9Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
40577c478bd9Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
40587c478bd9Sstevel@tonic-gate         MainFixers.addElement(a);
40597c478bd9Sstevel@tonic-gate 
40607c478bd9Sstevel@tonic-gate         o = gui.PoListPattern.getBody();
40617c478bd9Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
40627c478bd9Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
40637c478bd9Sstevel@tonic-gate         MainFixers.addElement(a);
40647c478bd9Sstevel@tonic-gate 
40657c478bd9Sstevel@tonic-gate         o = gui.PoName.getBody();
40667c478bd9Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
40677c478bd9Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
40687c478bd9Sstevel@tonic-gate         MainFixers.addElement(a);
40697c478bd9Sstevel@tonic-gate 
40707c478bd9Sstevel@tonic-gate         o = gui.PoMinPwLength.getBody();
40717c478bd9Sstevel@tonic-gate         cf = new ChoiceFixer((Choice)o);
40727c478bd9Sstevel@tonic-gate         a = new Association(o, cf, CHOICE_ITEM);
40737c478bd9Sstevel@tonic-gate         MainFixers.addElement(a);
40747c478bd9Sstevel@tonic-gate 
40757c478bd9Sstevel@tonic-gate         o = gui.PoMinPwClass.getBody();
40767c478bd9Sstevel@tonic-gate         cf = new ChoiceFixer((Choice)o);
40777c478bd9Sstevel@tonic-gate         a = new Association(o, cf, CHOICE_ITEM);
40787c478bd9Sstevel@tonic-gate         MainFixers.addElement(a);
40797c478bd9Sstevel@tonic-gate 
40807c478bd9Sstevel@tonic-gate         o = gui.PoSavedPasswords.getBody();
40817c478bd9Sstevel@tonic-gate         cf = new ChoiceFixer((Choice)o);
40827c478bd9Sstevel@tonic-gate         a = new Association(o, cf, CHOICE_ITEM);
40837c478bd9Sstevel@tonic-gate         MainFixers.addElement(a);
40847c478bd9Sstevel@tonic-gate 
40857c478bd9Sstevel@tonic-gate         o = gui.PoMinTicketLifetime.getBody();
40867c478bd9Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
40877c478bd9Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
40887c478bd9Sstevel@tonic-gate         MainFixers.addElement(a);
40897c478bd9Sstevel@tonic-gate 
40907c478bd9Sstevel@tonic-gate         o = gui.PoMaxTicketLifetime.getBody();
40917c478bd9Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
40927c478bd9Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
40937c478bd9Sstevel@tonic-gate         MainFixers.addElement(a);
40947c478bd9Sstevel@tonic-gate 
40957c478bd9Sstevel@tonic-gate         setListeners(MainFixers, true);
40967c478bd9Sstevel@tonic-gate     }
40977c478bd9Sstevel@tonic-gate 
setupDefaultsNormalListeners()40987c478bd9Sstevel@tonic-gate     public void setupDefaultsNormalListeners() {
40997c478bd9Sstevel@tonic-gate 
41007c478bd9Sstevel@tonic-gate         if (defaultsNormal == null) {
41017c478bd9Sstevel@tonic-gate             defaultsNormal = new Vector(10, 10);
41027c478bd9Sstevel@tonic-gate             ActionListener al;
41037c478bd9Sstevel@tonic-gate             ItemListener il;
41047c478bd9Sstevel@tonic-gate             KeyListener kl = new KeystrokeDetector(DEFAULTS_EDITING);
41057c478bd9Sstevel@tonic-gate             Association a;
41067c478bd9Sstevel@tonic-gate             Object o;
41077c478bd9Sstevel@tonic-gate 
41087c478bd9Sstevel@tonic-gate             // Action listeners for Defaults
41097c478bd9Sstevel@tonic-gate 
41107c478bd9Sstevel@tonic-gate             il = new GlobalLockAcctAction();
41117c478bd9Sstevel@tonic-gate             o = defaults.disableAccount;
41127c478bd9Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
41137c478bd9Sstevel@tonic-gate             defaultsNormal.addElement(a);
41147c478bd9Sstevel@tonic-gate 
41157c478bd9Sstevel@tonic-gate             il = new GlobalForcePwChangeAction();
41167c478bd9Sstevel@tonic-gate             o = defaults.forcePasswordChange;
41177c478bd9Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
41187c478bd9Sstevel@tonic-gate             defaultsNormal.addElement(a);
41197c478bd9Sstevel@tonic-gate 
41207c478bd9Sstevel@tonic-gate             il = new GlobalAllowPostdatedAction();
41217c478bd9Sstevel@tonic-gate             o = defaults.allowPostdatedTix;
41227c478bd9Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
41237c478bd9Sstevel@tonic-gate             defaultsNormal.addElement(a);
41247c478bd9Sstevel@tonic-gate 
41257c478bd9Sstevel@tonic-gate             il = new GlobalAllowForwardableAction();
41267c478bd9Sstevel@tonic-gate             o = defaults.allowForwardableTix;
41277c478bd9Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
41287c478bd9Sstevel@tonic-gate             defaultsNormal.addElement(a);
41297c478bd9Sstevel@tonic-gate 
41307c478bd9Sstevel@tonic-gate             il = new GlobalAllowRenewableAction();
41317c478bd9Sstevel@tonic-gate             o = defaults.allowRenewableTix;
41327c478bd9Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
41337c478bd9Sstevel@tonic-gate             defaultsNormal.addElement(a);
41347c478bd9Sstevel@tonic-gate 
41357c478bd9Sstevel@tonic-gate             il = new GlobalAllowProxiableAction();
41367c478bd9Sstevel@tonic-gate             o = defaults.allowProxiableTix;
41377c478bd9Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
41387c478bd9Sstevel@tonic-gate             defaultsNormal.addElement(a);
41397c478bd9Sstevel@tonic-gate 
41407c478bd9Sstevel@tonic-gate             il = new GlobalAllowSvrAction();
41417c478bd9Sstevel@tonic-gate             o = defaults.allowServiceTix;
41427c478bd9Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
41437c478bd9Sstevel@tonic-gate             defaultsNormal.addElement(a);
41447c478bd9Sstevel@tonic-gate 
41457c478bd9Sstevel@tonic-gate             il = new GlobalAllowTGTAction();
41467c478bd9Sstevel@tonic-gate             o = defaults.allowTGTAuth;
41477c478bd9Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
41487c478bd9Sstevel@tonic-gate             defaultsNormal.addElement(a);
41497c478bd9Sstevel@tonic-gate 
41507c478bd9Sstevel@tonic-gate             il = new GlobalAllowDupAuthAction();
41517c478bd9Sstevel@tonic-gate             o = defaults.allowDupAuth;
41527c478bd9Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
41537c478bd9Sstevel@tonic-gate             defaultsNormal.addElement(a);
41547c478bd9Sstevel@tonic-gate 
41557c478bd9Sstevel@tonic-gate             il = new GlobalRequirePreAuthAction();
41567c478bd9Sstevel@tonic-gate             o = defaults.requirePreauth;
41577c478bd9Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
41587c478bd9Sstevel@tonic-gate             defaultsNormal.addElement(a);
41597c478bd9Sstevel@tonic-gate 
41607c478bd9Sstevel@tonic-gate             il = new GlobalRequireHwPreAuthAction();
41617c478bd9Sstevel@tonic-gate             o = defaults.requireHWAuth;
41627c478bd9Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
41637c478bd9Sstevel@tonic-gate             defaultsNormal.addElement(a);
41647c478bd9Sstevel@tonic-gate 
41657c478bd9Sstevel@tonic-gate             il = new GlobalDefaultServerSideAction();
41667c478bd9Sstevel@tonic-gate             o = defaults.serverSide;
41677c478bd9Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
41687c478bd9Sstevel@tonic-gate             defaultsNormal.addElement(a);
41697c478bd9Sstevel@tonic-gate 
41707c478bd9Sstevel@tonic-gate             al = new GlobalDefaultRenewableLifeAction();
41717c478bd9Sstevel@tonic-gate             o = defaults.maxTicketRenewableLife;
41727c478bd9Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
41737c478bd9Sstevel@tonic-gate             defaultsNormal.addElement(a);
41747c478bd9Sstevel@tonic-gate             a = new Association(o, kl, TEXTFIELD_KEY);
41757c478bd9Sstevel@tonic-gate             defaultsNormal.addElement(a);
41767c478bd9Sstevel@tonic-gate 
41777c478bd9Sstevel@tonic-gate             al = new GlobalDefaultLifeAction();
41787c478bd9Sstevel@tonic-gate             o = defaults.maxTicketLife;
41797c478bd9Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
41807c478bd9Sstevel@tonic-gate             defaultsNormal.addElement(a);
41817c478bd9Sstevel@tonic-gate             a = new Association(o, kl, TEXTFIELD_KEY);
41827c478bd9Sstevel@tonic-gate             defaultsNormal.addElement(a);
41837c478bd9Sstevel@tonic-gate 
41847c478bd9Sstevel@tonic-gate             al = new GlobalDefaultExpiryAction();
41857c478bd9Sstevel@tonic-gate             o = defaults.accountExpiryDate;
41867c478bd9Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
41877c478bd9Sstevel@tonic-gate             defaultsNormal.addElement(a);
41887c478bd9Sstevel@tonic-gate             a = new Association(o, kl, TEXTFIELD_KEY);
41897c478bd9Sstevel@tonic-gate             defaultsNormal.addElement(a);
41907c478bd9Sstevel@tonic-gate 
41917c478bd9Sstevel@tonic-gate             il = new GlobalDefaultShowListsAction();
41927c478bd9Sstevel@tonic-gate             o = defaults.showLists;
41937c478bd9Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
41947c478bd9Sstevel@tonic-gate             defaultsNormal.addElement(a);
41957c478bd9Sstevel@tonic-gate 
41967c478bd9Sstevel@tonic-gate             il = new GlobalDefaultStaticListsAction();
41977c478bd9Sstevel@tonic-gate             o = defaults.staticLists;
41987c478bd9Sstevel@tonic-gate             a = new Association(o, il, CHECKBOX_ITEM);
41997c478bd9Sstevel@tonic-gate             defaultsNormal.addElement(a);
42007c478bd9Sstevel@tonic-gate 
42017c478bd9Sstevel@tonic-gate             al = new GlobalDefaultCacheTimeAction();
42027c478bd9Sstevel@tonic-gate             o = defaults.cacheTime;
42037c478bd9Sstevel@tonic-gate             a = new Association(o, al, TEXTFIELD_ACTION);
42047c478bd9Sstevel@tonic-gate             defaultsNormal.addElement(a);
42057c478bd9Sstevel@tonic-gate             a = new Association(o, kl, TEXTFIELD_KEY);
42067c478bd9Sstevel@tonic-gate             defaultsNormal.addElement(a);
42077c478bd9Sstevel@tonic-gate 
42087c478bd9Sstevel@tonic-gate             al = new GlobalSaveAction();
42097c478bd9Sstevel@tonic-gate             o = defaults.saveButton;
42107c478bd9Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
42117c478bd9Sstevel@tonic-gate             defaultsNormal.addElement(a);
42127c478bd9Sstevel@tonic-gate 
42137c478bd9Sstevel@tonic-gate             al = new GlobalApplyAction();
42147c478bd9Sstevel@tonic-gate             o = defaults.applyButton;
42157c478bd9Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
42167c478bd9Sstevel@tonic-gate             defaultsNormal.addElement(a);
42177c478bd9Sstevel@tonic-gate 
42187c478bd9Sstevel@tonic-gate             al = new GlobalCancelAction();
42197c478bd9Sstevel@tonic-gate             o = defaults.cancelButton;
42207c478bd9Sstevel@tonic-gate             a = new Association(o, al, BUTTON_ACTION);
42217c478bd9Sstevel@tonic-gate             defaultsNormal.addElement(a);
42227c478bd9Sstevel@tonic-gate 
42237c478bd9Sstevel@tonic-gate             DateTimeListener dtl = new DateTimeListener(
42247c478bd9Sstevel@tonic-gate 			defaults.accountExpiryDate, defaultsEditingFrame);
42257c478bd9Sstevel@tonic-gate             o = defaults.dateMoreButton;
42267c478bd9Sstevel@tonic-gate             a = new Association(o, dtl, BUTTON_ACTION);
42277c478bd9Sstevel@tonic-gate             defaultsNormal.addElement(a);
42287c478bd9Sstevel@tonic-gate 
42297c478bd9Sstevel@tonic-gate             DurationListener dl = new DurationListener(
42307c478bd9Sstevel@tonic-gate 		       defaults.maxTicketRenewableLife, defaultsEditingFrame);
42317c478bd9Sstevel@tonic-gate             o = defaults.renewalMoreButton;
42327c478bd9Sstevel@tonic-gate             a = new Association(o, dl, BUTTON_ACTION);
42337c478bd9Sstevel@tonic-gate             defaultsNormal.addElement(a);
42347c478bd9Sstevel@tonic-gate 
42357c478bd9Sstevel@tonic-gate             dl = new DurationListener(defaults.maxTicketLife,
42367c478bd9Sstevel@tonic-gate 				      defaultsEditingFrame);
42377c478bd9Sstevel@tonic-gate             o = defaults.lifeMoreButton;
42387c478bd9Sstevel@tonic-gate             a = new Association(o, dl, BUTTON_ACTION);
42397c478bd9Sstevel@tonic-gate             defaultsNormal.addElement(a);
42407c478bd9Sstevel@tonic-gate 
42417c478bd9Sstevel@tonic-gate             dl = new DurationListener(defaults.cacheTime, defaultsEditingFrame);
42427c478bd9Sstevel@tonic-gate             o = defaults.cacheMoreButton;
42437c478bd9Sstevel@tonic-gate             a = new Association(o, dl, BUTTON_ACTION);
42447c478bd9Sstevel@tonic-gate             defaultsNormal.addElement(a);
42457c478bd9Sstevel@tonic-gate 
42467c478bd9Sstevel@tonic-gate         }
42477c478bd9Sstevel@tonic-gate         setListeners(defaultsHelp, false);
42487c478bd9Sstevel@tonic-gate         setListeners(defaultsFixers, false);
42497c478bd9Sstevel@tonic-gate         setListeners(defaultsNormal, true);
42507c478bd9Sstevel@tonic-gate         defaultsHelpMode = false;
42517c478bd9Sstevel@tonic-gate     }
42527c478bd9Sstevel@tonic-gate 
setupDefaultsHelpListeners()42537c478bd9Sstevel@tonic-gate     public void setupDefaultsHelpListeners() {
42547c478bd9Sstevel@tonic-gate         if (defaultsHelp == null) {
42557c478bd9Sstevel@tonic-gate             defaultsHelp = new Vector(10, 10);
42567c478bd9Sstevel@tonic-gate             MouseListener ml = new HelpListener();
42577c478bd9Sstevel@tonic-gate             Association a;
42587c478bd9Sstevel@tonic-gate             Object o;
42597c478bd9Sstevel@tonic-gate 
42607c478bd9Sstevel@tonic-gate             o = defaults.disableAccount;
42617c478bd9Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
42627c478bd9Sstevel@tonic-gate             defaultsHelp.addElement(a);
42637c478bd9Sstevel@tonic-gate             defaults.disableAccount.setName("GlobalLockAcct" /* NOI18N */);
42647c478bd9Sstevel@tonic-gate 
42657c478bd9Sstevel@tonic-gate             o = defaults.forcePasswordChange;
42667c478bd9Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
42677c478bd9Sstevel@tonic-gate             defaultsHelp.addElement(a);
42687c478bd9Sstevel@tonic-gate             defaults.forcePasswordChange.setName("GlobalForcePwChange"
42697c478bd9Sstevel@tonic-gate 						 /* NOI18N */);
42707c478bd9Sstevel@tonic-gate 
42717c478bd9Sstevel@tonic-gate             o = defaults.allowPostdatedTix;
42727c478bd9Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
42737c478bd9Sstevel@tonic-gate             defaultsHelp.addElement(a);
42747c478bd9Sstevel@tonic-gate             defaults.allowPostdatedTix.setName("GlobalAllowPostdated"
42757c478bd9Sstevel@tonic-gate 					       /* NOI18N */);
42767c478bd9Sstevel@tonic-gate 
42777c478bd9Sstevel@tonic-gate             o = defaults.allowForwardableTix;
42787c478bd9Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
42797c478bd9Sstevel@tonic-gate             defaultsHelp.addElement(a);
42807c478bd9Sstevel@tonic-gate             defaults.allowForwardableTix.setName("GlobalAllowForwardable"
42817c478bd9Sstevel@tonic-gate 						 /* NOI18N */);
42827c478bd9Sstevel@tonic-gate 
42837c478bd9Sstevel@tonic-gate             o = defaults.allowRenewableTix;
42847c478bd9Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
42857c478bd9Sstevel@tonic-gate             defaultsHelp.addElement(a);
42867c478bd9Sstevel@tonic-gate             defaults.allowRenewableTix.setName("GlobalAllowRenewable"
42877c478bd9Sstevel@tonic-gate 					       /* NOI18N */);
42887c478bd9Sstevel@tonic-gate 
42897c478bd9Sstevel@tonic-gate             o = defaults.allowProxiableTix;
42907c478bd9Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
42917c478bd9Sstevel@tonic-gate             defaultsHelp.addElement(a);
42927c478bd9Sstevel@tonic-gate             defaults.allowProxiableTix.setName("GlobalAllowProxiable"
42937c478bd9Sstevel@tonic-gate 					       /* NOI18N */);
42947c478bd9Sstevel@tonic-gate 
42957c478bd9Sstevel@tonic-gate             o = defaults.allowServiceTix;
42967c478bd9Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
42977c478bd9Sstevel@tonic-gate             defaultsHelp.addElement(a);
42987c478bd9Sstevel@tonic-gate             defaults.allowServiceTix.setName("GlobalAllowSvr" /* NOI18N */);
42997c478bd9Sstevel@tonic-gate 
43007c478bd9Sstevel@tonic-gate             o = defaults.allowTGTAuth;
43017c478bd9Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
43027c478bd9Sstevel@tonic-gate             defaultsHelp.addElement(a);
43037c478bd9Sstevel@tonic-gate             defaults.allowTGTAuth.setName("GlobalAllowTGT" /* NOI18N */);
43047c478bd9Sstevel@tonic-gate 
43057c478bd9Sstevel@tonic-gate             o = defaults.allowDupAuth;
43067c478bd9Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
43077c478bd9Sstevel@tonic-gate             defaultsHelp.addElement(a);
43087c478bd9Sstevel@tonic-gate             defaults.allowDupAuth.setName("GlobalAllowDupAuth" /* NOI18N */);
43097c478bd9Sstevel@tonic-gate 
43107c478bd9Sstevel@tonic-gate             o = defaults.requirePreauth;
43117c478bd9Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
43127c478bd9Sstevel@tonic-gate             defaultsHelp.addElement(a);
43137c478bd9Sstevel@tonic-gate             defaults.requirePreauth.setName("GlobalRequirePreAuth"
43147c478bd9Sstevel@tonic-gate 					    /* NOI18N */);
43157c478bd9Sstevel@tonic-gate 
43167c478bd9Sstevel@tonic-gate             o = defaults.requireHWAuth;
43177c478bd9Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
43187c478bd9Sstevel@tonic-gate             defaultsHelp.addElement(a);
43197c478bd9Sstevel@tonic-gate             defaults.requireHWAuth.setName("GlobalRequireHwPreAuth"
43207c478bd9Sstevel@tonic-gate 					   /* NOI18N */);
43217c478bd9Sstevel@tonic-gate 
43227c478bd9Sstevel@tonic-gate             o = defaults.serverSide;
43237c478bd9Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
43247c478bd9Sstevel@tonic-gate             defaultsHelp.addElement(a);
43257c478bd9Sstevel@tonic-gate             defaults.serverSide.setName("GlDefServerSide" /* NOI18N */);
43267c478bd9Sstevel@tonic-gate 
43277c478bd9Sstevel@tonic-gate             o = defaults.maxTicketRenewableLife;
43287c478bd9Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
43297c478bd9Sstevel@tonic-gate             defaultsHelp.addElement(a);
43307c478bd9Sstevel@tonic-gate             defaults.maxTicketRenewableLife.setName("GlDefRenewableLife"
43317c478bd9Sstevel@tonic-gate 						    /* NOI18N */);
43327c478bd9Sstevel@tonic-gate 
43337c478bd9Sstevel@tonic-gate             o = defaults.maxTicketRenewableLifeLabel;
43347c478bd9Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
43357c478bd9Sstevel@tonic-gate             defaultsHelp.addElement(a);
43367c478bd9Sstevel@tonic-gate             defaults.maxTicketRenewableLifeLabel.setName("GlDefRenewableLife"
43377c478bd9Sstevel@tonic-gate 							 /* NOI18N */);
43387c478bd9Sstevel@tonic-gate 
43397c478bd9Sstevel@tonic-gate             o = defaults.maxTicketLife;
43407c478bd9Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
43417c478bd9Sstevel@tonic-gate             defaultsHelp.addElement(a);
43427c478bd9Sstevel@tonic-gate             defaults.maxTicketLife.setName("GlDefLife" /* NOI18N */);
43437c478bd9Sstevel@tonic-gate 
43447c478bd9Sstevel@tonic-gate             o = defaults.maxTicketLifeLabel;
43457c478bd9Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
43467c478bd9Sstevel@tonic-gate             defaultsHelp.addElement(a);
43477c478bd9Sstevel@tonic-gate             defaults.maxTicketLifeLabel.setName("GlDefLife" /* NOI18N */);
43487c478bd9Sstevel@tonic-gate 
43497c478bd9Sstevel@tonic-gate             o = defaults.accountExpiryDate;
43507c478bd9Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
43517c478bd9Sstevel@tonic-gate             defaultsHelp.addElement(a);
43527c478bd9Sstevel@tonic-gate             defaults.accountExpiryDate.setName("GlDefExpiry" /* NOI18N */);
43537c478bd9Sstevel@tonic-gate 
43547c478bd9Sstevel@tonic-gate             o = defaults.accountExpiryDateLabel;
43557c478bd9Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
43567c478bd9Sstevel@tonic-gate             defaultsHelp.addElement(a);
43577c478bd9Sstevel@tonic-gate             defaults.accountExpiryDateLabel.setName("GlDefExpiry" /* NOI18N */);
43587c478bd9Sstevel@tonic-gate 
43597c478bd9Sstevel@tonic-gate             o = defaults.showLists;
43607c478bd9Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
43617c478bd9Sstevel@tonic-gate             defaultsHelp.addElement(a);
43627c478bd9Sstevel@tonic-gate             defaults.showLists.setName("GlDefShowLists" /* NOI18N */);
43637c478bd9Sstevel@tonic-gate 
43647c478bd9Sstevel@tonic-gate             o = defaults.staticLists;
43657c478bd9Sstevel@tonic-gate             a = new Association(o, ml, CHECKBOX_MOUSE);
43667c478bd9Sstevel@tonic-gate             defaultsHelp.addElement(a);
43677c478bd9Sstevel@tonic-gate             defaults.staticLists.setName("GlDefStaticLists" /* NOI18N */);
43687c478bd9Sstevel@tonic-gate 
43697c478bd9Sstevel@tonic-gate             o = defaults.cacheTime;
43707c478bd9Sstevel@tonic-gate             a = new Association(o, ml, TEXTFIELD_MOUSE);
43717c478bd9Sstevel@tonic-gate             defaultsHelp.addElement(a);
43727c478bd9Sstevel@tonic-gate             defaults.cacheTime.setName("GlDefCacheTime" /* NOI18N */);
43737c478bd9Sstevel@tonic-gate 
43747c478bd9Sstevel@tonic-gate             o = defaults.cacheTimeLabel;
43757c478bd9Sstevel@tonic-gate             a = new Association(o, ml, LABEL_MOUSE);
43767c478bd9Sstevel@tonic-gate             defaultsHelp.addElement(a);
43777c478bd9Sstevel@tonic-gate             defaults.cacheTimeLabel.setName("GlDefCacheTime" /* NOI18N */);
43787c478bd9Sstevel@tonic-gate 
43797c478bd9Sstevel@tonic-gate             o = defaults.saveButton;
43807c478bd9Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
43817c478bd9Sstevel@tonic-gate             defaultsHelp.addElement(a);
43827c478bd9Sstevel@tonic-gate             defaults.saveButton.setName("GlobalSave" /* NOI18N */);
43837c478bd9Sstevel@tonic-gate 
43847c478bd9Sstevel@tonic-gate             o = defaults.applyButton;
43857c478bd9Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
43867c478bd9Sstevel@tonic-gate             defaultsHelp.addElement(a);
43877c478bd9Sstevel@tonic-gate             defaults.applyButton.setName("GlobalApply" /* NOI18N */);
43887c478bd9Sstevel@tonic-gate 
43897c478bd9Sstevel@tonic-gate             o = defaults.cancelButton;
43907c478bd9Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
43917c478bd9Sstevel@tonic-gate             defaultsHelp.addElement(a);
43927c478bd9Sstevel@tonic-gate             defaults.cancelButton.setName("GlobalCancel" /* NOI18N */);
43937c478bd9Sstevel@tonic-gate 
43947c478bd9Sstevel@tonic-gate             o = defaults.dateMoreButton;
43957c478bd9Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
43967c478bd9Sstevel@tonic-gate             defaultsHelp.addElement(a);
43977c478bd9Sstevel@tonic-gate             defaults.dateMoreButton.setName("DateHelperButton" /* NOI18N */);
43987c478bd9Sstevel@tonic-gate 
43997c478bd9Sstevel@tonic-gate             o = defaults.lifeMoreButton;
44007c478bd9Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
44017c478bd9Sstevel@tonic-gate             defaultsHelp.addElement(a);
44027c478bd9Sstevel@tonic-gate             defaults.lifeMoreButton.setName("DurationHelperButton"
44037c478bd9Sstevel@tonic-gate 					    /* NOI18N */);
44047c478bd9Sstevel@tonic-gate 
44057c478bd9Sstevel@tonic-gate             o = defaults.renewalMoreButton;
44067c478bd9Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
44077c478bd9Sstevel@tonic-gate             defaultsHelp.addElement(a);
44087c478bd9Sstevel@tonic-gate             defaults.renewalMoreButton.setName("DurationHelperButton"
44097c478bd9Sstevel@tonic-gate 					       /* NOI18N */);
44107c478bd9Sstevel@tonic-gate 
44117c478bd9Sstevel@tonic-gate             o = defaults.cacheMoreButton;
44127c478bd9Sstevel@tonic-gate             a = new Association(o, ml, BUTTON_MOUSE);
44137c478bd9Sstevel@tonic-gate             defaultsHelp.addElement(a);
44147c478bd9Sstevel@tonic-gate             defaults.cacheMoreButton.setName("DurationHelperButton"
44157c478bd9Sstevel@tonic-gate 					     /* NOI18N */);
44167c478bd9Sstevel@tonic-gate 
44177c478bd9Sstevel@tonic-gate             setupDefaultsHelpFlagTogglers();
44187c478bd9Sstevel@tonic-gate         }
44197c478bd9Sstevel@tonic-gate 
44207c478bd9Sstevel@tonic-gate         setListeners(defaultsNormal, false);
44217c478bd9Sstevel@tonic-gate         setListeners(defaultsHelp, true);
44227c478bd9Sstevel@tonic-gate         setupDefaultsHelpFixers();
44237c478bd9Sstevel@tonic-gate         defaultsHelpMode = true;
44247c478bd9Sstevel@tonic-gate     }
44257c478bd9Sstevel@tonic-gate 
44267c478bd9Sstevel@tonic-gate     /**
44277c478bd9Sstevel@tonic-gate      * Helper method to setupDefaultsHelpListeners. Should be called from
44287c478bd9Sstevel@tonic-gate      * only from there.
44297c478bd9Sstevel@tonic-gate      */
setupDefaultsHelpFlagTogglers()44307c478bd9Sstevel@tonic-gate     private void 	setupDefaultsHelpFlagTogglers() {
44317c478bd9Sstevel@tonic-gate 
44327c478bd9Sstevel@tonic-gate         if (defaultsHelp == null)
44337c478bd9Sstevel@tonic-gate             return;
44347c478bd9Sstevel@tonic-gate 
44357c478bd9Sstevel@tonic-gate         CheckboxToggler ml = new CheckboxToggler();
44367c478bd9Sstevel@tonic-gate         Object o;
44377c478bd9Sstevel@tonic-gate         Association a;
44387c478bd9Sstevel@tonic-gate 
44397c478bd9Sstevel@tonic-gate         o = defaults.disableAccount;
44407c478bd9Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
44417c478bd9Sstevel@tonic-gate         defaultsHelp.addElement(a);
44427c478bd9Sstevel@tonic-gate 
44437c478bd9Sstevel@tonic-gate         o = defaults.forcePasswordChange;
44447c478bd9Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
44457c478bd9Sstevel@tonic-gate         defaultsHelp.addElement(a);
44467c478bd9Sstevel@tonic-gate 
44477c478bd9Sstevel@tonic-gate         o = defaults.allowPostdatedTix;
44487c478bd9Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
44497c478bd9Sstevel@tonic-gate         defaultsHelp.addElement(a);
44507c478bd9Sstevel@tonic-gate 
44517c478bd9Sstevel@tonic-gate         o = defaults.allowForwardableTix;
44527c478bd9Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
44537c478bd9Sstevel@tonic-gate         defaultsHelp.addElement(a);
44547c478bd9Sstevel@tonic-gate 
44557c478bd9Sstevel@tonic-gate         o = defaults.allowRenewableTix;
44567c478bd9Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
44577c478bd9Sstevel@tonic-gate         defaultsHelp.addElement(a);
44587c478bd9Sstevel@tonic-gate 
44597c478bd9Sstevel@tonic-gate         o = defaults.allowProxiableTix;
44607c478bd9Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
44617c478bd9Sstevel@tonic-gate         defaultsHelp.addElement(a);
44627c478bd9Sstevel@tonic-gate 
44637c478bd9Sstevel@tonic-gate         o = defaults.allowServiceTix;
44647c478bd9Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
44657c478bd9Sstevel@tonic-gate         defaultsHelp.addElement(a);
44667c478bd9Sstevel@tonic-gate 
44677c478bd9Sstevel@tonic-gate         o = defaults.allowTGTAuth;
44687c478bd9Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
44697c478bd9Sstevel@tonic-gate         defaultsHelp.addElement(a);
44707c478bd9Sstevel@tonic-gate 
44717c478bd9Sstevel@tonic-gate         o = defaults.allowDupAuth;
44727c478bd9Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
44737c478bd9Sstevel@tonic-gate         defaultsHelp.addElement(a);
44747c478bd9Sstevel@tonic-gate 
44757c478bd9Sstevel@tonic-gate         o = defaults.requirePreauth;
44767c478bd9Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
44777c478bd9Sstevel@tonic-gate         defaultsHelp.addElement(a);
44787c478bd9Sstevel@tonic-gate 
44797c478bd9Sstevel@tonic-gate         o = defaults.requireHWAuth;
44807c478bd9Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
44817c478bd9Sstevel@tonic-gate         defaultsHelp.addElement(a);
44827c478bd9Sstevel@tonic-gate 
44837c478bd9Sstevel@tonic-gate         o = defaults.showLists;
44847c478bd9Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
44857c478bd9Sstevel@tonic-gate         defaultsHelp.addElement(a);
44867c478bd9Sstevel@tonic-gate 
44877c478bd9Sstevel@tonic-gate         o = defaults.serverSide;
44887c478bd9Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
44897c478bd9Sstevel@tonic-gate         defaultsHelp.addElement(a);
44907c478bd9Sstevel@tonic-gate 
44917c478bd9Sstevel@tonic-gate         o = defaults.staticLists;
44927c478bd9Sstevel@tonic-gate         a = new Association(o, ml, CHECKBOX_MOUSE);
44937c478bd9Sstevel@tonic-gate         defaultsHelp.addElement(a);
44947c478bd9Sstevel@tonic-gate     }
44957c478bd9Sstevel@tonic-gate 
setupDefaultsHelpFixers()44967c478bd9Sstevel@tonic-gate     public void setupDefaultsHelpFixers() {
44977c478bd9Sstevel@tonic-gate         defaultsFixers = new Vector(10, 10);
44987c478bd9Sstevel@tonic-gate         Association a;
44997c478bd9Sstevel@tonic-gate         Object o;
45007c478bd9Sstevel@tonic-gate         TextFixer tf;
45017c478bd9Sstevel@tonic-gate 
45027c478bd9Sstevel@tonic-gate         o = defaults.maxTicketRenewableLife;
45037c478bd9Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
45047c478bd9Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
45057c478bd9Sstevel@tonic-gate         defaultsFixers.addElement(a);
45067c478bd9Sstevel@tonic-gate 
45077c478bd9Sstevel@tonic-gate         o = defaults.maxTicketLife;
45087c478bd9Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
45097c478bd9Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
45107c478bd9Sstevel@tonic-gate         defaultsFixers.addElement(a);
45117c478bd9Sstevel@tonic-gate 
45127c478bd9Sstevel@tonic-gate         o = defaults.accountExpiryDate;
45137c478bd9Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
45147c478bd9Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
45157c478bd9Sstevel@tonic-gate         defaultsFixers.addElement(a);
45167c478bd9Sstevel@tonic-gate 
45177c478bd9Sstevel@tonic-gate         o = defaults.cacheTime;
45187c478bd9Sstevel@tonic-gate         tf = new TextFixer((TextField)o);
45197c478bd9Sstevel@tonic-gate         a = new Association(o, tf, TEXTFIELD_KEY);
45207c478bd9Sstevel@tonic-gate         defaultsFixers.addElement(a);
45217c478bd9Sstevel@tonic-gate 
45227c478bd9Sstevel@tonic-gate         setListeners(defaultsFixers, true);
45237c478bd9Sstevel@tonic-gate     }
45247c478bd9Sstevel@tonic-gate 
45257c478bd9Sstevel@tonic-gate     /**
45267c478bd9Sstevel@tonic-gate      * Set up listeners from a vector of Associations objects
45277c478bd9Sstevel@tonic-gate      *
45287c478bd9Sstevel@tonic-gate      */
setListeners(Vector associations, boolean install)45297c478bd9Sstevel@tonic-gate     public void setListeners(Vector associations, boolean install) {
45307c478bd9Sstevel@tonic-gate         setListeners(associations, install, false);
45317c478bd9Sstevel@tonic-gate     }
45327c478bd9Sstevel@tonic-gate 
setListeners(Vector associations, boolean install, boolean loud)45337c478bd9Sstevel@tonic-gate     public void setListeners(Vector associations, boolean install, boolean loud)
45347c478bd9Sstevel@tonic-gate     {
45357c478bd9Sstevel@tonic-gate         Association a;
45367c478bd9Sstevel@tonic-gate         Button b;
45377c478bd9Sstevel@tonic-gate         TextField t;
45387c478bd9Sstevel@tonic-gate         Choice c;
45397c478bd9Sstevel@tonic-gate         Checkbox x;
45407c478bd9Sstevel@tonic-gate         Label z;
45417c478bd9Sstevel@tonic-gate         Window w;
45427c478bd9Sstevel@tonic-gate 
45437c478bd9Sstevel@tonic-gate         if (associations != null) {
45447c478bd9Sstevel@tonic-gate             for (int i = 0; i < associations.size(); i++) {
45457c478bd9Sstevel@tonic-gate                 a = (Association)associations.elementAt(i);
45467c478bd9Sstevel@tonic-gate                 int type = a.Type;
45477c478bd9Sstevel@tonic-gate                 EventListener el = a.Listener;
45487c478bd9Sstevel@tonic-gate                 if (loud) {
45497c478bd9Sstevel@tonic-gate                     Object o = a.Object;
45507c478bd9Sstevel@tonic-gate                     String flag = install ? "install" : "deinstall";
45517c478bd9Sstevel@tonic-gate                     System.out.println(flag+
45527c478bd9Sstevel@tonic-gate 				       "ing listener "+el+" on component "+o);
45537c478bd9Sstevel@tonic-gate                 }
45547c478bd9Sstevel@tonic-gate 
45557c478bd9Sstevel@tonic-gate                 switch (type) {
45567c478bd9Sstevel@tonic-gate 		case BUTTON_ACTION:
45577c478bd9Sstevel@tonic-gate                     b = (Button)a.Object;
45587c478bd9Sstevel@tonic-gate                     if (install)
45597c478bd9Sstevel@tonic-gate                         b.addActionListener((ActionListener)el);
45607c478bd9Sstevel@tonic-gate                     else
45617c478bd9Sstevel@tonic-gate                         b.removeActionListener((ActionListener)el);
45627c478bd9Sstevel@tonic-gate                     break;
45637c478bd9Sstevel@tonic-gate 
45647c478bd9Sstevel@tonic-gate 		case BUTTON_MOUSE:
45657c478bd9Sstevel@tonic-gate                     b = (Button)a.Object;
45667c478bd9Sstevel@tonic-gate                     if (install)
45677c478bd9Sstevel@tonic-gate                         b.addMouseListener((MouseListener)el);
45687c478bd9Sstevel@tonic-gate                     else
45697c478bd9Sstevel@tonic-gate                         b.removeMouseListener((MouseListener)el);
45707c478bd9Sstevel@tonic-gate                     break;
45717c478bd9Sstevel@tonic-gate 
45727c478bd9Sstevel@tonic-gate 		case TEXTFIELD_ACTION:
45737c478bd9Sstevel@tonic-gate                     t = (TextField)a.Object;
45747c478bd9Sstevel@tonic-gate                     if (install)
45757c478bd9Sstevel@tonic-gate                         t.addActionListener((ActionListener)el);
45767c478bd9Sstevel@tonic-gate                     else
45777c478bd9Sstevel@tonic-gate                         t.removeActionListener((ActionListener)el);
45787c478bd9Sstevel@tonic-gate                     break;
45797c478bd9Sstevel@tonic-gate 
45807c478bd9Sstevel@tonic-gate 		case TEXTFIELD_MOUSE:
45817c478bd9Sstevel@tonic-gate                     t = (TextField)a.Object;
45827c478bd9Sstevel@tonic-gate                     if (install)
45837c478bd9Sstevel@tonic-gate                         t.addMouseListener((MouseListener)el);
45847c478bd9Sstevel@tonic-gate                     else
45857c478bd9Sstevel@tonic-gate                         t.removeMouseListener((MouseListener)el);
45867c478bd9Sstevel@tonic-gate                     break;
45877c478bd9Sstevel@tonic-gate 
45887c478bd9Sstevel@tonic-gate 		case TEXTFIELD_KEY:
45897c478bd9Sstevel@tonic-gate                     t = (TextField)a.Object;
45907c478bd9Sstevel@tonic-gate                     if (install)
45917c478bd9Sstevel@tonic-gate                         t.addKeyListener((KeyListener)el);
45927c478bd9Sstevel@tonic-gate                     else
45937c478bd9Sstevel@tonic-gate                         t.removeKeyListener((KeyListener)el);
45947c478bd9Sstevel@tonic-gate                     break;
45957c478bd9Sstevel@tonic-gate 
45967c478bd9Sstevel@tonic-gate 		case CHOICE_ITEM:
45977c478bd9Sstevel@tonic-gate                     c = (Choice)a.Object;
45987c478bd9Sstevel@tonic-gate                     if (install)
45997c478bd9Sstevel@tonic-gate                         c.addItemListener((ItemListener)el);
46007c478bd9Sstevel@tonic-gate                     else
46017c478bd9Sstevel@tonic-gate                         c.removeItemListener((ItemListener)el);
46027c478bd9Sstevel@tonic-gate                     break;
46037c478bd9Sstevel@tonic-gate 
46047c478bd9Sstevel@tonic-gate 		case CHOICE_MOUSE:
46057c478bd9Sstevel@tonic-gate                     c = (Choice)a.Object;
46067c478bd9Sstevel@tonic-gate                     if (install)
46077c478bd9Sstevel@tonic-gate                         c.addMouseListener((MouseListener)el);
46087c478bd9Sstevel@tonic-gate                     else
46097c478bd9Sstevel@tonic-gate                         c.removeMouseListener((MouseListener)el);
46107c478bd9Sstevel@tonic-gate                     break;
46117c478bd9Sstevel@tonic-gate 
46127c478bd9Sstevel@tonic-gate 		case CHECKBOX_ITEM:
46137c478bd9Sstevel@tonic-gate                     x = (Checkbox)a.Object;
46147c478bd9Sstevel@tonic-gate                     if (install)
46157c478bd9Sstevel@tonic-gate                         x.addItemListener((ItemListener)el);
46167c478bd9Sstevel@tonic-gate                     else
46177c478bd9Sstevel@tonic-gate                         x.removeItemListener((ItemListener)el);
46187c478bd9Sstevel@tonic-gate                     break;
46197c478bd9Sstevel@tonic-gate 
46207c478bd9Sstevel@tonic-gate 		case CHECKBOX_MOUSE:
46217c478bd9Sstevel@tonic-gate                     x = (Checkbox)a.Object;
46227c478bd9Sstevel@tonic-gate                     if (install)
46237c478bd9Sstevel@tonic-gate                         x.addMouseListener((MouseListener)el);
46247c478bd9Sstevel@tonic-gate                     else
46257c478bd9Sstevel@tonic-gate                         x.removeMouseListener((MouseListener)el);
46267c478bd9Sstevel@tonic-gate                     break;
46277c478bd9Sstevel@tonic-gate 
46287c478bd9Sstevel@tonic-gate 		case LABEL_MOUSE:
46297c478bd9Sstevel@tonic-gate                     z = (Label)a.Object;
46307c478bd9Sstevel@tonic-gate                     if (install)
46317c478bd9Sstevel@tonic-gate                         z.addMouseListener((MouseListener)el);
46327c478bd9Sstevel@tonic-gate                     else
46337c478bd9Sstevel@tonic-gate                         z.removeMouseListener((MouseListener)el);
46347c478bd9Sstevel@tonic-gate                     break;
46357c478bd9Sstevel@tonic-gate 
46367c478bd9Sstevel@tonic-gate 		case WINDOW_LISTENER:
46377c478bd9Sstevel@tonic-gate                     w = (Window)a.Object;
46387c478bd9Sstevel@tonic-gate                     if (install)
46397c478bd9Sstevel@tonic-gate                         w.addWindowListener((WindowListener)el);
46407c478bd9Sstevel@tonic-gate                     else
46417c478bd9Sstevel@tonic-gate                         w.removeWindowListener((WindowListener)el);
46427c478bd9Sstevel@tonic-gate                     break;
46437c478bd9Sstevel@tonic-gate                 }
46447c478bd9Sstevel@tonic-gate             }
46457c478bd9Sstevel@tonic-gate         }
46467c478bd9Sstevel@tonic-gate     }
46477c478bd9Sstevel@tonic-gate 
46487c478bd9Sstevel@tonic-gate     /*
46497c478bd9Sstevel@tonic-gate      * About a million actions here ...
46507c478bd9Sstevel@tonic-gate      */
46517c478bd9Sstevel@tonic-gate     private class LoginOKAction implements ActionListener {
actionPerformed(ActionEvent e)46527c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
46537c478bd9Sstevel@tonic-gate             loginComplete();
46547c478bd9Sstevel@tonic-gate         }
46557c478bd9Sstevel@tonic-gate     }
46567c478bd9Sstevel@tonic-gate 
46577c478bd9Sstevel@tonic-gate     private class LoginStartOverAction implements ActionListener {
actionPerformed(ActionEvent e)46587c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
46597c478bd9Sstevel@tonic-gate             setLoginDefaults();
46607c478bd9Sstevel@tonic-gate         }
46617c478bd9Sstevel@tonic-gate     }
46627c478bd9Sstevel@tonic-gate 
46637c478bd9Sstevel@tonic-gate     private class LoginNameAction implements ActionListener {
actionPerformed(ActionEvent e)46647c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
46657c478bd9Sstevel@tonic-gate             nameComplete();
46667c478bd9Sstevel@tonic-gate         }
46677c478bd9Sstevel@tonic-gate     }
46687c478bd9Sstevel@tonic-gate 
46697c478bd9Sstevel@tonic-gate     private class LoginPassAction implements ActionListener {
actionPerformed(ActionEvent e)46707c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
46717c478bd9Sstevel@tonic-gate             loginComplete();
46727c478bd9Sstevel@tonic-gate         }
46737c478bd9Sstevel@tonic-gate     }
46747c478bd9Sstevel@tonic-gate 
46757c478bd9Sstevel@tonic-gate     private class LoginRealmAction implements ActionListener {
actionPerformed(ActionEvent e)46767c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
46777c478bd9Sstevel@tonic-gate             newRealm();
46787c478bd9Sstevel@tonic-gate         }
46797c478bd9Sstevel@tonic-gate     }
46807c478bd9Sstevel@tonic-gate 
46817c478bd9Sstevel@tonic-gate     private class LoginServerAction implements ActionListener {
actionPerformed(ActionEvent e)46827c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
46837c478bd9Sstevel@tonic-gate             newServer();
46847c478bd9Sstevel@tonic-gate         }
46857c478bd9Sstevel@tonic-gate     }
46867c478bd9Sstevel@tonic-gate 
46877c478bd9Sstevel@tonic-gate     private class MainWindowCloseAction extends WindowAdapter {
windowClosing(WindowEvent e)46887c478bd9Sstevel@tonic-gate         public void windowClosing(WindowEvent e) {
46897c478bd9Sstevel@tonic-gate             checkLogout();
46907c478bd9Sstevel@tonic-gate         }
46917c478bd9Sstevel@tonic-gate     };
46927c478bd9Sstevel@tonic-gate 
46937c478bd9Sstevel@tonic-gate     private class PrListPatternAction implements ActionListener {
actionPerformed(ActionEvent e)46947c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
46957c478bd9Sstevel@tonic-gate             prPatternComplete();
46967c478bd9Sstevel@tonic-gate         }
46977c478bd9Sstevel@tonic-gate     }
46987c478bd9Sstevel@tonic-gate 
46997c478bd9Sstevel@tonic-gate     private class PrListClearAction implements ActionListener {
actionPerformed(ActionEvent e)47007c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
47017c478bd9Sstevel@tonic-gate             prPatternClear();
47027c478bd9Sstevel@tonic-gate         }
47037c478bd9Sstevel@tonic-gate     }
47047c478bd9Sstevel@tonic-gate 
47057c478bd9Sstevel@tonic-gate     private class PrListModifyAction implements ActionListener {
actionPerformed(ActionEvent e)47067c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
47077c478bd9Sstevel@tonic-gate             prModify();
47087c478bd9Sstevel@tonic-gate         }
47097c478bd9Sstevel@tonic-gate     }
47107c478bd9Sstevel@tonic-gate 
47117c478bd9Sstevel@tonic-gate     private class PrListAddAction implements ActionListener {
actionPerformed(ActionEvent e)47127c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
47137c478bd9Sstevel@tonic-gate             prAdd();
47147c478bd9Sstevel@tonic-gate         }
47157c478bd9Sstevel@tonic-gate     }
47167c478bd9Sstevel@tonic-gate 
47177c478bd9Sstevel@tonic-gate     private class PrListDeleteAction implements ActionListener {
actionPerformed(ActionEvent e)47187c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
47197c478bd9Sstevel@tonic-gate             prDelete();
47207c478bd9Sstevel@tonic-gate         }
47217c478bd9Sstevel@tonic-gate     }
47227c478bd9Sstevel@tonic-gate 
47237c478bd9Sstevel@tonic-gate     private class PrListDuplicateAction implements ActionListener {
actionPerformed(ActionEvent e)47247c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
47257c478bd9Sstevel@tonic-gate             prDuplicate();
47267c478bd9Sstevel@tonic-gate         }
47277c478bd9Sstevel@tonic-gate     }
47287c478bd9Sstevel@tonic-gate 
47297c478bd9Sstevel@tonic-gate     private class PrCommentsAction implements ActionListener {
actionPerformed(ActionEvent e)47307c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
47317c478bd9Sstevel@tonic-gate             setPrComments();
47327c478bd9Sstevel@tonic-gate             prSetNeedSave();
47337c478bd9Sstevel@tonic-gate         }
47347c478bd9Sstevel@tonic-gate     }
47357c478bd9Sstevel@tonic-gate 
47367c478bd9Sstevel@tonic-gate     private class PrPolicyAction implements ItemListener {
itemStateChanged(ItemEvent e)47377c478bd9Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
47387c478bd9Sstevel@tonic-gate             setPrPolicy();
47397c478bd9Sstevel@tonic-gate             prSetNeedSave();
47407c478bd9Sstevel@tonic-gate         }
47417c478bd9Sstevel@tonic-gate     }
47427c478bd9Sstevel@tonic-gate 
47437c478bd9Sstevel@tonic-gate     private class PrPasswordAction implements ActionListener {
actionPerformed(ActionEvent e)47447c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
47457c478bd9Sstevel@tonic-gate             setPrPassword(!prin.isNew);
47467c478bd9Sstevel@tonic-gate             prSetNeedSave();
47477c478bd9Sstevel@tonic-gate         }
47487c478bd9Sstevel@tonic-gate     }
47497c478bd9Sstevel@tonic-gate 
47507c478bd9Sstevel@tonic-gate     private class PrRandomPwAction implements ActionListener {
actionPerformed(ActionEvent e)47517c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
47527c478bd9Sstevel@tonic-gate             genRandomPassword();
47537c478bd9Sstevel@tonic-gate             prSetNeedSave();
47547c478bd9Sstevel@tonic-gate         }
47557c478bd9Sstevel@tonic-gate     }
47567c478bd9Sstevel@tonic-gate 
475745526e97Ssemery     private class EncListAction implements ActionListener {
actionPerformed(ActionEvent e)475845526e97Ssemery         public void actionPerformed(ActionEvent e) {
475945526e97Ssemery             setEncType();
476045526e97Ssemery             prSetNeedSave();
476145526e97Ssemery         }
476245526e97Ssemery     }
476345526e97Ssemery 
47647c478bd9Sstevel@tonic-gate     private class PrExpiryAction implements ActionListener {
actionPerformed(ActionEvent e)47657c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
47667c478bd9Sstevel@tonic-gate             setPrExpiry();
47677c478bd9Sstevel@tonic-gate             prSetNeedSave();
47687c478bd9Sstevel@tonic-gate         }
47697c478bd9Sstevel@tonic-gate     }
47707c478bd9Sstevel@tonic-gate 
47717c478bd9Sstevel@tonic-gate     private class PrSaveAction implements ActionListener {
actionPerformed(ActionEvent e)47727c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
47737c478bd9Sstevel@tonic-gate             prSave();
47747c478bd9Sstevel@tonic-gate         }
47757c478bd9Sstevel@tonic-gate     }
47767c478bd9Sstevel@tonic-gate 
47777c478bd9Sstevel@tonic-gate     private class PrCancelAction implements ActionListener {
actionPerformed(ActionEvent e)47787c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
47797c478bd9Sstevel@tonic-gate             prCancel();
47807c478bd9Sstevel@tonic-gate         }
47817c478bd9Sstevel@tonic-gate     }
47827c478bd9Sstevel@tonic-gate 
47837c478bd9Sstevel@tonic-gate     private class PrBasicPreviousAction implements ActionListener {
actionPerformed(ActionEvent e)47847c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
47857c478bd9Sstevel@tonic-gate             prBasicPrevious();
47867c478bd9Sstevel@tonic-gate         }
47877c478bd9Sstevel@tonic-gate     }
47887c478bd9Sstevel@tonic-gate 
47897c478bd9Sstevel@tonic-gate     private class PrBasicNextAction implements ActionListener {
actionPerformed(ActionEvent e)47907c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
47917c478bd9Sstevel@tonic-gate             prBasicNext();
47927c478bd9Sstevel@tonic-gate         }
47937c478bd9Sstevel@tonic-gate     }
47947c478bd9Sstevel@tonic-gate 
47957c478bd9Sstevel@tonic-gate     private class PrPwExpiryAction implements ActionListener {
actionPerformed(ActionEvent e)47967c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
47977c478bd9Sstevel@tonic-gate             setPrPwExpiry();
47987c478bd9Sstevel@tonic-gate             prSetNeedSave();
47997c478bd9Sstevel@tonic-gate         }
48007c478bd9Sstevel@tonic-gate     }
48017c478bd9Sstevel@tonic-gate 
48027c478bd9Sstevel@tonic-gate     private class PrKvnoAction implements ActionListener {
actionPerformed(ActionEvent e)48037c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
48047c478bd9Sstevel@tonic-gate             setPrKvno();
48057c478bd9Sstevel@tonic-gate             prSetNeedSave();
48067c478bd9Sstevel@tonic-gate         }
48077c478bd9Sstevel@tonic-gate     }
48087c478bd9Sstevel@tonic-gate 
48097c478bd9Sstevel@tonic-gate     private class PrMaxLifetimeAction implements ActionListener {
actionPerformed(ActionEvent e)48107c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
48117c478bd9Sstevel@tonic-gate             setPrMaxlife();
48127c478bd9Sstevel@tonic-gate             prSetNeedSave();
48137c478bd9Sstevel@tonic-gate         }
48147c478bd9Sstevel@tonic-gate     }
48157c478bd9Sstevel@tonic-gate 
48167c478bd9Sstevel@tonic-gate     private class PrMaxRenewalAction implements ActionListener {
actionPerformed(ActionEvent e)48177c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
48187c478bd9Sstevel@tonic-gate             setPrMaxrenew();
48197c478bd9Sstevel@tonic-gate             prSetNeedSave();
48207c478bd9Sstevel@tonic-gate         }
48217c478bd9Sstevel@tonic-gate     }
48227c478bd9Sstevel@tonic-gate 
48237c478bd9Sstevel@tonic-gate     private class PrDetailPreviousAction implements ActionListener {
actionPerformed(ActionEvent e)48247c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
48257c478bd9Sstevel@tonic-gate             prDetailPrevious();
48267c478bd9Sstevel@tonic-gate         }
48277c478bd9Sstevel@tonic-gate     }
48287c478bd9Sstevel@tonic-gate 
48297c478bd9Sstevel@tonic-gate     private class PrDetailNextAction implements ActionListener {
actionPerformed(ActionEvent e)48307c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
48317c478bd9Sstevel@tonic-gate             prDetailNext();
48327c478bd9Sstevel@tonic-gate         }
48337c478bd9Sstevel@tonic-gate     }
48347c478bd9Sstevel@tonic-gate 
48357c478bd9Sstevel@tonic-gate     private class PrFlagsPreviousAction implements ActionListener {
actionPerformed(ActionEvent e)48367c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
48377c478bd9Sstevel@tonic-gate             prFlagsPrevious();
48387c478bd9Sstevel@tonic-gate         }
48397c478bd9Sstevel@tonic-gate     }
48407c478bd9Sstevel@tonic-gate 
48417c478bd9Sstevel@tonic-gate     private class PrLockAcctAction implements ItemListener {
itemStateChanged(ItemEvent e)48427c478bd9Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
48437c478bd9Sstevel@tonic-gate             setPrFlag(Flags.DISALLOW_ALL_TIX);
48447c478bd9Sstevel@tonic-gate             prSetNeedSave();
48457c478bd9Sstevel@tonic-gate         }
48467c478bd9Sstevel@tonic-gate     }
48477c478bd9Sstevel@tonic-gate 
48487c478bd9Sstevel@tonic-gate     private class PrForcePwChangeAction implements ItemListener {
itemStateChanged(ItemEvent e)48497c478bd9Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
48507c478bd9Sstevel@tonic-gate             setPrFlag(Flags.REQUIRES_PWCHANGE);
48517c478bd9Sstevel@tonic-gate             prSetNeedSave();
48527c478bd9Sstevel@tonic-gate         }
48537c478bd9Sstevel@tonic-gate     }
48547c478bd9Sstevel@tonic-gate 
48557c478bd9Sstevel@tonic-gate     private class PrAllowPostdatedAction implements ItemListener {
itemStateChanged(ItemEvent e)48567c478bd9Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
48577c478bd9Sstevel@tonic-gate             setPrFlag(Flags.DISALLOW_POSTDATED);
48587c478bd9Sstevel@tonic-gate             prSetNeedSave();
48597c478bd9Sstevel@tonic-gate         }
48607c478bd9Sstevel@tonic-gate     }
48617c478bd9Sstevel@tonic-gate 
48627c478bd9Sstevel@tonic-gate     private class PrAllowForwardableAction implements ItemListener {
itemStateChanged(ItemEvent e)48637c478bd9Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
48647c478bd9Sstevel@tonic-gate             setPrFlag(Flags.DISALLOW_FORWARDABLE);
48657c478bd9Sstevel@tonic-gate             prSetNeedSave();
48667c478bd9Sstevel@tonic-gate         }
48677c478bd9Sstevel@tonic-gate     }
48687c478bd9Sstevel@tonic-gate 
48697c478bd9Sstevel@tonic-gate     private class PrAllowRenewableAction implements ItemListener {
itemStateChanged(ItemEvent e)48707c478bd9Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
48717c478bd9Sstevel@tonic-gate             setPrFlag(Flags.DISALLOW_RENEWABLE);
48727c478bd9Sstevel@tonic-gate             prSetNeedSave();
48737c478bd9Sstevel@tonic-gate         }
48747c478bd9Sstevel@tonic-gate     }
48757c478bd9Sstevel@tonic-gate 
48767c478bd9Sstevel@tonic-gate     private class PrAllowProxiableAction implements ItemListener {
itemStateChanged(ItemEvent e)48777c478bd9Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
48787c478bd9Sstevel@tonic-gate             setPrFlag(Flags.DISALLOW_PROXIABLE);
48797c478bd9Sstevel@tonic-gate             prSetNeedSave();
48807c478bd9Sstevel@tonic-gate         }
48817c478bd9Sstevel@tonic-gate     }
48827c478bd9Sstevel@tonic-gate 
48837c478bd9Sstevel@tonic-gate     private class PrAllowSvrAction implements ItemListener {
itemStateChanged(ItemEvent e)48847c478bd9Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
48857c478bd9Sstevel@tonic-gate             setPrFlag(Flags.DISALLOW_SVR);
48867c478bd9Sstevel@tonic-gate             prSetNeedSave();
48877c478bd9Sstevel@tonic-gate         }
48887c478bd9Sstevel@tonic-gate     }
48897c478bd9Sstevel@tonic-gate 
48907c478bd9Sstevel@tonic-gate     private class PrAllowTGTAction implements ItemListener {
itemStateChanged(ItemEvent e)48917c478bd9Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
48927c478bd9Sstevel@tonic-gate             setPrFlag(Flags.DISALLOW_TGT_BASED);
48937c478bd9Sstevel@tonic-gate             prSetNeedSave();
48947c478bd9Sstevel@tonic-gate         }
48957c478bd9Sstevel@tonic-gate     }
48967c478bd9Sstevel@tonic-gate 
48977c478bd9Sstevel@tonic-gate     private class PrAllowDupAuthAction implements ItemListener {
itemStateChanged(ItemEvent e)48987c478bd9Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
48997c478bd9Sstevel@tonic-gate             setPrFlag(Flags.DISALLOW_DUP_SKEY);
49007c478bd9Sstevel@tonic-gate             prSetNeedSave();
49017c478bd9Sstevel@tonic-gate         }
49027c478bd9Sstevel@tonic-gate     }
49037c478bd9Sstevel@tonic-gate 
49047c478bd9Sstevel@tonic-gate     private class PrRequirePreAuthAction implements ItemListener {
itemStateChanged(ItemEvent e)49057c478bd9Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
49067c478bd9Sstevel@tonic-gate             setPrFlag(Flags.REQUIRE_PRE_AUTH);
49077c478bd9Sstevel@tonic-gate             prSetNeedSave();
49087c478bd9Sstevel@tonic-gate         }
49097c478bd9Sstevel@tonic-gate     }
49107c478bd9Sstevel@tonic-gate 
49117c478bd9Sstevel@tonic-gate     private class PrRequireHwPreAuthAction implements ItemListener {
itemStateChanged(ItemEvent e)49127c478bd9Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
49137c478bd9Sstevel@tonic-gate             setPrFlag(Flags.REQUIRE_HW_AUTH);
49147c478bd9Sstevel@tonic-gate             prSetNeedSave();
49157c478bd9Sstevel@tonic-gate         }
49167c478bd9Sstevel@tonic-gate     }
49177c478bd9Sstevel@tonic-gate 
49187c478bd9Sstevel@tonic-gate     private class PrFlagsNextAction implements ActionListener {
actionPerformed(ActionEvent e)49197c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
49207c478bd9Sstevel@tonic-gate             prFlagsDone();
49217c478bd9Sstevel@tonic-gate         }
49227c478bd9Sstevel@tonic-gate     }
49237c478bd9Sstevel@tonic-gate 
49247c478bd9Sstevel@tonic-gate     private class PoListPatternAction implements ActionListener {
actionPerformed(ActionEvent e)49257c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
49267c478bd9Sstevel@tonic-gate             poPatternComplete();
49277c478bd9Sstevel@tonic-gate         }
49287c478bd9Sstevel@tonic-gate     }
49297c478bd9Sstevel@tonic-gate 
49307c478bd9Sstevel@tonic-gate     private class PoListClearAction implements ActionListener {
actionPerformed(ActionEvent e)49317c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
49327c478bd9Sstevel@tonic-gate             poPatternClear();
49337c478bd9Sstevel@tonic-gate         }
49347c478bd9Sstevel@tonic-gate     }
49357c478bd9Sstevel@tonic-gate 
49367c478bd9Sstevel@tonic-gate     private class PoListModifyAction implements ActionListener {
actionPerformed(ActionEvent e)49377c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
49387c478bd9Sstevel@tonic-gate             poSelected();
49397c478bd9Sstevel@tonic-gate         }
49407c478bd9Sstevel@tonic-gate     }
49417c478bd9Sstevel@tonic-gate 
49427c478bd9Sstevel@tonic-gate     private class PoListAddAction implements ActionListener {
actionPerformed(ActionEvent e)49437c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
49447c478bd9Sstevel@tonic-gate             poAdd();
49457c478bd9Sstevel@tonic-gate         }
49467c478bd9Sstevel@tonic-gate     }
49477c478bd9Sstevel@tonic-gate 
49487c478bd9Sstevel@tonic-gate     private class PoListDeleteAction implements ActionListener {
actionPerformed(ActionEvent e)49497c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
49507c478bd9Sstevel@tonic-gate             poDelete();
49517c478bd9Sstevel@tonic-gate         }
49527c478bd9Sstevel@tonic-gate     }
49537c478bd9Sstevel@tonic-gate 
49547c478bd9Sstevel@tonic-gate     private class PoListDuplicateAction implements ActionListener {
actionPerformed(ActionEvent e)49557c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
49567c478bd9Sstevel@tonic-gate             poDuplicate();
49577c478bd9Sstevel@tonic-gate         }
49587c478bd9Sstevel@tonic-gate     }
49597c478bd9Sstevel@tonic-gate 
49607c478bd9Sstevel@tonic-gate     private class PoMinPwLengthAction implements ItemListener {
itemStateChanged(ItemEvent e)49617c478bd9Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
49627c478bd9Sstevel@tonic-gate             setPolPwLength();
49637c478bd9Sstevel@tonic-gate             poSetNeedSave();
49647c478bd9Sstevel@tonic-gate         }
49657c478bd9Sstevel@tonic-gate     }
49667c478bd9Sstevel@tonic-gate 
49677c478bd9Sstevel@tonic-gate     private class PoMinPwClassAction implements ItemListener {
itemStateChanged(ItemEvent e)49687c478bd9Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
49697c478bd9Sstevel@tonic-gate             setPolPwClasses();
49707c478bd9Sstevel@tonic-gate             poSetNeedSave();
49717c478bd9Sstevel@tonic-gate         }
49727c478bd9Sstevel@tonic-gate     }
49737c478bd9Sstevel@tonic-gate 
49747c478bd9Sstevel@tonic-gate     private class PoSavedPasswordsAction implements ItemListener {
itemStateChanged(ItemEvent e)49757c478bd9Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
49767c478bd9Sstevel@tonic-gate             setPolPwHistory();
49777c478bd9Sstevel@tonic-gate             poSetNeedSave();
49787c478bd9Sstevel@tonic-gate         }
49797c478bd9Sstevel@tonic-gate     }
49807c478bd9Sstevel@tonic-gate 
49817c478bd9Sstevel@tonic-gate     private class PoMinTicketLifetimeAction implements ActionListener {
actionPerformed(ActionEvent e)49827c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
49837c478bd9Sstevel@tonic-gate             setPolMinlife();
49847c478bd9Sstevel@tonic-gate             poSetNeedSave();
49857c478bd9Sstevel@tonic-gate         }
49867c478bd9Sstevel@tonic-gate     }
49877c478bd9Sstevel@tonic-gate 
49887c478bd9Sstevel@tonic-gate     private class PoMaxTicketLifetimeAction implements ActionListener {
actionPerformed(ActionEvent e)49897c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
49907c478bd9Sstevel@tonic-gate             setPolMaxlife();
49917c478bd9Sstevel@tonic-gate             poSetNeedSave();
49927c478bd9Sstevel@tonic-gate         }
49937c478bd9Sstevel@tonic-gate     }
49947c478bd9Sstevel@tonic-gate 
49957c478bd9Sstevel@tonic-gate     private class PoSaveAction implements ActionListener {
actionPerformed(ActionEvent e)49967c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
49977c478bd9Sstevel@tonic-gate             poSave();
49987c478bd9Sstevel@tonic-gate         }
49997c478bd9Sstevel@tonic-gate     }
50007c478bd9Sstevel@tonic-gate 
50017c478bd9Sstevel@tonic-gate     private class PoCancelAction implements ActionListener {
actionPerformed(ActionEvent e)50027c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
50037c478bd9Sstevel@tonic-gate             poCancel();
50047c478bd9Sstevel@tonic-gate         }
50057c478bd9Sstevel@tonic-gate     }
50067c478bd9Sstevel@tonic-gate 
50077c478bd9Sstevel@tonic-gate     private class PoPreviousAction implements ActionListener {
actionPerformed(ActionEvent e)50087c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
50097c478bd9Sstevel@tonic-gate             polPrevious();
50107c478bd9Sstevel@tonic-gate         }
50117c478bd9Sstevel@tonic-gate     }
50127c478bd9Sstevel@tonic-gate 
50137c478bd9Sstevel@tonic-gate     private class PoDoneAction implements ActionListener {
actionPerformed(ActionEvent e)50147c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
50157c478bd9Sstevel@tonic-gate             polDone();
50167c478bd9Sstevel@tonic-gate         }
50177c478bd9Sstevel@tonic-gate     }
50187c478bd9Sstevel@tonic-gate 
50197c478bd9Sstevel@tonic-gate     private class GlobalLockAcctAction implements ItemListener {
itemStateChanged(ItemEvent e)50207c478bd9Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
50217c478bd9Sstevel@tonic-gate             setGlobalFlag(Flags.DISALLOW_ALL_TIX);
50227c478bd9Sstevel@tonic-gate         }
50237c478bd9Sstevel@tonic-gate     }
50247c478bd9Sstevel@tonic-gate 
50257c478bd9Sstevel@tonic-gate     private class GlobalForcePwChangeAction implements ItemListener {
itemStateChanged(ItemEvent e)50267c478bd9Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
50277c478bd9Sstevel@tonic-gate             setGlobalFlag(Flags.REQUIRES_PWCHANGE);
50287c478bd9Sstevel@tonic-gate         }
50297c478bd9Sstevel@tonic-gate     }
50307c478bd9Sstevel@tonic-gate 
50317c478bd9Sstevel@tonic-gate     private class GlobalAllowPostdatedAction implements ItemListener {
itemStateChanged(ItemEvent e)50327c478bd9Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
50337c478bd9Sstevel@tonic-gate             setGlobalFlag(Flags.DISALLOW_POSTDATED);
50347c478bd9Sstevel@tonic-gate         }
50357c478bd9Sstevel@tonic-gate     }
50367c478bd9Sstevel@tonic-gate 
50377c478bd9Sstevel@tonic-gate     private class GlobalAllowForwardableAction implements ItemListener {
itemStateChanged(ItemEvent e)50387c478bd9Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
50397c478bd9Sstevel@tonic-gate             setGlobalFlag(Flags.DISALLOW_FORWARDABLE);
50407c478bd9Sstevel@tonic-gate         }
50417c478bd9Sstevel@tonic-gate     }
50427c478bd9Sstevel@tonic-gate 
50437c478bd9Sstevel@tonic-gate     private class GlobalAllowRenewableAction implements ItemListener {
itemStateChanged(ItemEvent e)50447c478bd9Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
50457c478bd9Sstevel@tonic-gate             setGlobalFlag(Flags.DISALLOW_RENEWABLE);
50467c478bd9Sstevel@tonic-gate         }
50477c478bd9Sstevel@tonic-gate     }
50487c478bd9Sstevel@tonic-gate 
50497c478bd9Sstevel@tonic-gate     private class GlobalAllowProxiableAction implements ItemListener {
itemStateChanged(ItemEvent e)50507c478bd9Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
50517c478bd9Sstevel@tonic-gate             setGlobalFlag(Flags.DISALLOW_PROXIABLE);
50527c478bd9Sstevel@tonic-gate         }
50537c478bd9Sstevel@tonic-gate     }
50547c478bd9Sstevel@tonic-gate 
50557c478bd9Sstevel@tonic-gate     private class GlobalAllowSvrAction implements ItemListener {
itemStateChanged(ItemEvent e)50567c478bd9Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
50577c478bd9Sstevel@tonic-gate             setGlobalFlag(Flags.DISALLOW_SVR);
50587c478bd9Sstevel@tonic-gate         }
50597c478bd9Sstevel@tonic-gate     }
50607c478bd9Sstevel@tonic-gate 
50617c478bd9Sstevel@tonic-gate     private class GlobalAllowTGTAction implements ItemListener {
itemStateChanged(ItemEvent e)50627c478bd9Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
50637c478bd9Sstevel@tonic-gate             setGlobalFlag(Flags.DISALLOW_TGT_BASED);
50647c478bd9Sstevel@tonic-gate         }
50657c478bd9Sstevel@tonic-gate     }
50667c478bd9Sstevel@tonic-gate 
50677c478bd9Sstevel@tonic-gate     private class GlobalAllowDupAuthAction implements ItemListener {
itemStateChanged(ItemEvent e)50687c478bd9Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
50697c478bd9Sstevel@tonic-gate             setGlobalFlag(Flags.DISALLOW_DUP_SKEY);
50707c478bd9Sstevel@tonic-gate         }
50717c478bd9Sstevel@tonic-gate     }
50727c478bd9Sstevel@tonic-gate 
50737c478bd9Sstevel@tonic-gate     private class GlobalRequirePreAuthAction implements ItemListener {
itemStateChanged(ItemEvent e)50747c478bd9Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
50757c478bd9Sstevel@tonic-gate             setGlobalFlag(Flags.REQUIRE_PRE_AUTH);
50767c478bd9Sstevel@tonic-gate         }
50777c478bd9Sstevel@tonic-gate     }
50787c478bd9Sstevel@tonic-gate 
50797c478bd9Sstevel@tonic-gate     private class GlobalRequireHwPreAuthAction implements ItemListener {
itemStateChanged(ItemEvent e)50807c478bd9Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
50817c478bd9Sstevel@tonic-gate             setGlobalFlag(Flags.REQUIRE_HW_AUTH);
50827c478bd9Sstevel@tonic-gate         }
50837c478bd9Sstevel@tonic-gate     }
50847c478bd9Sstevel@tonic-gate 
50857c478bd9Sstevel@tonic-gate     private class GlobalDefaultServerSideAction implements ItemListener {
itemStateChanged(ItemEvent e)50867c478bd9Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
50877c478bd9Sstevel@tonic-gate             setServerSide();
50887c478bd9Sstevel@tonic-gate         }
50897c478bd9Sstevel@tonic-gate     }
50907c478bd9Sstevel@tonic-gate 
50917c478bd9Sstevel@tonic-gate     private class GlobalDefaultRenewableLifeAction implements ActionListener {
actionPerformed(ActionEvent e)50927c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
50937c478bd9Sstevel@tonic-gate             if (!setGlobalMaxrenew()) {
50947c478bd9Sstevel@tonic-gate                 ((TextField)e.getSource()).requestFocus();
50957c478bd9Sstevel@tonic-gate             }
50967c478bd9Sstevel@tonic-gate         }
50977c478bd9Sstevel@tonic-gate     }
50987c478bd9Sstevel@tonic-gate 
50997c478bd9Sstevel@tonic-gate     private class GlobalDefaultLifeAction implements ActionListener {
actionPerformed(ActionEvent e)51007c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
51017c478bd9Sstevel@tonic-gate             if (!setGlobalMaxlife()) {
51027c478bd9Sstevel@tonic-gate                 ((TextField)e.getSource()).requestFocus();
51037c478bd9Sstevel@tonic-gate             }
51047c478bd9Sstevel@tonic-gate         }
51057c478bd9Sstevel@tonic-gate     }
51067c478bd9Sstevel@tonic-gate 
51077c478bd9Sstevel@tonic-gate     private class GlobalDefaultExpiryAction implements ActionListener {
actionPerformed(ActionEvent e)51087c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
51097c478bd9Sstevel@tonic-gate             if (!setGlobalExpiry())
51107c478bd9Sstevel@tonic-gate                 ((TextField)e.getSource()).requestFocus();
51117c478bd9Sstevel@tonic-gate         }
51127c478bd9Sstevel@tonic-gate     }
51137c478bd9Sstevel@tonic-gate 
51147c478bd9Sstevel@tonic-gate     private class GlobalDefaultShowListsAction implements ItemListener {
itemStateChanged(ItemEvent e)51157c478bd9Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
51167c478bd9Sstevel@tonic-gate             setShowLists();
51177c478bd9Sstevel@tonic-gate         }
51187c478bd9Sstevel@tonic-gate     }
51197c478bd9Sstevel@tonic-gate 
51207c478bd9Sstevel@tonic-gate     private class GlobalDefaultStaticListsAction implements ItemListener {
itemStateChanged(ItemEvent e)51217c478bd9Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
51227c478bd9Sstevel@tonic-gate             setStaticLists();
51237c478bd9Sstevel@tonic-gate         }
51247c478bd9Sstevel@tonic-gate     }
51257c478bd9Sstevel@tonic-gate 
51267c478bd9Sstevel@tonic-gate     private class GlobalDefaultCacheTimeAction implements ActionListener {
actionPerformed(ActionEvent e)51277c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
51287c478bd9Sstevel@tonic-gate             setCacheTime();
51297c478bd9Sstevel@tonic-gate         }
51307c478bd9Sstevel@tonic-gate     }
51317c478bd9Sstevel@tonic-gate 
51327c478bd9Sstevel@tonic-gate     private class GlobalSaveAction implements ActionListener {
actionPerformed(ActionEvent e)51337c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
51347c478bd9Sstevel@tonic-gate             glSave();
51357c478bd9Sstevel@tonic-gate         }
51367c478bd9Sstevel@tonic-gate     }
51377c478bd9Sstevel@tonic-gate 
51387c478bd9Sstevel@tonic-gate     private class GlobalApplyAction implements ActionListener {
actionPerformed(ActionEvent e)51397c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
51407c478bd9Sstevel@tonic-gate             glApply();
51417c478bd9Sstevel@tonic-gate         }
51427c478bd9Sstevel@tonic-gate     }
51437c478bd9Sstevel@tonic-gate 
51447c478bd9Sstevel@tonic-gate     private class GlobalCancelAction implements ActionListener {
actionPerformed(ActionEvent e)51457c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
51467c478bd9Sstevel@tonic-gate             glCancel();
51477c478bd9Sstevel@tonic-gate         }
51487c478bd9Sstevel@tonic-gate     }
51497c478bd9Sstevel@tonic-gate 
51507c478bd9Sstevel@tonic-gate     private class HelpListener extends MouseAdapter {
mouseClicked(MouseEvent e)51517c478bd9Sstevel@tonic-gate         public void mouseClicked(MouseEvent e) {
51527c478bd9Sstevel@tonic-gate             showHelp(e.getComponent().getName());
51537c478bd9Sstevel@tonic-gate         }
51547c478bd9Sstevel@tonic-gate     }
51557c478bd9Sstevel@tonic-gate 
51567c478bd9Sstevel@tonic-gate     private class CheckboxToggler extends MouseAdapter {
mouseClicked(MouseEvent e)51577c478bd9Sstevel@tonic-gate         public void mouseClicked(MouseEvent e) {
51587c478bd9Sstevel@tonic-gate             if (e.getComponent() instanceof Checkbox) {
51597c478bd9Sstevel@tonic-gate                 Checkbox cb = (Checkbox)e.getComponent();
51607c478bd9Sstevel@tonic-gate                 cb.setState(!cb.getState());
51617c478bd9Sstevel@tonic-gate             }
51627c478bd9Sstevel@tonic-gate         }
51637c478bd9Sstevel@tonic-gate     }
51647c478bd9Sstevel@tonic-gate 
51657c478bd9Sstevel@tonic-gate     private class ChoiceFixer implements ItemListener {
51667c478bd9Sstevel@tonic-gate         private Choice c;
51677c478bd9Sstevel@tonic-gate         private String s;
51687c478bd9Sstevel@tonic-gate 
ChoiceFixer(Choice c)51697c478bd9Sstevel@tonic-gate         ChoiceFixer(Choice c) {
51707c478bd9Sstevel@tonic-gate             this.c = c;
51717c478bd9Sstevel@tonic-gate             s = c.getSelectedItem();
51727c478bd9Sstevel@tonic-gate             // System.out.println("CF: Saving string "+s);
51737c478bd9Sstevel@tonic-gate         }
51747c478bd9Sstevel@tonic-gate 
itemStateChanged(ItemEvent e)51757c478bd9Sstevel@tonic-gate         public void itemStateChanged(ItemEvent e) {
51767c478bd9Sstevel@tonic-gate             if (e.getSource() == c && !c.getSelectedItem().equals(s))
51777c478bd9Sstevel@tonic-gate                 c.select(s);
51787c478bd9Sstevel@tonic-gate             // System.out.println("CF: Restoring string "+s);
51797c478bd9Sstevel@tonic-gate         }
51807c478bd9Sstevel@tonic-gate     }
51817c478bd9Sstevel@tonic-gate 
51827c478bd9Sstevel@tonic-gate     private class TextFixer extends KeyAdapter {
51837c478bd9Sstevel@tonic-gate         private TextField t;
51847c478bd9Sstevel@tonic-gate         private String s;
51857c478bd9Sstevel@tonic-gate 
TextFixer(TextField t)51867c478bd9Sstevel@tonic-gate         TextFixer(TextField t) {
51877c478bd9Sstevel@tonic-gate             this.t = t;
51887c478bd9Sstevel@tonic-gate             s = t.getText();
51897c478bd9Sstevel@tonic-gate             // System.out.println("TF: Saving string "+s);
51907c478bd9Sstevel@tonic-gate         }
51917c478bd9Sstevel@tonic-gate 
keyTyped(KeyEvent e)51927c478bd9Sstevel@tonic-gate         public void keyTyped(KeyEvent e) {
51937c478bd9Sstevel@tonic-gate             if (e.getSource() == t)
51947c478bd9Sstevel@tonic-gate                 t.setText(s);
51957c478bd9Sstevel@tonic-gate             // System.out.println("TF: Restoring string "+s);
51967c478bd9Sstevel@tonic-gate         }
51977c478bd9Sstevel@tonic-gate     }
51987c478bd9Sstevel@tonic-gate 
51997c478bd9Sstevel@tonic-gate     /*
52007c478bd9Sstevel@tonic-gate      * End of the million listeners
52017c478bd9Sstevel@tonic-gate      */
52027c478bd9Sstevel@tonic-gate 
52037c478bd9Sstevel@tonic-gate     /**
52047c478bd9Sstevel@tonic-gate      * Call rb.getString(), but catch exception and returns English
52057c478bd9Sstevel@tonic-gate      * key so that small spelling errors don't cripple the GUI
52067c478bd9Sstevel@tonic-gate      *
52077c478bd9Sstevel@tonic-gate      */
getString(String key)52087c478bd9Sstevel@tonic-gate     private static final String getString(String key) {
52097c478bd9Sstevel@tonic-gate         try {
52107c478bd9Sstevel@tonic-gate             String res = rb.getString(key);
52117c478bd9Sstevel@tonic-gate             return res;
52127c478bd9Sstevel@tonic-gate         } catch (MissingResourceException e) {
52137c478bd9Sstevel@tonic-gate             System.out.println("Missing resource "+key+", using English.");
52147c478bd9Sstevel@tonic-gate             return key;
52157c478bd9Sstevel@tonic-gate         }
52167c478bd9Sstevel@tonic-gate     }
52177c478bd9Sstevel@tonic-gate 
getHelpString(String key)52187c478bd9Sstevel@tonic-gate     private static final String getHelpString(String key) {
52197c478bd9Sstevel@tonic-gate         String res;
52207c478bd9Sstevel@tonic-gate         try {
52217c478bd9Sstevel@tonic-gate             res = hrb.getString(key);
52227c478bd9Sstevel@tonic-gate         } catch (MissingResourceException e) {
52237c478bd9Sstevel@tonic-gate             res = "Missing help on key "+key;
52247c478bd9Sstevel@tonic-gate         }
52257c478bd9Sstevel@tonic-gate         return res;
52267c478bd9Sstevel@tonic-gate     }
52277c478bd9Sstevel@tonic-gate 
52287c478bd9Sstevel@tonic-gate 
52297c478bd9Sstevel@tonic-gate     /**
52307c478bd9Sstevel@tonic-gate      * Check the privileges this principal has to see what we should not try.
52317c478bd9Sstevel@tonic-gate      */
checkPrivs()52327c478bd9Sstevel@tonic-gate     private boolean checkPrivs() {
52337c478bd9Sstevel@tonic-gate         boolean okay = true;
52347c478bd9Sstevel@tonic-gate         String lpriv = (((privs & PRIV_ADD) == 0) ? "A" : "a")
52357c478bd9Sstevel@tonic-gate 	    + (((privs & PRIV_DELETE) == 0) ? "D" : "d")
52367c478bd9Sstevel@tonic-gate 	    + (((privs & PRIV_MODIFY) == 0) ? "M" : "m")
52377c478bd9Sstevel@tonic-gate 	    + (((privs & PRIV_CHANGEPW) == 0) ? "C" : "c")
52387c478bd9Sstevel@tonic-gate 	    + (((privs & PRIV_INQUIRE) == 0) ? "I" : "i")
52397c478bd9Sstevel@tonic-gate 	    + (((privs & PRIV_LIST) == 0) ? "L" : "l");
52407c478bd9Sstevel@tonic-gate         // System.out.println("Privileges are "+lpriv+" "
52417c478bd9Sstevel@tonic-gate         // 			+(new Integer(privs).toString()));
52427c478bd9Sstevel@tonic-gate         /**
52437c478bd9Sstevel@tonic-gate          * Having modify is not useful if we can't either add or see
52447c478bd9Sstevel@tonic-gate          * old values
52457c478bd9Sstevel@tonic-gate          */
52467c478bd9Sstevel@tonic-gate         if ((privs & (PRIV_MODIFY | PRIV_INQUIRE | PRIV_ADD)) == PRIV_MODIFY)
52477c478bd9Sstevel@tonic-gate             okay = false;
52487c478bd9Sstevel@tonic-gate         /* Having changepw without inquire is not useful */
52497c478bd9Sstevel@tonic-gate         if (privs == PRIV_CHANGEPW)
52507c478bd9Sstevel@tonic-gate             okay = false;
52517c478bd9Sstevel@tonic-gate         if (!okay) {
52527c478bd9Sstevel@tonic-gate             showLoginError(
52537c478bd9Sstevel@tonic-gate 		   getString("Insufficient privileges to use gkadmin: ")+lpriv
52547c478bd9Sstevel@tonic-gate 			   +getString(" Please try using another principal."));
52557c478bd9Sstevel@tonic-gate             return false;
52567c478bd9Sstevel@tonic-gate         }
52577c478bd9Sstevel@tonic-gate         return true;
52587c478bd9Sstevel@tonic-gate     }
52597c478bd9Sstevel@tonic-gate 
52607c478bd9Sstevel@tonic-gate     /*
52617c478bd9Sstevel@tonic-gate      * Try to cope with the privileges we have.
52627c478bd9Sstevel@tonic-gate      */
reactToPrivs()52637c478bd9Sstevel@tonic-gate     private void reactToPrivs() {
52647c478bd9Sstevel@tonic-gate         Boolean off = new Boolean(false);
52657c478bd9Sstevel@tonic-gate 
52667c478bd9Sstevel@tonic-gate         /*
52677c478bd9Sstevel@tonic-gate          * If we don't have the Add privilege, we turn off "Create New"
52687c478bd9Sstevel@tonic-gate          * and "Duplicate".  "Duplicate" is also handled in prSelValid/
52697c478bd9Sstevel@tonic-gate          * poSelValid because it's sensitive to selection from the lists.
52707c478bd9Sstevel@tonic-gate          */
52717c478bd9Sstevel@tonic-gate         if ((privs & PRIV_ADD) == 0) {
52727c478bd9Sstevel@tonic-gate             // System.out.println("Disabling Create New buttons");
52737c478bd9Sstevel@tonic-gate             gui.PrListAdd.set("enabled" /* NOI18N */, off);
52747c478bd9Sstevel@tonic-gate             gui.PoListAdd.set("enabled" /* NOI18N */, off);
52757c478bd9Sstevel@tonic-gate             gui.PrListDuplicate.set("enabled" /* NOI18N */, off);
52767c478bd9Sstevel@tonic-gate             gui.PoListDuplicate.set("enabled" /* NOI18N */, off);
52777c478bd9Sstevel@tonic-gate         }
52787c478bd9Sstevel@tonic-gate 
52797c478bd9Sstevel@tonic-gate         /*
52807c478bd9Sstevel@tonic-gate          * If we don't have the Delete privilege, we turn off "Delete".
52817c478bd9Sstevel@tonic-gate          * This is also done in prSelValid/poSelValid because it is
52827c478bd9Sstevel@tonic-gate          * thought about when a list item is selected.
52837c478bd9Sstevel@tonic-gate          */
52847c478bd9Sstevel@tonic-gate         if ((privs & PRIV_DELETE) == 0) {
52857c478bd9Sstevel@tonic-gate             // System.out.println("Disabling Delete buttons");
52867c478bd9Sstevel@tonic-gate             gui.PrListDelete.set("enabled" /* NOI18N */, off);
52877c478bd9Sstevel@tonic-gate             gui.PoListDelete.set("enabled" /* NOI18N */, off);
52887c478bd9Sstevel@tonic-gate         }
52897c478bd9Sstevel@tonic-gate 
52907c478bd9Sstevel@tonic-gate         /*
52917c478bd9Sstevel@tonic-gate          * If we don't have changepw, disable textfield and random button.
52927c478bd9Sstevel@tonic-gate          * Add needs to turn this on again for an add operation only.
52937c478bd9Sstevel@tonic-gate          */
52947c478bd9Sstevel@tonic-gate         if ((privs & PRIV_CHANGEPW) == 0) {
52957c478bd9Sstevel@tonic-gate             // System.out.println("Disabling password components");
52967c478bd9Sstevel@tonic-gate             gui.PrPassword.set("enabled" /* NOI18N */, off);
52977c478bd9Sstevel@tonic-gate             gui.PrBasicRandomPw.set("enabled" /* NOI18N */, off);
529845526e97Ssemery             gui.EncList.set("enabled" /* NOI18N */, off);
52997c478bd9Sstevel@tonic-gate         }
53007c478bd9Sstevel@tonic-gate 
53017c478bd9Sstevel@tonic-gate         /*
53027c478bd9Sstevel@tonic-gate          * If we don't have inquire, we can't get an existing principal
53037c478bd9Sstevel@tonic-gate          * to duplicate, and permitting modification seems a bad idea.
53047c478bd9Sstevel@tonic-gate          * We can still use the panels if we can add.  These will also
53057c478bd9Sstevel@tonic-gate          * get dealt with in prSelValid/poSelValid.
53067c478bd9Sstevel@tonic-gate          */
53077c478bd9Sstevel@tonic-gate         if ((privs & PRIV_INQUIRE) == 0) {
53087c478bd9Sstevel@tonic-gate             // System.out.println("Disabling Modify buttons");
53097c478bd9Sstevel@tonic-gate             gui.PrListModify.set("enabled" /* NOI18N */, off);
53107c478bd9Sstevel@tonic-gate             gui.PoListModify.set("enabled" /* NOI18N */, off);
53117c478bd9Sstevel@tonic-gate             gui.PrListDuplicate.set("enabled" /* NOI18N */, off);
53127c478bd9Sstevel@tonic-gate             gui.PoListDuplicate.set("enabled" /* NOI18N */, off);
53137c478bd9Sstevel@tonic-gate         }
53147c478bd9Sstevel@tonic-gate 
53157c478bd9Sstevel@tonic-gate         /*
53167c478bd9Sstevel@tonic-gate          * If we don't have Modify or Add but do have Inquire, we want to
53177c478bd9Sstevel@tonic-gate          * turn off save and cancel buttons, as well as all principal and
53187c478bd9Sstevel@tonic-gate          * policy components to prevent any changes.
53197c478bd9Sstevel@tonic-gate          */
53207c478bd9Sstevel@tonic-gate         if ((privs & (PRIV_MODIFY | PRIV_ADD)) == 0) {
53217c478bd9Sstevel@tonic-gate             // System.out.println("Disabling attribute components");
53227c478bd9Sstevel@tonic-gate             enablePrAttributes(off);
53237c478bd9Sstevel@tonic-gate             enablePoAttributes(off);
53247c478bd9Sstevel@tonic-gate         }
53257c478bd9Sstevel@tonic-gate 
53267c478bd9Sstevel@tonic-gate         /*
53277c478bd9Sstevel@tonic-gate          * We may have no list privs, or we may have turned off lists.
53287c478bd9Sstevel@tonic-gate          * Set things up accordingly.
53297c478bd9Sstevel@tonic-gate          */
53307c478bd9Sstevel@tonic-gate         noLists = ((privs & PRIV_LIST) == 0 || !defaults.getShowLists());
53317c478bd9Sstevel@tonic-gate         fixListPanels();
53327c478bd9Sstevel@tonic-gate     }
53337c478bd9Sstevel@tonic-gate 
fixListPanels()53347c478bd9Sstevel@tonic-gate     private void fixListPanels() {
53357c478bd9Sstevel@tonic-gate         /*
53367c478bd9Sstevel@tonic-gate          * If we can't use lists, we won't fetch lists, which means the
53377c478bd9Sstevel@tonic-gate          * only way to get a principal is to type something into the
53387c478bd9Sstevel@tonic-gate          * list pattern field.  Relabel those so they work better.
53397c478bd9Sstevel@tonic-gate          */
53407c478bd9Sstevel@tonic-gate         String s;
53417c478bd9Sstevel@tonic-gate         Boolean yes = new Boolean(true);
53427c478bd9Sstevel@tonic-gate         Boolean no = new Boolean(false);
53437c478bd9Sstevel@tonic-gate         if (noLists) {
53447c478bd9Sstevel@tonic-gate             // System.out.println("Hijacking list pattern stuff");
53457c478bd9Sstevel@tonic-gate             gui.PrListLabel.set("enabled" /* NOI18N */, no);
53467c478bd9Sstevel@tonic-gate             gui.PoListLabel.set("enabled" /* NOI18N */, no);
53477c478bd9Sstevel@tonic-gate             s = getString("Principal Name:");
53487c478bd9Sstevel@tonic-gate             gui.PrSearchLab.set("text" /* NOI18N */, s);
53497c478bd9Sstevel@tonic-gate             s = getString("Policy Name:");
53507c478bd9Sstevel@tonic-gate             gui.PoListPatternLabel.set("text" /* NOI18N */, s);
53517c478bd9Sstevel@tonic-gate             s = getString("Clear Name");
53527c478bd9Sstevel@tonic-gate             gui.PrListClear.set("text" /* NOI18N */, s);
53537c478bd9Sstevel@tonic-gate             gui.PoListClear.set("text" /* NOI18N */, s);
53547c478bd9Sstevel@tonic-gate             gui.Prlist.set("enabled", no);
53557c478bd9Sstevel@tonic-gate             gui.Pollist.set("enabled", no);
53567c478bd9Sstevel@tonic-gate             gui.refreshPrincipals.set("enabled", no);
53577c478bd9Sstevel@tonic-gate             gui.refreshPolicies.set("enabled", no);
53587c478bd9Sstevel@tonic-gate             gui.Prlist.set("selectedItem" /* NOI18N */, null);
53597c478bd9Sstevel@tonic-gate             gui.Pollist.set("selectedItem" /* NOI18N */, null);
53607c478bd9Sstevel@tonic-gate             gui.PrintPrlist.set("enabled" /* NOI18N */, no);
53617c478bd9Sstevel@tonic-gate             gui.PrintPollist.set("enabled" /* NOI18N */, no);
53627c478bd9Sstevel@tonic-gate         } else {
53637c478bd9Sstevel@tonic-gate             gui.PrListLabel.set("enabled" /* NOI18N */, yes);
53647c478bd9Sstevel@tonic-gate             gui.PoListLabel.set("enabled" /* NOI18N */, yes);
53657c478bd9Sstevel@tonic-gate             s = getString("Filter Pattern:");
53667c478bd9Sstevel@tonic-gate             gui.PrSearchLab.set("text" /* NOI18N */, s);
53677c478bd9Sstevel@tonic-gate             gui.PoListPatternLabel.set("text" /* NOI18N */, s);
53687c478bd9Sstevel@tonic-gate             s = getString("Clear Filter");
53697c478bd9Sstevel@tonic-gate             gui.PrListClear.set("text" /* NOI18N */, s);
53707c478bd9Sstevel@tonic-gate             gui.PoListClear.set("text" /* NOI18N */, s);
53717c478bd9Sstevel@tonic-gate             gui.Prlist.set("enabled", yes);
53727c478bd9Sstevel@tonic-gate             gui.Pollist.set("enabled", yes);
53737c478bd9Sstevel@tonic-gate             gui.refreshPrincipals.set("enabled", yes);
53747c478bd9Sstevel@tonic-gate             gui.refreshPolicies.set("enabled", yes);
53757c478bd9Sstevel@tonic-gate             gui.PrintPrlist.set("enabled", yes);
53767c478bd9Sstevel@tonic-gate             gui.PrintPollist.set("enabled", yes);
53777c478bd9Sstevel@tonic-gate         }
53787c478bd9Sstevel@tonic-gate     }
53797c478bd9Sstevel@tonic-gate 
enablePrAttributes(Boolean sense)53807c478bd9Sstevel@tonic-gate     private void enablePrAttributes(Boolean sense) {
53817c478bd9Sstevel@tonic-gate         // Basics
53827c478bd9Sstevel@tonic-gate         gui.PrPolicy.set("enabled" /* NOI18N */, sense);
53837c478bd9Sstevel@tonic-gate         gui.PrExpiry.set("enabled" /* NOI18N */, sense);
538445526e97Ssemery         gui.EncList.set("enabled" /* NOI18N */, sense);
53857c478bd9Sstevel@tonic-gate         gui.PrComments.set("enabled" /* NOI18N */, sense);
53867c478bd9Sstevel@tonic-gate         // Details
53877c478bd9Sstevel@tonic-gate         gui.PrPwExpiry.set("enabled" /* NOI18N */, sense);
53887c478bd9Sstevel@tonic-gate         gui.PrKvno.set("enabled" /* NOI18N */, sense);
53897c478bd9Sstevel@tonic-gate         gui.PrMaxLifetime.set("enabled" /* NOI18N */, sense);
53907c478bd9Sstevel@tonic-gate         gui.PrMaxRenewal.set("enabled" /* NOI18N */, sense);
53917c478bd9Sstevel@tonic-gate         // Flags
53927c478bd9Sstevel@tonic-gate         gui.PrLockAcct.set("enabled" /* NOI18N */, sense);
53937c478bd9Sstevel@tonic-gate         gui.PrForcePwChange.set("enabled" /* NOI18N */, sense);
53947c478bd9Sstevel@tonic-gate         gui.PrAllowPostdated.set("enabled" /* NOI18N */, sense);
53957c478bd9Sstevel@tonic-gate         gui.PrAllowForwardable.set("enabled" /* NOI18N */, sense);
53967c478bd9Sstevel@tonic-gate         gui.PrAllowRenewable.set("enabled" /* NOI18N */, sense);
53977c478bd9Sstevel@tonic-gate         gui.PrAllowProxiable.set("enabled" /* NOI18N */, sense);
53987c478bd9Sstevel@tonic-gate         gui.PrAllowSvr.set("enabled" /* NOI18N */, sense);
53997c478bd9Sstevel@tonic-gate         gui.PrAllowTGT.set("enabled" /* NOI18N */, sense);
54007c478bd9Sstevel@tonic-gate         gui.PrAllowDupAuth.set("enabled" /* NOI18N */, sense);
54017c478bd9Sstevel@tonic-gate         gui.PrRequirePreAuth.set("enabled" /* NOI18N */, sense);
54027c478bd9Sstevel@tonic-gate         gui.PrRequireHwPreAuth.set("enabled" /* NOI18N */, sense);
54037c478bd9Sstevel@tonic-gate     }
54047c478bd9Sstevel@tonic-gate 
enablePoAttributes(Boolean sense)54057c478bd9Sstevel@tonic-gate     private void enablePoAttributes(Boolean sense) {
54067c478bd9Sstevel@tonic-gate         // Policy
54077c478bd9Sstevel@tonic-gate         gui.PoMinPwLength.set("enabled" /* NOI18N */, sense);
54087c478bd9Sstevel@tonic-gate         gui.PoMinPwClass.set("enabled" /* NOI18N */, sense);
54097c478bd9Sstevel@tonic-gate         gui.PoSavedPasswords.set("enabled" /* NOI18N */, sense);
54107c478bd9Sstevel@tonic-gate         gui.PoMinTicketLifetime.set("enabled" /* NOI18N */, sense);
54117c478bd9Sstevel@tonic-gate         gui.PoMaxTicketLifetime.set("enabled" /* NOI18N */, sense);
54127c478bd9Sstevel@tonic-gate     }
54137c478bd9Sstevel@tonic-gate 
54147c478bd9Sstevel@tonic-gate     /**
54157c478bd9Sstevel@tonic-gate      * Show context-sensitive help from HelpData class
54167c478bd9Sstevel@tonic-gate      *
54177c478bd9Sstevel@tonic-gate      */
showHelp(String what)54187c478bd9Sstevel@tonic-gate     public void showHelp(String what) {
54197c478bd9Sstevel@tonic-gate         String res;
54207c478bd9Sstevel@tonic-gate 
54217c478bd9Sstevel@tonic-gate         // System.out.println("Help on "+what);
54227c478bd9Sstevel@tonic-gate         if (cHelp == null) {
54237c478bd9Sstevel@tonic-gate             // System.out.println("showHelp called without context.");
54247c478bd9Sstevel@tonic-gate             return;
54257c478bd9Sstevel@tonic-gate         }
54267c478bd9Sstevel@tonic-gate         res = getHelpString(what);
54277c478bd9Sstevel@tonic-gate         cHelp.setText(res);
54287c478bd9Sstevel@tonic-gate         cHelp.setVisible(true);
54297c478bd9Sstevel@tonic-gate     }
54307c478bd9Sstevel@tonic-gate 
54317c478bd9Sstevel@tonic-gate     /**
54327c478bd9Sstevel@tonic-gate      * Holds an association between an object and a listener, keeping
54337c478bd9Sstevel@tonic-gate      * track of the types so that they can be assigned en masse later
54347c478bd9Sstevel@tonic-gate      *
54357c478bd9Sstevel@tonic-gate      */
54367c478bd9Sstevel@tonic-gate     private class Association extends Object {
54377c478bd9Sstevel@tonic-gate         Object Object;
54387c478bd9Sstevel@tonic-gate         EventListener Listener;
54397c478bd9Sstevel@tonic-gate         int Type;
54407c478bd9Sstevel@tonic-gate 
Association(Object obj, EventListener list, int type)54417c478bd9Sstevel@tonic-gate         public Association(Object obj, EventListener list, int type) {
54427c478bd9Sstevel@tonic-gate             Object = obj;
54437c478bd9Sstevel@tonic-gate             Listener = list;
54447c478bd9Sstevel@tonic-gate             Type = type;
54457c478bd9Sstevel@tonic-gate         }
54467c478bd9Sstevel@tonic-gate     }
54477c478bd9Sstevel@tonic-gate 
54487c478bd9Sstevel@tonic-gate     /**
54497c478bd9Sstevel@tonic-gate      * Action listeners for the defaults editing frame.
54507c478bd9Sstevel@tonic-gate      */
54517c478bd9Sstevel@tonic-gate 
54527c478bd9Sstevel@tonic-gate     private class DefaultsContextSensitiveHelpListener
54537c478bd9Sstevel@tonic-gate 	implements ActionListener {
actionPerformed(ActionEvent e)54547c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
54557c478bd9Sstevel@tonic-gate             if (defaultsHelpMode)
54567c478bd9Sstevel@tonic-gate                 showHelp("ContextSensitiveHelp");
54577c478bd9Sstevel@tonic-gate             else
54587c478bd9Sstevel@tonic-gate                 contextHelp(defaultsEditingFrame);
54597c478bd9Sstevel@tonic-gate         }
54607c478bd9Sstevel@tonic-gate     }
54617c478bd9Sstevel@tonic-gate 
54627c478bd9Sstevel@tonic-gate     /**
54637c478bd9Sstevel@tonic-gate      * This class launches the dateTimeDialog box when the user presses
54647c478bd9Sstevel@tonic-gate      * the "..." button. An instance of this is shared by all the
54657c478bd9Sstevel@tonic-gate      * buttons that are meant to do this.
54667c478bd9Sstevel@tonic-gate      */
54677c478bd9Sstevel@tonic-gate     private class DateTimeListener  implements ActionListener {
54687c478bd9Sstevel@tonic-gate 
54697c478bd9Sstevel@tonic-gate         private TextField tf;
54707c478bd9Sstevel@tonic-gate         private Frame frame;
54717c478bd9Sstevel@tonic-gate 
DateTimeListener(TextField tf, Frame frame)54727c478bd9Sstevel@tonic-gate         DateTimeListener(TextField tf, Frame frame) {
54737c478bd9Sstevel@tonic-gate             this.tf = tf;
54747c478bd9Sstevel@tonic-gate             this.frame = frame;
54757c478bd9Sstevel@tonic-gate         }
54767c478bd9Sstevel@tonic-gate 
actionPerformed(ActionEvent e)54777c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
54787c478bd9Sstevel@tonic-gate             if (mainHelpMode && frame == realMainFrame)
54797c478bd9Sstevel@tonic-gate                 showHelp("DateTime...");
54807c478bd9Sstevel@tonic-gate             else
54817c478bd9Sstevel@tonic-gate                 if (defaultsHelpMode && frame == defaultsEditingFrame)
54827c478bd9Sstevel@tonic-gate 		    showHelp("DateTime...");
54837c478bd9Sstevel@tonic-gate 		else
54847c478bd9Sstevel@tonic-gate 		    getDateTimeFromDialogBox(tf, frame);
54857c478bd9Sstevel@tonic-gate         } // actionPerformed
54867c478bd9Sstevel@tonic-gate     } // class DateTimeListener
54877c478bd9Sstevel@tonic-gate 
54887c478bd9Sstevel@tonic-gate     /**
548945526e97Ssemery      * This class launches the EncListDialog box when the user presses
549045526e97Ssemery      * the "..." button. An instance of this is shared by all the
549145526e97Ssemery      * buttons that are meant to do this.
549245526e97Ssemery      */
549345526e97Ssemery     private class EncListListener implements ActionListener {
549445526e97Ssemery 
549545526e97Ssemery         private TextField tf;
549645526e97Ssemery         private Frame frame;
549745526e97Ssemery 
EncListListener(TextField tf, Frame frame)549845526e97Ssemery         EncListListener(TextField tf, Frame frame) {
549945526e97Ssemery             this.tf = tf;
550045526e97Ssemery             this.frame = frame;
550145526e97Ssemery         }
550245526e97Ssemery 
actionPerformed(ActionEvent e)550345526e97Ssemery         public void actionPerformed(ActionEvent e) {
550445526e97Ssemery             if (mainHelpMode && frame == realMainFrame)
550545526e97Ssemery                 showHelp("EncList...");
550645526e97Ssemery             else
550745526e97Ssemery                 if (defaultsHelpMode && frame == defaultsEditingFrame)
550845526e97Ssemery 		    showHelp("EncList...");
550945526e97Ssemery 		else
551045526e97Ssemery 		    getEncListFromDialogBox(tf, frame);
551145526e97Ssemery         } // actionPerformed
551245526e97Ssemery     } // class EncListListener
551345526e97Ssemery 
551445526e97Ssemery     /**
55157c478bd9Sstevel@tonic-gate      * This class launches the durrationHelper dialog box when the user presses
55167c478bd9Sstevel@tonic-gate      * the "..." button. An instance of this is shared by all the
55177c478bd9Sstevel@tonic-gate      * buttons that are meant to do this.
55187c478bd9Sstevel@tonic-gate      */
55197c478bd9Sstevel@tonic-gate     private class DurationListener implements ActionListener {
55207c478bd9Sstevel@tonic-gate 
55217c478bd9Sstevel@tonic-gate         private TextField tf;
55227c478bd9Sstevel@tonic-gate         private Frame frame;
55237c478bd9Sstevel@tonic-gate 
DurationListener(TextField tf, Frame frame)55247c478bd9Sstevel@tonic-gate         DurationListener(TextField tf, Frame frame) {
55257c478bd9Sstevel@tonic-gate             this.tf = tf;
55267c478bd9Sstevel@tonic-gate             this.frame = frame;
55277c478bd9Sstevel@tonic-gate         }
55287c478bd9Sstevel@tonic-gate 
actionPerformed(ActionEvent e)55297c478bd9Sstevel@tonic-gate         public void actionPerformed(ActionEvent e) {
55307c478bd9Sstevel@tonic-gate             if (mainHelpMode && frame == realMainFrame)
55317c478bd9Sstevel@tonic-gate                 showHelp("Duration...");
55327c478bd9Sstevel@tonic-gate             else
55337c478bd9Sstevel@tonic-gate                 if (defaultsHelpMode && frame == defaultsEditingFrame)
55347c478bd9Sstevel@tonic-gate 		    showHelp("Duration...");
55357c478bd9Sstevel@tonic-gate 		else
55367c478bd9Sstevel@tonic-gate 		    getDurationFromDialogBox(tf, frame);
55377c478bd9Sstevel@tonic-gate         }
55387c478bd9Sstevel@tonic-gate     }
55397c478bd9Sstevel@tonic-gate 
55407c478bd9Sstevel@tonic-gate 
55417c478bd9Sstevel@tonic-gate     private class KeystrokeDetector extends KeyAdapter {
55427c478bd9Sstevel@tonic-gate 
55437c478bd9Sstevel@tonic-gate         private int changeType; // principal or policy change
55447c478bd9Sstevel@tonic-gate 
KeystrokeDetector(int type)55457c478bd9Sstevel@tonic-gate         public KeystrokeDetector(int type) {
55467c478bd9Sstevel@tonic-gate             changeType = type;
55477c478bd9Sstevel@tonic-gate         }
55487c478bd9Sstevel@tonic-gate 
keyTyped(KeyEvent e)55497c478bd9Sstevel@tonic-gate         public void keyTyped(KeyEvent e) {
55507c478bd9Sstevel@tonic-gate             reactToKey(changeType);
55517c478bd9Sstevel@tonic-gate             ((TextField)e.getComponent()).requestFocus();
55527c478bd9Sstevel@tonic-gate         }
55537c478bd9Sstevel@tonic-gate     }
55547c478bd9Sstevel@tonic-gate 
reactToKey(int changeType)55557c478bd9Sstevel@tonic-gate     private void reactToKey(int changeType) {
55567c478bd9Sstevel@tonic-gate         switch (changeType) {
55577c478bd9Sstevel@tonic-gate 	case PRINCIPAL_EDITING:
55587c478bd9Sstevel@tonic-gate             prSetNeedSave();
55597c478bd9Sstevel@tonic-gate             break;
55607c478bd9Sstevel@tonic-gate 
55617c478bd9Sstevel@tonic-gate 	case POLICY_EDITING:
55627c478bd9Sstevel@tonic-gate             poSetNeedSave();
55637c478bd9Sstevel@tonic-gate             break;
55647c478bd9Sstevel@tonic-gate 
55657c478bd9Sstevel@tonic-gate 	case DEFAULTS_EDITING:
55667c478bd9Sstevel@tonic-gate             glSetNeedSave();
55677c478bd9Sstevel@tonic-gate             break;
55687c478bd9Sstevel@tonic-gate 
55697c478bd9Sstevel@tonic-gate 	case PRINCIPAL_LIST:
55707c478bd9Sstevel@tonic-gate             if (noLists)
55717c478bd9Sstevel@tonic-gate                 prSelValid(true);
55727c478bd9Sstevel@tonic-gate             break;
55737c478bd9Sstevel@tonic-gate 
55747c478bd9Sstevel@tonic-gate 	case POLICY_LIST:
55757c478bd9Sstevel@tonic-gate             if (noLists)
55767c478bd9Sstevel@tonic-gate                 poSelValid(true);
55777c478bd9Sstevel@tonic-gate             break;
55787c478bd9Sstevel@tonic-gate         }
55797c478bd9Sstevel@tonic-gate     }
55807c478bd9Sstevel@tonic-gate 
enclose(String value)55817c478bd9Sstevel@tonic-gate     private static String enclose(String value) {
55827c478bd9Sstevel@tonic-gate         return new StringBuffer("\"").append(value).append("\"").toString();
55837c478bd9Sstevel@tonic-gate     }
55847c478bd9Sstevel@tonic-gate 
constructDurationExample()55857c478bd9Sstevel@tonic-gate     private static String constructDurationExample() {
55867c478bd9Sstevel@tonic-gate         StringBuffer result = new StringBuffer(getString("Example: "));
55877c478bd9Sstevel@tonic-gate         result.append(enclose(nf.format(28800)));
55887c478bd9Sstevel@tonic-gate         return result.toString();
55897c478bd9Sstevel@tonic-gate     }
55907c478bd9Sstevel@tonic-gate 
constructDateExample()55917c478bd9Sstevel@tonic-gate     private static String constructDateExample() {
55927c478bd9Sstevel@tonic-gate         StringBuffer result = new StringBuffer(getString("Example: "));
55937c478bd9Sstevel@tonic-gate         result.append(enclose(df.format(new Date())));
55947c478bd9Sstevel@tonic-gate         result.append(' ').append(getString("or")).append(' ');
55957c478bd9Sstevel@tonic-gate         result.append(enclose(neverString));
55967c478bd9Sstevel@tonic-gate         return result.toString();
55977c478bd9Sstevel@tonic-gate     }
55987c478bd9Sstevel@tonic-gate 
constructNumberExample()55997c478bd9Sstevel@tonic-gate     private static String constructNumberExample() {
56007c478bd9Sstevel@tonic-gate         StringBuffer result =  new StringBuffer(getString("Example: "));
56017c478bd9Sstevel@tonic-gate         result.append(enclose(nf.format(4)));
56027c478bd9Sstevel@tonic-gate         return result.toString();
56037c478bd9Sstevel@tonic-gate     }
56047c478bd9Sstevel@tonic-gate 
56057c478bd9Sstevel@tonic-gate     static {
56067c478bd9Sstevel@tonic-gate         rb = ResourceBundle.getBundle("GuiResource" /* NOI18N */);
56077c478bd9Sstevel@tonic-gate         hrb = ResourceBundle.getBundle("HelpData" /* NOI18N */);
56087c478bd9Sstevel@tonic-gate         df = DateFormat.getDateTimeInstance(DateFormat.MEDIUM,
56097c478bd9Sstevel@tonic-gate 					    DateFormat.MEDIUM);
56107c478bd9Sstevel@tonic-gate         nf = NumberFormat.getInstance();
56117c478bd9Sstevel@tonic-gate 
56127c478bd9Sstevel@tonic-gate         neverString = getString("Never");
56137c478bd9Sstevel@tonic-gate 
56147c478bd9Sstevel@tonic-gate         toolkit = Toolkit.getDefaultToolkit();
56157c478bd9Sstevel@tonic-gate 
56167c478bd9Sstevel@tonic-gate         durationErrorText = new String[] {getHelpString("Bad Duration"),
56177c478bd9Sstevel@tonic-gate 					  constructDurationExample()};
56187c478bd9Sstevel@tonic-gate         dateErrorText = new String[] {getHelpString("Bad Date"),
56197c478bd9Sstevel@tonic-gate 				      constructDateExample()};
56207c478bd9Sstevel@tonic-gate         numberErrorText = new String[] {getHelpString("Bad Number"),
56217c478bd9Sstevel@tonic-gate 					constructNumberExample()};
56227c478bd9Sstevel@tonic-gate     }
56237c478bd9Sstevel@tonic-gate 
56247c478bd9Sstevel@tonic-gate }
5625