EMMA Coverage Report (generated Sat Oct 08 11:41:37 CEST 2011)
[all classes][net.sf.jomic.ui]

COVERAGE SUMMARY FOR SOURCE FILE [SnapableJFileChooser.java]

nameclass, %method, %block, %line, %
SnapableJFileChooser.java100% (1/1)29%  (2/7)44%  (29/66)37%  (5.9/16)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class SnapableJFileChooser100% (1/1)29%  (2/7)44%  (29/66)37%  (5.9/16)
componentHidden (ComponentEvent): void 0%   (0/1)0%   (0/1)0%   (0/1)
componentMoved (ComponentEvent): void 0%   (0/1)0%   (0/1)0%   (0/1)
componentResized (ComponentEvent): void 0%   (0/1)0%   (0/8)0%   (0/2)
componentShown (ComponentEvent): void 0%   (0/1)0%   (0/1)0%   (0/1)
createDialog (Component): JDialog 0%   (0/1)0%   (0/15)0%   (0/4)
SnapableJFileChooser (BasicSettings, String): void 100% (1/1)68%  (17/25)85%  (5.1/6)
<static initializer> 100% (1/1)80%  (12/15)80%  (0.8/1)

1// Jomic - a viewer for comic book archives.
2// Copyright (C) 2004-2011 Thomas Aglassinger
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with this program.  If not, see <http://www.gnu.org/licenses/>.
16package net.sf.jomic.ui;
17 
18import java.awt.Component;
19import java.awt.event.ComponentEvent;
20import java.awt.event.ComponentListener;
21 
22import javax.swing.JDialog;
23import javax.swing.JFileChooser;
24 
25import net.sf.jomic.tools.BasicSettings;
26 
27/**
28 *  JFileChooser that remembers own location and dimension.
29 *
30 * @author    Thomas Aglassinger
31 */
32public class SnapableJFileChooser extends JFileChooser implements ComponentListener
33{
34    private String areaProperty;
35    private BasicSettings settings;
36 
37    /**
38     *  Create a new JFileChooser that remembers location and dimension in <code>newSettings</code>
39     *  using the property <code>newAreaProperty</code>.
40     *
41     * @param  newSettings      Description of the parameter
42     * @param  newAreaProperty  Description of the parameter
43     */
44    public SnapableJFileChooser(BasicSettings newSettings, String newAreaProperty) {
45        super();
46        assert newSettings != null;
47        assert newAreaProperty != null;
48        settings = newSettings;
49        areaProperty = newAreaProperty;
50    }
51 
52    public void componentHidden(ComponentEvent event) {
53        // Do nothing.
54    }
55 
56    public void componentMoved(ComponentEvent event) {
57        // Do nothing.
58    }
59 
60    public void componentResized(ComponentEvent event) {
61        settings.setComponentAreaProperty(areaProperty, event.getComponent());
62    }
63 
64    public void componentShown(ComponentEvent event) {
65        // Do nothing.
66    }
67 
68    protected JDialog createDialog(Component component) {
69        JDialog result = super.createDialog(component);
70 
71        settings.applyComponentAreaProperty(areaProperty, result);
72        result.addComponentListener(this);
73        return result;
74    }
75}

[all classes][net.sf.jomic.ui]
EMMA 2.0.4217 (C) Vladimir Roubtsov