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 | 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; | |
53 | 0 | |
54 | 0 | public BackupConfigurationPanel() { |
55 | 0 | initialize(); |
56 | 0 | } |
57 | 0 | |
58 | 0 | protected void initialize() { |
59 | 0 | this.setLayout(new BorderLayout()); |
60 | 0 | this.add(getTopPanel(), BorderLayout.NORTH); |
61 | 0 | this.add(getBackUpPanel(), BorderLayout.CENTER); |
62 | 0 | } |
63 | 0 | |
64 | /** | |
65 | * @return Returns the backUpPanel. | |
66 | */ | |
67 | 0 | protected JPanel getBackUpPanel() { |
68 | 0 | if (backUpPanel == null) { |
69 | 0 | backUpPanel = new TabledBackupPanel(); |
70 | 0 | } |
71 | 0 | return backUpPanel; |
72 | 0 | } |
73 | ||
74 | /** | |
75 | * @return Returns the resourcesPanel. | |
76 | */ | |
77 | 0 | protected JPanel getResourcesPanel() { |
78 | 0 | if (resourcesPanel == null) { |
79 | 0 | resourcesPanel = new JPanel(); |
80 | 0 | resourcesPanel.setBorder(new TitledBorder( |
81 | 0 | Messages.getString("panel.backupconfigurationpanel.message1"))); //$NON-NLS-1$ |
82 | 0 | resourcesPanel.setLayout(new BorderLayout()); |
83 | 0 | resourcesPanel.add(getResourcesPathPanel(), BorderLayout.CENTER); |
84 | 0 | resourcesPanel.add(getResourcesSizePanel(), BorderLayout.EAST); |
85 | 0 | } |
86 | 0 | return resourcesPanel; |
87 | 0 | } |
88 | ||
89 | /** | |
90 | * @return Returns the resourcesPathTextField. | |
91 | */ | |
92 | 0 | protected JTextField getResourcesPathTextField() { |
93 | 0 | if (resourcesPathTextField == null) { |
94 | 0 | resourcesPathTextField = new JTextField(); |
95 | 0 | resourcesPathTextField |
96 | 0 | .setText(ConfigurationManager.RESOURCES_DIRECTORY); |
97 | 0 | resourcesPathTextField.setEditable(false); |
98 | 0 | } |
99 | 0 | return resourcesPathTextField; |
100 | 0 | } |
101 | ||
102 | /** | |
103 | * @return Returns the resourcesSizePanel. | |
104 | */ | |
105 | 0 | protected JPanel getResourcesSizePanel() { |
106 | 0 | if (resourcesSizePanel == null) { |
107 | 0 | resourcesSizePanel = new JPanel(); |
108 | 0 | resourcesSizePanel.setBorder(new TitledBorder(Messages.getString("common.size") + " " + Messages.getString("common.unit.kylobyte"))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
109 | 0 | resourcesSizePanel.setPreferredSize(new Dimension(250, 30)); |
110 | 0 | resourcesSizePanel.setLayout(new BorderLayout()); |
111 | 0 | resourcesSizePanel.add(getResourcesSizeTextField(), |
112 | 0 | BorderLayout.CENTER); |
113 | 0 | } |
114 | 0 | return resourcesSizePanel; |
115 | 0 | } |
116 | ||
117 | /** | |
118 | * @return Returns the resourcesSizeTextField. | |
119 | */ | |
120 | 0 | protected JTextField getResourcesSizeTextField() { |
121 | 0 | if (resourcesSizeTextField == null) { |
122 | 0 | resourcesSizeTextField = new JTextField(); |
123 | 0 | resourcesSizeTextField.setText("" //$NON-NLS-1$ |
124 | 0 | + BackupFactory.fileSizeInKB(new File( |
125 | 0 | ConfigurationManager.RESOURCES_DIRECTORY))); |
126 | 0 | resourcesSizeTextField.setEditable(false); |
127 | 0 | } |
128 | 0 | return resourcesSizeTextField; |
129 | 0 | } |
130 | ||
131 | /** | |
132 | * @return Returns the topPanel. | |
133 | */ | |
134 | 0 | protected JPanel getTopPanel() { |
135 | 0 | if (topPanel == null) { |
136 | 0 | topPanel = new JPanel(); |
137 | 0 | topPanel.setLayout(new GridLayout(2, 1)); |
138 | 0 | topPanel.add(getDatabasePanel()); |
139 | 0 | topPanel.add(getResourcesPanel()); |
140 | 0 | } |
141 | 0 | return topPanel; |
142 | 0 | } |
143 | ||
144 | /** | |
145 | * @return Returns the resourcesPathPanel. | |
146 | */ | |
147 | 0 | protected JPanel getResourcesPathPanel() { |
148 | 0 | if (resourcesPathPanel == null) { |
149 | 0 | resourcesPathPanel = new JPanel(); |
150 | 0 | resourcesPathPanel.setBorder(new TitledBorder(Messages.getString("common.directorypath"))); //$NON-NLS-1$ |
151 | 0 | resourcesPathPanel.setLayout(new BorderLayout()); |
152 | 0 | resourcesPathPanel.add(getResourcesPathTextField(), |
153 | 0 | BorderLayout.CENTER); |
154 | 0 | } |
155 | 0 | return resourcesPathPanel; |
156 | 0 | } |
157 | ||
158 | /** | |
159 | * @return Returns the databasePanel. | |
160 | */ | |
161 | 0 | protected JPanel getDatabasePanel() { |
162 | 0 | if (databasePanel == null) { |
163 | 0 | databasePanel = new DatabasePanel(); |
164 | 0 | } |
165 | 0 | return databasePanel; |
166 | 0 | } |
167 | } |
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |