1 19 20 package org.netbeans.modules.form; 21 22 import java.awt.Image ; 23 import java.beans.*; 24 import java.lang.reflect.Modifier ; 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 34 35 public class FormLoaderSettingsBeanInfo extends SimpleBeanInfo { 36 37 38 private static String iconURL = 39 "org/netbeans/modules/form/resources/formSettings.gif"; private static String icon32URL = 41 "org/netbeans/modules/form/resources/formSettings32.gif"; 43 46 public PropertyDescriptor[] getPropertyDescriptors() { 47 try { 48 PropertyDescriptor[] desc = new PropertyDescriptor[] { 49 new PropertyDescriptor(FormLoaderSettings.PROP_USE_INDENT_ENGINE, 50 FormLoaderSettings.class, 51 "getUseIndentEngine", "setUseIndentEngine"), new PropertyDescriptor(FormLoaderSettings.PROP_EVENT_VARIABLE_NAME, 54 FormLoaderSettings.class, 55 "getEventVariableName", "setEventVariableName"), new PropertyDescriptor(FormLoaderSettings.PROP_LISTENER_GENERATION_STYLE, 58 FormLoaderSettings.class, 59 "getListenerGenerationStyle", "setListenerGenerationStyle"), new PropertyDescriptor(FormLoaderSettings.PROP_LAYOUT_CODE_TARGET, 62 FormLoaderSettings.class, 63 "getLayoutCodeTarget", "setLayoutCodeTarget"), new PropertyDescriptor(FormLoaderSettings.PROP_SELECTION_BORDER_SIZE, 66 FormLoaderSettings.class, 67 "getSelectionBorderSize", "setSelectionBorderSize"), new PropertyDescriptor(FormLoaderSettings.PROP_SELECTION_BORDER_COLOR, 70 FormLoaderSettings.class, 71 "getSelectionBorderColor", "setSelectionBorderColor"), new PropertyDescriptor(FormLoaderSettings.PROP_CONNECTION_BORDER_COLOR, 74 FormLoaderSettings.class, 75 "getConnectionBorderColor", "setConnectionBorderColor"), new PropertyDescriptor(FormLoaderSettings.PROP_DRAG_BORDER_COLOR, 78 FormLoaderSettings.class, 79 "getDragBorderColor", "setDragBorderColor"), new PropertyDescriptor(FormLoaderSettings.PROP_GUIDING_LINE_COLOR, 82 FormLoaderSettings.class, 83 "getGuidingLineColor", "setGuidingLineColor"), new PropertyDescriptor(FormLoaderSettings.PROP_GRID_X, 86 FormLoaderSettings.class, 87 "getGridX", "setGridX"), new PropertyDescriptor(FormLoaderSettings.PROP_GRID_Y, 89 FormLoaderSettings.class, 90 "getGridY", "setGridY"), new PropertyDescriptor(FormLoaderSettings.PROP_APPLY_GRID_TO_POSITION, 92 FormLoaderSettings.class, 93 "getApplyGridToPosition", "setApplyGridToPosition"), new PropertyDescriptor(FormLoaderSettings.PROP_APPLY_GRID_TO_SIZE, 96 FormLoaderSettings.class, 97 "getApplyGridToSize", "setApplyGridToSize"), new PropertyDescriptor(FormLoaderSettings.PROP_VARIABLES_MODIFIER, 100 FormLoaderSettings.class, 101 "getVariablesModifier", "setVariablesModifier"), new PropertyDescriptor(FormLoaderSettings.PROP_EDITOR_SEARCH_PATH, 104 FormLoaderSettings.class, 105 "getEditorSearchPath", "setEditorSearchPath"), new IndexedPropertyDescriptor(FormLoaderSettings.PROP_REGISTERED_EDITORS, 108 FormLoaderSettings.class, 109 "getRegisteredEditors", "setRegisteredEditors", "getRegisteredEditor", "setRegisteredEditor"), new PropertyDescriptor(FormLoaderSettings.PROP_PALETTE_IN_TOOLBAR, 114 FormLoaderSettings.class, 115 "isPaletteInToolBar", "setPaletteInToolBar"), new PropertyDescriptor(FormLoaderSettings.PROP_FORMDESIGNER_BACKGROUND_COLOR, 122 FormLoaderSettings.class, 123 "getFormDesignerBackgroundColor", "setFormDesignerBackgroundColor"), new PropertyDescriptor(FormLoaderSettings.PROP_FORMDESIGNER_BORDER_COLOR, 126 FormLoaderSettings.class, 127 "getFormDesignerBorderColor", "setFormDesignerBorderColor"), new PropertyDescriptor(FormLoaderSettings.PROP_VARIABLES_LOCAL, 130 FormLoaderSettings.class, 131 "getVariablesLocal", "setVariablesLocal"), new PropertyDescriptor(FormLoaderSettings.PROP_DISPLAY_WRITABLE_ONLY, 134 FormLoaderSettings.class, 135 "getDisplayWritableOnly", "setDisplayWritableOnly"), new PropertyDescriptor(FormLoaderSettings.PROP_GENERATE_MNEMONICS, 138 FormLoaderSettings.class, 139 "getGenerateMnemonicsCode", "setGenerateMnemonicsCode"), new PropertyDescriptor(FormLoaderSettings.PROP_FOLD_GENERATED_CODE, 142 FormLoaderSettings.class, 143 "getFoldGeneratedCode", "setFoldGeneratedCode"), new PropertyDescriptor(FormLoaderSettings.PROP_ASSISTANT_SHOWN, 146 FormLoaderSettings.class, 147 "getAssistantShown", "setAssistantShown"), new PropertyDescriptor(FormLoaderSettings.PROP_AUTO_I18N, 150 FormLoaderSettings.class, 151 "getI18nAutoMode", "setI18nAutoMode") }; 154 155 ResourceBundle bundle = FormUtils.getBundle(); 156 int i = -1; 157 158 desc[++i].setDisplayName(bundle.getString("PROP_USE_INDENT_ENGINE")); desc[i].setShortDescription(bundle.getString("HINT_USE_INDENT_ENGINE")); 161 desc[++i].setDisplayName(bundle.getString("PROP_EVENT_VARIABLE_NAME")); desc[i].setShortDescription(bundle.getString("HINT_EVENT_VARIABLE_NAME")); desc[i].setExpert(true); 164 165 desc[++i].setDisplayName(bundle.getString("PROP_LISTENER_GENERATION_STYLE")); desc[i].setShortDescription(bundle.getString("HINT_LISTENER_GENERATION_STYLE")); desc[i].setPropertyEditorClass(ListenerGenerationStyleEditor.class); 168 desc[i].setExpert(true); 169 170 desc[++i].setDisplayName(bundle.getString("PROP_LAYOUT_CODE_TARGET")); desc[i].setShortDescription(bundle.getString("HINT_LAYOUT_CODE_TARGET")); desc[i].setPropertyEditorClass(LayoutCodeTargetEditor.class); 173 desc[i].setExpert(true); 174 175 desc[++i].setDisplayName(bundle.getString("PROP_SELECTION_BORDER_SIZE")); desc[i].setShortDescription(bundle.getString("HINT_SELECTION_BORDER_SIZE")); 178 desc[++i].setDisplayName(bundle.getString("PROP_SELECTION_BORDER_COLOR")); desc[i].setShortDescription(bundle.getString("HINT_SELECTION_BORDER_COLOR")); 181 desc[++i].setDisplayName(bundle.getString("PROP_CONNECTION_BORDER_COLOR")); desc[i].setShortDescription(bundle.getString("HINT_CONNECTION_BORDER_COLOR")); 184 desc[++i].setDisplayName(bundle.getString("PROP_DRAG_BORDER_COLOR")); desc[i].setShortDescription(bundle.getString("HINT_DRAG_BORDER_COLOR")); 187 desc[++i].setDisplayName(bundle.getString("PROP_GUIDING_LINE_COLOR")); desc[i].setShortDescription(bundle.getString("HINT_GUIDING_LINE_COLOR")); 190 desc[++i].setDisplayName(bundle.getString("PROP_GRID_X")); desc[i].setShortDescription(bundle.getString("HINT_GRID_X")); desc[i].setExpert(true); 193 194 desc[++i].setDisplayName(bundle.getString("PROP_GRID_Y")); desc[i].setShortDescription(bundle.getString("HINT_GRID_Y")); desc[i].setExpert(true); 197 198 desc[++i].setDisplayName(bundle.getString("PROP_APPLY_GRID_TO_POSITION")); desc[i].setShortDescription(bundle.getString("HINT_APPLY_GRID_TO_POSITION")); desc[i].setExpert(true); 201 202 desc[++i].setDisplayName(bundle.getString("PROP_APPLY_GRID_TO_SIZE")); desc[i].setShortDescription(bundle.getString("HINT_APPLY_GRID_TO_SIZE")); desc[i].setExpert(true); 205 206 desc[++i].setDisplayName(bundle.getString("PROP_VARIABLES_MODIFIER")); desc[i].setShortDescription(bundle.getString("HINT_VARIABLES_MODIFIER")); desc[i].setPropertyEditorClass(FieldModifierPropertyEditor.class); 209 desc[i].setExpert(true); 210 211 desc[++i].setDisplayName(bundle.getString("PROP_EDITOR_SEARCH_PATH")); desc[i].setShortDescription(bundle.getString("HINT_EDITOR_SEARCH_PATH")); desc[i].setExpert(true); 214 215 desc[++i].setDisplayName(bundle.getString("PROP_REGISTERED_EDITORS")); desc[i].setShortDescription(bundle.getString("HINT_REGISTERED_EDITORS")); desc[i].setExpert(true); 218 219 desc[++i].setDisplayName(bundle.getString("PROP_PALETTE_IN_TOOLBAR")); desc[i].setShortDescription(bundle.getString("HINT_PALETTE_IN_TOOLBAR")); 222 desc[++i].setDisplayName(bundle.getString("PROP_FORMDESIGNER_BACKGROUND_COLOR")); desc[i].setShortDescription(bundle.getString("HINT_FORMDESIGNER_BACKGROUND_COLOR")); 225 desc[++i].setDisplayName(bundle.getString("PROP_FORMDESIGNER_BORDER_COLOR")); desc[i].setShortDescription(bundle.getString("HINT_FORMDESIGNER_BORDER_COLOR")); 228 desc[++i].setDisplayName(bundle.getString("PROP_VARIABLES_LOCAL")); desc[i].setShortDescription(bundle.getString("HINT_VARIABLES_LOCAL")); desc[i].setExpert(true); 231 232 desc[++i].setHidden(true); 233 234 desc[++i].setDisplayName(bundle.getString("PROP_GENERATE_MNEMONICS")); desc[i].setShortDescription(bundle.getString("HINT_GENERATE_MNEMONICS")); desc[i].setExpert(true); 237 238 desc[++i].setDisplayName(bundle.getString("PROP_FOLD_GENERATED_CODE")); desc[i].setShortDescription(bundle.getString("HINT_FOLD_GENERATED_CODE")); desc[i].setExpert(true); 241 242 desc[++i].setDisplayName(bundle.getString("PROP_ASSISTANT_SHOWN")); desc[i].setShortDescription(bundle.getString("HINT_ASSISTANT_SHOWN")); desc[i].setPreferred(true); 245 246 desc[++i].setDisplayName(bundle.getString("PROP_AUTO_I18N")); desc[i].setShortDescription(bundle.getString("HINT_AUTO_I18N_GLOBAL")); desc[i].setPropertyEditorClass(I18nModeEditor.class); 249 desc[i].setPreferred(true); 250 251 return desc; 252 } 253 catch (IntrospectionException ex) { 254 throw new InternalError (); 255 } 256 } 257 258 259 public Image 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")); return retval; 270 } 271 272 273 275 277 final public static class FieldModifierPropertyEditor 278 extends ModifierEditor 279 { 280 static final long serialVersionUID =7628317154007139777L; 281 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 [] { 295 FormUtils.getBundleString("CTL_LISTENER_ANONYMOUS_CLASSES"), new Integer (JavaCodeGenerator.ANONYMOUS_INNERCLASSES), 297 "", FormUtils.getBundleString("CTL_LISTENER_CEDL_INNERCLASS"), new Integer (JavaCodeGenerator.CEDL_INNERCLASS), 300 "", FormUtils.getBundleString("CTL_LISTENER_CEDL_MAINCLASS"), new Integer (JavaCodeGenerator.CEDL_MAINCLASS), 303 "" }); 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 [] { 317 FormUtils.getBundleString("CTL_LAYOUT_CODE_JDK6"), new Integer (JavaCodeGenerator.LAYOUT_CODE_JDK6), 319 "", FormUtils.getBundleString("CTL_LAYOUT_CODE_LIBRARY"), new Integer (JavaCodeGenerator.LAYOUT_CODE_LIBRARY), 322 "" } 324 : 325 new Object [] { 326 FormUtils.getBundleString("CTL_LAYOUT_CODE_AUTO"), new Integer (JavaCodeGenerator.LAYOUT_CODE_AUTO), 328 "", FormUtils.getBundleString("CTL_LAYOUT_CODE_JDK6"), new Integer (JavaCodeGenerator.LAYOUT_CODE_JDK6), 331 "", FormUtils.getBundleString("CTL_LAYOUT_CODE_LIBRARY"), new Integer (JavaCodeGenerator.LAYOUT_CODE_LIBRARY), 334 "" }); 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 [] { 344 FormUtils.getBundleString("CTL_AUTO_I18N_DEFAULT"), new Integer (FormLoaderSettings.AUTO_I18N_DEFAULT), 346 "", FormUtils.getBundleString("CTL_AUTO_I18N_ON"), new Integer (FormLoaderSettings.AUTO_I18N_ON), 349 "", FormUtils.getBundleString("CTL_AUTO_I18N_OFF"), new Integer (FormLoaderSettings.AUTO_I18N_OFF), 352 "" }); 354 } 355 } 356 357 } 358 | Popular Tags |