< prev index next >

src/java.desktop/share/classes/javax/swing/ActionMap.java

Print this page

        

*** 30,49 **** import java.io.Serializable; import java.util.HashMap; import java.util.Set; /** ! * <code>ActionMap</code> provides mappings from ! * <code>Object</code>s ! * (called <em>keys</em> or <em><code>Action</code> names</em>) ! * to <code>Action</code>s. ! * An <code>ActionMap</code> is usually used with an <code>InputMap</code> * to locate a particular action ! * when a key is pressed. As with <code>InputMap</code>, ! * an <code>ActionMap</code> can have a parent ! * that is searched for keys not defined in the <code>ActionMap</code>. ! * <p>As with <code>InputMap</code> if you create a cycle, eg: * <pre> * ActionMap am = new ActionMap(); * ActionMap bm = new ActionMap(): * am.setParent(bm); * bm.setParent(am); --- 30,49 ---- import java.io.Serializable; import java.util.HashMap; import java.util.Set; /** ! * {@code ActionMap} provides mappings from ! * {@code Object}s ! * (called <em>keys</em> or <em>{@code Action} names</em>) ! * to {@code Action}s. ! * An {@code ActionMap} is usually used with an {@code InputMap} * to locate a particular action ! * when a key is pressed. As with {@code InputMap}, ! * an {@code ActionMap} can have a parent ! * that is searched for keys not defined in the {@code ActionMap}. ! * <p>As with {@code InputMap} if you create a cycle, eg: * <pre> * ActionMap am = new ActionMap(); * ActionMap bm = new ActionMap(): * am.setParent(bm); * bm.setParent(am);
*** 62,101 **** /** Parent that handles any bindings we don't contain. */ private ActionMap parent; /** ! * Creates an <code>ActionMap</code> with no parent and no mappings. */ public ActionMap() { } /** ! * Sets this <code>ActionMap</code>'s parent. * ! * @param map the <code>ActionMap</code> that is the parent of this one */ public void setParent(ActionMap map) { this.parent = map; } /** ! * Returns this <code>ActionMap</code>'s parent. * ! * @return the <code>ActionMap</code> that is the parent of this one, ! * or null if this <code>ActionMap</code> has no parent */ public ActionMap getParent() { return parent; } /** ! * Adds a binding for <code>key</code> to <code>action</code>. ! * If <code>action</code> is null, this removes the current binding ! * for <code>key</code>. ! * <p>In most instances, <code>key</code> will be ! * <code>action.getValue(NAME)</code>. * * @param key a key * @param action a binding for {@code key} */ public void put(Object key, Action action) { --- 62,101 ---- /** Parent that handles any bindings we don't contain. */ private ActionMap parent; /** ! * Creates an {@code ActionMap} with no parent and no mappings. */ public ActionMap() { } /** ! * Sets this {@code ActionMap}'s parent. * ! * @param map the {@code ActionMap} that is the parent of this one */ public void setParent(ActionMap map) { this.parent = map; } /** ! * Returns this {@code ActionMap}'s parent. * ! * @return the {@code ActionMap} that is the parent of this one, ! * or null if this {@code ActionMap} has no parent */ public ActionMap getParent() { return parent; } /** ! * Adds a binding for {@code key} to {@code action}. ! * If {@code action} is null, this removes the current binding ! * for {@code key}. ! * <p>In most instances, {@code key} will be ! * {@code action.getValue(NAME)}. * * @param key a key * @param action a binding for {@code key} */ public void put(Object key, Action action) {
*** 112,123 **** arrayTable.put(key, action); } } /** ! * Returns the binding for <code>key</code>, messaging the ! * parent <code>ActionMap</code> if the binding is not locally defined. * * @param key a key * @return the binding for {@code key} */ public Action get(Object key) { --- 112,123 ---- arrayTable.put(key, action); } } /** ! * Returns the binding for {@code key}, messaging the ! * parent {@code ActionMap} if the binding is not locally defined. * * @param key a key * @return the binding for {@code key} */ public Action get(Object key) {
*** 133,163 **** } return value; } /** ! * Removes the binding for <code>key</code> from this <code>ActionMap</code>. * * @param key a key */ public void remove(Object key) { if (arrayTable != null) { arrayTable.remove(key); } } /** ! * Removes all the mappings from this <code>ActionMap</code>. */ public void clear() { if (arrayTable != null) { arrayTable.clear(); } } /** ! * Returns the <code>Action</code> names that are bound in this <code>ActionMap</code>. * * @return an array of the keys */ public Object[] keys() { if (arrayTable == null) { --- 133,163 ---- } return value; } /** ! * Removes the binding for {@code key} from this {@code ActionMap}. * * @param key a key */ public void remove(Object key) { if (arrayTable != null) { arrayTable.remove(key); } } /** ! * Removes all the mappings from this {@code ActionMap}. */ public void clear() { if (arrayTable != null) { arrayTable.clear(); } } /** ! * Returns the {@code Action} names that are bound in this {@code ActionMap}. * * @return an array of the keys */ public Object[] keys() { if (arrayTable == null) {
*** 177,188 **** } return arrayTable.size(); } /** ! * Returns an array of the keys defined in this <code>ActionMap</code> and ! * its parent. This method differs from <code>keys()</code> in that * this method includes the keys defined in the parent. * * @return an array of the keys */ public Object[] allKeys() { --- 177,188 ---- } return arrayTable.size(); } /** ! * Returns an array of the keys defined in this {@code ActionMap} and ! * its parent. This method differs from {@code keys()} in that * this method includes the keys defined in the parent. * * @return an array of the keys */ public Object[] allKeys() {
< prev index next >