/**************************************************************************************************
 **
 ** $Id: KeyManager.java 831 2006-05-01 00:27:23Z Desruisseaux $
 **
 ** $URL: http://svn.code.sf.net/p/geoapi/code/branches/2.0.x/geoapi/src/main/java/org/opengis/go/display/event/KeyManager.java $
 **
 ** Copyright (C) 2003-2005 Open GIS Consortium, Inc.
 ** All Rights Reserved. http://www.opengis.org/legal/
 **
 *************************************************************************************************/

package org.opengis.go.display.event;

/**
 * Defines a common abstraction for classes that handle key events.
 * It prescribes a stack mechanism for managing KeyHandlers.
 *
 * @author OpenGIS® consortium
 * @version $Revision: 658 $, $Date: 2006-02-23 12:09:34 +1100 (jeu., 23 févr. 2006) $
 */
public interface KeyManager extends EventManager {

    /**
     * Enables the given KeyHandler.  This KeyManager
     * then passes events only to the given KeyHandler until it is
     * either removed or another KeyHandler is enabled.
     * @param keyHandler  the new KeyHandler to enable.
     */
    public void enableKeyHandler(KeyHandler keyHandler);

    /**
     * Enables the given KeyHandler, and pushes it on the stack so that if
     * another KeyHandler gets enabled, this one will be reenabled when
     * that KeyHandler is removed.
     * @param keyHandler  The KeyHandler to enable and push.
     * @see #enableKeyHandler
     */
    public void pushKeyHandler(KeyHandler keyHandler);

    /**
     * Removes the given KeyHandler and reinstates the KeyHandler at the
     * top of the stack, if any.
     * @param keyHandler  the KeyHandler to disable and remove.
     */
    public void removeKeyHandler(KeyHandler keyHandler);

    /**
     * Replaces a KeyHandler in the stack with another KeyHandler.
     * @param existingHandler the KeyHandler to be replaced.
     * @param replacementHandler the KeyHandler that is replacing
     *        the existingHandler.
     * @return true if existingHandler was found and
     *         replaced by replacementHandler.
     */
    public boolean replaceKeyHandler(KeyHandler existingHandler,
                                     KeyHandler replacementHandler);

    /**
     * Returns the current KeyHandler or {@code null} if no
     *         handler is set.
     *
     * @return the current KeyHandler or {@code null}.
     */
    public KeyHandler getCurrentKeyHandler();

    /**
     * Returns an array of additional KeyHandlers to call for a given
     * KeyEvent, if the current event handler doesn't handle it. These
     * handlers will be called in ascending index order until the KeyEvent
     * {@linkplain java.awt.event.InputEvent#isConsumed() is consumed}.
     *
     * @return The additional KeyHandlers.
     */
    public KeyHandler[] getFallbackKeyHandlers();

}


 

Ads help maintain this website.