EMMA Coverage Report (generated Wed Feb 13 07:49:24 ICT 2008)
[all classes][net.sourceforge.hiveboard.view]

COVERAGE SUMMARY FOR SOURCE FILE [MatteGeometry.java]

nameclass, %method, %block, %line, %
MatteGeometry.java100% (1/1)100% (5/5)100% (77/77)100% (14/14)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class MatteGeometry100% (1/1)100% (5/5)100% (77/77)100% (14/14)
<static initializer> 100% (1/1)100% (5/5)100% (1/1)
MatteGeometry (JComponent, FullScreenPrefs, String): void 100% (1/1)100% (63/63)100% (10/10)
getMattePaintOrigin (): int 100% (1/1)100% (3/3)100% (1/1)
getMatteRectangle (): Rectangle 100% (1/1)100% (3/3)100% (1/1)
getMatteTextOrigin (): Point 100% (1/1)100% (3/3)100% (1/1)

1//  Copyright 2004-2007 Jean-Francois Poilpret
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// 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
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14 
15package net.sourceforge.hiveboard.view;
16 
17import java.awt.FontMetrics;
18import java.awt.Point;
19import java.awt.Rectangle;
20 
21import javax.swing.JComponent;
22import javax.swing.JTextArea;
23 
24final public class MatteGeometry
25{
26        public MatteGeometry(JComponent pane, FullScreenPrefs prefs, String content)
27        {
28                FontMetrics metrics = _fontField.getFontMetrics(prefs.getFont());
29                
30                // Calculate limit coordinates of matte
31                int height = pane.getHeight();
32                int y = (int) (prefs.getMatteY() * height);
33                y = Math.max(y, MIN_MATTE_Y);
34                y = Math.min(y, height - MATTE_BORDER - metrics.getAscent() - metrics.getDescent());
35 
36                _rectangle = new Rectangle(        0, 
37                                                                        y, 
38                                                                        metrics.stringWidth(content) + MATTE_BORDER, 
39                                                                        metrics.getHeight() + MATTE_BORDER);
40 
41                _textOrigin = y;
42                _origin = new Point(MATTE_HALF_BORDER, MATTE_HALF_BORDER + metrics.getAscent());
43        }
44        
45        public Rectangle        getMatteRectangle()
46        {
47                return _rectangle;
48        }
49        
50        public Point        getMatteTextOrigin()
51        {
52                return _origin;
53        }
54        
55        public int                getMattePaintOrigin()
56        {
57                return _textOrigin;
58        }
59        
60        static private final JTextArea        _fontField = new JTextArea();
61 
62        private Rectangle                                _rectangle;
63        private int                                                _textOrigin;
64        private Point                                        _origin;
65        
66        static private final int                MATTE_BORDER = 8;
67        static private final int                MATTE_HALF_BORDER = MATTE_BORDER / 2;
68        static private final int                MIN_MATTE_Y = 0;
69}

[all classes][net.sourceforge.hiveboard.view]
EMMA 2.0.5312 (C) Vladimir Roubtsov