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 40938
Collapse All | Expand All

(-)settings/src/org/netbeans/modules/settings/convertors/SerialDataNode.java (-4 / +37 lines)
Lines 52-58 Link Here
52
    /** bean info is not used only if the file specifies 
52
    /** bean info is not used only if the file specifies 
53
     * <attr name="beaninfo" booleanvalue="false" />
53
     * <attr name="beaninfo" booleanvalue="false" />
54
     */
54
     */
55
    private boolean noBeanInfo = false;
55
    private Object customizer;
56
    private final SerialDataConvertor convertor;
56
    private final SerialDataConvertor convertor;
57
    private WeakReference settingInstance = new WeakReference(null);
57
    private WeakReference settingInstance = new WeakReference(null);
58
    private boolean isNameChanged = false;
58
    private boolean isNameChanged = false;
Lines 80-86 Link Here
80
        super (dobj, getChildren(dobj, noBeanInfo));
80
        super (dobj, getChildren(dobj, noBeanInfo));
81
        
81
        
82
        this.convertor = conv;
82
        this.convertor = conv;
83
        this.noBeanInfo = noBeanInfo;
83
        if (noBeanInfo) {
84
            customizer = getClass ();
85
        }
84
        isAfterNodeConstruction = Boolean.TRUE;
86
        isAfterNodeConstruction = Boolean.TRUE;
85
    }
87
    }
86
    
88
    
Lines 134-140 Link Here
134
    * @return icon to use to represent the node
136
    * @return icon to use to represent the node
135
    */
137
    */
136
    public Image getIcon (int type) {
138
    public Image getIcon (int type) {
137
        if (noBeanInfo) return super.getIcon(type);
139
        if (isNoBeanInfo()) return super.getIcon(type);
138
        Image img = null;
140
        Image img = null;
139
        try {
141
        try {
140
            DataObject dobj = getDataObject();
142
            DataObject dobj = getDataObject();
Lines 194-199 Link Here
194
            InstanceCookie ic = ic();
196
            InstanceCookie ic = ic();
195
            if (ic == null) return;
197
            if (ic == null) return;
196
            BeanInfo info = Utilities.getBeanInfo(ic.instanceClass());
198
            BeanInfo info = Utilities.getBeanInfo(ic.instanceClass());
199
            
200
            if (customizer == null) {
201
                customizer = info.getBeanDescriptor ().getCustomizerClass ();
202
                if (customizer == null) {
203
                    customizer = this;
204
                }
205
            }
206
            
197
            java.beans.EventSetDescriptor[] descs = info.getEventSetDescriptors();
207
            java.beans.EventSetDescriptor[] descs = info.getEventSetDescriptors();
198
            Method setter = null;
208
            Method setter = null;
199
            for (int i = 0; descs != null && i < descs.length; i++) {
209
            for (int i = 0; descs != null && i < descs.length; i++) {
Lines 545-551 Link Here
545
    
555
    
546
    /** Gets the short description of this feature. */
556
    /** Gets the short description of this feature. */
547
    public String getShortDescription() {
557
    public String getShortDescription() {
548
        if (noBeanInfo) return super.getShortDescription();
558
        if (isNoBeanInfo()) return super.getShortDescription();
549
        
559
        
550
        try {
560
        try {
551
            InstanceCookie ic = ic();
561
            InstanceCookie ic = ic();
Lines 571-576 Link Here
571
    public SystemAction getDefaultAction() {
581
    public SystemAction getDefaultAction() {
572
        return null;
582
        return null;
573
    }
583
    }
584
585
    public java.awt.Component getCustomizer() {
586
        if (! (customizer instanceof java.awt.Component)) {
587
            try {
588
                customizer = ((Class)customizer).newInstance ();
589
            } catch (Exception ex) {
590
                ErrorManager.getDefault ().notify (ex);
591
            }
592
        } 
593
        return (java.awt.Component)customizer;
594
    }
595
596
    public boolean hasCustomizer() {
597
        if (isNoBeanInfo ()) {
598
            return false;
599
        }
600
        initPList ();
601
        return customizer != this;
602
    }
574
    
603
    
575
    //
604
    //
576
    // inner classes - properties
605
    // inner classes - properties
Lines 1044-1049 Link Here
1044
            isChanged = false;
1073
            isChanged = false;
1045
            return wasChanged;
1074
            return wasChanged;
1046
        }
1075
        }
1076
    }
1077
1078
    private boolean isNoBeanInfo() {
1079
        return customizer == getClass ();
1047
    }
1080
    }
1048
        
1081
        
1049
}
1082
}
(-)src/org/netbeans/core/Bundle.properties (+6 lines)
Lines 566-568 Link Here
566
566
567
GTK_FONTSIZE_UNSUPPORTED=--fontsize is not supported on GTK look and feel. \
567
GTK_FONTSIZE_UNSUPPORTED=--fontsize is not supported on GTK look and feel. \
568
Adjust your desktop font size instead.
568
Adjust your desktop font size instead.
569
570
CTL_IDESettingsUseProxy=Use Proxy
571
572
CTL_IDESettingsProxyHost=Proxy Host
573
574
CTL_IDESettingsProxyPort=Proxy Port
(-)src/org/netbeans/core/IDESettingsBeanInfo.java (+4 lines)
Lines 109-112 Link Here
109
            return Utilities.loadImage ("org/netbeans/core/resources/ideSettings32.gif"); // NOI18N
109
            return Utilities.loadImage ("org/netbeans/core/resources/ideSettings32.gif"); // NOI18N
110
    }
110
    }
111
111
112
    public java.beans.BeanDescriptor getBeanDescriptor() {
113
        return new BeanDescriptor (IDESettings.class, IDESettingsCustomizer.class);
114
    }
115
112
}
116
}
(-)src/org/netbeans/core/IDESettingsCustomizer.form (+8 lines)
Added Link Here
1
<?xml version="1.0" encoding="UTF-8" ?>
2
3
<Form version="1.0" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
4
5
  <Layout class="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout">
6
    <Property name="useNullLayout" type="boolean" value="true"/>
7
  </Layout>
8
</Form>
(-)src/org/netbeans/core/IDESettingsCustomizer.java (+48 lines)
Added Link Here
1
/*
2
 * IDESettingsCustomizer.java
3
 *
4
 * Created on 28. èervenec 2004, 17:21
5
 */
6
7
package org.netbeans.core;
8
9
/**
10
 *
11
 * @author  jarda
12
 */
13
public class IDESettingsCustomizer extends javax.swing.JPanel 
14
implements java.beans.Customizer {
15
    
16
    /** Creates new form IDESettingsCustomizer */
17
    public IDESettingsCustomizer () {
18
        setLayout (new java.awt.BorderLayout ());
19
        add (java.awt.BorderLayout.CENTER, org.netbeans.core.ui.IDESettingsPanel.toolsOptions ());
20
    }
21
    
22
    public IDESettingsCustomizer (Object o) {
23
        this ();
24
        setObject (o);
25
    }
26
    
27
    public void setObject (Object obj) {
28
        //initComponents ();
29
        
30
        IDESettings ide = (IDESettings)obj;
31
    }
32
    
33
    /** This method is called from within the constructor to
34
     * initialize the form.
35
     * WARNING: Do NOT modify this code. The content of this method is
36
     * always regenerated by the Form Editor.
37
     */
38
    private void initComponents() {//GEN-BEGIN:initComponents
39
        java.awt.GridBagConstraints gridBagConstraints;
40
41
        setLayout(null);
42
43
    }//GEN-END:initComponents
44
    
45
    
46
    // Variables declaration - do not modify//GEN-BEGIN:variables
47
    // End of variables declaration//GEN-END:variables
48
}
(-)src/org/netbeans/core/actions/OptionsAction.java (-1 / +87 lines)
Lines 224-238 Link Here
224
        private transient JSplitPane split=null;
224
        private transient JSplitPane split=null;
225
        protected TreeView initGui () {
225
        protected TreeView initGui () {
226
            TTW retVal = new TTW () ;
226
            TTW retVal = new TTW () ;
227
            Dimension d = retVal.getPreferredSize ();
228
            d.width = 180;
229
            retVal.setPreferredSize (d);
227
            
230
            
228
            
231
            
229
            split = new JSplitPane (JSplitPane.HORIZONTAL_SPLIT);
232
            split = new JSplitPane (JSplitPane.HORIZONTAL_SPLIT);
230
            PropertySheetView propertyView = new PropertySheetView();
233
            CustomSheet propertyView = new CustomSheet ();
231
            
234
            
232
            split.setLeftComponent(retVal);
235
            split.setLeftComponent(retVal);
233
            split.setRightComponent(propertyView);
236
            split.setRightComponent(propertyView);
234
            // install proper border for split pane
237
            // install proper border for split pane
235
            split.setBorder((Border)UIManager.get("Nb.ScrollPane.border")); // NOI18N
238
            split.setBorder((Border)UIManager.get("Nb.ScrollPane.border")); // NOI18N
239
            split.setDividerLocation (0.20);
236
240
237
            setLayout (new java.awt.GridBagLayout ());
241
            setLayout (new java.awt.GridBagLayout ());
238
242
Lines 563-566 Link Here
563
        }
567
        }
564
        
568
        
565
    } // end of inner class OptionsPanel    
569
    } // end of inner class OptionsPanel    
570
    
571
    
572
    /** Component that shows either the property sheet or customizer for given node.
573
     */
574
    private static final class CustomSheet extends javax.swing.JPanel 
575
    implements Runnable, PropertyChangeListener {
576
        /** property state of the customizers */
577
        public static final String PROP_OK = "ok"; // NOI18N
578
        
579
        private ExplorerManager manager;
580
        private PropertySheetView sheet;
581
        private JPanel panel;
582
        
583
        public CustomSheet () {
584
            super (new CardLayout ());
585
            
586
            sheet = new PropertySheetView ();
587
            panel = new JPanel ();
588
            
589
            add ("sheet", sheet); // NOI18N
590
            add ("panel", panel); // NOI18N
591
            
592
            Dimension size = new Dimension (700, 500);
593
            panel.setPreferredSize (size);
594
            sheet.setPreferredSize (size);
595
            setMinimumSize (size);
596
        }
597
        
598
        public void addNotify () {
599
            super.addNotify ();
600
            manager = ExplorerManager.find (this);
601
            if (manager != null) {
602
                manager.addPropertyChangeListener(this);
603
            }
604
            
605
            run ();
606
        }
607
        
608
        public void removeNotify () {
609
            super.removeNotify ();
610
            if (manager != null) {
611
                manager.removePropertyChangeListener (this);
612
            }
613
        }
614
615
        public void propertyChange (PropertyChangeEvent ev) {
616
            if (ev.getSource () == manager) {
617
                SwingUtilities.invokeLater (this);
618
            }
619
        }
620
        
621
        private Node prev;
622
        public void run () {
623
            if (manager == null) return;
624
            
625
            Node[] arr = manager.getSelectedNodes ();
626
627
            if (arr.length == 1 && arr[0].hasCustomizer ()) {
628
                if (arr[0] == prev) {
629
                    return;
630
                }
631
                prev = arr[0];
632
                
633
                if (panel.getComponentCount () == 1) {
634
                    panel.remove (0);
635
                }
636
                
637
                panel.add (BorderLayout.CENTER, arr[0].getCustomizer ());
638
639
                if (!panel.isShowing()) {
640
                    // apply the customizer
641
                    ((CardLayout)getLayout ()).show (this, "panel"); // NOI18N
642
                }
643
                
644
                return;
645
            }
646
           
647
            prev = null;
648
            ((CardLayout)getLayout ()).show (this, "sheet"); // NOI18N
649
        }
650
    } // end of CustomSheet
651
    
566
}
652
}
(-)src/org/netbeans/core/ui/IDESettingsPanel.java (-25 / +70 lines)
Lines 34-41 Link Here
34
 *
34
 *
35
 * @author  jrojcek
35
 * @author  jrojcek
36
 */
36
 */
37
class IDESettingsPanel extends javax.swing.JPanel
37
public final class IDESettingsPanel extends javax.swing.JPanel
38
                       implements PropertyChangeListener {
38
implements PropertyChangeListener, java.awt.event.ItemListener, javax.swing.event.DocumentListener {
39
39
40
    /** See org.openide.WizardDescriptor.PROP_CONTENT_SELECTED_INDEX
40
    /** See org.openide.WizardDescriptor.PROP_CONTENT_SELECTED_INDEX
41
     */
41
     */
Lines 56-64 Link Here
56
    
56
    
57
    /** holds init data for async initialization */
57
    /** holds init data for async initialization */
58
    private InitData initData;
58
    private InitData initData;
59
    /** it this panel listening on immediate changes or not */
60
    private boolean immediate;
59
    
61
    
60
    /** Creates new form IDESettingsPanel */
62
    /** Creates new form IDESettingsPanel */
61
    public IDESettingsPanel() {
63
    IDESettingsPanel() {
62
        //XXX if we could kill the 
64
        //XXX if we could kill the 
63
        initComponents();
65
        initComponents();
64
66
Lines 89-94 Link Here
89
        Utilities.attachInitJob(this, new AsyncGUIJobImpl ());
91
        Utilities.attachInitJob(this, new AsyncGUIJobImpl ());
90
    }
92
    }
91
    
93
    
94
    /** Create a panel to be used inside Tools/Options
95
     */
96
    public static JPanel toolsOptions () {
97
        IDESettingsPanel ide = new IDESettingsPanel ();
98
        ide.initializePanel (true);
99
        return ide;
100
    }
101
    
92
    //A couple static methods to fix NPEs on GTK
102
    //A couple static methods to fix NPEs on GTK
93
    
103
    
94
    private static Font fetchFont(String key) {
104
    private static Font fetchFont(String key) {
Lines 352-357 Link Here
352
362
353
    private void changeProxyEnabled(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_changeProxyEnabled
363
    private void changeProxyEnabled(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_changeProxyEnabled
354
        setProxySettingEnabled(proxyCheckBox.isSelected());
364
        setProxySettingEnabled(proxyCheckBox.isSelected());
365
        
366
        if (immediate) {
367
            storeValues ();
368
        }
355
    }//GEN-LAST:event_changeProxyEnabled
369
    }//GEN-LAST:event_changeProxyEnabled
356
370
357
    private void setProxySettingEnabled(boolean b) {
371
    private void setProxySettingEnabled(boolean b) {
Lines 373-378 Link Here
373
        } else {
387
        } else {
374
            uiMode = 1; // sdi
388
            uiMode = 1; // sdi
375
        }
389
        }
390
        if (immediate) {
391
            storeValues ();
392
        }
376
    }//GEN-LAST:event_changeWindowMode
393
    }//GEN-LAST:event_changeWindowMode
377
394
378
395
Lines 407-426 Link Here
407
    public void initFromSettings(WizardDescriptor wd) {
424
    public void initFromSettings(WizardDescriptor wd) {
408
        wd.addPropertyChangeListener(this);
425
        wd.addPropertyChangeListener(this);
409
        if (Boolean.TRUE.equals(wd.getProperty("initializePanel"))) {
426
        if (Boolean.TRUE.equals(wd.getProperty("initializePanel"))) {
410
            initializePanel();
427
            initializePanel(false);
411
        }
428
        }
412
    }
429
    }
413
    
430
    
414
    /** Initialize panel from NB setting
431
    /** Initialize panel from NB setting
415
     */
432
     */
416
    private void initializePanel() {
433
    private void initializePanel(boolean listenOnChanges) {
417
        // asycnhronous refresh
434
        // asycnhronous refresh
418
        Utilities.attachInitJob(this, new AsyncGUIJobImpl ());        
435
        Utilities.attachInitJob(this, new AsyncGUIJobImpl ());        
419
        IDESettings settings = (IDESettings)IDESettings.findObject (IDESettings.class, true);
436
        IDESettings settings = (IDESettings)IDESettings.findObject (IDESettings.class, true);
420
        uiMode = settings.getUIMode();
437
        uiMode = settings.getUIMode();
421
        sdiRadioButton.setSelected(uiMode == 1); // SDI
438
        sdiRadioButton.setSelected(uiMode == 1); // SDI
422
        mdiRadioButton.setSelected(uiMode == 2); // MDI
439
        mdiRadioButton.setSelected(uiMode == 2); // MDI
423
440
        
424
        // web browser, proxy init...
441
        // web browser, proxy init...
425
        browserLabel.setDisplayedMnemonic (bundle.getString ("CTL_BrowserLabel_mnemonic").charAt (0));
442
        browserLabel.setDisplayedMnemonic (bundle.getString ("CTL_BrowserLabel_mnemonic").charAt (0));
426
        try {
443
        try {
Lines 433-438 Link Here
433
        } catch (RuntimeException ex) {
450
        } catch (RuntimeException ex) {
434
            ErrorManager.getDefault ().notify (ex);
451
            ErrorManager.getDefault ().notify (ex);
435
        }
452
        }
453
        
454
        if (listenOnChanges) {
455
            immediate = true;
456
            serverField.getDocument ().addDocumentListener (this);
457
            portField.getDocument ().addDocumentListener (this);
458
            browserComboBox.addItemListener (this);
459
        }
460
436
    }
461
    }
437
462
438
    /** Handling of property changes in node structure and setup wizard descriptor
463
    /** Handling of property changes in node structure and setup wizard descriptor
Lines 444-470 Link Here
444
            WizardDescriptor wd = (WizardDescriptor)evt.getSource();
469
            WizardDescriptor wd = (WizardDescriptor)evt.getSource();
445
            if (wd.getValue() == wd.FINISH_OPTION) {
470
            if (wd.getValue() == wd.FINISH_OPTION) {
446
                wd.removePropertyChangeListener(this);
471
                wd.removePropertyChangeListener(this);
447
                // set proxy
472
                storeValues ();
448
                IDESettings settings = (IDESettings)IDESettings.findObject(IDESettings.class, true);
473
            }
449
                settings.setProxyHost(serverField.getText());
474
        }
450
                settings.setProxyPort(portField.getText());
475
    }
451
                settings.setUseProxy(proxyCheckBox.isSelected());
476
    
452
                // set ui mode
477
    private void storeValues () {
453
                settings.setUIMode(uiMode);
478
        // set proxy
454
                // set web browser
479
        IDESettings settings = (IDESettings)IDESettings.findObject(IDESettings.class, true);
455
                if (editor != null) {
480
        settings.setProxyHost(serverField.getText());
456
                    try {
481
        settings.setProxyPort(portField.getText());
457
                        Object o = browserComboBox.getSelectedItem ();
482
        settings.setUseProxy(proxyCheckBox.isSelected());
458
                        if (o instanceof String && (o != null)) {
483
        // set ui mode
459
                            editor.setAsText ((String)o);
484
        settings.setUIMode(uiMode);
460
                            settings.setWWWBrowser ((org.openide.awt.HtmlBrowser.Factory)editor.getValue ());
485
        // set web browser
461
                        }
486
        if (editor != null) {
462
                    }
487
            try {
463
                    catch (RuntimeException ex) {
488
                Object o = browserComboBox.getSelectedItem ();
464
                        ErrorManager.getDefault ().notify (ex);
489
                if (o instanceof String && (o != null)) {
465
                    }
490
                    editor.setAsText ((String)o);
491
                    settings.setWWWBrowser ((org.openide.awt.HtmlBrowser.Factory)editor.getValue ());
466
                }
492
                }
467
            }
493
            }
494
            catch (RuntimeException ex) {
495
                ErrorManager.getDefault ().notify (ex);
496
            }
468
        }
497
        }
469
    }
498
    }
470
    
499
    
Lines 479-484 Link Here
479
        mdiRadioButton.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_mdiRadioButton")); //NOI18N
508
        mdiRadioButton.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_mdiRadioButton")); //NOI18N
480
        serverField.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_serverField"));
509
        serverField.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_serverField"));
481
        portField.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_portField"));
510
        portField.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_portField"));
511
    }
512
513
    public void insertUpdate(javax.swing.event.DocumentEvent e) {
514
        storeValues ();
515
    }
516
517
    public void removeUpdate(javax.swing.event.DocumentEvent e) {
518
        storeValues ();
519
    }
520
521
    public void itemStateChanged(java.awt.event.ItemEvent e) {
522
        storeValues ();
523
    }
524
525
    public void changedUpdate(javax.swing.event.DocumentEvent e) {
526
        storeValues ();
482
    }
527
    }
483
    
528
    
484
    private class AsyncGUIJobImpl implements AsyncGUIJob {
529
    private class AsyncGUIJobImpl implements AsyncGUIJob {

Return to bug 40938