swingx
  1. swingx
  2. SWINGX-91

LookAndFeelAddon: support to auto-load framework resourcebundle

    Details

    • Type: Improvement Improvement
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 0.9.0
    • Fix Version/s: 0.9.1
    • Component/s: Plaf
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      91

      Description

      not sure if this is solvable - but here's what I want:

      SwingX has a framework resourcebundle for supporting localizable property
      settings. This bundle is loaded in the static LookAndFeelAddon initialization
      block - which is called only if any component has contributed a addon.

      Currently, components interested in a resource have to register a empty addons
      simply to guarantee the bundle loading - at least that's how I implemented it,
      might have overlooked the obvious <g>

      Any ideas how to streamline this a bit?

      Jeanette

        Activity

        Hide
        Karl Schaefer added a comment -

        It does happen very early. Here's the scenario:
        1. Create component.
        2. Install addon from component's initializer.
        3. LookAndFeelAddons matches Addon package (subclass of LookAndFeelAddons).
        4. LookAndFeelAddons loads matched package; here we load the resource bundle.
        This allows us to load L&F-specific bundles. Note all L&F addons extends
        BasicLookAndFeelAddon, so its bundle is always loaded.
        5. The contributed ComponentAddons are loaded.
        6. The loaded data is added to the UIManager (UIDefaults).
        7. Go back to initializing the component, where it should seem like it was part
        of core the entire time. Yeah for us.

        Show
        Karl Schaefer added a comment - It does happen very early. Here's the scenario: 1. Create component. 2. Install addon from component's initializer. 3. LookAndFeelAddons matches Addon package (subclass of LookAndFeelAddons). 4. LookAndFeelAddons loads matched package; here we load the resource bundle. This allows us to load L&F-specific bundles. Note all L&F addons extends BasicLookAndFeelAddon, so its bundle is always loaded. 5. The contributed ComponentAddons are loaded. 6. The loaded data is added to the UIManager (UIDefaults). 7. Go back to initializing the component, where it should seem like it was part of core the entire time. Yeah for us.
        Hide
        kleopatra added a comment -

        Karl - thanks for the outline! That's pretty

        I probably misunderstood your previous comment, mixing the "not static" with the
        "other method". Just to make sure: I'm interested in the properties in the
        framework resourceBundle swingx.properties. This bundle ideally will contain
        properties for components or whatever other parts of SwingX which do not have an
        addon? Currently, those classes force the loading in a static block by just
        touching the LookAndFeelAddon

        [code]
        static

        { LookAndFeelAddons.getAddon(); }

        [/code]

        and the plan is to replace that with static another method (yet to created
        somewhere)

        [code]
        LookAndFeelAddons.guaranteeFrameworkResources();
        [/code]

        it's okay with me, just want to understand And personally, I probably
        wouldn't do it - being lazy <g>

        Cheers
        Jeanette

        Show
        kleopatra added a comment - Karl - thanks for the outline! That's pretty I probably misunderstood your previous comment, mixing the "not static" with the "other method". Just to make sure: I'm interested in the properties in the framework resourceBundle swingx.properties. This bundle ideally will contain properties for components or whatever other parts of SwingX which do not have an addon? Currently, those classes force the loading in a static block by just touching the LookAndFeelAddon [code] static { LookAndFeelAddons.getAddon(); } [/code] and the plan is to replace that with static another method (yet to created somewhere) [code] LookAndFeelAddons.guaranteeFrameworkResources(); [/code] it's okay with me, just want to understand And personally, I probably wouldn't do it - being lazy <g> Cheers Jeanette
        Hide
        Karl Schaefer added a comment -

        That's what I'm saying the property framework bundle is loaded in step 4. This
        framework bundle is loaded by anything that causes the LookAndFeelAddons
        subclass to be loaded, which getAddon does.

        There is no need to do anything for classes that don't have addons as they are
        making the call to getAddon to initialize the bundle. It just looks wrong.
        initializeResources or something that has a void return just "looks" better.
        We can close this since getAddon solves the problem; it's just ugly that's all.

        Show
        Karl Schaefer added a comment - That's what I'm saying the property framework bundle is loaded in step 4. This framework bundle is loaded by anything that causes the LookAndFeelAddons subclass to be loaded, which getAddon does. There is no need to do anything for classes that don't have addons as they are making the call to getAddon to initialize the bundle. It just looks wrong. initializeResources or something that has a void return just "looks" better. We can close this since getAddon solves the problem; it's just ugly that's all.
        Hide
        kleopatra added a comment -

        we stand above ugliness <g>

        Jeanette

        Show
        kleopatra added a comment - we stand above ugliness <g> Jeanette
        Hide
        Karl Schaefer added a comment -

        Per our agreement to stand above ugliness, this is closed.

        Show
        Karl Schaefer added a comment - Per our agreement to stand above ugliness, this is closed.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: