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
6   51   2   3
0   23   0.33   2
2     1  
1    
11.1% of code in this file is excluded from these metrics.
 
  JListSelectionValuesQuery       Line # 35 6 11.1% 2 0 100% 1.0
 
No Tests
 
1    /*
2    * Created on Nov 1, 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.driver;
17   
18    import static org.fest.swing.edt.GuiActionRunner.execute;
19   
20    import java.util.ArrayList;
21    import java.util.List;
22   
23    import javax.swing.JList;
24   
25    import org.fest.swing.annotation.RunsInEDT;
26    import org.fest.swing.cell.JListCellReader;
27    import org.fest.swing.edt.GuiQuery;
28   
29    /**
30    * Understands an action, executed in the event dispatch thread, that returns an array of <code>String</code>s that
31    * represents the selection of a given <code>{@link JList}</code>
32    *
33    * @author Alex Ruiz
34    */
 
35    final class JListSelectionValuesQuery {
36   
 
37  15 toggle @RunsInEDT
38    static List<String> selectionValues(final JList list, final JListCellReader cellReader) {
39  15 return execute(new GuiQuery<List<String>>() {
 
40  15 toggle protected List<String> executeInEDT() {
41  15 List<String> values = new ArrayList<String>();
42  15 int[] selectedIndices = list.getSelectedIndices();
43  15 for (int index : selectedIndices)
44  20 values.add(cellReader.valueAt(list, index));
45  15 return values;
46    }
47    });
48    }
49   
 
50    toggle private JListSelectionValuesQuery() {}
51    }