KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > form > FormLoaderSettingsBeanInfo


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.form;
21
22 import java.awt.Image JavaDoc;
23 import java.beans.*;
24 import java.lang.reflect.Modifier JavaDoc;
25 import java.util.*;
26 import org.netbeans.modules.form.editors.ModifierEditor;
27 import org.openide.util.NbBundle;
28
29 import org.openide.util.Utilities;
30
31 /**
32  * A BeanInfo for FormLoaderSettings.
33  */

34
35 public class FormLoaderSettingsBeanInfo extends SimpleBeanInfo {
36
37     /** The icons for Settings */
38     private static String JavaDoc iconURL =
39         "org/netbeans/modules/form/resources/formSettings.gif"; // NOI18N
40
private static String JavaDoc icon32URL =
41         "org/netbeans/modules/form/resources/formSettings32.gif"; // NOI18N
42

43     /** Descriptor of valid properties
44      * @return array of properties
45      */

46     public PropertyDescriptor[] getPropertyDescriptors() {
47         try {
48             PropertyDescriptor[] desc = new PropertyDescriptor[] {
49                 new PropertyDescriptor(FormLoaderSettings.PROP_USE_INDENT_ENGINE,
50                                        FormLoaderSettings.class,
51                                        "getUseIndentEngine", // NOI18N
52
"setUseIndentEngine"), // NOI18N
53
new PropertyDescriptor(FormLoaderSettings.PROP_EVENT_VARIABLE_NAME,
54                                        FormLoaderSettings.class,
55                                        "getEventVariableName", // NOI18N
56
"setEventVariableName"), // NOI18N
57
new PropertyDescriptor(FormLoaderSettings.PROP_LISTENER_GENERATION_STYLE,
58                                        FormLoaderSettings.class,
59                                        "getListenerGenerationStyle", // NOI18N
60
"setListenerGenerationStyle"), // NOI18N
61
new PropertyDescriptor(FormLoaderSettings.PROP_LAYOUT_CODE_TARGET,
62                                        FormLoaderSettings.class,
63                                        "getLayoutCodeTarget", // NOI18N
64
"setLayoutCodeTarget"), // NOI18N
65
new PropertyDescriptor(FormLoaderSettings.PROP_SELECTION_BORDER_SIZE,
66                                        FormLoaderSettings.class,
67                                        "getSelectionBorderSize", // NOI18N
68
"setSelectionBorderSize"), // NOI18N
69
new PropertyDescriptor(FormLoaderSettings.PROP_SELECTION_BORDER_COLOR,
70                                        FormLoaderSettings.class,
71                                        "getSelectionBorderColor", // NOI18N
72
"setSelectionBorderColor"), // NOI18N
73
new PropertyDescriptor(FormLoaderSettings.PROP_CONNECTION_BORDER_COLOR,
74                                        FormLoaderSettings.class,
75                                        "getConnectionBorderColor", // NOI18N
76
"setConnectionBorderColor"), // NOI18N
77
new PropertyDescriptor(FormLoaderSettings.PROP_DRAG_BORDER_COLOR,
78                                        FormLoaderSettings.class,
79                                        "getDragBorderColor", // NOI18N
80
"setDragBorderColor"), // NOI18N
81
new PropertyDescriptor(FormLoaderSettings.PROP_GUIDING_LINE_COLOR,
82                                        FormLoaderSettings.class,
83                                        "getGuidingLineColor", // NOI18N
84
"setGuidingLineColor"), // NOI18N
85
new PropertyDescriptor(FormLoaderSettings.PROP_GRID_X,
86                                        FormLoaderSettings.class,
87                                        "getGridX", "setGridX"), // NOI18N
88
new PropertyDescriptor(FormLoaderSettings.PROP_GRID_Y,
89                                        FormLoaderSettings.class,
90                                        "getGridY", "setGridY"), // NOI18N
91
new PropertyDescriptor(FormLoaderSettings.PROP_APPLY_GRID_TO_POSITION,
92                                        FormLoaderSettings.class,
93                                        "getApplyGridToPosition", // NOI18N
94
"setApplyGridToPosition"), // NOI18N
95
new PropertyDescriptor(FormLoaderSettings.PROP_APPLY_GRID_TO_SIZE,
96                                        FormLoaderSettings.class,
97                                        "getApplyGridToSize", // NOI18N
98
"setApplyGridToSize"), // NOI18N
99
new PropertyDescriptor(FormLoaderSettings.PROP_VARIABLES_MODIFIER,
100                                        FormLoaderSettings.class,
101                                        "getVariablesModifier", // NOI18N
102
"setVariablesModifier"), // NOI18N
103
new PropertyDescriptor(FormLoaderSettings.PROP_EDITOR_SEARCH_PATH,
104                                        FormLoaderSettings.class,
105                                        "getEditorSearchPath", // NOI18N
106
"setEditorSearchPath"), // NOI18N
107
new IndexedPropertyDescriptor(FormLoaderSettings.PROP_REGISTERED_EDITORS,
108                                               FormLoaderSettings.class,
109                                               "getRegisteredEditors", // NOI18N
110
"setRegisteredEditors", // NOI18N
111
"getRegisteredEditor", // NOI18N
112
"setRegisteredEditor"), // NOI18N
113
new PropertyDescriptor(FormLoaderSettings.PROP_PALETTE_IN_TOOLBAR,
114                                        FormLoaderSettings.class,
115                                        "isPaletteInToolBar", // NOI18N
116
"setPaletteInToolBar"), // NOI18N
117
// new PropertyDescriptor(FormLoaderSettings.PROP_CONTAINER_BEANS,
118
// FormLoaderSettings.class,
119
// "getContainerBeans", // NOI18N
120
// "setContainerBeans"), // NOI18N
121
new PropertyDescriptor(FormLoaderSettings.PROP_FORMDESIGNER_BACKGROUND_COLOR,
122                                        FormLoaderSettings.class,
123                                        "getFormDesignerBackgroundColor", // NOI18N
124
"setFormDesignerBackgroundColor"), // NOI18N
125
new PropertyDescriptor(FormLoaderSettings.PROP_FORMDESIGNER_BORDER_COLOR,
126                                        FormLoaderSettings.class,
127                                        "getFormDesignerBorderColor", // NOI18N
128
"setFormDesignerBorderColor"), // NOI18N
129
new PropertyDescriptor(FormLoaderSettings.PROP_VARIABLES_LOCAL,
130                                        FormLoaderSettings.class,
131                                        "getVariablesLocal", // NOI18N
132
"setVariablesLocal"), // NOI18N
133
new PropertyDescriptor(FormLoaderSettings.PROP_DISPLAY_WRITABLE_ONLY,
134                                        FormLoaderSettings.class,
135                                        "getDisplayWritableOnly", // NOI18N
136
"setDisplayWritableOnly"), // NOI18N
137
new PropertyDescriptor(FormLoaderSettings.PROP_GENERATE_MNEMONICS,
138                                        FormLoaderSettings.class,
139                                        "getGenerateMnemonicsCode", // NOI18N
140
"setGenerateMnemonicsCode"), // NOI18N
141
new PropertyDescriptor(FormLoaderSettings.PROP_FOLD_GENERATED_CODE,
142                                        FormLoaderSettings.class,
143                                        "getFoldGeneratedCode", // NOI18N
144
"setFoldGeneratedCode"), // NOI18N
145
new PropertyDescriptor(FormLoaderSettings.PROP_ASSISTANT_SHOWN,
146                                        FormLoaderSettings.class,
147                                        "getAssistantShown", // NOI18N
148
"setAssistantShown"), // NOI18N
149
new PropertyDescriptor(FormLoaderSettings.PROP_AUTO_I18N,
150                                        FormLoaderSettings.class,
151                                        "getI18nAutoMode", // NOI18N
152
"setI18nAutoMode") // NOI18N
153
};
154
155             ResourceBundle bundle = FormUtils.getBundle();
156             int i = -1;
157
158             desc[++i].setDisplayName(bundle.getString("PROP_USE_INDENT_ENGINE")); // NOI18N
159
desc[i].setShortDescription(bundle.getString("HINT_USE_INDENT_ENGINE")); // NOI18N
160

161             desc[++i].setDisplayName(bundle.getString("PROP_EVENT_VARIABLE_NAME")); // NOI18N
162
desc[i].setShortDescription(bundle.getString("HINT_EVENT_VARIABLE_NAME")); // NOI18N
163
desc[i].setExpert(true);
164
165             desc[++i].setDisplayName(bundle.getString("PROP_LISTENER_GENERATION_STYLE")); // NOI18N
166
desc[i].setShortDescription(bundle.getString("HINT_LISTENER_GENERATION_STYLE")); // NOI18N
167
desc[i].setPropertyEditorClass(ListenerGenerationStyleEditor.class);
168             desc[i].setExpert(true);
169
170             desc[++i].setDisplayName(bundle.getString("PROP_LAYOUT_CODE_TARGET")); // NOI18N
171
desc[i].setShortDescription(bundle.getString("HINT_LAYOUT_CODE_TARGET")); // NOI18N
172
desc[i].setPropertyEditorClass(LayoutCodeTargetEditor.class);
173             desc[i].setExpert(true);
174
175             desc[++i].setDisplayName(bundle.getString("PROP_SELECTION_BORDER_SIZE")); // NOI18N
176
desc[i].setShortDescription(bundle.getString("HINT_SELECTION_BORDER_SIZE")); // NOI18N
177

178             desc[++i].setDisplayName(bundle.getString("PROP_SELECTION_BORDER_COLOR")); // NOI18N
179
desc[i].setShortDescription(bundle.getString("HINT_SELECTION_BORDER_COLOR")); // NOI18N
180

181             desc[++i].setDisplayName(bundle.getString("PROP_CONNECTION_BORDER_COLOR")); // NOI18N
182
desc[i].setShortDescription(bundle.getString("HINT_CONNECTION_BORDER_COLOR")); // NOI18N
183

184             desc[++i].setDisplayName(bundle.getString("PROP_DRAG_BORDER_COLOR")); // NOI18N
185
desc[i].setShortDescription(bundle.getString("HINT_DRAG_BORDER_COLOR")); // NOI18N
186

187             desc[++i].setDisplayName(bundle.getString("PROP_GUIDING_LINE_COLOR")); // NOI18N
188
desc[i].setShortDescription(bundle.getString("HINT_GUIDING_LINE_COLOR")); // NOI18N
189

190             desc[++i].setDisplayName(bundle.getString("PROP_GRID_X")); // NOI18N
191
desc[i].setShortDescription(bundle.getString("HINT_GRID_X")); // NOI18N
192
desc[i].setExpert(true);
193
194             desc[++i].setDisplayName(bundle.getString("PROP_GRID_Y")); // NOI18N
195
desc[i].setShortDescription(bundle.getString("HINT_GRID_Y")); // NOI18N
196
desc[i].setExpert(true);
197
198             desc[++i].setDisplayName(bundle.getString("PROP_APPLY_GRID_TO_POSITION")); // NOI18N
199
desc[i].setShortDescription(bundle.getString("HINT_APPLY_GRID_TO_POSITION")); // NOI18N
200
desc[i].setExpert(true);
201
202             desc[++i].setDisplayName(bundle.getString("PROP_APPLY_GRID_TO_SIZE")); // NOI18N
203
desc[i].setShortDescription(bundle.getString("HINT_APPLY_GRID_TO_SIZE")); // NOI18N
204
desc[i].setExpert(true);
205
206             desc[++i].setDisplayName(bundle.getString("PROP_VARIABLES_MODIFIER")); // NOI18N
207
desc[i].setShortDescription(bundle.getString("HINT_VARIABLES_MODIFIER")); // NOI18N
208
desc[i].setPropertyEditorClass(FieldModifierPropertyEditor.class);
209             desc[i].setExpert(true);
210
211             desc[++i].setDisplayName(bundle.getString("PROP_EDITOR_SEARCH_PATH")); // NOI18N
212
desc[i].setShortDescription(bundle.getString("HINT_EDITOR_SEARCH_PATH")); // NOI18N
213
desc[i].setExpert(true);
214
215             desc[++i].setDisplayName(bundle.getString("PROP_REGISTERED_EDITORS")); // NOI18N
216
desc[i].setShortDescription(bundle.getString("HINT_REGISTERED_EDITORS")); // NOI18N
217
desc[i].setExpert(true);
218
219             desc[++i].setDisplayName(bundle.getString("PROP_PALETTE_IN_TOOLBAR")); // NOI18N
220
desc[i].setShortDescription(bundle.getString("HINT_PALETTE_IN_TOOLBAR")); // NOI18N
221

222             desc[++i].setDisplayName(bundle.getString("PROP_FORMDESIGNER_BACKGROUND_COLOR")); // NOI18N
223
desc[i].setShortDescription(bundle.getString("HINT_FORMDESIGNER_BACKGROUND_COLOR")); // NOI18N
224

225             desc[++i].setDisplayName(bundle.getString("PROP_FORMDESIGNER_BORDER_COLOR")); // NOI18N
226
desc[i].setShortDescription(bundle.getString("HINT_FORMDESIGNER_BORDER_COLOR")); // NOI18N
227

228             desc[++i].setDisplayName(bundle.getString("PROP_VARIABLES_LOCAL")); // NOI18N
229
desc[i].setShortDescription(bundle.getString("HINT_VARIABLES_LOCAL")); // NOI18N
230
desc[i].setExpert(true);
231
232             desc[++i].setHidden(true);
233
234             desc[++i].setDisplayName(bundle.getString("PROP_GENERATE_MNEMONICS")); // NOI18N
235
desc[i].setShortDescription(bundle.getString("HINT_GENERATE_MNEMONICS")); // NOI18N
236
desc[i].setExpert(true);
237             
238             desc[++i].setDisplayName(bundle.getString("PROP_FOLD_GENERATED_CODE")); // NOI18N
239
desc[i].setShortDescription(bundle.getString("HINT_FOLD_GENERATED_CODE")); // NOI18N
240
desc[i].setExpert(true);
241
242             desc[++i].setDisplayName(bundle.getString("PROP_ASSISTANT_SHOWN")); // NOI18N
243
desc[i].setShortDescription(bundle.getString("HINT_ASSISTANT_SHOWN")); // NOI18N
244
desc[i].setPreferred(true);
245
246             desc[++i].setDisplayName(bundle.getString("PROP_AUTO_I18N")); // NOI18N
247
desc[i].setShortDescription(bundle.getString("HINT_AUTO_I18N_GLOBAL")); // NOI18N
248
desc[i].setPropertyEditorClass(I18nModeEditor.class);
249             desc[i].setPreferred(true);
250
251             return desc;
252         }
253         catch (IntrospectionException ex) {
254             throw new InternalError JavaDoc();
255         }
256     }
257
258     /** Returns the FormLoaderSettings' icon */
259     public Image JavaDoc getIcon(int type) {
260         return Utilities.loadImage(
261                    type == java.beans.BeanInfo.ICON_COLOR_16x16
262                        || type == java.beans.BeanInfo.ICON_MONO_16x16 ?
263                    iconURL : icon32URL);
264     }
265     
266     public BeanDescriptor getBeanDescriptor() {
267         BeanDescriptor retval = new BeanDescriptor(FormLoaderSettings.class , null );
268         retval.setDisplayName(NbBundle.getMessage(FormLoaderSettings.class, "CTL_FormSettings"));//NOI18N
269
return retval;
270     }
271     
272
273     // --------
274

275     /** Property editor for variables modifiers.
276      */

277     final public static class FieldModifierPropertyEditor
278         extends ModifierEditor
279     {
280         static final long serialVersionUID =7628317154007139777L;
281         /** Construct new editor with mask for fields. */
282         public FieldModifierPropertyEditor() {
283             super(Modifier.PUBLIC | Modifier.PROTECTED | Modifier.PRIVATE
284                   | Modifier.STATIC | Modifier.FINAL | Modifier.TRANSIENT
285                   | Modifier.VOLATILE);
286         }
287     }
288
289
290     public final static class ListenerGenerationStyleEditor
291                       extends org.netbeans.modules.form.editors.EnumEditor
292     {
293         public ListenerGenerationStyleEditor() {
294             super(new Object JavaDoc[] {
295                 FormUtils.getBundleString("CTL_LISTENER_ANONYMOUS_CLASSES"), // NOI18N
296
new Integer JavaDoc(JavaCodeGenerator.ANONYMOUS_INNERCLASSES),
297                 "", // NOI18N
298
FormUtils.getBundleString("CTL_LISTENER_CEDL_INNERCLASS"), // NOI18N
299
new Integer JavaDoc(JavaCodeGenerator.CEDL_INNERCLASS),
300                 "", // NOI18N
301
FormUtils.getBundleString("CTL_LISTENER_CEDL_MAINCLASS"), // NOI18N
302
new Integer JavaDoc(JavaCodeGenerator.CEDL_MAINCLASS),
303                 "" // NOI18N
304
});
305         }
306     }
307
308     public final static class LayoutCodeTargetEditor
309                       extends org.netbeans.modules.form.editors.EnumEditor
310     {
311         public LayoutCodeTargetEditor() {
312             this(false);
313         }
314         public LayoutCodeTargetEditor(boolean specific) {
315             super(specific ?
316                 new Object JavaDoc[] {
317                     FormUtils.getBundleString("CTL_LAYOUT_CODE_JDK6"), // NOI18N
318
new Integer JavaDoc(JavaCodeGenerator.LAYOUT_CODE_JDK6),
319                     "", // NOI18N
320
FormUtils.getBundleString("CTL_LAYOUT_CODE_LIBRARY"), // NOI18N
321
new Integer JavaDoc(JavaCodeGenerator.LAYOUT_CODE_LIBRARY),
322                     "" // NOI18N
323
}
324                 :
325                 new Object JavaDoc[] {
326                     FormUtils.getBundleString("CTL_LAYOUT_CODE_AUTO"), // NOI18N
327
new Integer JavaDoc(JavaCodeGenerator.LAYOUT_CODE_AUTO),
328                     "", // NOI18N
329
FormUtils.getBundleString("CTL_LAYOUT_CODE_JDK6"), // NOI18N
330
new Integer JavaDoc(JavaCodeGenerator.LAYOUT_CODE_JDK6),
331                     "", // NOI18N
332
FormUtils.getBundleString("CTL_LAYOUT_CODE_LIBRARY"), // NOI18N
333
new Integer JavaDoc(JavaCodeGenerator.LAYOUT_CODE_LIBRARY),
334                     "" // NOI18N
335
});
336         }
337     }
338
339     public final static class I18nModeEditor
340                       extends org.netbeans.modules.form.editors.EnumEditor
341     {
342         public I18nModeEditor() {
343             super(new Object JavaDoc[] {
344                     FormUtils.getBundleString("CTL_AUTO_I18N_DEFAULT"), // NOI18N
345
new Integer JavaDoc(FormLoaderSettings.AUTO_I18N_DEFAULT),
346                     "", // NOI18N
347
FormUtils.getBundleString("CTL_AUTO_I18N_ON"), // NOI18N
348
new Integer JavaDoc(FormLoaderSettings.AUTO_I18N_ON),
349                     "", // NOI18N
350
FormUtils.getBundleString("CTL_AUTO_I18N_OFF"), // NOI18N
351
new Integer JavaDoc(FormLoaderSettings.AUTO_I18N_OFF),
352                     "" // NOI18N
353
});
354         }
355     }
356
357 }
358
Popular Tags