
jdplus.toolkit.desktop.plugin.util.KeyStrokes Maven / Gradle / Ivy
/*
* Copyright 2013 National Bank of Belgium
*
* Licensed under the EUPL, Version 1.1 or – as soon they will be approved
* by the European Commission - subsequent versions of the EUPL (the "Licence");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://ec.europa.eu/idabc/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
package jdplus.toolkit.desktop.plugin.util;
import javax.swing.*;
import javax.swing.text.DefaultEditorKit;
import java.awt.*;
import java.awt.event.KeyEvent;
import java.util.List;
import java.util.*;
import java.util.function.Supplier;
/**
* @author Philippe Charles
*/
public final class KeyStrokes {
private KeyStrokes() {
// static class
}
public static final List COPY;
public static final List PASTE;
public static final List SELECT_ALL;
public static final List DELETE;
public static final List OPEN;
public static final List CLEAR;
public static void putAll(InputMap im, Collection extends KeyStroke> keyStrokes, Object actionMapKey) {
keyStrokes.stream().forEach(o -> im.put(o, actionMapKey));
}
//
private enum ActionType {
COPY, PASTE, SELECT_ALL, DELETE, OPEN, CLEAR
}
static {
Map> keyStrokes = new TextFieldKeyStrokeSupplier().get();
COPY = keyStrokes.get(ActionType.COPY);
PASTE = keyStrokes.get(ActionType.PASTE);
SELECT_ALL = keyStrokes.get(ActionType.SELECT_ALL);
DELETE = keyStrokes.get(ActionType.DELETE);
OPEN = keyStrokes.get(ActionType.OPEN);
CLEAR = keyStrokes.get(ActionType.CLEAR);
}
private static abstract class AbstractSupplier implements Supplier
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy