You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pivot.apache.org by "Roger Lee Whitcomb (Jira)" <ji...@apache.org> on 2021/03/12 21:08:00 UTC

[jira] [Commented] (PIVOT-1014) Specify skin default styles in JSON file so they can be easily changed

    [ https://issues.apache.org/jira/browse/PIVOT-1014?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17300612#comment-17300612 ] 

Roger Lee Whitcomb commented on PIVOT-1014:
-------------------------------------------

Some of this and a bunch of other changes in the same files:

Sending        wtk/src/org/apache/pivot/wtk/skin/ComponentSkin.java
Sending        wtk/src/org/apache/pivot/wtk/skin/ContainerSkin.java
Sending        wtk/src/org/apache/pivot/wtk/skin/ScrollPaneSkin.java
Sending        wtk/src/org/apache/pivot/wtk/skin/SeparatorSkin.java
Sending        wtk/src/org/apache/pivot/wtk/skin/SliderSkin.java
Sending        wtk/src/org/apache/pivot/wtk/skin/TextAreaSkin.java
Sending        wtk/src/org/apache/pivot/wtk/skin/TextPaneSkin.java
Sending        wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinNodeView.java
Sending        wtk/src/org/apache/pivot/wtk/skin/TextPaneSkinParagraphView.java
Sending        wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraExpanderSkin.java
Sending        wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraRollupSkin.java
Sending        wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraScrollPaneSkin.java
Sending        wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSeparatorSkin.java
Sending        wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSliderSkin.java
Sending        wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSpinnerSkin.java
Sending        wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextAreaSkin.java
Sending        wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTextPaneSkin.java
Sending        wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTreeViewSkin.java
Sending        wtk-terra/src/org/apache/pivot/wtk/skin/terra/terra_theme_defaults.json
Transmitting file data ...................done
Committing transaction...
Committed revision 1887553.

> Specify skin default styles in JSON file so they can be easily changed
> ----------------------------------------------------------------------
>
>                 Key: PIVOT-1014
>                 URL: https://issues.apache.org/jira/browse/PIVOT-1014
>             Project: Pivot
>          Issue Type: Improvement
>          Components: wtk-terra
>            Reporter: Roger Lee Whitcomb
>            Assignee: Roger Lee Whitcomb
>            Priority: Minor
>             Fix For: 2.1
>
>
> 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:
> {code:java}
>        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);
> {code}
> New:
> {code:java}
>     TerraExpanderSkin : {
>         backgroundColor : 4,
>         titleBarBackgroundColor : 10,
>         titleBarBorderColor : 7,
>         titleBarColor : 12,
>         shadeButtonColor : 12,
>         disabledShadeButtonColor : 7,
>         borderColor : 7,
>         padding : 4
>     },
> {code}
> 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.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)