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

COVERAGE SUMMARY FOR SOURCE FILE [TextToolPanel.java]

nameclass, %method, %block, %line, %
TextToolPanel.java100% (2/2)100% (7/7)100% (87/87)100% (19/19)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class TextToolPanel100% (1/1)100% (5/5)100% (63/63)100% (16/16)
TextToolPanel (): void 100% (1/1)100% (40/40)100% (8/8)
accept (): void 100% (1/1)100% (5/5)100% (2/2)
access$000 (TextToolPanel): JTextArea 100% (1/1)100% (3/3)100% (1/1)
getFieldDocument (): Document 100% (1/1)100% (4/4)100% (1/1)
reset (): void 100% (1/1)100% (11/11)100% (4/4)
     
class TextToolPanel$1100% (1/1)100% (2/2)100% (24/24)100% (3/3)
TextToolPanel$1 (TextToolPanel): void 100% (1/1)100% (6/6)100% (1/1)
contentUpdated (): void 100% (1/1)100% (18/18)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.BorderLayout;
18 
19import javax.swing.JScrollPane;
20import javax.swing.JTextArea;
21import javax.swing.text.Document;
22 
23import org.jdesktop.application.Action;
24 
25import net.sourceforge.hivegui.component.TextListener;
26import net.sourceforge.hivegui.dialog.AbstractDialogPanel;
27 
28public class TextToolPanel extends AbstractDialogPanel
29{
30        static private final String        NAME = "text-tool";
31 
32        public TextToolPanel()
33        {
34                super(NAME);
35                setLayout(new BorderLayout());
36 
37                // Initialize widgets
38                _field.setName(NAME + "-input");
39                JScrollPane scroller = new JScrollPane(        _field,
40                                                                                                JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
41                                                                                                JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
42                add(scroller, BorderLayout.CENTER);
43                
44                _field.getDocument().addDocumentListener(new TextListener()
45                {
46                        @Override protected void contentUpdated()
47                        {
48                                setAcceptEnabled(        _field.getText() != null
49                                                                &&        _field.getText().length() != 0);
50                        }
51                });
52        }
53 
54        public Document        getFieldDocument()
55        {
56                return _field.getDocument();
57        }
58 
59        @Override public void reset()
60        {
61                setAcceptEnabled(false);
62                _field.setText("");
63                _field.requestFocus();
64        }
65        
66        @Action(enabledProperty = "acceptEnabled")
67        public void accept()
68        {
69                _parent.close(false);
70        }
71        
72        final private JTextArea        _field = new JTextArea(5, 40);
73}

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