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/08/12 16:48:53 UTC

svn commit: r803542 - in /incubator/pivot/trunk/wtk: src/org/apache/pivot/wtk/Container.java src/org/apache/pivot/wtk/skin/ContainerSkin.java test/org/apache/pivot/wtk/test/FocusTest.java

Author: gbrown
Date: Wed Aug 12 14:48:53 2009
New Revision: 803542

URL: http://svn.apache.org/viewvc?rev=803542&view=rev
Log:
Additional minor focus-related cleanup.

Modified:
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Container.java
    incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ContainerSkin.java
    incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/FocusTest.java

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Container.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Container.java?rev=803542&r1=803541&r2=803542&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Container.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/Container.java Wed Aug 12 14:48:53 2009
@@ -32,17 +32,6 @@
 
 /**
  * Abstract base class for containers.
- * <p>
- * NOTES:
- * <ul>
- * <li>Child components that have special meaning to a container should be
- * installed via a dedicated method (for example,
- * {@link org.apache.pivot.wtk.Window#setContent(Component)}); additional components may
- * be added by the skin when installed. Other components may still be added but
- * may not be rendered properly by the installed skin.</li>
- * <li>Callers should not rely on component position within container to mean
- * anything other than paint order.</li>
- * </ul>
  *
  * @author gbrown
  */
@@ -456,7 +445,7 @@
 
                     // Ensure that we don't get into an infinite loop
                     if (component == first) {
-                        break;
+                        throw new RuntimeException("Infinite loop in focus traversal policy for " + this);
                     }
                 }
 

Modified: incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ContainerSkin.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ContainerSkin.java?rev=803542&r1=803541&r2=803542&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ContainerSkin.java (original)
+++ incubator/pivot/trunk/wtk/src/org/apache/pivot/wtk/skin/ContainerSkin.java Wed Aug 12 14:48:53 2009
@@ -83,8 +83,7 @@
                             if (index < n - 1) {
                                 nextComponent = container.get(index + 1);
                             } else {
-                                if (wrap
-                                    && container.containsFocus()) {
+                                if (wrap) {
                                     nextComponent = container.get(0);
                                 }
                             }
@@ -107,8 +106,7 @@
                             if (index > 0) {
                                 nextComponent = container.get(index - 1);
                             } else {
-                                if (wrap
-                                    && container.containsFocus()) {
+                                if (wrap) {
                                     nextComponent = container.get(n - 1);
                                 }
                             }

Modified: incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/FocusTest.java
URL: http://svn.apache.org/viewvc/incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/FocusTest.java?rev=803542&r1=803541&r2=803542&view=diff
==============================================================================
--- incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/FocusTest.java (original)
+++ incubator/pivot/trunk/wtk/test/org/apache/pivot/wtk/test/FocusTest.java Wed Aug 12 14:48:53 2009
@@ -19,7 +19,6 @@
 import org.apache.pivot.collections.Map;
 import org.apache.pivot.wtk.Application;
 import org.apache.pivot.wtk.BoxPane;
-import org.apache.pivot.wtk.Component;
 import org.apache.pivot.wtk.DesktopApplicationContext;
 import org.apache.pivot.wtk.Direction;
 import org.apache.pivot.wtk.Display;
@@ -43,11 +42,8 @@
         frame.setPreferredSize(320, 240);
         frame.open(display);
 
-        boolean focused = frame.requestFocus();
-        System.out.println("focused = " + focused);
-
-        Component component = frame.transferFocus(null, Direction.FORWARD);
-        System.out.println("component = " + component);
+        frame.requestFocus();
+        frame.transferFocus(null, Direction.FORWARD);
     }
 
     @Override