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

COVERAGE SUMMARY FOR SOURCE FILE [CompoundHiliteAction.java]

nameclass, %method, %block, %line, %
CompoundHiliteAction.java100% (1/1)89%  (8/9)90%  (83/92)85%  (23/27)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class CompoundHiliteAction100% (1/1)89%  (8/9)90%  (83/92)85%  (23/27)
perform (BufferedImage): void 0%   (0/1)0%   (0/9)0%   (0/4)
CompoundHiliteAction (): void 100% (1/1)100% (13/13)100% (3/3)
addAction (DrawingAction): boolean 100% (1/1)100% (20/20)100% (5/5)
clear (): void 100% (1/1)100% (11/11)100% (3/3)
getActionArea (): Rectangle 100% (1/1)100% (3/3)100% (1/1)
isEmpty (): boolean 100% (1/1)100% (4/4)100% (1/1)
perform (Graphics2D): void 100% (1/1)100% (24/24)100% (6/6)
setHiliteColor (Color): void 100% (1/1)100% (4/4)100% (2/2)
setHiliteStroke (BasicStroke): void 100% (1/1)100% (4/4)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.drawing;
16 
17import java.awt.BasicStroke;
18import java.awt.Color;
19import java.awt.Graphics2D;
20import java.awt.Rectangle;
21import java.awt.image.BufferedImage;
22import java.util.ArrayList;
23import java.util.List;
24 
25public class CompoundHiliteAction implements HiliteAction
26{
27        public boolean        addAction(DrawingAction action)
28        {
29                if (action instanceof HiliteAction)
30                {
31                        _actions.add((HiliteAction) action);
32                        Rectangle.union(_area, action.getActionArea(), _area);
33                        return true;
34                }
35                else
36                {
37                        return false;
38                }
39        }
40        
41        public void        clear()
42        {
43                _actions.clear();
44                _area.setBounds(0, 0, 0, 0);
45        }
46        
47        public boolean        isEmpty()
48        {
49                return _actions.isEmpty();
50        }
51        
52        public void                perform(Graphics2D graf)
53        {
54                graf.setStroke(_stroke);
55                graf.setColor(_color);
56                for (HiliteAction action: _actions)
57                {
58                        action.perform(graf);
59                }
60        }
61        
62        public void        perform(BufferedImage image)
63        {
64                Graphics2D graf = image.createGraphics();
65                perform(graf);
66                graf.dispose();
67        }
68 
69        public void                setHiliteStroke(BasicStroke stroke)
70        {
71                _stroke = stroke;
72        }
73        
74        public void                setHiliteColor(Color color)
75        {
76                _color = color;
77        }
78 
79        public Rectangle        getActionArea()
80        {
81                return _area;
82        }
83        
84        private Rectangle                                _area = new Rectangle();
85        private List<HiliteAction>                _actions = new ArrayList<HiliteAction>();
86        transient private BasicStroke        _stroke;
87        transient private Color                        _color;
88}

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