United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-4274639 : Add createPropertyEditor method to PropertyDescriptor

Details
Type:
Enhancement
Submit Date:
1999-09-22
Status:
Resolved
Updated Date:
2003-08-15
Project Name:
JDK
Resolved Date:
2003-08-15
Component:
client-libs
OS:
generic
Sub-Component:
java.beans
CPU:
generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
1.2.2
Fixed Versions:
5.0 (tiger)

Related Reports
Relates:
Relates:

Sub Tasks

Description

Name: krT82822			Date: 09/22/99


Sometimes it's not possible to create a new PropertyEditor simply
by invoking newInstance() on its class. In my designs, the
editor for a given property should really have some link to the
bean that its modifying. For example:

1 - A URLEditor class should accept both absolute and relative
    urls. However, the context url depends on which bean is being
    modified. (For example, if the bean is also an applet then
    the context url might be the applet's documentBase property,
    which will be different for different applet's)

2 - An editor which presents the user with a list of the fields
    available from a database needs to know which database
    to get its list from.

I beleive the problem can be remedied by adding the following
method to the PropertyDescriptor class:

public PropertyEditor createPropertyEditor(Object bean) { ... }

The createPropertyEditor method is a factory method for creating
PropertyEditors which can edit the property on behalf of the
given JavaBean. The bean argument allows the PropertyEditor to
retrieve some of its state from the bean.

The default implementation will first check to see if the
getPropertyEditorClass method returns a non-null. If it does, then
newInstance() will be called on it to create a new PropertyEditor.
Otherwise, PropertyEditorManager.findEditor will be used to find
a PropertyEditor for the declared type of this property. If
that fails, then it returns null.
(Review ID: 95596) 
======================================================================

                                    

Comments
CONVERTED DATA

BugTraq+ Release Management Values

COMMIT TO FIX:
tiger

FIXED IN:
tiger

INTEGRATED IN:
tiger
tiger-b16


                                     
2004-06-14
EVALUATION

One of the release drivers for 1.5 is to improve PropertyEditors for JavaBeans. This is one of the RFEs which will be covered.

Some ideas:

The property descriptor could produce an instance of a PropertyEditor but there will not be a way to retrieve the source Bean of the property being edited. This should be closed as a duplicate of 4305280 because it falls under "expose the modified Bean". The PropertyDescriptor class should have a way of returning the new PropertyEditor that knows the source bean. This may be difficult since the PropertyDescriptor itself doesn't know what Bean it belongs to.

Need to think about this more for Tiger.
                                     
2004-06-11
WORK AROUND



Name: krT82822			Date: 09/22/99


Any work around would depend on the implementation of the bean
builder tool and would tie the bean to that particular environment.
======================================================================
                                     
2004-06-11



Hardware and Software, Engineered to Work Together