src/share/classes/javax/swing/SortingFocusTraversalPolicy.java

Print this page

        

*** 113,123 **** private int getComponentIndex(List<Component> cycle, Component aComponent) { int index; try { index = Collections.binarySearch(cycle, aComponent, comparator); } catch (ClassCastException e) { ! if (log.isLoggable(PlatformLogger.FINE)) { log.fine("### During the binary search for " + aComponent + " the exception occured: ", e); } return -1; } if (index < 0) { --- 113,123 ---- private int getComponentIndex(List<Component> cycle, Component aComponent) { int index; try { index = Collections.binarySearch(cycle, aComponent, comparator); } catch (ClassCastException e) { ! if (log.isLoggable(PlatformLogger.Level.FINE)) { log.fine("### During the binary search for " + aComponent + " the exception occured: ", e); } return -1; } if (index < 0) {
*** 191,201 **** if (cont.isFocusCycleRoot()) { if (getImplicitDownCycleTraversal()) { retComp = cont.getFocusTraversalPolicy().getDefaultComponent(cont); ! if (retComp != null && log.isLoggable(PlatformLogger.FINE)) { log.fine("### Transfered focus down-cycle to " + retComp + " in the focus cycle root " + cont); } } else { return null; --- 191,201 ---- if (cont.isFocusCycleRoot()) { if (getImplicitDownCycleTraversal()) { retComp = cont.getFocusTraversalPolicy().getDefaultComponent(cont); ! if (retComp != null && log.isLoggable(PlatformLogger.Level.FINE)) { log.fine("### Transfered focus down-cycle to " + retComp + " in the focus cycle root " + cont); } } else { return null;
*** 203,213 **** } else if (cont.isFocusTraversalPolicyProvider()) { retComp = (traversalDirection == FORWARD_TRAVERSAL ? cont.getFocusTraversalPolicy().getDefaultComponent(cont) : cont.getFocusTraversalPolicy().getLastComponent(cont)); ! if (retComp != null && log.isLoggable(PlatformLogger.FINE)) { log.fine("### Transfered focus to " + retComp + " in the FTP provider " + cont); } } } return retComp; --- 203,213 ---- } else if (cont.isFocusTraversalPolicyProvider()) { retComp = (traversalDirection == FORWARD_TRAVERSAL ? cont.getFocusTraversalPolicy().getDefaultComponent(cont) : cont.getFocusTraversalPolicy().getLastComponent(cont)); ! if (retComp != null && log.isLoggable(PlatformLogger.Level.FINE)) { log.fine("### Transfered focus to " + retComp + " in the FTP provider " + cont); } } } return retComp;
*** 234,244 **** * @throws IllegalArgumentException if aContainer is not a focus cycle * root of aComponent or a focus traversal policy provider, or if either aContainer or * aComponent is null */ public Component getComponentAfter(Container aContainer, Component aComponent) { ! if (log.isLoggable(PlatformLogger.FINE)) { log.fine("### Searching in " + aContainer + " for component after " + aComponent); } if (aContainer == null || aComponent == null) { throw new IllegalArgumentException("aContainer and aComponent cannot be null"); --- 234,244 ---- * @throws IllegalArgumentException if aContainer is not a focus cycle * root of aComponent or a focus traversal policy provider, or if either aContainer or * aComponent is null */ public Component getComponentAfter(Container aContainer, Component aComponent) { ! if (log.isLoggable(PlatformLogger.Level.FINE)) { log.fine("### Searching in " + aContainer + " for component after " + aComponent); } if (aContainer == null || aComponent == null) { throw new IllegalArgumentException("aContainer and aComponent cannot be null");
*** 258,268 **** } // See if the component is inside of policy provider. Container provider = getTopmostProvider(aContainer, aComponent); if (provider != null) { ! if (log.isLoggable(PlatformLogger.FINE)) { log.fine("### Asking FTP " + provider + " for component after " + aComponent); } // FTP knows how to find component after the given. We don't. FocusTraversalPolicy policy = provider.getFocusTraversalPolicy(); --- 258,268 ---- } // See if the component is inside of policy provider. Container provider = getTopmostProvider(aContainer, aComponent); if (provider != null) { ! if (log.isLoggable(PlatformLogger.Level.FINE)) { log.fine("### Asking FTP " + provider + " for component after " + aComponent); } // FTP knows how to find component after the given. We don't. FocusTraversalPolicy policy = provider.getFocusTraversalPolicy();
*** 269,296 **** Component afterComp = policy.getComponentAfter(provider, aComponent); // Null result means that we overstepped the limit of the FTP's cycle. // In that case we must quit the cycle, otherwise return the component found. if (afterComp != null) { ! if (log.isLoggable(PlatformLogger.FINE)) { log.fine("### FTP returned " + afterComp); } return afterComp; } aComponent = provider; } List<Component> cycle = getFocusTraversalCycle(aContainer); ! if (log.isLoggable(PlatformLogger.FINE)) { log.fine("### Cycle is " + cycle + ", component is " + aComponent); } int index = getComponentIndex(cycle, aComponent); if (index < 0) { ! if (log.isLoggable(PlatformLogger.FINE)) { log.fine("### Didn't find component " + aComponent + " in a cycle " + aContainer); } return getFirstComponent(aContainer); } --- 269,296 ---- Component afterComp = policy.getComponentAfter(provider, aComponent); // Null result means that we overstepped the limit of the FTP's cycle. // In that case we must quit the cycle, otherwise return the component found. if (afterComp != null) { ! if (log.isLoggable(PlatformLogger.Level.FINE)) { log.fine("### FTP returned " + afterComp); } return afterComp; } aComponent = provider; } List<Component> cycle = getFocusTraversalCycle(aContainer); ! if (log.isLoggable(PlatformLogger.Level.FINE)) { log.fine("### Cycle is " + cycle + ", component is " + aComponent); } int index = getComponentIndex(cycle, aComponent); if (index < 0) { ! if (log.isLoggable(PlatformLogger.Level.FINE)) { log.fine("### Didn't find component " + aComponent + " in a cycle " + aContainer); } return getFirstComponent(aContainer); }
*** 351,361 **** } // See if the component is inside of policy provider. Container provider = getTopmostProvider(aContainer, aComponent); if (provider != null) { ! if (log.isLoggable(PlatformLogger.FINE)) { log.fine("### Asking FTP " + provider + " for component after " + aComponent); } // FTP knows how to find component after the given. We don't. FocusTraversalPolicy policy = provider.getFocusTraversalPolicy(); --- 351,361 ---- } // See if the component is inside of policy provider. Container provider = getTopmostProvider(aContainer, aComponent); if (provider != null) { ! if (log.isLoggable(PlatformLogger.Level.FINE)) { log.fine("### Asking FTP " + provider + " for component after " + aComponent); } // FTP knows how to find component after the given. We don't. FocusTraversalPolicy policy = provider.getFocusTraversalPolicy();
*** 362,372 **** Component beforeComp = policy.getComponentBefore(provider, aComponent); // Null result means that we overstepped the limit of the FTP's cycle. // In that case we must quit the cycle, otherwise return the component found. if (beforeComp != null) { ! if (log.isLoggable(PlatformLogger.FINE)) { log.fine("### FTP returned " + beforeComp); } return beforeComp; } aComponent = provider; --- 362,372 ---- Component beforeComp = policy.getComponentBefore(provider, aComponent); // Null result means that we overstepped the limit of the FTP's cycle. // In that case we must quit the cycle, otherwise return the component found. if (beforeComp != null) { ! if (log.isLoggable(PlatformLogger.Level.FINE)) { log.fine("### FTP returned " + beforeComp); } return beforeComp; } aComponent = provider;
*** 377,394 **** } } List<Component> cycle = getFocusTraversalCycle(aContainer); ! if (log.isLoggable(PlatformLogger.FINE)) { log.fine("### Cycle is " + cycle + ", component is " + aComponent); } int index = getComponentIndex(cycle, aComponent); if (index < 0) { ! if (log.isLoggable(PlatformLogger.FINE)) { log.fine("### Didn't find component " + aComponent + " in a cycle " + aContainer); } return getLastComponent(aContainer); } --- 377,394 ---- } } List<Component> cycle = getFocusTraversalCycle(aContainer); ! if (log.isLoggable(PlatformLogger.Level.FINE)) { log.fine("### Cycle is " + cycle + ", component is " + aComponent); } int index = getComponentIndex(cycle, aComponent); if (index < 0) { ! if (log.isLoggable(PlatformLogger.Level.FINE)) { log.fine("### Didn't find component " + aComponent + " in a cycle " + aContainer); } return getLastComponent(aContainer); }
*** 430,440 **** * @throws IllegalArgumentException if aContainer is null */ public Component getFirstComponent(Container aContainer) { List<Component> cycle; ! if (log.isLoggable(PlatformLogger.FINE)) { log.fine("### Getting first component in " + aContainer); } if (aContainer == null) { throw new IllegalArgumentException("aContainer cannot be null"); } --- 430,440 ---- * @throws IllegalArgumentException if aContainer is null */ public Component getFirstComponent(Container aContainer) { List<Component> cycle; ! if (log.isLoggable(PlatformLogger.Level.FINE)) { log.fine("### Getting first component in " + aContainer); } if (aContainer == null) { throw new IllegalArgumentException("aContainer cannot be null"); }
*** 444,459 **** } else { cycle = getFocusTraversalCycle(aContainer); } if (cycle.size() == 0) { ! if (log.isLoggable(PlatformLogger.FINE)) { log.fine("### Cycle is empty"); } return null; } ! if (log.isLoggable(PlatformLogger.FINE)) { log.fine("### Cycle is " + cycle); } for (Component comp : cycle) { if (accept(comp)) { --- 444,459 ---- } else { cycle = getFocusTraversalCycle(aContainer); } if (cycle.size() == 0) { ! if (log.isLoggable(PlatformLogger.Level.FINE)) { log.fine("### Cycle is empty"); } return null; } ! if (log.isLoggable(PlatformLogger.Level.FINE)) { log.fine("### Cycle is " + cycle); } for (Component comp : cycle) { if (accept(comp)) {
*** 478,488 **** * or null if no suitable Component can be found * @throws IllegalArgumentException if aContainer is null */ public Component getLastComponent(Container aContainer) { List<Component> cycle; ! if (log.isLoggable(PlatformLogger.FINE)) { log.fine("### Getting last component in " + aContainer); } if (aContainer == null) { throw new IllegalArgumentException("aContainer cannot be null"); --- 478,488 ---- * or null if no suitable Component can be found * @throws IllegalArgumentException if aContainer is null */ public Component getLastComponent(Container aContainer) { List<Component> cycle; ! if (log.isLoggable(PlatformLogger.Level.FINE)) { log.fine("### Getting last component in " + aContainer); } if (aContainer == null) { throw new IllegalArgumentException("aContainer cannot be null");
*** 493,508 **** } else { cycle = getFocusTraversalCycle(aContainer); } if (cycle.size() == 0) { ! if (log.isLoggable(PlatformLogger.FINE)) { log.fine("### Cycle is empty"); } return null; } ! if (log.isLoggable(PlatformLogger.FINE)) { log.fine("### Cycle is " + cycle); } for (int i= cycle.size() - 1; i >= 0; i--) { Component comp = cycle.get(i); --- 493,508 ---- } else { cycle = getFocusTraversalCycle(aContainer); } if (cycle.size() == 0) { ! if (log.isLoggable(PlatformLogger.Level.FINE)) { log.fine("### Cycle is empty"); } return null; } ! if (log.isLoggable(PlatformLogger.Level.FINE)) { log.fine("### Cycle is " + cycle); } for (int i= cycle.size() - 1; i >= 0; i--) { Component comp = cycle.get(i);