Coverage details for base.jdbs.ui.dialog.BackupDialog

LineHitsSource
1 /*******************************************************************************
2  *InternetCafe is a software solution that helps the management of Cybercafes
3  * according with the ITALIAN DECREE LAW ON ANTI-TERROR MEASURES, 27 JULY 2005.
4  * Copyright (C) 2006 Guido Angelo Ingenito
5  
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  *******************************************************************************/
20  
21 package base.jdbs.ui.dialog;
22  
23 import java.awt.BorderLayout;
24 import java.awt.GridLayout;
25 import java.awt.event.ActionEvent;
26 import java.awt.event.ActionListener;
27  
28 import javax.swing.JButton;
29 import javax.swing.JDialog;
30 import javax.swing.JLabel;
31 import javax.swing.JPanel;
32  
33 import org.apache.log4j.Logger;
34  
35 import ui.command.CommandExecutor;
36 import ui.util.GeneralUtil;
37 import base.jdbs.Backup;
38 import base.jdbs.BackupFactory;
39 import base.jdbs.ui.command.BuildBackupArtifactCommand;
40 import base.jdbs.ui.panel.BackupPanel;
41  
42 /**
43  * @author skunk
44  *
45  */
460@SuppressWarnings("serial")
470public class BackupDialog extends JDialog {
480 
490    private static final transient Logger logger = Logger
50             .getLogger(BackupDialog.class.getName());
51  
52     private JPanel backupPanel;
53  
54     private JPanel buttonPanel;
550 
56     private JButton buildBackupArtifactButton;
570 
580    private JButton closeButton;
590 
600    private final Backup backup = BackupFactory.newDefaultBackup();
61  
620    public BackupDialog() {
630        initialize();
640    }
650 
660    protected void initialize() {
670        this.setSize(800, 600);
680        GeneralUtil.centerComponent(this);
690        this.setLayout(new BorderLayout());
700        this.add(this.getBackupPanel(), BorderLayout.CENTER);
710        this.add(this.getButtonPanel(), BorderLayout.SOUTH);
720    }
730 
740    /**
75      * @return Returns the backupPanel.
760     */
77     protected JPanel getBackupPanel() {
780        if (this.backupPanel == null) {
790            this.backupPanel = new BackupPanel(backup);
80         }
810        return backupPanel;
82     }
830 
840    /**
850     * @return Returns the buttonPanel.
860     */
870    protected JPanel getButtonPanel() {
880        if (this.buttonPanel == null) {
890            this.buttonPanel = new JPanel();
900            this.buttonPanel.setLayout(new GridLayout(1, 4));
910            this.buttonPanel.add(new JLabel());
920            this.buttonPanel.add(this.getBuildBackupArtifactButton());
930            this.buttonPanel.add(this.getCloseButton());
940            this.buttonPanel.add(new JLabel());
95         }
960        return buttonPanel;
97     }
980 
990    /**
1000     * @return Returns the buildBackupArtifactButton.
101      */
102     protected JButton getBuildBackupArtifactButton() {
1030        if (this.buildBackupArtifactButton == null) {
1040            this.buildBackupArtifactButton = new JButton("Build Artifact");
1050            this.buildBackupArtifactButton
106                     .addActionListener(new ActionListener() {
1070 
108                         public void actionPerformed(ActionEvent arg0) {
109                             CommandExecutor.getInstance().executeCommand(
110                                     new BuildBackupArtifactCommand(backup),
111                                     false);
112                             setVisible(false);
113                         }
1140                    });
1150        }
1160        return buildBackupArtifactButton;
117     }
118  
119     /**
120      * @return Returns the closeButton.
121      */
1220    protected JButton getCloseButton() {
1230        if (this.closeButton == null) {
1240            this.closeButton = new JButton("Close");
1250            this.closeButton.addActionListener(new ActionListener() {
126  
127                 public void actionPerformed(ActionEvent arg0) {
128                     setVisible(false);
129                 }
130             });
131         }
1320        return closeButton;
133     }
134  
135 }

this report was generated by version 1.0.5 of jcoverage.
visit www.jcoverage.com for updates.

copyright © 2003, jcoverage ltd. all rights reserved.
Java is a trademark of Sun Microsystems, Inc. in the United States and other countries.