1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-06 03:50:19 +02:00

git-svn-id: https://only.mawhrin.net/repos/FBReaderJ/trunk@302 6a642e6f-84f6-412e-ac94-c4a38d5a04b0

This commit is contained in:
MarinaSokol 2007-12-04 16:34:07 +00:00
parent ef76da8f9a
commit a2d25ac2c2
2 changed files with 11 additions and 2 deletions

View file

@ -197,10 +197,12 @@ public abstract class ZLApplication {
action.checkAndRun();
}
}
abstract protected ZLKeyBindings keyBindings();
//may be protected
abstract public ZLKeyBindings keyBindings();
public final void doActionByKey(String key) {
System.out.println("key in application->"+ key);
ZLAction a = getAction(keyBindings().getBinding(key));
if ((a != null) &&
(!a.useKeyDelay() /*||

View file

@ -1,7 +1,9 @@
package org.zlibrary.core.application;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import org.zlibrary.core.options.ZLIntegerOption;
import org.zlibrary.core.options.ZLIntegerRangeOption;
@ -26,6 +28,7 @@ public class ZLKeyBindings {
}
public void bindKey(String key, int code) {
//System.out.println("key-->"+key);
myBindingsMap.put(key, code);
myIsChanged = true;
}
@ -33,6 +36,10 @@ public class ZLKeyBindings {
public int getBinding(String key) {
return myBindingsMap.get(key);
}
public Set<Map.Entry<String, Integer>> getKeys() {
return Collections.unmodifiableSet(myBindingsMap.entrySet());
}
private void loadDefaultBindings() {
Map<String,Integer> keymap = new HashMap<String,Integer>();