You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pivot.apache.org by Greg Brown <gk...@mac.com> on 2009/04/03 21:24:53 UTC

Theme provider change

Hi all,

I just submitted a change that locates and loads themes dynamically using the provider system we just built for charts. The code that loads a service provider has been refactored into a new pivot.util.Service class. This class has a single method, getProvider(), that locates and loads a provider class for a given service name. Both charts and themes now use this.

As a result, themes can now be swapped in and out with no configuration changes. However, since themes are now loaded dynamically, the default constructor, and therefore the default color scheme, is used. To change the color scheme, you can now do this:

    TerraTheme terraTheme = (TerraTheme)Theme.getTheme();
    URL schemeLocation = TerraTheme.class.getResource("TerraTheme_default.json");
    terraTheme.loadScheme(schemeLocation);

Be sure to do this before instantiating any components, though, or you'll get the wrong colors.

This change should make themes a little bit easier to use. Please let me know if you have any questions or comments.

Greg