Coverage details for base.jdbs.ui.panel.RepositoryConfigurationPanel

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.panel;
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.JCheckBox;
30 import javax.swing.JLabel;
31 import javax.swing.JPanel;
32 import javax.swing.JTextField;
33 import javax.swing.border.TitledBorder;
34  
35 import org.apache.log4j.Logger;
36  
37 import ui.util.GeneralUtil;
38 import base.jdbs.ConfigurationManager;
39 import base.jdbs.ui.dialog.RepositorySetupDialog;
40  
41 @SuppressWarnings("serial")
420public class RepositoryConfigurationPanel extends JPanel {
43     
440    private static final transient Logger logger = Logger.getLogger(RepositoryConfigurationPanel.class.getName());
45  
46     private JPanel locationPanel;
47     private JTextField locationTextField;
48     
49     private JPanel declaredAvailableSpacePanel;
50     private JTextField declaredAvailableSpaceTextField;
51     
52     private JPanel autoBackupExpirationPanel;
53     private JCheckBox autoBackupExpirationCheckBox;
54     
55     private JPanel buttonPanel;
56     private JButton changeButton;
57     
580    public RepositoryConfigurationPanel(){
590        this.setBorder(new TitledBorder("Repository Configuration Parameters"));
600        this.setLayout(new BorderLayout());
610        JPanel leftPanel = new JPanel();
620        leftPanel.setLayout(new GridLayout(2,1));
630        leftPanel.add(this.getLocationPanel());
640        leftPanel.add(this.getDeclaredAvailableSpacePanel());
650        this.add(leftPanel,BorderLayout.CENTER);
660        JPanel southPanel = new JPanel();
670        southPanel.setLayout(new BorderLayout());
680        southPanel.add(this.getButtonPanel(),BorderLayout.NORTH);
690        southPanel.add(this.getAutoBackupExpirationPanel(),BorderLayout.SOUTH);
700        this.add(southPanel,BorderLayout.SOUTH);
710    }
72  
73     /**
740     * @return the declaredAvailableSpacePanel
750     */
760    protected JPanel getDeclaredAvailableSpacePanel() {
770        if(this.declaredAvailableSpacePanel == null){
780            this.declaredAvailableSpacePanel = new JPanel();
790            this.declaredAvailableSpacePanel.setBorder(new TitledBorder("Declared Available Space"));
800            this.declaredAvailableSpacePanel.setLayout(new BorderLayout());
810            this.declaredAvailableSpacePanel.add(this.getDeclaredAvailableSpaceTextField(),BorderLayout.CENTER);
82         }
830        return declaredAvailableSpacePanel;
84     }
85     /**
860     * @return the declaredAvailableSpaceTextField
870     */
880    protected JTextField getDeclaredAvailableSpaceTextField() {
890        if(this.declaredAvailableSpaceTextField == null){
900            this.declaredAvailableSpaceTextField = new JTextField();
910            this.declaredAvailableSpaceTextField.setEditable(false);
920            this.declaredAvailableSpaceTextField.setText(""+ConfigurationManager.getInstance().getRepository().getDeclaredAvailableSpace());
93         }
940        return declaredAvailableSpaceTextField;
95     }
96     
97     /**
980     * @return the locationPanel
990     */
1000    protected JPanel getLocationPanel() {
1010        if(this.locationPanel == null){
1020            this.locationPanel = new JPanel();
1030            this.locationPanel.setBorder(new TitledBorder("Location"));
1040            this.locationPanel.setLayout(new BorderLayout());
1050            this.locationPanel.add(this.getLocationTextField(),BorderLayout.CENTER);
106         }
1070        return locationPanel;
108     }
109     /**
1100     * @return the locationTextField
1110     */
1120    protected JTextField getLocationTextField() {
1130        if(this.locationTextField == null){
1140            this.locationTextField = new JTextField();
1150            this.locationTextField.setEditable(false);
1160            this.locationTextField.setText(ConfigurationManager.getInstance().getRepository().getLocation().getAbsolutePath());
117         }
1180        return locationTextField;
119     }
120  
121     /**
1220     * @return Returns the buttonPanel.
1230     */
1240    protected JPanel getButtonPanel() {
1250        if(this.buttonPanel == null){
1260            this.buttonPanel = new JPanel();
1270            this.buttonPanel.setLayout(new GridLayout(1,3));
1280            this.buttonPanel.add(new JLabel());
1290            this.buttonPanel.add(this.getChangeButton());
1300            this.buttonPanel.add(new JLabel());
131         }
1320        return buttonPanel;
133     }
134  
135     /**
1360     * @return Returns the changeButton.
1370     */
1380    protected JButton getChangeButton() {
1390        if(this.changeButton == null){
1400            this.changeButton = new JButton("Setup");
1410            this.changeButton.addActionListener(new ActionListener(){
142  
143                 public void actionPerformed(ActionEvent arg0) {
144                     RepositorySetupDialog repositorySetupDialog = new RepositorySetupDialog();
145                     repositorySetupDialog.setModal(true);
146                     GeneralUtil.centerComponent(repositorySetupDialog);
147                     repositorySetupDialog.setVisible(true);
148                 }
1490                
150             });
151         }
1520        return changeButton;
153     }
154  
155     /**
1560     * @return Returns the autoBackupExpirationCheckBox.
1570     */
158     protected JCheckBox getAutoBackupExpirationCheckBox() {
1590        if(this.autoBackupExpirationCheckBox == null){
1600            this.autoBackupExpirationCheckBox = new JCheckBox();
161         }
1620        return autoBackupExpirationCheckBox;
163     }
164  
165     /**
1660     * @return Returns the autoBackupExpirationPanel.
1670     */
1680    protected JPanel getAutoBackupExpirationPanel() {
1690        if(this.autoBackupExpirationPanel == null){
1700            this.autoBackupExpirationPanel = new JPanel();
1710            this.autoBackupExpirationPanel.setBorder(new TitledBorder("Automatically Purge Expired Backups"));
1720            this.autoBackupExpirationPanel.setLayout(new BorderLayout());
1730            this.autoBackupExpirationPanel.add(this.getAutoBackupExpirationCheckBox(),BorderLayout.CENTER);
174         }
1750        return autoBackupExpirationPanel;
176     }
177  
178 }

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.