Clover Coverage Report - FEST Swing 1.2
Coverage timestamp: Tue Jun 1 2010 15:19:25 PDT
../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
3   58   2   1.5
0   15   0.67   2
2     1  
1    
 
  ParsedKeyStrokeMappingProvider       Line # 34 3 0% 2 0 100% 1.0
 
No Tests
 
1    /*
2    * Created on Mar 13, 2010
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 @2010 the original author or authors.
15    */
16    package org.fest.swing.keystroke;
17   
18    import static java.util.Collections.unmodifiableList;
19    import static org.fest.swing.keystroke.KeyStrokeMappings.defaultMappings;
20   
21    import java.util.*;
22   
23    import javax.swing.KeyStroke;
24   
25    /**
26    * Understands a <code>{@link KeyStrokeMappingProvider}</code> created by parsing a text file containing all the key
27    * mappings.
28    *
29    * @author Alex Ruiz
30    *
31    * @since 1.2
32    * @see KeyStrokeMappingsParser
33    */
 
34    class ParsedKeyStrokeMappingProvider implements KeyStrokeMappingProvider {
35   
36    private final List<KeyStrokeMapping> mappings = new ArrayList<KeyStrokeMapping>(100);
37   
 
38  2 toggle ParsedKeyStrokeMappingProvider(List<KeyStrokeMapping> mappings) {
39  2 this.mappings.addAll(defaultMappings());
40  2 this.mappings.addAll(mappings);
41    }
42   
43    /**
44    * Returns the mapping of characters and <code>{@link KeyStroke}</code>s. The mappings are obtained from a text
45    * file. In addition, this provider will automatically add mappings for following keys:
46    * <ul>
47    * <li>Backspace</li>
48    * <li>Delete</li>
49    * <li>Enter</li>
50    * <li>Escape</li>
51    * <li>Tab</li>
52    * </ul>
53    * @return the mapping of characters and <code>KeyStroke</code>s.
54    */
 
55  4 toggle public Collection<KeyStrokeMapping> keyStrokeMappings() {
56  4 return unmodifiableList(mappings);
57    }
58    }