You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by sm...@apache.org on 2012/05/16 16:27:09 UTC

svn commit: r1339185 - in /pivot/trunk: tests/src/org/apache/pivot/tests/expander_test.bxml tutorials/src/org/apache/pivot/tutorials/navigation.bxml wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraExpanderSkin.java

Author: smartini
Date: Wed May 16 14:27:08 2012
New Revision: 1339185

URL: http://svn.apache.org/viewvc?rev=1339185&view=rev
Log:
set the same color (like in accordions) in text and graphics of expanders titles, even when not enabled (similar to the change already made for rollups). Add a sample of this even in Kitchen Sink.

Modified:
    pivot/trunk/tests/src/org/apache/pivot/tests/expander_test.bxml
    pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation.bxml
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraExpanderSkin.java

Modified: pivot/trunk/tests/src/org/apache/pivot/tests/expander_test.bxml
URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/expander_test.bxml?rev=1339185&r1=1339184&r2=1339185&view=diff
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/expander_test.bxml (original)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/expander_test.bxml Wed May 16 14:27:08 2012
@@ -27,10 +27,19 @@ limitations under the License.
         </columns>
 
         <TablePane.Row height="1*">
-            <Expander title="Left Expander">
+            <Expander title="Left Top Expander">
                 <Label text="Left" styles="{verticalAlignment:'center', horizontalAlignment:'center', wrapText:true}" />
             </Expander>
-            <Expander title="Right Expander" collapsible="false">
+            <Expander title="Right Top Expander" collapsible="false">
+                <Label text="Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the 'License'); you may not use this file except in compliance with the License." styles="{verticalAlignment:'center', horizontalAlignment:'center', wrapText:true}" />
+            </Expander>
+        </TablePane.Row>
+
+        <TablePane.Row height="1*">
+            <Expander title="Left Bottom Expander, disabled" enabled="false">
+                <Label text="Left" styles="{verticalAlignment:'center', horizontalAlignment:'center', wrapText:true}" />
+            </Expander>
+            <Expander title="Right Bottom Expander, disabled" collapsible="false" enabled="false">
                 <Label text="Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the 'License'); you may not use this file except in compliance with the License." styles="{verticalAlignment:'center', horizontalAlignment:'center', wrapText:true}" />
             </Expander>
         </TablePane.Row>

Modified: pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation.bxml
URL: http://svn.apache.org/viewvc/pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation.bxml?rev=1339185&r1=1339184&r2=1339185&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation.bxml (original)
+++ pivot/trunk/tutorials/src/org/apache/pivot/tutorials/navigation.bxml Wed May 16 14:27:08 2012
@@ -156,10 +156,15 @@ limitations under the License.
                         styles="{horizontalAlignment:'center', verticalAlignment:'center', font:{italic:true}}"/>
                 </Expander>
 
-                <Expander title="Three">
+                <Expander title="Three" enabled="false">
                     <Label preferredWidth="100" preferredHeight="50" text="Trois"
                         styles="{horizontalAlignment:'center', verticalAlignment:'bottom', font:{italic:true}}"/>
                 </Expander>
+
+                <Expander title="Four">
+                    <Label preferredWidth="100" preferredHeight="50" text="Quatre"
+                        styles="{horizontalAlignment:'center', verticalAlignment:'bottom', font:{italic:true}}"/>
+                </Expander>
             </BoxPane>
         </BoxPane>
     </Border>
@@ -172,7 +177,9 @@ limitations under the License.
                   styles="{horizontalAlignment:'center', verticalAlignment:'top', font:{italic:true}}"/>
                 <Label Accordion.headerData="Two" text="Deux"
                   styles="{horizontalAlignment:'center', verticalAlignment:'center', font:{italic:true}}"/>
-                <Label Accordion.headerData="Three" text="Trois"
+                <Label Accordion.headerData="Three" text="Trois" enabled="false"
+                  styles="{horizontalAlignment:'center', verticalAlignment:'bottom', font:{italic:true}}"/>
+                <Label Accordion.headerData="Four" text="Quatre"
                   styles="{horizontalAlignment:'center', verticalAlignment:'bottom', font:{italic:true}}"/>
             </Accordion>
         </BoxPane>

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=1339185&r1=1339184&r2=1339185&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 Wed May 16 14:27:08 2012
@@ -149,8 +149,14 @@ public class TerraExpanderSkin extends E
     protected class CollapseImage extends ButtonImage {
         @Override
         public void paint(Graphics2D graphics) {
+            Expander expander = (Expander)TerraExpanderSkin.this.getComponent();
+
             graphics.setStroke(new BasicStroke(0));
-            graphics.setPaint(shadeButtonColor);
+            if (expander.isEnabled()) {
+                graphics.setPaint(shadeButtonColor);
+            } else {
+                graphics.setPaint(disabledShadeButtonColor);
+            }
             graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                 RenderingHints.VALUE_ANTIALIAS_ON);
 
@@ -164,8 +170,14 @@ public class TerraExpanderSkin extends E
     protected class ExpandImage extends ButtonImage {
         @Override
         public void paint(Graphics2D graphics) {
+            Expander expander = (Expander)TerraExpanderSkin.this.getComponent();
+
             graphics.setStroke(new BasicStroke(0));
-            graphics.setPaint(shadeButtonColor);
+            if (expander.isEnabled()) {
+                graphics.setPaint(shadeButtonColor);
+            } else {
+                graphics.setPaint(disabledShadeButtonColor);
+            }
             graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                 RenderingHints.VALUE_ANTIALIAS_ON);
 
@@ -189,6 +201,7 @@ public class TerraExpanderSkin extends E
     private Color titleBarBackgroundColor;
     private Color titleBarBorderColor;
     private Color shadeButtonColor;
+    private Color disabledShadeButtonColor;
     private Color borderColor;
     private Insets padding;
 
@@ -227,7 +240,8 @@ public class TerraExpanderSkin extends E
 
         titleBarBackgroundColor = theme.getColor(10);
         titleBarBorderColor = theme.getColor(7);
-        shadeButtonColor = theme.getColor(7);
+        shadeButtonColor = theme.getColor(12);
+        disabledShadeButtonColor = theme.getColor(7);
         borderColor = theme.getColor(7);
         padding = new Insets(4);
 
@@ -255,7 +269,7 @@ public class TerraExpanderSkin extends E
         titleRow.add(titleBoxPane);
         titleRow.add(buttonBoxPane);
 
-        titleLabel.getStyles().put("color", theme.getColor(12));
+        titleLabel.getStyles().put("color", shadeButtonColor);
 
         Font titleFont = theme.getFont().deriveFont(Font.BOLD);
         titleLabel.getStyles().put("font", titleFont);
@@ -453,6 +467,13 @@ public class TerraExpanderSkin extends E
 
         graphics.setPaint(borderColor);
         GraphicsUtilities.drawRect(graphics, 0, 0, width, height);
+
+        Expander expander = (Expander)TerraExpanderSkin.this.getComponent();
+        if (expander.isEnabled()) {
+            setTitleBarColor(shadeButtonColor);
+        } else {
+            setTitleBarColor(disabledShadeButtonColor);
+        }
     }
 
     public Font getTitleBarFont() {
@@ -547,6 +568,10 @@ public class TerraExpanderSkin extends E
         setShadeButtonColor(GraphicsUtilities.decodeColor(shadeButtonColor));
     }
 
+    public Color getDisabledShadeButtonColor() {
+        return disabledShadeButtonColor;
+    }
+
     public Color getBorderColor() {
         return borderColor;
     }