EMMA Coverage Report (generated Tue Feb 12 22:23:49 ICT 2008)
[all classes][net.sourceforge.hivegui.autowait]

COVERAGE SUMMARY FOR SOURCE FILE [WaitCursorEventQueue.java]

nameclass, %method, %block, %line, %
WaitCursorEventQueue.java0%   (0/1)0%   (0/6)0%   (0/105)0%   (0/24)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class WaitCursorEventQueue0%   (0/1)0%   (0/6)0%   (0/105)0%   (0/24)
<static initializer> 0%   (0/1)0%   (0/4)0%   (0/1)
WaitCursorEventQueue (int): void 0%   (0/1)0%   (0/18)0%   (0/4)
close (): void 0%   (0/1)0%   (0/6)0%   (0/3)
dispatchEvent (AWTEvent): void 0%   (0/1)0%   (0/67)0%   (0/12)
getNextEvent (): AWTEvent 0%   (0/1)0%   (0/6)0%   (0/2)
trigger (): void 0%   (0/1)0%   (0/4)0%   (0/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 
15// Original copyright is held by Nathan Arthur
16// [Java Specialists' Newsletter, Issue #75, 2003-07-29]
17 
18package net.sourceforge.hivegui.autowait;
19 
20import java.awt.AWTEvent;
21import java.awt.EventQueue;
22 
23import org.apache.commons.logging.Log;
24import org.apache.commons.logging.LogFactory;
25 
26public class WaitCursorEventQueue extends EventQueue implements DelayTimerCallback
27{
28        static private final Log        _logger = LogFactory.getLog(WaitCursorEventQueue.class);
29 
30        public WaitCursorEventQueue(int delay)
31        {
32                _waitTimer = new DelayTimer(this, delay);
33                _cursorManager = new CursorManager(_waitTimer);
34        }
35 
36        public void close()
37        {
38                _waitTimer.quit();
39                pop();
40        }
41 
42        @Override protected void dispatchEvent(AWTEvent event)
43        {
44                if (_logger.isDebugEnabled())
45                {
46                        _logger.debug("ENTER dispatchEvent() event=" + event);
47                }
48                _cursorManager.push(event.getSource());
49                _waitTimer.startTimer();
50                try
51                {
52                        super.dispatchEvent(event);
53                }
54                finally
55                {
56                        _waitTimer.stopTimer();
57                        _cursorManager.pop();
58                        if (_logger.isDebugEnabled())
59                        {
60                                _logger.debug("LEAVE dispatchEvent() event=" + event);
61                        }
62                }
63        }
64 
65        @Override public AWTEvent getNextEvent() throws InterruptedException
66        {
67                // started by pop(), this catches modal dialogs
68                _waitTimer.stopTimer(); 
69                // closing that do work afterwards
70                return super.getNextEvent();
71        }
72 
73        public void trigger()
74        {
75                _cursorManager.setCursor();
76        }
77 
78        private final CursorManager        _cursorManager;
79        private final DelayTimer        _waitTimer;
80}

[all classes][net.sourceforge.hivegui.autowait]
EMMA 2.0.5312 (C) Vladimir Roubtsov