All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nl.praegus.fitnesse.slim.util.KeyMapping Maven / Gradle / Ivy

There is a newer version: 0.0.22
Show newest version
package nl.praegus.fitnesse.slim.util;

import nl.hsac.fitnesse.fixture.slim.SlimFixtureException;

import java.awt.event.KeyEvent;
import java.util.HashMap;
import java.util.Map;

public class KeyMapping {

    private KeyMapping() {
        // constructor is private cause everything is static
    }

    private static Map keyMap = new HashMap<>();

    static {
        keyMap.put("control", KeyEvent.VK_CONTROL);
        keyMap.put("v", KeyEvent.VK_V);
    }

    public static Integer getKey(String key) {
        Integer keyStoke = keyMap.get(key.toLowerCase().trim());

        if (keyStoke != null) {
            return keyStoke;
        }
        throw new SlimFixtureException("Key: " + key + " does not exist or is not supported yet");
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy