swingx
  1. swingx
  2. SWINGX-438

Addons support for derived components/addons

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Critical Critical
    • Resolution: Unresolved
    • Affects Version/s: 0.9.0
    • Fix Version/s: None
    • Component/s: Plaf
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      438

      Description

      Currently components are using a static block to register their own UI-delegate
      and UI-defaults e.g:

      static

      { LookAndFeelAddons.contribute(new JXDatePickerAddon()); }

      If the derived component wants to provide its own addon a similar static block
      can be added to the derived component. Unfortunaltely now we have two registered
      addons for only one component, because the static block of the base class will
      be executed too.

      Problems can arise during a LAF switch because every registered addon wants to
      install UI-defaults and then the UI-defaults from the derived addon will get
      overriden from the base addon.

      A simple proposal could be to use a protected member field which is used to hold
      the addon instance so it can be uncontributed from the derived component. E.g:

      Base Class:
      protected static AbstractComponentAddon addon;
      static

      { addon = new JXDatePickerAddon(); LookAndFeelAddons.contribute(addon); }

      Dervived Class:
      static

      { LookAndFeelAddons.uncontribute(addon); addon = new MyDatePickerAddon(); LookAndFeelAddons.contribute(addon); }

        Activity

        Hide
        kleopatra added a comment -

        AddOns are Fred's babies

        The suggestion looks reasonable to me. Just wondering if we could come up with a
        more polymorphic solution?

        Jeanette

        Show
        kleopatra added a comment - AddOns are Fred's babies The suggestion looks reasonable to me. Just wondering if we could come up with a more polymorphic solution? Jeanette
        Hide
        rah003 added a comment -

        Reprioritization.

        Show
        rah003 added a comment - Reprioritization.
        Hide
        Karl Schaefer added a comment -

        There is a problem if we uncontribute from a subclass and have other instances
        of the superclass hanging around.

        Show
        Karl Schaefer added a comment - There is a problem if we uncontribute from a subclass and have other instances of the superclass hanging around.
        Hide
        Karl Schaefer added a comment -

        Not sure how to solve this, but since we're not currently subclassing addons,
        we can postpone it.

        Show
        Karl Schaefer added a comment - Not sure how to solve this, but since we're not currently subclassing addons, we can postpone it.

          People

          • Assignee:
            Karl Schaefer
            Reporter:
            wzberger
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: