Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4274639

Add createPropertyEditor method to PropertyDescriptor

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 1.2.2
    • Fix Version/s: 5.0
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      tiger
    • CPU:
      generic
    • OS:
      generic

      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)
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mdavidsosunw Mark Davidson (Inactive)
              Reporter:
              kryansunw Kevin Ryan (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: