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.frame; | |
21 | ||
22 | import java.awt.BorderLayout; | |
23 | import java.awt.event.MouseEvent; | |
24 | import java.awt.event.MouseListener; | |
25 | import java.awt.event.WindowEvent; | |
26 | import java.awt.event.WindowListener; | |
27 | import java.util.Date; | |
28 | ||
29 | import javax.swing.ImageIcon; | |
30 | import javax.swing.JFrame; | |
31 | import javax.swing.JPanel; | |
32 | import javax.swing.JTabbedPane; | |
33 | ||
34 | import org.apache.log4j.Logger; | |
35 | ||
36 | import ui.ICMenuBar; | |
37 | import ui.Messages; | |
38 | import ui.command.CommandExecutor; | |
39 | import ui.command.IO.ExitCommand; | |
40 | import ui.panel.ICConfigurationPanel; | |
41 | import ui.panel.ICInfoPanel; | |
42 | import ui.panel.ICInventoryPanel; | |
43 | import ui.panel.ICNetworkPanel; | |
44 | import ui.panel.ICServicePanel; | |
45 | import ui.panel.ICSessionPanel; | |
46 | import ui.panel.ICStatisticPanel; | |
47 | import ui.panel.ICUserPanel; | |
48 | import base.ConfigurationManager; | |
49 | import base.InternetCafe; | |
50 | ||
51 | 0 | @SuppressWarnings("serial") //$NON-NLS-1$ |
52 | 0 | public class ICMainFrame extends JFrame { |
53 | 0 | |
54 | 0 | private static final transient Logger logger = Logger |
55 | 0 | .getLogger(ICMainFrame.class.getName()); |
56 | ||
57 | private JTabbedPane tabbedPane; | |
58 | 0 | |
59 | 0 | public ICMainFrame() { |
60 | 0 | initialize(); |
61 | 0 | } |
62 | ||
63 | 0 | protected void initialize() { |
64 | 0 | this.setTitle(ConfigurationManager.getInstance().getInternetCafeName()); |
65 | 0 | this.setJMenuBar(new ICMenuBar()); |
66 | 0 | setDefaultCloseOperation(javax.swing.JFrame.DO_NOTHING_ON_CLOSE); |
67 | 0 | setSize(1024, 768); |
68 | 0 | setResizable(true); |
69 | 0 | JPanel panel = new JPanel(); |
70 | 0 | panel.setLayout(new BorderLayout()); |
71 | 0 | panel.add(InternetCafe.getToolBar(), BorderLayout.NORTH); |
72 | 0 | panel.add(getTabbedPane(), BorderLayout.CENTER); |
73 | 0 | panel.add(InternetCafe.getStatusBar(), BorderLayout.SOUTH); |
74 | 0 | |
75 | 0 | this.setContentPane(panel); |
76 | 0 | |
77 | 0 | this.addWindowListener(new WindowListener() { |
78 | ||
79 | public void windowOpened(WindowEvent arg0) { | |
80 | // TODO Auto-generated method stub | |
81 | ||
82 | } | |
83 | ||
84 | public void windowClosing(WindowEvent arg0) { | |
85 | CommandExecutor.getInstance().executeCommand(new ExitCommand(), | |
86 | false); | |
87 | } | |
88 | ||
89 | public void windowClosed(WindowEvent arg0) { | |
90 | // CommandExecutor.getInstance().executeCommand(new | |
91 | // ExitCommand()); | |
92 | ||
93 | } | |
94 | ||
95 | public void windowIconified(WindowEvent arg0) { | |
96 | // TODO Auto-generated method stub | |
97 | ||
98 | } | |
99 | ||
100 | public void windowDeiconified(WindowEvent arg0) { | |
101 | // TODO Auto-generated method stub | |
102 | ||
103 | } | |
104 | ||
105 | public void windowActivated(WindowEvent arg0) { | |
106 | // TODO Auto-generated method stub | |
107 | ||
108 | } | |
109 | ||
110 | public void windowDeactivated(WindowEvent arg0) { | |
111 | // TODO Auto-generated method stub | |
112 | ||
113 | } | |
114 | ||
115 | 0 | }); |
116 | 0 | } |
117 | ||
118 | /** | |
119 | * @return Returns the tabbedPane. | |
120 | */ | |
121 | 0 | protected JTabbedPane getTabbedPane() { |
122 | 0 | if (tabbedPane == null) { |
123 | 0 | tabbedPane = new JTabbedPane(); |
124 | 0 | tabbedPane.addTab(Messages.getString("mainframe.info"), new ImageIcon(this.getClass() //$NON-NLS-1$ |
125 | 0 | .getResource("/icon/16x16/places/start-here.png")), //$NON-NLS-1$ |
126 | 0 | new ICInfoPanel(), ConfigurationManager.getInstance() |
127 | 0 | .getInternetCafeName() |
128 | 0 | + Messages.getString("mainframe.tooltip.infoof")); //$NON-NLS-1$ |
129 | 0 | tabbedPane.addTab(Messages.getString("mainframe.users"), new ImageIcon(this.getClass() //$NON-NLS-1$ |
130 | 0 | .getResource("/icon/16x16/apps/system-users.png")), //$NON-NLS-1$ |
131 | 0 | new ICUserPanel(), Messages.getString("mainframe.tooltip.manageusers")); //$NON-NLS-1$ |
132 | 0 | tabbedPane |
133 | 0 | .addTab( |
134 | 0 | Messages.getString("mainframe.sessions"), //$NON-NLS-1$ |
135 | 0 | new ImageIcon( |
136 | 0 | this |
137 | 0 | .getClass() |
138 | 0 | .getResource( |
139 | 0 | "/icon/16x16/apps/preferences-system-windows.png")), //$NON-NLS-1$ |
140 | 0 | new ICSessionPanel(), Messages.getString("mainframe.tooltip.managesessions")); //$NON-NLS-1$ |
141 | 0 | tabbedPane.addTab(Messages.getString("mainframe.services"), new ImageIcon(this.getClass() //$NON-NLS-1$ |
142 | 0 | .getResource("/icon/16x16/apps/internet-web-browser.png")), //$NON-NLS-1$ |
143 | 0 | new ICServicePanel(), Messages.getString("mainframe.tooltip.manageservices")); //$NON-NLS-1$ |
144 | 0 | tabbedPane.addTab(Messages.getString("mainframe.network"), new ImageIcon(this.getClass() //$NON-NLS-1$ |
145 | 0 | .getResource("/icon/16x16/places/network-workgroup.png")), //$NON-NLS-1$ |
146 | 0 | new ICNetworkPanel(), Messages.getString("mainframe.tooltip.managenetwork")); //$NON-NLS-1$ |
147 | 0 | tabbedPane.addTab(Messages.getString("mainframe.inventory"), //$NON-NLS-1$ |
148 | 0 | new ImageIcon(this.getClass().getResource( |
149 | 0 | "/icon/16x16/actions/format-justify-fill.png")), //$NON-NLS-1$ |
150 | 0 | new ICInventoryPanel(), Messages.getString("mainframe.tooltip.manageinventory")); //$NON-NLS-1$ |
151 | 0 | tabbedPane.addTab(Messages.getString("mainframe.statistics"), new ImageIcon(this.getClass() //$NON-NLS-1$ |
152 | 0 | .getResource( |
153 | 0 | "/icon/16x16/mimetypes/x-office-spreadsheet.png")), //$NON-NLS-1$ |
154 | 0 | new ICStatisticPanel(), Messages.getString("mainframe.tooltip.manageinventory")); //$NON-NLS-1$ |
155 | 0 | tabbedPane.addTab(Messages.getString("mainframe.configuration"), new ImageIcon(this.getClass() //$NON-NLS-1$ |
156 | 0 | .getResource( |
157 | 0 | "/icon/16x16/categories/preferences-desktop.png")), //$NON-NLS-1$ |
158 | 0 | new ICConfigurationPanel(), |
159 | 0 | Messages.getString("mainframe.tooltip.manageconfiguration")); //$NON-NLS-1$ |
160 | 0 | tabbedPane.addMouseListener(new MouseListener() { |
161 | ||
162 | public void mouseClicked(MouseEvent arg0) { | |
163 | Date currentDate = new Date(); | |
164 | logger.debug("Last Seen User Working: " + currentDate); //$NON-NLS-1$ | |
165 | ConfigurationManager.getInstance().setLastSeenUserWorking( | |
166 | currentDate); | |
167 | } | |
168 | ||
169 | public void mousePressed(MouseEvent arg0) { | |
170 | // TODO Auto-generated method stub | |
171 | ||
172 | } | |
173 | ||
174 | public void mouseReleased(MouseEvent arg0) { | |
175 | // TODO Auto-generated method stub | |
176 | ||
177 | } | |
178 | ||
179 | public void mouseEntered(MouseEvent arg0) { | |
180 | // TODO Auto-generated method stub | |
181 | ||
182 | } | |
183 | ||
184 | public void mouseExited(MouseEvent arg0) { | |
185 | // TODO Auto-generated method stub | |
186 | ||
187 | } | |
188 | ||
189 | }); | |
190 | 0 | } |
191 | 0 | return tabbedPane; |
192 | } | |
193 | } |
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |