enable registerResourceBundle to any skin
-----------------------------------------

                 Key: TRINIDAD-105
                 URL: https://issues.apache.org/jira/browse/TRINIDAD-105
             Project: MyFaces Trinidad
          Issue Type: Bug
          Components: Skinning
    Affects Versions: 1.2.1-core
            Reporter: Jeanne Waldman
            Assignee: Jeanne Waldman


We are developing 'custom' components on top of Trinidad, as are a lot of 
people. We want them to be able to run the custom components in the simple 
skin. However, when running these custom components we get severe errors, like 
this:

SEVERE: Could not get resource key af_statusIndicator.CONNECTING from skin 
 rich.desktop 

The reason is that we do not have the needed api on the Skin class to register 
resource bundles for custom component developers.  We recently added a 
registerStyleSheet api so that custom component developers can register their 
components' skin's stylesheet to any skin they want. We need a similar api to 
add resource bundles.

Once this new API/code is in place, when a renderer calls Skin's 
getTranslatedValue, the Skin code will have to look in each resource bundle 
that is registered until it finds the key/value. I plan to lazily cache the 
information so that we don't have to look in each resource bundle each time.

For SkinExtensions it would be nice to know what resource bundle is that the 
person that created the skin registered, so that it would have precedence over 
the custom components resource bundle.

I propose on the Skin API:
    /**
     * Registers an additional resource bundle on this Skin.  This is meant for 
skin-addition
     * use-cases, where a custom component developer has a resource bundle for 
their custom
     * components, and they want the bundle to work for this Skin and the 
children Skins.
     * The resource bundle specified by this resource bundle name
     * will be looked into for the translated value if it is not found in the 
Skin's
     * own resource bundle.
     * It is recommended that you register your resource bundles on the most 
base skin, so
     * that all children skins will pick it up.
     * @param resourceBundleName The name of the resource bundle
     * @throws NullPointerException if resource bundle name is null.
     */
    abstract public void registerResourceBundle(
      String resourceBundleName
      );

I propose we keep the following api on SkinExtension:


  /**
   * Returns the name of the bundle for the SkinExtension. It will return 
whatever was 
   * set in setBundleName
   * @see #setBundleName(String)
   */
  @Override
  public String getBundleName()
  {
    return _bundleName;
  }

  /**
   * Returns the name of the bundle for this SkinExtension. Use 
registerResourceBundle
   * to add skin-additions resource bundles. The SkinExtension bundle's 
resources will take precedence
   * over the skin-additions resource bundles.
   * @see Skin#registerResourceBundle(String)
   */
  public void setBundleName(String bundleName)
  {
    _bundleName = bundleName;
  }

The api to register resource bundles for custom component developers in 
trinidad-skins.xml's <skin-addition> could be 
<bundle-name>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to