Ignore:
Timestamp:
08/31/12 10:27:50 (12 years ago)
Author:
pharms
Message:
  • use console for logging instead of logger
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  
    1212import java.util.Map; 
    1313import java.util.logging.Level; 
    14 import java.util.logging.Logger; 
     14 
     15import de.ugoe.cs.util.console.Console; 
    1516 
    1617/** 
     
    2122 */ 
    2223public class KeyboardMap { 
    23  
    24     /** */ 
    25     private static Logger LOG = Logger.getLogger(KeyboardMap.class.getName()); 
    2624 
    2725    /** */ 
     
    110108     */ 
    111109    void init() throws IllegalArgumentException { 
    112         LOG.info("initializing keymap for locale " + locale); 
     110        Console.traceln(Level.FINE, "initializing keymap for locale " + locale); 
    113111 
    114112        List<String[]> deadKeySequences = new ArrayList<String[]>(); 
     
    116114        readStream(getStream(fileName), deadKeySequences, keyStrokes); 
    117115 
    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"); 
    120118 
    121119        VirtualKeySynonyms virtualKeySynonyms = determineVirtualKeySynonyms(keyStrokes); 
     
    135133     */ 
    136134    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); 
    138137 
    139138        InputStream stream = 
     
    164163        } 
    165164        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); 
    167166            throw new IllegalArgumentException 
    168167                ("provided stream can not be read due to invalid encoding", e); 
     
    178177        } 
    179178        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); 
    181180            throw new IllegalArgumentException("no keyboard map available for locale " + locale, e); 
    182181        } 
     
    186185            } 
    187186            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"); 
    189189            } 
    190190        } 
     
    235235            for (int i = 0; i < keyStrokes.size(); i++) { 
    236236                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]); 
    239240                    keyStrokes.set(i, values); 
    240241                    alreadyAdded = true; 
     
    256257     */ 
    257258    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"); 
    259260 
    260261        VirtualKeySynonyms virtualKeySynonyms = new VirtualKeySynonyms(); 
     
    280281        for (String[] unmatchedKeyStroke : unmatchedKeyStrokes) { 
    281282            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); 
    284286            } 
    285287        } 
     
    360362                } 
    361363                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); 
    364367                    throw new IllegalArgumentException 
    365368                        ("no keyboard map available for locale " + locale); 
     
    400403 
    401404        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); 
    404407            // throw new IllegalArgumentException("no keyboard map available for locale " + 
    405408            // mLocale); 
     
    10171020        } 
    10181021        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); 
    10211024 
    10221025            return null; 
     
    20152018        } 
    20162019        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); 
    20192022 
    20202023            // if (shift) 
  • trunk/quest-misc/src/main/java/de/ugoe/cs/tasktree/keyboardmaps/VirtualKeySynonyms.java

    r655 r725  
    55import java.util.List; 
    66import java.util.Map; 
    7 import java.util.logging.Logger; 
     7import java.util.logging.Level; 
     8 
     9import de.ugoe.cs.util.console.Console; 
    810 
    911/** 
     
    1517class VirtualKeySynonyms { 
    1618     
    17     /** */ 
    18     private static Logger LOG = Logger.getLogger(KeyboardMap.class.getName()); 
    19  
    2019    /** */ 
    2120    private Map<Integer, List<VirtualKey>> synonyms = new HashMap<Integer, List<VirtualKey>>(); 
     
    4645 
    4746        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 + ")."); 
    5150        } 
    5251 
     
    7372        } 
    7473        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); 
    7675            return null; 
    7776        } 
Note: See TracChangeset for help on using the changeset viewer.