Lines 7-13
Link Here
|
7 |
* http://www.sun.com/ |
7 |
* http://www.sun.com/ |
8 |
* |
8 |
* |
9 |
* The Original Code is NetBeans. The Initial Developer of the Original |
9 |
* The Original Code is NetBeans. The Initial Developer of the Original |
10 |
* Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun |
10 |
* Code is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun |
11 |
* Microsystems, Inc. All Rights Reserved. |
11 |
* Microsystems, Inc. All Rights Reserved. |
12 |
*/ |
12 |
*/ |
13 |
|
13 |
|
Lines 67-72
Link Here
|
67 |
private JRadioButton rbHTTPProxy = new JRadioButton (); |
67 |
private JRadioButton rbHTTPProxy = new JRadioButton (); |
68 |
private JTextField tfHost = new JTextField (); |
68 |
private JTextField tfHost = new JTextField (); |
69 |
private JTextField tfPort = new JTextField (); |
69 |
private JTextField tfPort = new JTextField (); |
|
|
70 |
private JTextField tfNonProxy = new JTextField (); |
70 |
private JComboBox cbUpdatePeriod = new JComboBox (new String [] { |
71 |
private JComboBox cbUpdatePeriod = new JComboBox (new String [] { |
71 |
loc ("CTL_Update_every_startup"), |
72 |
loc ("CTL_Update_every_startup"), |
72 |
loc ("CTL_Update_every_day"), |
73 |
loc ("CTL_Update_every_day"), |
Lines 88-93
Link Here
|
88 |
tfHost.getAccessibleContext ().setAccessibleDescription (loc ("AD_Host")); |
89 |
tfHost.getAccessibleContext ().setAccessibleDescription (loc ("AD_Host")); |
89 |
tfPort.getAccessibleContext ().setAccessibleName (loc ("AN_Port")); |
90 |
tfPort.getAccessibleContext ().setAccessibleName (loc ("AN_Port")); |
90 |
tfPort.getAccessibleContext ().setAccessibleDescription (loc ("AD_Port")); |
91 |
tfPort.getAccessibleContext ().setAccessibleDescription (loc ("AD_Port")); |
|
|
92 |
tfNonProxy.getAccessibleContext ().setAccessibleName (loc ("AN_NonProxy")); |
93 |
tfNonProxy.getAccessibleContext ().setAccessibleDescription (loc ("AD_NonProxy")); |
91 |
cbUpdatePeriod.getAccessibleContext ().setAccessibleName (loc ("AN_Update_Period")); |
94 |
cbUpdatePeriod.getAccessibleContext ().setAccessibleName (loc ("AN_Update_Period")); |
92 |
cbUpdatePeriod.getAccessibleContext ().setAccessibleDescription (loc ("AD_Update_Period")); |
95 |
cbUpdatePeriod.getAccessibleContext ().setAccessibleDescription (loc ("AD_Update_Period")); |
93 |
cbAskBeforeCheck.getAccessibleContext ().setAccessibleName (loc ("AN_Ask_Before_Check")); |
96 |
cbAskBeforeCheck.getAccessibleContext ().setAccessibleName (loc ("AN_Ask_Before_Check")); |
Lines 100-105
Link Here
|
100 |
cbWebBrowser.addActionListener (this); |
103 |
cbWebBrowser.addActionListener (this); |
101 |
tfHost.addActionListener (this); |
104 |
tfHost.addActionListener (this); |
102 |
tfPort.addActionListener (this); |
105 |
tfPort.addActionListener (this); |
|
|
106 |
tfNonProxy.addActionListener (this); |
103 |
cbUpdatePeriod.addActionListener (this); |
107 |
cbUpdatePeriod.addActionListener (this); |
104 |
cbAskBeforeCheck.addActionListener (this); |
108 |
cbAskBeforeCheck.addActionListener (this); |
105 |
|
109 |
|
Lines 115-150
Link Here
|
115 |
loc (rbNoProxy, "No_Proxy"); |
119 |
loc (rbNoProxy, "No_Proxy"); |
116 |
loc (rbSystemProxy, "Use_System_Proxy_Settings"); |
120 |
loc (rbSystemProxy, "Use_System_Proxy_Settings"); |
117 |
loc (rbHTTPProxy, "Use_HTTP_Proxy"); |
121 |
loc (rbHTTPProxy, "Use_HTTP_Proxy"); |
|
|
122 |
tfPort.setColumns (4); |
118 |
|
123 |
|
119 |
FormLayout layout = new FormLayout( |
124 |
FormLayout layout = new FormLayout( |
120 |
"5dlu, l:p, 5dlu, p:g, 1dlu, p", // cols |
125 |
"5dlu, l:p, 5dlu, p:g, 5dlu, l:p, 5dlu, p", // cols |
121 |
"p, 3dlu, p, 3dlu, p, 3dlu, p, 10dlu, p, 3dlu" + |
126 |
"p, 3dlu, p, 3dlu, p, 3dlu, p, 10dlu, p, 3dlu" + |
122 |
", p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 10dlu, p, 3dlu, p, 3dlu, p"); // rows |
127 |
", p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 3dlu, p, 10dlu, p, 3dlu, p, 3dlu, p"); // rows |
123 |
PanelBuilder builder = new PanelBuilder (layout, this); |
128 |
PanelBuilder builder = new PanelBuilder (layout, this); |
124 |
CellConstraints cc = new CellConstraints (); |
129 |
CellConstraints cc = new CellConstraints (); |
125 |
CellConstraints lc = new CellConstraints (); |
130 |
CellConstraints lc = new CellConstraints (); |
126 |
builder.addSeparator (loc ("General"), cc.xyw (1, 1, 6)); |
131 |
builder.addSeparator (loc ("General"), cc.xyw (1, 1, 8)); |
127 |
builder.addLabel ( loc ("Package_View_Type"),lc.xy (2, 3), |
132 |
builder.addLabel ( loc ("Package_View_Type"),lc.xy (2, 3), |
128 |
rbFlatternPackages, cc.xyw (4, 3, 3)); |
133 |
rbFlatternPackages, cc.xyw (4, 3, 3)); |
129 |
builder.add ( rbTreePackages, cc.xyw (4, 5, 3)); |
134 |
builder.add ( rbTreePackages, cc.xyw (4, 5, 3)); |
130 |
builder.addLabel ( loc ("Web_Browser"), lc.xy (2, 7), |
135 |
builder.addLabel ( loc ("Web_Browser"), lc.xy (2, 7), |
131 |
cbWebBrowser, cc.xy (4, 7)); |
136 |
cbWebBrowser, cc.xyw (4, 7, 5)); |
132 |
|
137 |
|
133 |
builder.addSeparator (loc ("Proxy_Settings"), cc.xyw (1, 9, 6)); |
138 |
builder.addSeparator (loc ("Proxy_Settings"), cc.xyw (1, 9, 8)); |
134 |
builder.addLabel ( loc ("Web_Proxy"), lc.xy (2, 11), |
139 |
builder.addLabel ( loc ("Web_Proxy"), lc.xy (2, 11), |
135 |
rbNoProxy, cc.xyw (4, 11, 3)); |
140 |
rbNoProxy, cc.xyw (4, 11, 3)); |
136 |
builder.add ( rbSystemProxy, cc.xyw (4, 13, 3)); |
141 |
builder.add ( rbSystemProxy, cc.xyw (4, 13, 3)); |
137 |
builder.add ( rbHTTPProxy, cc.xyw (4, 15, 3)); |
142 |
builder.add ( rbHTTPProxy, cc.xyw (4, 15, 3)); |
138 |
builder.addLabel ( loc ("Proxy_Host"), lc.xy (2, 17), |
143 |
builder.addLabel ( loc ("Proxy_Host"), lc.xy (2, 17), |
139 |
tfHost, cc.xyw (4, 17, 3)); |
144 |
tfHost, cc.xyw (4, 17, 1)); |
140 |
builder.addLabel ( loc ("Proxy_Port"), lc.xy (2, 19), |
145 |
builder.addLabel ( loc ("Proxy_Port"), lc.xy (6, 17), |
141 |
tfPort, cc.xyw (4, 19, 3)); |
146 |
tfPort, cc.xyw (8, 17, 1)); |
142 |
|
147 |
builder.addLabel ( loc ("Non_Proxy"), lc.xy (2, 19), |
143 |
builder.addSeparator (loc ("Auto_Update"), cc.xyw (1, 21, 6)); |
148 |
tfNonProxy, cc.xyw (4, 19, 5)); |
144 |
builder.addLabel ( loc ("Check_Period"), lc.xy (2, 23), |
149 |
builder.addLabel ( loc ("Non_Proxy_Hint"), lc.xy (4, 21)); |
145 |
cbUpdatePeriod, cc.xyw (4, 23, 3)); |
150 |
|
146 |
builder.addLabel ( loc ("Ask_Before_Check"), lc.xy (2, 25), |
151 |
builder.addSeparator (loc ("Auto_Update"), cc.xyw (1, 23, 8)); |
147 |
cbAskBeforeCheck, cc.xyw (4, 25, 3)); |
152 |
builder.addLabel ( loc ("Check_Period"), lc.xy (2, 25), |
|
|
153 |
cbUpdatePeriod, cc.xyw (4, 25, 5)); |
154 |
builder.addLabel ( loc ("Ask_Before_Check"), lc.xy (2, 27), |
155 |
cbAskBeforeCheck, cc.xyw (4, 27, 3)); |
148 |
|
156 |
|
149 |
// if system proxy setting is not detectable, disable this radio |
157 |
// if system proxy setting is not detectable, disable this radio |
150 |
// button |
158 |
// button |
Lines 186-201
Link Here
|
186 |
rbNoProxy.setSelected (true); |
194 |
rbNoProxy.setSelected (true); |
187 |
tfHost.setEnabled (false); |
195 |
tfHost.setEnabled (false); |
188 |
tfPort.setEnabled (false); |
196 |
tfPort.setEnabled (false); |
|
|
197 |
tfNonProxy.setEnabled (false); |
189 |
break; |
198 |
break; |
190 |
case 1: |
199 |
case 1: |
191 |
rbSystemProxy.setSelected (true); |
200 |
rbSystemProxy.setSelected (true); |
192 |
tfHost.setEnabled (false); |
201 |
tfHost.setEnabled (false); |
193 |
tfPort.setEnabled (false); |
202 |
tfPort.setEnabled (false); |
|
|
203 |
tfNonProxy.setEnabled (false); |
194 |
break; |
204 |
break; |
195 |
default: |
205 |
default: |
196 |
rbHTTPProxy.setSelected (true); |
206 |
rbHTTPProxy.setSelected (true); |
197 |
tfHost.setEnabled (true); |
207 |
tfHost.setEnabled (true); |
198 |
tfPort.setEnabled (true); |
208 |
tfPort.setEnabled (true); |
|
|
209 |
tfNonProxy.setEnabled (true); |
199 |
break; |
210 |
break; |
200 |
} |
211 |
} |
201 |
tfHost.setText (model.getProxyHost ()); |
212 |
tfHost.setText (model.getProxyHost ()); |
Lines 204-209
Link Here
|
204 |
tfPort.setText (Integer.toString (port)); |
215 |
tfPort.setText (Integer.toString (port)); |
205 |
else |
216 |
else |
206 |
tfPort.setText (""); |
217 |
tfPort.setText (""); |
|
|
218 |
tfNonProxy.setText (model.getUserNonProxy ()); |
207 |
|
219 |
|
208 |
// Autoupdate settings |
220 |
// Autoupdate settings |
209 |
cbAskBeforeCheck.setSelected (model.getAutoUpdateAskBeforeCheck ()); |
221 |
cbAskBeforeCheck.setSelected (model.getAutoUpdateAskBeforeCheck ()); |
Lines 249-262
Link Here
|
249 |
if (model == null) return; |
261 |
if (model == null) return; |
250 |
|
262 |
|
251 |
// proxy settings |
263 |
// proxy settings |
252 |
model.setProxyHost (tfHost.getText ()); |
|
|
253 |
try { |
254 |
model.setProxyPort ( |
255 |
Math.max (Integer.parseInt (tfPort.getText ()), 0) |
256 |
); |
257 |
} catch (NumberFormatException ex) { |
258 |
model.setProxyPort (0); |
259 |
} |
260 |
if (rbNoProxy.isSelected ()) { |
264 |
if (rbNoProxy.isSelected ()) { |
261 |
model.setProxyType (0); |
265 |
model.setProxyType (0); |
262 |
} else |
266 |
} else |
Lines 265-270
Link Here
|
265 |
} else { |
269 |
} else { |
266 |
model.setProxyType (2); |
270 |
model.setProxyType (2); |
267 |
} |
271 |
} |
|
|
272 |
model.setProxyHost (tfHost.getText ()); |
273 |
model.setUserNonProxy (tfNonProxy.getText ()); |
274 |
try { |
275 |
model.setProxyPort ( |
276 |
Math.max (Integer.parseInt (tfPort.getText ()), 0) |
277 |
); |
278 |
} catch (NumberFormatException ex) { |
279 |
model.setProxyPort (0); |
280 |
} |
268 |
|
281 |
|
269 |
// Autoupdate settings |
282 |
// Autoupdate settings |
270 |
model.setAutoUpdateAskBeforeCheck (cbAskBeforeCheck.isSelected ()); |
283 |
model.setAutoUpdateAskBeforeCheck (cbAskBeforeCheck.isSelected ()); |
Lines 312-317
Link Here
|
312 |
if (!tfPort.getText ().equals (Integer.toString (model.getProxyPort ()))) return true; |
325 |
if (!tfPort.getText ().equals (Integer.toString (model.getProxyPort ()))) return true; |
313 |
} else |
326 |
} else |
314 |
if (!tfPort.getText ().equals ("")) return true; |
327 |
if (!tfPort.getText ().equals ("")) return true; |
|
|
328 |
if (!tfNonProxy.getText ().equals (model.getUserNonProxy ())) { |
329 |
return true; |
330 |
} |
315 |
return changed; |
331 |
return changed; |
316 |
} |
332 |
} |
317 |
|
333 |
|
Lines 319-324
Link Here
|
319 |
changed = true; |
335 |
changed = true; |
320 |
tfHost.setEnabled (rbHTTPProxy.isSelected ()); |
336 |
tfHost.setEnabled (rbHTTPProxy.isSelected ()); |
321 |
tfPort.setEnabled (rbHTTPProxy.isSelected ()); |
337 |
tfPort.setEnabled (rbHTTPProxy.isSelected ()); |
|
|
338 |
tfNonProxy.setEnabled (rbHTTPProxy.isSelected ()); |
322 |
} |
339 |
} |
323 |
} |
340 |
} |
324 |
|
341 |
|