Author: rwhitcomb Date: Tue Mar 18 23:01:33 2014 New Revision: 1579081 URL: http://svn.apache.org/r1579081 Log: PIVOT-925: Fix Expander's title bar color, which is only effective for the first time the control is expanded/contracted after being set.
I added a field to store the color and changed the method that sets the color during expansion/contraction to just set the label color from either the saved color or the inactive color depending on the state. This is a cross of revision 1536833 from branches/2.0.x to trunk. Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraExpanderSkin.java Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraExpanderSkin.java URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraExpanderSkin.java?rev=1579081&r1=1579080&r2=1579081&view=diff ============================================================================== --- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraExpanderSkin.java (original) +++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraExpanderSkin.java Tue Mar 18 23:01:33 2014 @@ -199,6 +199,7 @@ public class TerraExpanderSkin extends E private Color titleBarBackgroundColor; private Color titleBarBorderColor; + private Color titleBarColor; private Color shadeButtonColor; private Color disabledShadeButtonColor; private Color borderColor; @@ -239,6 +240,7 @@ public class TerraExpanderSkin extends E titleBarBackgroundColor = theme.getColor(10); titleBarBorderColor = theme.getColor(7); + titleBarColor = theme.getColor(12); shadeButtonColor = theme.getColor(12); disabledShadeButtonColor = theme.getColor(7); borderColor = theme.getColor(7); @@ -268,7 +270,7 @@ public class TerraExpanderSkin extends E titleRow.add(titleBoxPane); titleRow.add(buttonBoxPane); - titleLabel.getStyles().put("color", shadeButtonColor); + titleLabel.getStyles().put("color", titleBarColor); Font titleFont = theme.getFont().deriveFont(Font.BOLD); titleLabel.getStyles().put("font", titleFont); @@ -490,10 +492,11 @@ public class TerraExpanderSkin extends E } public Color getTitleBarColor() { - return (Color) titleLabel.getStyles().get("color"); + return this.titleBarColor; } public void setTitleBarColor(Color titleBarColor) { + this.titleBarColor = titleBarColor; titleLabel.getStyles().put("color", titleBarColor); } @@ -655,9 +658,9 @@ public class TerraExpanderSkin extends E @Override public void enabledChanged(Component component) { if (component.isEnabled()) { - setTitleBarColor(shadeButtonColor); + titleLabel.getStyles().put("color", titleBarColor); } else { - setTitleBarColor(disabledShadeButtonColor); + titleLabel.getStyles().put("color", disabledShadeButtonColor); } }