You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by rw...@apache.org on 2012/09/28 17:06:20 UTC

svn commit: r1391496 - in /pivot/branches/2.0.x: tests/src/org/apache/pivot/tests/issues/Pivot721.java wtk/src/org/apache/pivot/wtk/content/ButtonDataRenderer.java

Author: rwhitcomb
Date: Fri Sep 28 15:06:20 2012
New Revision: 1391496

URL: http://svn.apache.org/viewvc?rev=1391496&view=rev
Log:
Pivot-721: setFillIcon on ButtonDataRenderer has no effect.

Changed previous fix to put the set of "fill:true" only in the "setFillIcon"
method (because setting it always messed up the default behavior in a lot of
cases).

And, completely fixed the issue by setting the image preferred size to the
button size in the "fillIcon" case, which allows the image to completely
fill the button.

Also, fixed a copy/paste bug in the Pivot721.java test case.

Modified:
    pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/issues/Pivot721.java
    pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/content/ButtonDataRenderer.java

Modified: pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/issues/Pivot721.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/issues/Pivot721.java?rev=1391496&r1=1391495&r2=1391496&view=diff
==============================================================================
--- pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/issues/Pivot721.java (original)
+++ pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/issues/Pivot721.java Fri Sep 28 15:06:20 2012
@@ -32,7 +32,7 @@ public class Pivot721 extends Applicatio
     @Override
     public void startup(Display display, Map<String, String> properties) throws Exception {
         BXMLSerializer bxmlSerializer = new BXMLSerializer();
-        window = (Window) bxmlSerializer.readObject(Pivot734.class, "pivot_721.bxml");
+        window = (Window) bxmlSerializer.readObject(Pivot721.class, "pivot_721.bxml");
 
         // force fill into button renderer, but only in some buttons ...
         ButtonDataRenderer filledButtonDataRenderer = new ButtonDataRenderer();

Modified: pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/content/ButtonDataRenderer.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/content/ButtonDataRenderer.java?rev=1391496&r1=1391495&r2=1391496&view=diff
==============================================================================
--- pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/content/ButtonDataRenderer.java (original)
+++ pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/content/ButtonDataRenderer.java Fri Sep 28 15:06:20 2012
@@ -38,7 +38,6 @@ public class ButtonDataRenderer extends 
     public ButtonDataRenderer() {
         getStyles().put("horizontalAlignment", HorizontalAlignment.CENTER);
         getStyles().put("verticalAlignment", VerticalAlignment.CENTER);
-        getStyles().put("fill", true);
 
         add(imageView);
         add(label);
@@ -81,6 +80,11 @@ public class ButtonDataRenderer extends 
             imageView.setImage(icon);
 
             imageView.getStyles().put("opacity", button.isEnabled() ? 1.0f : 0.5f);
+
+            if (getFillIcon()) {
+                imageView.setPreferredWidth(button.getWidth());
+                imageView.setPreferredHeight(button.getHeight());
+            }
         }
 
         // Update the label
@@ -135,6 +139,7 @@ public class ButtonDataRenderer extends 
 
     public void setFillIcon(boolean fillIcon) {
         imageView.getStyles().put("fill", fillIcon);
+        getStyles().put("fill", fillIcon);
     }
 
     @Override