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 2013/03/18 17:39:15 UTC

svn commit: r1457849 - in /pivot/trunk: RELEASE-NOTES demos/src/org/apache/pivot/demos/styles/sample_content.bxml tests/src/org/apache/pivot/tests/issues/pivot_901.bxml wtk/src/org/apache/pivot/wtk/content/ButtonDataRenderer.java

Author: smartini
Date: Mon Mar 18 16:39:14 2013
New Revision: 1457849

URL: http://svn.apache.org/r1457849
Log:
merge fixes from 2.0.x

Added:
    pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot_901.bxml
Modified:
    pivot/trunk/RELEASE-NOTES
    pivot/trunk/demos/src/org/apache/pivot/demos/styles/sample_content.bxml
    pivot/trunk/wtk/src/org/apache/pivot/wtk/content/ButtonDataRenderer.java

Modified: pivot/trunk/RELEASE-NOTES
URL: http://svn.apache.org/viewvc/pivot/trunk/RELEASE-NOTES?rev=1457849&r1=1457848&r2=1457849&view=diff
==============================================================================
--- pivot/trunk/RELEASE-NOTES (original)
+++ pivot/trunk/RELEASE-NOTES Mon Mar 18 16:39:14 2013
@@ -56,6 +56,7 @@ Release Notes for Pivot 2.0.3:
     * [PIVOT-888] - Nullpointer Exception while editing TextArea with text property two-way bounded
     * [PIVOT-892] - DoubleValidator and FloatValidator do not allow exponents to be entered
     * [PIVOT-898] - fillIcon in buttons seems to let images display with wrong dimension
+    * [PIVOT-901] - List Buttons are rendered very thin when there is no list item selected or when item with empty string is selected
 
 ** Task
 

Modified: pivot/trunk/demos/src/org/apache/pivot/demos/styles/sample_content.bxml
URL: http://svn.apache.org/viewvc/pivot/trunk/demos/src/org/apache/pivot/demos/styles/sample_content.bxml?rev=1457849&r1=1457848&r2=1457849&view=diff
==============================================================================
--- pivot/trunk/demos/src/org/apache/pivot/demos/styles/sample_content.bxml (original)
+++ pivot/trunk/demos/src/org/apache/pivot/demos/styles/sample_content.bxml Mon Mar 18 16:39:14 2013
@@ -18,7 +18,9 @@ limitations under the License.
 
 <TabPane selectedIndex="0"
     xmlns:bxml="http://pivot.apache.org/bxml"
-    xmlns="org.apache.pivot.wtk">
+    xmlns="org.apache.pivot.wtk"
+    xmlns:content="org.apache.pivot.wtk.content"
+>
     <Border TabPane.tabData="Tab 1" TabPane.tooltipText="Sample Content Tab">
         <ScrollPane horizontalScrollBarPolicy="fill_to_capacity" styles="{backgroundColor:null}">
             <TablePane styles="{padding:8, horizontalSpacing:12}">
@@ -36,42 +38,66 @@ limitations under the License.
 
                         <TablePane.Row>
                             <FlowPane>
-                                <PushButton buttonData="Push Button"/>
+                                <PushButton buttonData="Push Button"
+                                    tooltipText="PushButton sample"
+                                />
                             </FlowPane>
 
                             <FlowPane>
-                                <PushButton buttonData="Push Button" enabled="false"/>
+                                <PushButton buttonData="Push Button" enabled="false"
+                                    tooltipText="PushButton sample"
+                                />
                             </FlowPane>
                         </TablePane.Row>
 
                         <TablePane.Row>
-                            <Checkbox buttonData="Checkbox" selected="true"/>
-                            <Checkbox buttonData="Checkbox" selected="true" enabled="false"/>
+                            <Checkbox buttonData="Checkbox" selected="true"
+                                tooltipText="Checkbox sample"
+                            />
+                            <Checkbox buttonData="Checkbox" selected="true" enabled="false"
+                                tooltipText="Checkbox sample"
+                            />
                         </TablePane.Row>
 
                         <TablePane.Row>
-                            <RadioButton buttonData="Radio Button" selected="true"/>
-                            <RadioButton buttonData="Radio Button" selected="true" enabled="false"/>
+                            <RadioButton buttonData="Radio Button" selected="true"
+                                tooltipText="RadioButton sample"
+                            />
+                            <RadioButton buttonData="Radio Button" selected="true" enabled="false"
+                                tooltipText="RadioButton sample"
+                            />
                         </TablePane.Row>
 
                         <TablePane.Row>
-                            <LinkButton buttonData="Link Button"/>
-                            <LinkButton buttonData="Link Button" enabled="false"/>
+                            <LinkButton buttonData="Link Button"
+                                tooltipText="LinkButton sample"
+                            />
+                            <LinkButton buttonData="Link Button" enabled="false"
+                                tooltipText="LinkButton sample"
+                            />
                         </TablePane.Row>
 
                         <TablePane.Row>
-                            <TextInput text="Text Input" textSize="10"/>
-                            <TextInput text="Text Input" textSize="10" enabled="false"/>
+                            <TextInput text="Text Input" textSize="10"
+                                tooltipText="TextInput sample"
+                            />
+                            <TextInput text="Text Input" textSize="10" enabled="false"
+                                tooltipText="TextInput sample"
+                            />
                         </TablePane.Row>
 
                         <TablePane.Row>
-                            <Separator TablePane.columnSpan="2" heading="Separator"/>
+                            <Separator TablePane.columnSpan="2" heading="Separator"
+                                tooltipText="Separator sample"
+                            />
                         </TablePane.Row>
 
                         <TablePane.Row>
                             <Border TablePane.columnSpan="2" styles="{color:10}">
                                 <ScrollPane horizontalScrollBarPolicy="fill" preferredHeight="80">
-                                    <TableView bxml:id="tableView" selectedIndex="0">
+                                    <TableView bxml:id="tableView" selectMode="multi"
+                                        tooltipText="TableView sample"
+                                    >
                                         <columns>
                                             <TableView.Column name="a" headerData="A" width="1*"/>
                                             <TableView.Column name="b" headerData="B" width="1*"/>
@@ -101,14 +127,52 @@ limitations under the License.
                         </TablePane.Row>
 
                         <TablePane.Row>
-                            <Accordion>
+                            <Border TablePane.columnSpan="2" styles="{color:10}">
+                                <ScrollPane horizontalScrollBarPolicy="fill" preferredHeight="80">
+                                    <TreeView bxml:id="treeView" selectMode="multi"
+                                        tooltipText="TreeView sample"
+                                    >
+                                        <treeData>
+                                            <content:TreeBranch>
+                                                <content:TreeBranch text="Activity">
+                                                    <content:TreeNode text="Camping" />
+                                                    <content:TreeNode text="Skiing" />
+                                                </content:TreeBranch>
+                                                <content:TreeBranch text="Occasion">
+                                                    <content:TreeBranch text="Holidays">
+                                                        <content:TreeNode text="Christmas" />
+                                                        <content:TreeNode text="Independence Day" />
+                                                        <content:TreeNode text="Labor Day" />
+                                                        <content:TreeNode text="New Year's Day" />
+                                                        <content:TreeNode text="President's Day" />
+                                                        <content:TreeNode text="Thanksgiving" />
+                                                        <content:TreeNode text="Valentine's Day" />
+                                                        <content:TreeNode text="Veteran's Day" />
+                                                    </content:TreeBranch>
+                                                    <content:TreeNode text="Anniversary" />
+                                                    <content:TreeNode text="Birthday" />
+                                                    <content:TreeNode text="Wedding" />
+                                                </content:TreeBranch>
+                                            </content:TreeBranch>
+                                        </treeData>
+                                    </TreeView>
+                                </ScrollPane>
+                            </Border>
+                        </TablePane.Row>
+
+                        <TablePane.Row>
+                            <Accordion
+                                tooltipText="Accordion sample"
+                            >
                                 <Label text="Un" Accordion.headerData="One"/>
                                 <Label text="Deux" Accordion.headerData="Two"/>
                                 <Label text="Trois" Accordion.headerData="Three" enabled="false"/>
                             </Accordion>
 
                             <BoxPane orientation="vertical" styles="{fill:true}">
-                                <Expander title="Expander">
+                                <Expander title="Expander"
+                                    tooltipText="Expander sample"
+                                >
                                     <Label text="Content"/>
                                 </Expander>
                             </BoxPane>
@@ -117,7 +181,9 @@ limitations under the License.
 
                     <BoxPane orientation="vertical" styles="{fill:true, spacing:8}">
                         <Border styles="{padding:4}">
-                            <Form styles="{verticalSpacing:8}">
+                            <Form styles="{verticalSpacing:8}"
+                                tooltipText="Form sample"
+                            >
                                 <Form.Section>
                                     <Label text="Form error">
                                         <Form.flag>
@@ -146,16 +212,70 @@ limitations under the License.
                         <BoxPane orientation="vertical">
                             <PushButton buttonData="Show Alert"
                                 ButtonPressListener.buttonPressed="org.apache.pivot.wtk.Alert.alert('This is an alert.',
-                                    arguments[0].window);"/>
+                                    arguments[0].window);"
+                                tooltipText="PushButton sample"
+                            />
                             <PushButton buttonData="Show Prompt"
                                 ButtonPressListener.buttonPressed="org.apache.pivot.wtk.Prompt.prompt('This is a prompt.',
-                                    arguments[0].window);"/>
+                                    arguments[0].window);"
+                                tooltipText="PushButton sample"
+                            />
                         </BoxPane>
 
                         <Border>
                             <TextArea preferredWidth="200"
-                                text="Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua."/>
+                                text="Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua."
+                                tooltipText="TextArea sample"
+                            />
                         </Border>
+
+                        <Label text=""/> <!-- Separator //-->
+
+                        <FlowPane>
+                            <ListButton bxml:id="listButton" buttonData="Number"
+                                listData="['', 'One', 'Two', 'Three']"
+                                tooltipText="ListButton sample"
+                            />
+                            <Label text=""/> <!-- Separator //-->
+                            <Border>
+                                <ListView bxml:id="listView" selectMode="multi"
+                                    listData="['', 'One', 'Two', 'Three']"
+                                    tooltipText="ListView sample"
+                                />
+                            </Border>
+                        </FlowPane>
+
+                        <Label text=""/> <!-- Separator //-->
+
+                        <FlowPane>
+                            <MenuButton buttonData="Menu Button"
+                                tooltipText="MenuButton sample"
+                            >
+                                <Menu>
+                                    <Menu.Section>
+                                        <Menu.Item buttonData="A" name="A">
+                                            <Menu>
+                                                <Menu.Section>
+                                                    <Menu.Item buttonData="A.1" name="A.1"/>
+                                                    <Menu.Item buttonData="A.2" name="A.2"/>
+                                                </Menu.Section>
+                                            </Menu>
+                                        </Menu.Item>
+                                        <Menu.Item buttonData="B" name="B">
+                                            <Menu>
+                                                <Menu.Section>
+                                                    <Menu.Item buttonData="B.1" name="B.1"/>
+                                                    <Menu.Item buttonData="B.2" name="B.2"/>
+                                                </Menu.Section>
+                                            </Menu>
+                                        </Menu.Item>
+                                    </Menu.Section>
+                                </Menu>
+                            </MenuButton>
+                            <Label text=""/> <!-- Separator //-->
+                        </FlowPane>
+
+                        <Label text=""/> <!-- Separator //-->
                     </BoxPane>
                 </TablePane.Row>
             </TablePane>

Added: pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot_901.bxml
URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot_901.bxml?rev=1457849&view=auto
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot_901.bxml (added)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/issues/pivot_901.bxml Mon Mar 18 16:39:14 2013
@@ -0,0 +1,71 @@
+<?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="List Views [PIVOT-901]" 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"
+>
+
+    <bxml:script>
+    <![CDATA[
+    importPackage(java.lang);  // required to use System.out and System.err
+    importPackage(org.apache.pivot.util);  // required to use Pivot Utility class Console
+    importPackage(org.apache.pivot.wtk);   // required to use Pivot WTK classes
+
+    System.out.println("BXML Scripts successfully initialized");
+    ]]>
+    </bxml:script>
+
+
+  <BoxPane orientation="vertical">
+
+    <Border>
+
+      <BoxPane orientation="vertical">
+          <!-- Test appearance when ListButton has an empty value as first element -->
+          <Label text="Select one element (listDataKey not set):"/>
+          <ListButton bxml:id="listButton" buttonData="Number"
+              listData="['', 'One', 'Two', 'Three']"
+          >
+              <listButtonSelectionListeners>
+                function selectedIndexChanged(listButton, previousSelectedIndex) {
+                    System.out.println("selectedIndexChanged: was " + previousSelectedIndex + ", now it's " + listButton.selectedIndex);
+                }
+              </listButtonSelectionListeners>
+          </ListButton>
+
+          <PushButton bxml:id="button" buttonData="Log Selected">
+              <buttonPressListeners>
+              function buttonPressed(button) {
+                  System.out.println("Select item at index " + listButton.getSelectedIndex() + " in the list, with:"
+                      + ", item = { " + listButton.getSelectedItem() + " }"
+                      + ", key " + listButton.getSelectedItemKey()
+                      + "."
+                  );
+              }
+              </buttonPressListeners>
+          </PushButton>
+      </BoxPane>
+
+    </Border>
+
+  </BoxPane>
+
+</Window>

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/content/ButtonDataRenderer.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/content/ButtonDataRenderer.java?rev=1457849&r1=1457848&r2=1457849&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/content/ButtonDataRenderer.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/content/ButtonDataRenderer.java Mon Mar 18 16:39:14 2013
@@ -98,7 +98,7 @@ public class ButtonDataRenderer extends 
         // Update the label
         label.setText(text != null ? text : "");
 
-        if (text == null || text.length() == 0) {
+        if (text == null || (text.length() == 0 && getFillIcon())) {
             label.setVisible(false);
         } else {
             label.setVisible(true);