You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2009/07/07 21:22:04 UTC

svn commit: r791944 - in /incubator/pivot/trunk/wtk: src/org/apache/pivot/wtk/skin/FlowPaneSkin.java src/org/apache/pivot/wtk/skin/terra/alert_skin.wtkx src/org/apache/pivot/wtk/skin/terra/prompt_skin.wtkx test/org/apache/pivot/wtk/test/SheetTest.java

Author: gbrown
Date: Tue Jul  7 19:22:03 2009
New Revision: 791944

URL: http://svn.apache.org/viewvc?rev=791944&view=rev
Log:
Fix issue PIVOT-165.

Modified:
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/FlowPaneSkin.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/alert_skin.wtkx
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/prompt_skin.wtkx
    incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/SheetTest.java

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/FlowPaneSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/FlowPaneSkin.java?rev=791944&r1=791943&r2=791944&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/FlowPaneSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/FlowPaneSkin.java Tue Jul  7 19:22:03 2009
@@ -26,7 +26,6 @@
 import org.apache.pivot.wtk.Orientation;
 import org.apache.pivot.wtk.VerticalAlignment;
 
-
 /**
  * Flow pane skin.
  * <p>
@@ -310,7 +309,8 @@
 
         Orientation orientation = flowPane.getOrientation();
         if (orientation == Orientation.HORIZONTAL) {
-            int preferredWidth = getPreferredWidth(-1);
+            int preferredWidth = (verticalAlignment == VerticalAlignment.JUSTIFY) ?
+                getPreferredWidth(height) : getPreferredWidth(-1);
 
             // Determine the fixed width (used in scaling components
             // when justified horizontally)
@@ -424,7 +424,8 @@
                 }
             }
         } else {
-            int preferredHeight = getPreferredHeight(-1);
+            int preferredHeight = (horizontalAlignment == HorizontalAlignment.JUSTIFY) ?
+                getPreferredHeight(width) : getPreferredHeight(-1);
 
             // Determine the fixed height (used in scaling components
             // when justified vertically)

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/alert_skin.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/alert_skin.wtkx?rev=791944&r1=791943&r2=791944&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/alert_skin.wtkx (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/alert_skin.wtkx Tue Jul  7 19:22:03 2009
@@ -17,13 +17,13 @@
 -->
 
 <FlowPane orientation="vertical" styles="{spacing:8, horizontalAlignment:'justify'}"
-    preferredWidth="300"
     xmlns:wtkx="http://pivot.apache.org/wtkx"
     xmlns:collections="org.apache.pivot.collections"
     xmlns="org.apache.pivot.wtk">
     <Border styles="{padding:12, backgroundColor:10, color:7}">
         <content>
-            <TablePane styles="{horizontalSpacing:12, verticalSpacing:12}">
+            <TablePane preferredWidth="280"
+                styles="{horizontalSpacing:12, verticalSpacing:12}">
                 <columns>
                     <TablePane.Column width="-1"/>
                     <TablePane.Column width="1*"/>

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/prompt_skin.wtkx
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/prompt_skin.wtkx?rev=791944&r1=791943&r2=791944&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/prompt_skin.wtkx (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/terra/prompt_skin.wtkx Tue Jul  7 19:22:03 2009
@@ -18,13 +18,13 @@
 
 <FlowPane orientation="vertical" styles="{spacing:8, horizontalAlignment:'justify',
     verticalAlignment:'bottom'}"
-    preferredWidth="300"
     xmlns:wtkx="http://pivot.apache.org/wtkx"
     xmlns:collections="org.apache.pivot.collections"
     xmlns="org.apache.pivot.wtk">
     <Border styles="{padding:12, backgroundColor:4, color:7}">
         <content>
-            <TablePane styles="{horizontalSpacing:12, verticalSpacing:12}">
+            <TablePane preferredWidth="280"
+                styles="{horizontalSpacing:12, verticalSpacing:12}">
                 <columns>
                     <TablePane.Column width="-1"/>
                     <TablePane.Column width="1*"/>

Modified: incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/SheetTest.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/SheetTest.java?rev=791944&r1=791943&r2=791944&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/SheetTest.java (original)
+++ incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/SheetTest.java Tue Jul  7 19:22:03 2009
@@ -16,8 +16,10 @@
  */
 package org.apache.pivot.wtk.test;
 
+import org.apache.pivot.collections.ArrayList;
 import org.apache.pivot.collections.Map;
 import org.apache.pivot.util.Vote;
+import org.apache.pivot.wtk.Alert;
 import org.apache.pivot.wtk.Application;
 import org.apache.pivot.wtk.Button;
 import org.apache.pivot.wtk.ButtonPressListener;
@@ -27,6 +29,8 @@
 import org.apache.pivot.wtk.Frame;
 import org.apache.pivot.wtk.HorizontalAlignment;
 import org.apache.pivot.wtk.Label;
+import org.apache.pivot.wtk.MessageType;
+import org.apache.pivot.wtk.Prompt;
 import org.apache.pivot.wtk.PushButton;
 import org.apache.pivot.wtk.Sheet;
 import org.apache.pivot.wtk.TablePane;
@@ -54,12 +58,25 @@
         tablePane.getRows().add(new TablePane.Row(1, true));
         tablePane.getRows().add(new TablePane.Row(-1));
 
-        Label sheetContent = new Label("Sheet Content");
+        final Label sheetContent = new Label("Sheet Content");
+        sheetContent.getStyles().put("wrapText", true);
         sheetContent.getStyles().put("horizontalAlignment", HorizontalAlignment.CENTER);
         sheetContent.getStyles().put("verticalAlignment", VerticalAlignment.CENTER);
 
         tablePane.getRows().get(0).add(sheetContent);
 
+        Label promptBody = new Label("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.");
+        promptBody.getStyles().put("wrapText", true);
+
+        final Prompt prompt = new Prompt(MessageType.INFO, "Prompt", new ArrayList<String>("OK"), promptBody);
+        prompt.setTitle("Prompt");
+
+        Label alertBody = new Label("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.");
+        alertBody.getStyles().put("wrapText", true);
+
+        final Alert alert = new Alert(MessageType.INFO, "Alert", new ArrayList<String>("OK"), alertBody);
+        alert.setTitle("Alert");
+
         FlowPane flowPane = new FlowPane();
         tablePane.getRows().get(1).add(flowPane);
 
@@ -79,7 +96,9 @@
 
         windowContent.getButtonPressListeners().add(new ButtonPressListener() {
             public void buttonPressed(Button button) {
-                sheet.open(frame);
+                // sheet.open(frame);
+                prompt.open(frame);
+                // alert.open(frame);
             }
         });