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

(-)a/form/src/org/netbeans/modules/form/Bundle.properties (+2 lines)
Lines 98-103 Link Here
98
HINT_ASSISTANT_SHOWN=If selected, the assistant is shown in the designer.
98
HINT_ASSISTANT_SHOWN=If selected, the assistant is shown in the designer.
99
PROP_GENERATE_FQN=Generate Full Classnames
99
PROP_GENERATE_FQN=Generate Full Classnames
100
HINT_GENERATE_FQN=If selected then fully qualified names of classes are generated.
100
HINT_GENERATE_FQN=If selected then fully qualified names of classes are generated.
101
HINT_SHOW_READ_ONLY=When selected properties that are read-only will be visible in the property inspector.
101
102
102
# form toolbar
103
# form toolbar
103
CTL_SelectionButtonHint=Selection Mode
104
CTL_SelectionButtonHint=Selection Mode
Lines 753-758 Link Here
753
Selection_Border_Color=Selection &Border Color:
754
Selection_Border_Color=Selection &Border Color:
754
Guiding_Line_Color=Guiding Line &Color:
755
Guiding_Line_Color=Guiding Line &Color:
755
Generate_FQN=Generate Fully &Qualified Names of Classes
756
Generate_FQN=Generate Fully &Qualified Names of Classes
757
Show_Read_Only=Show Read Only Properties
756
758
757
MSG_Paiting_Exception=The following exception has been thrown during painting of the form. \
759
MSG_Paiting_Exception=The following exception has been thrown during painting of the form. \
758
Use the Inspector window to fix or remove the problematic component.
760
Use the Inspector window to fix or remove the problematic component.
(-)a/form/src/org/netbeans/modules/form/FormEditorCustomizer.java (+8 lines)
Lines 74-79 Link Here
74
    private JCheckBox cbFold = new JCheckBox ();
74
    private JCheckBox cbFold = new JCheckBox ();
75
    private JCheckBox cbAssistant = new JCheckBox();
75
    private JCheckBox cbAssistant = new JCheckBox();
76
    private JCheckBox cbFQN = new JCheckBox();
76
    private JCheckBox cbFQN = new JCheckBox();
77
    private JCheckBox cbShowReadOnly = new JCheckBox();
77
    private JComboBox cbModifier = new JComboBox ();
78
    private JComboBox cbModifier = new JComboBox ();
78
    private JRadioButton rbGenerateLocals = new JRadioButton ();
79
    private JRadioButton rbGenerateLocals = new JRadioButton ();
79
    private JRadioButton rbGenerateFields = new JRadioButton ();
80
    private JRadioButton rbGenerateFields = new JRadioButton ();
Lines 92-97 Link Here
92
        loc(cbFold, "Fold"); // NOI18N
93
        loc(cbFold, "Fold"); // NOI18N
93
        loc(cbAssistant, "Assistant"); // NOI18N
94
        loc(cbAssistant, "Assistant"); // NOI18N
94
        loc(cbFQN, "Generate_FQN"); // NOI18N
95
        loc(cbFQN, "Generate_FQN"); // NOI18N
96
        loc(cbShowReadOnly, "Show_Read_Only"); // NOI18N
95
        loc(rbGenerateLocals, "Generate_Locals"); // NOI18N
97
        loc(rbGenerateLocals, "Generate_Locals"); // NOI18N
96
        group.add (rbGenerateLocals);
98
        group.add (rbGenerateLocals);
97
        loc(rbGenerateFields, "Generate_Fields"); // NOI18N
99
        loc(rbGenerateFields, "Generate_Fields"); // NOI18N
Lines 140-145 Link Here
140
        cbFold.setToolTipText(loc("HINT_FOLD_GENERATED_CODE")); // NOI18N
142
        cbFold.setToolTipText(loc("HINT_FOLD_GENERATED_CODE")); // NOI18N
141
        cbAssistant.setToolTipText(loc("HINT_ASSISTANT_SHOWN")); // NOI18N
143
        cbAssistant.setToolTipText(loc("HINT_ASSISTANT_SHOWN")); // NOI18N
142
        cbFQN.setToolTipText(loc("HINT_GENERATE_FQN")); // NOI18N
144
        cbFQN.setToolTipText(loc("HINT_GENERATE_FQN")); // NOI18N
145
        cbShowReadOnly.setToolTipText(loc("HINT_SHOW_READ_ONLY")); // NOI18N
143
        rbGenerateLocals.getAccessibleContext().setAccessibleDescription(loc("Generate_Locals_ACSD")); // NOI18N
146
        rbGenerateLocals.getAccessibleContext().setAccessibleDescription(loc("Generate_Locals_ACSD")); // NOI18N
144
        rbGenerateFields.getAccessibleContext().setAccessibleDescription(loc("Generate_Fields_ACSD")); // NOI18N
147
        rbGenerateFields.getAccessibleContext().setAccessibleDescription(loc("Generate_Fields_ACSD")); // NOI18N
145
148
Lines 172-177 Link Here
172
                    .add(cbFold)
175
                    .add(cbFold)
173
                    .add(cbAssistant)
176
                    .add(cbAssistant)
174
                    .add(cbFQN)
177
                    .add(cbFQN)
178
                    .add(cbShowReadOnly)
175
                    .add(cbModifier, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
179
                    .add(cbModifier, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
176
                    .add(cbLayoutStyle, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
180
                    .add(cbLayoutStyle, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
177
                    .add(cbComponentNames, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
181
                    .add(cbComponentNames, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
Lines 213-218 Link Here
213
                .add(cbFold)
217
                .add(cbFold)
214
                .add(cbAssistant)
218
                .add(cbAssistant)
215
                .add(cbFQN)
219
                .add(cbFQN)
220
                .add(cbShowReadOnly)
216
                .addPreferredGap(LayoutStyle.RELATED)
221
                .addPreferredGap(LayoutStyle.RELATED)
217
                .add(layout.createParallelGroup(GroupLayout.LEADING)
222
                .add(layout.createParallelGroup(GroupLayout.LEADING)
218
                    .add(GroupLayout.CENTER, guideLineColLabel)
223
                    .add(GroupLayout.CENTER, guideLineColLabel)
Lines 229-234 Link Here
229
        cbFold.addActionListener (this);
234
        cbFold.addActionListener (this);
230
        cbAssistant.addActionListener(this);
235
        cbAssistant.addActionListener(this);
231
        cbFQN.addActionListener(this);
236
        cbFQN.addActionListener(this);
237
        cbShowReadOnly.addActionListener(this);
232
        cbLayoutStyle.addActionListener (this);
238
        cbLayoutStyle.addActionListener (this);
233
        cbComponentNames.addActionListener (this);
239
        cbComponentNames.addActionListener (this);
234
        cbListenerStyle.addActionListener (this);
240
        cbListenerStyle.addActionListener (this);
Lines 278-283 Link Here
278
        cbFold.setSelected(options.getFoldGeneratedCode());
284
        cbFold.setSelected(options.getFoldGeneratedCode());
279
        cbAssistant.setSelected(options.getAssistantShown());
285
        cbAssistant.setSelected(options.getAssistantShown());
280
        cbFQN.setSelected(options.getGenerateFQN());
286
        cbFQN.setSelected(options.getGenerateFQN());
287
        cbShowReadOnly.setSelected(options.getShowReadOnlyProperties());
281
        rbGenerateLocals.setSelected(options.getVariablesLocal());
288
        rbGenerateLocals.setSelected(options.getVariablesLocal());
282
        rbGenerateFields.setSelected(!options.getVariablesLocal());
289
        rbGenerateFields.setSelected(!options.getVariablesLocal());
283
        if ((options.getVariablesModifier() & Modifier.PUBLIC) > 0) {
290
        if ((options.getVariablesModifier() & Modifier.PUBLIC) > 0) {
Lines 303-308 Link Here
303
        options.setFoldGeneratedCode (cbFold.isSelected ());
310
        options.setFoldGeneratedCode (cbFold.isSelected ());
304
        options.setAssistantShown(cbAssistant.isSelected());
311
        options.setAssistantShown(cbAssistant.isSelected());
305
        options.setGenerateFQN(cbFQN.isSelected());
312
        options.setGenerateFQN(cbFQN.isSelected());
313
        options.setShowReadOnlyProperties(cbShowReadOnly.isSelected());
306
        options.setListenerGenerationStyle (cbListenerStyle.getSelectedIndex ());
314
        options.setListenerGenerationStyle (cbListenerStyle.getSelectedIndex ());
307
        options.setLayoutCodeTarget(cbLayoutStyle.getSelectedIndex ());
315
        options.setLayoutCodeTarget(cbLayoutStyle.getSelectedIndex ());
308
        options.setAutoSetComponentName(cbComponentNames.getSelectedIndex());
316
        options.setAutoSetComponentName(cbComponentNames.getSelectedIndex());
(-)a/form/src/org/netbeans/modules/form/FormLoaderSettings.java (+10 lines)
Lines 110-115 Link Here
110
    public static final String PROP_LAYOUT_CODE_TARGET = "layoutCodeTarget"; // NOI18N
110
    public static final String PROP_LAYOUT_CODE_TARGET = "layoutCodeTarget"; // NOI18N
111
    /** Property name of the generate FQN property. */
111
    /** Property name of the generate FQN property. */
112
    public static final String PROP_GENERATE_FQN = "generateFQN"; // NOI18N
112
    public static final String PROP_GENERATE_FQN = "generateFQN"; // NOI18N
113
    /** Property name of the showReadOnlyProperties property. */
114
    public static final String PROP_SHOW_READ_ONLY_PROPERTIES = "showReadOnlyProperties"; // NOI18N
113
115
114
    /** Name of the property for automatic resources/i18n management.
116
    /** Name of the property for automatic resources/i18n management.
115
     * The name refers only to i18n for compatibility reasons. */
117
     * The name refers only to i18n for compatibility reasons. */
Lines 413-418 Link Here
413
        getPreferences().putInt(PROP_AUTO_SET_COMPONENT_NAME, value);
415
        getPreferences().putInt(PROP_AUTO_SET_COMPONENT_NAME, value);
414
    }
416
    }
415
417
418
    public boolean getShowReadOnlyProperties() {
419
        return getPreferences().getBoolean(PROP_SHOW_READ_ONLY_PROPERTIES, true);
420
    }
421
422
    public void setShowReadOnlyProperties(boolean value) {
423
        getPreferences().putBoolean(PROP_SHOW_READ_ONLY_PROPERTIES, value);
424
    }
425
416
    /**
426
    /**
417
     * Getter for the generateMnemonicsCode option.
427
     * Getter for the generateMnemonicsCode option.
418
     * 
428
     * 
(-)a/form/src/org/netbeans/modules/form/FormSettings.java (+9 lines)
Lines 129-134 Link Here
129
        return autoName;
129
        return autoName;
130
    }
130
    }
131
131
132
    public boolean getShowReadOnlyProperties() {
133
        Boolean val = (Boolean) settings.get(FormLoaderSettings.PROP_SHOW_READ_ONLY_PROPERTIES);
134
        return val == null ? true : val.booleanValue();
135
    }
136
137
    public void setShowReadOnlyProperties(boolean value) {
138
        settings.put(FormLoaderSettings.PROP_SHOW_READ_ONLY_PROPERTIES, Boolean.valueOf(value));
139
    }
140
132
    public boolean getGenerateMnemonicsCode() {
141
    public boolean getGenerateMnemonicsCode() {
133
        Boolean generateMnemonicsCode = (Boolean)settings.get(FormLoaderSettings.PROP_GENERATE_MNEMONICS);
142
        Boolean generateMnemonicsCode = (Boolean)settings.get(FormLoaderSettings.PROP_GENERATE_MNEMONICS);
134
        return generateMnemonicsCode.booleanValue();
143
        return generateMnemonicsCode.booleanValue();
(-)a/form/src/org/netbeans/modules/form/RADComponent.java (-1 / +34 lines)
Lines 46-52 Link Here
46
import java.io.IOException;
46
import java.io.IOException;
47
import java.lang.reflect.InvocationTargetException;
47
import java.lang.reflect.InvocationTargetException;
48
import java.util.*;
48
import java.util.*;
49
import java.util.prefs.PreferenceChangeEvent;
49
import java.lang.reflect.Method;
50
import java.lang.reflect.Method;
51
import java.util.prefs.PreferenceChangeListener;
50
import javax.accessibility.Accessible;
52
import javax.accessibility.Accessible;
51
import javax.accessibility.AccessibleContext;
53
import javax.accessibility.AccessibleContext;
52
import javax.swing.AbstractButton;
54
import javax.swing.AbstractButton;
Lines 124-129 Link Here
124
    private String storedName; // component name preserved e.g. for remove undo
126
    private String storedName; // component name preserved e.g. for remove undo
125
127
126
    private boolean valid = true;
128
    private boolean valid = true;
129
130
    private PreferenceChangeListener settingsListener;
131
132
127
    // -----------------------------------------------------------------------------
133
    // -----------------------------------------------------------------------------
128
    // Constructors & Initialization
134
    // Constructors & Initialization
129
135
Lines 142-147 Link Here
142
            // properties and events will be created on first request
148
            // properties and events will be created on first request
143
            clearProperties();
149
            clearProperties();
144
150
151
// TODO: Find out the correct place to register/deregister this event.
152
//        if (settingsListener != null) {
153
//            FormLoaderSettings.getPreferences().removePreferenceChangeListener(settingsListener);
154
//        }
155
156
        settingsListener = new PreferenceChangeListener() {
157
            public void preferenceChange(PreferenceChangeEvent evt) {
158
                if (FormLoaderSettings.PROP_SHOW_READ_ONLY_PROPERTIES.equals(evt.getKey())) {
159
                    clearProperties();
160
                    createBeanProperties();
161
                }
162
            }
163
        };
164
        FormLoaderSettings.getPreferences().addPreferenceChangeListener(settingsListener);
165
145
//            if (beanClass != null)
166
//            if (beanClass != null)
146
//                createCodeExpression();
167
//                createCodeExpression();
147
168
Lines 840-845 Link Here
840
                            propAccessClsf = FormUtils.getPropertiesAccessClsf(beanClass);
861
                            propAccessClsf = FormUtils.getPropertiesAccessClsf(beanClass);
841
                            propParentChildDepClsf = FormUtils.getPropertiesParentChildDepsClsf(beanClass);
862
                            propParentChildDepClsf = FormUtils.getPropertiesParentChildDepsClsf(beanClass);
842
                        }
863
                        }
864
                        
865
                        descriptors[i].setDisplayName(
866
                                RADProperty.getFormedName(
867
                                descriptors[i].getDisplayName()));
843
868
844
                        prop = createBeanProperty(descriptors[j], propAccessClsf, propParentChildDepClsf);
869
                        prop = createBeanProperty(descriptors[j], propAccessClsf, propParentChildDepClsf);
845
870
Lines 1213-1219 Link Here
1213
            boolean action = (pd.getValue("action") != null); // NOI18N
1238
            boolean action = (pd.getValue("action") != null); // NOI18N
1214
            Object category = pd.getValue("category"); // NOI18N
1239
            Object category = pd.getValue("category"); // NOI18N
1215
            List<RADProperty> listToAdd;
1240
            List<RADProperty> listToAdd;
1216
            
1241
1242
            if (!FormLoaderSettings.getInstance().getShowReadOnlyProperties() &&
1243
                (pd.isHidden() ||
1244
                    pd.getPropertyType() == null ||
1245
                    pd.getWriteMethod() == null)
1246
            ) {
1247
                continue;
1248
            }
1249
1217
            if ((category == null) || (!(category instanceof String))) {
1250
            if ((category == null) || (!(category instanceof String))) {
1218
                Object propCat = FormUtils.getPropertyCategory(pd, propsCats);
1251
                Object propCat = FormUtils.getPropertyCategory(pd, propsCats);
1219
                if (propCat == FormUtils.PROP_PREFERRED)
1252
                if (propCat == FormUtils.PROP_PREFERRED)
(-)a/form/src/org/netbeans/modules/form/RADProperty.java (-1 / +23 lines)
Lines 70-80 Link Here
70
    private PropertyDescriptor desc;
70
    private PropertyDescriptor desc;
71
    private Object defaultValue;
71
    private Object defaultValue;
72
72
73
    public static String getFormedName(String v) {
74
        char[] chars = v.toCharArray();
75
        StringBuilder res = new StringBuilder((int) (v.length() * 1.2));
76
        boolean lup = false;
77
        for (int i = 0; i < chars.length; i++) {
78
            if (i == 0) {
79
                res.append(Character.toUpperCase(chars[i]));
80
                lup = true;
81
            } else if (Character.isUpperCase(chars[i])) {
82
                if (!lup) {
83
                    res.append(' ');
84
                }
85
                res.append(chars[i]);
86
                lup = true;
87
            } else {
88
                res.append(chars[i]);
89
                lup = false;
90
            }
91
        }
92
        return res.toString();
93
    }
94
73
    public RADProperty(RADComponent metacomp, PropertyDescriptor propdesc) {
95
    public RADProperty(RADComponent metacomp, PropertyDescriptor propdesc) {
74
        super(new FormPropertyContext.Component(metacomp),
96
        super(new FormPropertyContext.Component(metacomp),
75
              propdesc.getName(),
97
              propdesc.getName(),
76
              propdesc.getPropertyType(),
98
              propdesc.getPropertyType(),
77
              propdesc.getDisplayName(),
99
              getFormedName(propdesc.getDisplayName()),
78
              propdesc.getShortDescription());
100
              propdesc.getShortDescription());
79
101
80
        component = metacomp;
102
        component = metacomp;

Return to bug 163544