diff options
Diffstat (limited to 'libjava/classpath/java/awt/ContainerOrderFocusTraversalPolicy.java')
-rw-r--r-- | libjava/classpath/java/awt/ContainerOrderFocusTraversalPolicy.java | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/libjava/classpath/java/awt/ContainerOrderFocusTraversalPolicy.java b/libjava/classpath/java/awt/ContainerOrderFocusTraversalPolicy.java index 14afd364..3fa437d 100644 --- a/libjava/classpath/java/awt/ContainerOrderFocusTraversalPolicy.java +++ b/libjava/classpath/java/awt/ContainerOrderFocusTraversalPolicy.java @@ -1,4 +1,4 @@ -/* ContainerOrderFocusTraversalPolicy.java -- +/* ContainerOrderFocusTraversalPolicy.java -- Copyright (C) 2002, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -108,21 +108,21 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy Container prevAncestor = ancestor; while (ancestor != root) { - ancestor = current.getFocusCycleRootAncestor (); - if (ancestor == prevAncestor) - { + ancestor = current.getFocusCycleRootAncestor (); + if (ancestor == prevAncestor) + { // We've reached the top focus cycle root ancestor. Check // if it is root. if (ancestor == null) ancestor = root; else if (ancestor != root) - throw new IllegalArgumentException ("the given container is not" - + " a focus cycle root of the" - + " current component"); + throw new IllegalArgumentException ("the given container is not" + + " a focus cycle root of the" + + " current component"); else break; - } - prevAncestor = ancestor; + } + prevAncestor = ancestor; } // FIXME: is this the right thing to do here? It moves the context @@ -151,7 +151,7 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy componentIndex = i; } - // Search forward for the next acceptable component. + // Search forward for the next acceptable component. // Search through all components at least one time // i.e. start at componentIndex + 1 --> nComponents -1 --> 0 ---> componentIndex int i = componentIndex + 1; @@ -159,24 +159,24 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy Component next = getNextAvailableComponent(components, i, end); if (next != null) return next; - + // Now check remainder of components from 0 to componentIndex i = 0; end = componentIndex; next = getNextAvailableComponent(components, i, end); if (next != null) - return next; - + return next; + // No focusable components after current in its Container. So go // to the next Component after current's Container (parent). Component result = getComponentAfter (root, parent); return result; } } - + /** * Gets the next available component in the array between the given range. - * + * * @param components - the array of components. * @param start - where to start * @param end - where to end @@ -207,7 +207,7 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy /** * Gets the previous available component in the array between the given range. - * + * * @param components - the array of components. * @param start - where to start * @param end - where to end @@ -215,7 +215,7 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy */ Component getPrevAvailableComponent(Component[] components, int start, int end) { - while (start >= end) + while (start >= end) { Component c = components[start]; if (c.visible && c.isDisplayable() && c.enabled && c.focusable) @@ -238,7 +238,7 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy * Returns the Component that should receive the focus before * <code>current</code>. <code>root</code> must be a focus cycle root of * current. - * + * * @param root a focus cycle root of current * @param current a (possibly indirect) child of root, or root itself * @return the previous Component in the focus traversal order for root, or @@ -260,21 +260,21 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy Container prevAncestor = ancestor; while (ancestor != root) { - ancestor = current.getFocusCycleRootAncestor (); - if (ancestor == prevAncestor) - { - // We've reached the top focus cycle root ancestor. Check - // if it is root. + ancestor = current.getFocusCycleRootAncestor (); + if (ancestor == prevAncestor) + { + // We've reached the top focus cycle root ancestor. Check + // if it is root. if (ancestor == null) ancestor = root; else if (ancestor != root) - throw new IllegalArgumentException ("the given container is not" - + " a focus cycle root of the" - + " current component"); - else - break; - } - prevAncestor = ancestor; + throw new IllegalArgumentException ("the given container is not" + + " a focus cycle root of the" + + " current component"); + else + break; + } + prevAncestor = ancestor; } // FIXME: is this the right thing to do here? It moves the context @@ -311,13 +311,13 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy Component prev = getPrevAvailableComponent(components, i, end); if (prev != null) return prev; - + // Now check remainder of components i = numComponents -1; end = componentIndex; prev = getPrevAvailableComponent(components, i, end); if (prev != null) - return prev; + return prev; // No focusable components before current in its Container. So go // to the previous Component before current's Container (parent). @@ -369,7 +369,7 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy return first; } else if (accept(component)) - return component; + return component; } return null; @@ -399,14 +399,14 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy return root; Component[] componentArray = root.getComponents (); - + for (int i = componentArray.length - 1; i >= 0; i--) { Component component = componentArray [i]; - - if (component.visible && component.isDisplayable() && component.enabled + + if (component.visible && component.isDisplayable() && component.enabled && component.focusable) - return component; + return component; if (component instanceof Container) { |