Coverage details for ui.table.UserTable

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.table;
21  
22 import javax.swing.DefaultCellEditor;
23 import javax.swing.JComboBox;
24 import javax.swing.JTable;
25 import javax.swing.ListSelectionModel;
26 import javax.swing.table.TableColumn;
27  
28 import ui.table.model.UserTableModel;
29 import base.user.UserCredential;
30 import base.user.UserGender;
31  
32 @SuppressWarnings("serial") //$NON-NLS-1$
33 public class UserTable extends JTable {
34     /**
35      * @param userTableSorter
36      */
37     public UserTable(TableSorter userTableSorter) {
380        super(userTableSorter);
390        initialize();
400    }
41  
42     protected void initialize() {
430        this.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
440        TableColumn idColumn = this.getColumnModel().getColumn(
450                UserTableModel.USER_ID_COLUMN);
460        idColumn.setPreferredWidth(30);
470        idColumn.setMaxWidth(60);
48  
490        TableColumn genderColumn = this.getColumnModel().getColumn(
500                UserTableModel.USER_GENDER_COLUMN);
510        DefaultCellEditor genderCellEditor = new DefaultCellEditor(
520                getUserGenderComboBox());
530        genderCellEditor.setClickCountToStart(2);
540        genderColumn.setCellEditor(genderCellEditor);
550        genderColumn.setPreferredWidth(30);
56  
570        TableColumn credentialColumn = this.getColumnModel().getColumn(
580                UserTableModel.USER_CREDENTIAL_COLUMN);
590        DefaultCellEditor credentialCellEditor = new DefaultCellEditor(
600                getUserCredentialComboBox());
610        credentialCellEditor.setClickCountToStart(2);
620        credentialColumn.setCellEditor(credentialCellEditor);
630        credentialColumn.setPreferredWidth(40);
640    }
65  
66     private JComboBox getUserGenderComboBox() {
670        JComboBox comboBox = new JComboBox();
680        for (int i = 0; i < UserGender.USER_GENDER.length; i++)
690            comboBox.addItem(UserGender.USER_GENDER[i]);
700        return comboBox;
71     }
72  
73     private JComboBox getUserCredentialComboBox() {
740        JComboBox comboBox = new JComboBox();
750        for (int i = 0; i < UserCredential.USER_CREDENTIAL.length; i++)
760            comboBox.addItem(UserCredential.USER_CREDENTIAL[i]);
770        return comboBox;
78     }
79  
80 }

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.