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.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") | |
42 | 0 | public class RepositoryConfigurationPanel extends JPanel { |
43 | ||
44 | 0 | 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 | ||
58 | 0 | public RepositoryConfigurationPanel(){ |
59 | 0 | this.setBorder(new TitledBorder("Repository Configuration Parameters")); |
60 | 0 | this.setLayout(new BorderLayout()); |
61 | 0 | JPanel leftPanel = new JPanel(); |
62 | 0 | leftPanel.setLayout(new GridLayout(2,1)); |
63 | 0 | leftPanel.add(this.getLocationPanel()); |
64 | 0 | leftPanel.add(this.getDeclaredAvailableSpacePanel()); |
65 | 0 | this.add(leftPanel,BorderLayout.CENTER); |
66 | 0 | JPanel southPanel = new JPanel(); |
67 | 0 | southPanel.setLayout(new BorderLayout()); |
68 | 0 | southPanel.add(this.getButtonPanel(),BorderLayout.NORTH); |
69 | 0 | southPanel.add(this.getAutoBackupExpirationPanel(),BorderLayout.SOUTH); |
70 | 0 | this.add(southPanel,BorderLayout.SOUTH); |
71 | 0 | } |
72 | ||
73 | /** | |
74 | 0 | * @return the declaredAvailableSpacePanel |
75 | 0 | */ |
76 | 0 | protected JPanel getDeclaredAvailableSpacePanel() { |
77 | 0 | if(this.declaredAvailableSpacePanel == null){ |
78 | 0 | this.declaredAvailableSpacePanel = new JPanel(); |
79 | 0 | this.declaredAvailableSpacePanel.setBorder(new TitledBorder("Declared Available Space")); |
80 | 0 | this.declaredAvailableSpacePanel.setLayout(new BorderLayout()); |
81 | 0 | this.declaredAvailableSpacePanel.add(this.getDeclaredAvailableSpaceTextField(),BorderLayout.CENTER); |
82 | } | |
83 | 0 | return declaredAvailableSpacePanel; |
84 | } | |
85 | /** | |
86 | 0 | * @return the declaredAvailableSpaceTextField |
87 | 0 | */ |
88 | 0 | protected JTextField getDeclaredAvailableSpaceTextField() { |
89 | 0 | if(this.declaredAvailableSpaceTextField == null){ |
90 | 0 | this.declaredAvailableSpaceTextField = new JTextField(); |
91 | 0 | this.declaredAvailableSpaceTextField.setEditable(false); |
92 | 0 | this.declaredAvailableSpaceTextField.setText(""+ConfigurationManager.getInstance().getRepository().getDeclaredAvailableSpace()); |
93 | } | |
94 | 0 | return declaredAvailableSpaceTextField; |
95 | } | |
96 | ||
97 | /** | |
98 | 0 | * @return the locationPanel |
99 | 0 | */ |
100 | 0 | protected JPanel getLocationPanel() { |
101 | 0 | if(this.locationPanel == null){ |
102 | 0 | this.locationPanel = new JPanel(); |
103 | 0 | this.locationPanel.setBorder(new TitledBorder("Location")); |
104 | 0 | this.locationPanel.setLayout(new BorderLayout()); |
105 | 0 | this.locationPanel.add(this.getLocationTextField(),BorderLayout.CENTER); |
106 | } | |
107 | 0 | return locationPanel; |
108 | } | |
109 | /** | |
110 | 0 | * @return the locationTextField |
111 | 0 | */ |
112 | 0 | protected JTextField getLocationTextField() { |
113 | 0 | if(this.locationTextField == null){ |
114 | 0 | this.locationTextField = new JTextField(); |
115 | 0 | this.locationTextField.setEditable(false); |
116 | 0 | this.locationTextField.setText(ConfigurationManager.getInstance().getRepository().getLocation().getAbsolutePath()); |
117 | } | |
118 | 0 | return locationTextField; |
119 | } | |
120 | ||
121 | /** | |
122 | 0 | * @return Returns the buttonPanel. |
123 | 0 | */ |
124 | 0 | protected JPanel getButtonPanel() { |
125 | 0 | if(this.buttonPanel == null){ |
126 | 0 | this.buttonPanel = new JPanel(); |
127 | 0 | this.buttonPanel.setLayout(new GridLayout(1,3)); |
128 | 0 | this.buttonPanel.add(new JLabel()); |
129 | 0 | this.buttonPanel.add(this.getChangeButton()); |
130 | 0 | this.buttonPanel.add(new JLabel()); |
131 | } | |
132 | 0 | return buttonPanel; |
133 | } | |
134 | ||
135 | /** | |
136 | 0 | * @return Returns the changeButton. |
137 | 0 | */ |
138 | 0 | protected JButton getChangeButton() { |
139 | 0 | if(this.changeButton == null){ |
140 | 0 | this.changeButton = new JButton("Setup"); |
141 | 0 | 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 | } | |
149 | 0 | |
150 | }); | |
151 | } | |
152 | 0 | return changeButton; |
153 | } | |
154 | ||
155 | /** | |
156 | 0 | * @return Returns the autoBackupExpirationCheckBox. |
157 | 0 | */ |
158 | protected JCheckBox getAutoBackupExpirationCheckBox() { | |
159 | 0 | if(this.autoBackupExpirationCheckBox == null){ |
160 | 0 | this.autoBackupExpirationCheckBox = new JCheckBox(); |
161 | } | |
162 | 0 | return autoBackupExpirationCheckBox; |
163 | } | |
164 | ||
165 | /** | |
166 | 0 | * @return Returns the autoBackupExpirationPanel. |
167 | 0 | */ |
168 | 0 | protected JPanel getAutoBackupExpirationPanel() { |
169 | 0 | if(this.autoBackupExpirationPanel == null){ |
170 | 0 | this.autoBackupExpirationPanel = new JPanel(); |
171 | 0 | this.autoBackupExpirationPanel.setBorder(new TitledBorder("Automatically Purge Expired Backups")); |
172 | 0 | this.autoBackupExpirationPanel.setLayout(new BorderLayout()); |
173 | 0 | this.autoBackupExpirationPanel.add(this.getAutoBackupExpirationCheckBox(),BorderLayout.CENTER); |
174 | } | |
175 | 0 | return autoBackupExpirationPanel; |
176 | } | |
177 | ||
178 | } |
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |