Coverage details for base.jdbs.ui.panel.PeerPanel

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  
21 package base.jdbs.ui.panel;
22  
23 import java.awt.BorderLayout;
24 import java.awt.Dimension;
25  
26 import javax.swing.JPanel;
27 import javax.swing.JScrollPane;
28 import javax.swing.JTable;
29 import javax.swing.border.TitledBorder;
30 import javax.swing.table.TableModel;
31  
32 import org.apache.log4j.Logger;
33  
34 import ui.table.TableSorter;
35 import base.jdbs.ui.PeerTableModel;
36  
37 @SuppressWarnings("serial")
380public class PeerPanel extends JPanel{
39     
400    private static final transient Logger logger = Logger.getLogger(PeerPanel.class.getName());
41  
42     /**The table where the neighborhood peers must be shown.**/
43     private JTable peerTable;
44     /**This is needed to scroll the peers displayed in the peerTable.**/
45     private JScrollPane peerTableScrollPane;
46     /**This is needed to sort the content of the peerTable.**/
47     private TableSorter peerTableSorter;
48     /**This is the model for the network table.**/
49     private TableModel peerTableModel;
50     /**The button panel is needed to offer some functions to the user.**/
51     private JPanel buttonPanel;
52     
53     /**This is the default constructor.**/
540    public PeerPanel(){
550        initialize();
560    }
57     
58     /**
59      * This method initializes the panel configuring and setting its components.
60      */
61     protected void initialize(){
620        this.setBorder(new TitledBorder("Peer Panel"));
630        this.setLayout(new BorderLayout());
640        this.add(getPeerTableScrollPane(), BorderLayout.CENTER);
650        this.add(getButtonPanel(), BorderLayout.EAST);
660    }
67     
68     /**
69      * @return Returns the peerTable.
70      */
71     protected JTable getPeerTable() {
720        if (peerTable == null) {
730            peerTable = new JTable(getPeerTableSorter());
740            peerTable.setPreferredScrollableViewportSize(new Dimension(500, 70));
75             // We need to place it here to avoid a ciclyc call...
760            peerTableSorter.setTableHeader(peerTable.getTableHeader());
77             // Set up tool tips for column headers.
780            peerTable.getTableHeader().setToolTipText("Click to specify sorting; Control-Click to specify secondary sorting.");
79         }
800        return peerTable;
81     }
82  
83     /**
84      * @return Returns the peerTableScrollPane.
85      */
86     protected JScrollPane getPeerTableScrollPane() {
870        if (peerTableScrollPane == null) {
880            peerTableScrollPane = new JScrollPane(getPeerTable());
89         }
900        return peerTableScrollPane;
91     }
92  
93     /**
94      * @return Returns the peerTableSorter.
95      */
96     protected TableSorter getPeerTableSorter() {
970        if (peerTableSorter == null) {
980            peerTableSorter = new TableSorter(getPeerTableModel());
99         }
1000        return peerTableSorter;
101     }
102     
103     /**
104      * @return Returns the peerTableModel.
105      */
106     protected TableModel getPeerTableModel() {
1070        if (peerTableModel == null) {
1080            peerTableModel = new PeerTableModel();
109         }
1100        return peerTableModel;
111     }
112  
113     /**
114      * @return the buttonPanel
115      */
116     protected JPanel getButtonPanel() {
1170        if(buttonPanel == null){
1180            buttonPanel = new JPanel();
1190            buttonPanel.setLayout(new BorderLayout());
120         }
1210        return buttonPanel;
122     }
123 }

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.