Uploaded image for project: 'Pivot'
  1. Pivot
  2. PIVOT-1014

Specify skin default styles in JSON file so they can be easily changed

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • 2.1
    • wtk-terra
    • None

    Description

      I have noticed some inconsistencies in the way default styles (things like colors, fonts, padding/margins, etc.) are set in the constructors of the Terra*Skin classes, such as:

      • Color values set directly from the theme vs. set through the setter methods.
      • Missing color setter methods using the theme color index.
      • Derived colors being set in two different places, potentially leading to inconsistencies because of the duplication.
      • Possible inconsistencies between controls in the theme colors used (such as for backgrounds, borders, etc.) – this has not been verified, because it will require a lot of research.
      • Since these defaults are all set in code, even though (for instance) the theme colors themselves are set in the "TerraTheme_default.json" file, changing the overall look-and-feel is difficult at present.

      So, for all these reasons I propose to use a new "terra_theme_defaults.json" file, which can be overridden by a new setting in the "TerraTheme*.json" file(s) which will set all the defaults for all the Terra*Skin classes similar to this (taken from TerraExpanderSkin):
      Previously:

             setBackgroundColor(theme.getColor(4));
      
             titleBarBackgroundColor = theme.getColor(10);
             titleBarBorderColor = theme.getColor(7);
             titleBarColor = theme.getColor(12);
             shadeButtonColor = theme.getColor(12);
             disabledShadeButtonColor = theme.getColor(7);
             borderColor = theme.getColor(7);
             padding = new Insets(4);
      

      New:

          TerraExpanderSkin : {
              backgroundColor : 4,
              titleBarBackgroundColor : 10,
              titleBarBorderColor : 7,
              titleBarColor : 12,
              shadeButtonColor : 12,
              disabledShadeButtonColor : 7,
              borderColor : 7,
              padding : 4
          },
      

      Note: this approach also fits well with the overall Pivot philosophy of doing things in a "declarative" fashion (via BXML / JSON files) rather than in code, where possible.

      I have prototyped this in a couple of classes and it seems to work well, AND it has revealed a number of the color properties that were missing the "setXXX(int index)" methods.

      Note: there is potential for slowdown during control construction since we're executing a LOT more code to set these defaults (including expensive reflection operations inside BeanAdapter), but I have not yet been able to measure the speed differential to see if it will be of concern.

      Attachments

        Activity

          People

            rwhitcomb Roger Lee Whitcomb
            rwhitcomb Roger Lee Whitcomb
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: