Coverage details for ui.panel.NAddressPanel

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.Dimension;
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.NAddress;
32  
33 @SuppressWarnings("serial") //$NON-NLS-1$
34 public class NAddressPanel extends JPanel {
350 
360    public NAddressPanel(NAddress address) {
370        this.address = address;
380        initialize();
390    }
400 
410    protected void initialize() {
420        this.setSize(new Dimension(400, 320));
430        this.setPreferredSize(new Dimension(400, 320));
440        this.setMinimumSize(new Dimension(400, 320));
450        this.setLayout(new GridLayout(6, 1));
460        this.add(getStreetPanel(), null);
470        this.add(getCityPanel(), null);
480        this.add(getRegionPanel(), null);
490        this.add(getNationPanel(), null);
500        this.add(getPostalCodePanel(), null);
510        this.add(getDescriptionPanel(), null);
520    }
530 
54     private NAddress address;
55  
56     private JPanel cityPanel;
57  
58     private JPanel nationPanel;
59  
60     private JPanel streetPanel;
61  
62     private JPanel regionPanel;
63  
64     private JPanel postalCodePanel;
65  
66     private JPanel descriptionPanel;
67  
68     private JTextField cityTextField;
69  
70     private JTextField nationTextField;
71  
72     private JTextField streetTextField;
73  
74     private JTextField regionTextField;
75  
76     private JTextField postalCodeTextField;
77  
78     private JTextField descriptionTextField;
79  
80     /**
81      * @return Returns the cityPanel.
82      */
830    protected JPanel getCityPanel() {
840        if (cityPanel == null) {
850            cityPanel = new JPanel();
860            TitledBorder titledBorder = new TitledBorder(Messages.getString("common.city")); //$NON-NLS-1$
870            cityPanel.setBorder(titledBorder);
880            cityPanel.setLayout(new BorderLayout());
890            cityPanel.add(getCityTextField(), BorderLayout.CENTER);
900        }
910        return cityPanel;
920    }
93  
94     /**
95      * @return Returns the cityTextField.
96      */
970    protected JTextField getCityTextField() {
980        if (cityTextField == null) {
990            cityTextField = new JTextField(address == null ? "" : address //$NON-NLS-1$
1000                    .getCity());
1010        }
1020        return cityTextField;
1030    }
104  
105     /**
106      * @return Returns the descriptionPanel.
107      */
1080    protected JPanel getDescriptionPanel() {
1090        if (descriptionPanel == null) {
1100            descriptionPanel = new JPanel();
1110            TitledBorder titledBorder = new TitledBorder(Messages.getString("common.description")); //$NON-NLS-1$
1120            descriptionPanel.setBorder(titledBorder);
1130            descriptionPanel.setLayout(new BorderLayout());
1140            descriptionPanel
1150                    .add(getDescriptionTextField(), BorderLayout.CENTER);
1160        }
1170        return descriptionPanel;
1180    }
119  
120     /**
121      * @return Returns the descriptionTextField.
122      */
1230    protected JTextField getDescriptionTextField() {
1240        if (descriptionTextField == null) {
1250            descriptionTextField = new JTextField(address == null ? "" //$NON-NLS-1$
1260                    : address.getDescription());
1270        }
1280        return descriptionTextField;
1290    }
130  
131     /**
132      * @return Returns the nationPanel.
133      */
1340    protected JPanel getNationPanel() {
1350        if (nationPanel == null) {
1360            nationPanel = new JPanel();
1370            TitledBorder titledBorder = new TitledBorder(Messages.getString("common.nation")); //$NON-NLS-1$
1380            nationPanel.setBorder(titledBorder);
1390            nationPanel.setLayout(new BorderLayout());
1400            nationPanel.add(getNationTextField(), BorderLayout.CENTER);
1410        }
1420        return nationPanel;
1430    }
144  
145     /**
146      * @return Returns the nationTextField.
147      */
1480    protected JTextField getNationTextField() {
1490        if (nationTextField == null) {
1500            nationTextField = new JTextField(address == null ? "" : address //$NON-NLS-1$
1510                    .getNation());
1520        }
1530        return nationTextField;
1540    }
155  
156     /**
157      * @return Returns the postalCodePanel.
158      */
1590    protected JPanel getPostalCodePanel() {
1600        if (postalCodePanel == null) {
1610            postalCodePanel = new JPanel();
1620            TitledBorder titledBorder = new TitledBorder(Messages.getString("common.postalcode")); //$NON-NLS-1$
1630            postalCodePanel.setBorder(titledBorder);
1640            postalCodePanel.setLayout(new BorderLayout());
1650            postalCodePanel.add(getPostalCodeTextField(), BorderLayout.CENTER);
1660        }
1670        return postalCodePanel;
1680    }
169  
170     /**
171      * @return Returns the postalCodeTextField.
172      */
1730    protected JTextField getPostalCodeTextField() {
1740        if (postalCodeTextField == null) {
1750            postalCodeTextField = new JTextField(address == null ? "" : address //$NON-NLS-1$
1760                    .getPostalCode());
1770        }
1780        return postalCodeTextField;
1790    }
180  
181     /**
182      * @return Returns the regionPanel.
183      */
1840    protected JPanel getRegionPanel() {
1850        if (regionPanel == null) {
1860            regionPanel = new JPanel();
1870            TitledBorder titledBorder = new TitledBorder(Messages.getString("common.region")); //$NON-NLS-1$
1880            regionPanel.setBorder(titledBorder);
1890            regionPanel.setLayout(new BorderLayout());
1900            regionPanel.add(getRegionTextField(), BorderLayout.CENTER);
1910        }
1920        return regionPanel;
1930    }
194  
195     /**
196      * @return Returns the regionTextField.
197      */
1980    protected JTextField getRegionTextField() {
1990        if (regionTextField == null) {
2000            regionTextField = new JTextField(address == null ? "" : address //$NON-NLS-1$
2010                    .getRegion());
2020        }
2030        return regionTextField;
2040    }
205  
206     /**
207      * @return Returns the streetPanel.
208      */
2090    protected JPanel getStreetPanel() {
2100        if (streetPanel == null) {
2110            streetPanel = new JPanel();
2120            TitledBorder titledBorder = new TitledBorder(Messages.getString("common.street")); //$NON-NLS-1$
2130            streetPanel.setBorder(titledBorder);
2140            streetPanel.setLayout(new BorderLayout());
2150            streetPanel.add(getStreetTextField(), BorderLayout.CENTER);
2160        }
2170 
2180        return streetPanel;
2190    }
220  
221     /**
222      * @return Returns the streetTextField.
223      */
2240    protected JTextField getStreetTextField() {
2250        if (streetTextField == null) {
2260            streetTextField = new JTextField(address == null ? "" : address //$NON-NLS-1$
2270                    .getStreet());
2280        }
2290        return streetTextField;
2300    }
231  
2320    public String getNAddressCity() {
2330        return this.getCityTextField().getText();
2340    }
235  
2360    public String getNAddressNation() {
2370        return this.getNationTextField().getText();
2380    }
239  
2400    public String getNAddressStreet() {
2410        return this.getStreetTextField().getText();
2420    }
243  
2440    public String getNAddressRegion() {
2450        return this.getRegionTextField().getText();
2460    }
247  
2480    public String getNAddressPostalCode() {
2490        return this.getPostalCodeTextField().getText();
2500    }
251  
2520    public String getNAddressDescription() {
2530        return this.getDescriptionTextField().getText();
2540    }
255  
256 }

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.