JDK-4274639 : Add createPropertyEditor method to PropertyDescriptor
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: java.beans
  • Affected Version: 1.2.2
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 1999-09-22
  • Updated: 2017-05-16
  • Resolved: 2003-08-15
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
5.0 tigerFixed
Related Reports
Relates :  
Relates :  
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
14-06-2004

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.
11-06-2004

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. ======================================================================
11-06-2004