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; | |
21 | ||
22 | import java.awt.event.ActionEvent; | |
23 | import java.awt.event.ActionListener; | |
24 | ||
25 | import javax.swing.ImageIcon; | |
26 | import javax.swing.JButton; | |
27 | import javax.swing.JToolBar; | |
28 | ||
29 | import org.apache.log4j.Logger; | |
30 | ||
31 | import ui.command.CommandExecutor; | |
32 | import ui.command.IO.LogOutAdministratorCommand; | |
33 | import ui.command.IO.SaveDBCommand; | |
34 | import ui.command.creation.ShowNewClientWorkstationDialogCommand; | |
35 | import ui.command.creation.ShowNewServiceDialogCommand; | |
36 | import ui.command.creation.ShowNewSessionDialogCommand; | |
37 | import ui.command.creation.ShowNewUserDialogCommand; | |
38 | ||
39 | @SuppressWarnings("serial") //$NON-NLS-1$ | |
40 | 0 | public class ICToolBar extends JToolBar { |
41 | ||
42 | 0 | private static final transient Logger logger = Logger |
43 | 0 | .getLogger(ICToolBar.class.getName()); |
44 | ||
45 | private JButton newUserButton; | |
46 | ||
47 | private JButton newSessionButton; | |
48 | ||
49 | private JButton newServiceButton; | |
50 | ||
51 | private JButton newClientWorkstationButton; | |
52 | ||
53 | private JButton saveDBButton; | |
54 | ||
55 | private JButton logOutButton; | |
56 | ||
57 | 0 | public ICToolBar() { |
58 | 0 | initialize(); |
59 | 0 | } |
60 | ||
61 | protected void initialize() { | |
62 | 0 | this.setOrientation(JToolBar.HORIZONTAL); |
63 | 0 | this.setOpaque(true); |
64 | 0 | this.add(getNewUserButton()); |
65 | 0 | this.add(getNewSessionButton()); |
66 | 0 | this.add(getNewServiceButton()); |
67 | 0 | this.add(getNewClientWorkstationButton()); |
68 | 0 | this.add(getSaveDBButton()); |
69 | 0 | this.add(getLogOutButton()); |
70 | 0 | } |
71 | ||
72 | /** | |
73 | * @return Returns the newServiceButton. | |
74 | */ | |
75 | protected JButton getNewServiceButton() { | |
76 | 0 | if (newServiceButton == null) { |
77 | 0 | newServiceButton = new JButton(); |
78 | 0 | newServiceButton.setToolTipText(Messages.getString("toolbar.newservice")); //$NON-NLS-1$ |
79 | 0 | newServiceButton |
80 | 0 | .setIcon(new ImageIcon( |
81 | 0 | this |
82 | 0 | .getClass() |
83 | 0 | .getResource( |
84 | 0 | "/icon/22x22/apps/preferences-desktop-remote-desktop.png"))); //$NON-NLS-1$ |
85 | 0 | newServiceButton.addActionListener(new ActionListener() { |
86 | public void actionPerformed(ActionEvent arg0) { | |
87 | logger.debug("actionPerformed newServiceButton"); //$NON-NLS-1$ | |
88 | CommandExecutor.getInstance().executeCommand( | |
89 | new ShowNewServiceDialogCommand(), false); | |
90 | } | |
91 | }); | |
92 | } | |
93 | 0 | return newServiceButton; |
94 | } | |
95 | ||
96 | /** | |
97 | * @return Returns the newSessionButton. | |
98 | */ | |
99 | protected JButton getNewSessionButton() { | |
100 | 0 | if (newSessionButton == null) { |
101 | 0 | newSessionButton = new JButton(); |
102 | 0 | newSessionButton.setToolTipText(Messages.getString("toolbar.newsession")); //$NON-NLS-1$ |
103 | 0 | newSessionButton.setIcon(new ImageIcon(this.getClass().getResource( |
104 | 0 | "/icon/22x22/actions/window-new.png"))); //$NON-NLS-1$ |
105 | 0 | newSessionButton.addActionListener(new ActionListener() { |
106 | public void actionPerformed(ActionEvent arg0) { | |
107 | logger.debug("actionPerformed newSessionButton"); //$NON-NLS-1$ | |
108 | CommandExecutor.getInstance().executeCommand( | |
109 | new ShowNewSessionDialogCommand(), false); | |
110 | } | |
111 | }); | |
112 | } | |
113 | 0 | return newSessionButton; |
114 | } | |
115 | ||
116 | /** | |
117 | * @return Returns the newUserButton. | |
118 | */ | |
119 | protected JButton getNewUserButton() { | |
120 | 0 | if (newUserButton == null) { |
121 | 0 | newUserButton = new JButton(); |
122 | 0 | newUserButton.setToolTipText(Messages.getString("toolbar.newuser")); //$NON-NLS-1$ |
123 | 0 | newUserButton.setIcon(new ImageIcon(this.getClass().getResource( |
124 | 0 | "/icon/22x22/actions/contact-new.png"))); //$NON-NLS-1$ |
125 | 0 | newUserButton.addActionListener(new ActionListener() { |
126 | public void actionPerformed(ActionEvent arg0) { | |
127 | logger.debug("actionPerformed newUserButton"); //$NON-NLS-1$ | |
128 | CommandExecutor.getInstance().executeCommand( | |
129 | new ShowNewUserDialogCommand(), false); | |
130 | } | |
131 | }); | |
132 | } | |
133 | 0 | return newUserButton; |
134 | } | |
135 | ||
136 | /** | |
137 | * @return Returns the saveDBButton. | |
138 | */ | |
139 | protected JButton getSaveDBButton() { | |
140 | 0 | if (saveDBButton == null) { |
141 | 0 | saveDBButton = new JButton(); |
142 | 0 | saveDBButton.setToolTipText(Messages.getString("toolbar.savedatabaseas")); //$NON-NLS-1$ |
143 | 0 | saveDBButton.setIcon(new ImageIcon(this.getClass().getResource( |
144 | 0 | "/icon/22x22/actions/document-save.png"))); //$NON-NLS-1$ |
145 | ||
146 | 0 | saveDBButton.addActionListener(new ActionListener() { |
147 | public void actionPerformed(ActionEvent arg0) { | |
148 | logger.debug("actionPerformed saveDBButton"); //$NON-NLS-1$ | |
149 | CommandExecutor.getInstance().executeCommand( | |
150 | new SaveDBCommand(), false); | |
151 | } | |
152 | }); | |
153 | } | |
154 | 0 | return saveDBButton; |
155 | } | |
156 | ||
157 | /** | |
158 | * @return Returns the logOutButton. | |
159 | */ | |
160 | protected JButton getLogOutButton() { | |
161 | 0 | if (logOutButton == null) { |
162 | 0 | logOutButton = new JButton(); |
163 | 0 | logOutButton.setToolTipText(Messages.getString("toolbar.logout")); //$NON-NLS-1$ |
164 | 0 | logOutButton.setIcon(new ImageIcon(this.getClass().getResource( |
165 | 0 | "/icon/22x22/actions/system-log-out.png"))); //$NON-NLS-1$ |
166 | 0 | logOutButton.addActionListener(new ActionListener() { |
167 | public void actionPerformed(ActionEvent arg0) { | |
168 | logger.debug("actionPerformed logOutButton"); //$NON-NLS-1$ | |
169 | CommandExecutor.getInstance().executeCommand( | |
170 | new LogOutAdministratorCommand(), false); | |
171 | } | |
172 | }); | |
173 | } | |
174 | 0 | return logOutButton; |
175 | } | |
176 | ||
177 | /** | |
178 | * @return Returns the newClientWorkstationButton. | |
179 | */ | |
180 | protected JButton getNewClientWorkstationButton() { | |
181 | 0 | if (newClientWorkstationButton == null) { |
182 | 0 | newClientWorkstationButton = new JButton(); |
183 | 0 | newClientWorkstationButton.setToolTipText(Messages.getString("toolbar.newclientworkstation")); //$NON-NLS-1$ |
184 | 0 | newClientWorkstationButton.setIcon(new ImageIcon(this.getClass() |
185 | 0 | .getResource("/icon/22x22/devices/computer.png"))); //$NON-NLS-1$ |
186 | ||
187 | 0 | newClientWorkstationButton.addActionListener(new ActionListener() { |
188 | public void actionPerformed(ActionEvent arg0) { | |
189 | logger.debug("actionPerformed newClientWorkstationButton"); //$NON-NLS-1$ | |
190 | CommandExecutor.getInstance().executeCommand( | |
191 | new ShowNewClientWorkstationDialogCommand(), false); | |
192 | } | |
193 | }); | |
194 | } | |
195 | 0 | return newClientWorkstationButton; |
196 | } | |
197 | ||
198 | } |
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |