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

COVERAGE SUMMARY FOR SOURCE FILE [FullScreenPanel.java]

nameclass, %method, %block, %line, %
FullScreenPanel.java100% (3/3)100% (15/15)98%  (160/163)98%  (40/41)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class FullScreenPanel100% (1/1)100% (8/8)98%  (120/123)97%  (30/31)
setMatteComment (String): void 100% (1/1)86%  (19/22)80%  (4/5)
FullScreenPanel (FullScreenPrefs, FullScreenPopupHandler, FullScreenMatteHand... 100% (1/1)100% (46/46)100% (12/12)
access$000 (FullScreenPanel): MouseListener 100% (1/1)100% (3/3)100% (1/1)
access$100 (FullScreenPanel, MouseEvent): void 100% (1/1)100% (4/4)100% (1/1)
managePopupTrigger (MouseEvent): void 100% (1/1)100% (13/13)100% (3/3)
paintChildren (Graphics): void 100% (1/1)100% (16/16)100% (4/4)
setAreaScroller (JScrollPane): void 100% (1/1)100% (14/14)100% (4/4)
setBoard (Board): void 100% (1/1)100% (5/5)100% (2/2)
     
class FullScreenPanel$1100% (1/1)100% (3/3)100% (20/20)100% (5/5)
FullScreenPanel$1 (FullScreenPanel): void 100% (1/1)100% (6/6)100% (1/1)
componentAdded (ContainerEvent): void 100% (1/1)100% (7/7)100% (2/2)
componentRemoved (ContainerEvent): void 100% (1/1)100% (7/7)100% (2/2)
     
class FullScreenPanel$PopupMouseListener100% (1/1)100% (4/4)100% (20/20)100% (5/5)
FullScreenPanel$PopupMouseListener (FullScreenPanel): void 100% (1/1)100% (6/6)100% (1/1)
FullScreenPanel$PopupMouseListener (FullScreenPanel, FullScreenPanel$1): void 100% (1/1)100% (4/4)100% (1/1)
mousePressed (MouseEvent): void 100% (1/1)100% (5/5)100% (2/2)
mouseReleased (MouseEvent): void 100% (1/1)100% (5/5)100% (2/2)

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.Color;
18import java.awt.Graphics;
19import java.awt.Graphics2D;
20import java.awt.event.ContainerEvent;
21import java.awt.event.ContainerListener;
22import java.awt.event.MouseAdapter;
23import java.awt.event.MouseEvent;
24import java.awt.event.MouseListener;
25 
26import javax.swing.JPanel;
27import javax.swing.JPopupMenu;
28import javax.swing.JScrollPane;
29import javax.swing.JViewport;
30 
31import org.jdesktop.animation.timing.Animator;
32 
33import net.sourceforge.hiveboard.Board;
34import net.sourceforge.hivegui.component.CenterLayout;
35 
36public class FullScreenPanel extends JPanel implements MatteCommentAcceptor
37{
38        public FullScreenPanel(        FullScreenPrefs                                prefs,
39                                                        FullScreenPopupHandler                popupHandler,
40                                                        FullScreenMatteHandler                matteHandler)
41        {
42                super(new CenterLayout());
43                setName("fullscreen-pane");
44                setOpaque(true);
45                setBackground(Color.WHITE);
46 
47                // Initialize fields
48                _painter = new MattePainterManager(this);
49                _prefs = prefs;
50                _popup = popupHandler.getPopup();
51                _matteHandler = matteHandler;
52 
53                // Setup listeners
54                addMouseListener(_listener);
55                _matteHandler.setCommentAcceptor(this);
56        }
57 
58        public void        setAreaScroller(JScrollPane scroller)
59        {
60                // The only component that can be put in this pane is a scrollpane
61                JViewport view = scroller.getViewport();
62                view.addContainerListener(new ContainerListener()
63                {
64                        public void        componentAdded(ContainerEvent e)
65                        {
66                                e.getChild().addMouseListener(_listener);
67                        }
68                        public void        componentRemoved(ContainerEvent e)
69                        {
70                                e.getChild().removeMouseListener(_listener);
71                        }
72                });
73                add(scroller);
74        }
75 
76        public void        setBoard(Board board)
77        {
78                _matteHandler.setBoard(board);
79        }
80        
81        public void        setMatteComment(String comment)
82        {
83                if (_animator != null && _animator.isRunning())
84                {
85                        _animator.stop();
86                }
87                _animator = _painter.createAnimator(_prefs, comment);
88                _animator.start();
89        }
90 
91        @Override protected void paintChildren(Graphics g)
92        {
93                super.paintChildren(g);
94                if (_animator != null && _animator.isRunning())
95                {
96                        _painter.paint((Graphics2D) g);
97                }
98        }
99 
100        private void        managePopupTrigger(MouseEvent e)
101        {
102                if (e.isPopupTrigger())
103                {
104                        // Popup is directly managed, never passed further
105                        _popup.show(e.getComponent(), e.getX(), e.getY());
106                }
107        }
108        
109        private class PopupMouseListener extends MouseAdapter
110        {
111                @Override public void mousePressed(MouseEvent e)
112                {
113                        managePopupTrigger(e);
114                }
115 
116                @Override public void mouseReleased(MouseEvent e)
117                {
118                        managePopupTrigger(e);
119                }
120        }
121 
122        private final MattePainterManager                _painter;
123        private Animator                                                _animator;
124        private final FullScreenPrefs                        _prefs;
125 
126        private final FullScreenMatteHandler        _matteHandler;
127        private final JPopupMenu                                _popup;
128        private final MouseListener                                _listener = new PopupMouseListener();
129}

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