Coverage details for ui.panel.BackupConfigurationPanel

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 package ui.panel;
21  
22 import java.awt.BorderLayout;
23 import java.awt.Dimension;
24 import java.awt.GridLayout;
25 import java.io.File;
26  
27 import javax.swing.JPanel;
28 import javax.swing.JTextField;
29 import javax.swing.border.TitledBorder;
30  
31 import ui.Messages;
32 import base.ConfigurationManager;
33 import base.backup.BackupFactory;
34  
35 @SuppressWarnings("serial") //$NON-NLS-1$
36 public class BackupConfigurationPanel extends JPanel {
37  
38     private JPanel topPanel;
39  
40     private JPanel databasePanel;
41  
42     private JPanel resourcesPanel;
43  
44     private JPanel resourcesPathPanel;
45  
46     private JTextField resourcesPathTextField;
47  
48     private JPanel resourcesSizePanel;
49  
50     private JTextField resourcesSizeTextField;
51  
52     private JPanel backUpPanel;
530 
540    public BackupConfigurationPanel() {
550        initialize();
560    }
570 
580    protected void initialize() {
590        this.setLayout(new BorderLayout());
600        this.add(getTopPanel(), BorderLayout.NORTH);
610        this.add(getBackUpPanel(), BorderLayout.CENTER);
620    }
630 
64     /**
65      * @return Returns the backUpPanel.
66      */
670    protected JPanel getBackUpPanel() {
680        if (backUpPanel == null) {
690            backUpPanel = new TabledBackupPanel();
700        }
710        return backUpPanel;
720    }
73  
74     /**
75      * @return Returns the resourcesPanel.
76      */
770    protected JPanel getResourcesPanel() {
780        if (resourcesPanel == null) {
790            resourcesPanel = new JPanel();
800            resourcesPanel.setBorder(new TitledBorder(
810                    Messages.getString("panel.backupconfigurationpanel.message1"))); //$NON-NLS-1$
820            resourcesPanel.setLayout(new BorderLayout());
830            resourcesPanel.add(getResourcesPathPanel(), BorderLayout.CENTER);
840            resourcesPanel.add(getResourcesSizePanel(), BorderLayout.EAST);
850        }
860        return resourcesPanel;
870    }
88  
89     /**
90      * @return Returns the resourcesPathTextField.
91      */
920    protected JTextField getResourcesPathTextField() {
930        if (resourcesPathTextField == null) {
940            resourcesPathTextField = new JTextField();
950            resourcesPathTextField
960                    .setText(ConfigurationManager.RESOURCES_DIRECTORY);
970            resourcesPathTextField.setEditable(false);
980        }
990        return resourcesPathTextField;
1000    }
101  
102     /**
103      * @return Returns the resourcesSizePanel.
104      */
1050    protected JPanel getResourcesSizePanel() {
1060        if (resourcesSizePanel == null) {
1070            resourcesSizePanel = new JPanel();
1080            resourcesSizePanel.setBorder(new TitledBorder(Messages.getString("common.size") + " " + Messages.getString("common.unit.kylobyte"))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
1090            resourcesSizePanel.setPreferredSize(new Dimension(250, 30));
1100            resourcesSizePanel.setLayout(new BorderLayout());
1110            resourcesSizePanel.add(getResourcesSizeTextField(),
1120                    BorderLayout.CENTER);
1130        }
1140        return resourcesSizePanel;
1150    }
116  
117     /**
118      * @return Returns the resourcesSizeTextField.
119      */
1200    protected JTextField getResourcesSizeTextField() {
1210        if (resourcesSizeTextField == null) {
1220            resourcesSizeTextField = new JTextField();
1230            resourcesSizeTextField.setText("" //$NON-NLS-1$
1240                    + BackupFactory.fileSizeInKB(new File(
1250                            ConfigurationManager.RESOURCES_DIRECTORY)));
1260            resourcesSizeTextField.setEditable(false);
1270        }
1280        return resourcesSizeTextField;
1290    }
130  
131     /**
132      * @return Returns the topPanel.
133      */
1340    protected JPanel getTopPanel() {
1350        if (topPanel == null) {
1360            topPanel = new JPanel();
1370            topPanel.setLayout(new GridLayout(2, 1));
1380            topPanel.add(getDatabasePanel());
1390            topPanel.add(getResourcesPanel());
1400        }
1410        return topPanel;
1420    }
143  
144     /**
145      * @return Returns the resourcesPathPanel.
146      */
1470    protected JPanel getResourcesPathPanel() {
1480        if (resourcesPathPanel == null) {
1490            resourcesPathPanel = new JPanel();
1500            resourcesPathPanel.setBorder(new TitledBorder(Messages.getString("common.directorypath"))); //$NON-NLS-1$
1510            resourcesPathPanel.setLayout(new BorderLayout());
1520            resourcesPathPanel.add(getResourcesPathTextField(),
1530                    BorderLayout.CENTER);
1540        }
1550        return resourcesPathPanel;
1560    }
157  
158     /**
159      * @return Returns the databasePanel.
160      */
1610    protected JPanel getDatabasePanel() {
1620        if (databasePanel == null) {
1630            databasePanel = new DatabasePanel();
1640        }
1650        return databasePanel;
1660    }
167 }

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.