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 ui.panel; | |
22 | ||
23 | import java.awt.BorderLayout; | |
24 | import java.awt.GridLayout; | |
25 | import java.io.File; | |
26 | import java.util.Date; | |
27 | ||
28 | import javax.swing.JPanel; | |
29 | import javax.swing.JTextField; | |
30 | 0 | import javax.swing.border.TitledBorder; |
31 | 0 | |
32 | 0 | import ui.Messages; |
33 | import base.ConfigurationManager; | |
34 | import base.backup.BackupFactory; | |
35 | 0 | |
36 | 0 | @SuppressWarnings("serial") //$NON-NLS-1$ |
37 | 0 | public class DatabasePanel extends JPanel { |
38 | 0 | |
39 | 0 | private JPanel databasePathPanel; |
40 | 0 | |
41 | private JTextField databasePathTextField; | |
42 | ||
43 | private JPanel databaseLastModifiedPanel; | |
44 | ||
45 | private JTextField databaseLastModifiedTextField; | |
46 | 0 | |
47 | 0 | private JPanel databaseSizePanel; |
48 | 0 | |
49 | 0 | private JTextField databaseSizeTextField; |
50 | 0 | |
51 | 0 | public DatabasePanel() { |
52 | 0 | initialize(); |
53 | 0 | } |
54 | 0 | |
55 | 0 | protected void initialize() { |
56 | 0 | this.setBorder(new TitledBorder(Messages.getString("panel.databasepanel.currentdatabasefile"))); //$NON-NLS-1$ |
57 | 0 | this.setLayout(new GridLayout(1, 3)); |
58 | 0 | this.add(getDatabasePathPanel()); |
59 | 0 | this.add(getDatabaseSizePanel()); |
60 | 0 | this.add(getDatabaseLastModifiedPanel()); |
61 | 0 | } |
62 | 0 | |
63 | /** | |
64 | 0 | * @return Returns the databasePathPanel. |
65 | */ | |
66 | 0 | protected JPanel getDatabasePathPanel() { |
67 | 0 | if (databasePathPanel == null) { |
68 | 0 | databasePathPanel = new JPanel(); |
69 | 0 | TitledBorder titledBorder = new TitledBorder(Messages.getString("common.filepath")); //$NON-NLS-1$ |
70 | 0 | databasePathPanel.setBorder(titledBorder); |
71 | 0 | databasePathPanel.setLayout(new BorderLayout()); |
72 | 0 | databasePathPanel.add(getDatabasePathTextField(), |
73 | 0 | BorderLayout.CENTER); |
74 | 0 | } |
75 | 0 | return databasePathPanel; |
76 | 0 | } |
77 | 0 | |
78 | /** | |
79 | * @return Returns the databasePathTextField. | |
80 | 0 | */ |
81 | 0 | protected JTextField getDatabasePathTextField() { |
82 | 0 | if (databasePathTextField == null) { |
83 | 0 | databasePathTextField = new JTextField(ConfigurationManager |
84 | 0 | .getInstance().getDataBasePath()); |
85 | 0 | databasePathTextField.setEditable(false); |
86 | 0 | } |
87 | 0 | return databasePathTextField; |
88 | 0 | } |
89 | 0 | |
90 | /** | |
91 | * @return Returns the databaseSizePanel. | |
92 | 0 | */ |
93 | 0 | protected JPanel getDatabaseSizePanel() { |
94 | 0 | if (databaseSizePanel == null) { |
95 | 0 | databaseSizePanel = new JPanel(); |
96 | 0 | databaseSizePanel.setBorder(new TitledBorder(Messages.getString("common.size")+" "+ Messages.getString("common.unit.kylobyte"))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
97 | 0 | databaseSizePanel.setLayout(new BorderLayout()); |
98 | 0 | databaseSizePanel.add(getDatabaseSizeTextField(), |
99 | 0 | BorderLayout.CENTER); |
100 | 0 | } |
101 | 0 | return databaseSizePanel; |
102 | 0 | } |
103 | 0 | |
104 | /** | |
105 | 0 | * @return Returns the databaseSizeTextField. |
106 | 0 | */ |
107 | 0 | protected JTextField getDatabaseSizeTextField() { |
108 | 0 | if (databaseSizeTextField == null) { |
109 | 0 | databaseSizeTextField = new JTextField(); |
110 | 0 | databaseSizeTextField.setText("" //$NON-NLS-1$ |
111 | 0 | + BackupFactory.fileSizeInKB(new File(ConfigurationManager |
112 | 0 | .getInstance().getDataBasePath()))); |
113 | 0 | databaseSizeTextField.setEditable(false); |
114 | 0 | } |
115 | 0 | return databaseSizeTextField; |
116 | 0 | } |
117 | 0 | |
118 | 0 | /** |
119 | * @return Returns the databaseLastModifiedPanel. | |
120 | */ | |
121 | 0 | protected JPanel getDatabaseLastModifiedPanel() { |
122 | 0 | if (databaseLastModifiedPanel == null) { |
123 | 0 | databaseLastModifiedPanel = new JPanel(); |
124 | 0 | databaseLastModifiedPanel.setBorder(new TitledBorder( |
125 | 0 | Messages.getString("common.lastmodified"))); //$NON-NLS-1$ |
126 | 0 | databaseLastModifiedPanel.setLayout(new BorderLayout()); |
127 | 0 | databaseLastModifiedPanel.add(getDatabaseLastModifiedTextField(), |
128 | 0 | BorderLayout.CENTER); |
129 | 0 | } |
130 | 0 | return databaseLastModifiedPanel; |
131 | 0 | } |
132 | ||
133 | /** | |
134 | * @return Returns the databaseLastModifiedTextField. | |
135 | */ | |
136 | 0 | protected JTextField getDatabaseLastModifiedTextField() { |
137 | 0 | if (databaseLastModifiedTextField == null) { |
138 | 0 | databaseLastModifiedTextField = new JTextField(); |
139 | 0 | databaseLastModifiedTextField.setText(new Date(new File( |
140 | 0 | ConfigurationManager.getInstance().getDataBasePath()) |
141 | 0 | .lastModified()).toString()); |
142 | 0 | databaseLastModifiedTextField.setEditable(false); |
143 | 0 | } |
144 | 0 | return databaseLastModifiedTextField; |
145 | 0 | } |
146 | } |
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |