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   42   3   3
0   24   0.5   2
2     1.5  
1    
11.1% of code in this file is excluded from these metrics.
 
  JSplitPaneLocationCalculator       Line # 24 6 11.1% 3 0 100% 1.0
 
No Tests
 
1    /*
2    * Created on Nov 25, 2009
3    *
4    * Copyright @2009-2010 the original author or authors.
5    */
6    package org.fest.swing.driver;
7   
8    import static javax.swing.JSplitPane.VERTICAL_SPLIT;
9    import static org.fest.swing.driver.HorizontalJSplitPaneDividerLocation.locationToMoveDividerToHorizontally;
10    import static org.fest.swing.driver.VerticalJSplitPaneDividerLocation.locationToMoveDividerToVertically;
11    import static org.fest.swing.edt.GuiActionRunner.execute;
12   
13    import javax.swing.JSplitPane;
14   
15    import org.fest.swing.annotation.RunsInEDT;
16    import org.fest.swing.edt.GuiQuery;
17   
18    /**
19    * Understands calculation of a valid position of a <code>{@link JSplitPane}</code>'s divider, while respecting the
20    * minimum sizes of the right and left component inside the <code>JSplitPane</code>.
21    *
22    * @author Alex Ruiz
23    */
 
24    final class JSplitPaneLocationCalculator {
25   
 
26  10 toggle @RunsInEDT
27    static int locationToMoveDividerTo(final JSplitPane splitPane, final int desiredLocation) {
28  10 return execute(new GuiQuery<Integer>() {
 
29  10 toggle protected Integer executeInEDT() {
30  10 switch (splitPane.getOrientation()) {
31  5 case VERTICAL_SPLIT:
32  5 return locationToMoveDividerToVertically(splitPane, desiredLocation);
33   
34  5 default:
35  5 return locationToMoveDividerToHorizontally(splitPane, desiredLocation);
36    }
37    }
38    });
39    }
40   
 
41    toggle private JSplitPaneLocationCalculator() {}
42    }