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 2010/02/01 20:55:18 UTC

svn commit: r905395 - in /pivot/trunk: tests/src/org/apache/pivot/tests/ web/src/org/apache/pivot/web/ wtk-terra/src/org/apache/pivot/wtk/skin/terra/ wtk/src/org/apache/pivot/wtk/

Author: gbrown
Date: Mon Feb  1 19:55:18 2010
New Revision: 905395

URL: http://svn.apache.org/viewvc?rev=905395&view=rev
Log:
Fix positioning bug in TerraSuggestionPopupSkin; add convenience methods to Component for mapping points to/from an ancestor; minor fix to QueryException.


Modified:
    pivot/trunk/tests/src/org/apache/pivot/tests/suggestion_popup_test.wtkx
    pivot/trunk/web/src/org/apache/pivot/web/QueryException.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSuggestionPopupSkin.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java

Modified: pivot/trunk/tests/src/org/apache/pivot/tests/suggestion_popup_test.wtkx
URL: http://svn.apache.org/viewvc/pivot/trunk/tests/src/org/apache/pivot/tests/suggestion_popup_test.wtkx?rev=905395&r1=905394&r2=905395&view=diff
==============================================================================
--- pivot/trunk/tests/src/org/apache/pivot/tests/suggestion_popup_test.wtkx (original)
+++ pivot/trunk/tests/src/org/apache/pivot/tests/suggestion_popup_test.wtkx Mon Feb  1 19:55:18 2010
@@ -16,7 +16,8 @@
 limitations under the License.
 -->
 
-<Window title="Suggestion Popup Test" maximized="true"
+<Window title="Suggestion Popup Test" preferredWidth="480" preferredHeight="360"
+    x="120" y="60"
     xmlns:wtkx="http://pivot.apache.org/wtkx"
     xmlns="org.apache.pivot.wtk">
     <content>

Modified: pivot/trunk/web/src/org/apache/pivot/web/QueryException.java
URL: http://svn.apache.org/viewvc/pivot/trunk/web/src/org/apache/pivot/web/QueryException.java?rev=905395&r1=905394&r2=905395&view=diff
==============================================================================
--- pivot/trunk/web/src/org/apache/pivot/web/QueryException.java (original)
+++ pivot/trunk/web/src/org/apache/pivot/web/QueryException.java Mon Feb  1 19:55:18 2010
@@ -32,13 +32,12 @@
 
     public QueryException(int status, String message) {
         super(message);
-
         this.status = status;
     }
 
     public QueryException(Throwable cause) {
         super(cause);
-        status = 0;
+        status = Query.Status.INTERNAL_SERVER_ERROR;
     }
 
     /**

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSuggestionPopupSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSuggestionPopupSkin.java?rev=905395&r1=905394&r2=905395&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSuggestionPopupSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraSuggestionPopupSkin.java Mon Feb  1 19:55:18 2010
@@ -34,6 +34,7 @@
 import org.apache.pivot.wtk.ListView;
 import org.apache.pivot.wtk.ListViewSelectionListener;
 import org.apache.pivot.wtk.Mouse;
+import org.apache.pivot.wtk.Point;
 import org.apache.pivot.wtk.Span;
 import org.apache.pivot.wtk.SuggestionPopup;
 import org.apache.pivot.wtk.SuggestionPopupListener;
@@ -234,9 +235,9 @@
         textInput.getComponentKeyListeners().add(textInputKeyListener);
 
         // Reposition under text input
-        int x = textInput.getX();
-        int y = textInput.getY() + textInput.getHeight();
-        suggestionPopup.setLocation(x, y - 1);
+        Point location = textInput.mapPointToAncestor(textInput.getDisplay(),
+            textInput.getLocation());
+        suggestionPopup.setLocation(location.x, location.y + textInput.getHeight() - 1);
         suggestionPopup.setPreferredWidth(textInput.getWidth());
     }
 

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java?rev=905395&r1=905394&r2=905395&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java Mon Feb  1 19:55:18 2010
@@ -1607,6 +1607,14 @@
         return coordinates;
     }
 
+    public Point mapPointToAncestor(Container ancestor, Point location) {
+        if (location == null) {
+            throw new IllegalArgumentException();
+        }
+
+        return mapPointToAncestor(ancestor, location.x, location.y);
+    }
+
     /**
      * Maps a point in the specified ancestor's coordinate space to this
      * component's coordinate system.
@@ -1645,6 +1653,14 @@
         return coordinates;
     }
 
+    public Point mapPointFromAncestor(Container ancestor, Point location) {
+        if (location == null) {
+            throw new IllegalArgumentException();
+        }
+
+        return mapPointFromAncestor(ancestor, location.x, location.y);
+    }
+
     /**
      * Determines if this component is showing. To be showing, the component
      * and all of its ancestors must be visible, and the component's window