You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by no...@apache.org on 2011/07/27 16:04:24 UTC

svn commit: r1151471 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java

Author: noelgrandin
Date: Wed Jul 27 14:04:23 2011
New Revision: 1151471

URL: http://svn.apache.org/viewvc?rev=1151471&view=rev
Log:
PIVOT-772 Exceptions thrown when calling getCharacterBounds of TextArea when incomplete lines exist
scrollToVisible() needs the hierarchy to be layed out so that the sizes of components are up to date.

Modified:
    pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java

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=1151471&r1=1151470&r2=1151471&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java Wed Jul 27 14:04:23 2011
@@ -1824,7 +1824,13 @@ public abstract class Component implemen
      * @param height
      */
     public void scrollAreaToVisible(int x, int y, int width, int height) {
-        Component component = this;
+        // The calculations need all the component sizes to be up to date, which means the
+        // entire hierarchy has to be layed out.
+        Display display = getDisplay();
+        if (display != null) {
+            display.validate();
+        }
+        Component component = getParent();
 
         while (component != null) {
             if (component instanceof Viewport) {



Re: svn commit: r1151471 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java

Posted by Sandro Martini <sa...@gmail.com>.
Hi, just tried (after the revert fron Noel) and all is ok now.

Bye

Re: svn commit: r1151471 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java

Posted by Sandro Martini <sa...@gmail.com>.
Hi Chris, 
I'll try to look at it (if possible this evening), but maybe Noel has better
knowledge on this (and of course even Greg).

Let's update.

Bye


--
View this message in context: http://apache-pivot-developers.417237.n3.nabble.com/Re-svn-commit-r1151471-pivot-trunk-wtk-src-org-apache-pivot-wtk-Component-java-tp3299743p3300649.html
Sent from the Apache Pivot - Developers mailing list archive at Nabble.com.

Re: svn commit: r1151471 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java

Posted by Chris Bartlett <cb...@gmail.com>.
r1152834 backed out most of r1151471, but not the line that seems to
be the cause of the problem.

On 1 September 2011 05:35, Chris Bartlett <cb...@gmail.com> wrote:
> This commit looks to have introduced a problem with scrolling.
>
> Specifically this change
>> -        Component component = this;
>> +        Component component = getParent();
>
> Run this...
> java org.apache.pivot.wtk.DesktopApplicationContext
> org.apache.pivot.wtk.ScriptApplication
> --src=/org/apache/pivot/tutorials/lists/list_views.bxml
>
> Use the keyboard to move to item 'Ten' and then try to move back to item 'One'
> The selected list item should remain visible when using the arrow keys
> to move up and down in the ListView.  It worked fine in v2.0, but in
> the current trunk version, the up key press doesn't scroll properly
> (the down key seems OK).
>
> The same tutorial is also at
> http://pivot.apache.org/tutorials/lists.html
>
> Unfortunately I stumbled on this today while I am struggling to get my
> dev workstation running properly again after upgrading Eclipse &
> various other software, so even tracking down this commit took a
> while.  I want to rule out anything weird  going on with my box, so
> would appreciate if anyone else can check and try to reproduce this
> with a recent build.
>
> Chris
>
> On 27 July 2011 21:04,  <no...@apache.org> wrote:
>> Author: noelgrandin
>> Date: Wed Jul 27 14:04:23 2011
>> New Revision: 1151471
>>
>> URL: http://svn.apache.org/viewvc?rev=1151471&view=rev
>> Log:
>> PIVOT-772 Exceptions thrown when calling getCharacterBounds of TextArea when incomplete lines exist
>> scrollToVisible() needs the hierarchy to be layed out so that the sizes of components are up to date.
>>
>> Modified:
>>    pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java
>>
>> 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=1151471&r1=1151470&r2=1151471&view=diff
>> ==============================================================================
>> --- pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java (original)
>> +++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java Wed Jul 27 14:04:23 2011
>> @@ -1824,7 +1824,13 @@ public abstract class Component implemen
>>      * @param height
>>      */
>>     public void scrollAreaToVisible(int x, int y, int width, int height) {
>> -        Component component = this;
>> +        // The calculations need all the component sizes to be up to date, which means the
>> +        // entire hierarchy has to be layed out.
>> +        Display display = getDisplay();
>> +        if (display != null) {
>> +            display.validate();
>> +        }
>> +        Component component = getParent();
>>
>>         while (component != null) {
>>             if (component instanceof Viewport) {
>>
>>
>>
>

Re: svn commit: r1151471 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java

Posted by Chris Bartlett <cb...@gmail.com>.
This commit looks to have introduced a problem with scrolling.

Specifically this change
> -        Component component = this;
> +        Component component = getParent();

Run this...
java org.apache.pivot.wtk.DesktopApplicationContext
org.apache.pivot.wtk.ScriptApplication
--src=/org/apache/pivot/tutorials/lists/list_views.bxml

Use the keyboard to move to item 'Ten' and then try to move back to item 'One'
The selected list item should remain visible when using the arrow keys
to move up and down in the ListView.  It worked fine in v2.0, but in
the current trunk version, the up key press doesn't scroll properly
(the down key seems OK).

The same tutorial is also at
http://pivot.apache.org/tutorials/lists.html

Unfortunately I stumbled on this today while I am struggling to get my
dev workstation running properly again after upgrading Eclipse &
various other software, so even tracking down this commit took a
while.  I want to rule out anything weird  going on with my box, so
would appreciate if anyone else can check and try to reproduce this
with a recent build.

Chris

On 27 July 2011 21:04,  <no...@apache.org> wrote:
> Author: noelgrandin
> Date: Wed Jul 27 14:04:23 2011
> New Revision: 1151471
>
> URL: http://svn.apache.org/viewvc?rev=1151471&view=rev
> Log:
> PIVOT-772 Exceptions thrown when calling getCharacterBounds of TextArea when incomplete lines exist
> scrollToVisible() needs the hierarchy to be layed out so that the sizes of components are up to date.
>
> Modified:
>    pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java
>
> 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=1151471&r1=1151470&r2=1151471&view=diff
> ==============================================================================
> --- pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java (original)
> +++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java Wed Jul 27 14:04:23 2011
> @@ -1824,7 +1824,13 @@ public abstract class Component implemen
>      * @param height
>      */
>     public void scrollAreaToVisible(int x, int y, int width, int height) {
> -        Component component = this;
> +        // The calculations need all the component sizes to be up to date, which means the
> +        // entire hierarchy has to be layed out.
> +        Display display = getDisplay();
> +        if (display != null) {
> +            display.validate();
> +        }
> +        Component component = getParent();
>
>         while (component != null) {
>             if (component instanceof Viewport) {
>
>
>