author | Stephen Talley <stephen.talley@sun.com> |
Tue, 15 Sep 2009 17:46:37 -0400 | |
changeset 356 | 379b8150bb93 |
parent 344 | acffa4b97c50 |
child 365 | d3e845ff291e |
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 |
/* |
|
219
57841c113efe
6788 package names should share o.o.o.vp prefix
Stephen Talley <stephen.talley@sun.com>
parents:
176
diff
changeset
|
23 |
* Copyright 2009 Sun Microsystems, Inc. All rights reserved. |
0 | 24 |
* Use is subject to license terms. |
25 |
*/ |
|
26 |
||
27 |
package org.opensolaris.os.vp.client.swing; |
|
28 |
||
262
885abe865e16
8009 Help window should not necessarily be tied to main frame
Stephen Talley <stephen.talley@sun.com>
parents:
256
diff
changeset
|
29 |
import java.awt.*; |
885abe865e16
8009 Help window should not necessarily be tied to main frame
Stephen Talley <stephen.talley@sun.com>
parents:
256
diff
changeset
|
30 |
import java.awt.event.*; |
0 | 31 |
import java.net.*; |
279
b82f64a1f586
8129 smf/sharemgr/sysid: breadcrumbs should be shown until UI redesign is implemented
Stephen Talley <stephen.talley@sun.com>
parents:
275
diff
changeset
|
32 |
import java.util.Properties; |
262
885abe865e16
8009 Help window should not necessarily be tied to main frame
Stephen Talley <stephen.talley@sun.com>
parents:
256
diff
changeset
|
33 |
import java.util.logging.*; |
885abe865e16
8009 Help window should not necessarily be tied to main frame
Stephen Talley <stephen.talley@sun.com>
parents:
256
diff
changeset
|
34 |
import javax.help.*; |
344
acffa4b97c50
10973 Move notion of health from vpanels-client to vpanels-panel
David Powell <David.Powell@sun.com>
parents:
323
diff
changeset
|
35 |
import javax.swing.*; |
0 | 36 |
import org.opensolaris.os.vp.client.common.*; |
40
d1412af1ae5b
3215 ActionAbortedException is used too broadly
Stephen Talley <stephen.talley@sun.com>
parents:
39
diff
changeset
|
37 |
import org.opensolaris.os.vp.panel.common.*; |
d1412af1ae5b
3215 ActionAbortedException is used too broadly
Stephen Talley <stephen.talley@sun.com>
parents:
39
diff
changeset
|
38 |
import org.opensolaris.os.vp.panel.common.action.*; |
d1412af1ae5b
3215 ActionAbortedException is used too broadly
Stephen Talley <stephen.talley@sun.com>
parents:
39
diff
changeset
|
39 |
import org.opensolaris.os.vp.panel.common.control.*; |
d1412af1ae5b
3215 ActionAbortedException is used too broadly
Stephen Talley <stephen.talley@sun.com>
parents:
39
diff
changeset
|
40 |
import org.opensolaris.os.vp.panel.common.view.BusyIndicator; |
251
2d4060817fe2
7905 NavigationListeners that resize a window or handle UI flicker should not be tied to a specific Window
Stephen Talley <stephen.talley@sun.com>
parents:
243
diff
changeset
|
41 |
import org.opensolaris.os.vp.panel.swing.control.*; |
266
b6e25669b646
7654 add status/status text to header
Stephen Talley <stephen.talley@sun.com>
parents:
262
diff
changeset
|
42 |
import org.opensolaris.os.vp.panel.swing.view.AuthPanel; |
220
696985231edf
6899 --topless/-t option should be changed to --undecorated
Stephen Talley <stephen.talley@sun.com>
parents:
219
diff
changeset
|
43 |
import org.opensolaris.os.vp.util.misc.*; |
219
57841c113efe
6788 package names should share o.o.o.vp prefix
Stephen Talley <stephen.talley@sun.com>
parents:
176
diff
changeset
|
44 |
import org.opensolaris.os.vp.util.swing.GUIUtil; |
0 | 45 |
|
46 |
@SuppressWarnings({"serial"}) |
|
47 |
public class AppInstance implements ClientContext { |
|
344
acffa4b97c50
10973 Move notion of health from vpanels-client to vpanels-panel
David Powell <David.Powell@sun.com>
parents:
323
diff
changeset
|
48 |
|
acffa4b97c50
10973 Move notion of health from vpanels-client to vpanels-panel
David Powell <David.Powell@sun.com>
parents:
323
diff
changeset
|
49 |
static { |
acffa4b97c50
10973 Move notion of health from vpanels-client to vpanels-panel
David Powell <David.Powell@sun.com>
parents:
323
diff
changeset
|
50 |
// Force early load of runtime properties |
acffa4b97c50
10973 Move notion of health from vpanels-client to vpanels-panel
David Powell <David.Powell@sun.com>
parents:
323
diff
changeset
|
51 |
AppProperties a = AppProperties.singleton; |
acffa4b97c50
10973 Move notion of health from vpanels-client to vpanels-panel
David Powell <David.Powell@sun.com>
parents:
323
diff
changeset
|
52 |
|
acffa4b97c50
10973 Move notion of health from vpanels-client to vpanels-panel
David Powell <David.Powell@sun.com>
parents:
323
diff
changeset
|
53 |
// Set look and feel unless user has a preference |
acffa4b97c50
10973 Move notion of health from vpanels-client to vpanels-panel
David Powell <David.Powell@sun.com>
parents:
323
diff
changeset
|
54 |
String gtk = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"; |
acffa4b97c50
10973 Move notion of health from vpanels-client to vpanels-panel
David Powell <David.Powell@sun.com>
parents:
323
diff
changeset
|
55 |
|
acffa4b97c50
10973 Move notion of health from vpanels-client to vpanels-panel
David Powell <David.Powell@sun.com>
parents:
323
diff
changeset
|
56 |
if (System.getProperty("swing.defaultlaf") == null) { |
acffa4b97c50
10973 Move notion of health from vpanels-client to vpanels-panel
David Powell <David.Powell@sun.com>
parents:
323
diff
changeset
|
57 |
String lafName = UIManager.getSystemLookAndFeelClassName(); |
acffa4b97c50
10973 Move notion of health from vpanels-client to vpanels-panel
David Powell <David.Powell@sun.com>
parents:
323
diff
changeset
|
58 |
// Refuse to be a victim of Solaris's Motif default |
acffa4b97c50
10973 Move notion of health from vpanels-client to vpanels-panel
David Powell <David.Powell@sun.com>
parents:
323
diff
changeset
|
59 |
if (lafName.contains("MotifLookAndFeel")) |
acffa4b97c50
10973 Move notion of health from vpanels-client to vpanels-panel
David Powell <David.Powell@sun.com>
parents:
323
diff
changeset
|
60 |
lafName = gtk; |
acffa4b97c50
10973 Move notion of health from vpanels-client to vpanels-panel
David Powell <David.Powell@sun.com>
parents:
323
diff
changeset
|
61 |
try { |
acffa4b97c50
10973 Move notion of health from vpanels-client to vpanels-panel
David Powell <David.Powell@sun.com>
parents:
323
diff
changeset
|
62 |
UIManager.setLookAndFeel(lafName); |
acffa4b97c50
10973 Move notion of health from vpanels-client to vpanels-panel
David Powell <David.Powell@sun.com>
parents:
323
diff
changeset
|
63 |
} catch (Exception ignore) { |
acffa4b97c50
10973 Move notion of health from vpanels-client to vpanels-panel
David Powell <David.Powell@sun.com>
parents:
323
diff
changeset
|
64 |
} |
acffa4b97c50
10973 Move notion of health from vpanels-client to vpanels-panel
David Powell <David.Powell@sun.com>
parents:
323
diff
changeset
|
65 |
} |
acffa4b97c50
10973 Move notion of health from vpanels-client to vpanels-panel
David Powell <David.Powell@sun.com>
parents:
323
diff
changeset
|
66 |
|
acffa4b97c50
10973 Move notion of health from vpanels-client to vpanels-panel
David Powell <David.Powell@sun.com>
parents:
323
diff
changeset
|
67 |
LookAndFeel laf = UIManager.getLookAndFeel(); |
acffa4b97c50
10973 Move notion of health from vpanels-client to vpanels-panel
David Powell <David.Powell@sun.com>
parents:
323
diff
changeset
|
68 |
|
acffa4b97c50
10973 Move notion of health from vpanels-client to vpanels-panel
David Powell <David.Powell@sun.com>
parents:
323
diff
changeset
|
69 |
// Handle Gnome-specific bugs |
acffa4b97c50
10973 Move notion of health from vpanels-client to vpanels-panel
David Powell <David.Powell@sun.com>
parents:
323
diff
changeset
|
70 |
if (laf != null && laf.getClass().getName().equals(gtk)) { |
acffa4b97c50
10973 Move notion of health from vpanels-client to vpanels-panel
David Powell <David.Powell@sun.com>
parents:
323
diff
changeset
|
71 |
// Gnome L&F doesn't set this correctly |
acffa4b97c50
10973 Move notion of health from vpanels-client to vpanels-panel
David Powell <David.Powell@sun.com>
parents:
323
diff
changeset
|
72 |
UIManager.put("ToolTip.background", new JToolTip().getBackground()); |
acffa4b97c50
10973 Move notion of health from vpanels-client to vpanels-panel
David Powell <David.Powell@sun.com>
parents:
323
diff
changeset
|
73 |
|
acffa4b97c50
10973 Move notion of health from vpanels-client to vpanels-panel
David Powell <David.Powell@sun.com>
parents:
323
diff
changeset
|
74 |
// Gnome L&F is the only L&F that does this |
acffa4b97c50
10973 Move notion of health from vpanels-client to vpanels-panel
David Powell <David.Powell@sun.com>
parents:
323
diff
changeset
|
75 |
UIManager.put("Slider.paintValue", Boolean.FALSE); |
acffa4b97c50
10973 Move notion of health from vpanels-client to vpanels-panel
David Powell <David.Powell@sun.com>
parents:
323
diff
changeset
|
76 |
} |
acffa4b97c50
10973 Move notion of health from vpanels-client to vpanels-panel
David Powell <David.Powell@sun.com>
parents:
323
diff
changeset
|
77 |
} |
acffa4b97c50
10973 Move notion of health from vpanels-client to vpanels-panel
David Powell <David.Powell@sun.com>
parents:
323
diff
changeset
|
78 |
|
0 | 79 |
// |
80 |
// Instance data |
|
81 |
// |
|
82 |
||
83 |
private App app; |
|
256
a570f2e29dbd
7971 login dialog should be external and modal
Stephen Talley <stephen.talley@sun.com>
parents:
251
diff
changeset
|
84 |
private LoginPane loginPane; |
0 | 85 |
private String title; |
86 |
private AppFrame frame; |
|
87 |
private AppLoginManager loginManager; |
|
88 |
private ConnectionInfo info; |
|
89 |
private PanelDescriptorFactory factory; |
|
262
885abe865e16
8009 Help window should not necessarily be tied to main frame
Stephen Talley <stephen.talley@sun.com>
parents:
256
diff
changeset
|
90 |
private SwingNavigator navigator; |
157
f4316b998c95
4857 all classes that handle event management should use EventListeners class
Stephen Talley <stephen.talley@sun.com>
parents:
156
diff
changeset
|
91 |
private ConnectionListeners listeners = new ConnectionListeners(true); |
0 | 92 |
|
262
885abe865e16
8009 Help window should not necessarily be tied to main frame
Stephen Talley <stephen.talley@sun.com>
parents:
256
diff
changeset
|
93 |
private HelpBroker helpBroker; |
885abe865e16
8009 Help window should not necessarily be tied to main frame
Stephen Talley <stephen.talley@sun.com>
parents:
256
diff
changeset
|
94 |
private ActionListener showHelpAction; |
885abe865e16
8009 Help window should not necessarily be tied to main frame
Stephen Talley <stephen.talley@sun.com>
parents:
256
diff
changeset
|
95 |
|
55
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
96 |
// Wrap the AppFrame's BusyIndicator in non-UI-thread-accessible methods |
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
97 |
private BusyIndicator busyIndicator = new BusyIndicator() { |
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
98 |
@Override |
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
99 |
public int getDelay() { |
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
100 |
return frame.getBusyIndicator().getDelay(); |
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
101 |
} |
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
102 |
|
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
103 |
@Override |
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
104 |
public String getMessage() { |
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
105 |
return frame.getBusyIndicator().getMessage(); |
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
106 |
} |
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
107 |
|
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
108 |
@Override |
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
109 |
public boolean isShown() { |
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
110 |
return frame.getBusyIndicator().isShown(); |
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
111 |
} |
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
112 |
|
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
113 |
@Override |
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
114 |
public void setDelay(int delay) { |
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
115 |
frame.getBusyIndicator().setDelay(delay); |
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
116 |
} |
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
117 |
|
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
118 |
@Override |
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
119 |
public void setShown(final boolean shown) { |
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
120 |
GUIUtil.invokeAndWait( |
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
121 |
new Runnable() { |
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
122 |
@Override |
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
123 |
public void run() { |
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
124 |
frame.getBusyIndicator().setShown(shown); |
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
125 |
} |
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
126 |
}); |
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
127 |
} |
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
128 |
|
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
129 |
@Override |
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
130 |
public void setMessage(final String message) { |
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
131 |
GUIUtil.invokeAndWait( |
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
132 |
new Runnable() { |
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
133 |
@Override |
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
134 |
public void run() { |
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
135 |
frame.getBusyIndicator().setMessage(message); |
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
136 |
} |
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
137 |
}); |
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
138 |
} |
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
139 |
}; |
bf29b35b1773
3318 sharemgr: Navigating to new share after creation causes unintended login popup
Stephen Talley <stephen.talley@sun.com>
parents:
40
diff
changeset
|
140 |
|
0 | 141 |
// |
142 |
// Constructors |
|
143 |
// |
|
144 |
||
279
b82f64a1f586
8129 smf/sharemgr/sysid: breadcrumbs should be shown until UI redesign is implemented
Stephen Talley <stephen.talley@sun.com>
parents:
275
diff
changeset
|
145 |
public AppInstance(App app, Properties properteis) { |
0 | 146 |
this.app = app; |
147 |
||
279
b82f64a1f586
8129 smf/sharemgr/sysid: breadcrumbs should be shown until UI redesign is implemented
Stephen Talley <stephen.talley@sun.com>
parents:
275
diff
changeset
|
148 |
frame = new AppFrame(this, properteis); |
312
d435e63e1a43
9323 apache: list selection changes even when navigation is aborted
Stephen Talley <stephen.talley@sun.com>
parents:
302
diff
changeset
|
149 |
frame.addWindowListener( |
d435e63e1a43
9323 apache: list selection changes even when navigation is aborted
Stephen Talley <stephen.talley@sun.com>
parents:
302
diff
changeset
|
150 |
new WindowAdapter() { |
d435e63e1a43
9323 apache: list selection changes even when navigation is aborted
Stephen Talley <stephen.talley@sun.com>
parents:
302
diff
changeset
|
151 |
@Override |
d435e63e1a43
9323 apache: list selection changes even when navigation is aborted
Stephen Talley <stephen.talley@sun.com>
parents:
302
diff
changeset
|
152 |
public void windowClosing(WindowEvent e) { |
d435e63e1a43
9323 apache: list selection changes even when navigation is aborted
Stephen Talley <stephen.talley@sun.com>
parents:
302
diff
changeset
|
153 |
navigator.asyncExec( |
d435e63e1a43
9323 apache: list selection changes even when navigation is aborted
Stephen Talley <stephen.talley@sun.com>
parents:
302
diff
changeset
|
154 |
new Runnable() { |
d435e63e1a43
9323 apache: list selection changes even when navigation is aborted
Stephen Talley <stephen.talley@sun.com>
parents:
302
diff
changeset
|
155 |
@Override |
d435e63e1a43
9323 apache: list selection changes even when navigation is aborted
Stephen Talley <stephen.talley@sun.com>
parents:
302
diff
changeset
|
156 |
public void run() { |
d435e63e1a43
9323 apache: list selection changes even when navigation is aborted
Stephen Talley <stephen.talley@sun.com>
parents:
302
diff
changeset
|
157 |
try { |
356
379b8150bb93
11379 apache: unable to cancel app with bad data in outstanding changes
Stephen Talley <stephen.talley@sun.com>
parents:
344
diff
changeset
|
158 |
closeInstance(false); |
312
d435e63e1a43
9323 apache: list selection changes even when navigation is aborted
Stephen Talley <stephen.talley@sun.com>
parents:
302
diff
changeset
|
159 |
} catch (ActionAbortedException ignore) { |
d435e63e1a43
9323 apache: list selection changes even when navigation is aborted
Stephen Talley <stephen.talley@sun.com>
parents:
302
diff
changeset
|
160 |
} |
d435e63e1a43
9323 apache: list selection changes even when navigation is aborted
Stephen Talley <stephen.talley@sun.com>
parents:
302
diff
changeset
|
161 |
} |
d435e63e1a43
9323 apache: list selection changes even when navigation is aborted
Stephen Talley <stephen.talley@sun.com>
parents:
302
diff
changeset
|
162 |
}); |
d435e63e1a43
9323 apache: list selection changes even when navigation is aborted
Stephen Talley <stephen.talley@sun.com>
parents:
302
diff
changeset
|
163 |
} |
d435e63e1a43
9323 apache: list selection changes even when navigation is aborted
Stephen Talley <stephen.talley@sun.com>
parents:
302
diff
changeset
|
164 |
}); |
d435e63e1a43
9323 apache: list selection changes even when navigation is aborted
Stephen Talley <stephen.talley@sun.com>
parents:
302
diff
changeset
|
165 |
|
256
a570f2e29dbd
7971 login dialog should be external and modal
Stephen Talley <stephen.talley@sun.com>
parents:
251
diff
changeset
|
166 |
createLoginPane(); |
0 | 167 |
|
256
a570f2e29dbd
7971 login dialog should be external and modal
Stephen Talley <stephen.talley@sun.com>
parents:
251
diff
changeset
|
168 |
loginManager = new AppLoginManager(this); |
0 | 169 |
|
170 |
PanelResourceManager manager = new SwingPanelResourceManager(this); |
|
171 |
factory = new SwingPanelDescriptorFactory(this, manager); |
|
172 |
||
173 |
createNavigator(); |
|
174 |
frame.navigatorCreated(); |
|
262
885abe865e16
8009 Help window should not necessarily be tied to main frame
Stephen Talley <stephen.talley@sun.com>
parents:
256
diff
changeset
|
175 |
|
885abe865e16
8009 Help window should not necessarily be tied to main frame
Stephen Talley <stephen.talley@sun.com>
parents:
256
diff
changeset
|
176 |
createHelp(); |
0 | 177 |
} |
178 |
||
179 |
// |
|
180 |
// ClientContext methods |
|
181 |
// |
|
182 |
||
183 |
@Override |
|
184 |
public void addConnectionListener(ConnectionListener listener) { |
|
157
f4316b998c95
4857 all classes that handle event management should use EventListeners class
Stephen Talley <stephen.talley@sun.com>
parents:
156
diff
changeset
|
185 |
listeners.add(listener); |
0 | 186 |
} |
187 |
||
188 |
@Override |
|
356
379b8150bb93
11379 apache: unable to cancel app with bad data in outstanding changes
Stephen Talley <stephen.talley@sun.com>
parents:
344
diff
changeset
|
189 |
public void closeInstance(boolean isCancel) throws ActionAbortedException { |
256
a570f2e29dbd
7971 login dialog should be external and modal
Stephen Talley <stephen.talley@sun.com>
parents:
251
diff
changeset
|
190 |
if (loginPane.isShowing()) { |
176
75562bda9d0d
5276 SettingsButtonBar should support Apply, Quit buttons
Stephen Talley <stephen.talley@sun.com>
parents:
171
diff
changeset
|
191 |
throw new ActionAbortedException(); |
75562bda9d0d
5276 SettingsButtonBar should support Apply, Quit buttons
Stephen Talley <stephen.talley@sun.com>
parents:
171
diff
changeset
|
192 |
} |
75562bda9d0d
5276 SettingsButtonBar should support Apply, Quit buttons
Stephen Talley <stephen.talley@sun.com>
parents:
171
diff
changeset
|
193 |
|
75562bda9d0d
5276 SettingsButtonBar should support Apply, Quit buttons
Stephen Talley <stephen.talley@sun.com>
parents:
171
diff
changeset
|
194 |
try { |
75562bda9d0d
5276 SettingsButtonBar should support Apply, Quit buttons
Stephen Talley <stephen.talley@sun.com>
parents:
171
diff
changeset
|
195 |
// Unwind navigation stack to force user to handle pending changes |
356
379b8150bb93
11379 apache: unable to cancel app with bad data in outstanding changes
Stephen Talley <stephen.talley@sun.com>
parents:
344
diff
changeset
|
196 |
navigator.goToAsyncAndWait(isCancel, null); |
176
75562bda9d0d
5276 SettingsButtonBar should support Apply, Quit buttons
Stephen Talley <stephen.talley@sun.com>
parents:
171
diff
changeset
|
197 |
|
75562bda9d0d
5276 SettingsButtonBar should support Apply, Quit buttons
Stephen Talley <stephen.talley@sun.com>
parents:
171
diff
changeset
|
198 |
} catch (NavigationAbortedException e) { |
75562bda9d0d
5276 SettingsButtonBar should support Apply, Quit buttons
Stephen Talley <stephen.talley@sun.com>
parents:
171
diff
changeset
|
199 |
throw new ActionAbortedException(e); |
75562bda9d0d
5276 SettingsButtonBar should support Apply, Quit buttons
Stephen Talley <stephen.talley@sun.com>
parents:
171
diff
changeset
|
200 |
|
75562bda9d0d
5276 SettingsButtonBar should support Apply, Quit buttons
Stephen Talley <stephen.talley@sun.com>
parents:
171
diff
changeset
|
201 |
} catch (InvalidAddressException e) { |
75562bda9d0d
5276 SettingsButtonBar should support Apply, Quit buttons
Stephen Talley <stephen.talley@sun.com>
parents:
171
diff
changeset
|
202 |
// Should not be possible |
75562bda9d0d
5276 SettingsButtonBar should support Apply, Quit buttons
Stephen Talley <stephen.talley@sun.com>
parents:
171
diff
changeset
|
203 |
|
75562bda9d0d
5276 SettingsButtonBar should support Apply, Quit buttons
Stephen Talley <stephen.talley@sun.com>
parents:
171
diff
changeset
|
204 |
} catch (InvalidParameterException e) { |
75562bda9d0d
5276 SettingsButtonBar should support Apply, Quit buttons
Stephen Talley <stephen.talley@sun.com>
parents:
171
diff
changeset
|
205 |
// Should not be possible |
75562bda9d0d
5276 SettingsButtonBar should support Apply, Quit buttons
Stephen Talley <stephen.talley@sun.com>
parents:
171
diff
changeset
|
206 |
} |
75562bda9d0d
5276 SettingsButtonBar should support Apply, Quit buttons
Stephen Talley <stephen.talley@sun.com>
parents:
171
diff
changeset
|
207 |
|
75562bda9d0d
5276 SettingsButtonBar should support Apply, Quit buttons
Stephen Talley <stephen.talley@sun.com>
parents:
171
diff
changeset
|
208 |
close(); |
75562bda9d0d
5276 SettingsButtonBar should support Apply, Quit buttons
Stephen Talley <stephen.talley@sun.com>
parents:
171
diff
changeset
|
209 |
} |
75562bda9d0d
5276 SettingsButtonBar should support Apply, Quit buttons
Stephen Talley <stephen.talley@sun.com>
parents:
171
diff
changeset
|
210 |
|
323
497a785649eb
10071 apply new design to SMF panel
David Powell <David.Powell@sun.com>
parents:
312
diff
changeset
|
211 |
public void newInstance(String path) { |
497a785649eb
10071 apply new design to SMF panel
David Powell <David.Powell@sun.com>
parents:
312
diff
changeset
|
212 |
app.load(info, path); |
497a785649eb
10071 apply new design to SMF panel
David Powell <David.Powell@sun.com>
parents:
312
diff
changeset
|
213 |
} |
497a785649eb
10071 apply new design to SMF panel
David Powell <David.Powell@sun.com>
parents:
312
diff
changeset
|
214 |
|
176
75562bda9d0d
5276 SettingsButtonBar should support Apply, Quit buttons
Stephen Talley <stephen.talley@sun.com>
parents:
171
diff
changeset
|
215 |
@Override |
220
696985231edf
6899 --topless/-t option should be changed to --undecorated
Stephen Talley <stephen.talley@sun.com>
parents:
219
diff
changeset
|
216 |
public BusyIndicator getBusyIndicator() { |
696985231edf
6899 --topless/-t option should be changed to --undecorated
Stephen Talley <stephen.talley@sun.com>
parents:
219
diff
changeset
|
217 |
return busyIndicator; |
696985231edf
6899 --topless/-t option should be changed to --undecorated
Stephen Talley <stephen.talley@sun.com>
parents:
219
diff
changeset
|
218 |
} |
696985231edf
6899 --topless/-t option should be changed to --undecorated
Stephen Talley <stephen.talley@sun.com>
parents:
219
diff
changeset
|
219 |
|
696985231edf
6899 --topless/-t option should be changed to --undecorated
Stephen Talley <stephen.talley@sun.com>
parents:
219
diff
changeset
|
220 |
@Override |
0 | 221 |
public ConnectionInfo getConnectionInfo() { |
222 |
return info; |
|
223 |
} |
|
224 |
||
225 |
@Override |
|
220
696985231edf
6899 --topless/-t option should be changed to --undecorated
Stephen Talley <stephen.talley@sun.com>
parents:
219
diff
changeset
|
226 |
public HelpBroker getHelpBroker() { |
262
885abe865e16
8009 Help window should not necessarily be tied to main frame
Stephen Talley <stephen.talley@sun.com>
parents:
256
diff
changeset
|
227 |
return helpBroker; |
220
696985231edf
6899 --topless/-t option should be changed to --undecorated
Stephen Talley <stephen.talley@sun.com>
parents:
219
diff
changeset
|
228 |
} |
696985231edf
6899 --topless/-t option should be changed to --undecorated
Stephen Talley <stephen.talley@sun.com>
parents:
219
diff
changeset
|
229 |
|
696985231edf
6899 --topless/-t option should be changed to --undecorated
Stephen Talley <stephen.talley@sun.com>
parents:
219
diff
changeset
|
230 |
@Override |
0 | 231 |
public Logger getLog() { |
232 |
return App.log; |
|
233 |
} |
|
234 |
||
235 |
@Override |
|
236 |
public String getTitle() { |
|
237 |
return title; |
|
238 |
} |
|
239 |
||
240 |
@Override |
|
241 |
public boolean removeConnectionListener(ConnectionListener listener) { |
|
220
696985231edf
6899 --topless/-t option should be changed to --undecorated
Stephen Talley <stephen.talley@sun.com>
parents:
219
diff
changeset
|
242 |
return listeners.remove(listener); |
0 | 243 |
} |
244 |
||
245 |
@Override |
|
39
3dd6445bd848
2463 operations that require privilege should prompt user
Stephen Talley <stephen.talley@sun.com>
parents:
32
diff
changeset
|
246 |
public void requestConnection(String user, String role, |
3dd6445bd848
2463 operations that require privilege should prompt user
Stephen Talley <stephen.talley@sun.com>
parents:
32
diff
changeset
|
247 |
DialogMessage message) throws ActionAbortedException { |
3dd6445bd848
2463 operations that require privilege should prompt user
Stephen Talley <stephen.talley@sun.com>
parents:
32
diff
changeset
|
248 |
|
3dd6445bd848
2463 operations that require privilege should prompt user
Stephen Talley <stephen.talley@sun.com>
parents:
32
diff
changeset
|
249 |
loginPane.setDefaultMessage(message); |
3dd6445bd848
2463 operations that require privilege should prompt user
Stephen Talley <stephen.talley@sun.com>
parents:
32
diff
changeset
|
250 |
loginPane.setHostFieldEditable(false); |
3dd6445bd848
2463 operations that require privilege should prompt user
Stephen Talley <stephen.talley@sun.com>
parents:
32
diff
changeset
|
251 |
|
3dd6445bd848
2463 operations that require privilege should prompt user
Stephen Talley <stephen.talley@sun.com>
parents:
32
diff
changeset
|
252 |
try { |
3dd6445bd848
2463 operations that require privilege should prompt user
Stephen Talley <stephen.talley@sun.com>
parents:
32
diff
changeset
|
253 |
// Create or retrieve ConnectionInfo - throws ActionAbortedException |
300
7f3357de9250
8810 incomplete support for port specification
David Powell <David.Powell@sun.com>
parents:
279
diff
changeset
|
254 |
ConnectionInfo info = getConnectionInfo(null, -1, user, role, true); |
39
3dd6445bd848
2463 operations that require privilege should prompt user
Stephen Talley <stephen.talley@sun.com>
parents:
32
diff
changeset
|
255 |
|
3dd6445bd848
2463 operations that require privilege should prompt user
Stephen Talley <stephen.talley@sun.com>
parents:
32
diff
changeset
|
256 |
// Guaranteed to be non-null |
3dd6445bd848
2463 operations that require privilege should prompt user
Stephen Talley <stephen.talley@sun.com>
parents:
32
diff
changeset
|
257 |
setConnectionInfo(info); |
40
d1412af1ae5b
3215 ActionAbortedException is used too broadly
Stephen Talley <stephen.talley@sun.com>
parents:
39
diff
changeset
|
258 |
|
d1412af1ae5b
3215 ActionAbortedException is used too broadly
Stephen Talley <stephen.talley@sun.com>
parents:
39
diff
changeset
|
259 |
} catch (NavigationAbortedException e) { |
d1412af1ae5b
3215 ActionAbortedException is used too broadly
Stephen Talley <stephen.talley@sun.com>
parents:
39
diff
changeset
|
260 |
// Should not be possible since the host didn't change |
d1412af1ae5b
3215 ActionAbortedException is used too broadly
Stephen Talley <stephen.talley@sun.com>
parents:
39
diff
changeset
|
261 |
throw new ActionAbortedException(e); |
d1412af1ae5b
3215 ActionAbortedException is used too broadly
Stephen Talley <stephen.talley@sun.com>
parents:
39
diff
changeset
|
262 |
|
39
3dd6445bd848
2463 operations that require privilege should prompt user
Stephen Talley <stephen.talley@sun.com>
parents:
32
diff
changeset
|
263 |
} finally { |
3dd6445bd848
2463 operations that require privilege should prompt user
Stephen Talley <stephen.talley@sun.com>
parents:
32
diff
changeset
|
264 |
loginPane.setDefaultMessage(null); |
3dd6445bd848
2463 operations that require privilege should prompt user
Stephen Talley <stephen.talley@sun.com>
parents:
32
diff
changeset
|
265 |
loginPane.setHostFieldEditable(true); |
3dd6445bd848
2463 operations that require privilege should prompt user
Stephen Talley <stephen.talley@sun.com>
parents:
32
diff
changeset
|
266 |
} |
3dd6445bd848
2463 operations that require privilege should prompt user
Stephen Talley <stephen.talley@sun.com>
parents:
32
diff
changeset
|
267 |
} |
3dd6445bd848
2463 operations that require privilege should prompt user
Stephen Talley <stephen.talley@sun.com>
parents:
32
diff
changeset
|
268 |
|
3dd6445bd848
2463 operations that require privilege should prompt user
Stephen Talley <stephen.talley@sun.com>
parents:
32
diff
changeset
|
269 |
@Override |
0 | 270 |
public void setTitle(String title) { |
271 |
this.title = title; |
|
272 |
setTitle(); |
|
273 |
} |
|
274 |
||
171
ec6f1c5d031c
2537 API and UI should support deep-linking into help text
Stephen Talley <stephen.talley@sun.com>
parents:
161
diff
changeset
|
275 |
@Override |
ec6f1c5d031c
2537 API and UI should support deep-linking into help text
Stephen Talley <stephen.talley@sun.com>
parents:
161
diff
changeset
|
276 |
public void showHelp() { |
262
885abe865e16
8009 Help window should not necessarily be tied to main frame
Stephen Talley <stephen.talley@sun.com>
parents:
256
diff
changeset
|
277 |
Window window = navigator.getWindow(); |
885abe865e16
8009 Help window should not necessarily be tied to main frame
Stephen Talley <stephen.talley@sun.com>
parents:
256
diff
changeset
|
278 |
|
885abe865e16
8009 Help window should not necessarily be tied to main frame
Stephen Talley <stephen.talley@sun.com>
parents:
256
diff
changeset
|
279 |
ActionEvent event = new ActionEvent( |
885abe865e16
8009 Help window should not necessarily be tied to main frame
Stephen Talley <stephen.talley@sun.com>
parents:
256
diff
changeset
|
280 |
window, ActionEvent.ACTION_PERFORMED, "showHelp"); |
885abe865e16
8009 Help window should not necessarily be tied to main frame
Stephen Talley <stephen.talley@sun.com>
parents:
256
diff
changeset
|
281 |
|
885abe865e16
8009 Help window should not necessarily be tied to main frame
Stephen Talley <stephen.talley@sun.com>
parents:
256
diff
changeset
|
282 |
showHelpAction.actionPerformed(event); |
171
ec6f1c5d031c
2537 API and UI should support deep-linking into help text
Stephen Talley <stephen.talley@sun.com>
parents:
161
diff
changeset
|
283 |
} |
ec6f1c5d031c
2537 API and UI should support deep-linking into help text
Stephen Talley <stephen.talley@sun.com>
parents:
161
diff
changeset
|
284 |
|
0 | 285 |
// |
286 |
// AppInstance methods |
|
287 |
// |
|
288 |
||
289 |
/** |
|
290 |
* Closes this {@code AppInstance} unconditionally. |
|
291 |
*/ |
|
292 |
public void close() { |
|
293 |
ConnectionInfo info = getConnectionInfo(); |
|
294 |
if (info != null) { |
|
295 |
app.getConnectionManager().removeConnection(info, this); |
|
296 |
} |
|
297 |
||
256
a570f2e29dbd
7971 login dialog should be external and modal
Stephen Talley <stephen.talley@sun.com>
parents:
251
diff
changeset
|
298 |
loginPane.dispose(); |
0 | 299 |
frame.dispose(); |
300 |
||
301 |
// Notify App |
|
302 |
app.instanceClosed(this); |
|
303 |
} |
|
304 |
||
305 |
protected void fireChangeEvent( |
|
306 |
ConnectionInfo oldInfo, ConnectionInfo info) { |
|
307 |
||
102
a39a3f68b935
3751 add enable/disable actions to SMF panel
David Powell <David.Powell@sun.com>
parents:
61
diff
changeset
|
308 |
listeners.connectionChanged(new ConnectionEvent(this, oldInfo, info)); |
0 | 309 |
} |
310 |
||
311 |
public App getApp() { |
|
312 |
return app; |
|
313 |
} |
|
314 |
||
315 |
/** |
|
316 |
* Retrieve or create a {@link ConnectionInfo} for the given host and user. |
|
317 |
* If {@code forceManualLogin} is {@code false}, an attempt is first made to |
|
318 |
* find an existing connection for the given parameters. If no connection |
|
319 |
* is found, {@link #getConnectionInfoFromLogin} is called to prompt the |
|
320 |
* user to select or create a connection through the login pane. |
|
321 |
* |
|
322 |
* @param host |
|
300
7f3357de9250
8810 incomplete support for port specification
David Powell <David.Powell@sun.com>
parents:
279
diff
changeset
|
323 |
* the host, or {@code null} to use the host and port from the |
7f3357de9250
8810 incomplete support for port specification
David Powell <David.Powell@sun.com>
parents:
279
diff
changeset
|
324 |
* current connection, if any |
7f3357de9250
8810 incomplete support for port specification
David Powell <David.Powell@sun.com>
parents:
279
diff
changeset
|
325 |
* |
7f3357de9250
8810 incomplete support for port specification
David Powell <David.Powell@sun.com>
parents:
279
diff
changeset
|
326 |
* @param port |
7f3357de9250
8810 incomplete support for port specification
David Powell <David.Powell@sun.com>
parents:
279
diff
changeset
|
327 |
* the port, or {@code -1} to use the default port |
0 | 328 |
* |
329 |
* @param user |
|
330 |
* the user, or {@code null} to use the user from the current |
|
331 |
* connection, if any |
|
332 |
* |
|
333 |
* @param role |
|
334 |
* the role, or {@code null} to use the role from the current |
|
335 |
* connection, if any |
|
336 |
* |
|
337 |
* @param forceManualLogin |
|
338 |
* if {@code true}, do not search for an existing connection |
|
339 |
* connection before displaying the login pane |
|
340 |
* |
|
341 |
* @return a non-{@code null} {@link ConnectionInfo} |
|
342 |
* |
|
343 |
* @exception ActionAbortedException |
|
344 |
* if no existing {@link ConnectionInfo} matching the given |
|
345 |
* host/user is found, and the user cancels the login pane |
|
346 |
*/ |
|
300
7f3357de9250
8810 incomplete support for port specification
David Powell <David.Powell@sun.com>
parents:
279
diff
changeset
|
347 |
protected ConnectionInfo getConnectionInfo(String host, int port, |
7f3357de9250
8810 incomplete support for port specification
David Powell <David.Powell@sun.com>
parents:
279
diff
changeset
|
348 |
String user, String role, boolean forceManualLogin) |
7f3357de9250
8810 incomplete support for port specification
David Powell <David.Powell@sun.com>
parents:
279
diff
changeset
|
349 |
throws ActionAbortedException { |
0 | 350 |
|
351 |
ConnectionInfo oldinfo = getConnectionInfo(); |
|
352 |
||
353 |
if (oldinfo != null) { |
|
354 |
if (host == null) { |
|
355 |
host = oldinfo.getHost(); |
|
300
7f3357de9250
8810 incomplete support for port specification
David Powell <David.Powell@sun.com>
parents:
279
diff
changeset
|
356 |
port = oldinfo.getPort(); |
0 | 357 |
} |
358 |
||
359 |
if (user == null) { |
|
360 |
user = oldinfo.getUser(); |
|
361 |
} |
|
362 |
||
363 |
if (role == null) { |
|
364 |
role = oldinfo.getRole(); |
|
365 |
} |
|
366 |
} |
|
367 |
||
368 |
ConnectionInfo info = null; |
|
369 |
||
370 |
if (!forceManualLogin && host != null && user != null) { |
|
371 |
// Search for an existing connection |
|
300
7f3357de9250
8810 incomplete support for port specification
David Powell <David.Powell@sun.com>
parents:
279
diff
changeset
|
372 |
info = app.getConnectionManager().getConnection(host, port, user, |
7f3357de9250
8810 incomplete support for port specification
David Powell <David.Powell@sun.com>
parents:
279
diff
changeset
|
373 |
role); |
0 | 374 |
} |
375 |
||
376 |
if (info == null) { |
|
377 |
// Prompt user to select or create a connection |
|
300
7f3357de9250
8810 incomplete support for port specification
David Powell <David.Powell@sun.com>
parents:
279
diff
changeset
|
378 |
info = getConnectionInfoFromLogin(host, port, user, role, oldinfo); |
0 | 379 |
} |
380 |
||
381 |
return info; |
|
382 |
} |
|
383 |
||
384 |
/** |
|
385 |
* Create or retrieve a {@link ConnectionInfo} from user interaction with |
|
386 |
* the login pane. |
|
387 |
* |
|
388 |
* @param host |
|
389 |
* if non-{@code null}, the initial value to place in the login |
|
390 |
* pane's host field |
|
391 |
* |
|
300
7f3357de9250
8810 incomplete support for port specification
David Powell <David.Powell@sun.com>
parents:
279
diff
changeset
|
392 |
* @param port |
7f3357de9250
8810 incomplete support for port specification
David Powell <David.Powell@sun.com>
parents:
279
diff
changeset
|
393 |
* if not {@code -1}, the initial port value to place in the |
7f3357de9250
8810 incomplete support for port specification
David Powell <David.Powell@sun.com>
parents:
279
diff
changeset
|
394 |
* login pane's host field |
7f3357de9250
8810 incomplete support for port specification
David Powell <David.Powell@sun.com>
parents:
279
diff
changeset
|
395 |
* |
0 | 396 |
* @param user |
397 |
* if non-{@code null}, the initial value to place in the login |
|
398 |
* pane's user field |
|
399 |
* |
|
400 |
* @param role |
|
401 |
* if non-{@code null}, the initial value to place in the login |
|
402 |
* pane's role field |
|
403 |
* |
|
404 |
* @return a non-{@code null} {@link ConnectionInfo} |
|
405 |
* |
|
406 |
* @exception ActionAbortedException |
|
407 |
* if the user cancels the login pane |
|
408 |
*/ |
|
409 |
protected ConnectionInfo getConnectionInfoFromLogin( |
|
300
7f3357de9250
8810 incomplete support for port specification
David Powell <David.Powell@sun.com>
parents:
279
diff
changeset
|
410 |
String host, int port, String user, String role, ConnectionInfo oldinfo) |
0 | 411 |
throws ActionAbortedException { |
412 |
||
413 |
boolean useExisting = true; |
|
414 |
||
415 |
// Prepopulate LoginPane |
|
416 |
if (host != null) { |
|
300
7f3357de9250
8810 incomplete support for port specification
David Powell <David.Powell@sun.com>
parents:
279
diff
changeset
|
417 |
String hoststr = (port == -1) ? host : host + ":" + port; |
7f3357de9250
8810 incomplete support for port specification
David Powell <David.Powell@sun.com>
parents:
279
diff
changeset
|
418 |
loginPane.setHost(hoststr); |
0 | 419 |
useExisting = false; |
420 |
} |
|
421 |
||
422 |
if (user != null) { |
|
423 |
loginPane.setUser(user); |
|
424 |
useExisting = false; |
|
425 |
} |
|
426 |
||
427 |
if (role != null) { |
|
428 |
loginPane.setRole(role); |
|
429 |
useExisting = false; |
|
430 |
} |
|
431 |
||
432 |
// Select "Use existing connection..." by default in login pane |
|
433 |
loginPane.setUseExistingSelected(useExisting); |
|
434 |
||
435 |
// Throws ActionAbortedException |
|
436 |
return loginManager.getConnectionInfo(oldinfo); |
|
437 |
} |
|
438 |
||
439 |
public AppFrame getFrame() { |
|
440 |
return frame; |
|
441 |
} |
|
442 |
||
256
a570f2e29dbd
7971 login dialog should be external and modal
Stephen Talley <stephen.talley@sun.com>
parents:
251
diff
changeset
|
443 |
protected LoginPane getLoginPane() { |
a570f2e29dbd
7971 login dialog should be external and modal
Stephen Talley <stephen.talley@sun.com>
parents:
251
diff
changeset
|
444 |
return loginPane; |
a570f2e29dbd
7971 login dialog should be external and modal
Stephen Talley <stephen.talley@sun.com>
parents:
251
diff
changeset
|
445 |
} |
a570f2e29dbd
7971 login dialog should be external and modal
Stephen Talley <stephen.talley@sun.com>
parents:
251
diff
changeset
|
446 |
|
0 | 447 |
public Navigator getNavigator() { |
448 |
return navigator; |
|
449 |
} |
|
450 |
||
451 |
public PanelDescriptorFactory getPanelDescriptorFactory() { |
|
452 |
return factory; |
|
453 |
} |
|
454 |
||
455 |
public URI getURI() { |
|
456 |
try { |
|
457 |
ConnectionInfo info = getConnectionInfo(); |
|
300
7f3357de9250
8810 incomplete support for port specification
David Powell <David.Powell@sun.com>
parents:
279
diff
changeset
|
458 |
return App.createURI(info.getHost(), info.getUser(), |
7f3357de9250
8810 incomplete support for port specification
David Powell <David.Powell@sun.com>
parents:
279
diff
changeset
|
459 |
info.getRole(), info.getPort(), navigator.getPathString()); |
0 | 460 |
} catch (URISyntaxException e) { |
461 |
} |
|
462 |
||
463 |
return null; |
|
464 |
} |
|
465 |
||
466 |
/** |
|
39
3dd6445bd848
2463 operations that require privilege should prompt user
Stephen Talley <stephen.talley@sun.com>
parents:
32
diff
changeset
|
467 |
* Retrieve or create a connection, then navigate to the given path. |
0 | 468 |
* |
469 |
* @param host |
|
300
7f3357de9250
8810 incomplete support for port specification
David Powell <David.Powell@sun.com>
parents:
279
diff
changeset
|
470 |
* the host, or {@code null} to use the host and port from the |
7f3357de9250
8810 incomplete support for port specification
David Powell <David.Powell@sun.com>
parents:
279
diff
changeset
|
471 |
* current connection, if any |
7f3357de9250
8810 incomplete support for port specification
David Powell <David.Powell@sun.com>
parents:
279
diff
changeset
|
472 |
* |
7f3357de9250
8810 incomplete support for port specification
David Powell <David.Powell@sun.com>
parents:
279
diff
changeset
|
473 |
* @param port |
7f3357de9250
8810 incomplete support for port specification
David Powell <David.Powell@sun.com>
parents:
279
diff
changeset
|
474 |
* the port, or {@code -1} to use the default port |
0 | 475 |
* |
476 |
* @param user |
|
477 |
* the user, or {@code null} to use the user from the current |
|
478 |
* connection, if any |
|
479 |
* |
|
480 |
* @param role |
|
481 |
* the role, or {@code null} to use the role from the current |
|
482 |
* connection, if any |
|
483 |
* |
|
39
3dd6445bd848
2463 operations that require privilege should prompt user
Stephen Talley <stephen.talley@sun.com>
parents:
32
diff
changeset
|
484 |
* @param path |
3dd6445bd848
2463 operations that require privilege should prompt user
Stephen Talley <stephen.talley@sun.com>
parents:
32
diff
changeset
|
485 |
* the path to navigate to after creating the connection, or |
3dd6445bd848
2463 operations that require privilege should prompt user
Stephen Talley <stephen.talley@sun.com>
parents:
32
diff
changeset
|
486 |
* {@code null} to navigate to the current path |
3dd6445bd848
2463 operations that require privilege should prompt user
Stephen Talley <stephen.talley@sun.com>
parents:
32
diff
changeset
|
487 |
* |
0 | 488 |
* @param forceManualLogin |
489 |
* if {@code true}, do not search for an existing connection |
|
490 |
* connection before displaying the login pane |
|
491 |
* |
|
492 |
* @exception ActionAbortedException |
|
40
d1412af1ae5b
3215 ActionAbortedException is used too broadly
Stephen Talley <stephen.talley@sun.com>
parents:
39
diff
changeset
|
493 |
* see {@link #getConnectionInfo(String,String,String,boolean)} |
d1412af1ae5b
3215 ActionAbortedException is used too broadly
Stephen Talley <stephen.talley@sun.com>
parents:
39
diff
changeset
|
494 |
* |
d1412af1ae5b
3215 ActionAbortedException is used too broadly
Stephen Talley <stephen.talley@sun.com>
parents:
39
diff
changeset
|
495 |
* @exception NavigationAbortedException |
302
ac70675de834
9318 Navigator/Control should distinguish between cancel and non-cancel navigations
Stephen Talley <stephen.talley@sun.com>
parents:
300
diff
changeset
|
496 |
* see {@link Navigator#goTo(boolean,Control,Navigable...)} |
0 | 497 |
* |
498 |
* @exception InvalidAddressException |
|
302
ac70675de834
9318 Navigator/Control should distinguish between cancel and non-cancel navigations
Stephen Talley <stephen.talley@sun.com>
parents:
300
diff
changeset
|
499 |
* see {@link Navigator#goTo(boolean,Control,Navigable...)} |
0 | 500 |
* |
501 |
* @exception MissingParameterException |
|
302
ac70675de834
9318 Navigator/Control should distinguish between cancel and non-cancel navigations
Stephen Talley <stephen.talley@sun.com>
parents:
300
diff
changeset
|
502 |
* see {@link Navigator#goTo(boolean,Control,Navigable...)} |
0 | 503 |
* |
504 |
* @exception InvalidParameterException |
|
302
ac70675de834
9318 Navigator/Control should distinguish between cancel and non-cancel navigations
Stephen Talley <stephen.talley@sun.com>
parents:
300
diff
changeset
|
505 |
* see {@link Navigator#goTo(boolean,Control,Navigable...)} |
0 | 506 |
* |
507 |
* @exception IllegalArgumentException |
|
302
ac70675de834
9318 Navigator/Control should distinguish between cancel and non-cancel navigations
Stephen Talley <stephen.talley@sun.com>
parents:
300
diff
changeset
|
508 |
* see {@link Navigator#goTo(boolean,Control,Navigable...)} |
0 | 509 |
* |
510 |
* @see #getConnectionInfo(String,String,String,boolean) |
|
511 |
*/ |
|
300
7f3357de9250
8810 incomplete support for port specification
David Powell <David.Powell@sun.com>
parents:
279
diff
changeset
|
512 |
protected void load(String host, int port, String user, String role, |
7f3357de9250
8810 incomplete support for port specification
David Powell <David.Powell@sun.com>
parents:
279
diff
changeset
|
513 |
String path, boolean forceManualLogin) throws ActionAbortedException, |
40
d1412af1ae5b
3215 ActionAbortedException is used too broadly
Stephen Talley <stephen.talley@sun.com>
parents:
39
diff
changeset
|
514 |
NavigationAbortedException, InvalidAddressException, |
d1412af1ae5b
3215 ActionAbortedException is used too broadly
Stephen Talley <stephen.talley@sun.com>
parents:
39
diff
changeset
|
515 |
MissingParameterException, InvalidParameterException { |
0 | 516 |
|
517 |
// Save absolute path now, because logging in may change navigation path |
|
518 |
if (path == null) { |
|
519 |
path = navigator.getPathString(); |
|
520 |
} else if (!Navigator.isAbsolute(path)) { |
|
521 |
path = navigator.getPathString() + path; |
|
522 |
} |
|
523 |
||
40
d1412af1ae5b
3215 ActionAbortedException is used too broadly
Stephen Talley <stephen.talley@sun.com>
parents:
39
diff
changeset
|
524 |
// Create or retrieve ConnectionInfo - throws AbortedException |
0 | 525 |
ConnectionInfo info = |
300
7f3357de9250
8810 incomplete support for port specification
David Powell <David.Powell@sun.com>
parents:
279
diff
changeset
|
526 |
getConnectionInfo(host, port, user, role, forceManualLogin); |
0 | 527 |
|
323
497a785649eb
10071 apply new design to SMF panel
David Powell <David.Powell@sun.com>
parents:
312
diff
changeset
|
528 |
navigate(info, path); |
497a785649eb
10071 apply new design to SMF panel
David Powell <David.Powell@sun.com>
parents:
312
diff
changeset
|
529 |
} |
497a785649eb
10071 apply new design to SMF panel
David Powell <David.Powell@sun.com>
parents:
312
diff
changeset
|
530 |
|
497a785649eb
10071 apply new design to SMF panel
David Powell <David.Powell@sun.com>
parents:
312
diff
changeset
|
531 |
void load(ConnectionInfo info, String path) |
497a785649eb
10071 apply new design to SMF panel
David Powell <David.Powell@sun.com>
parents:
312
diff
changeset
|
532 |
throws ActionAbortedException, NavigationAbortedException, |
497a785649eb
10071 apply new design to SMF panel
David Powell <David.Powell@sun.com>
parents:
312
diff
changeset
|
533 |
InvalidAddressException, MissingParameterException, |
497a785649eb
10071 apply new design to SMF panel
David Powell <David.Powell@sun.com>
parents:
312
diff
changeset
|
534 |
InvalidParameterException { |
497a785649eb
10071 apply new design to SMF panel
David Powell <David.Powell@sun.com>
parents:
312
diff
changeset
|
535 |
|
497a785649eb
10071 apply new design to SMF panel
David Powell <David.Powell@sun.com>
parents:
312
diff
changeset
|
536 |
if (!Navigator.isAbsolute(path)) |
497a785649eb
10071 apply new design to SMF panel
David Powell <David.Powell@sun.com>
parents:
312
diff
changeset
|
537 |
throw (new InvalidAddressException(path)); |
497a785649eb
10071 apply new design to SMF panel
David Powell <David.Powell@sun.com>
parents:
312
diff
changeset
|
538 |
|
497a785649eb
10071 apply new design to SMF panel
David Powell <David.Powell@sun.com>
parents:
312
diff
changeset
|
539 |
navigate(info, path); |
497a785649eb
10071 apply new design to SMF panel
David Powell <David.Powell@sun.com>
parents:
312
diff
changeset
|
540 |
} |
497a785649eb
10071 apply new design to SMF panel
David Powell <David.Powell@sun.com>
parents:
312
diff
changeset
|
541 |
|
497a785649eb
10071 apply new design to SMF panel
David Powell <David.Powell@sun.com>
parents:
312
diff
changeset
|
542 |
private void navigate(ConnectionInfo info, final String path) |
497a785649eb
10071 apply new design to SMF panel
David Powell <David.Powell@sun.com>
parents:
312
diff
changeset
|
543 |
throws NavigationAbortedException, InvalidAddressException, |
497a785649eb
10071 apply new design to SMF panel
David Powell <David.Powell@sun.com>
parents:
312
diff
changeset
|
544 |
MissingParameterException, InvalidParameterException |
497a785649eb
10071 apply new design to SMF panel
David Powell <David.Powell@sun.com>
parents:
312
diff
changeset
|
545 |
{ |
40
d1412af1ae5b
3215 ActionAbortedException is used too broadly
Stephen Talley <stephen.talley@sun.com>
parents:
39
diff
changeset
|
546 |
// Guaranteed to be non-null - throws NavigationExceptions |
0 | 547 |
setConnectionInfo(info); |
548 |
||
61
fb7cd11392e7
3335 sharemgr: PathControl at startup shows dialog before main window is shown
Stephen Talley <stephen.talley@sun.com>
parents:
60
diff
changeset
|
549 |
navigator.asyncExecAndWait( |
fb7cd11392e7
3335 sharemgr: PathControl at startup shows dialog before main window is shown
Stephen Talley <stephen.talley@sun.com>
parents:
60
diff
changeset
|
550 |
new NavRunnable() { |
fb7cd11392e7
3335 sharemgr: PathControl at startup shows dialog before main window is shown
Stephen Talley <stephen.talley@sun.com>
parents:
60
diff
changeset
|
551 |
@Override |
fb7cd11392e7
3335 sharemgr: PathControl at startup shows dialog before main window is shown
Stephen Talley <stephen.talley@sun.com>
parents:
60
diff
changeset
|
552 |
public void run() throws NavigationAbortedException, |
fb7cd11392e7
3335 sharemgr: PathControl at startup shows dialog before main window is shown
Stephen Talley <stephen.talley@sun.com>
parents:
60
diff
changeset
|
553 |
InvalidAddressException, MissingParameterException, |
fb7cd11392e7
3335 sharemgr: PathControl at startup shows dialog before main window is shown
Stephen Talley <stephen.talley@sun.com>
parents:
60
diff
changeset
|
554 |
InvalidParameterException { |
fb7cd11392e7
3335 sharemgr: PathControl at startup shows dialog before main window is shown
Stephen Talley <stephen.talley@sun.com>
parents:
60
diff
changeset
|
555 |
|
323
497a785649eb
10071 apply new design to SMF panel
David Powell <David.Powell@sun.com>
parents:
312
diff
changeset
|
556 |
SimpleNavigable[] pArray = Navigator.toArray(path); |
302
ac70675de834
9318 Navigator/Control should distinguish between cancel and non-cancel navigations
Stephen Talley <stephen.talley@sun.com>
parents:
300
diff
changeset
|
557 |
navigator.goTo(false, null, pArray); |
0 | 558 |
|
61
fb7cd11392e7
3335 sharemgr: PathControl at startup shows dialog before main window is shown
Stephen Talley <stephen.talley@sun.com>
parents:
60
diff
changeset
|
559 |
// Schedule this on the navigation thread so that any other |
fb7cd11392e7
3335 sharemgr: PathControl at startup shows dialog before main window is shown
Stephen Talley <stephen.talley@sun.com>
parents:
60
diff
changeset
|
560 |
// pending navigations can be assured that the UI is visible |
fb7cd11392e7
3335 sharemgr: PathControl at startup shows dialog before main window is shown
Stephen Talley <stephen.talley@sun.com>
parents:
60
diff
changeset
|
561 |
// before they start. Ay chihuahua. |
fb7cd11392e7
3335 sharemgr: PathControl at startup shows dialog before main window is shown
Stephen Talley <stephen.talley@sun.com>
parents:
60
diff
changeset
|
562 |
GUIUtil.invokeAndWait( |
fb7cd11392e7
3335 sharemgr: PathControl at startup shows dialog before main window is shown
Stephen Talley <stephen.talley@sun.com>
parents:
60
diff
changeset
|
563 |
new Runnable() { |
fb7cd11392e7
3335 sharemgr: PathControl at startup shows dialog before main window is shown
Stephen Talley <stephen.talley@sun.com>
parents:
60
diff
changeset
|
564 |
@Override |
fb7cd11392e7
3335 sharemgr: PathControl at startup shows dialog before main window is shown
Stephen Talley <stephen.talley@sun.com>
parents:
60
diff
changeset
|
565 |
public void run() { |
fb7cd11392e7
3335 sharemgr: PathControl at startup shows dialog before main window is shown
Stephen Talley <stephen.talley@sun.com>
parents:
60
diff
changeset
|
566 |
// In case we're not already |
fb7cd11392e7
3335 sharemgr: PathControl at startup shows dialog before main window is shown
Stephen Talley <stephen.talley@sun.com>
parents:
60
diff
changeset
|
567 |
frame.setVisible(true); |
fb7cd11392e7
3335 sharemgr: PathControl at startup shows dialog before main window is shown
Stephen Talley <stephen.talley@sun.com>
parents:
60
diff
changeset
|
568 |
} |
fb7cd11392e7
3335 sharemgr: PathControl at startup shows dialog before main window is shown
Stephen Talley <stephen.talley@sun.com>
parents:
60
diff
changeset
|
569 |
}); |
fb7cd11392e7
3335 sharemgr: PathControl at startup shows dialog before main window is shown
Stephen Talley <stephen.talley@sun.com>
parents:
60
diff
changeset
|
570 |
} |
32
0307255c625b
2834 VP hangs on launching separate VP window
Stephen Talley <stephen.talley@sun.com>
parents:
4
diff
changeset
|
571 |
}); |
0 | 572 |
} |
573 |
||
574 |
/** |
|
575 |
* Show the login screen. |
|
576 |
* |
|
577 |
* @param host |
|
578 |
* if non-{@code null}, the initial value to place in the login |
|
579 |
* pane's host field |
|
580 |
* |
|
581 |
* @param user |
|
582 |
* if non-{@code null}, the initial value to place in the login |
|
583 |
* pane's user field |
|
584 |
*/ |
|
585 |
public void login(String host, String user, String role) { |
|
586 |
try { |
|
300
7f3357de9250
8810 incomplete support for port specification
David Powell <David.Powell@sun.com>
parents:
279
diff
changeset
|
587 |
load(host, -1, user, role, null, true); |
40
d1412af1ae5b
3215 ActionAbortedException is used too broadly
Stephen Talley <stephen.talley@sun.com>
parents:
39
diff
changeset
|
588 |
} catch (ActionException ignore) { |
0 | 589 |
} catch (NavigationException ignore) { |
590 |
} |
|
591 |
} |
|
592 |
||
593 |
/** |
|
594 |
* Sets the current connection. |
|
595 |
* <p> |
|
596 |
* If the host of the current connection differs from that of the new |
|
597 |
* connection, the current panel (and in fact most of the navigation stack) |
|
598 |
* cannot be re-used and must be stopped. |
|
599 |
* |
|
600 |
* @param info |
|
601 |
* a {@link ConnectionInfo} |
|
602 |
* |
|
40
d1412af1ae5b
3215 ActionAbortedException is used too broadly
Stephen Talley <stephen.talley@sun.com>
parents:
39
diff
changeset
|
603 |
* @exception NavigationAbortedException |
0 | 604 |
* if the host differs, as described above, and the user |
605 |
* cancels the stop operation |
|
606 |
*/ |
|
607 |
protected void setConnectionInfo(ConnectionInfo info) |
|
40
d1412af1ae5b
3215 ActionAbortedException is used too broadly
Stephen Talley <stephen.talley@sun.com>
parents:
39
diff
changeset
|
608 |
throws NavigationAbortedException { |
0 | 609 |
|
610 |
ConnectionInfo oldInfo = getConnectionInfo(); |
|
611 |
||
612 |
if (oldInfo != info) { |
|
613 |
ConnectionManager connManager = app.getConnectionManager(); |
|
614 |
connManager.addConnection(info, this); |
|
615 |
||
616 |
// Has the host changed? |
|
617 |
String newHost = info.getHost(); |
|
40
d1412af1ae5b
3215 ActionAbortedException is used too broadly
Stephen Talley <stephen.talley@sun.com>
parents:
39
diff
changeset
|
618 |
if (oldInfo != null && !oldInfo.matchesHost(newHost)) { |
d1412af1ae5b
3215 ActionAbortedException is used too broadly
Stephen Talley <stephen.talley@sun.com>
parents:
39
diff
changeset
|
619 |
// The host has changed. This means that the current panel (and |
d1412af1ae5b
3215 ActionAbortedException is used too broadly
Stephen Talley <stephen.talley@sun.com>
parents:
39
diff
changeset
|
620 |
// in fact most of the navigation stack) cannot be re-used. So |
d1412af1ae5b
3215 ActionAbortedException is used too broadly
Stephen Talley <stephen.talley@sun.com>
parents:
39
diff
changeset
|
621 |
// back out completely, allowing the user to cancel if there are |
d1412af1ae5b
3215 ActionAbortedException is used too broadly
Stephen Talley <stephen.talley@sun.com>
parents:
39
diff
changeset
|
622 |
// unsaved changes. |
d1412af1ae5b
3215 ActionAbortedException is used too broadly
Stephen Talley <stephen.talley@sun.com>
parents:
39
diff
changeset
|
623 |
try { |
d1412af1ae5b
3215 ActionAbortedException is used too broadly
Stephen Talley <stephen.talley@sun.com>
parents:
39
diff
changeset
|
624 |
// Navigate to root Control |
302
ac70675de834
9318 Navigator/Control should distinguish between cancel and non-cancel navigations
Stephen Talley <stephen.talley@sun.com>
parents:
300
diff
changeset
|
625 |
navigator.goTo(false, navigator.getPath().get(0)); |
40
d1412af1ae5b
3215 ActionAbortedException is used too broadly
Stephen Talley <stephen.talley@sun.com>
parents:
39
diff
changeset
|
626 |
} catch (NavigationAbortedException e) { |
d1412af1ae5b
3215 ActionAbortedException is used too broadly
Stephen Talley <stephen.talley@sun.com>
parents:
39
diff
changeset
|
627 |
// We're not going to use this connection after all |
d1412af1ae5b
3215 ActionAbortedException is used too broadly
Stephen Talley <stephen.talley@sun.com>
parents:
39
diff
changeset
|
628 |
connManager.removeConnection(info, this); |
d1412af1ae5b
3215 ActionAbortedException is used too broadly
Stephen Talley <stephen.talley@sun.com>
parents:
39
diff
changeset
|
629 |
throw e; |
d1412af1ae5b
3215 ActionAbortedException is used too broadly
Stephen Talley <stephen.talley@sun.com>
parents:
39
diff
changeset
|
630 |
} catch (InvalidAddressException e) { |
d1412af1ae5b
3215 ActionAbortedException is used too broadly
Stephen Talley <stephen.talley@sun.com>
parents:
39
diff
changeset
|
631 |
// Should not be possible |
d1412af1ae5b
3215 ActionAbortedException is used too broadly
Stephen Talley <stephen.talley@sun.com>
parents:
39
diff
changeset
|
632 |
} catch (InvalidParameterException e) { |
d1412af1ae5b
3215 ActionAbortedException is used too broadly
Stephen Talley <stephen.talley@sun.com>
parents:
39
diff
changeset
|
633 |
// Should not be possible |
0 | 634 |
} |
635 |
} |
|
636 |
||
637 |
// Set and notify any listeners (ie, panels) of change |
|
638 |
this.info = info; |
|
639 |
fireChangeEvent(oldInfo, info); |
|
640 |
setTitle(); |
|
641 |
||
642 |
if (oldInfo != null) { |
|
643 |
// Now that listeners have been notified of the change, remove |
|
644 |
// the link between this AppInstance and oldInfo, closing |
|
645 |
// oldInfo if no one else is using it |
|
646 |
connManager.removeConnection(oldInfo, this); |
|
647 |
} |
|
648 |
} |
|
649 |
} |
|
650 |
||
651 |
// |
|
652 |
// Private methods |
|
653 |
// |
|
654 |
||
262
885abe865e16
8009 Help window should not necessarily be tied to main frame
Stephen Talley <stephen.talley@sun.com>
parents:
256
diff
changeset
|
655 |
private void createHelp() { |
885abe865e16
8009 Help window should not necessarily be tied to main frame
Stephen Talley <stephen.talley@sun.com>
parents:
256
diff
changeset
|
656 |
String helpSetName = |
885abe865e16
8009 Help window should not necessarily be tied to main frame
Stephen Talley <stephen.talley@sun.com>
parents:
256
diff
changeset
|
657 |
getClass().getPackage().getName().replaceAll("\\.", "/") + |
885abe865e16
8009 Help window should not necessarily be tied to main frame
Stephen Talley <stephen.talley@sun.com>
parents:
256
diff
changeset
|
658 |
"/help/app"; |
885abe865e16
8009 Help window should not necessarily be tied to main frame
Stephen Talley <stephen.talley@sun.com>
parents:
256
diff
changeset
|
659 |
|
885abe865e16
8009 Help window should not necessarily be tied to main frame
Stephen Talley <stephen.talley@sun.com>
parents:
256
diff
changeset
|
660 |
HelpSet helpSet; |
885abe865e16
8009 Help window should not necessarily be tied to main frame
Stephen Talley <stephen.talley@sun.com>
parents:
256
diff
changeset
|
661 |
try { |
885abe865e16
8009 Help window should not necessarily be tied to main frame
Stephen Talley <stephen.talley@sun.com>
parents:
256
diff
changeset
|
662 |
ClassLoader loader = getClass().getClassLoader(); |
885abe865e16
8009 Help window should not necessarily be tied to main frame
Stephen Talley <stephen.talley@sun.com>
parents:
256
diff
changeset
|
663 |
URL url = HelpSet.findHelpSet(loader, helpSetName); |
885abe865e16
8009 Help window should not necessarily be tied to main frame
Stephen Talley <stephen.talley@sun.com>
parents:
256
diff
changeset
|
664 |
helpSet = new HelpSet(loader, url); |
885abe865e16
8009 Help window should not necessarily be tied to main frame
Stephen Talley <stephen.talley@sun.com>
parents:
256
diff
changeset
|
665 |
} catch (HelpSetException e) { |
885abe865e16
8009 Help window should not necessarily be tied to main frame
Stephen Talley <stephen.talley@sun.com>
parents:
256
diff
changeset
|
666 |
String message = String.format( |
885abe865e16
8009 Help window should not necessarily be tied to main frame
Stephen Talley <stephen.talley@sun.com>
parents:
256
diff
changeset
|
667 |
"could not load helpset: %s", helpSetName); |
885abe865e16
8009 Help window should not necessarily be tied to main frame
Stephen Talley <stephen.talley@sun.com>
parents:
256
diff
changeset
|
668 |
|
885abe865e16
8009 Help window should not necessarily be tied to main frame
Stephen Talley <stephen.talley@sun.com>
parents:
256
diff
changeset
|
669 |
getLog().log(Level.WARNING, message, e); |
885abe865e16
8009 Help window should not necessarily be tied to main frame
Stephen Talley <stephen.talley@sun.com>
parents:
256
diff
changeset
|
670 |
helpSet = new HelpSet(); |
885abe865e16
8009 Help window should not necessarily be tied to main frame
Stephen Talley <stephen.talley@sun.com>
parents:
256
diff
changeset
|
671 |
} |
885abe865e16
8009 Help window should not necessarily be tied to main frame
Stephen Talley <stephen.talley@sun.com>
parents:
256
diff
changeset
|
672 |
|
885abe865e16
8009 Help window should not necessarily be tied to main frame
Stephen Talley <stephen.talley@sun.com>
parents:
256
diff
changeset
|
673 |
helpBroker = helpSet.createHelpBroker(); |
885abe865e16
8009 Help window should not necessarily be tied to main frame
Stephen Talley <stephen.talley@sun.com>
parents:
256
diff
changeset
|
674 |
showHelpAction = new CSH.DisplayHelpFromSource(helpBroker); |
885abe865e16
8009 Help window should not necessarily be tied to main frame
Stephen Talley <stephen.talley@sun.com>
parents:
256
diff
changeset
|
675 |
} |
885abe865e16
8009 Help window should not necessarily be tied to main frame
Stephen Talley <stephen.talley@sun.com>
parents:
256
diff
changeset
|
676 |
|
256
a570f2e29dbd
7971 login dialog should be external and modal
Stephen Talley <stephen.talley@sun.com>
parents:
251
diff
changeset
|
677 |
private void createLoginPane() { |
a570f2e29dbd
7971 login dialog should be external and modal
Stephen Talley <stephen.talley@sun.com>
parents:
251
diff
changeset
|
678 |
loginPane = new LoginPane(this); |
a570f2e29dbd
7971 login dialog should be external and modal
Stephen Talley <stephen.talley@sun.com>
parents:
251
diff
changeset
|
679 |
loginPane.setHost("localhost"); |
a570f2e29dbd
7971 login dialog should be external and modal
Stephen Talley <stephen.talley@sun.com>
parents:
251
diff
changeset
|
680 |
loginPane.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); |
a570f2e29dbd
7971 login dialog should be external and modal
Stephen Talley <stephen.talley@sun.com>
parents:
251
diff
changeset
|
681 |
} |
a570f2e29dbd
7971 login dialog should be external and modal
Stephen Talley <stephen.talley@sun.com>
parents:
251
diff
changeset
|
682 |
|
0 | 683 |
private void createNavigator() { |
684 |
AppRootControl rootControl = new AppRootControl(this); |
|
685 |
||
686 |
try { |
|
275
1e055a67a9b6
8094 Navigator interface could be simplified
Stephen Talley <stephen.talley@sun.com>
parents:
266
diff
changeset
|
687 |
navigator = new SwingNavigator(); |
251
2d4060817fe2
7905 NavigationListeners that resize a window or handle UI flicker should not be tied to a specific Window
Stephen Talley <stephen.talley@sun.com>
parents:
243
diff
changeset
|
688 |
|
2d4060817fe2
7905 NavigationListeners that resize a window or handle UI flicker should not be tied to a specific Window
Stephen Talley <stephen.talley@sun.com>
parents:
243
diff
changeset
|
689 |
// Resize windows on each navigation |
2d4060817fe2
7905 NavigationListeners that resize a window or handle UI flicker should not be tied to a specific Window
Stephen Talley <stephen.talley@sun.com>
parents:
243
diff
changeset
|
690 |
navigator.addNavigationListener(new NavigationWindowResizer()); |
2d4060817fe2
7905 NavigationListeners that resize a window or handle UI flicker should not be tied to a specific Window
Stephen Talley <stephen.talley@sun.com>
parents:
243
diff
changeset
|
691 |
|
302
ac70675de834
9318 Navigator/Control should distinguish between cancel and non-cancel navigations
Stephen Talley <stephen.talley@sun.com>
parents:
300
diff
changeset
|
692 |
navigator.goToAsyncAndWait(false, null, rootControl); |
0 | 693 |
} catch (NavigationException unlikely) { |
694 |
} |
|
695 |
} |
|
696 |
||
697 |
private void setTitle() { |
|
698 |
String login = null; |
|
699 |
String resource = "window.title.defaultlogin"; |
|
700 |
ConnectionInfo info = getConnectionInfo(); |
|
701 |
||
702 |
// If not logged in with default host/user/role... |
|
703 |
if (info != null && |
|
300
7f3357de9250
8810 incomplete support for port specification
David Powell <David.Powell@sun.com>
parents:
279
diff
changeset
|
704 |
!info.matches(App.LOCAL_HOST, -1, App.LOCAL_USER, null)) { |
0 | 705 |
|
266
b6e25669b646
7654 add status/status text to header
Stephen Talley <stephen.talley@sun.com>
parents:
262
diff
changeset
|
706 |
login = AuthPanel.toString(info); |
0 | 707 |
resource = "window.title.nondefaultlogin"; |
708 |
} |
|
709 |
||
710 |
String title = Finder.getString(resource, getTitle(), login); |
|
711 |
frame.setTitle(title); |
|
712 |
} |
|
713 |
} |