home *** CD-ROM | disk | FTP | other *** search
/ Sky at Night 2007 June / SAN CD 6-2007 CD-ROM 25.iso / pc / Software / AstroGrav_Win / Java / jre1.6.0 / lib / rt.jar / java / awt / KeyboardFocusManager.class (.txt) < prev    next >
Encoding:
Java Class File  |  2006-11-29  |  22.9 KB  |  1,315 lines

  1. package java.awt;
  2.  
  3. import java.awt.event.FocusEvent;
  4. import java.awt.event.KeyEvent;
  5. import java.awt.event.WindowEvent;
  6. import java.awt.peer.KeyboardFocusManagerPeer;
  7. import java.awt.peer.LightweightPeer;
  8. import java.beans.PropertyChangeListener;
  9. import java.beans.PropertyChangeSupport;
  10. import java.beans.PropertyVetoException;
  11. import java.beans.VetoableChangeListener;
  12. import java.beans.VetoableChangeSupport;
  13. import java.lang.ref.WeakReference;
  14. import java.lang.reflect.Field;
  15. import java.security.AccessController;
  16. import java.util.Collections;
  17. import java.util.HashSet;
  18. import java.util.Iterator;
  19. import java.util.LinkedList;
  20. import java.util.List;
  21. import java.util.Map;
  22. import java.util.Set;
  23. import java.util.StringTokenizer;
  24. import java.util.WeakHashMap;
  25. import java.util.logging.Level;
  26. import java.util.logging.Logger;
  27. import sun.awt.AppContext;
  28. import sun.awt.CausedFocusEvent;
  29. import sun.awt.DebugHelper;
  30. import sun.awt.HeadlessToolkit;
  31. import sun.awt.SunToolkit;
  32. import sun.awt.CausedFocusEvent.Cause;
  33.  
  34. public abstract class KeyboardFocusManager implements KeyEventDispatcher, KeyEventPostProcessor {
  35.    private static final Logger focusLog = Logger.getLogger("java.awt.focus.KeyboardFocusManager");
  36.    transient KeyboardFocusManagerPeer peer;
  37.    private static final DebugHelper dbg;
  38.    public static final int FORWARD_TRAVERSAL_KEYS = 0;
  39.    public static final int BACKWARD_TRAVERSAL_KEYS = 1;
  40.    public static final int UP_CYCLE_TRAVERSAL_KEYS = 2;
  41.    public static final int DOWN_CYCLE_TRAVERSAL_KEYS = 3;
  42.    static final int TRAVERSAL_KEY_LENGTH = 4;
  43.    private static Component focusOwner;
  44.    private static Component permanentFocusOwner;
  45.    private static Window focusedWindow;
  46.    private static Window activeWindow;
  47.    private FocusTraversalPolicy defaultPolicy = new DefaultFocusTraversalPolicy();
  48.    private static final String[] defaultFocusTraversalKeyPropertyNames;
  49.    private static final AWTKeyStroke[][] defaultFocusTraversalKeyStrokes;
  50.    private Set[] defaultFocusTraversalKeys = new Set[4];
  51.    private static Container currentFocusCycleRoot;
  52.    private VetoableChangeSupport vetoableSupport;
  53.    private PropertyChangeSupport changeSupport;
  54.    private LinkedList keyEventDispatchers;
  55.    private LinkedList keyEventPostProcessors;
  56.    private static Map mostRecentFocusOwners;
  57.    private static final String notPrivileged = "this KeyboardFocusManager is not installed in the current thread's context";
  58.    private static AWTPermission replaceKeyboardFocusManagerPermission;
  59.    transient SequencedEvent currentSequencedEvent = null;
  60.    private static LinkedList heavyweightRequests;
  61.    private static LinkedList currentLightweightRequests;
  62.    private static boolean clearingCurrentLightweightRequests;
  63.    private static Component newFocusOwner;
  64.    static final int SNFH_FAILURE = 0;
  65.    static final int SNFH_SUCCESS_HANDLED = 1;
  66.    static final int SNFH_SUCCESS_PROCEED = 2;
  67.    static Field proxyActive;
  68.  
  69.    private static native void initIDs();
  70.  
  71.    public static KeyboardFocusManager getCurrentKeyboardFocusManager() {
  72.       return getCurrentKeyboardFocusManager(AppContext.getAppContext());
  73.    }
  74.  
  75.    static synchronized KeyboardFocusManager getCurrentKeyboardFocusManager(AppContext var0) {
  76.       Object var1 = (KeyboardFocusManager)var0.get(KeyboardFocusManager.class);
  77.       if (var1 == null) {
  78.          var1 = new DefaultKeyboardFocusManager();
  79.          var0.put(KeyboardFocusManager.class, var1);
  80.       }
  81.  
  82.       return (KeyboardFocusManager)var1;
  83.    }
  84.  
  85.    public static void setCurrentKeyboardFocusManager(KeyboardFocusManager var0) throws SecurityException {
  86.       SecurityManager var1 = System.getSecurityManager();
  87.       if (var1 != null) {
  88.          if (replaceKeyboardFocusManagerPermission == null) {
  89.             replaceKeyboardFocusManagerPermission = new AWTPermission("replaceKeyboardFocusManager");
  90.          }
  91.  
  92.          var1.checkPermission(replaceKeyboardFocusManagerPermission);
  93.       }
  94.  
  95.       KeyboardFocusManager var2 = null;
  96.       synchronized(KeyboardFocusManager.class) {
  97.          AppContext var4 = AppContext.getAppContext();
  98.          if (var0 != null) {
  99.             var2 = getCurrentKeyboardFocusManager(var4);
  100.             var4.put(KeyboardFocusManager.class, var0);
  101.          } else {
  102.             var2 = getCurrentKeyboardFocusManager(var4);
  103.             var4.remove(KeyboardFocusManager.class);
  104.          }
  105.       }
  106.  
  107.       if (var2 != null) {
  108.          var2.firePropertyChange("managingFocus", Boolean.TRUE, Boolean.FALSE);
  109.       }
  110.  
  111.       if (var0 != null) {
  112.          var0.firePropertyChange("managingFocus", Boolean.FALSE, Boolean.TRUE);
  113.       }
  114.  
  115.    }
  116.  
  117.    final void setCurrentSequencedEvent(SequencedEvent var1) {
  118.       synchronized(SequencedEvent.class) {
  119.          assert var1 == null || this.currentSequencedEvent == null;
  120.  
  121.          this.currentSequencedEvent = var1;
  122.       }
  123.    }
  124.  
  125.    final SequencedEvent getCurrentSequencedEvent() {
  126.       synchronized(SequencedEvent.class) {
  127.          return this.currentSequencedEvent;
  128.       }
  129.    }
  130.  
  131.    static Set initFocusTraversalKeysSet(String var0, Set var1) {
  132.       StringTokenizer var2 = new StringTokenizer(var0, ",");
  133.  
  134.       while(var2.hasMoreTokens()) {
  135.          var1.add(AWTKeyStroke.getAWTKeyStroke(var2.nextToken()));
  136.       }
  137.  
  138.       return var1.isEmpty() ? Collections.EMPTY_SET : Collections.unmodifiableSet(var1);
  139.    }
  140.  
  141.    public KeyboardFocusManager() {
  142.       for(int var1 = 0; var1 < 4; ++var1) {
  143.          HashSet var2 = new HashSet();
  144.  
  145.          for(int var3 = 0; var3 < defaultFocusTraversalKeyStrokes[var1].length; ++var3) {
  146.             var2.add(defaultFocusTraversalKeyStrokes[var1][var3]);
  147.          }
  148.  
  149.          this.defaultFocusTraversalKeys[var1] = var2.isEmpty() ? Collections.EMPTY_SET : Collections.unmodifiableSet(var2);
  150.       }
  151.  
  152.       this.initPeer();
  153.    }
  154.  
  155.    private void initPeer() {
  156.       if (Toolkit.getDefaultToolkit() instanceof HeadlessToolkit) {
  157.          this.peer = ((HeadlessToolkit)Toolkit.getDefaultToolkit()).createKeyboardFocusManagerPeer(this);
  158.       }
  159.  
  160.       if (Toolkit.getDefaultToolkit() instanceof SunToolkit) {
  161.          this.peer = ((SunToolkit)Toolkit.getDefaultToolkit()).createKeyboardFocusManagerPeer(this);
  162.       }
  163.  
  164.    }
  165.  
  166.    public Component getFocusOwner() {
  167.       synchronized(KeyboardFocusManager.class) {
  168.          if (focusOwner == null) {
  169.             return null;
  170.          } else {
  171.             return focusOwner.appContext == AppContext.getAppContext() ? focusOwner : null;
  172.          }
  173.       }
  174.    }
  175.  
  176.    protected Component getGlobalFocusOwner() throws SecurityException {
  177.       synchronized(KeyboardFocusManager.class) {
  178.          if (this == getCurrentKeyboardFocusManager()) {
  179.             return focusOwner;
  180.          } else {
  181.             if (focusLog.isLoggable(Level.FINE)) {
  182.                focusLog.fine("This manager is " + this + ", current is " + getCurrentKeyboardFocusManager());
  183.             }
  184.  
  185.             throw new SecurityException("this KeyboardFocusManager is not installed in the current thread's context");
  186.          }
  187.       }
  188.    }
  189.  
  190.    protected void setGlobalFocusOwner(Component var1) {
  191.       Component var2 = null;
  192.       boolean var3 = false;
  193.       if (var1 == null || var1.isFocusable()) {
  194.          synchronized(KeyboardFocusManager.class) {
  195.             var2 = this.getFocusOwner();
  196.  
  197.             try {
  198.                this.fireVetoableChange("focusOwner", var2, var1);
  199.             } catch (PropertyVetoException var7) {
  200.                return;
  201.             }
  202.  
  203.             focusOwner = var1;
  204.             if (var1 != null && (this.getCurrentFocusCycleRoot() == null || !var1.isFocusCycleRoot(this.getCurrentFocusCycleRoot()))) {
  205.                Container var5 = var1.getFocusCycleRootAncestor();
  206.                if (var5 == null && var1 instanceof Window) {
  207.                   var5 = (Container)var1;
  208.                }
  209.  
  210.                if (var5 != null) {
  211.                   this.setGlobalCurrentFocusCycleRoot(var5);
  212.                }
  213.             }
  214.  
  215.             var3 = true;
  216.          }
  217.       }
  218.  
  219.       if (var3) {
  220.          this.firePropertyChange("focusOwner", var2, var1);
  221.       }
  222.  
  223.    }
  224.  
  225.    public void clearGlobalFocusOwner() {
  226.       if (!GraphicsEnvironment.isHeadless()) {
  227.          Toolkit.getDefaultToolkit();
  228.          this._clearGlobalFocusOwner();
  229.       }
  230.  
  231.    }
  232.  
  233.    private void _clearGlobalFocusOwner() {
  234.       Window var1 = markClearGlobalFocusOwner();
  235.       this.peer.clearGlobalFocusOwner(var1);
  236.    }
  237.  
  238.    Component getNativeFocusOwner() {
  239.       return this.peer.getCurrentFocusOwner();
  240.    }
  241.  
  242.    void setNativeFocusOwner(Component var1) {
  243.       focusLog.log(Level.FINEST, "Calling peer {0} setCurrentFocusOwner for {1}", new Object[]{this.peer, var1});
  244.       this.peer.setCurrentFocusOwner(var1);
  245.    }
  246.  
  247.    Window getNativeFocusedWindow() {
  248.       return this.peer.getCurrentFocusedWindow();
  249.    }
  250.  
  251.    void setNativeFocusedWindow(Window var1) {
  252.       this.peer.setCurrentFocusedWindow(var1);
  253.    }
  254.  
  255.    public Component getPermanentFocusOwner() {
  256.       synchronized(KeyboardFocusManager.class) {
  257.          if (permanentFocusOwner == null) {
  258.             return null;
  259.          } else {
  260.             return permanentFocusOwner.appContext == AppContext.getAppContext() ? permanentFocusOwner : null;
  261.          }
  262.       }
  263.    }
  264.  
  265.    protected Component getGlobalPermanentFocusOwner() throws SecurityException {
  266.       synchronized(KeyboardFocusManager.class) {
  267.          if (this == getCurrentKeyboardFocusManager()) {
  268.             return permanentFocusOwner;
  269.          } else {
  270.             if (focusLog.isLoggable(Level.FINE)) {
  271.                focusLog.fine("This manager is " + this + ", current is " + getCurrentKeyboardFocusManager());
  272.             }
  273.  
  274.             throw new SecurityException("this KeyboardFocusManager is not installed in the current thread's context");
  275.          }
  276.       }
  277.    }
  278.  
  279.    protected void setGlobalPermanentFocusOwner(Component var1) {
  280.       Component var2 = null;
  281.       boolean var3 = false;
  282.       if (var1 == null || var1.isFocusable()) {
  283.          synchronized(KeyboardFocusManager.class) {
  284.             var2 = this.getPermanentFocusOwner();
  285.  
  286.             try {
  287.                this.fireVetoableChange("permanentFocusOwner", var2, var1);
  288.             } catch (PropertyVetoException var7) {
  289.                return;
  290.             }
  291.  
  292.             permanentFocusOwner = var1;
  293.             setMostRecentFocusOwner(var1);
  294.             var3 = true;
  295.          }
  296.       }
  297.  
  298.       if (var3) {
  299.          this.firePropertyChange("permanentFocusOwner", var2, var1);
  300.       }
  301.  
  302.    }
  303.  
  304.    public Window getFocusedWindow() {
  305.       synchronized(KeyboardFocusManager.class) {
  306.          if (focusedWindow == null) {
  307.             return null;
  308.          } else {
  309.             return focusedWindow.appContext == AppContext.getAppContext() ? focusedWindow : null;
  310.          }
  311.       }
  312.    }
  313.  
  314.    protected Window getGlobalFocusedWindow() throws SecurityException {
  315.       synchronized(KeyboardFocusManager.class) {
  316.          if (this == getCurrentKeyboardFocusManager()) {
  317.             return focusedWindow;
  318.          } else {
  319.             if (focusLog.isLoggable(Level.FINE)) {
  320.                focusLog.fine("This manager is " + this + ", current is " + getCurrentKeyboardFocusManager());
  321.             }
  322.  
  323.             throw new SecurityException("this KeyboardFocusManager is not installed in the current thread's context");
  324.          }
  325.       }
  326.    }
  327.  
  328.    protected void setGlobalFocusedWindow(Window var1) {
  329.       Window var2 = null;
  330.       boolean var3 = false;
  331.       if (var1 == null || var1.isFocusableWindow()) {
  332.          synchronized(KeyboardFocusManager.class) {
  333.             var2 = this.getFocusedWindow();
  334.  
  335.             try {
  336.                this.fireVetoableChange("focusedWindow", var2, var1);
  337.             } catch (PropertyVetoException var7) {
  338.                return;
  339.             }
  340.  
  341.             focusedWindow = var1;
  342.             var3 = true;
  343.          }
  344.       }
  345.  
  346.       if (var3) {
  347.          this.firePropertyChange("focusedWindow", var2, var1);
  348.       }
  349.  
  350.    }
  351.  
  352.    public Window getActiveWindow() {
  353.       synchronized(KeyboardFocusManager.class) {
  354.          if (activeWindow == null) {
  355.             return null;
  356.          } else {
  357.             return activeWindow.appContext == AppContext.getAppContext() ? activeWindow : null;
  358.          }
  359.       }
  360.    }
  361.  
  362.    protected Window getGlobalActiveWindow() throws SecurityException {
  363.       synchronized(KeyboardFocusManager.class) {
  364.          if (this == getCurrentKeyboardFocusManager()) {
  365.             return activeWindow;
  366.          } else {
  367.             if (focusLog.isLoggable(Level.FINE)) {
  368.                focusLog.fine("This manager is " + this + ", current is " + getCurrentKeyboardFocusManager());
  369.             }
  370.  
  371.             throw new SecurityException("this KeyboardFocusManager is not installed in the current thread's context");
  372.          }
  373.       }
  374.    }
  375.  
  376.    protected void setGlobalActiveWindow(Window var1) {
  377.       Window var2;
  378.       synchronized(KeyboardFocusManager.class) {
  379.          var2 = this.getActiveWindow();
  380.          if (focusLog.isLoggable(Level.FINER)) {
  381.             focusLog.finer("Setting global active window to " + var1 + ", old active " + var2);
  382.          }
  383.  
  384.          try {
  385.             this.fireVetoableChange("activeWindow", var2, var1);
  386.          } catch (PropertyVetoException var6) {
  387.             return;
  388.          }
  389.  
  390.          activeWindow = var1;
  391.       }
  392.  
  393.       this.firePropertyChange("activeWindow", var2, var1);
  394.    }
  395.  
  396.    public synchronized FocusTraversalPolicy getDefaultFocusTraversalPolicy() {
  397.       return this.defaultPolicy;
  398.    }
  399.  
  400.    public void setDefaultFocusTraversalPolicy(FocusTraversalPolicy var1) {
  401.       if (var1 == null) {
  402.          throw new IllegalArgumentException("default focus traversal policy cannot be null");
  403.       } else {
  404.          FocusTraversalPolicy var2;
  405.          synchronized(this) {
  406.             var2 = this.defaultPolicy;
  407.             this.defaultPolicy = var1;
  408.          }
  409.  
  410.          this.firePropertyChange("defaultFocusTraversalPolicy", var2, var1);
  411.       }
  412.    }
  413.  
  414.    public void setDefaultFocusTraversalKeys(int var1, Set<? extends AWTKeyStroke> var2) {
  415.       if (var1 >= 0 && var1 < 4) {
  416.          if (var2 == null) {
  417.             throw new IllegalArgumentException("cannot set null Set of default focus traversal keys");
  418.          } else {
  419.             Set var3;
  420.             synchronized(this) {
  421.                for(Object var6 : var2) {
  422.                   if (var6 == null) {
  423.                      throw new IllegalArgumentException("cannot set null focus traversal key");
  424.                   }
  425.  
  426.                   if (!(var6 instanceof AWTKeyStroke)) {
  427.                      throw new IllegalArgumentException("object is expected to be AWTKeyStroke");
  428.                   }
  429.  
  430.                   AWTKeyStroke var7 = (AWTKeyStroke)var6;
  431.                   if (var7.getKeyChar() != '\uffff') {
  432.                      throw new IllegalArgumentException("focus traversal keys cannot map to KEY_TYPED events");
  433.                   }
  434.  
  435.                   for(int var8 = 0; var8 < 4; ++var8) {
  436.                      if (var8 != var1 && this.defaultFocusTraversalKeys[var8].contains(var7)) {
  437.                         throw new IllegalArgumentException("focus traversal keys must be unique for a Component");
  438.                      }
  439.                   }
  440.                }
  441.  
  442.                var3 = this.defaultFocusTraversalKeys[var1];
  443.                this.defaultFocusTraversalKeys[var1] = Collections.unmodifiableSet(new HashSet(var2));
  444.             }
  445.  
  446.             this.firePropertyChange(defaultFocusTraversalKeyPropertyNames[var1], var3, var2);
  447.          }
  448.       } else {
  449.          throw new IllegalArgumentException("invalid focus traversal key identifier");
  450.       }
  451.    }
  452.  
  453.    public Set<AWTKeyStroke> getDefaultFocusTraversalKeys(int var1) {
  454.       if (var1 >= 0 && var1 < 4) {
  455.          return this.defaultFocusTraversalKeys[var1];
  456.       } else {
  457.          throw new IllegalArgumentException("invalid focus traversal key identifier");
  458.       }
  459.    }
  460.  
  461.    public Container getCurrentFocusCycleRoot() {
  462.       synchronized(KeyboardFocusManager.class) {
  463.          if (currentFocusCycleRoot == null) {
  464.             return null;
  465.          } else {
  466.             return currentFocusCycleRoot.appContext == AppContext.getAppContext() ? currentFocusCycleRoot : null;
  467.          }
  468.       }
  469.    }
  470.  
  471.    protected Container getGlobalCurrentFocusCycleRoot() throws SecurityException {
  472.       synchronized(KeyboardFocusManager.class) {
  473.          if (this == getCurrentKeyboardFocusManager()) {
  474.             return currentFocusCycleRoot;
  475.          } else {
  476.             if (focusLog.isLoggable(Level.FINE)) {
  477.                focusLog.fine("This manager is " + this + ", current is " + getCurrentKeyboardFocusManager());
  478.             }
  479.  
  480.             throw new SecurityException("this KeyboardFocusManager is not installed in the current thread's context");
  481.          }
  482.       }
  483.    }
  484.  
  485.    public void setGlobalCurrentFocusCycleRoot(Container var1) {
  486.       Container var2;
  487.       synchronized(KeyboardFocusManager.class) {
  488.          var2 = this.getCurrentFocusCycleRoot();
  489.          currentFocusCycleRoot = var1;
  490.       }
  491.  
  492.       this.firePropertyChange("currentFocusCycleRoot", var2, var1);
  493.    }
  494.  
  495.    public void addPropertyChangeListener(PropertyChangeListener var1) {
  496.       if (var1 != null) {
  497.          synchronized(this) {
  498.             if (this.changeSupport == null) {
  499.                this.changeSupport = new PropertyChangeSupport(this);
  500.             }
  501.  
  502.             this.changeSupport.addPropertyChangeListener(var1);
  503.          }
  504.       }
  505.  
  506.    }
  507.  
  508.    public void removePropertyChangeListener(PropertyChangeListener var1) {
  509.       if (var1 != null) {
  510.          synchronized(this) {
  511.             if (this.changeSupport != null) {
  512.                this.changeSupport.removePropertyChangeListener(var1);
  513.             }
  514.          }
  515.       }
  516.  
  517.    }
  518.  
  519.    public synchronized PropertyChangeListener[] getPropertyChangeListeners() {
  520.       if (this.changeSupport == null) {
  521.          this.changeSupport = new PropertyChangeSupport(this);
  522.       }
  523.  
  524.       return this.changeSupport.getPropertyChangeListeners();
  525.    }
  526.  
  527.    public void addPropertyChangeListener(String var1, PropertyChangeListener var2) {
  528.       if (var2 != null) {
  529.          synchronized(this) {
  530.             if (this.changeSupport == null) {
  531.                this.changeSupport = new PropertyChangeSupport(this);
  532.             }
  533.  
  534.             this.changeSupport.addPropertyChangeListener(var1, var2);
  535.          }
  536.       }
  537.  
  538.    }
  539.  
  540.    public void removePropertyChangeListener(String var1, PropertyChangeListener var2) {
  541.       if (var2 != null) {
  542.          synchronized(this) {
  543.             if (this.changeSupport != null) {
  544.                this.changeSupport.removePropertyChangeListener(var1, var2);
  545.             }
  546.          }
  547.       }
  548.  
  549.    }
  550.  
  551.    public synchronized PropertyChangeListener[] getPropertyChangeListeners(String var1) {
  552.       if (this.changeSupport == null) {
  553.          this.changeSupport = new PropertyChangeSupport(this);
  554.       }
  555.  
  556.       return this.changeSupport.getPropertyChangeListeners(var1);
  557.    }
  558.  
  559.    protected void firePropertyChange(String var1, Object var2, Object var3) {
  560.       if (var2 != var3) {
  561.          PropertyChangeSupport var4 = this.changeSupport;
  562.          if (var4 != null) {
  563.             var4.firePropertyChange(var1, var2, var3);
  564.          }
  565.  
  566.       }
  567.    }
  568.  
  569.    public void addVetoableChangeListener(VetoableChangeListener var1) {
  570.       if (var1 != null) {
  571.          synchronized(this) {
  572.             if (this.vetoableSupport == null) {
  573.                this.vetoableSupport = new VetoableChangeSupport(this);
  574.             }
  575.  
  576.             this.vetoableSupport.addVetoableChangeListener(var1);
  577.          }
  578.       }
  579.  
  580.    }
  581.  
  582.    public void removeVetoableChangeListener(VetoableChangeListener var1) {
  583.       if (var1 != null) {
  584.          synchronized(this) {
  585.             if (this.vetoableSupport != null) {
  586.                this.vetoableSupport.removeVetoableChangeListener(var1);
  587.             }
  588.          }
  589.       }
  590.  
  591.    }
  592.  
  593.    public synchronized VetoableChangeListener[] getVetoableChangeListeners() {
  594.       if (this.vetoableSupport == null) {
  595.          this.vetoableSupport = new VetoableChangeSupport(this);
  596.       }
  597.  
  598.       return this.vetoableSupport.getVetoableChangeListeners();
  599.    }
  600.  
  601.    public void addVetoableChangeListener(String var1, VetoableChangeListener var2) {
  602.       if (var2 != null) {
  603.          synchronized(this) {
  604.             if (this.vetoableSupport == null) {
  605.                this.vetoableSupport = new VetoableChangeSupport(this);
  606.             }
  607.  
  608.             this.vetoableSupport.addVetoableChangeListener(var1, var2);
  609.          }
  610.       }
  611.  
  612.    }
  613.  
  614.    public void removeVetoableChangeListener(String var1, VetoableChangeListener var2) {
  615.       if (var2 != null) {
  616.          synchronized(this) {
  617.             if (this.vetoableSupport != null) {
  618.                this.vetoableSupport.removeVetoableChangeListener(var1, var2);
  619.             }
  620.          }
  621.       }
  622.  
  623.    }
  624.  
  625.    public synchronized VetoableChangeListener[] getVetoableChangeListeners(String var1) {
  626.       if (this.vetoableSupport == null) {
  627.          this.vetoableSupport = new VetoableChangeSupport(this);
  628.       }
  629.  
  630.       return this.vetoableSupport.getVetoableChangeListeners(var1);
  631.    }
  632.  
  633.    protected void fireVetoableChange(String var1, Object var2, Object var3) throws PropertyVetoException {
  634.       if (var2 != var3) {
  635.          VetoableChangeSupport var4 = this.vetoableSupport;
  636.          if (var4 != null) {
  637.             var4.fireVetoableChange(var1, var2, var3);
  638.          }
  639.  
  640.       }
  641.    }
  642.  
  643.    public void addKeyEventDispatcher(KeyEventDispatcher var1) {
  644.       if (var1 != null) {
  645.          synchronized(this) {
  646.             if (this.keyEventDispatchers == null) {
  647.                this.keyEventDispatchers = new LinkedList();
  648.             }
  649.  
  650.             this.keyEventDispatchers.add(var1);
  651.          }
  652.       }
  653.  
  654.    }
  655.  
  656.    public void removeKeyEventDispatcher(KeyEventDispatcher var1) {
  657.       if (var1 != null) {
  658.          synchronized(this) {
  659.             if (this.keyEventDispatchers != null) {
  660.                this.keyEventDispatchers.remove(var1);
  661.             }
  662.          }
  663.       }
  664.  
  665.    }
  666.  
  667.    protected synchronized List<KeyEventDispatcher> getKeyEventDispatchers() {
  668.       return this.keyEventDispatchers != null ? (List)this.keyEventDispatchers.clone() : null;
  669.    }
  670.  
  671.    public void addKeyEventPostProcessor(KeyEventPostProcessor var1) {
  672.       if (var1 != null) {
  673.          synchronized(this) {
  674.             if (this.keyEventPostProcessors == null) {
  675.                this.keyEventPostProcessors = new LinkedList();
  676.             }
  677.  
  678.             this.keyEventPostProcessors.add(var1);
  679.          }
  680.       }
  681.  
  682.    }
  683.  
  684.    public void removeKeyEventPostProcessor(KeyEventPostProcessor var1) {
  685.       if (var1 != null) {
  686.          synchronized(this) {
  687.             if (this.keyEventPostProcessors != null) {
  688.                this.keyEventPostProcessors.remove(var1);
  689.             }
  690.          }
  691.       }
  692.  
  693.    }
  694.  
  695.    protected List<KeyEventPostProcessor> getKeyEventPostProcessors() {
  696.       return this.keyEventPostProcessors != null ? (List)this.keyEventPostProcessors.clone() : null;
  697.    }
  698.  
  699.    static void setMostRecentFocusOwner(Component var0) {
  700.       Object var1;
  701.       for(var1 = var0; var1 != null && !(var1 instanceof Window); var1 = ((Component)var1).parent) {
  702.       }
  703.  
  704.       if (var1 != null) {
  705.          setMostRecentFocusOwner((Window)var1, var0);
  706.       }
  707.  
  708.    }
  709.  
  710.    static synchronized void setMostRecentFocusOwner(Window var0, Component var1) {
  711.       WeakReference var2 = null;
  712.       if (var1 != null) {
  713.          var2 = new WeakReference(var1);
  714.       }
  715.  
  716.       mostRecentFocusOwners.put(var0, var2);
  717.    }
  718.  
  719.    static void clearMostRecentFocusOwner(Component var0) {
  720.       if (var0 != null) {
  721.          Container var1;
  722.          synchronized(var0.getTreeLock()) {
  723.             for(var1 = var0.getParent(); var1 != null && !(var1 instanceof Window); var1 = var1.getParent()) {
  724.             }
  725.          }
  726.  
  727.          synchronized(KeyboardFocusManager.class) {
  728.             if (var1 != null && getMostRecentFocusOwner((Window)var1) == var0) {
  729.                setMostRecentFocusOwner((Window)var1, (Component)null);
  730.             }
  731.  
  732.             if (var1 != null) {
  733.                Window var3 = (Window)var1;
  734.                if (var3.getTemporaryLostComponent() == var0) {
  735.                   var3.setTemporaryLostComponent((Component)null);
  736.                }
  737.             }
  738.  
  739.          }
  740.       }
  741.    }
  742.  
  743.    static synchronized Component getMostRecentFocusOwner(Window var0) {
  744.       WeakReference var1 = (WeakReference)mostRecentFocusOwners.get(var0);
  745.       return var1 == null ? null : (Component)var1.get();
  746.    }
  747.  
  748.    public abstract boolean dispatchEvent(AWTEvent var1);
  749.  
  750.    public final void redispatchEvent(Component var1, AWTEvent var2) {
  751.       var2.focusManagerIsDispatching = true;
  752.       var1.dispatchEvent(var2);
  753.       var2.focusManagerIsDispatching = false;
  754.    }
  755.  
  756.    public abstract boolean dispatchKeyEvent(KeyEvent var1);
  757.  
  758.    public abstract boolean postProcessKeyEvent(KeyEvent var1);
  759.  
  760.    public abstract void processKeyEvent(Component var1, KeyEvent var2);
  761.  
  762.    protected abstract void enqueueKeyEvents(long var1, Component var3);
  763.  
  764.    protected abstract void dequeueKeyEvents(long var1, Component var3);
  765.  
  766.    protected abstract void discardKeyEvents(Component var1);
  767.  
  768.    public abstract void focusNextComponent(Component var1);
  769.  
  770.    public abstract void focusPreviousComponent(Component var1);
  771.  
  772.    public abstract void upFocusCycle(Component var1);
  773.  
  774.    public abstract void downFocusCycle(Container var1);
  775.  
  776.    public final void focusNextComponent() {
  777.       Component var1 = this.getFocusOwner();
  778.       if (var1 != null) {
  779.          this.focusNextComponent(var1);
  780.       }
  781.  
  782.    }
  783.  
  784.    public final void focusPreviousComponent() {
  785.       Component var1 = this.getFocusOwner();
  786.       if (var1 != null) {
  787.          this.focusPreviousComponent(var1);
  788.       }
  789.  
  790.    }
  791.  
  792.    public final void upFocusCycle() {
  793.       Component var1 = this.getFocusOwner();
  794.       if (var1 != null) {
  795.          this.upFocusCycle(var1);
  796.       }
  797.  
  798.    }
  799.  
  800.    public final void downFocusCycle() {
  801.       Component var1 = this.getFocusOwner();
  802.       if (var1 instanceof Container) {
  803.          this.downFocusCycle((Container)var1);
  804.       }
  805.  
  806.    }
  807.  
  808.    void dumpRequests() {
  809.       System.err.println(">>> Requests dump, time: " + System.currentTimeMillis());
  810.       synchronized(heavyweightRequests) {
  811.          for(HeavyweightFocusRequest var3 : heavyweightRequests) {
  812.             System.err.println(">>> Req: " + var3);
  813.          }
  814.       }
  815.  
  816.       System.err.println("");
  817.    }
  818.  
  819.    static boolean processSynchronousLightweightTransfer(Component var0, Component var1, boolean var2, boolean var3, long var4) {
  820.       Window var6 = Component.getContainingWindow(var0);
  821.       if (var6 != null && var6.syncLWRequests) {
  822.          if (var1 == null) {
  823.             var1 = var0;
  824.          }
  825.  
  826.          KeyboardFocusManager var7 = getCurrentKeyboardFocusManager(SunToolkit.targetToAppContext(var1));
  827.          FocusEvent var8 = null;
  828.          FocusEvent var9 = null;
  829.          Component var10 = var7.getGlobalFocusOwner();
  830.          synchronized(heavyweightRequests) {
  831.             HeavyweightFocusRequest var12 = (HeavyweightFocusRequest)(heavyweightRequests.size() > 0 ? heavyweightRequests.getLast() : null);
  832.             if (var12 == null && var0 == var7.getNativeFocusOwner()) {
  833.                if (var1 == var10) {
  834.                   return true;
  835.                }
  836.  
  837.                var7.enqueueKeyEvents(var4, var1);
  838.                var12 = new HeavyweightFocusRequest(var0, var1, var2, Cause.UNKNOWN);
  839.                heavyweightRequests.add(var12);
  840.                if (var10 != null) {
  841.                   var8 = new FocusEvent(var10, 1005, var2, var1);
  842.                }
  843.  
  844.                var9 = new FocusEvent(var1, 1004, var2, var10);
  845.             }
  846.          }
  847.  
  848.          boolean var11 = false;
  849.          boolean var23 = clearingCurrentLightweightRequests;
  850.  
  851.          try {
  852.             clearingCurrentLightweightRequests = false;
  853.             synchronized(Component.LOCK) {
  854.                if (var8 != null && var10 != null) {
  855.                   var8.isPosted = true;
  856.                   var10.dispatchEvent(var8);
  857.                   var11 = true;
  858.                }
  859.  
  860.                if (var9 != null && var1 != null) {
  861.                   var9.isPosted = true;
  862.                   var1.dispatchEvent(var9);
  863.                   var11 = true;
  864.                }
  865.             }
  866.          } finally {
  867.             clearingCurrentLightweightRequests = var23;
  868.          }
  869.  
  870.          return var11;
  871.       } else {
  872.          return false;
  873.       }
  874.    }
  875.  
  876.    static int shouldNativelyFocusHeavyweight(Component var0, Component var1, boolean var2, boolean var3, long var4, CausedFocusEvent.Cause var6) {
  877.       DebugHelper var10000 = dbg;
  878.       if (var1 == null) {
  879.          var1 = var0;
  880.       }
  881.  
  882.       KeyboardFocusManager var7 = getCurrentKeyboardFocusManager(SunToolkit.targetToAppContext(var1));
  883.       KeyboardFocusManager var8 = getCurrentKeyboardFocusManager();
  884.       Component var9 = var8.getGlobalFocusOwner();
  885.       Component var10 = var8.getNativeFocusOwner();
  886.       Window var11 = var8.getNativeFocusedWindow();
  887.       if (focusLog.isLoggable(Level.FINER)) {
  888.          focusLog.log(Level.FINER, "SNFH for {0} in {1}", new Object[]{var1, var0});
  889.       }
  890.  
  891.       if (focusLog.isLoggable(Level.FINEST)) {
  892.          focusLog.log(Level.FINEST, "0. Current focus owner {0}", var9);
  893.          focusLog.log(Level.FINEST, "0. Native focus owner {0}", var10);
  894.          focusLog.log(Level.FINEST, "0. Native focused window {0}", var11);
  895.       }
  896.  
  897.       synchronized(heavyweightRequests) {
  898.          HeavyweightFocusRequest var13 = (HeavyweightFocusRequest)(heavyweightRequests.size() > 0 ? heavyweightRequests.getLast() : null);
  899.          if (focusLog.isLoggable(Level.FINEST)) {
  900.             focusLog.log(Level.FINEST, "Request {0}", var13);
  901.          }
  902.  
  903.          if (var13 == null && var0 == var10) {
  904.             if (var1 == var9) {
  905.                if (focusLog.isLoggable(Level.FINEST)) {
  906.                   focusLog.log(Level.FINEST, "1. SNFH_FAILURE for {0}", var1);
  907.                }
  908.  
  909.                return 0;
  910.             } else {
  911.                var7.enqueueKeyEvents(var4, var1);
  912.                var13 = new HeavyweightFocusRequest(var0, var1, var2, var6);
  913.                heavyweightRequests.add(var13);
  914.                if (var9 != null) {
  915.                   CausedFocusEvent var18 = new CausedFocusEvent(var9, 1005, var2, var1, var6);
  916.                   SunToolkit.postEvent(var9.appContext, var18);
  917.                }
  918.  
  919.                CausedFocusEvent var19 = new CausedFocusEvent(var1, 1004, var2, var9, var6);
  920.                SunToolkit.postEvent(var1.appContext, var19);
  921.                if (focusLog.isLoggable(Level.FINEST)) {
  922.                   focusLog.log(Level.FINEST, "2. SNFH_HANDLED for {0}", var1);
  923.                }
  924.  
  925.                return 1;
  926.             }
  927.          } else if (var13 != null && var13.heavyweight == var0) {
  928.             if (var13.addLightweightRequest(var1, var2, var6)) {
  929.                var7.enqueueKeyEvents(var4, var1);
  930.             }
  931.  
  932.             if (focusLog.isLoggable(Level.FINEST)) {
  933.                focusLog.finest("3. SNFH_HANDLED for lightweight" + var1 + " in " + var0);
  934.             }
  935.  
  936.             return 1;
  937.          } else {
  938.             if (!var3) {
  939.                if (var13 == java.awt.KeyboardFocusManager.HeavyweightFocusRequest.CLEAR_GLOBAL_FOCUS_OWNER) {
  940.                   int var14 = heavyweightRequests.size();
  941.                   var13 = (HeavyweightFocusRequest)(var14 >= 2 ? heavyweightRequests.get(var14 - 2) : null);
  942.                }
  943.  
  944.                if (focusedWindowChanged(var0, (Component)(var13 != null ? var13.heavyweight : var11))) {
  945.                   if (focusLog.isLoggable(Level.FINEST)) {
  946.                      focusLog.finest("4. SNFH_FAILURE for " + var1);
  947.                   }
  948.  
  949.                   return 0;
  950.                }
  951.             }
  952.  
  953.             var7.enqueueKeyEvents(var4, var1);
  954.             heavyweightRequests.add(new HeavyweightFocusRequest(var0, var1, var2, var6));
  955.             if (focusLog.isLoggable(Level.FINEST)) {
  956.                focusLog.finest("5. SNFH_PROCEED for " + var1);
  957.             }
  958.  
  959.             return 2;
  960.          }
  961.       }
  962.    }
  963.  
  964.    static void heavyweightButtonDown(Component var0, long var1) {
  965.       heavyweightButtonDown(var0, var1, false);
  966.    }
  967.  
  968.    static void heavyweightButtonDown(Component var0, long var1, boolean var3) {
  969.       DebugHelper var10000 = dbg;
  970.       KeyboardFocusManager var4 = getCurrentKeyboardFocusManager(SunToolkit.targetToAppContext(var0));
  971.       synchronized(heavyweightRequests) {
  972.          HeavyweightFocusRequest var6 = (HeavyweightFocusRequest)(heavyweightRequests.size() > 0 ? heavyweightRequests.getLast() : null);
  973.          Component var7 = var6 == null ? var4.getNativeFocusOwner() : var6.heavyweight;
  974.          if (var3 || var0 != var7) {
  975.             getCurrentKeyboardFocusManager(SunToolkit.targetToAppContext(var0)).enqueueKeyEvents(var1, var0);
  976.             heavyweightRequests.add(new HeavyweightFocusRequest(var0, var0, false, Cause.MOUSE_EVENT));
  977.          }
  978.  
  979.       }
  980.    }
  981.  
  982.    static Window markClearGlobalFocusOwner() {
  983.       synchronized(heavyweightRequests) {
  984.          HeavyweightFocusRequest var1 = (HeavyweightFocusRequest)(heavyweightRequests.size() > 0 ? heavyweightRequests.getLast() : null);
  985.          if (var1 == java.awt.KeyboardFocusManager.HeavyweightFocusRequest.CLEAR_GLOBAL_FOCUS_OWNER) {
  986.             return null;
  987.          } else {
  988.             KeyboardFocusManager var2 = getCurrentKeyboardFocusManager();
  989.             heavyweightRequests.add(java.awt.KeyboardFocusManager.HeavyweightFocusRequest.CLEAR_GLOBAL_FOCUS_OWNER);
  990.  
  991.             Object var3;
  992.             for(var3 = var1 != null ? Component.getContainingWindow(var1.heavyweight) : var2.getNativeFocusedWindow(); var3 != null && !(var3 instanceof Frame) && !(var3 instanceof Dialog); var3 = ((Component)var3).getParent()) {
  993.             }
  994.  
  995.             return (Window)var3;
  996.          }
  997.       }
  998.    }
  999.  
  1000.    Component getCurrentWaitingRequest(Component var1) {
  1001.       synchronized(heavyweightRequests) {
  1002.          HeavyweightFocusRequest var3 = (HeavyweightFocusRequest)(heavyweightRequests.size() > 0 ? heavyweightRequests.getFirst() : null);
  1003.          if (var3 != null && var3.heavyweight == var1) {
  1004.             LightweightFocusRequest var4 = (LightweightFocusRequest)var3.lightweightRequests.getFirst();
  1005.             if (var4 != null) {
  1006.                return var4.component;
  1007.             }
  1008.          }
  1009.  
  1010.          return null;
  1011.       }
  1012.    }
  1013.  
  1014.    static boolean hasFocusRequests() {
  1015.       synchronized(heavyweightRequests) {
  1016.          return heavyweightRequests.size() > 0;
  1017.       }
  1018.    }
  1019.  
  1020.    static void processCurrentLightweightRequests() {
  1021.       KeyboardFocusManager var0 = getCurrentKeyboardFocusManager();
  1022.       Object var1 = null;
  1023.       LinkedList var12;
  1024.       synchronized(heavyweightRequests) {
  1025.          if (currentLightweightRequests == null) {
  1026.             return;
  1027.          }
  1028.  
  1029.          clearingCurrentLightweightRequests = true;
  1030.          var12 = currentLightweightRequests;
  1031.          currentLightweightRequests = null;
  1032.       }
  1033.  
  1034.       try {
  1035.          if (var12 != null) {
  1036.             Iterator var2 = var12.iterator();
  1037.  
  1038.             while(var2.hasNext()) {
  1039.                Component var3 = var0.getGlobalFocusOwner();
  1040.                if (var3 == null) {
  1041.                   break;
  1042.                }
  1043.  
  1044.                LightweightFocusRequest var4 = (LightweightFocusRequest)var2.next();
  1045.                CausedFocusEvent var5 = new CausedFocusEvent(var3, 1005, var4.temporary, var4.component, var4.cause);
  1046.                CausedFocusEvent var6 = new CausedFocusEvent(var4.component, 1004, var4.temporary, var3, var4.cause);
  1047.                var5.isPosted = true;
  1048.                var3.dispatchEvent(var5);
  1049.                var6.isPosted = true;
  1050.                var4.component.dispatchEvent(var6);
  1051.             }
  1052.          }
  1053.       } finally {
  1054.          clearingCurrentLightweightRequests = false;
  1055.          Object var13 = null;
  1056.       }
  1057.  
  1058.    }
  1059.  
  1060.    static FocusEvent retargetUnexpectedFocusEvent(FocusEvent var0) {
  1061.       synchronized(heavyweightRequests) {
  1062.          if (removeFirstRequest()) {
  1063.             return (FocusEvent)retargetFocusEvent(var0);
  1064.          } else {
  1065.             Component var2 = var0.getComponent();
  1066.             Component var3 = var0.getOppositeComponent();
  1067.             boolean var4 = false;
  1068.             if (var0.getID() == 1005 && (var3 == null || isTemporary(var3, var2))) {
  1069.                var4 = true;
  1070.             }
  1071.  
  1072.             return new CausedFocusEvent(var2, var0.getID(), var4, var3, Cause.NATIVE_SYSTEM);
  1073.          }
  1074.       }
  1075.    }
  1076.  
  1077.    static FocusEvent retargetFocusGained(FocusEvent var0) {
  1078.       assert var0.getID() == 1004;
  1079.  
  1080.       Component var1 = getCurrentKeyboardFocusManager().getGlobalFocusOwner();
  1081.       Component var2 = var0.getComponent();
  1082.       Component var3 = var0.getOppositeComponent();
  1083.       Component var4 = getHeavyweight(var2);
  1084.       synchronized(heavyweightRequests) {
  1085.          HeavyweightFocusRequest var6 = (HeavyweightFocusRequest)(heavyweightRequests.size() > 0 ? heavyweightRequests.getFirst() : null);
  1086.          if (var6 == java.awt.KeyboardFocusManager.HeavyweightFocusRequest.CLEAR_GLOBAL_FOCUS_OWNER) {
  1087.             return retargetUnexpectedFocusEvent(var0);
  1088.          } else {
  1089.             if (var2 != null && var4 == null && var6 != null && var2 == var6.getFirstLightweightRequest().component) {
  1090.                var2 = var6.heavyweight;
  1091.                var4 = var2;
  1092.             }
  1093.  
  1094.             if (var6 != null && var4 == var6.heavyweight) {
  1095.                heavyweightRequests.removeFirst();
  1096.                LightweightFocusRequest var7 = (LightweightFocusRequest)var6.lightweightRequests.removeFirst();
  1097.                Component var8 = var7.component;
  1098.                if (var1 != null) {
  1099.                   newFocusOwner = var8;
  1100.                }
  1101.  
  1102.                boolean var9 = var3 != null && !isTemporary(var8, var3) ? var7.temporary : false;
  1103.                if (var6.lightweightRequests.size() > 0) {
  1104.                   currentLightweightRequests = var6.lightweightRequests;
  1105.                   EventQueue.invokeLater(new 1());
  1106.                }
  1107.  
  1108.                return new CausedFocusEvent(var8, 1004, var9, var3, var7.cause);
  1109.             } else {
  1110.                return (FocusEvent)(var1 == null || var1.getContainingWindow() != var2 || var6 != null && var2 == var6.heavyweight ? retargetUnexpectedFocusEvent(var0) : new CausedFocusEvent(var1, 1004, false, (Component)null, Cause.ACTIVATION));
  1111.             }
  1112.          }
  1113.       }
  1114.    }
  1115.  
  1116.    static FocusEvent retargetFocusLost(FocusEvent var0) {
  1117.       assert ((FocusEvent)var0).getID() == 1005;
  1118.  
  1119.       Component var1 = getCurrentKeyboardFocusManager().getGlobalFocusOwner();
  1120.       Component var2 = ((FocusEvent)var0).getOppositeComponent();
  1121.       Component var3 = getHeavyweight(var2);
  1122.       synchronized(heavyweightRequests) {
  1123.          HeavyweightFocusRequest var5 = (HeavyweightFocusRequest)(heavyweightRequests.size() > 0 ? heavyweightRequests.getFirst() : null);
  1124.          if (var5 == java.awt.KeyboardFocusManager.HeavyweightFocusRequest.CLEAR_GLOBAL_FOCUS_OWNER) {
  1125.             if (var1 != null) {
  1126.                heavyweightRequests.removeFirst();
  1127.                return new CausedFocusEvent(var1, 1005, false, (Component)null, Cause.CLEAR_GLOBAL_FOCUS_OWNER);
  1128.             }
  1129.          } else {
  1130.             if (var2 == null) {
  1131.                if (var1 != null) {
  1132.                   return new CausedFocusEvent(var1, 1005, true, (Component)null, Cause.ACTIVATION);
  1133.                }
  1134.  
  1135.                return (FocusEvent)var0;
  1136.             }
  1137.  
  1138.             if (var5 != null && (var3 == var5.heavyweight || var3 == null && var2 == var5.getFirstLightweightRequest().component)) {
  1139.                if (var1 == null) {
  1140.                   return (FocusEvent)var0;
  1141.                }
  1142.  
  1143.                LightweightFocusRequest var6 = (LightweightFocusRequest)var5.lightweightRequests.getFirst();
  1144.                boolean var7 = isTemporary(var2, var1) ? true : var6.temporary;
  1145.                return new CausedFocusEvent(var1, 1005, var7, var6.component, var6.cause);
  1146.             }
  1147.  
  1148.             if (focusedWindowChanged(var2, var1)) {
  1149.                if (!((FocusEvent)var0).isTemporary() && var1 != null) {
  1150.                   var0 = new CausedFocusEvent(var1, 1005, true, var2, Cause.ACTIVATION);
  1151.                }
  1152.  
  1153.                return (FocusEvent)var0;
  1154.             }
  1155.          }
  1156.  
  1157.          return retargetUnexpectedFocusEvent((FocusEvent)var0);
  1158.       }
  1159.    }
  1160.  
  1161.    static AWTEvent retargetFocusEvent(AWTEvent var0) {
  1162.       if (clearingCurrentLightweightRequests) {
  1163.          return (AWTEvent)var0;
  1164.       } else {
  1165.          KeyboardFocusManager var1 = getCurrentKeyboardFocusManager();
  1166.          if (focusLog.isLoggable(Level.FINE)) {
  1167.             if (var0 instanceof FocusEvent || var0 instanceof WindowEvent) {
  1168.                focusLog.log(Level.FINE, ">>> {0}", new Object[]{var0});
  1169.             }
  1170.  
  1171.             if (focusLog.isLoggable(Level.FINER) && var0 instanceof KeyEvent) {
  1172.                focusLog.log(Level.FINER, "    focus owner is {0}", new Object[]{var1.getGlobalFocusOwner()});
  1173.                focusLog.log(Level.FINER, ">>> {0}", new Object[]{var0});
  1174.             }
  1175.          }
  1176.  
  1177.          synchronized(heavyweightRequests) {
  1178.             if (newFocusOwner != null && ((AWTEvent)var0).getID() == 1005) {
  1179.                FocusEvent var3 = (FocusEvent)var0;
  1180.                if (var1.getGlobalFocusOwner() == var3.getComponent() && var3.getOppositeComponent() == newFocusOwner) {
  1181.                   newFocusOwner = null;
  1182.                   return (AWTEvent)var0;
  1183.                }
  1184.             }
  1185.          }
  1186.  
  1187.          processCurrentLightweightRequests();
  1188.          switch (((AWTEvent)var0).getID()) {
  1189.             case 1004:
  1190.                var0 = retargetFocusGained((FocusEvent)var0);
  1191.                break;
  1192.             case 1005:
  1193.                var0 = retargetFocusLost((FocusEvent)var0);
  1194.          }
  1195.  
  1196.          return (AWTEvent)var0;
  1197.       }
  1198.    }
  1199.  
  1200.    void clearMarkers() {
  1201.    }
  1202.  
  1203.    static boolean removeFirstRequest() {
  1204.       KeyboardFocusManager var0 = getCurrentKeyboardFocusManager();
  1205.       synchronized(heavyweightRequests) {
  1206.          HeavyweightFocusRequest var2 = (HeavyweightFocusRequest)(heavyweightRequests.size() > 0 ? heavyweightRequests.getFirst() : null);
  1207.          if (var2 != null) {
  1208.             heavyweightRequests.removeFirst();
  1209.             if (var2.lightweightRequests != null) {
  1210.                Iterator var3 = var2.lightweightRequests.iterator();
  1211.  
  1212.                while(var3.hasNext()) {
  1213.                   var0.dequeueKeyEvents(-1L, ((LightweightFocusRequest)var3.next()).component);
  1214.                }
  1215.             }
  1216.          }
  1217.  
  1218.          if (heavyweightRequests.size() == 0) {
  1219.             var0.clearMarkers();
  1220.          }
  1221.  
  1222.          return heavyweightRequests.size() > 0;
  1223.       }
  1224.    }
  1225.  
  1226.    static void removeLastFocusRequest(Component var0) {
  1227.       DebugHelper var10000 = dbg;
  1228.       KeyboardFocusManager var1 = getCurrentKeyboardFocusManager();
  1229.       synchronized(heavyweightRequests) {
  1230.          HeavyweightFocusRequest var3 = (HeavyweightFocusRequest)(heavyweightRequests.size() > 0 ? heavyweightRequests.getLast() : null);
  1231.          if (var3 != null && var3.heavyweight == var0) {
  1232.             heavyweightRequests.removeLast();
  1233.          }
  1234.  
  1235.          if (heavyweightRequests.size() == 0) {
  1236.             var1.clearMarkers();
  1237.          }
  1238.  
  1239.       }
  1240.    }
  1241.  
  1242.    private static boolean focusedWindowChanged(Component var0, Component var1) {
  1243.       Window var2 = Component.getContainingWindow(var0);
  1244.       Window var3 = Component.getContainingWindow(var1);
  1245.       if (var2 == null && var3 == null) {
  1246.          return true;
  1247.       } else if (var2 == null) {
  1248.          return true;
  1249.       } else if (var3 == null) {
  1250.          return true;
  1251.       } else {
  1252.          return var2 != var3;
  1253.       }
  1254.    }
  1255.  
  1256.    private static boolean isTemporary(Component var0, Component var1) {
  1257.       Window var2 = Component.getContainingWindow(var0);
  1258.       Window var3 = Component.getContainingWindow(var1);
  1259.       if (var2 == null && var3 == null) {
  1260.          return false;
  1261.       } else if (var2 == null) {
  1262.          return true;
  1263.       } else if (var3 == null) {
  1264.          return false;
  1265.       } else {
  1266.          return var2 != var3;
  1267.       }
  1268.    }
  1269.  
  1270.    static Component getHeavyweight(Component var0) {
  1271.       if (var0 != null && var0.getPeer() != null) {
  1272.          return (Component)(var0.getPeer() instanceof LightweightPeer ? var0.getNativeContainer() : var0);
  1273.       } else {
  1274.          return null;
  1275.       }
  1276.    }
  1277.  
  1278.    private static boolean isProxyActiveImpl(KeyEvent var0) {
  1279.       if (proxyActive == null) {
  1280.          proxyActive = (Field)AccessController.doPrivileged(new 2());
  1281.       }
  1282.  
  1283.       try {
  1284.          return proxyActive.getBoolean(var0);
  1285.       } catch (IllegalAccessException var2) {
  1286.          assert false;
  1287.  
  1288.          return false;
  1289.       }
  1290.    }
  1291.  
  1292.    static boolean isProxyActive(KeyEvent var0) {
  1293.       return !GraphicsEnvironment.isHeadless() ? isProxyActiveImpl(var0) : false;
  1294.    }
  1295.  
  1296.    // $FF: synthetic method
  1297.    static DebugHelper access$000() {
  1298.       return dbg;
  1299.    }
  1300.  
  1301.    static {
  1302.       Toolkit.loadLibraries();
  1303.       if (!GraphicsEnvironment.isHeadless()) {
  1304.          initIDs();
  1305.       }
  1306.  
  1307.       dbg = DebugHelper.create(KeyboardFocusManager.class);
  1308.       defaultFocusTraversalKeyPropertyNames = new String[]{"forwardDefaultFocusTraversalKeys", "backwardDefaultFocusTraversalKeys", "upCycleDefaultFocusTraversalKeys", "downCycleDefaultFocusTraversalKeys"};
  1309.       defaultFocusTraversalKeyStrokes = new AWTKeyStroke[][]{{AWTKeyStroke.getAWTKeyStroke(9, 0, false), AWTKeyStroke.getAWTKeyStroke(9, 130, false)}, {AWTKeyStroke.getAWTKeyStroke(9, 65, false), AWTKeyStroke.getAWTKeyStroke(9, 195, false)}, new AWTKeyStroke[0], new AWTKeyStroke[0]};
  1310.       mostRecentFocusOwners = new WeakHashMap();
  1311.       heavyweightRequests = new LinkedList();
  1312.       newFocusOwner = null;
  1313.    }
  1314. }
  1315.