author | Dan Labrecque <Dan.Labrecque@oracle.com> |
Tue, 14 Dec 2010 14:54:59 -0500 | |
changeset 624 | 23c2892e582e |
parent 622 | 779060a588bc |
child 625 | 0ad7f2393529 |
permissions | -rw-r--r-- |
0 | 1 |
/* |
2 |
* CDDL HEADER START |
|
3 |
* |
|
4 |
* The contents of this file are subject to the terms of the |
|
5 |
* Common Development and Distribution License (the "License"). |
|
6 |
* You may not use this file except in compliance with the License. |
|
7 |
* |
|
8 |
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
|
9 |
* or http://www.opensolaris.org/os/licensing. |
|
10 |
* See the License for the specific language governing permissions |
|
11 |
* and limitations under the License. |
|
12 |
* |
|
13 |
* When distributing Covered Code, include this CDDL HEADER in each |
|
14 |
* file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
|
15 |
* If applicable, add the following below this CDDL HEADER, with the |
|
16 |
* fields enclosed by brackets "[]" replaced with your own identifying |
|
17 |
* information: Portions Copyright [yyyy] [name of copyright owner] |
|
18 |
* |
|
19 |
* CDDL HEADER END |
|
20 |
*/ |
|
21 |
||
22 |
/* |
|
591
7c5752b99fd6
12473 panels should probably be run in a sandbox
Stephen Talley <stephen.talley@oracle.com>
parents:
496
diff
changeset
|
23 |
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. |
0 | 24 |
*/ |
25 |
||
26 |
package org.opensolaris.os.vp.client.swing; |
|
27 |
||
28 |
import java.awt.*; |
|
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
29 |
import java.util.*; |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
30 |
import java.util.List; |
0 | 31 |
import javax.swing.*; |
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
32 |
import javax.swing.event.*; |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
33 |
import javax.swing.text.JTextComponent; |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
34 |
import org.opensolaris.os.vp.panel.common.*; |
487
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
35 |
import org.opensolaris.os.vp.panel.common.action.*; |
591
7c5752b99fd6
12473 panels should probably be run in a sandbox
Stephen Talley <stephen.talley@oracle.com>
parents:
496
diff
changeset
|
36 |
import org.opensolaris.os.vp.util.misc.DialogMessage; |
7c5752b99fd6
12473 panels should probably be run in a sandbox
Stephen Talley <stephen.talley@oracle.com>
parents:
496
diff
changeset
|
37 |
import org.opensolaris.os.vp.util.misc.finder.Finder; |
219
57841c113efe
6788 package names should share o.o.o.vp prefix
Stephen Talley <stephen.talley@sun.com>
parents:
173
diff
changeset
|
38 |
import org.opensolaris.os.vp.util.swing.*; |
57841c113efe
6788 package names should share o.o.o.vp prefix
Stephen Talley <stephen.talley@sun.com>
parents:
173
diff
changeset
|
39 |
import org.opensolaris.os.vp.util.swing.layout.*; |
0 | 40 |
|
41 |
@SuppressWarnings({"serial"}) |
|
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
42 |
public class LoginPane extends DialogPane { |
0 | 43 |
// |
76
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
44 |
// Inner classes |
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
45 |
// |
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
46 |
|
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
47 |
private static abstract class LoginField<C extends Component> |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
48 |
extends JPanel { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
49 |
|
76
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
50 |
// |
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
51 |
// Instance data |
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
52 |
// |
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
53 |
|
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
54 |
private JLabel label; |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
55 |
private C field; |
76
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
56 |
|
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
57 |
// |
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
58 |
// Constructors |
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
59 |
// |
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
60 |
|
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
61 |
public LoginField() { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
62 |
super(new BorderLayout()); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
63 |
setOpaque(false); |
76
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
64 |
|
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
65 |
label = new JLabel(); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
66 |
add(label, BorderLayout.WEST); |
76
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
67 |
|
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
68 |
field = createField(); |
487
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
69 |
add(field, BorderLayout.NORTH); |
76
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
70 |
} |
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
71 |
|
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
72 |
// |
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
73 |
// LoginField methods |
76
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
74 |
// |
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
75 |
|
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
76 |
public abstract C createField(); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
77 |
|
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
78 |
public JLabel getLabel() { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
79 |
return label; |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
80 |
} |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
81 |
|
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
82 |
public C getField() { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
83 |
return field; |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
84 |
} |
76
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
85 |
|
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
86 |
public void setEditable(boolean editable) { |
487
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
87 |
label.setVisible(!editable); |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
88 |
field.setVisible(editable); |
76
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
89 |
} |
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
90 |
|
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
91 |
public abstract String getValue(); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
92 |
|
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
93 |
public abstract void setValue(String text); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
94 |
|
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
95 |
public String toDisplayableText(String value) { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
96 |
return value; |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
97 |
} |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
98 |
|
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
99 |
protected void updateLabel() { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
100 |
getLabel().setText(toDisplayableText(getValue())); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
101 |
} |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
102 |
} |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
103 |
|
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
104 |
private static class LoginTextField extends LoginField<JTextField> { |
76
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
105 |
// |
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
106 |
// LoginField methods |
76
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
107 |
// |
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
108 |
|
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
109 |
@Override |
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
110 |
public JTextField createField() { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
111 |
JTextField field = new JTextField(GUIUtil.getTextFieldWidth()); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
112 |
|
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
113 |
field.getDocument().addDocumentListener( |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
114 |
new DocumentAdapter() { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
115 |
@Override |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
116 |
public void docUpdate(DocumentEvent e) { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
117 |
updateLabel(); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
118 |
} |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
119 |
}); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
120 |
|
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
121 |
return field; |
76
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
122 |
} |
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
123 |
|
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
124 |
@Override |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
125 |
public String getValue() { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
126 |
String value = getField().getText(); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
127 |
if (value.isEmpty()) { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
128 |
value = null; |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
129 |
} |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
130 |
return value; |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
131 |
} |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
132 |
|
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
133 |
@Override |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
134 |
public void setValue(String text) { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
135 |
getField().setText(text); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
136 |
} |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
137 |
} |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
138 |
|
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
139 |
private static class LoginComboBox extends LoginField<JComboBox> { |
76
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
140 |
// |
487
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
141 |
// Instance data |
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
142 |
// |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
143 |
|
487
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
144 |
private String nullText; |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
145 |
|
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
146 |
// |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
147 |
// Constructors |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
148 |
// |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
149 |
|
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
150 |
public LoginComboBox(String nullText) { |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
151 |
this.nullText = nullText; |
601
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
152 |
updateLabel(); |
487
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
153 |
} |
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
154 |
|
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
155 |
// |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
156 |
// LoginField methods |
76
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
157 |
// |
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
158 |
|
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
159 |
@Override |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
160 |
public JComboBox createField() { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
161 |
final JComboBox field = new JComboBox(); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
162 |
if (!(field.getModel() instanceof DefaultComboBoxModel)) { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
163 |
field.setModel(new DefaultComboBoxModel()); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
164 |
} |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
165 |
|
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
166 |
final ListCellRenderer renderer = field.getRenderer(); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
167 |
|
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
168 |
// Handle null values in the model |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
169 |
field.setRenderer( |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
170 |
new ListCellRenderer() { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
171 |
@Override |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
172 |
public Component getListCellRendererComponent(JList list, |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
173 |
Object value, int index, boolean isSelected, |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
174 |
boolean cellHasFocus) { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
175 |
|
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
176 |
return renderer.getListCellRendererComponent(list, |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
177 |
toDisplayableText((String)value), index, isSelected, |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
178 |
cellHasFocus); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
179 |
} |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
180 |
}); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
181 |
|
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
182 |
field.getModel().addListDataListener( |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
183 |
new ListDataListener() { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
184 |
@Override |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
185 |
public void contentsChanged(ListDataEvent e) { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
186 |
updateLabel(); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
187 |
} |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
188 |
|
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
189 |
@Override |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
190 |
public void intervalAdded(ListDataEvent e) { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
191 |
updateLabel(); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
192 |
} |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
193 |
|
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
194 |
@Override |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
195 |
public void intervalRemoved(ListDataEvent e) { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
196 |
updateLabel(); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
197 |
} |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
198 |
}); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
199 |
|
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
200 |
return field; |
76
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
201 |
} |
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
202 |
|
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
203 |
@Override |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
204 |
public String getValue() { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
205 |
return (String)getField().getSelectedItem(); |
76
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
206 |
} |
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
207 |
|
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
208 |
@Override |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
209 |
public void setValue(String text) { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
210 |
getField().getModel().setSelectedItem(text); |
76
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
211 |
} |
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
212 |
|
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
213 |
@Override |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
214 |
public String toDisplayableText(String value) { |
487
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
215 |
return value == null ? nullText : value; |
76
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
216 |
} |
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
217 |
} |
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
218 |
|
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
219 |
// |
0 | 220 |
// Static data |
221 |
// |
|
222 |
||
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
223 |
private static final Color COLOR_LABEL_ERROR = Color.red.darker(); |
0 | 224 |
|
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
225 |
private static final String LABEL_HOST = |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
226 |
Finder.getString("login.label.host"); |
39
3dd6445bd848
2463 operations that require privilege should prompt user
Stephen Talley <stephen.talley@sun.com>
parents:
33
diff
changeset
|
227 |
|
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
228 |
private static final String LABEL_USER = |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
229 |
Finder.getString("login.label.user"); |
50
66ec0f9650dd
3253 tab-navigation from impromptu password dialog causes UI paralysis
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
230 |
|
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
231 |
private static final String LABEL_ROLE = |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
232 |
Finder.getString("login.label.role"); |
50
66ec0f9650dd
3253 tab-navigation from impromptu password dialog causes UI paralysis
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
233 |
|
0 | 234 |
// |
235 |
// Instance data |
|
236 |
// |
|
237 |
||
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
238 |
private JPanel fieldPanel; |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
239 |
private int nCoreFields; |
487
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
240 |
|
0 | 241 |
private JLabel hostLabel; |
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
242 |
private LoginField hostField; |
487
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
243 |
|
0 | 244 |
private JLabel userLabel; |
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
245 |
private LoginField userField; |
487
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
246 |
|
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
247 |
private JLabel roleLabel; |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
248 |
private LoginComboBox roleField; |
0 | 249 |
|
250 |
// |
|
251 |
// Constructors |
|
252 |
// |
|
253 |
||
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
254 |
public LoginPane() { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
255 |
createFieldPanel(); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
256 |
setContent(fieldPanel, false, false); |
0 | 257 |
|
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
258 |
SettingsButtonBar buttonBar = getButtonBar(); |
0 | 259 |
|
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
260 |
JButton cancel = buttonBar.getCancelButton(); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
261 |
cancel.addActionListener(setClickedButtonActionListener); |
487
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
262 |
|
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
263 |
// Move to left side of dialog |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
264 |
buttonBar.remove(cancel); |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
265 |
buttonBar.add(cancel, 0); |
50
66ec0f9650dd
3253 tab-navigation from impromptu password dialog causes UI paralysis
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
266 |
|
601
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
267 |
JButton close = buttonBar.getCloseButton(); |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
268 |
close.addActionListener(setClickedButtonActionListener); |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
269 |
|
487
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
270 |
JButton back = buttonBar.getBackButton(); |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
271 |
back.addActionListener(setClickedButtonActionListener); |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
272 |
|
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
273 |
JButton forward = buttonBar.getForwardButton(); |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
274 |
forward.addActionListener(setClickedButtonActionListener); |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
275 |
forward.setText(Finder.getString("login.button.forward")); |
0 | 276 |
} |
277 |
||
278 |
// |
|
279 |
// LoginPane methods |
|
280 |
// |
|
281 |
||
496
3e406d128be1
15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents:
487
diff
changeset
|
282 |
public void promptForAck(final LoginRequest request) |
3e406d128be1
15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents:
487
diff
changeset
|
283 |
throws ActionAbortedException { |
3e406d128be1
15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents:
487
diff
changeset
|
284 |
|
3e406d128be1
15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents:
487
diff
changeset
|
285 |
assert !EventQueue.isDispatchThread(); |
3e406d128be1
15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents:
487
diff
changeset
|
286 |
|
600
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
287 |
final StringLoginProperty host = request.getHost(); |
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
288 |
final StringLoginProperty user = request.getUser(); |
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
289 |
final StringLoginProperty role = request.getRole(); |
496
3e406d128be1
15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents:
487
diff
changeset
|
290 |
|
3e406d128be1
15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents:
487
diff
changeset
|
291 |
GUIUtil.invokeAndWait( |
3e406d128be1
15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents:
487
diff
changeset
|
292 |
new Runnable() { |
3e406d128be1
15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents:
487
diff
changeset
|
293 |
@Override |
3e406d128be1
15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents:
487
diff
changeset
|
294 |
public void run() { |
3e406d128be1
15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents:
487
diff
changeset
|
295 |
DialogMessage help = new DialogMessage(Finder.getString( |
600
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
296 |
"login.message.ack", host.getValue(), |
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
297 |
user.getValue(), role.getValue())); |
496
3e406d128be1
15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents:
487
diff
changeset
|
298 |
|
3e406d128be1
15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents:
487
diff
changeset
|
299 |
List<DialogMessage> messages = request.getMessages(); |
3e406d128be1
15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents:
487
diff
changeset
|
300 |
messages.add(help); |
3e406d128be1
15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents:
487
diff
changeset
|
301 |
getMessagePanel().setMessages(messages); |
3e406d128be1
15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents:
487
diff
changeset
|
302 |
|
624
23c2892e582e
17520 - "Change role..." needs better behavior when no roles
Dan Labrecque <Dan.Labrecque@oracle.com>
parents:
622
diff
changeset
|
303 |
setHostInUI(host, false); |
23c2892e582e
17520 - "Change role..." needs better behavior when no roles
Dan Labrecque <Dan.Labrecque@oracle.com>
parents:
622
diff
changeset
|
304 |
setUserInUI(user, false); |
496
3e406d128be1
15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents:
487
diff
changeset
|
305 |
|
3e406d128be1
15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents:
487
diff
changeset
|
306 |
if (role.getValue() == null) { |
3e406d128be1
15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents:
487
diff
changeset
|
307 |
hideRole(); |
3e406d128be1
15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents:
487
diff
changeset
|
308 |
} else { |
624
23c2892e582e
17520 - "Change role..." needs better behavior when no roles
Dan Labrecque <Dan.Labrecque@oracle.com>
parents:
622
diff
changeset
|
309 |
setRoleInUI(role, false); |
496
3e406d128be1
15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents:
487
diff
changeset
|
310 |
} |
3e406d128be1
15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents:
487
diff
changeset
|
311 |
|
3e406d128be1
15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents:
487
diff
changeset
|
312 |
clearAuthFields(); |
3e406d128be1
15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents:
487
diff
changeset
|
313 |
|
3e406d128be1
15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents:
487
diff
changeset
|
314 |
getButtonBar().getBackButton().setEnabled(false); |
3e406d128be1
15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents:
487
diff
changeset
|
315 |
} |
3e406d128be1
15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents:
487
diff
changeset
|
316 |
}); |
3e406d128be1
15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents:
487
diff
changeset
|
317 |
|
3e406d128be1
15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents:
487
diff
changeset
|
318 |
try { |
3e406d128be1
15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents:
487
diff
changeset
|
319 |
awaitForward(); |
3e406d128be1
15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents:
487
diff
changeset
|
320 |
} catch (ActionRegressedException impossible) { |
3e406d128be1
15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents:
487
diff
changeset
|
321 |
} |
3e406d128be1
15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents:
487
diff
changeset
|
322 |
} |
3e406d128be1
15339 command line invocations shouldn't attempt to reuse connections
Stephen Talley <stephen.talley@oracle.com>
parents:
487
diff
changeset
|
323 |
|
601
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
324 |
public void promptForFailedRequest(final LoginRequest request) { |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
325 |
assert !EventQueue.isDispatchThread(); |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
326 |
|
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
327 |
final StringLoginProperty host = request.getHost(); |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
328 |
final StringLoginProperty user = request.getUser(); |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
329 |
final StringLoginProperty role = request.getRole(); |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
330 |
|
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
331 |
GUIUtil.invokeAndWait( |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
332 |
new Runnable() { |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
333 |
@Override |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
334 |
public void run() { |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
335 |
DialogMessage help = new DialogMessage(Finder.getString( |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
336 |
"login.message.fail", host.getValue(), user.getValue(), |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
337 |
role.getValue())); |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
338 |
|
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
339 |
List<DialogMessage> messages = request.getMessages(); |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
340 |
messages.add(help); |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
341 |
getMessagePanel().setMessages(messages); |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
342 |
|
624
23c2892e582e
17520 - "Change role..." needs better behavior when no roles
Dan Labrecque <Dan.Labrecque@oracle.com>
parents:
622
diff
changeset
|
343 |
setHostInUI(host, false); |
23c2892e582e
17520 - "Change role..." needs better behavior when no roles
Dan Labrecque <Dan.Labrecque@oracle.com>
parents:
622
diff
changeset
|
344 |
setUserInUI(user, false); |
23c2892e582e
17520 - "Change role..." needs better behavior when no roles
Dan Labrecque <Dan.Labrecque@oracle.com>
parents:
622
diff
changeset
|
345 |
setRoleInUI(role, false); |
601
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
346 |
|
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
347 |
clearAuthFields(); |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
348 |
} |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
349 |
}); |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
350 |
|
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
351 |
awaitClose(); |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
352 |
} |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
353 |
|
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
354 |
public void promptForHostAndUser(final LoginRequest request) |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
355 |
throws ActionAbortedException { |
0 | 356 |
|
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
357 |
assert !EventQueue.isDispatchThread(); |
0 | 358 |
|
600
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
359 |
final StringLoginProperty host = request.getHost(); |
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
360 |
final StringLoginProperty user = request.getUser(); |
487
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
361 |
|
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
362 |
GUIUtil.invokeAndWait( |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
363 |
new Runnable() { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
364 |
@Override |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
365 |
public void run() { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
366 |
String resource = "login.message.hostuser"; |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
367 |
if (host.isEditable()) { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
368 |
resource += ".host"; |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
369 |
} |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
370 |
if (user.isEditable()) { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
371 |
resource += ".user"; |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
372 |
} |
0 | 373 |
|
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
374 |
DialogMessage help = new DialogMessage(Finder.getString( |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
375 |
resource, host.getValue(), user.getValue())); |
76
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
376 |
|
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
377 |
List<DialogMessage> messages = request.getMessages(); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
378 |
messages.add(help); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
379 |
getMessagePanel().setMessages(messages); |
76
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
380 |
|
487
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
381 |
setHostInUI(host, true); |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
382 |
setUserInUI(user, true); |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
383 |
hideRole(); |
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
384 |
clearAuthFields(); |
487
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
385 |
|
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
386 |
getButtonBar().getBackButton().setEnabled(false); |
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
387 |
} |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
388 |
}); |
0 | 389 |
|
487
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
390 |
try { |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
391 |
awaitForward(); |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
392 |
} catch (ActionRegressedException impossible) { |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
393 |
} |
0 | 394 |
|
487
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
395 |
setInProperty(host, hostField); |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
396 |
setInProperty(user, userField); |
0 | 397 |
} |
398 |
||
624
23c2892e582e
17520 - "Change role..." needs better behavior when no roles
Dan Labrecque <Dan.Labrecque@oracle.com>
parents:
622
diff
changeset
|
399 |
public void promptForEnsureRoles(final LoginRequest request) { |
23c2892e582e
17520 - "Change role..." needs better behavior when no roles
Dan Labrecque <Dan.Labrecque@oracle.com>
parents:
622
diff
changeset
|
400 |
assert !EventQueue.isDispatchThread(); |
23c2892e582e
17520 - "Change role..." needs better behavior when no roles
Dan Labrecque <Dan.Labrecque@oracle.com>
parents:
622
diff
changeset
|
401 |
|
23c2892e582e
17520 - "Change role..." needs better behavior when no roles
Dan Labrecque <Dan.Labrecque@oracle.com>
parents:
622
diff
changeset
|
402 |
final StringLoginProperty host = request.getHost(); |
23c2892e582e
17520 - "Change role..." needs better behavior when no roles
Dan Labrecque <Dan.Labrecque@oracle.com>
parents:
622
diff
changeset
|
403 |
final StringLoginProperty user = request.getUser(); |
23c2892e582e
17520 - "Change role..." needs better behavior when no roles
Dan Labrecque <Dan.Labrecque@oracle.com>
parents:
622
diff
changeset
|
404 |
|
23c2892e582e
17520 - "Change role..." needs better behavior when no roles
Dan Labrecque <Dan.Labrecque@oracle.com>
parents:
622
diff
changeset
|
405 |
GUIUtil.invokeAndWait( |
23c2892e582e
17520 - "Change role..." needs better behavior when no roles
Dan Labrecque <Dan.Labrecque@oracle.com>
parents:
622
diff
changeset
|
406 |
new Runnable() { |
23c2892e582e
17520 - "Change role..." needs better behavior when no roles
Dan Labrecque <Dan.Labrecque@oracle.com>
parents:
622
diff
changeset
|
407 |
@Override |
23c2892e582e
17520 - "Change role..." needs better behavior when no roles
Dan Labrecque <Dan.Labrecque@oracle.com>
parents:
622
diff
changeset
|
408 |
public void run() { |
23c2892e582e
17520 - "Change role..." needs better behavior when no roles
Dan Labrecque <Dan.Labrecque@oracle.com>
parents:
622
diff
changeset
|
409 |
List<DialogMessage> messages = request.getMessages(); |
23c2892e582e
17520 - "Change role..." needs better behavior when no roles
Dan Labrecque <Dan.Labrecque@oracle.com>
parents:
622
diff
changeset
|
410 |
getMessagePanel().setMessages(messages); |
23c2892e582e
17520 - "Change role..." needs better behavior when no roles
Dan Labrecque <Dan.Labrecque@oracle.com>
parents:
622
diff
changeset
|
411 |
|
23c2892e582e
17520 - "Change role..." needs better behavior when no roles
Dan Labrecque <Dan.Labrecque@oracle.com>
parents:
622
diff
changeset
|
412 |
setHostInUI(host, false); |
23c2892e582e
17520 - "Change role..." needs better behavior when no roles
Dan Labrecque <Dan.Labrecque@oracle.com>
parents:
622
diff
changeset
|
413 |
setUserInUI(user, false); |
23c2892e582e
17520 - "Change role..." needs better behavior when no roles
Dan Labrecque <Dan.Labrecque@oracle.com>
parents:
622
diff
changeset
|
414 |
hideRole(); |
23c2892e582e
17520 - "Change role..." needs better behavior when no roles
Dan Labrecque <Dan.Labrecque@oracle.com>
parents:
622
diff
changeset
|
415 |
|
23c2892e582e
17520 - "Change role..." needs better behavior when no roles
Dan Labrecque <Dan.Labrecque@oracle.com>
parents:
622
diff
changeset
|
416 |
clearAuthFields(); |
23c2892e582e
17520 - "Change role..." needs better behavior when no roles
Dan Labrecque <Dan.Labrecque@oracle.com>
parents:
622
diff
changeset
|
417 |
} |
23c2892e582e
17520 - "Change role..." needs better behavior when no roles
Dan Labrecque <Dan.Labrecque@oracle.com>
parents:
622
diff
changeset
|
418 |
}); |
23c2892e582e
17520 - "Change role..." needs better behavior when no roles
Dan Labrecque <Dan.Labrecque@oracle.com>
parents:
622
diff
changeset
|
419 |
|
23c2892e582e
17520 - "Change role..." needs better behavior when no roles
Dan Labrecque <Dan.Labrecque@oracle.com>
parents:
622
diff
changeset
|
420 |
awaitClose(); |
23c2892e582e
17520 - "Change role..." needs better behavior when no roles
Dan Labrecque <Dan.Labrecque@oracle.com>
parents:
622
diff
changeset
|
421 |
} |
23c2892e582e
17520 - "Change role..." needs better behavior when no roles
Dan Labrecque <Dan.Labrecque@oracle.com>
parents:
622
diff
changeset
|
422 |
|
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
423 |
public void promptForRole(final LoginRequest request, |
487
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
424 |
final List<String> roles) throws ActionAbortedException, |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
425 |
ActionRegressedException { |
0 | 426 |
|
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
427 |
assert !EventQueue.isDispatchThread(); |
39
3dd6445bd848
2463 operations that require privilege should prompt user
Stephen Talley <stephen.talley@sun.com>
parents:
33
diff
changeset
|
428 |
|
600
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
429 |
final StringLoginProperty host = request.getHost(); |
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
430 |
final StringLoginProperty user = request.getUser(); |
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
431 |
final StringLoginProperty role = request.getRole(); |
487
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
432 |
|
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
433 |
GUIUtil.invokeAndWait( |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
434 |
new Runnable() { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
435 |
@Override |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
436 |
public void run() { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
437 |
DialogMessage help = new DialogMessage(Finder.getString( |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
438 |
"login.message.role", host.getValue(), |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
439 |
user.getValue())); |
39
3dd6445bd848
2463 operations that require privilege should prompt user
Stephen Talley <stephen.talley@sun.com>
parents:
33
diff
changeset
|
440 |
|
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
441 |
List<DialogMessage> messages = request.getMessages(); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
442 |
messages.add(help); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
443 |
getMessagePanel().setMessages(messages); |
0 | 444 |
|
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
445 |
DefaultComboBoxModel model = |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
446 |
(DefaultComboBoxModel)roleField.getField().getModel(); |
0 | 447 |
|
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
448 |
model.removeAllElements(); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
449 |
model.addElement(null); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
450 |
for (String r : roles) { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
451 |
model.addElement(r); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
452 |
} |
0 | 453 |
|
487
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
454 |
setHostInUI(host, false); |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
455 |
setUserInUI(user, false); |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
456 |
setRoleInUI(role, true); |
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
457 |
clearAuthFields(); |
487
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
458 |
|
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
459 |
getButtonBar().getBackButton().setEnabled( |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
460 |
host.isEditable() || user.isEditable()); |
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
461 |
} |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
462 |
}); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
463 |
|
487
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
464 |
awaitForward(); |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
465 |
setInProperty(role, roleField); |
0 | 466 |
} |
467 |
||
600
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
468 |
/** |
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
469 |
* Prompt the user for role login information. |
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
470 |
* |
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
471 |
* @param request - {@code LoginRequest}. |
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
472 |
* |
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
473 |
* @param properties - A {@code List} of {@code LoginProperty} objects. |
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
474 |
* NOTE: Only instances of {@code StringLoginProperty} and |
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
475 |
* {@code PasswordLoginProperty} are allowed. |
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
476 |
*/ |
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
477 |
public void promptForRoleAuth(LoginRequest request, |
487
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
478 |
List<LoginProperty> properties) throws ActionAbortedException, |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
479 |
ActionRegressedException { |
0 | 480 |
|
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
481 |
assert !EventQueue.isDispatchThread(); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
482 |
|
600
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
483 |
final StringLoginProperty host = request.getHost(); |
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
484 |
final StringLoginProperty user = request.getUser(); |
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
485 |
final StringLoginProperty role = request.getRole(); |
39
3dd6445bd848
2463 operations that require privilege should prompt user
Stephen Talley <stephen.talley@sun.com>
parents:
33
diff
changeset
|
486 |
|
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
487 |
GUIUtil.invokeAndWait( |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
488 |
new Runnable() { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
489 |
@Override |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
490 |
public void run() { |
487
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
491 |
setHostInUI(host, false); |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
492 |
setUserInUI(user, false); |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
493 |
setRoleInUI(role, false); |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
494 |
|
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
495 |
getButtonBar().getBackButton().setEnabled( |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
496 |
host.isEditable() || user.isEditable() || |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
497 |
role.isEditable()); |
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
498 |
} |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
499 |
}); |
0 | 500 |
|
622
779060a588bc
17589 generic message shouldn't preface every step in PAM conversation
Stephen Talley <stephen.talley@oracle.com>
parents:
601
diff
changeset
|
501 |
promptForAuth(request.getMessages(), properties); |
0 | 502 |
} |
503 |
||
600
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
504 |
/** |
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
505 |
* Prompt the user for user login information. |
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
506 |
* |
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
507 |
* @param request - {@code LoginRequest}. |
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
508 |
* |
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
509 |
* @param properties - A {@code List} of {@code LoginProperty} objects. |
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
510 |
* NOTE: Only instances of {@code StringLoginProperty} and |
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
511 |
* {@code PasswordLoginProperty} are allowed. |
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
512 |
*/ |
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
513 |
public void promptForUserAuth(LoginRequest request, |
487
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
514 |
List<LoginProperty> properties) throws ActionAbortedException, |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
515 |
ActionRegressedException { |
0 | 516 |
|
600
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
517 |
final StringLoginProperty host = request.getHost(); |
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
518 |
final StringLoginProperty user = request.getUser(); |
0 | 519 |
|
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
520 |
GUIUtil.invokeAndWait( |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
521 |
new Runnable() { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
522 |
@Override |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
523 |
public void run() { |
487
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
524 |
setHostInUI(host, false); |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
525 |
setUserInUI(user, false); |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
526 |
hideRole(); |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
527 |
|
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
528 |
getButtonBar().getBackButton().setEnabled( |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
529 |
host.isEditable() || user.isEditable()); |
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
530 |
} |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
531 |
}); |
0 | 532 |
|
622
779060a588bc
17589 generic message shouldn't preface every step in PAM conversation
Stephen Talley <stephen.talley@oracle.com>
parents:
601
diff
changeset
|
533 |
promptForAuth(request.getMessages(), properties); |
0 | 534 |
} |
535 |
||
536 |
// |
|
537 |
// Private methods |
|
538 |
// |
|
539 |
||
601
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
540 |
private void awaitClose() { |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
541 |
SettingsButtonBar bar = getButtonBar(); |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
542 |
AbstractButton closeButton = bar.getCloseButton(); |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
543 |
|
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
544 |
for (AbstractButton button : bar.getButtons()) { |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
545 |
button.setVisible(button == closeButton); |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
546 |
} |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
547 |
|
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
548 |
while (awaitClickedButton() != closeButton); |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
549 |
} |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
550 |
|
487
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
551 |
private void awaitForward() throws ActionAbortedException, |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
552 |
ActionRegressedException { |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
553 |
|
601
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
554 |
SettingsButtonBar bar = getButtonBar(); |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
555 |
AbstractButton backButton = bar.getBackButton(); |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
556 |
AbstractButton forwardButton = bar.getForwardButton(); |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
557 |
AbstractButton cancelButton = bar.getCancelButton(); |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
558 |
|
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
559 |
for (AbstractButton button : bar.getButtons()) { |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
560 |
button.setVisible(button == backButton || |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
561 |
button == forwardButton || button == cancelButton); |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
562 |
} |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
563 |
|
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
564 |
JButton clicked = null; |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
565 |
while (clicked != forwardButton) { |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
566 |
clicked = awaitClickedButton(); |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
567 |
|
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
568 |
if (clicked == backButton) { |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
569 |
throw new ActionRegressedException(); |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
570 |
} |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
571 |
|
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
572 |
if (clicked == cancelButton) { |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
573 |
throw new ActionAbortedException(); |
9d4e3e0ee603
7947 vp should fail if unable to connect to requested host
Stephen Talley <stephen.talley@oracle.com>
parents:
600
diff
changeset
|
574 |
} |
487
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
575 |
} |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
576 |
} |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
577 |
|
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
578 |
private void clearAuthFields() { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
579 |
// Remove all but the "core" fields (host, user, role) |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
580 |
while (fieldPanel.getComponentCount() > nCoreFields) { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
581 |
fieldPanel.remove(nCoreFields); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
582 |
} |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
583 |
} |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
584 |
|
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
585 |
private void createFieldPanel() { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
586 |
hostField = new LoginTextField(); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
587 |
hostLabel = new JLabel(); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
588 |
hostLabel.setLabelFor(hostField); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
589 |
|
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
590 |
userField = new LoginTextField(); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
591 |
userLabel = new JLabel(); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
592 |
userLabel.setLabelFor(userField); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
593 |
|
487
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
594 |
roleField = new LoginComboBox( |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
595 |
Finder.getString("login.field.role.none")); |
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
596 |
roleLabel = new JLabel(); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
597 |
roleLabel.setLabelFor(roleField); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
598 |
|
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
599 |
int gap = GUIUtil.getHalfGap(); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
600 |
|
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
601 |
HasAnchors a = new SimpleHasAnchors( |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
602 |
HorizontalAnchor.LEFT, VerticalAnchor.CENTER); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
603 |
|
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
604 |
TableLayout layout = new TableLayout(1, 2, gap, gap); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
605 |
layout.setHorizontalAnchor(HorizontalAnchor.LEFT); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
606 |
layout.setDefaultConstraint(a); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
607 |
|
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
608 |
fieldPanel = new JPanel(layout); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
609 |
fieldPanel.setOpaque(false); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
610 |
|
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
611 |
fieldPanel.add(hostLabel); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
612 |
fieldPanel.add(hostField); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
613 |
|
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
614 |
fieldPanel.add(userLabel); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
615 |
fieldPanel.add(userField); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
616 |
|
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
617 |
fieldPanel.add(roleLabel); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
618 |
fieldPanel.add(roleField); |
0 | 619 |
|
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
620 |
nCoreFields = fieldPanel.getComponentCount(); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
621 |
} |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
622 |
|
487
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
623 |
private void hideRole() { |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
624 |
roleLabel.setVisible(false); |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
625 |
roleField.setVisible(false); |
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
626 |
} |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
627 |
|
600
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
628 |
/** |
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
629 |
* Prompt the user for login information. |
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
630 |
* |
622
779060a588bc
17589 generic message shouldn't preface every step in PAM conversation
Stephen Talley <stephen.talley@oracle.com>
parents:
601
diff
changeset
|
631 |
* @param messages |
779060a588bc
17589 generic message shouldn't preface every step in PAM conversation
Stephen Talley <stephen.talley@oracle.com>
parents:
601
diff
changeset
|
632 |
* messages to instruct the user |
600
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
633 |
* |
622
779060a588bc
17589 generic message shouldn't preface every step in PAM conversation
Stephen Talley <stephen.talley@oracle.com>
parents:
601
diff
changeset
|
634 |
* @param properties |
779060a588bc
17589 generic message shouldn't preface every step in PAM conversation
Stephen Talley <stephen.talley@oracle.com>
parents:
601
diff
changeset
|
635 |
* {@code List} of {@code LoginProperty} objects. |
600
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
636 |
* NOTE: Only instances of {@code StringLoginProperty} and |
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
637 |
* {@code PasswordLoginProperty} are allowed. |
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
638 |
*/ |
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
639 |
private void promptForAuth(final List<DialogMessage> messages, |
622
779060a588bc
17589 generic message shouldn't preface every step in PAM conversation
Stephen Talley <stephen.talley@oracle.com>
parents:
601
diff
changeset
|
640 |
final List<LoginProperty> properties) |
487
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
641 |
throws ActionAbortedException, ActionRegressedException { |
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
642 |
|
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
643 |
assert !EventQueue.isDispatchThread(); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
644 |
|
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
645 |
final Map<LoginProperty, JTextComponent> map = |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
646 |
new HashMap<LoginProperty, JTextComponent>(); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
647 |
|
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
648 |
GUIUtil.invokeAndWait( |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
649 |
new Runnable() { |
0 | 650 |
@Override |
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
651 |
public void run() { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
652 |
getMessagePanel().setMessages(messages); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
653 |
|
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
654 |
clearAuthFields(); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
655 |
|
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
656 |
int cols = GUIUtil.getTextFieldWidth(); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
657 |
|
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
658 |
if (properties != null) { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
659 |
for (LoginProperty property : properties) { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
660 |
JLabel label = new JLabel(property.getName()); |
600
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
661 |
JTextComponent field = null; |
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
662 |
String value = null; |
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
663 |
if (property instanceof PasswordLoginProperty) { |
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
664 |
field = new JPasswordField(cols); |
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
665 |
value = new String((char[])property.getValue()); |
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
666 |
} else { |
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
667 |
field = new JTextField(cols); |
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
668 |
value = (String)property.getValue(); |
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
669 |
} |
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
670 |
field.setText(value); |
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
671 |
fieldPanel.add(label); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
672 |
fieldPanel.add(field); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
673 |
map.put(property, field); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
674 |
} |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
675 |
} |
0 | 676 |
} |
677 |
}); |
|
678 |
||
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
679 |
final boolean[] success = {false}; |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
680 |
try { |
487
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
681 |
awaitForward(); |
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
682 |
success[0] = true; |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
683 |
} finally { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
684 |
GUIUtil.invokeAndWait( |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
685 |
new Runnable() { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
686 |
@Override |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
687 |
public void run() { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
688 |
for (Map.Entry<LoginProperty, JTextComponent> entry : |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
689 |
map.entrySet()) { |
0 | 690 |
|
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
691 |
JTextComponent field = entry.getValue(); |
0 | 692 |
|
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
693 |
if (success[0]) { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
694 |
if (field instanceof JPasswordField) { |
600
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
695 |
((PasswordLoginProperty)entry.getKey()). |
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
696 |
setValue(((JPasswordField)field). |
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
697 |
getPassword()); |
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
698 |
} else { |
600
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
699 |
((StringLoginProperty)entry.getKey()). |
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
700 |
setValue(field.getText()); |
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
701 |
} |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
702 |
} |
0 | 703 |
|
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
704 |
// Remove any sensitive information |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
705 |
field.setText(null); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
706 |
} |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
707 |
} |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
708 |
}); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
709 |
} |
256
a570f2e29dbd
7971 login dialog should be external and modal
Stephen Talley <stephen.talley@sun.com>
parents:
219
diff
changeset
|
710 |
} |
a570f2e29dbd
7971 login dialog should be external and modal
Stephen Talley <stephen.talley@sun.com>
parents:
219
diff
changeset
|
711 |
|
600
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
712 |
private void setHostInUI(StringLoginProperty property, boolean allowEdit) { |
487
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
713 |
setInUI(property, hostLabel, hostField, LABEL_HOST, allowEdit); |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
714 |
} |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
715 |
|
600
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
716 |
private void setInProperty(StringLoginProperty property, LoginField field) { |
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
717 |
if (property.isEditable()) { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
718 |
property.setValue(field.getValue()); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
719 |
} |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
720 |
property.setErrored(false); |
0 | 721 |
} |
722 |
||
600
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
723 |
private void setInUI(StringLoginProperty property, JLabel label, |
487
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
724 |
final LoginField field, String defaultLabel, boolean allowEdit) { |
76
af5a052967b0
3415 login panel error details shouldn't launch another window
Stephen Talley <stephen.talley@sun.com>
parents:
74
diff
changeset
|
725 |
|
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
726 |
String labelText = property.getName(); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
727 |
label.setText(labelText != null ? labelText : defaultLabel); |
0 | 728 |
|
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
729 |
boolean editable = allowEdit && property.isEditable(); |
487
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
730 |
Color foreground = null; |
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
731 |
int style = Font.PLAIN; |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
732 |
if (property.isErrored()) { |
487
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
733 |
foreground = COLOR_LABEL_ERROR; |
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
734 |
style = Font.BOLD; |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
735 |
if (editable) { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
736 |
EventQueue.invokeLater( |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
737 |
new Runnable() { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
738 |
@Override |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
739 |
public void run() { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
740 |
Component comp = field.getField(); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
741 |
if (comp instanceof JTextComponent) { |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
742 |
((JTextComponent)comp).selectAll(); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
743 |
} |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
744 |
comp.requestFocusInWindow(); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
745 |
} |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
746 |
}); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
747 |
} |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
748 |
} |
487
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
749 |
label.setForeground(foreground); |
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
750 |
label.setFont(label.getFont().deriveFont(style)); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
751 |
label.setVisible(true); |
0 | 752 |
|
473
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
753 |
field.setValue(property.getValue()); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
754 |
field.setEditable(editable); |
18f221b572ce
14914 all local logins should use AF_UNIX connections
Stephen Talley <stephen.talley@oracle.com>
parents:
470
diff
changeset
|
755 |
field.setVisible(true); |
33
3c3f3e185efd
2506 "Specify a role..." should use a flip-down triangle, not a link
Stephen Talley <stephen.talley@sun.com>
parents:
19
diff
changeset
|
756 |
} |
487
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
757 |
|
600
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
758 |
private void setRoleInUI(StringLoginProperty property, boolean allowEdit) { |
487
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
759 |
setInUI(property, roleLabel, roleField, LABEL_ROLE, allowEdit); |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
760 |
} |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
761 |
|
600
c16a7e34499d
17304 - Implement password type
Shadrack Kilemba <Shadrack.Kilemba@Oracle.COM>
parents:
591
diff
changeset
|
762 |
private void setUserInUI(StringLoginProperty property, boolean allowEdit) { |
487
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
763 |
setInUI(property, userLabel, userField, LABEL_USER, allowEdit); |
09d92217e10c
15685 login dialog should support "back" behavior
Stephen Talley <stephen.talley@oracle.com>
parents:
484
diff
changeset
|
764 |
} |
0 | 765 |
} |