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;
}
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;
}
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;
}
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");
}
}
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;
}
Aggregations