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.

Bug 94183 - Provide Creator-specific "backstop" property editors for common types
Summary: Provide Creator-specific "backstop" property editors for common types
Status: NEW
Alias: None
Product: obsolete
Classification: Unclassified
Component: visualweb (show other bugs)
Version: 5.x
Hardware: PC All
: P2 blocker (vote)
Assignee: _ sandipchitale
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-02-02 23:55 UTC by bugbridge
Modified: 2007-02-02 23:55 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description bugbridge 2007-02-02 23:55:47 UTC
Description:
Creator has property editors for common class types like String and Date, for 
JSF-specific types like ValueBinding and MethodBinding, and for primitives 
like int and long. However, when insync creates beans, and no editor is 
specified by a property, it allows NetBeans to supply the default, "backstop" 
editor. In most cases, however, these editors are not well-suited to the task. 

Insync should specify editors for well-known types, to free component authors 
from the burden of having to do this for every single property.

Suggested Fix:
Basic "backstop" support for the most common JSF property types could be 
provided by modifying the implementation of loadEditor() in 
org.netbeans.modules.visualweb.insync.live.SourceDesignProperty. If the 
property descriptor does not specify an editor, then use a Creator-specific 
editor for the property's type. If there is none, then fall back on the 
NetBeans editor, registered statically via the Java Beans 
PropertyEditorManager.

For example:

        // If no editor loaded, attempt to load a Creator-specific, default 
editor appropriate
        // for the property type
        if (editor == null) {
            Class propertyType = this.getPropertyDescriptor().getPropertyType
();
            if (String.class.isAssignableFrom(propertyType))
                editor = new 
org.netbeans.modules.visualweb.propertyeditors.StringPropertyEditor();
            else if (Integer.class.isAssignableFrom(propertyType))
                editor = new 
org.netbeans.modules.visualweb.propertyeditors.IntegerPropertyEditor();
            else if (Long.class.isAssignableFrom(propertyType))
                editor = new 
org.netbeans.modules.visualweb.propertyeditors.LongPropertyEditor();
            else if (Double.class.isAssignableFrom(propertyType))
                editor = new 
org.netbeans.modules.visualweb.propertyeditors.DoublePropertyEditor();
            else if (Converter.class.isAssignableFrom(propertyType))
                editor = new 
org.netbeans.modules.visualweb.propertyeditors.ConverterPropertyEditor();
            else if (Validator.class.isAssignableFrom(propertyType))
                editor = new 
org.netbeans.modules.visualweb.propertyeditors.ValidatorPropertyEditor();
            else if (ValueBinding.class.isAssignableFrom(propertyType))
                editor = new 
org.netbeans.modules.visualweb.propertyeditors.binding.ValueBindingPropertyEdit
or();
            else if (MethodBinding.class.isAssignableFrom(propertyType))
                editor = new 
org.netbeans.modules.visualweb.propertyeditors.MethodBindingPropertyEditor();
            // If no editor loaded still, attempt to load the editor 
registered statically
            // with the Java Beans editor manager
            if (editor == null) {
                editor = PropertyEditorManager.findEditor
(descriptor.getPropertyType());
                // An ultimate fallback editor is one that allows sibling bean 
selection
                if (editor == null)
                    editor = new BeanSelectionEditor(this);
            }
        }