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/08/03 16:55:53 UTC

svn commit: r1369004 - in /pivot/branches/2.0.x: tests/src/org/apache/pivot/tests/issues/ wtk/src/org/apache/pivot/wtk/content/

Author: smartini
Date: Fri Aug  3 14:55:53 2012
New Revision: 1369004

URL: http://svn.apache.org/viewvc?rev=1369004&view=rev
Log:
PIVOT-721, first part of the fix and two test case

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

Added: 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=1369004&view=auto
==============================================================================
--- pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/issues/Pivot721.java (added)
+++ pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/issues/Pivot721.java Fri Aug  3 14:55:53 2012
@@ -0,0 +1,62 @@
+/*
+ * 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.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.pivot.tests.issues;
+
+import org.apache.pivot.beans.BXMLSerializer;
+import org.apache.pivot.collections.Map;
+import org.apache.pivot.wtk.Application;
+import org.apache.pivot.wtk.DesktopApplicationContext;
+import org.apache.pivot.wtk.Display;
+import org.apache.pivot.wtk.PushButton;
+import org.apache.pivot.wtk.Window;
+import org.apache.pivot.wtk.content.ButtonDataRenderer;
+
+public class Pivot721 extends Application.Adapter {
+
+    private Window window;
+
+    @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");
+
+        // force fill into button renderer, but only in some buttons ...
+        ButtonDataRenderer filledButtonDataRenderer = new ButtonDataRenderer();
+        filledButtonDataRenderer.setFillIcon(true);
+        PushButton button3 = (PushButton) bxmlSerializer.getNamespace().get("button3");
+        // ((ButtonDataRenderer)button3.getDataRenderer()).setFillIcon(true);  // ok, but note that all buttons share a common renderer instance
+        button3.setDataRenderer(filledButtonDataRenderer);  // set/use the customized renderer instance
+        PushButton button4 = (PushButton) bxmlSerializer.getNamespace().get("button4");
+        button4.setDataRenderer(filledButtonDataRenderer);  // set/use the customized renderer instance
+
+        window.open(display);
+    }
+
+    @Override
+    public boolean shutdown(boolean optional) {
+       if (window != null) {
+           window.close();
+       }
+
+       return false;
+    }
+
+    public static void main(String[] args) {
+        DesktopApplicationContext.main(Pivot721.class, args);
+    }
+
+}

Added: pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/issues/pivot_721.bxml
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/issues/pivot_721.bxml?rev=1369004&view=auto
==============================================================================
--- pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/issues/pivot_721.bxml (added)
+++ pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/issues/pivot_721.bxml Fri Aug  3 14:55:53 2012
@@ -0,0 +1,72 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+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.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+<Window title="PIVOT-721" maximized="true"
+    xmlns:bxml="http://pivot.apache.org/bxml"
+    xmlns:app="org.apache.pivot.tests.issues"
+    xmlns:content="org.apache.pivot.wtk.content"
+    xmlns="org.apache.pivot.wtk"
+>
+
+    <BoxPane orientation="vertical" styles="{fill:true, spacing:10, padding:{top:20}}" preferredWidth="400">
+
+        <Border title="Button Without Fill">
+            <BoxPane orientation="horizontal" styles="{spacing:40}">
+                <Border>
+                    <BoxPane>
+                        <Label text="button 50x50" />
+                        <PushButton bxml:id="button1" preferredWidth="50" preferredHeight="50">
+                            <content:ButtonData icon="@test1.jpg" />
+                        </PushButton>
+                    </BoxPane>
+                </Border>
+                <Border>
+                    <BoxPane>
+                        <Label text="button 200x200" />
+                        <PushButton bxml:id="button2" preferredWidth="200" preferredHeight="200">
+                            <content:ButtonData icon="@test1.jpg" />
+                        </PushButton>
+                    </BoxPane>
+                </Border>
+            </BoxPane>
+        </Border>
+
+        <Border title="Button With Fill set in Renderer">
+            <BoxPane orientation="horizontal" styles="{spacing:40}">
+                <Border>
+                    <BoxPane>
+                        <Label text="button 50x50" />
+                        <PushButton bxml:id="button3" preferredWidth="50" preferredHeight="50">
+                            <content:ButtonData icon="@test1.jpg" />
+                        </PushButton>
+                    </BoxPane>
+                </Border>
+                <Border>
+                    <BoxPane>
+                        <Label text="button 200x200" />
+                        <PushButton bxml:id="button4" preferredWidth="200" preferredHeight="200">
+                            <content:ButtonData icon="@test1.jpg" />
+                        </PushButton>
+                    </BoxPane>
+                </Border>
+            </BoxPane>
+        </Border>
+
+    </BoxPane>
+
+</Window>

Added: pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/issues/pivot_721_test2.bxml
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/issues/pivot_721_test2.bxml?rev=1369004&view=auto
==============================================================================
--- pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/issues/pivot_721_test2.bxml (added)
+++ pivot/branches/2.0.x/tests/src/org/apache/pivot/tests/issues/pivot_721_test2.bxml Fri Aug  3 14:55:53 2012
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+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.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+<Window title="PIVOT-721, test 2" maximized="true"
+    xmlns:bxml="http://pivot.apache.org/bxml"
+    xmlns:app="org.apache.pivot.tests.issues"
+    xmlns:content="org.apache.pivot.wtk.content"
+    xmlns="org.apache.pivot.wtk"
+>
+
+    <BoxPane styles="{fill:true, verticalAlignment:'center'}" preferredHeight="100">
+        <ImageView image="@test1.jpg" styles="{fill:true}" />
+        <Label text="Label" />
+    </BoxPane>
+
+</Window>

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=1369004&r1=1369003&r2=1369004&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 Aug  3 14:55:53 2012
@@ -38,6 +38,7 @@ public class ButtonDataRenderer extends 
     public ButtonDataRenderer() {
         getStyles().put("horizontalAlignment", HorizontalAlignment.CENTER);
         getStyles().put("verticalAlignment", VerticalAlignment.CENTER);
+        getStyles().put("fill", true);
 
         add(imageView);
         add(label);