This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 105236
Collapse All | Expand All

(-)a/core.ui/src/org/netbeans/core/ui/options/general/AdvancedProxyPanel.form (+4 lines)
Lines 6-13 Link Here
6
      <ResourceString bundle="org/netbeans/modules/options/general/Bundle.properties" key="ACD_AdvancedProxyPanel" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
6
      <ResourceString bundle="org/netbeans/modules/options/general/Bundle.properties" key="ACD_AdvancedProxyPanel" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
7
    </Property>
7
    </Property>
8
  </AccessibilityProperties>
8
  </AccessibilityProperties>
9
  <SyntheticProperties>
10
    <SyntheticProperty name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,13,0,0,3,33"/>
11
  </SyntheticProperties>
9
  <AuxValues>
12
  <AuxValues>
10
    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
13
    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
14
    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
11
    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
15
    <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/>
12
    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
16
    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/>
13
    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
17
    <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="2"/>
(-)a/core.ui/src/org/netbeans/core/ui/options/general/AdvancedProxyPanel.java (-1 / +76 lines)
Lines 42-47 Link Here
42
42
43
import javax.swing.event.DocumentEvent;
43
import javax.swing.event.DocumentEvent;
44
import javax.swing.event.DocumentListener;
44
import javax.swing.event.DocumentListener;
45
import org.openide.DialogDescriptor;
46
import org.openide.NotificationLineSupport;
45
47
46
/**
48
/**
47
 *
49
 *
Lines 53-58 Link Here
53
    private String oldHttpsPort;
55
    private String oldHttpsPort;
54
    private String oldSocksHost;
56
    private String oldSocksHost;
55
    private String oldSocksPort;
57
    private String oldSocksPort;
58
    private DialogDescriptor dd = null;
56
    
59
    
57
    /** Creates new form AdvancedProxyPanel */
60
    /** Creates new form AdvancedProxyPanel */
58
    AdvancedProxyPanel (GeneralOptionsModel model) {
61
    AdvancedProxyPanel (GeneralOptionsModel model) {
Lines 84-89 Link Here
84
                followHttpPortIfDemand ();
87
                followHttpPortIfDemand ();
85
            }
88
            }
86
        });
89
        });
90
        tfHttpsProxyPort.getDocument().addDocumentListener(new DocumentListener() {
91
92
            public void insertUpdate(DocumentEvent arg0) {
93
                validatePortValue(tfHttpsProxyPort.getText());
94
            }
95
96
            public void removeUpdate(DocumentEvent arg0) {
97
                validatePortValue(tfHttpsProxyPort.getText());
98
            }
99
100
            public void changedUpdate(DocumentEvent arg0) {
101
                validatePortValue(tfHttpsProxyPort.getText());
102
            }
103
        });
104
        tfSocksPort.getDocument().addDocumentListener(new DocumentListener() {
105
106
            public void insertUpdate(DocumentEvent arg0) {
107
                validatePortValue(tfSocksPort.getText());
108
            }
109
110
            public void removeUpdate(DocumentEvent arg0) {
111
                validatePortValue(tfSocksPort.getText());
112
            }
113
114
            public void changedUpdate(DocumentEvent arg0) {
115
                validatePortValue(tfSocksPort.getText());
116
            }
117
        });
118
        
87
    }
119
    }
88
    
120
    
89
    // helps implement OptionsPanelController
121
    // helps implement OptionsPanelController
Lines 176-187 Link Here
176
    }
208
    }
177
    
209
    
178
    private void followHttpPortIfDemand () {
210
    private void followHttpPortIfDemand () {
211
        String port = tfHttpProxyPort.getText();
212
        validatePortValue(port);
213
179
        if (! cbSameProxySettings.isSelected ()) {
214
        if (! cbSameProxySettings.isSelected ()) {
180
            return ;
215
            return ;
181
        }
216
        }
182
        String port = tfHttpProxyPort.getText ();
217
183
        tfHttpsProxyPort.setText (port);
218
        tfHttpsProxyPort.setText (port);
184
        tfSocksPort.setText (port);
219
        tfSocksPort.setText (port);
220
        
221
    }
222
223
    private void validatePortValue(String port) {
224
        clearError();
225
        if (port != null && port.length() > 0) {
226
            try {
227
                Integer.parseInt(port);
228
            } catch (NumberFormatException nfex) {
229
                showError(org.openide.util.NbBundle.getMessage(
230
                        AdvancedProxyPanel.class,
231
                        "LBL_AdvancedProxyPanel_PortError")); // NOI18N
232
            }
233
        }
234
    }
235
236
    private void showError(String message) {
237
        if (dd != null) {
238
            NotificationLineSupport notificationLineSupport =
239
                    dd.getNotificationLineSupport();
240
            if (notificationLineSupport != null) {
241
                notificationLineSupport.setErrorMessage(message);
242
            }
243
            dd.setValid(false);
244
        }
245
    }
246
247
    private void clearError() {
248
        if (dd != null) {
249
            NotificationLineSupport notificationLineSupport =
250
                    dd.getNotificationLineSupport();
251
            if (notificationLineSupport != null) {
252
                notificationLineSupport.clearMessages();
253
            }
254
            dd.setValid(true);
255
        }
256
    }
257
258
    public void setDialogDescriptor(DialogDescriptor dd) {
259
        this.dd = dd;
185
    }
260
    }
186
    
261
    
187
    /** This method is called from within the constructor to
262
    /** This method is called from within the constructor to
(-)a/core.ui/src/org/netbeans/core/ui/options/general/Bundle.properties (+3 lines)
Lines 150-155 Link Here
150
LBL_GeneralOptionsPanel_bMoreProxy.AN=Advanced Proxy Settings
150
LBL_GeneralOptionsPanel_bMoreProxy.AN=Advanced Proxy Settings
151
LBL_GeneralOptionsPanel_bMoreProxy.AD=Open Advanced Proxy Settings
151
LBL_GeneralOptionsPanel_bMoreProxy.AD=Open Advanced Proxy Settings
152
152
153
LBL_GeneralOptionsPanel_PortError=Port number must be an integer value.
154
153
LBL_GeneralOptionsPanel_lWebProxy=Proxy Settings\:
155
LBL_GeneralOptionsPanel_lWebProxy=Proxy Settings\:
154
156
155
LBL_AdvancedProxyPanel_lHttpProxyHost=HTTP &Proxy\:
157
LBL_AdvancedProxyPanel_lHttpProxyHost=HTTP &Proxy\:
Lines 173-178 Link Here
173
LBL_AdvancedProxyPanel_cbSameProxySettings=Use the same proxy settings for &all protocols
175
LBL_AdvancedProxyPanel_cbSameProxySettings=Use the same proxy settings for &all protocols
174
176
175
LBL_AdvancedProxyPanel_Title=Advanced Proxy Options
177
LBL_AdvancedProxyPanel_Title=Advanced Proxy Options
178
LBL_AdvancedProxyPanel_PortError=Port number must be an integer value.
176
GeneralOptionsPanel.rbUseSystemProxy.text=&Use System Proxy Settings
179
GeneralOptionsPanel.rbUseSystemProxy.text=&Use System Proxy Settings
177
GeneralOptionsPanel.lWebBrowser.text=&Web Browser\:
180
GeneralOptionsPanel.lWebBrowser.text=&Web Browser\:
178
GeneralOptionsPanel.rbNoProxy.text=&No Proxy
181
GeneralOptionsPanel.rbNoProxy.text=&No Proxy
(-)a/core.ui/src/org/netbeans/core/ui/options/general/GeneralOptionsPanel.form (-6 / +24 lines)
Lines 1-6 Link Here
1
<?xml version="1.0" encoding="UTF-8" ?>
1
<?xml version="1.0" encoding="UTF-8" ?>
2
2
3
<Form version="1.4" maxVersion="1.4" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
3
<Form version="1.4" maxVersion="1.4" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
4
  <SyntheticProperties>
5
    <SyntheticProperty name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,78,0,0,5,21"/>
6
  </SyntheticProperties>
4
  <AuxValues>
7
  <AuxValues>
5
    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
8
    <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
6
    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
9
    <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
Lines 21-27 Link Here
21
                  <Group type="102" alignment="1" attributes="0">
24
                  <Group type="102" alignment="1" attributes="0">
22
                      <Component id="lWebBrowser" min="-2" max="-2" attributes="0"/>
25
                      <Component id="lWebBrowser" min="-2" max="-2" attributes="0"/>
23
                      <EmptySpace type="separate" max="-2" attributes="0"/>
26
                      <EmptySpace type="separate" max="-2" attributes="0"/>
24
                      <Component id="cbWebBrowser" pref="1131" max="32767" attributes="0"/>
27
                      <Component id="cbWebBrowser" pref="1132" max="32767" attributes="0"/>
25
                      <EmptySpace max="-2" attributes="0"/>
28
                      <EmptySpace max="-2" attributes="0"/>
26
                      <Component id="editBrowserButton" min="-2" max="-2" attributes="0"/>
29
                      <Component id="editBrowserButton" min="-2" max="-2" attributes="0"/>
27
                  </Group>
30
                  </Group>
Lines 36-46 Link Here
36
                          <Group type="102" alignment="0" attributes="0">
39
                          <Group type="102" alignment="0" attributes="0">
37
                              <EmptySpace min="17" pref="17" max="17" attributes="0"/>
40
                              <EmptySpace min="17" pref="17" max="17" attributes="0"/>
38
                              <Group type="103" groupAlignment="0" attributes="0">
41
                              <Group type="103" groupAlignment="0" attributes="0">
39
                                  <Component id="bMoreProxy" alignment="0" min="-2" max="-2" attributes="0"/>
42
                                  <Group type="102" alignment="0" attributes="0">
43
                                      <Component id="bMoreProxy" min="-2" max="-2" attributes="0"/>
44
                                      <EmptySpace max="-2" attributes="0"/>
45
                                      <Component id="errorLabel" pref="1105" max="32767" attributes="0"/>
46
                                  </Group>
40
                                  <Group type="102" alignment="0" attributes="0">
47
                                  <Group type="102" alignment="0" attributes="0">
41
                                      <Component id="lProxyHost" min="-2" max="-2" attributes="0"/>
48
                                      <Component id="lProxyHost" min="-2" max="-2" attributes="0"/>
42
                                      <EmptySpace type="unrelated" max="-2" attributes="0"/>
49
                                      <EmptySpace type="unrelated" max="-2" attributes="0"/>
43
                                      <Component id="tfProxyHost" pref="959" max="32767" attributes="2"/>
50
                                      <Component id="tfProxyHost" pref="1016" max="32767" attributes="2"/>
44
                                      <EmptySpace min="-2" pref="12" max="-2" attributes="0"/>
51
                                      <EmptySpace min="-2" pref="12" max="-2" attributes="0"/>
45
                                      <Component id="lProxyPort" min="-2" max="-2" attributes="0"/>
52
                                      <Component id="lProxyPort" min="-2" max="-2" attributes="0"/>
46
                                      <EmptySpace type="unrelated" max="-2" attributes="0"/>
53
                                      <EmptySpace type="unrelated" max="-2" attributes="0"/>
Lines 55-64 Link Here
55
                      <Component id="lUsage" min="-2" max="-2" attributes="0"/>
62
                      <Component id="lUsage" min="-2" max="-2" attributes="0"/>
56
                      <EmptySpace min="-2" max="-2" attributes="0"/>
63
                      <EmptySpace min="-2" max="-2" attributes="0"/>
57
                      <Group type="103" groupAlignment="0" attributes="0">
64
                      <Group type="103" groupAlignment="0" attributes="0">
58
                          <Component id="lblUsageInfo" alignment="0" pref="1171" max="32767" attributes="0"/>
65
                          <Component id="lblUsageInfo" alignment="0" pref="1205" max="32767" attributes="0"/>
59
                          <Group type="102" alignment="0" attributes="0">
66
                          <Group type="102" alignment="0" attributes="0">
60
                              <Component id="jUsageCheck" min="-2" max="-2" attributes="0"/>
67
                              <Component id="jUsageCheck" min="-2" max="-2" attributes="0"/>
61
                              <EmptySpace pref="691" max="32767" attributes="0"/>
68
                              <EmptySpace pref="838" max="32767" attributes="0"/>
62
                          </Group>
69
                          </Group>
63
                          <Component id="lblLearnMore" alignment="0" min="-2" max="-2" attributes="0"/>
70
                          <Component id="lblLearnMore" alignment="0" min="-2" max="-2" attributes="0"/>
64
                      </Group>
71
                      </Group>
Lines 98-104 Link Here
98
                  <Component id="lProxyPort" alignment="3" min="-2" max="-2" attributes="0"/>
105
                  <Component id="lProxyPort" alignment="3" min="-2" max="-2" attributes="0"/>
99
              </Group>
106
              </Group>
100
              <EmptySpace max="-2" attributes="0"/>
107
              <EmptySpace max="-2" attributes="0"/>
101
              <Component id="bMoreProxy" min="-2" max="-2" attributes="0"/>
108
              <Group type="103" groupAlignment="3" attributes="0">
109
                  <Component id="bMoreProxy" alignment="3" min="-2" max="-2" attributes="0"/>
110
                  <Component id="errorLabel" alignment="3" min="-2" max="-2" attributes="0"/>
111
              </Group>
102
              <EmptySpace type="unrelated" max="-2" attributes="0"/>
112
              <EmptySpace type="unrelated" max="-2" attributes="0"/>
103
              <Component id="jSeparator3" min="-2" pref="10" max="-2" attributes="0"/>
113
              <Component id="jSeparator3" min="-2" pref="10" max="-2" attributes="0"/>
104
              <EmptySpace type="unrelated" max="-2" attributes="0"/>
114
              <EmptySpace type="unrelated" max="-2" attributes="0"/>
Lines 276-280 Link Here
276
        <EventHandler event="mousePressed" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="lblLearnMoreMousePressed"/>
286
        <EventHandler event="mousePressed" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="lblLearnMoreMousePressed"/>
277
      </Events>
287
      </Events>
278
    </Component>
288
    </Component>
289
    <Component class="javax.swing.JLabel" name="errorLabel">
290
      <Properties>
291
        <Property name="horizontalAlignment" type="int" value="4"/>
292
      </Properties>
293
      <AccessibilityProperties>
294
        <Property name="AccessibleContext.accessibleName" type="java.lang.String" value="" noResource="true"/>
295
      </AccessibilityProperties>
296
    </Component>
279
  </SubComponents>
297
  </SubComponents>
280
</Form>
298
</Form>
(-)a/core.ui/src/org/netbeans/core/ui/options/general/GeneralOptionsPanel.java (-8 / +106 lines)
Lines 41-60 Link Here
41
41
42
package org.netbeans.core.ui.options.general;
42
package org.netbeans.core.ui.options.general;
43
43
44
import java.awt.Color;
44
import java.awt.Component;
45
import java.awt.Component;
45
import java.awt.Cursor;
46
import java.awt.Cursor;
47
import java.awt.Image;
46
import java.awt.event.ActionEvent;
48
import java.awt.event.ActionEvent;
47
import java.awt.event.ActionListener;
49
import java.awt.event.ActionListener;
50
import java.beans.PropertyChangeEvent;
51
import java.beans.PropertyChangeSupport;
48
import java.net.MalformedURLException;
52
import java.net.MalformedURLException;
49
import java.net.URL;
53
import java.net.URL;
50
import javax.swing.AbstractButton;
54
import javax.swing.AbstractButton;
51
import javax.swing.ButtonGroup;
55
import javax.swing.ButtonGroup;
56
import javax.swing.ImageIcon;
52
import javax.swing.JLabel;
57
import javax.swing.JLabel;
53
import javax.swing.JPanel;
58
import javax.swing.JPanel;
59
import javax.swing.UIManager;
60
import javax.swing.event.DocumentEvent;
61
import javax.swing.event.DocumentListener;
54
import org.netbeans.beaninfo.editors.HtmlBrowser;
62
import org.netbeans.beaninfo.editors.HtmlBrowser;
63
import org.netbeans.spi.options.OptionsPanelController;
55
import org.openide.DialogDescriptor;
64
import org.openide.DialogDescriptor;
56
import org.openide.DialogDisplayer;
65
import org.openide.DialogDisplayer;
57
import org.openide.awt.Mnemonics;
66
import org.openide.awt.Mnemonics;
67
import org.openide.util.ImageUtilities;
58
import org.openide.util.Lookup;
68
import org.openide.util.Lookup;
59
import org.openide.util.NbBundle;
69
import org.openide.util.NbBundle;
60
70
Lines 69-74 Link Here
69
    private GeneralOptionsModel     model;
79
    private GeneralOptionsModel     model;
70
    private HtmlBrowser.FactoryEditor editor;
80
    private HtmlBrowser.FactoryEditor editor;
71
    private AdvancedProxyPanel advancedPanel;
81
    private AdvancedProxyPanel advancedPanel;
82
    private PropertyChangeSupport support = new PropertyChangeSupport(this);
83
    private boolean valid = true;
72
84
73
    
85
    
74
    /** 
86
    /** 
Lines 76-81 Link Here
76
     */
88
     */
77
    public GeneralOptionsPanel () {
89
    public GeneralOptionsPanel () {
78
        initComponents ();
90
        initComponents ();
91
92
        Color nbErrorForeground = UIManager.getColor("nb.errorForeground");
93
        if (nbErrorForeground == null) {
94
            nbErrorForeground = new Color(255, 0, 0);
95
        }
96
        errorLabel.setForeground(nbErrorForeground);
97
        Image img = ImageUtilities.loadImage("org/netbeans/core/ui/resources/error.png"); //NOI18N
98
        errorLabel.setIcon(new ImageIcon(img));
99
        errorLabel.setVisible(false);
79
        
100
        
80
        loc (lWebBrowser, "Web_Browser");
101
        loc (lWebBrowser, "Web_Browser");
81
        loc (lWebProxy, "Web_Proxy");
102
        loc (lWebProxy, "Web_Proxy");
Lines 95-100 Link Here
95
        cbWebBrowser.addActionListener (this);
116
        cbWebBrowser.addActionListener (this);
96
        tfProxyHost.addActionListener (this);
117
        tfProxyHost.addActionListener (this);
97
        tfProxyPort.addActionListener (this);
118
        tfProxyPort.addActionListener (this);
119
120
        tfProxyPort.getDocument().addDocumentListener(new DocumentListener(){
121
122
            public void insertUpdate(DocumentEvent e) {
123
                validatePortValue();
124
            }
125
126
            public void removeUpdate(DocumentEvent e) {
127
                validatePortValue();
128
            }
129
130
            public void changedUpdate(DocumentEvent e) {
131
                validatePortValue();
132
            }
133
        });
98
        
134
        
99
        ButtonGroup bgProxy = new ButtonGroup ();
135
        ButtonGroup bgProxy = new ButtonGroup ();
100
        bgProxy.add (rbNoProxy);
136
        bgProxy.add (rbNoProxy);
Lines 165-170 Link Here
165
        jUsageCheck = new javax.swing.JCheckBox();
201
        jUsageCheck = new javax.swing.JCheckBox();
166
        lblUsageInfo = new javax.swing.JLabel();
202
        lblUsageInfo = new javax.swing.JLabel();
167
        lblLearnMore = new javax.swing.JLabel();
203
        lblLearnMore = new javax.swing.JLabel();
204
        errorLabel = new javax.swing.JLabel();
168
205
169
        lWebBrowser.setLabelFor(cbWebBrowser);
206
        lWebBrowser.setLabelFor(cbWebBrowser);
170
        org.openide.awt.Mnemonics.setLocalizedText(lWebBrowser, org.openide.util.NbBundle.getMessage(GeneralOptionsPanel.class, "GeneralOptionsPanel.lWebBrowser.text")); // NOI18N
207
        org.openide.awt.Mnemonics.setLocalizedText(lWebBrowser, org.openide.util.NbBundle.getMessage(GeneralOptionsPanel.class, "GeneralOptionsPanel.lWebBrowser.text")); // NOI18N
Lines 236-241 Link Here
236
            }
273
            }
237
        });
274
        });
238
275
276
        errorLabel.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
277
239
        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
278
        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
240
        this.setLayout(layout);
279
        this.setLayout(layout);
241
        layout.setHorizontalGroup(
280
        layout.setHorizontalGroup(
Lines 246-252 Link Here
246
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
285
                    .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
247
                        .add(lWebBrowser)
286
                        .add(lWebBrowser)
248
                        .add(18, 18, 18)
287
                        .add(18, 18, 18)
249
                        .add(cbWebBrowser, 0, 1131, Short.MAX_VALUE)
288
                        .add(cbWebBrowser, 0, 1132, Short.MAX_VALUE)
250
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
289
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
251
                        .add(editBrowserButton))
290
                        .add(editBrowserButton))
252
                    .add(jSeparator2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 1291, Short.MAX_VALUE)
291
                    .add(jSeparator2, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 1291, Short.MAX_VALUE)
Lines 260-270 Link Here
260
                            .add(layout.createSequentialGroup()
299
                            .add(layout.createSequentialGroup()
261
                                .add(17, 17, 17)
300
                                .add(17, 17, 17)
262
                                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
301
                                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
263
                                    .add(bMoreProxy)
302
                                    .add(layout.createSequentialGroup()
303
                                        .add(bMoreProxy)
304
                                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
305
                                        .add(errorLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 1105, Short.MAX_VALUE))
264
                                    .add(layout.createSequentialGroup()
306
                                    .add(layout.createSequentialGroup()
265
                                        .add(lProxyHost)
307
                                        .add(lProxyHost)
266
                                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
308
                                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
267
                                        .add(tfProxyHost, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 957, Short.MAX_VALUE)
309
                                        .add(tfProxyHost, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 1016, Short.MAX_VALUE)
268
                                        .add(12, 12, 12)
310
                                        .add(12, 12, 12)
269
                                        .add(lProxyPort)
311
                                        .add(lProxyPort)
270
                                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
312
                                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
Lines 274-283 Link Here
274
                        .add(lUsage)
316
                        .add(lUsage)
275
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
317
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
276
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
318
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
277
                            .add(lblUsageInfo, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 1171, Short.MAX_VALUE)
319
                            .add(lblUsageInfo, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 1205, Short.MAX_VALUE)
278
                            .add(layout.createSequentialGroup()
320
                            .add(layout.createSequentialGroup()
279
                                .add(jUsageCheck)
321
                                .add(jUsageCheck)
280
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 690, Short.MAX_VALUE))
322
                                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 838, Short.MAX_VALUE))
281
                            .add(lblLearnMore))))
323
                            .add(lblLearnMore))))
282
                .add(0, 0, 0))
324
                .add(0, 0, 0))
283
        );
325
        );
Lines 307-313 Link Here
307
                    .add(tfProxyHost, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
349
                    .add(tfProxyHost, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
308
                    .add(lProxyPort))
350
                    .add(lProxyPort))
309
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
351
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
310
                .add(bMoreProxy)
352
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
353
                    .add(bMoreProxy)
354
                    .add(errorLabel))
311
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
355
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
312
                .add(jSeparator3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 10, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
356
                .add(jSeparator3, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 10, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
313
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
357
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
Lines 325-330 Link Here
325
        bMoreProxy.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(GeneralOptionsPanel.class, "LBL_GeneralOptionsPanel_bMoreProxy.AD")); // NOI18N
369
        bMoreProxy.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(GeneralOptionsPanel.class, "LBL_GeneralOptionsPanel_bMoreProxy.AD")); // NOI18N
326
        editBrowserButton.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(GeneralOptionsPanel.class, "GeneralOptionsPanel.editBrowserButton.AN")); // NOI18N
370
        editBrowserButton.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(GeneralOptionsPanel.class, "GeneralOptionsPanel.editBrowserButton.AN")); // NOI18N
327
        editBrowserButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(GeneralOptionsPanel.class, "GeneralOptionsPanel.editBrowserButton.AD")); // NOI18N
371
        editBrowserButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(GeneralOptionsPanel.class, "GeneralOptionsPanel.editBrowserButton.AD")); // NOI18N
372
        errorLabel.getAccessibleContext().setAccessibleName(""); // NOI18N
328
    }// </editor-fold>//GEN-END:initComponents
373
    }// </editor-fold>//GEN-END:initComponents
329
374
330
private void editBrowserButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editBrowserButtonActionPerformed
375
private void editBrowserButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editBrowserButtonActionPerformed
Lines 358-363 Link Here
358
        advancedPanel = new AdvancedProxyPanel (model);
403
        advancedPanel = new AdvancedProxyPanel (model);
359
    }
404
    }
360
    DialogDescriptor dd = new DialogDescriptor (advancedPanel, loc ("LBL_AdvancedProxyPanel_Title"));
405
    DialogDescriptor dd = new DialogDescriptor (advancedPanel, loc ("LBL_AdvancedProxyPanel_Title"));
406
    advancedPanel.setDialogDescriptor(dd);
407
    dd.createNotificationLineSupport();
361
    advancedPanel.update (tfProxyHost.getText (), tfProxyPort.getText ());
408
    advancedPanel.update (tfProxyHost.getText (), tfProxyPort.getText ());
362
    DialogDisplayer.getDefault ().createDialog (dd).setVisible (true);
409
    DialogDisplayer.getDefault ().createDialog (dd).setVisible (true);
363
    if (DialogDescriptor.OK_OPTION.equals (dd.getValue ())) {
410
    if (DialogDescriptor.OK_OPTION.equals (dd.getValue ())) {
Lines 407-412 Link Here
407
    private javax.swing.JButton bMoreProxy;
454
    private javax.swing.JButton bMoreProxy;
408
    private javax.swing.JComboBox cbWebBrowser;
455
    private javax.swing.JComboBox cbWebBrowser;
409
    private javax.swing.JButton editBrowserButton;
456
    private javax.swing.JButton editBrowserButton;
457
    private javax.swing.JLabel errorLabel;
410
    private javax.swing.JSeparator jSeparator2;
458
    private javax.swing.JSeparator jSeparator2;
411
    private javax.swing.JSeparator jSeparator3;
459
    private javax.swing.JSeparator jSeparator3;
412
    private javax.swing.JCheckBox jUsageCheck;
460
    private javax.swing.JCheckBox jUsageCheck;
Lines 424-430 Link Here
424
    private javax.swing.JTextField tfProxyPort;
472
    private javax.swing.JTextField tfProxyPort;
425
    // End of variables declaration//GEN-END:variables
473
    // End of variables declaration//GEN-END:variables
426
    
474
    
427
    
475
476
    private void validatePortValue() {
477
        clearError();
478
479
        boolean oldValid = valid;
480
        valid = isPortValid();
481
        if (!valid) {
482
            showError(loc("LBL_GeneralOptionsPanel_PortError")); // NOI18N
483
        }
484
485
        if (oldValid != valid) {
486
            support.firePropertyChange(
487
                    new PropertyChangeEvent(this,
488
                    OptionsPanelController.PROP_VALID, oldValid, valid));
489
        }
490
    }
491
492
    private boolean isPortValid() {
493
        String port = tfProxyPort.getText();
494
        boolean portStatus = true;
495
        if (port != null && port.length() > 0) {
496
            try {
497
                Integer.parseInt(port);
498
            } catch (NumberFormatException nfex) {
499
                portStatus = false;
500
            }
501
        }
502
503
        return portStatus;
504
    }
505
506
    private void showError(String message) {
507
        errorLabel.setVisible(true);
508
        errorLabel.setText(message);
509
    }
510
511
    private void clearError() {
512
        errorLabel.setText("");
513
        errorLabel.setVisible(false);
514
    }
515
428
    private static String loc (String key, String... params) {
516
    private static String loc (String key, String... params) {
429
        return NbBundle.getMessage (GeneralOptionsPanel.class, key, params);
517
        return NbBundle.getMessage (GeneralOptionsPanel.class, key, params);
430
    }
518
    }
Lines 560-566 Link Here
560
    }
648
    }
561
    
649
    
562
    boolean dataValid () {
650
    boolean dataValid () {
563
        return true;
651
        return isPortValid();
564
    }
652
    }
565
    
653
    
566
    boolean isChanged () {
654
    boolean isChanged () {
Lines 569-574 Link Here
569
        if (!tfProxyPort.getText ().equals (model.getHttpProxyPort ())) return true;
657
        if (!tfProxyPort.getText ().equals (model.getHttpProxyPort ())) return true;
570
        return changed;
658
        return changed;
571
    }
659
    }
660
661
    @Override
662
    public void addPropertyChangeListener(java.beans.PropertyChangeListener l) {
663
        support.addPropertyChangeListener(l);
664
    }
665
666
    @Override
667
    public void removePropertyChangeListener(java.beans.PropertyChangeListener l) {
668
        support.removePropertyChangeListener(l);
669
    }
572
    
670
    
573
    public void actionPerformed (ActionEvent e) {
671
    public void actionPerformed (ActionEvent e) {
574
        changed = true;
672
        changed = true;

Return to bug 105236