0N/A/*
2362N/A * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/Apackage java.awt;
0N/A
0N/Aimport java.awt.event.KeyEvent;
0N/A
0N/A
0N/A/**
0N/A * A KeyEventPostProcessor cooperates with the current KeyboardFocusManager
0N/A * in the final resolution of all unconsumed KeyEvents. KeyEventPostProcessors
0N/A * registered with the current KeyboardFocusManager will receive KeyEvents
0N/A * after the KeyEvents have been dispatched to and handled by their targets.
0N/A * KeyEvents that would have been otherwise discarded because no Component in
0N/A * the application currently owns the focus will also be forwarded to
0N/A * registered KeyEventPostProcessors. This will allow applications to implement
0N/A * features that require global KeyEvent post-handling, such as menu shortcuts.
0N/A * <p>
0N/A * Note that the KeyboardFocusManager itself implements KeyEventPostProcessor.
0N/A * By default, the current KeyboardFocusManager will be the final
0N/A * KeyEventPostProcessor in the chain. The current KeyboardFocusManager cannot
0N/A * be completely deregistered as a KeyEventPostProcessor. However, if a
0N/A * KeyEventPostProcessor reports that no further post-processing of the
0N/A * KeyEvent should take place, the AWT will consider the event fully handled
0N/A * and will take no additional action with regard to the event. (While it is
0N/A * possible for client code to register the current KeyboardFocusManager as
0N/A * a KeyEventPostProcessor one or more times, this is usually unnecessary and
0N/A * not recommended.)
0N/A *
0N/A * @author David Mendenhall
0N/A *
0N/A * @see KeyboardFocusManager#addKeyEventPostProcessor
0N/A * @see KeyboardFocusManager#removeKeyEventPostProcessor
0N/A * @since 1.4
0N/A */
0N/Apublic interface KeyEventPostProcessor {
0N/A
0N/A /**
0N/A * This method is called by the current KeyboardFocusManager, requesting
0N/A * that this KeyEventPostProcessor perform any necessary post-processing
0N/A * which should be part of the KeyEvent's final resolution. At the time
0N/A * this method is invoked, typically the KeyEvent has already been
0N/A * dispatched to and handled by its target. However, if no Component in
0N/A * the application currently owns the focus, then the KeyEvent has not
0N/A * been dispatched to any Component. Typically, KeyEvent post-processing
0N/A * will be used to implement features which require global KeyEvent
0N/A * post-handling, such as menu shortcuts. Note that if a
0N/A * KeyEventPostProcessor wishes to dispatch the KeyEvent, it must use
0N/A * <code>redispatchEvent</code> to prevent the AWT from recursively
0N/A * requesting that this KeyEventPostProcessor perform post-processing
0N/A * of the event again.
0N/A * <p>
0N/A * If an implementation of this method returns <code>false</code>, then the
0N/A * KeyEvent is passed to the next KeyEventPostProcessor in the chain,
0N/A * ending with the current KeyboardFocusManager. If an implementation
0N/A * returns <code>true</code>, the KeyEvent is assumed to have been fully
0N/A * handled (although this need not be the case), and the AWT will take no
0N/A * further action with regard to the KeyEvent. If an implementation
0N/A * consumes the KeyEvent but returns <code>false</code>, the consumed
0N/A * event will still be passed to the next KeyEventPostProcessor in the
0N/A * chain. It is important for developers to check whether the KeyEvent has
0N/A * been consumed before performing any post-processing of the KeyEvent. By
0N/A * default, the current KeyboardFocusManager will perform no post-
0N/A * processing in response to a consumed KeyEvent.
0N/A *
0N/A * @param e the KeyEvent to post-process
0N/A * @return <code>true</code> if the AWT should take no further action with
0N/A * regard to the KeyEvent; <code>false</code> otherwise
0N/A * @see KeyboardFocusManager#redispatchEvent
0N/A */
0N/A boolean postProcessKeyEvent(KeyEvent e);
0N/A}