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
9   65   6   1.5
0   34   0.67   6
6     1  
1    
 
  WindowMetrics       Line # 27 9 0% 6 0 100% 1.0
 
No Tests
 
1    /*
2    * Created on Oct 18, 2007
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 @2007-2010 the original author or authors.
15    */
16    package org.fest.swing.monitor;
17   
18    import java.awt.*;
19   
20    import org.fest.swing.annotation.RunsInCurrentThread;
21   
22    /**
23    * Understands some window metrics.
24    *
25    * @author Alex Ruiz
26    */
 
27    final class WindowMetrics {
28   
29    private final Window window;
30   
31    final Insets insets;
32   
 
33  2696 toggle @RunsInCurrentThread
34    WindowMetrics(Window w) {
35  2696 this.window = w;
36  2696 insets = w.getInsets();
37    }
38   
 
39  2693 toggle @RunsInCurrentThread
40    Point center() {
41  2693 int x = window.getX() + insets.left + horizontalCenter();
42  2693 int y = window.getY() + insets.top + verticalCenter();
43  2693 return new Point(x, y);
44    }
45   
 
46  2693 toggle @RunsInCurrentThread
47    private int horizontalCenter() {
48  2693 return (window.getWidth() - leftAndRightInsets()) / 2;
49    }
50   
 
51  2697 toggle @RunsInCurrentThread
52    int leftAndRightInsets() {
53  2697 return insets.left + insets.right;
54    }
55   
 
56  2693 toggle @RunsInCurrentThread
57    private int verticalCenter() {
58  2693 return (window.getHeight() - topAndBottomInsets()) / 2;
59    }
60   
 
61  2697 toggle @RunsInCurrentThread
62    int topAndBottomInsets() {
63  2697 return insets.top + insets.bottom;
64    }
65    }