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

COVERAGE SUMMARY FOR SOURCE FILE [AbstractTool.java]

nameclass, %method, %block, %line, %
AbstractTool.java100% (1/1)100% (9/9)100% (78/78)100% (23/23)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AbstractTool100% (1/1)100% (9/9)100% (78/78)100% (23/23)
AbstractTool (): void 100% (1/1)100% (3/3)100% (1/1)
getCursor (): Cursor 100% (1/1)100% (3/3)100% (1/1)
init (String, ToolHandler): void 100% (1/1)100% (28/28)100% (8/8)
initActions (ActionMap): void 100% (1/1)100% (1/1)100% (1/1)
initName (): void 100% (1/1)100% (1/1)100% (1/1)
initProperty (): void 100% (1/1)100% (1/1)100% (1/1)
initResources (ResourceMap): void 100% (1/1)100% (26/26)100% (4/4)
setApplicationContextHolder (ApplicationContextHolder): void 100% (1/1)100% (9/9)100% (3/3)
setPropertyMap (Map): void 100% (1/1)100% (6/6)100% (3/3)

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.Cursor;
18import java.util.Map;
19 
20import javax.swing.ActionMap;
21import javax.swing.JComponent;
22 
23import org.jdesktop.application.ApplicationContext;
24import org.jdesktop.application.Resource;
25import org.jdesktop.application.ResourceMap;
26 
27import net.sourceforge.hivegui.application.ApplicationContextHolder;
28import net.sourceforge.hivegui.application.HiveGuiApplicationMain;
29 
30public abstract class AbstractTool implements Tool
31{
32        public void                setPropertyMap(Map<String, Object> properties)
33        {
34                _properties = properties;
35                initProperty();
36        }
37        
38        public void                setApplicationContextHolder(ApplicationContextHolder holder)
39        {
40                _context = holder.getContext();
41                _application = holder.getApplication();
42        }
43        
44        public Cursor getCursor()
45        {
46                return _cursor;
47        }
48 
49        final public void init(String toolName, ToolHandler handler)
50        {
51                _name = toolName;
52                _handler = handler;
53 
54                initName();
55                // Set actions of tool
56                ActionMap actions = _context.getActionMap(AbstractTool.class, this);
57                initActions(actions);
58                // Set resources of tool
59                ResourceMap map = _context.getResourceMap(getClass(), AbstractTool.class);
60                initResources(map);
61        }
62 
63        protected void initName()
64        {
65        }
66 
67        protected void        initProperty()
68        {
69        }
70        
71        protected void        initResources(ResourceMap map)
72        {
73                map.injectFields(this, _name);
74                for (JComponent comp: getToolBarComponents())
75                {
76                        map.injectComponent(comp);
77                }
78        }
79        
80        protected void        initActions(ActionMap map)
81        {
82        }
83 
84        protected ApplicationContext                _context;
85        protected HiveGuiApplicationMain        _application;
86        protected Map<String, Object>                _properties;
87        protected ToolHandler                                _handler;
88        protected String                                        _name;
89        @Resource(key = "toolcursor")
90        protected Cursor                                        _cursor;
91}

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