Coverage details for ui.ICToolBar

LineHitsSource
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$
400public class ICToolBar extends JToolBar {
41  
420    private static final transient Logger logger = Logger
430            .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  
570    public ICToolBar() {
580        initialize();
590    }
60  
61     protected void initialize() {
620        this.setOrientation(JToolBar.HORIZONTAL);
630        this.setOpaque(true);
640        this.add(getNewUserButton());
650        this.add(getNewSessionButton());
660        this.add(getNewServiceButton());
670        this.add(getNewClientWorkstationButton());
680        this.add(getSaveDBButton());
690        this.add(getLogOutButton());
700    }
71  
72     /**
73      * @return Returns the newServiceButton.
74      */
75     protected JButton getNewServiceButton() {
760        if (newServiceButton == null) {
770            newServiceButton = new JButton();
780            newServiceButton.setToolTipText(Messages.getString("toolbar.newservice")); //$NON-NLS-1$
790            newServiceButton
800                    .setIcon(new ImageIcon(
810                            this
820                                    .getClass()
830                                    .getResource(
840                                            "/icon/22x22/apps/preferences-desktop-remote-desktop.png"))); //$NON-NLS-1$
850            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         }
930        return newServiceButton;
94     }
95  
96     /**
97      * @return Returns the newSessionButton.
98      */
99     protected JButton getNewSessionButton() {
1000        if (newSessionButton == null) {
1010            newSessionButton = new JButton();
1020            newSessionButton.setToolTipText(Messages.getString("toolbar.newsession")); //$NON-NLS-1$
1030            newSessionButton.setIcon(new ImageIcon(this.getClass().getResource(
1040                    "/icon/22x22/actions/window-new.png"))); //$NON-NLS-1$
1050            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         }
1130        return newSessionButton;
114     }
115  
116     /**
117      * @return Returns the newUserButton.
118      */
119     protected JButton getNewUserButton() {
1200        if (newUserButton == null) {
1210            newUserButton = new JButton();
1220            newUserButton.setToolTipText(Messages.getString("toolbar.newuser")); //$NON-NLS-1$
1230            newUserButton.setIcon(new ImageIcon(this.getClass().getResource(
1240                    "/icon/22x22/actions/contact-new.png"))); //$NON-NLS-1$
1250            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         }
1330        return newUserButton;
134     }
135  
136     /**
137      * @return Returns the saveDBButton.
138      */
139     protected JButton getSaveDBButton() {
1400        if (saveDBButton == null) {
1410            saveDBButton = new JButton();
1420            saveDBButton.setToolTipText(Messages.getString("toolbar.savedatabaseas")); //$NON-NLS-1$
1430            saveDBButton.setIcon(new ImageIcon(this.getClass().getResource(
1440                    "/icon/22x22/actions/document-save.png"))); //$NON-NLS-1$
145  
1460            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         }
1540        return saveDBButton;
155     }
156  
157     /**
158      * @return Returns the logOutButton.
159      */
160     protected JButton getLogOutButton() {
1610        if (logOutButton == null) {
1620            logOutButton = new JButton();
1630            logOutButton.setToolTipText(Messages.getString("toolbar.logout")); //$NON-NLS-1$
1640            logOutButton.setIcon(new ImageIcon(this.getClass().getResource(
1650                    "/icon/22x22/actions/system-log-out.png"))); //$NON-NLS-1$
1660            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         }
1740        return logOutButton;
175     }
176  
177     /**
178      * @return Returns the newClientWorkstationButton.
179      */
180     protected JButton getNewClientWorkstationButton() {
1810        if (newClientWorkstationButton == null) {
1820            newClientWorkstationButton = new JButton();
1830            newClientWorkstationButton.setToolTipText(Messages.getString("toolbar.newclientworkstation")); //$NON-NLS-1$
1840            newClientWorkstationButton.setIcon(new ImageIcon(this.getClass()
1850                    .getResource("/icon/22x22/devices/computer.png"))); //$NON-NLS-1$
186  
1870            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         }
1950        return newClientWorkstationButton;
196     }
197  
198 }

this report was generated by version 1.0.5 of jcoverage.
visit www.jcoverage.com for updates.

copyright © 2003, jcoverage ltd. all rights reserved.
Java is a trademark of Sun Microsystems, Inc. in the United States and other countries.