|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| DefaultKeyStrokeMappingProvider | Line # 29 | 1 | 0% | 1 | 0 | 100% |
1.0
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
| DefaultKeyStrokeMappingProvider.LazyLoadingSingleton | Line # 47 | 0 | - | 0 | 0 | - |
-1.0
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||
| No Tests | |||
| 1 | /* | |
| 2 | * Created on Mar 26, 2008 | |
| 3 | * | |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except | |
| 5 | * in compliance with the License. You may obtain a copy of the License at | |
| 6 | * | |
| 7 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 8 | * | |
| 9 | * Unless required by applicable law or agreed to in writing, software distributed under the License | |
| 10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express | |
| 11 | * or implied. See the License for the specific language governing permissions and limitations under | |
| 12 | * the License. | |
| 13 | * | |
| 14 | * Copyright @2008-2010 the original author or authors. | |
| 15 | */ | |
| 16 | package org.fest.swing.keystroke; | |
| 17 | ||
| 18 | import static org.fest.swing.keystroke.KeyStrokeMappings.defaultMappings; | |
| 19 | ||
| 20 | import java.util.*; | |
| 21 | ||
| 22 | import javax.swing.KeyStroke; | |
| 23 | ||
| 24 | /** | |
| 25 | * Understands a default mapping of characters and <code>{@link KeyStroke}</code>s. | |
| 26 | * | |
| 27 | * @author Alex Ruiz | |
| 28 | */ | |
| 29 | public class DefaultKeyStrokeMappingProvider implements KeyStrokeMappingProvider { | |
| 30 | ||
| 31 | /** | |
| 32 | * Returns the default mapping of characters and <code>{@link KeyStroke}</code>s. This provider will only return | |
| 33 | * the mappings for following keys: | |
| 34 | * <ul> | |
| 35 | * <li>Backspace</li> | |
| 36 | * <li>Delete</li> | |
| 37 | * <li>Enter</li> | |
| 38 | * <li>Escape</li> | |
| 39 | * <li>Tab</li> | |
| 40 | * </ul> | |
| 41 | * @return the default mapping of characters and <code>KeyStroke</code>s | |
| 42 | */ | |
| 43 | 1354 |
public Collection<KeyStrokeMapping> keyStrokeMappings() { |
| 44 | 1354 | return LazyLoadingSingleton.instance; |
| 45 | } | |
| 46 | ||
| 47 | private static class LazyLoadingSingleton { | |
| 48 | static List<KeyStrokeMapping> instance = new ArrayList<KeyStrokeMapping>(defaultMappings()); | |
| 49 | } | |
| 50 | } | |
|
||||||||||||