pivot-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roger Whitcomb (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (PIVOT-1014) Specify skin default styles in JSON file so they can be easily changed
Date Thu, 07 Dec 2017 23:56:00 GMT

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

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

Found first place with inconsistencies, and moved them to the .json file (with comments):
Sending        wtk\src\org\apache\pivot\wtk\skin\TextAreaSkin.java
Sending        wtk-terra\src\org\apache\pivot\wtk\skin\terra\TerraTextAreaSkin.java
Sending        wtk-terra\src\org\apache\pivot\wtk\skin\terra\terra_theme_defaults.json
Transmitting file data ...done
Committing transaction...
Committed revision 1817443.

> 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 Whitcomb
>            Assignee: Roger 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
(v6.4.14#64029)

Mime
View raw message