Skip to content
Browse files

merge fixes from 2.0.x

git-svn-id: https://svn.apache.org/repos/asf/pivot/trunk@1369790 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent 4586a2e commit 35affd30e5e530c6b28e4cdb1eeb78945beca06a Sandro Martini committed
View
6 demos/src/org/apache/pivot/demos/dom/DOMInteractionDemo.java
@@ -85,6 +85,12 @@ public boolean shutdown(boolean optional) {
return false;
}
+ /**
+ * Set text of the message, then display it in a Popup.
+ * <p>
+ * Called by JavaScript from the Browser.
+ * @param helloText the text of the message
+ */
public void sayHello(String helloText) {
ApplicationContext.queueCallback(new CallFromBrowserCallback(helloText));
}
View
62 tests/src/org/apache/pivot/tests/issues/Pivot721.java
@@ -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);
+ }
+
+}
View
72 tests/src/org/apache/pivot/tests/issues/pivot_721.bxml
@@ -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>
View
86 tests/src/org/apache/pivot/tests/issues/pivot_721_test2.bxml
@@ -0,0 +1,86 @@
+<?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, Scale Up Test on Images" 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="height: 50">
+ <BoxPane styles="{fill:true, verticalAlignment:'center'}" preferredHeight="50">
+ <Label text="16x16" />
+ <ImageView image="@../clock.png" styles="{fill:true}" tooltipText="clock.png, 16x16" />
+ <Label text=" , " />
+ <Label text="32x32" />
+ <ImageView image="@../go-home.png" styles="{fill:true}" tooltipText="go-home, 32x32" />
+ <Label text=" , " />
+ <Label text="320x240" />
+ <ImageView image="@../IMG_0725_2.jpg" styles="{fill:true}" tooltipText="IMG_0725_2.jpg, 320x240" />
+ <Label text=" , " />
+ </BoxPane>
+ </Border>
+
+ <Border title="height: 100">
+ <BoxPane styles="{fill:true, verticalAlignment:'center'}" preferredHeight="100">
+ <Label text="16x16" />
+ <ImageView image="@../clock.png" styles="{fill:true}" tooltipText="clock.png, 16x16" />
+ <Label text=" , " />
+ <Label text="32x32" />
+ <ImageView image="@../go-home.png" styles="{fill:true}" tooltipText="go-home, 32x32" />
+ <Label text=" , " />
+ <Label text="320x240" />
+ <ImageView image="@../IMG_0725_2.jpg" styles="{fill:true}" tooltipText="IMG_0725_2.jpg, 320x240" />
+ <Label text=" , " />
+ </BoxPane>
+ </Border>
+
+ <Border title="height: 300">
+ <BoxPane styles="{fill:true, verticalAlignment:'center'}" preferredHeight="300">
+ <Label text="16x16" />
+ <ImageView image="@../clock.png" styles="{fill:true}" tooltipText="clock.png, 16x16" />
+ <Label text=" , " />
+ <Label text="32x32" />
+ <ImageView image="@../go-home.png" styles="{fill:true}" tooltipText="go-home, 32x32" />
+ <Label text=" , " />
+ <Label text="320x240" />
+ <ImageView image="@../IMG_0725_2.jpg" styles="{fill:true}" tooltipText="IMG_0725_2.jpg, 320x240" />
+ <Label text=" , " />
+ </BoxPane>
+ </Border>
+
+ <Border title="height: 400">
+ <BoxPane styles="{fill:true, verticalAlignment:'center'}" preferredHeight="400">
+ <Label text="16x16" />
+ <ImageView image="@../clock.png" styles="{fill:true}" tooltipText="clock.png, 16x16" />
+ <Label text=" , " />
+ <Label text="32x32" />
+ <ImageView image="@../go-home.png" styles="{fill:true}" tooltipText="go-home, 32x32" />
+ <Label text=" , " />
+ <Label text="320x240" />
+ <ImageView image="@../IMG_0725_2.jpg" styles="{fill:true}" tooltipText="IMG_0725_2.jpg, 320x240" />
+ <Label text=" , " />
+ </BoxPane>
+ </Border>
+
+ </BoxPane>
+
+</Window>
View
86 tests/src/org/apache/pivot/tests/issues/pivot_721_test2_with_workaround.bxml
@@ -0,0 +1,86 @@
+<?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, Scale Up Test on Images - With Workaround" 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="height: 50">
+ <BoxPane styles="{fill:true, verticalAlignment:'center'}" preferredHeight="50">
+ <Label text="16x16" />
+ <ImageView image="@../clock.png" styles="{fill:true}" tooltipText="clock.png, 16x16" preferredWidth="50" />
+ <Label text=" , " />
+ <Label text="32x32" />
+ <ImageView image="@../go-home.png" styles="{fill:true}" tooltipText="go-home, 32x32" preferredWidth="50" />
+ <Label text=" , " />
+ <Label text="320x240" />
+ <ImageView image="@../IMG_0725_2.jpg" styles="{fill:true}" tooltipText="IMG_0725_2.jpg, 320x240" preferredWidth="50" />
+ <Label text=" , " />
+ </BoxPane>
+ </Border>
+
+ <Border title="height: 100">
+ <BoxPane styles="{fill:true, verticalAlignment:'center'}" preferredHeight="100">
+ <Label text="16x16" />
+ <ImageView image="@../clock.png" styles="{fill:true}" tooltipText="clock.png, 16x16" preferredWidth="100" />
+ <Label text=" , " />
+ <Label text="32x32" />
+ <ImageView image="@../go-home.png" styles="{fill:true}" tooltipText="go-home, 32x32" preferredWidth="100" />
+ <Label text=" , " />
+ <Label text="320x240" />
+ <ImageView image="@../IMG_0725_2.jpg" styles="{fill:true}" tooltipText="IMG_0725_2.jpg, 320x240" preferredWidth="100" />
+ <Label text=" , " />
+ </BoxPane>
+ </Border>
+
+ <Border title="height: 300">
+ <BoxPane styles="{fill:true, verticalAlignment:'center'}" preferredHeight="300">
+ <Label text="16x16" />
+ <ImageView image="@../clock.png" styles="{fill:true}" tooltipText="clock.png, 16x16" preferredWidth="300" />
+ <Label text=" , " />
+ <Label text="32x32" />
+ <ImageView image="@../go-home.png" styles="{fill:true}" tooltipText="go-home, 32x32" preferredWidth="300" />
+ <Label text=" , " />
+ <Label text="320x240" />
+ <ImageView image="@../IMG_0725_2.jpg" styles="{fill:true}" tooltipText="IMG_0725_2.jpg, 320x240" preferredWidth="300" />
+ <Label text=" , " />
+ </BoxPane>
+ </Border>
+
+ <Border title="height: 400">
+ <BoxPane styles="{fill:true, verticalAlignment:'center'}" preferredHeight="400">
+ <Label text="16x16" />
+ <ImageView image="@../clock.png" styles="{fill:true}" tooltipText="clock.png, 16x16" preferredWidth="400" />
+ <Label text=" , " />
+ <Label text="32x32" />
+ <ImageView image="@../go-home.png" styles="{fill:true}" tooltipText="go-home, 32x32" preferredWidth="400" />
+ <Label text=" , " />
+ <Label text="320x240" />
+ <ImageView image="@../IMG_0725_2.jpg" styles="{fill:true}" tooltipText="IMG_0725_2.jpg, 320x240" preferredWidth="400" />
+ <Label text=" , " />
+ </BoxPane>
+ </Border>
+
+ </BoxPane>
+
+</Window>
View
1 wtk/src/org/apache/pivot/wtk/content/ButtonDataRenderer.java
@@ -38,6 +38,7 @@
public ButtonDataRenderer() {
getStyles().put("horizontalAlignment", HorizontalAlignment.CENTER);
getStyles().put("verticalAlignment", VerticalAlignment.CENTER);
+ getStyles().put("fill", true);
add(imageView);
add(label);
View
4 wtk/src/org/apache/pivot/wtk/skin/BoxPaneSkin.java
@@ -624,6 +624,10 @@ public boolean getFill() {
* regardless of the size of the BoxPane. Their alignment along the axis orthogonal
* to the pane's orientation is controlled by the corresponding alignment style
* (e.g., verticalAlignment in a BoxPane with orientation=horizontal).
+ * <p>
+ * Note that to Scale Up Images, other that fill=true it will be needed to set
+ * even the preferredWidth/preferredHeight as with container preferredHeight/preferredWidth
+ * just set, depending on the pane's orientation.
*/
public void setFill(boolean fill) {
this.fill = fill;

0 comments on commit 35affd3

Please sign in to comment.
Something went wrong with that request. Please try again.