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

COVERAGE SUMMARY FOR SOURCE FILE [DefaultViewFactory.java]

nameclass, %method, %block, %line, %
DefaultViewFactory.java0%   (0/2)0%   (0/8)0%   (0/68)0%   (0/23)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class DefaultViewFactory0%   (0/1)0%   (0/5)0%   (0/51)0%   (0/18)
DefaultViewFactory (): void 0%   (0/1)0%   (0/3)0%   (0/2)
createView (String): View 0%   (0/1)0%   (0/5)0%   (0/1)
createView (String, JComponent): View 0%   (0/1)0%   (0/26)0%   (0/8)
initView (View, String): void 0%   (0/1)0%   (0/12)0%   (0/5)
setContextHolder (ApplicationContextHolder): void 0%   (0/1)0%   (0/5)0%   (0/2)
     
class DefaultViewFactory$ViewBean0%   (0/1)0%   (0/3)0%   (0/17)0%   (0/5)
DefaultViewFactory$ViewBean (String): void 0%   (0/1)0%   (0/4)0%   (0/2)
getViewIcon (): Icon 0%   (0/1)0%   (0/9)0%   (0/1)
setViewIcon (Icon): 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 
15package net.sourceforge.hivegui.docking;
16 
17import javax.swing.Icon;
18import javax.swing.JComponent;
19 
20import org.flexdock.view.View;
21import org.jdesktop.application.ApplicationContext;
22 
23import net.sourceforge.hivegui.application.ApplicationContextHolder;
24 
25public class DefaultViewFactory implements ViewFactory
26{
27        public void        setContextHolder(ApplicationContextHolder holder)
28        {
29                _context = holder.getContext();
30        }
31        
32        public View        createView(String id, JComponent content)
33        {
34                if (content == null)
35                {
36                        return null;
37                }
38                View view = createView(id);
39                view.setName(id);
40                view.setContentPane(content);
41                initView(view, id);
42                _context.getResourceMap(View.class).injectComponents(view);
43                return view;
44        }
45        
46        protected View        createView(String id)
47        {
48                return new ViewBean(id);
49        }
50        
51        protected void        initView(View view, String id)
52        {
53                if (EmptyableViewport.EMPTY_VIEW_ID.equals(id))
54                {
55                        view.setTitlebar(null);
56                }
57                else
58                {
59                        view.addAction(View.CLOSE_ACTION);
60                }
61        }
62 
63        // This class exists only to make flexdock's View more JavaBean-compliant
64        // (at least with regard to the "icon" property, renamed to "viewIcon")
65        static protected class ViewBean extends View
66        {
67                public ViewBean(String id)
68                {
69                        super(id);
70                }
71 
72                public Icon        getViewIcon()
73                {
74                        return (titlepane == null ? null : titlepane.getIcon());
75                }
76                
77                public void        setViewIcon(Icon icon)
78                {
79                        setIcon(icon);
80                }
81        }
82 
83        protected ApplicationContext        _context;
84}

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