home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 1998 November
/
Chip_1998-11_cd.bin
/
tema
/
Cafe
/
jfc.bin
/
Keymap.java
< prev
next >
Wrap
Text File
|
1998-02-26
|
4KB
|
138 lines
/*
* @(#)Keymap.java 1.9 98/01/14
*
* Copyright (c) 1997 Sun Microsystems, Inc. All Rights Reserved.
*
* This software is the confidential and proprietary information of Sun
* Microsystems, Inc. ("Confidential Information"). You shall not
* disclose such Confidential Information and shall use it only in
* accordance with the terms of the license agreement you entered into
* with Sun.
*
* SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE
* SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
* IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
* PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR ANY DAMAGES
* SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
* THIS SOFTWARE OR ITS DERIVATIVES.
*
*/
package com.sun.java.swing.text;
import com.sun.java.swing.Action;
import com.sun.java.swing.KeyStroke;
/**
* A collection of bindings of KeyStrokes to actions. The
* bindings are basically name-value pairs that potentially
* resolve in a hierarchy.
*
* @author Timothy Prinzing
* @version 1.9 01/14/98
*/
public interface Keymap {
/**
* Fetches the name of the set of key-bindings.
*
* @return the name
*/
public String getName();
/**
* Fetch the default action to fire if a
* key is typed (ie a KEY_TYPED KeyEvent is received)
* and there is no binding for it. Typically this
* would be some action that inserts text so that
* the keymap doesn't require an action for each
* possible key.
*/
public Action getDefaultAction();
/**
* Set the default action to fire if a key is typed.
*/
public void setDefaultAction(Action a);
/**
* Fetches the action appropriate for the given symbolic
* event sequence. This is used by JTextController to
* determine how to interpret key sequences. If the
* binding is not resolved locally, an attempt is made
* to resolve through the parent keymap, if one is set.
*
* @param key the key sequence
* @returns the action associated with the key
* sequence if one is defined, otherwise null
*/
public Action getAction(KeyStroke key);
/**
* Fetches all of the keystrokes in this map that
* are bound to some action.
*
* @return the list of keystrokes
*/
public KeyStroke[] getBoundKeyStrokes();
/**
* Fetches all of the actions defined in this keymap.
*
* @return the list of actions
*/
public Action[] getBoundActions();
/**
* Fetches the keystrokes that will result in
* the given action.
*
* @param a the action
* @return the list of keystrokes
*/
public KeyStroke[] getKeyStrokesForAction(Action a);
/**
* Determines if the given key sequence is locally defined.
*
* @param key the key sequence
* @return true if the key sequence is locally defined else false
*/
public boolean isLocallyDefined(KeyStroke key);
/**
* Adds a binding to the keymap.
*
* @param key the key sequence
* @param a the action
*/
public void addActionForKeyStroke(KeyStroke key, Action a);
/**
* Removes a binding from the keymap.
*
* @param keys the key sequence
*/
public void removeKeyStrokeBinding(KeyStroke keys);
/**
* Removes all bindings from the keymap.
*/
public void removeBindings();
/**
* Fetches the parent keymap used to resolve key-bindings.
*
* @return the keymap
*/
public Keymap getResolveParent();
/**
* Sets the parent keymap, which will be used to
* resolve key-bindings.
*
* @param parent the parent keymap
*/
public void setResolveParent(Keymap parent);
}