1 14 package org.compiere.apps; 15 16 import java.awt.*; 17 import javax.swing.*; 18 import org.compiere.swing.*; 19 20 26 public class AFocusTraversalPolicy extends LayoutFocusTraversalPolicy 27 { 28 32 public static AFocusTraversalPolicy get() 33 { 34 if (s_policy == null) 35 s_policy = new AFocusTraversalPolicy(); 36 return s_policy; 37 } 39 40 private static AFocusTraversalPolicy s_policy = new AFocusTraversalPolicy(); 41 42 43 44 47 public AFocusTraversalPolicy () 48 { 49 super(); 50 } 52 64 public Component getFirstComponent(Container focusCycleRoot) 65 { 66 Component c = super.getFirstComponent(focusCycleRoot); 67 return c; 70 } 72 91 public Component getComponentAfter(Container focusCycleRoot, Component aComponent) 92 { 93 Component c = super.getComponentAfter(focusCycleRoot, aComponent); 94 return c; 95 } 96 97 116 public Component getComponentBefore(Container focusCycleRoot, Component aComponent) 117 { 118 Component c = super.getComponentBefore(focusCycleRoot, aComponent); 119 return c; 120 } 121 122 134 public Component getLastComponent(Container focusCycleRoot) 135 { 136 Component c = super.getLastComponent(focusCycleRoot); 137 return c; 138 } 139 140 174 protected boolean accept(Component aComponent) 175 { 176 if (!super.accept(aComponent)) 177 return false; 178 179 if (aComponent instanceof JTabbedPane) 181 return false; 182 if (aComponent instanceof CEditor) 184 { 185 CEditor ed = (CEditor)aComponent; 186 if (!ed.isReadWrite()) 187 return false; 188 } 189 if (aComponent.getParent() instanceof JToolBar) 191 return false; 192 return true; 194 } 196 197 198 203 private void info (String title, Component c) 204 { 205 System.out.print (title); 206 System.out.print (c.getClass().getName()); 207 System.out.println (" - " + c.getName()); 208 } 210 } | Popular Tags |