Package org.jnode.driver.console.textscreen

Examples of org.jnode.driver.console.textscreen.ConsoleKeyEventBindings


     * Remove bindings for an action.
     *
     * @param console the console whose bindings are to be changed
     */
    private void removeBindings(TextConsole console) {
        ConsoleKeyEventBindings bindings = console.getKeyEventBindings();
        // This throws an unchecked exception if the action is not supplied.  It signals
        // a bug in the command syntax and should be allowed to propagate to the shell.
        KeyboardReaderAction action = argAction.getValue();
       
        if (argVkSpec.isSet() || argCharacter.isSet()) {
            // If virtual key names were supplied, remove only those bindings.
            if (argVkSpec.isSet()) {
                for (VirtualKey vk : argVkSpec.getValues()) {
                    bindings.unsetVKAction(vk);
                }
            }
            if (argCharacter.isSet()) {
                for (char ch : argCharacter.getValues()) {
                    bindings.unsetCharAction(ch);
                }
            }
        } else {
            // Otherwise remove all bindings for the action.
            int count = 0;
            List<Character> chars = buildCharMap(bindings).get(action);
            if (chars != null) {
                for (char ch : chars) {
                    bindings.unsetCharAction(ch);
                    count++;
                }
            }
            List<VirtualKey> vks = buildVKMap(bindings).get(action);
            if (vks != null) {
                for (VirtualKey vk : vks) {
                    bindings.unsetVKAction(vk);
                    count++;
                }
            }
            if (count == 0) {
                err.format(err_no_bind, action);
View Full Code Here


        console.setKeyEventBindings(bindings);
        out.format(fmt_update, action);
    }
   
    private void addBindings(TextConsole console) {
        ConsoleKeyEventBindings bindings = console.getKeyEventBindings();
        // This throws an unchecked exception if the action is not supplied.  It signals
        // a bug in the command syntax and should be allowed to propagate to the shell.
        KeyboardReaderAction action = argAction.getValue();

        int count = 0;
        if (argVkSpec.isSet()) {
            for (VirtualKey vk : argVkSpec.getValues()) {
                bindings.setVKAction(vk, action);
                count++;
            }
        }
        if (argCharacter.isSet()) {
            for (char ch : argCharacter.getValues()) {
                bindings.setCharAction(ch, action);
                count++;
            }
        }
        if (count > 0) {
            console.setKeyEventBindings(bindings);
View Full Code Here

        console.setKeyEventBindings(ConsoleKeyEventBindings.createDefault());
        out.println(str_reset);
    }
   
    private void displayBindings(TextConsole console) {
        ConsoleKeyEventBindings bindings = console.getKeyEventBindings();
       
        Map<KeyboardReaderAction, List<Character>> charMap = buildCharMap(bindings);
        Map<KeyboardReaderAction, List<VirtualKey>> vkMap = buildVKMap(bindings);
       
        for (KeyboardReaderAction action : KeyboardReaderAction.values()) {
View Full Code Here

TOP

Related Classes of org.jnode.driver.console.textscreen.ConsoleKeyEventBindings

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.