Line | Hits | Source |
---|---|---|
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 | */ | |
46 | 0 | @SuppressWarnings("serial") |
47 | 0 | public class BackupDialog extends JDialog { |
48 | 0 | |
49 | 0 | private static final transient Logger logger = Logger |
50 | .getLogger(BackupDialog.class.getName()); | |
51 | ||
52 | private JPanel backupPanel; | |
53 | ||
54 | private JPanel buttonPanel; | |
55 | 0 | |
56 | private JButton buildBackupArtifactButton; | |
57 | 0 | |
58 | 0 | private JButton closeButton; |
59 | 0 | |
60 | 0 | private final Backup backup = BackupFactory.newDefaultBackup(); |
61 | ||
62 | 0 | public BackupDialog() { |
63 | 0 | initialize(); |
64 | 0 | } |
65 | 0 | |
66 | 0 | protected void initialize() { |
67 | 0 | this.setSize(800, 600); |
68 | 0 | GeneralUtil.centerComponent(this); |
69 | 0 | this.setLayout(new BorderLayout()); |
70 | 0 | this.add(this.getBackupPanel(), BorderLayout.CENTER); |
71 | 0 | this.add(this.getButtonPanel(), BorderLayout.SOUTH); |
72 | 0 | } |
73 | 0 | |
74 | 0 | /** |
75 | * @return Returns the backupPanel. | |
76 | 0 | */ |
77 | protected JPanel getBackupPanel() { | |
78 | 0 | if (this.backupPanel == null) { |
79 | 0 | this.backupPanel = new BackupPanel(backup); |
80 | } | |
81 | 0 | return backupPanel; |
82 | } | |
83 | 0 | |
84 | 0 | /** |
85 | 0 | * @return Returns the buttonPanel. |
86 | 0 | */ |
87 | 0 | protected JPanel getButtonPanel() { |
88 | 0 | if (this.buttonPanel == null) { |
89 | 0 | this.buttonPanel = new JPanel(); |
90 | 0 | this.buttonPanel.setLayout(new GridLayout(1, 4)); |
91 | 0 | this.buttonPanel.add(new JLabel()); |
92 | 0 | this.buttonPanel.add(this.getBuildBackupArtifactButton()); |
93 | 0 | this.buttonPanel.add(this.getCloseButton()); |
94 | 0 | this.buttonPanel.add(new JLabel()); |
95 | } | |
96 | 0 | return buttonPanel; |
97 | } | |
98 | 0 | |
99 | 0 | /** |
100 | 0 | * @return Returns the buildBackupArtifactButton. |
101 | */ | |
102 | protected JButton getBuildBackupArtifactButton() { | |
103 | 0 | if (this.buildBackupArtifactButton == null) { |
104 | 0 | this.buildBackupArtifactButton = new JButton("Build Artifact"); |
105 | 0 | this.buildBackupArtifactButton |
106 | .addActionListener(new ActionListener() { | |
107 | 0 | |
108 | public void actionPerformed(ActionEvent arg0) { | |
109 | CommandExecutor.getInstance().executeCommand( | |
110 | new BuildBackupArtifactCommand(backup), | |
111 | false); | |
112 | setVisible(false); | |
113 | } | |
114 | 0 | }); |
115 | 0 | } |
116 | 0 | return buildBackupArtifactButton; |
117 | } | |
118 | ||
119 | /** | |
120 | * @return Returns the closeButton. | |
121 | */ | |
122 | 0 | protected JButton getCloseButton() { |
123 | 0 | if (this.closeButton == null) { |
124 | 0 | this.closeButton = new JButton("Close"); |
125 | 0 | this.closeButton.addActionListener(new ActionListener() { |
126 | ||
127 | public void actionPerformed(ActionEvent arg0) { | |
128 | setVisible(false); | |
129 | } | |
130 | }); | |
131 | } | |
132 | 0 | return closeButton; |
133 | } | |
134 | ||
135 | } |
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |