| Line | Hits | Source |
|---|---|---|
| 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.GridLayout; | |
| 24 | ||
| 25 | import javax.swing.JPanel; | |
| 26 | import javax.swing.JTextField; | |
| 27 | import javax.swing.border.TitledBorder; | |
| 28 | ||
| 29 | import ui.Messages; | |
| 30 | import base.user.PhoneNumber; | |
| 31 | ||
| 32 | @SuppressWarnings("serial") //$NON-NLS-1$ | |
| 33 | public class PhoneNumberPanel extends JPanel { | |
| 34 | ||
| 35 | private JPanel areaCodePanel; | |
| 36 | ||
| 37 | private JTextField areaCodeTextField; | |
| 38 | ||
| 39 | private JPanel exchangePanel; | |
| 40 | ||
| 41 | private JTextField exchangeTextField; | |
| 42 | ||
| 43 | private JPanel numberPanel; | |
| 44 | ||
| 45 | private JTextField numberTextField; | |
| 46 | ||
| 47 | private JPanel descriptionPanel; | |
| 48 | ||
| 49 | private JTextField descriptionTextField; | |
| 50 | ||
| 51 | 0 | public String getPhoneNumberAreaCode() { |
| 52 | 0 | return this.getAreaCodeTextField().getText(); |
| 53 | 0 | } |
| 54 | ||
| 55 | 0 | public String getPhoneNumberExchange() { |
| 56 | 0 | return this.getExchangeTextField().getText(); |
| 57 | 0 | } |
| 58 | ||
| 59 | 0 | public String getPhoneNumberNumber() { |
| 60 | 0 | return this.getNumberTextField().getText(); |
| 61 | 0 | } |
| 62 | ||
| 63 | 0 | public String getPhoneNumberDescription() { |
| 64 | 0 | return this.getDescriptionTextField().getText(); |
| 65 | 0 | } |
| 66 | ||
| 67 | private PhoneNumber phoneNumber; | |
| 68 | ||
| 69 | /** | |
| 70 | * @param phoneNumber | |
| 71 | * The PhoneNumber from which the displayed informations must be | |
| 72 | * retrieved. | |
| 73 | 0 | */ |
| 74 | 0 | public PhoneNumberPanel(PhoneNumber phoneNumber) { |
| 75 | 0 | this.phoneNumber = phoneNumber; |
| 76 | 0 | initialize(); |
| 77 | 0 | } |
| 78 | 0 | |
| 79 | 0 | protected void initialize() { |
| 80 | 0 | this.setLayout(new GridLayout(4, 1)); |
| 81 | 0 | this.add(getAreaCodePanel()); |
| 82 | 0 | this.add(getExchangePanel()); |
| 83 | 0 | this.add(getNumberPanel()); |
| 84 | 0 | this.add(getDescriptionPanel()); |
| 85 | 0 | } |
| 86 | 0 | |
| 87 | /** | |
| 88 | * @return Returns the areaCodePanel. | |
| 89 | */ | |
| 90 | 0 | protected JPanel getAreaCodePanel() { |
| 91 | 0 | if (areaCodePanel == null) { |
| 92 | 0 | areaCodePanel = new JPanel(); |
| 93 | 0 | areaCodePanel.setBorder(new TitledBorder(Messages.getString("common.areacode"))); //$NON-NLS-1$ |
| 94 | 0 | areaCodePanel.setLayout(new BorderLayout()); |
| 95 | 0 | areaCodePanel.add(getAreaCodeTextField(), BorderLayout.CENTER); |
| 96 | 0 | } |
| 97 | 0 | return areaCodePanel; |
| 98 | 0 | } |
| 99 | ||
| 100 | /** | |
| 101 | * @return Returns the descriptionPanel. | |
| 102 | */ | |
| 103 | 0 | protected JPanel getDescriptionPanel() { |
| 104 | 0 | if (descriptionPanel == null) { |
| 105 | 0 | descriptionPanel = new JPanel(); |
| 106 | 0 | descriptionPanel.setBorder(new TitledBorder(Messages.getString("common.description"))); //$NON-NLS-1$ |
| 107 | 0 | descriptionPanel.setLayout(new BorderLayout()); |
| 108 | 0 | descriptionPanel |
| 109 | 0 | .add(getDescriptionTextField(), BorderLayout.CENTER); |
| 110 | 0 | } |
| 111 | 0 | return descriptionPanel; |
| 112 | 0 | } |
| 113 | ||
| 114 | /** | |
| 115 | * @return Returns the exchangePanel. | |
| 116 | */ | |
| 117 | 0 | protected JPanel getExchangePanel() { |
| 118 | 0 | if (exchangePanel == null) { |
| 119 | 0 | exchangePanel = new JPanel(); |
| 120 | 0 | exchangePanel.setBorder(new TitledBorder(Messages.getString("common.exchange"))); //$NON-NLS-1$ |
| 121 | 0 | exchangePanel.setLayout(new BorderLayout()); |
| 122 | 0 | exchangePanel.add(getExchangeTextField(), BorderLayout.CENTER); |
| 123 | 0 | } |
| 124 | 0 | return exchangePanel; |
| 125 | 0 | } |
| 126 | ||
| 127 | /** | |
| 128 | * @return Returns the numberPanel. | |
| 129 | */ | |
| 130 | 0 | protected JPanel getNumberPanel() { |
| 131 | 0 | if (numberPanel == null) { |
| 132 | 0 | numberPanel = new JPanel(); |
| 133 | 0 | numberPanel.setBorder(new TitledBorder(Messages.getString("common.number"))); //$NON-NLS-1$ |
| 134 | 0 | numberPanel.setLayout(new BorderLayout()); |
| 135 | 0 | numberPanel.add(getNumberTextField(), BorderLayout.CENTER); |
| 136 | 0 | } |
| 137 | 0 | return numberPanel; |
| 138 | 0 | } |
| 139 | ||
| 140 | /** | |
| 141 | * @return Returns the areaCodeTextField. | |
| 142 | */ | |
| 143 | 0 | protected JTextField getAreaCodeTextField() { |
| 144 | 0 | if (areaCodeTextField == null) { |
| 145 | 0 | areaCodeTextField = new JTextField(); |
| 146 | 0 | areaCodeTextField.setText(phoneNumber != null ? "" //$NON-NLS-1$ |
| 147 | 0 | + phoneNumber.getAreaCode() : Messages.getString("phonenumber.default.areacode")); //$NON-NLS-1$ |
| 148 | 0 | } |
| 149 | 0 | return areaCodeTextField; |
| 150 | 0 | } |
| 151 | ||
| 152 | /** | |
| 153 | * @return Returns the descriptionTextField. | |
| 154 | */ | |
| 155 | 0 | protected JTextField getDescriptionTextField() { |
| 156 | 0 | if (descriptionTextField == null) { |
| 157 | 0 | descriptionTextField = new JTextField(); |
| 158 | 0 | descriptionTextField.setText(phoneNumber != null ? phoneNumber |
| 159 | 0 | .getDescription() : ""); //$NON-NLS-1$ |
| 160 | 0 | } |
| 161 | 0 | return descriptionTextField; |
| 162 | 0 | } |
| 163 | ||
| 164 | /** | |
| 165 | * @return Returns the exchangeTextField. | |
| 166 | */ | |
| 167 | 0 | protected JTextField getExchangeTextField() { |
| 168 | 0 | if (exchangeTextField == null) { |
| 169 | 0 | exchangeTextField = new JTextField(); |
| 170 | 0 | exchangeTextField.setText(phoneNumber != null ? phoneNumber |
| 171 | 0 | .getExchange() : ""); //$NON-NLS-1$ |
| 172 | 0 | } |
| 173 | 0 | return exchangeTextField; |
| 174 | 0 | } |
| 175 | ||
| 176 | /** | |
| 177 | * @return Returns the numberTextField. | |
| 178 | */ | |
| 179 | 0 | protected JTextField getNumberTextField() { |
| 180 | 0 | if (numberTextField == null) { |
| 181 | 0 | numberTextField = new JTextField(); |
| 182 | 0 | numberTextField.setText(phoneNumber != null ? phoneNumber |
| 183 | 0 | .getNumber() : ""); //$NON-NLS-1$ |
| 184 | 0 | } |
| 185 | 0 | return numberTextField; |
| 186 | 0 | } |
| 187 | ||
| 188 | } |
|
this report was generated by version 1.0.5 of jcoverage. |
copyright © 2003, jcoverage ltd. all rights reserved. |