Coverage details for ui.panel.EAddressPanel

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.panel;
21  
22 import java.awt.BorderLayout;
23 import java.awt.Color;
24 import java.awt.GridLayout;
25  
26 import javax.swing.JPanel;
27 import javax.swing.JTextField;
28 import javax.swing.border.TitledBorder;
29  
30 import ui.Messages;
31 import base.user.EAddress;
32  
33 @SuppressWarnings("serial") //$NON-NLS-1$
34 public class EAddressPanel extends JPanel {
35  
36     private JPanel addressPanel;
37  
38     private JTextField addressTextField;
39  
40     private JPanel descriptionPanel;
41  
42     private JTextField descriptionTextField;
43  
44     private EAddress eAddress;
45  
46     /**
47      * @param eAddress
48      * The eAddress from whic must be retrieved each displayed
49      * information.
500     */
510    public EAddressPanel(EAddress eAddress) {
520        this.eAddress = eAddress;
530        initialize();
540    }
550 
560    protected void initialize() {
570        this.setLayout(new GridLayout(2, 1));
580        this.add(getAddressPanel());
590        this.add(getDescriptionPanel());
600    }
610 
62     /**
63      * @return Returns the addressPanel.
64      */
650    protected JPanel getAddressPanel() {
660        if (addressPanel == null) {
670            addressPanel = new JPanel();
680            addressPanel.setBorder(new TitledBorder(Messages.getString("common.elettronicmailaddress"))); //$NON-NLS-1$
690            addressPanel.setLayout(new BorderLayout());
700            addressPanel.add(getAddressTextField(), BorderLayout.CENTER);
710        }
720        return addressPanel;
730    }
74  
75     /**
76      * @return Returns the addressTextField.
77      */
780    protected JTextField getAddressTextField() {
790        if (addressTextField == null) {
800            addressTextField = new JTextField(eAddress != null ? eAddress
810                    .toString() : ""); //$NON-NLS-1$
820        }
830        return addressTextField;
840    }
85  
86     /**
87      * @return Returns the descriptionPanel.
88      */
890    protected JPanel getDescriptionPanel() {
900        if (descriptionPanel == null) {
910            descriptionPanel = new JPanel();
920            descriptionPanel.setBorder(new TitledBorder(Messages.getString("common.description"))); //$NON-NLS-1$
930            descriptionPanel.setLayout(new BorderLayout());
940            descriptionPanel
950                    .add(getDescriptionTextField(), BorderLayout.CENTER);
960        }
970        return descriptionPanel;
980    }
99  
100     /**
101      * @return Returns the descriptionTextField.
102      */
1030    protected JTextField getDescriptionTextField() {
1040        if (descriptionTextField == null) {
1050            descriptionTextField = new JTextField(eAddress != null ? eAddress
1060                    .getDescription() : ""); //$NON-NLS-1$
1070        }
1080        return descriptionTextField;
1090    }
110  
1110    public String getEAddress() {
1120        return this.addressTextField.getText();
1130    }
114  
1150    public String getEAddressDescription() {
1160        return this.descriptionTextField.getText();
1170    }
118  
1190    public void setAddressError(boolean isError) {
1200        if (isError)
1210            ((TitledBorder) this.getAddressPanel().getBorder())
1220                    .setTitleColor(Color.RED);
1230        else
1240            ((TitledBorder) this.getAddressPanel().getBorder())
1250                    .setTitleColor(new TitledBorder("").getTitleColor()); //$NON-NLS-1$
1260        this.getAddressPanel().updateUI();
1270    }
1280}

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.