Changeset 725 for trunk/quest-misc/src/main/java
- Timestamp:
- 08/31/12 10:27:50 (12 years ago)
- Location:
- trunk/quest-misc/src/main/java/de/ugoe/cs/tasktree/keyboardmaps
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/quest-misc/src/main/java/de/ugoe/cs/tasktree/keyboardmaps/KeyboardMap.java
r655 r725 12 12 import java.util.Map; 13 13 import java.util.logging.Level; 14 import java.util.logging.Logger; 14 15 import de.ugoe.cs.util.console.Console; 15 16 16 17 /** … … 21 22 */ 22 23 public class KeyboardMap { 23 24 /** */25 private static Logger LOG = Logger.getLogger(KeyboardMap.class.getName());26 24 27 25 /** */ … … 110 108 */ 111 109 void init() throws IllegalArgumentException { 112 LOG.info("initializing keymap for locale " + locale);110 Console.traceln(Level.FINE, "initializing keymap for locale " + locale); 113 111 114 112 List<String[]> deadKeySequences = new ArrayList<String[]>(); … … 116 114 readStream(getStream(fileName), deadKeySequences, keyStrokes); 117 115 118 LOG.info("read " + keyStrokes.size() + " key strokes and " + deadKeySequences.size()+119 " dead key sequences");116 Console.traceln(Level.FINER, "read " + keyStrokes.size() + " key strokes and " + 117 deadKeySequences.size() + " dead key sequences"); 120 118 121 119 VirtualKeySynonyms virtualKeySynonyms = determineVirtualKeySynonyms(keyStrokes); … … 135 133 */ 136 134 private InputStream getStream(String name) { 137 LOG.info("reading keymap for locale " + locale + " from resource keymaps/" + name); 135 Console.traceln 136 (Level.FINER, "reading keymap for locale " + locale + " from resource keymaps/" + name); 138 137 139 138 InputStream stream = … … 164 163 } 165 164 catch (UnsupportedEncodingException e) { 166 LOG.log(Level.WARNING, "no keyboard map available for locale " + locale,e);165 Console.traceln(Level.WARNING, "no keyboard map available for locale " + locale); 167 166 throw new IllegalArgumentException 168 167 ("provided stream can not be read due to invalid encoding", e); … … 178 177 } 179 178 catch (IOException e) { 180 LOG.log(Level.WARNING, "no keyboard map available for locale " + locale,e);179 Console.traceln(Level.WARNING, "no keyboard map available for locale " + locale); 181 180 throw new IllegalArgumentException("no keyboard map available for locale " + locale, e); 182 181 } … … 186 185 } 187 186 catch (IOException e) { 188 LOG.warning("could not close input stream for reading keyboard map"); 187 Console.traceln 188 (Level.WARNING, "could not close input stream for reading keyboard map"); 189 189 } 190 190 } … … 235 235 for (int i = 0; i < keyStrokes.size(); i++) { 236 236 if (keyStrokes.get(i)[0].equals(values[0])) { 237 LOG.finest("replacing key stroke " + values[0] + " with former keyid " + 238 keyStrokes.get(i)[1] + " with new key id " + values[1]); 237 Console.traceln(Level.FINEST, "replacing key stroke " + values[0] + 238 " with former keyid " + keyStrokes.get(i)[1] + 239 " with new key id " + values[1]); 239 240 keyStrokes.set(i, values); 240 241 alreadyAdded = true; … … 256 257 */ 257 258 private VirtualKeySynonyms determineVirtualKeySynonyms(List<String[]> keyStrokes) { 258 LOG.info("determining virtual keys and synonyms for the keymap");259 Console.traceln(Level.FINER, "determining virtual keys and synonyms for the keymap"); 259 260 260 261 VirtualKeySynonyms virtualKeySynonyms = new VirtualKeySynonyms(); … … 280 281 for (String[] unmatchedKeyStroke : unmatchedKeyStrokes) { 281 282 if (!virtualKeySynonyms.containsKey(getKeyId(unmatchedKeyStroke[1]))) { 282 LOG.finest("no virtual key mapped to key stroke " + unmatchedKeyStroke[0] + "(" + 283 unmatchedKeyStroke[1] + ") of keyboard map for locale " + locale); 283 Console.traceln(Level.FINEST, "no virtual key mapped to key stroke " + 284 unmatchedKeyStroke[0] + "(" + unmatchedKeyStroke[1] + 285 ") of keyboard map for locale " + locale); 284 286 } 285 287 } … … 360 362 } 361 363 else { 362 LOG.severe("unknown condition " + values[i] + " specified for key stroke " + 363 keyStrokeName + " through keyboard map for locale " + locale); 364 Console.traceln(Level.SEVERE, "unknown condition " + values[i] + 365 " specified for key stroke " + keyStrokeName + 366 " through keyboard map for locale " + locale); 364 367 throw new IllegalArgumentException 365 368 ("no keyboard map available for locale " + locale); … … 400 403 401 404 if (virtualKeys == null) { 402 LOG.severe("no virtual key mapped to key stroke " + keyStrokeName +403 " of keyboard map for locale " + locale);405 Console.traceln(Level.SEVERE, "no virtual key mapped to key stroke " + keyStrokeName + 406 " of keyboard map for locale " + locale); 404 407 // throw new IllegalArgumentException("no keyboard map available for locale " + 405 408 // mLocale); … … 1017 1020 } 1018 1021 else { 1019 LOG.finest("unknown virtual key for key stroke " + keyStrokeName +1020 " specified through " + "keyboard map for locale " + locale);1022 Console.traceln(Level.FINEST, "unknown virtual key for key stroke " + keyStrokeName + 1023 " specified through " + "keyboard map for locale " + locale); 1021 1024 1022 1025 return null; … … 2015 2018 } 2016 2019 else { 2017 LOG.severe("unknown key stroke name " + keyStrokeName +2018 " specified through keyboard map " + "for locale " + locale);2020 Console.traceln(Level.SEVERE, "unknown key stroke name " + keyStrokeName + 2021 " specified through keyboard map " + "for locale " + locale); 2019 2022 2020 2023 // if (shift) -
trunk/quest-misc/src/main/java/de/ugoe/cs/tasktree/keyboardmaps/VirtualKeySynonyms.java
r655 r725 5 5 import java.util.List; 6 6 import java.util.Map; 7 import java.util.logging.Logger; 7 import java.util.logging.Level; 8 9 import de.ugoe.cs.util.console.Console; 8 10 9 11 /** … … 15 17 class VirtualKeySynonyms { 16 18 17 /** */18 private static Logger LOG = Logger.getLogger(KeyboardMap.class.getName());19 20 19 /** */ 21 20 private Map<Integer, List<VirtualKey>> synonyms = new HashMap<Integer, List<VirtualKey>>(); … … 46 45 47 46 if ((existingKeyId != null) && (existingKeyId != keyId)) { 48 LOG.finest("virtual key " + virtualKey+49 " is mapped to more than one key id (current is " + existingKeyId +50 ", new is " + keyId +"). New key id will be used (" + keyId + ").");47 Console.traceln(Level.FINEST, "virtual key " + virtualKey + " is mapped to more " + 48 "than one key id (current is " + existingKeyId + ", new is " + keyId + 49 "). New key id will be used (" + keyId + ")."); 51 50 } 52 51 … … 73 72 } 74 73 else { 75 LOG.warning("no virtual key define for key id " + keyId);74 Console.traceln(Level.WARNING, "no virtual key define for key id " + keyId); 76 75 return null; 77 76 }
Note: See TracChangeset
for help on using the changeset viewer.