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
24 import javax.swing.ImageIcon;
25 import javax.swing.JPanel;
26 import javax.swing.JTabbedPane;
27
28 import ui.Messages;
29 import base.ConfigurationManager;
30 import base.jdbs.ui.JDBSMainPanel;
31
32 @SuppressWarnings("serial")
33 public class ICConfigurationPanel extends JPanel {
34
35 private JPanel applicationConfigurationPanel;
36
37 private JPanel backupConfigurationPanel;
38
39 private JPanel securityConfigurationPanel;
40
41 private JPanel localConfigurationPanel;
42
43 private JTabbedPane tabbedPanel;
44
45 public ICConfigurationPanel() {
46 initialize();
47 }
48
49 protected void initialize() {
50 this.setLayout(new BorderLayout());
51 this.add(getTabbedPanel(), BorderLayout.CENTER);
52 }
53
54 /***
55 * @return Returns the applicationConfigurationPanel.
56 */
57 protected JPanel getApplicationConfigurationPanel() {
58 if (applicationConfigurationPanel == null) {
59 applicationConfigurationPanel = new InternetCafeConfigurationPanel();
60 }
61 return applicationConfigurationPanel;
62 }
63
64 /***
65 * @return Returns the backupConfigurationPanel.
66 */
67 protected JPanel getBackupConfigurationPanel() {
68 if (backupConfigurationPanel == null) {
69 if(ConfigurationManager.getInstance().isJDBSEnabled())
70 backupConfigurationPanel = new JDBSMainPanel();
71 else backupConfigurationPanel = new BackupConfigurationPanel();
72 }
73 return backupConfigurationPanel;
74 }
75
76 /***
77 * @return Returns the securityConfigurationPanel.
78 */
79 protected JPanel getSecurityConfigurationPanel() {
80 if (securityConfigurationPanel == null) {
81 securityConfigurationPanel = new SecurityConfigurationPanel();
82 }
83 return securityConfigurationPanel;
84 }
85
86 /***
87 * @return Returns the localConfigurationPanel.
88 */
89 protected JPanel getLocalConfigurationPanel() {
90 if (localConfigurationPanel == null) {
91 localConfigurationPanel = new LocalConfigurationPanel();
92 }
93 return localConfigurationPanel;
94 }
95
96 /***
97 * @return Returns the tabbedPanel.
98 */
99 protected JTabbedPane getTabbedPanel() {
100 if (tabbedPanel == null) {
101 tabbedPanel = new JTabbedPane();
102 tabbedPanel
103 .addTab(
104 Messages.getString("common.internetcafe"),
105 new ImageIcon(
106 this
107 .getClass()
108 .getResource(
109 "/icon/16x16/apps/preferences-desktop-theme.png")),
110 getApplicationConfigurationPanel(),
111 Messages.getString("panel.icconfigurationpanel.managepreference.tooltip"));
112 tabbedPanel.addTab(Messages.getString("common.security"), new ImageIcon(this.getClass()
113 .getResource("/icon/16x16/emblems/emblem-important.png")),
114 getSecurityConfigurationPanel(),
115 Messages.getString("panel.icconfigurationpanel.managesecurity.tooltip"));
116 tabbedPanel.addTab(Messages.getString("common.backup"), new ImageIcon(this.getClass()
117 .getResource("/icon/16x16/devices/media-floppy.png")),
118 getBackupConfigurationPanel(), Messages.getString("panel.icconfigurationpanel.managebackups.tooltip"));
119 tabbedPanel
120 .addTab(
121 Messages.getString("common.language"),
122 new ImageIcon(
123 this
124 .getClass()
125 .getResource(
126 "/icon/16x16/apps/preferences-desktop-locale.png")),
127 getLocalConfigurationPanel(), Messages.getString("panel.icconfigurationpanel.managelanguages.tooltip"));
128 }
129 return tabbedPanel;
130 }
131 }