Search in sources :

Example 1 with FocusTraversalPolicy

use of java.awt.FocusTraversalPolicy in project jdk8u_jdk by JetBrains.

the class CompareTabOrderComparator method getComponentAfter.

public Component getComponentAfter(Container aContainer, Component aComponent) {
    Container root = (aContainer.isFocusCycleRoot()) ? aContainer : aContainer.getFocusCycleRootAncestor();
    // traversal policy is non-legacy, then honor it.
    if (root != null) {
        FocusTraversalPolicy policy = root.getFocusTraversalPolicy();
        if (policy != gluePolicy) {
            return policy.getComponentAfter(root, aComponent);
        }
        comparator.setComponentOrientation(root.getComponentOrientation());
        return layoutPolicy.getComponentAfter(root, aComponent);
    }
    return null;
}
Also used : Container(java.awt.Container) FocusTraversalPolicy(java.awt.FocusTraversalPolicy)

Example 2 with FocusTraversalPolicy

use of java.awt.FocusTraversalPolicy in project jdk8u_jdk by JetBrains.

the class CompareTabOrderComparator method getFirstComponent.

public Component getFirstComponent(Container aContainer) {
    Container root = (aContainer.isFocusCycleRoot()) ? aContainer : aContainer.getFocusCycleRootAncestor();
    // traversal policy is non-legacy, then honor it.
    if (root != null) {
        FocusTraversalPolicy policy = root.getFocusTraversalPolicy();
        if (policy != gluePolicy) {
            return policy.getFirstComponent(root);
        }
        comparator.setComponentOrientation(root.getComponentOrientation());
        return layoutPolicy.getFirstComponent(root);
    }
    return null;
}
Also used : Container(java.awt.Container) FocusTraversalPolicy(java.awt.FocusTraversalPolicy)

Example 3 with FocusTraversalPolicy

use of java.awt.FocusTraversalPolicy in project jdk8u_jdk by JetBrains.

the class CompareTabOrderComparator method getLastComponent.

public Component getLastComponent(Container aContainer) {
    Container root = (aContainer.isFocusCycleRoot()) ? aContainer : aContainer.getFocusCycleRootAncestor();
    // traversal policy is non-legacy, then honor it.
    if (root != null) {
        FocusTraversalPolicy policy = root.getFocusTraversalPolicy();
        if (policy != gluePolicy) {
            return policy.getLastComponent(root);
        }
        comparator.setComponentOrientation(root.getComponentOrientation());
        return layoutPolicy.getLastComponent(root);
    }
    return null;
}
Also used : Container(java.awt.Container) FocusTraversalPolicy(java.awt.FocusTraversalPolicy)

Example 4 with FocusTraversalPolicy

use of java.awt.FocusTraversalPolicy in project jdk8u_jdk by JetBrains.

the class InitialFTP method test.

public static void test(Window win, Class<? extends FocusTraversalPolicy> expectedPolicy) {
    FocusTraversalPolicy ftp = win.getFocusTraversalPolicy();
    System.out.println("==============" + "\n" + "Tested window:    " + win + "\n" + "Expected policy:  " + expectedPolicy + "\n" + "Effective policy: " + ftp.getClass());
    if (!expectedPolicy.equals(ftp.getClass())) {
        throw new RuntimeException("Test failed: wrong effective focus policy");
    }
}
Also used : FocusTraversalPolicy(java.awt.FocusTraversalPolicy)

Example 5 with FocusTraversalPolicy

use of java.awt.FocusTraversalPolicy in project jdk8u_jdk by JetBrains.

the class CompareTabOrderComparator method getComponentBefore.

public Component getComponentBefore(Container aContainer, Component aComponent) {
    Container root = (aContainer.isFocusCycleRoot()) ? aContainer : aContainer.getFocusCycleRootAncestor();
    // traversal policy is non-legacy, then honor it.
    if (root != null) {
        FocusTraversalPolicy policy = root.getFocusTraversalPolicy();
        if (policy != gluePolicy) {
            return policy.getComponentBefore(root, aComponent);
        }
        comparator.setComponentOrientation(root.getComponentOrientation());
        return layoutPolicy.getComponentBefore(root, aComponent);
    }
    return null;
}
Also used : Container(java.awt.Container) FocusTraversalPolicy(java.awt.FocusTraversalPolicy)

Aggregations

FocusTraversalPolicy (java.awt.FocusTraversalPolicy)7 Container (java.awt.Container)6 Component (java.awt.Component)2