/[classpath]/classpath/javax/swing/FocusManager.java
ViewVC logotype

Diff of /classpath/javax/swing/FocusManager.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3.2.3 by gnu_andrew, Tue Aug 2 20:12:36 2005 UTC revision 1.3.2.4 by gnu_andrew, Wed Nov 2 00:43:44 2005 UTC
# Line 38  exception statement from your version. * Line 38  exception statement from your version. *
38    
39  package javax.swing;  package javax.swing;
40    
41    import java.awt.AWTEvent;
42  import java.awt.Component;  import java.awt.Component;
43    import java.awt.Container;
44  import java.awt.DefaultKeyboardFocusManager;  import java.awt.DefaultKeyboardFocusManager;
45    import java.awt.FocusTraversalPolicy;
46    import java.awt.KeyEventDispatcher;
47    import java.awt.KeyEventPostProcessor;
48  import java.awt.KeyboardFocusManager;  import java.awt.KeyboardFocusManager;
49    import java.awt.Window;
50  import java.awt.event.KeyEvent;  import java.awt.event.KeyEvent;
51    import java.beans.PropertyChangeListener;
52    import java.beans.VetoableChangeListener;
53    import java.util.Set;
54    
55  /**  /**
56   * This class has been obsoleted by the new   * This class has been obsoleted by the new
# Line 54  public abstract class FocusManager Line 63  public abstract class FocusManager
63    extends DefaultKeyboardFocusManager    extends DefaultKeyboardFocusManager
64  {  {
65    /**    /**
66     * DisabledFocusManager     * A FocusManager that wraps an AWT KeyboardFocusManager and forwards all
67       * method calls to it. This is used for compatibility with the new focus
68       * system.
69       *
70       * @author Roman Kennke (kennke@aicas.com)
71     */     */
72    static class DisabledFocusManager    private static class WrappingFocusManager
73      extends FocusManager      extends FocusManager
74    {    {
75        /**
76         * The wrapped KeyboardFocusManager.
77         */
78        private KeyboardFocusManager wrapped;
79    
80        /**
81         * Creates a new instance of WrappedFocusManager.
82         *
83         * @param fm the focus manager to wrap
84         */
85        WrappingFocusManager(KeyboardFocusManager fm)
86        {
87          wrapped = fm;
88        }
89    
90        /**
91         * Wraps {@link DefaultKeyboardFocusManager#dispatchEvent(AWTEvent)}.
92         *
93         * @param ev the event to dispatch
94         *
95         * @return <code>true</code> if the event has been dispatched,
96         *         <code>false</code> otherwise
97         */
98        public boolean dispatchEvent(AWTEvent ev)
99        {
100          return wrapped.dispatchEvent(ev);
101        }
102    
103        /**
104         * Wraps {@link DefaultKeyboardFocusManager#dispatchKeyEvent(KeyEvent)}.
105         *
106         * @param ev the event to dispatch
107         *
108         * @return <code>true</code> if the event has been dispatched,
109         *         <code>false</code> otherwise
110         */
111        public boolean dispatchKeyEvent(KeyEvent ev)
112        {
113          return wrapped.dispatchKeyEvent(ev);
114        }
115    
116        /**
117         * Wraps {@link DefaultKeyboardFocusManager#downFocusCycle(Container)}.
118         *
119         * @param c the container
120         */
121        public void downFocusCycle(Container c)
122        {
123          wrapped.downFocusCycle(c);
124        }
125    
126        /**
127         * Wraps {@link DefaultKeyboardFocusManager#upFocusCycle(Container)}.
128         *
129         * @param c the container
130         */
131        public void upFocusCycle(Container c)
132        {
133          wrapped.upFocusCycle(c);
134        }
135    
136        /**
137         * Wraps {@link DefaultKeyboardFocusManager#focusNextComponent(Component)}.
138         *
139         * @param c the component
140         */
141        public void focusNextComponent(Component c)
142        {
143          wrapped.focusNextComponent(c);
144        }
145    
146        /**
147         * Wraps
148         * {@link DefaultKeyboardFocusManager#focusPreviousComponent(Component)}.
149         *
150         * @param c the component
151         */
152        public void focusPreviousComponent(Component c)
153        {
154          wrapped.focusPreviousComponent(c);
155        }
156    
157        /**
158         * Wraps {@link DefaultKeyboardFocusManager#postProcessKeyEvent(KeyEvent)}.
159         *
160         * @param e the key event
161         *
162         * @return a boolead
163         */
164        public boolean postProcessKeyEvent(KeyEvent e)
165        {
166          return wrapped.postProcessKeyEvent(e);
167        }
168    
169        /**
170         * Wraps
171         * {@link DefaultKeyboardFocusManager#processKeyEvent(Component, KeyEvent)}.
172         *
173         * @param c the component
174         * @param e the key event
175         */
176        public void processKeyEvent(Component c, KeyEvent e)
177        {
178          wrapped.processKeyEvent(c, e);
179        }
180    
181        /**
182         * Wraps
183         * {@link KeyboardFocusManager#addKeyEventDispatcher(KeyEventDispatcher)}.
184         *
185         * @param d the dispatcher
186         */
187        public void addKeyEventDispatcher(KeyEventDispatcher d)
188        {
189          wrapped.addKeyEventDispatcher(d);
190        }
191    
192        /**
193         * Wraps
194         * {@link KeyboardFocusManager#addKeyEventPostProcessor(KeyEventPostProcessor)}.
195         *
196         * @param p the post processor
197         */
198        public void addKeyEventPostProcessor(KeyEventPostProcessor p)
199        {
200          wrapped.addKeyEventPostProcessor(p);
201        }
202    
203        /**
204         * Wraps {@link KeyboardFocusManager#addPropertyChangeListener(PropertyChangeListener)}.
205         *
206         * @param l the property change listener
207         */
208        public void addPropertyChangeListener(PropertyChangeListener l)
209        {
210          wrapped.addPropertyChangeListener(l);
211        }
212    
213        /**
214         * Wraps {@link KeyboardFocusManager#addPropertyChangeListener(String, PropertyChangeListener)}.
215         *
216         * @param p the property name
217         * @param l the property change listener
218         */
219        public void addPropertyChangeListener(String p, PropertyChangeListener l)
220        {
221          wrapped.addPropertyChangeListener(p, l);
222        }
223    
224        /**
225         * Wraps {@link KeyboardFocusManager#addVetoableChangeListener(String, VetoableChangeListener)}.
226         *
227         * @param p the property name
228         * @param l the vetoable change listener
229         */
230        public void addVetoableChangeListener(String p, VetoableChangeListener l)
231        {
232          wrapped.addVetoableChangeListener(p, l);
233        }
234    
235        /**
236         * Wraps {@link KeyboardFocusManager#addVetoableChangeListener(VetoableChangeListener)}.
237         *
238         * @param l the vetoable change listener
239         */
240        public void addVetoableChangeListener(VetoableChangeListener l)
241        {
242          wrapped.addVetoableChangeListener(l);
243        }
244    
245        /**
246         * Wraps {@link KeyboardFocusManager#clearGlobalFocusOwner()}.
247         */
248        public void clearGlobalFocusOwner()
249        {
250          wrapped.clearGlobalFocusOwner();
251        }
252    
253        /**
254         * Wraps {@link KeyboardFocusManager#getActiveWindow()}.
255         *
256         * @return the active window
257         */
258        public Window getActiveWindow()
259        {
260          return wrapped.getActiveWindow();
261        }
262    
263        /**
264         * Wraps {@link KeyboardFocusManager#getCurrentFocusCycleRoot()}.
265         *
266         * @return the focus cycle root
267         */
268        public Container getCurrentFocusCycleRoot()
269        {
270          return wrapped.getCurrentFocusCycleRoot();
271        }
272    
273        /**
274         * Wraps {@link KeyboardFocusManager#getDefaultFocusTraversalKeys(int)}.
275         *
276         * @param i the ID
277         *
278         * @return the focus traversal keys
279         */
280        public Set getDefaultFocusTraversalKeys(int i)
281        {
282          return wrapped.getDefaultFocusTraversalKeys(i);
283        }
284    
285        /**
286         * Wraps {@link KeyboardFocusManager#getDefaultFocusTraversalPolicy()}.
287         *
288         * @return the focus traversal policy
289         */
290        public FocusTraversalPolicy getDefaultFocusTraversalPolicy()
291        {
292          return wrapped.getDefaultFocusTraversalPolicy();
293        }
294    
295        /**
296         * Wraps {@link KeyboardFocusManager#getFocusedWindow()}.
297         *
298         * @return the focused window
299         */
300        public Window getFocusedWindow()
301        {
302          return wrapped.getFocusedWindow();
303        }
304    
305        /**
306         * Wraps {@link KeyboardFocusManager#getFocusOwner()}.
307         *
308         * @return the focus owner
309         */
310        public Component getFocusOwner()
311        {
312          return wrapped.getFocusOwner();
313        }
314    
315        /**
316         * Wraps {@link KeyboardFocusManager#getPermanentFocusOwner()}.
317         *
318         * @return the focus owner
319         */
320        public Component getPermanentFocusOwner()
321        {
322          return wrapped.getPermanentFocusOwner();
323        }
324    
325        /**
326         * Wraps {@link KeyboardFocusManager#getPropertyChangeListeners()}.
327         *
328         * @return the property change listeners
329         */
330        public PropertyChangeListener[] getPropertyChangeListeners()
331        {
332          return wrapped.getPropertyChangeListeners();
333        }
334    
335        /**
336         * Wraps {@link KeyboardFocusManager#getPropertyChangeListeners(String)}.
337         *
338         * @param n the property name
339         *
340         * @return the property change listeners
341         */
342        public PropertyChangeListener[] getPropertyChangeListeners(String n)
343        {
344          return wrapped.getPropertyChangeListeners(n);
345        }
346    
347        /**
348         * Wraps {@link KeyboardFocusManager#getVetoableChangeListeners()}.
349         *
350         * @return the vetoable change listeners
351         */
352        public VetoableChangeListener[] getVetoableChangeListeners()
353        {
354          return wrapped.getVetoableChangeListeners();
355        }
356    
357        /**
358         * Wraps {@link KeyboardFocusManager#getVetoableChangeListeners(String)}.
359         *
360         * @param n the property name
361         *
362         * @return the vetoable change listeners
363         */
364        public VetoableChangeListener[] getVetoableChangeListeners(String n)
365        {
366          return wrapped.getVetoableChangeListeners(n);
367        }
368    
369        
370        /**
371         * Wraps
372         * {@link KeyboardFocusManager#removeKeyEventDispatcher(KeyEventDispatcher)}.
373         *
374         * @param d the key event dispatcher to remove
375         */
376        public void removeKeyEventDispatcher(KeyEventDispatcher d)
377        {
378          wrapped.removeKeyEventDispatcher(d);
379        }
380    
381        /**
382         * Wraps
383         * {@link KeyboardFocusManager#removeKeyEventPostProcessor(KeyEventPostProcessor)}.
384         *
385         * @param p the post processor
386         */
387        public void removeKeyEventPostProcessor(KeyEventPostProcessor p)
388        {
389          wrapped.removeKeyEventPostProcessor(p);
390        }
391    
392        /**
393         * Wraps
394         * {@link KeyboardFocusManager#removePropertyChangeListener(PropertyChangeListener)}.
395         *
396         * @param l the listener
397         */
398        public void removePropertyChangeListener(PropertyChangeListener l)
399        {
400          wrapped.removePropertyChangeListener(l);
401        }
402    
403        /**
404         * Wraps
405         * {@link KeyboardFocusManager#removePropertyChangeListener(String, PropertyChangeListener)}.
406         *
407         * @param n the property name
408         * @param l the listener
409         */
410        public void removePropertyChangeListener(String n, PropertyChangeListener l)
411        {
412          wrapped.removePropertyChangeListener(n, l);
413        }
414    
415        /**
416         * Wraps
417         * {@link KeyboardFocusManager#removeVetoableChangeListener(VetoableChangeListener)}.
418         *
419         * @param l the listener
420         */
421        public void removeVetoableChangeListener(VetoableChangeListener l)
422        {
423          wrapped.removeVetoableChangeListener(l);
424        }
425    
426      /**      /**
427       * Constructor DisabledFocusManager       * Wraps
428         * {@link KeyboardFocusManager#removeVetoableChangeListener(String, VetoableChangeListener)}.
429         *
430         * @param n the property name
431         * @param l the listener
432       */       */
433      DisabledFocusManager()      public void removeVetoableChangeListener(String n, VetoableChangeListener l)
434      {      {
435        // TODO        wrapped.removeVetoableChangeListener(n, l);
436      }      }
437    
438      /**      /**
439       * processKeyEvent       * Wraps
440       * @param component TODO       * {@link KeyboardFocusManager#setDefaultFocusTraversalKeys(int, Set)}.
441       * @param event TODO       *
442         * @param id the ID
443         * @param k the keystrokes
444       */       */
445      public void processKeyEvent(Component component, KeyEvent event)      public void setDefaultFocusTraversalKeys(int id, Set k)
446      {      {
447        // TODO        wrapped.setDefaultFocusTraversalKeys(id, k);
448      }      }
449    
450      /**      /**
451       * focusNextComponent       * Wraps {@link KeyboardFocusManager#setDefaultFocusTraversalPolicy(FocusTraversalPolicy)}.
452       * @param component TODO       *
453         * @param p the focus traversal policy
454       */       */
455      public void focusNextComponent(Component component)      public void setDefaultFocusTraversalPolicy(FocusTraversalPolicy p)
456      {      {
457        // TODO        wrapped.setDefaultFocusTraversalPolicy(p);
458      }      }
459    
460      /**      /**
461       * focusPreviousComponent       * Wraps
462       * @param value0 TODO       * {@link KeyboardFocusManager#setGlobalCurrentFocusCycleRoot(Container)}.
463         *
464         * @param r the focus cycle root
465       */       */
466      public void focusPreviousComponent(Component value0)      public void setGlobalCurrentFocusCycleRoot(Container r)
467      {      {
468        // TODO        wrapped.setGlobalCurrentFocusCycleRoot(r);
469      }      }
470    }    }
471    
# Line 117  public abstract class FocusManager Line 489  public abstract class FocusManager
489     */     */
490    public static FocusManager getCurrentManager()    public static FocusManager getCurrentManager()
491    {    {
492      KeyboardFocusManager fm =      KeyboardFocusManager m =
493        KeyboardFocusManager.getCurrentKeyboardFocusManager();        KeyboardFocusManager.getCurrentKeyboardFocusManager();
494      if (fm instanceof FocusManager)      return new WrappingFocusManager(m);
       return (FocusManager) fm;  
     else  
       {  
         System.err.println("The Swing FocusManager API has been obsoleted by");  
         System.err.println("the new KeyboardFocusManager system.");  
         System.err.println("You should either not use the Swing FocusManager");  
         System.err.println("API or set the system property");  
         System.err.println  
           ("gnu.java.awt.FocusManager=javax.swing.FocusManager");  
       }  
       return null;  
495    }    }
496    
497    /**    /**

Legend:
Removed from v.1.3.2.3  
changed lines
  Added in v.1.3.2.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26