0001: // The contents of this file are subject to the Mozilla Public License Version
0002: // 1.1
0003: //(the "License"); you may not use this file except in compliance with the
0004: //License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
0005: //
0006: //Software distributed under the License is distributed on an "AS IS" basis,
0007: //WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
0008: //for the specific language governing rights and
0009: //limitations under the License.
0010: //
0011: //The Original Code is "The Columba Project"
0012: //
0013: //The Initial Developers of the Original Code are Frederik Dietz and Timo
0014: // Stich.
0015: //Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
0016: //
0017: //All Rights Reserved.
0018: package org.columba.addressbook.gui.dialog.contact;
0019:
0020: import java.awt.BorderLayout;
0021: import java.awt.Container;
0022: import java.awt.Frame;
0023: import java.awt.Insets;
0024: import java.awt.event.ActionEvent;
0025: import java.awt.event.ActionListener;
0026: import java.net.MalformedURLException;
0027: import java.net.URL;
0028: import java.util.Iterator;
0029: import java.util.ResourceBundle;
0030:
0031: import javax.swing.Icon;
0032: import javax.swing.ImageIcon;
0033: import javax.swing.JButton;
0034: import javax.swing.JCheckBox;
0035: import javax.swing.JComboBox;
0036: import javax.swing.JComponent;
0037: import javax.swing.JDialog;
0038: import javax.swing.JLabel;
0039: import javax.swing.JPanel;
0040: import javax.swing.JScrollPane;
0041: import javax.swing.JTabbedPane;
0042: import javax.swing.JTextArea;
0043: import javax.swing.JTextField;
0044:
0045: import org.columba.addressbook.gui.base.FolderComboBox;
0046: import org.columba.addressbook.model.AddressModel;
0047: import org.columba.addressbook.model.ContactModel;
0048: import org.columba.addressbook.model.EmailModel;
0049: import org.columba.addressbook.model.IContactModel;
0050: import org.columba.addressbook.model.IEmailModel;
0051: import org.columba.addressbook.model.InstantMessagingModel;
0052: import org.columba.addressbook.model.PhoneModel;
0053: import org.columba.core.desktop.ColumbaDesktop;
0054: import org.columba.core.resourceloader.IconKeys;
0055: import org.columba.core.resourceloader.ImageLoader;
0056:
0057: import com.jgoodies.forms.factories.Borders;
0058: import com.jgoodies.forms.factories.DefaultComponentFactory;
0059: import com.jgoodies.forms.factories.FormFactory;
0060: import com.jgoodies.forms.layout.CellConstraints;
0061: import com.jgoodies.forms.layout.ColumnSpec;
0062: import com.jgoodies.forms.layout.FormLayout;
0063: import com.jgoodies.forms.layout.FormSpec;
0064: import com.jgoodies.forms.layout.RowSpec;
0065: import com.jgoodies.forms.layout.Sizes;
0066:
0067: /**
0068: * Contact Editor Dialog.
0069: * <p>
0070: * Editor doesn't change contact model, instead it uses a new contact model
0071: * instance. Use <code>getDestModel()</code> to retrieve the resulting contact
0072: * model, after the user is finished with editing.
0073: *
0074: * @author Frederik Dietz
0075: */
0076:
0077: public class ContactEditorDialog extends JDialog implements
0078: ActionListener {
0079:
0080: private JPanel dialogPane;
0081:
0082: private JPanel contentPane;
0083:
0084: private JTabbedPane tabbedPane2;
0085:
0086: private JPanel contactPanel;
0087:
0088: private JPanel panel7;
0089:
0090: private JButton pictureButton;
0091:
0092: private JButton formattedNameButton;
0093:
0094: private JTextField formattedNameTextField;
0095:
0096: private JLabel nicknameLabel;
0097:
0098: private JTextField nicknameTextField;
0099:
0100: private JLabel fileunderLabel;
0101:
0102: private JComboBox fileunderComboBox;
0103:
0104: private JLabel whereLabel;
0105:
0106: private FolderComboBox whereComboBox;
0107:
0108: private JButton categoriesButton;
0109:
0110: private JTextField categoriesTextField;
0111:
0112: private JComponent emailSeparator;
0113:
0114: private JComboBox emailComboBox1;
0115:
0116: private JTextField emailTextField1;
0117:
0118: private JComboBox emailComboBox2;
0119:
0120: private JTextField emailTextField2;
0121:
0122: private JComboBox emailComboBox3;
0123:
0124: private JTextField emailTextField3;
0125:
0126: private JComboBox emailComboBox4;
0127:
0128: private JTextField emailTextField4;
0129:
0130: private JCheckBox preferHtmlCheckBox;
0131:
0132: private JComponent telephoneSeparator;
0133:
0134: private JComboBox telephoneComboBox1;
0135:
0136: private JTextField telephoneTextField1;
0137:
0138: private JComboBox telephoneComboBox2;
0139:
0140: private JTextField telephoneTextField2;
0141:
0142: private JComboBox telephoneComboBox3;
0143:
0144: private JTextField telephoneTextField3;
0145:
0146: private JComboBox telephoneComboBox4;
0147:
0148: private JTextField telephoneTextField4;
0149:
0150: private JComponent imSeparator;
0151:
0152: private JComboBox imComboBox1;
0153:
0154: private JTextField imTextField1;
0155:
0156: private JComboBox imComboBox2;
0157:
0158: private JTextField imTextField2;
0159:
0160: private JComboBox imComboBox3;
0161:
0162: private JTextField imTextField3;
0163:
0164: private JComboBox imComboBox4;
0165:
0166: private JTextField imTextField4;
0167:
0168: private JPanel personalInfoPanel;
0169:
0170: private JComponent webAddressSeparator;
0171:
0172: private JLabel homepageLabel;
0173:
0174: private JPanel panel1;
0175:
0176: private JTextField homepageTextField;
0177:
0178: private JButton homepageButton;
0179:
0180: private JLabel weblogLabel;
0181:
0182: private JPanel panel5;
0183:
0184: private JTextField weblogTextField;
0185:
0186: private JButton weblogButton;
0187:
0188: private JLabel calendarLabel;
0189:
0190: private JPanel panel6;
0191:
0192: private JTextField calendarTextField;
0193:
0194: private JButton calendarButton;
0195:
0196: private JLabel freebusyLabel;
0197:
0198: private JPanel panel8;
0199:
0200: private JTextField freebusyTextField;
0201:
0202: private JButton freebusyButton;
0203:
0204: private JComponent jobSeparator;
0205:
0206: private JLabel professionLabel;
0207:
0208: private JTextField professionTextField;
0209:
0210: private JLabel titleLabel;
0211:
0212: private JTextField titleTextField;
0213:
0214: private JLabel companyLabel;
0215:
0216: private JTextField companyTextField;
0217:
0218: private JLabel departmentLabel;
0219:
0220: private JTextField departmentTextField;
0221:
0222: private JLabel managerLabel;
0223:
0224: private JTextField managerTextField;
0225:
0226: private JLabel officeLabel;
0227:
0228: private JTextField officeTextField;
0229:
0230: private JComponent miscellaneousSeparator;
0231:
0232: private JLabel birthdayLabel;
0233:
0234: private JComboBox birthdayComboBox;
0235:
0236: private JLabel notesLabel;
0237:
0238: private JScrollPane scrollPane3;
0239:
0240: private JTextArea notesTextArea;
0241:
0242: private JPanel mailingAddressPanel;
0243:
0244: private JComponent privateSeparator;
0245:
0246: private JLabel privateAddressLabel;
0247:
0248: private JScrollPane scrollPane1;
0249:
0250: private JTextArea privateAddressTextArea;
0251:
0252: private JLabel privateCityLabel;
0253:
0254: private JTextField privateCityTextField;
0255:
0256: private JLabel privateZipPostalCodeLabel;
0257:
0258: private JTextField privateZipPostalCodeTextField;
0259:
0260: private JLabel label1;
0261:
0262: private JTextField privateStreetTextField;
0263:
0264: private JLabel privateStateProvinceCountyLabel;
0265:
0266: private JTextField privateStateProvinceCountyTextField;
0267:
0268: private JLabel privatePOBoxLabel;
0269:
0270: private JTextField privatePOBoxTextField;
0271:
0272: private JLabel privateCountryLabel;
0273:
0274: private JTextField privateCountryTextField;
0275:
0276: private JComponent workSeparator;
0277:
0278: private JLabel workAddressLabel;
0279:
0280: private JScrollPane scrollPane2;
0281:
0282: private JTextArea workAddressTextArea;
0283:
0284: private JLabel workCityLabel;
0285:
0286: private JTextField workCityTextField;
0287:
0288: private JLabel workZipPostalCodeLabel;
0289:
0290: private JTextField workZipPostalCodeTextField;
0291:
0292: private JLabel label2;
0293:
0294: private JTextField workStreetTextField;
0295:
0296: private JLabel workStateProvinceCountyLabel;
0297:
0298: private JTextField workStateProvinceCountyTextField;
0299:
0300: private JLabel workPOBoxLabel;
0301:
0302: private JTextField workPOBoxTextField;
0303:
0304: private JLabel workCountryLabel;
0305:
0306: private JTextField workCountryTextField;
0307:
0308: private JComponent otherSeparator;
0309:
0310: private JLabel otherAddressLabel;
0311:
0312: private JScrollPane scrollPane4;
0313:
0314: private JTextArea otherAddressTextArea;
0315:
0316: private JLabel otherCityLabel;
0317:
0318: private JTextField otherCityTextField;
0319:
0320: private JLabel otherZipPostalCodeLabel;
0321:
0322: private JTextField otherZipPostalCodeTextField;
0323:
0324: private JLabel label3;
0325:
0326: private JTextField otherStreetTextField;
0327:
0328: private JLabel otherStateProvinceCountyLabel;
0329:
0330: private JTextField otherStateProvinceCountyTextField;
0331:
0332: private JLabel otherPOBoxLabel;
0333:
0334: private JTextField otherPOBoxTextField;
0335:
0336: private JLabel otherCountryLabel;
0337:
0338: private JTextField otherCountryTextField;
0339:
0340: private JPanel buttonBar;
0341:
0342: private JButton okButton;
0343:
0344: private JButton cancelButton;
0345:
0346: private FullNameDialog fullNameDialog;
0347:
0348: private ResourceBundle bundle;
0349:
0350: private IContactModel sourceModel;
0351:
0352: private ContactModel destModel;
0353:
0354: private boolean result = false;
0355:
0356: public ContactEditorDialog(Frame owner, IContactModel sourceModel) {
0357: super (owner, true);
0358:
0359: this .sourceModel = sourceModel;
0360:
0361: init();
0362: }
0363:
0364: public ContactEditorDialog(Frame owner) {
0365: super (owner, true);
0366:
0367: init();
0368: }
0369:
0370: /**
0371: *
0372: */
0373: private void init() {
0374: bundle = ResourceBundle
0375: .getBundle("org.columba.addressbook.i18n.dialog.contact");
0376:
0377: initComponents();
0378: layoutComponents();
0379:
0380: destModel = new ContactModel();
0381:
0382: fullNameDialog = new FullNameDialog(this );
0383:
0384: updateComponents(true);
0385:
0386: pack();
0387: setLocationRelativeTo(null);
0388: setVisible(true);
0389: }
0390:
0391: public void updateFullNameDialogComponents(boolean b) {
0392: if (b) {
0393:
0394: // leave dialog empty if no source contact model specified
0395: if (sourceModel == null)
0396: return;
0397:
0398: fullNameDialog.getNamePrefixTextField().setText(
0399: sourceModel.getNamePrefix());
0400: fullNameDialog.getLastNameTextField().setText(
0401: sourceModel.getFamilyName());
0402: fullNameDialog.getFirstNameTextField().setText(
0403: sourceModel.getGivenName());
0404: fullNameDialog.getMiddleNameTextField().setText(
0405: sourceModel.getAdditionalNames());
0406: fullNameDialog.getNameSuffixTextField().setText(
0407: sourceModel.getNameSuffix());
0408:
0409: } else {
0410: destModel.setNamePrefix(fullNameDialog
0411: .getNamePrefixTextField().getText());
0412: destModel.setFamilyName(fullNameDialog
0413: .getLastNameTextField().getText());
0414: destModel.setGivenName(fullNameDialog
0415: .getFirstNameTextField().getText());
0416: destModel.setAdditionalNames(fullNameDialog
0417: .getMiddleNameTextField().getText());
0418: destModel.setNameSuffix(fullNameDialog
0419: .getNameSuffixTextField().getText());
0420: }
0421: }
0422:
0423: public void updateComponents(boolean b) {
0424:
0425: updateFullNameDialogComponents(b);
0426:
0427: if (b) {
0428: // leave dialog empty if no source contact model specified
0429: if (sourceModel == null)
0430: return;
0431:
0432: // model -> view
0433: nicknameTextField.setText(sourceModel.getNickName());
0434: formattedNameTextField.setText(sourceModel
0435: .getFormattedName());
0436:
0437: fillSortStringComboBox();
0438: if (sourceModel.getSortString() != null) {
0439: fileunderComboBox.setSelectedItem(sourceModel
0440: .getSortString());
0441: }
0442:
0443: companyTextField.setText(sourceModel.getOrganisation());
0444: professionTextField.setText(sourceModel.getProfession());
0445: titleTextField.setText(sourceModel.getTitle());
0446:
0447: managerTextField.setText(sourceModel.getManager());
0448: departmentTextField.setText(sourceModel.getDepartment());
0449: officeTextField.setText(sourceModel.getOffice());
0450:
0451: homepageTextField.setText(sourceModel.getHomePage());
0452: weblogTextField.setText(sourceModel.getWeblog());
0453: freebusyTextField.setText(sourceModel.getFreeBusy());
0454: calendarTextField.setText(sourceModel.getCalendar());
0455:
0456: Icon image = null;
0457: if (sourceModel.getPhoto() != null)
0458: image = sourceModel.getPhoto();
0459: // fall back to default image
0460: if (image == null)
0461: image = ImageLoader.getMiscIcon("malehead.png");
0462: pictureButton.setIcon(image);
0463:
0464: // we support up to 4 email addresses
0465: Iterator it = sourceModel.getEmailIterator();
0466: if (it.hasNext()) {
0467: IEmailModel m = (IEmailModel) it.next();
0468: fillEmailView(m, emailComboBox1, emailTextField1);
0469: }
0470: if (it.hasNext()) {
0471: IEmailModel m = (IEmailModel) it.next();
0472: fillEmailView(m, emailComboBox2, emailTextField2);
0473: }
0474: if (it.hasNext()) {
0475: IEmailModel m = (IEmailModel) it.next();
0476: fillEmailView(m, emailComboBox3, emailTextField3);
0477: }
0478: if (it.hasNext()) {
0479: IEmailModel m = (IEmailModel) it.next();
0480: fillEmailView(m, emailComboBox4, emailTextField4);
0481: }
0482:
0483: // we support up to 4 phone entries
0484: it = sourceModel.getPhoneIterator();
0485: if (it.hasNext()) {
0486: PhoneModel m = (PhoneModel) it.next();
0487: fillPhoneView(m, telephoneComboBox1,
0488: telephoneTextField1);
0489: }
0490: if (it.hasNext()) {
0491: PhoneModel m = (PhoneModel) it.next();
0492: fillPhoneView(m, telephoneComboBox2,
0493: telephoneTextField2);
0494: }
0495: if (it.hasNext()) {
0496: PhoneModel m = (PhoneModel) it.next();
0497: fillPhoneView(m, telephoneComboBox3,
0498: telephoneTextField3);
0499: }
0500: if (it.hasNext()) {
0501: PhoneModel m = (PhoneModel) it.next();
0502: fillPhoneView(m, telephoneComboBox4,
0503: telephoneTextField4);
0504: }
0505:
0506: // we support up to 4 im entries
0507: it = sourceModel.getInstantMessagingIterator();
0508: if (it.hasNext()) {
0509: InstantMessagingModel m = (InstantMessagingModel) it
0510: .next();
0511: fillIMView(m, imComboBox1, imTextField1);
0512: }
0513: if (it.hasNext()) {
0514: InstantMessagingModel m = (InstantMessagingModel) it
0515: .next();
0516: fillIMView(m, imComboBox2, imTextField2);
0517: }
0518: if (it.hasNext()) {
0519: InstantMessagingModel m = (InstantMessagingModel) it
0520: .next();
0521: fillIMView(m, imComboBox3, imTextField3);
0522: }
0523: if (it.hasNext()) {
0524: InstantMessagingModel m = (InstantMessagingModel) it
0525: .next();
0526: fillIMView(m, imComboBox4, imTextField4);
0527: }
0528:
0529: // we support up to 3 address entries (work/private/other)
0530: it = sourceModel.getAddressIterator();
0531: if (it.hasNext()) {
0532: AddressModel m = (AddressModel) it.next();
0533: fillAddressView(m);
0534: }
0535: if (it.hasNext()) {
0536: AddressModel m = (AddressModel) it.next();
0537: fillAddressView(m);
0538: }
0539: if (it.hasNext()) {
0540: AddressModel m = (AddressModel) it.next();
0541: fillAddressView(m);
0542: }
0543:
0544: notesTextArea.setText(sourceModel.getNote());
0545:
0546: } else {
0547: // view -> model
0548: destModel.setNickName(nicknameTextField.getText());
0549: destModel
0550: .setFormattedName(formattedNameTextField.getText());
0551:
0552: if (fileunderComboBox.getSelectedItem() != null)
0553: destModel.setSortString((String) fileunderComboBox
0554: .getSelectedItem());
0555:
0556: destModel.setOrganisation(companyTextField.getText());
0557: destModel.setProfession(professionTextField.getText());
0558: destModel.setTitle(titleTextField.getText());
0559:
0560: destModel.setManager(managerTextField.getText());
0561: destModel.setDepartment(departmentTextField.getText());
0562: destModel.setOffice(officeTextField.getText());
0563:
0564: destModel.setHomePage(homepageTextField.getText());
0565: destModel.setWeblog(weblogTextField.getText());
0566: destModel.setFreeBusy(freebusyTextField.getText());
0567: destModel.setCalendar(calendarTextField.getText());
0568:
0569: // we support up to 4 email addresses
0570: fillEmailModel(emailTextField1, emailComboBox1, destModel);
0571: fillEmailModel(emailTextField2, emailComboBox2, destModel);
0572: fillEmailModel(emailTextField3, emailComboBox3, destModel);
0573: fillEmailModel(emailTextField4, emailComboBox4, destModel);
0574:
0575: // we support up to 4 phones
0576: fillPhoneModel(telephoneTextField1, telephoneComboBox1,
0577: destModel);
0578: fillPhoneModel(telephoneTextField2, telephoneComboBox2,
0579: destModel);
0580: fillPhoneModel(telephoneTextField3, telephoneComboBox3,
0581: destModel);
0582: fillPhoneModel(telephoneTextField4, telephoneComboBox4,
0583: destModel);
0584:
0585: // we support up to 4 im
0586: fillIMModel(imTextField1, imComboBox1, destModel);
0587: fillIMModel(imTextField2, imComboBox2, destModel);
0588: fillIMModel(imTextField3, imComboBox3, destModel);
0589: fillIMModel(imTextField4, imComboBox4, destModel);
0590:
0591: // we support 3 address types (work/home/other)
0592: fillAddressModel(AddressModel.TYPE_WORK, destModel);
0593: fillAddressModel(AddressModel.TYPE_HOME, destModel);
0594: fillAddressModel(AddressModel.TYPE_OTHER, destModel);
0595:
0596: destModel.setNote(notesTextArea.getText());
0597:
0598: Icon icon = pictureButton.getIcon();
0599: if (icon != null) {
0600: destModel.setPhoto((ImageIcon) icon);
0601: }
0602:
0603: }
0604: }
0605:
0606: /**
0607: * for example: "lastname, firstname" or "firstname lastname"
0608: */
0609: private void fillSortStringComboBox() {
0610: String ln = fullNameDialog.getLastNameTextField().getText();
0611: String fn = fullNameDialog.getFirstNameTextField().getText();
0612:
0613: if (ln != null && fn != null) {
0614: if (ln.length() != 0 && fn.length() != 0) {
0615: fileunderComboBox.addItem(ln + ", " + fn);
0616: fileunderComboBox.addItem(fn + " " + ln);
0617: }
0618:
0619: if (ln.length() != 0) {
0620: fileunderComboBox.addItem(ln);
0621: }
0622:
0623: if (fn.length() != 0) {
0624: fileunderComboBox.addItem(fn);
0625: }
0626:
0627: if (formattedNameTextField.getText() != null
0628: && formattedNameTextField.getText().length() > 0) {
0629: fileunderComboBox.addItem(formattedNameTextField
0630: .getText());
0631: }
0632:
0633: if (fileunderComboBox.getModel().getSize() > 0)
0634: fileunderComboBox.setSelectedIndex(0);
0635: }
0636: }
0637:
0638: private void fillIMModel(JTextField imTextField,
0639: JComboBox imComboBox, ContactModel destModel2) {
0640: if (imTextField.getText() != null) {
0641: if (imComboBox.getSelectedIndex() == 0)
0642: destModel
0643: .addInstantMessaging(new InstantMessagingModel(
0644: imTextField.getText(),
0645: InstantMessagingModel.TYPE_JABBER));
0646: else if (imComboBox.getSelectedIndex() == 1)
0647: destModel
0648: .addInstantMessaging(new InstantMessagingModel(
0649: imTextField.getText(),
0650: InstantMessagingModel.TYPE_AIM));
0651: else if (imComboBox.getSelectedIndex() == 2)
0652: destModel
0653: .addInstantMessaging(new InstantMessagingModel(
0654: imTextField.getText(),
0655: InstantMessagingModel.TYPE_YAHOO));
0656: else if (imComboBox.getSelectedIndex() == 3)
0657: destModel
0658: .addInstantMessaging(new InstantMessagingModel(
0659: imTextField.getText(),
0660: InstantMessagingModel.TYPE_MSN));
0661: else if (imComboBox.getSelectedIndex() == 4)
0662: destModel
0663: .addInstantMessaging(new InstantMessagingModel(
0664: imTextField.getText(),
0665: InstantMessagingModel.TYPE_ICQ));
0666: }
0667:
0668: }
0669:
0670: private void fillPhoneModel(JTextField telephoneTextField,
0671: JComboBox telephoneComboBox, ContactModel destModel2) {
0672: if (telephoneTextField.getText() != null) {
0673: if (telephoneComboBox.getSelectedIndex() == 0)
0674: destModel.addPhone(new PhoneModel(telephoneTextField
0675: .getText(), PhoneModel.TYPE_BUSINESS_PHONE));
0676: else if (telephoneComboBox.getSelectedIndex() == 1)
0677: destModel.addPhone(new PhoneModel(telephoneTextField
0678: .getText(), PhoneModel.TYPE_ASSISTANT_PHONE));
0679: else if (telephoneComboBox.getSelectedIndex() == 2)
0680: destModel.addPhone(new PhoneModel(telephoneTextField
0681: .getText(), PhoneModel.TYPE_BUSINESS_FAX));
0682: else if (telephoneComboBox.getSelectedIndex() == 3)
0683: destModel.addPhone(new PhoneModel(telephoneTextField
0684: .getText(), PhoneModel.TYPE_CALLBACK_PHONE));
0685: else if (telephoneComboBox.getSelectedIndex() == 4)
0686: destModel.addPhone(new PhoneModel(telephoneTextField
0687: .getText(), PhoneModel.TYPE_CAR_PHONE));
0688: else if (telephoneComboBox.getSelectedIndex() == 5)
0689: destModel.addPhone(new PhoneModel(telephoneTextField
0690: .getText(), PhoneModel.TYPE_COMPANY_PHONE));
0691: else if (telephoneComboBox.getSelectedIndex() == 6)
0692: destModel.addPhone(new PhoneModel(telephoneTextField
0693: .getText(), PhoneModel.TYPE_HOME_PHONE));
0694: else if (telephoneComboBox.getSelectedIndex() == 7)
0695: destModel.addPhone(new PhoneModel(telephoneTextField
0696: .getText(), PhoneModel.TYPE_HOME_FAX));
0697: else if (telephoneComboBox.getSelectedIndex() == 8)
0698: destModel.addPhone(new PhoneModel(telephoneTextField
0699: .getText(), PhoneModel.TYPE_ISDN));
0700: else if (telephoneComboBox.getSelectedIndex() == 9)
0701: destModel.addPhone(new PhoneModel(telephoneTextField
0702: .getText(), PhoneModel.TYPE_MOBILE_PHONE));
0703: else if (telephoneComboBox.getSelectedIndex() == 10)
0704: destModel.addPhone(new PhoneModel(telephoneTextField
0705: .getText(), PhoneModel.TYPE_OTHER_PHONE));
0706: else if (telephoneComboBox.getSelectedIndex() == 11)
0707: destModel.addPhone(new PhoneModel(telephoneTextField
0708: .getText(), PhoneModel.TYPE_OTHER_FAX));
0709: else if (telephoneComboBox.getSelectedIndex() == 12)
0710: destModel.addPhone(new PhoneModel(telephoneTextField
0711: .getText(), PhoneModel.TYPE_PAGER));
0712: else if (telephoneComboBox.getSelectedIndex() == 13)
0713: destModel.addPhone(new PhoneModel(telephoneTextField
0714: .getText(), PhoneModel.TYPE_PRIMARY_PHONE));
0715: else if (telephoneComboBox.getSelectedIndex() == 14)
0716: destModel.addPhone(new PhoneModel(telephoneTextField
0717: .getText(), PhoneModel.TYPE_RADIO));
0718: else if (telephoneComboBox.getSelectedIndex() == 15)
0719: destModel.addPhone(new PhoneModel(telephoneTextField
0720: .getText(), PhoneModel.TYPE_TELEX));
0721: else if (telephoneComboBox.getSelectedIndex() == 16)
0722: destModel.addPhone(new PhoneModel(telephoneTextField
0723: .getText(), PhoneModel.TYPE_TTY));
0724:
0725: }
0726:
0727: }
0728:
0729: private void fillIMView(InstantMessagingModel m,
0730: JComboBox imComboBox, JTextField imTextField) {
0731:
0732: if (m.getType() == InstantMessagingModel.TYPE_JABBER)
0733: imComboBox.setSelectedIndex(0);
0734: else if (m.getType() == InstantMessagingModel.TYPE_AIM)
0735: imComboBox.setSelectedIndex(1);
0736: else if (m.getType() == InstantMessagingModel.TYPE_YAHOO)
0737: imComboBox.setSelectedIndex(2);
0738: else if (m.getType() == InstantMessagingModel.TYPE_MSN)
0739: imComboBox.setSelectedIndex(3);
0740: else if (m.getType() == InstantMessagingModel.TYPE_ICQ)
0741: imComboBox.setSelectedIndex(4);
0742:
0743: imTextField.setText(m.getUserId());
0744: }
0745:
0746: private void fillPhoneView(PhoneModel m,
0747: JComboBox telephoneComboBox, JTextField telephoneTextField) {
0748:
0749: if (m.getType() == PhoneModel.TYPE_BUSINESS_PHONE)
0750: telephoneComboBox.setSelectedIndex(0);
0751: else if (m.getType() == PhoneModel.TYPE_ASSISTANT_PHONE)
0752: telephoneComboBox.setSelectedIndex(1);
0753: else if (m.getType() == PhoneModel.TYPE_BUSINESS_FAX)
0754: telephoneComboBox.setSelectedIndex(2);
0755: else if (m.getType() == PhoneModel.TYPE_CALLBACK_PHONE)
0756: telephoneComboBox.setSelectedIndex(3);
0757: else if (m.getType() == PhoneModel.TYPE_CAR_PHONE)
0758: telephoneComboBox.setSelectedIndex(4);
0759: else if (m.getType() == PhoneModel.TYPE_COMPANY_PHONE)
0760: telephoneComboBox.setSelectedIndex(5);
0761: else if (m.getType() == PhoneModel.TYPE_HOME_PHONE)
0762: telephoneComboBox.setSelectedIndex(6);
0763: else if (m.getType() == PhoneModel.TYPE_HOME_FAX)
0764: telephoneComboBox.setSelectedIndex(7);
0765: else if (m.getType() == PhoneModel.TYPE_ISDN)
0766: telephoneComboBox.setSelectedIndex(8);
0767: else if (m.getType() == PhoneModel.TYPE_MOBILE_PHONE)
0768: telephoneComboBox.setSelectedIndex(9);
0769: else if (m.getType() == PhoneModel.TYPE_OTHER_PHONE)
0770: telephoneComboBox.setSelectedIndex(10);
0771: else if (m.getType() == PhoneModel.TYPE_OTHER_FAX)
0772: telephoneComboBox.setSelectedIndex(11);
0773: else if (m.getType() == PhoneModel.TYPE_PAGER)
0774: telephoneComboBox.setSelectedIndex(12);
0775: else if (m.getType() == PhoneModel.TYPE_PRIMARY_PHONE)
0776: telephoneComboBox.setSelectedIndex(13);
0777: else if (m.getType() == PhoneModel.TYPE_RADIO)
0778: telephoneComboBox.setSelectedIndex(14);
0779: else if (m.getType() == PhoneModel.TYPE_TELEX)
0780: telephoneComboBox.setSelectedIndex(15);
0781: else if (m.getType() == PhoneModel.TYPE_TTY)
0782: telephoneComboBox.setSelectedIndex(16);
0783:
0784: telephoneTextField.setText(m.getNumber());
0785: }
0786:
0787: /**
0788: * Fill address model using values from ui-controls.
0789: *
0790: * @param type
0791: * @param destModel
0792: */
0793: private void fillAddressModel(int type, ContactModel destModel) {
0794: AddressModel model = null;
0795: if (type == AddressModel.TYPE_WORK)
0796: model = new AddressModel(workPOBoxTextField.getText(),
0797: workStreetTextField.getText(), workCityTextField
0798: .getText(), workZipPostalCodeTextField
0799: .getText(),
0800: workStateProvinceCountyTextField.getText(),
0801: workCountryTextField.getText(), workAddressTextArea
0802: .getText(), type);
0803: else if (type == AddressModel.TYPE_HOME)
0804: model = new AddressModel(privatePOBoxTextField.getText(),
0805: privateStreetTextField.getText(),
0806: privateCityTextField.getText(),
0807: privateZipPostalCodeTextField.getText(),
0808: privateStateProvinceCountyTextField.getText(),
0809: privateCountryTextField.getText(),
0810: privateAddressTextArea.getText(), type);
0811: else if (type == AddressModel.TYPE_OTHER)
0812: model = new AddressModel(otherPOBoxTextField.getText(),
0813: otherStreetTextField.getText(), otherCityTextField
0814: .getText(), otherZipPostalCodeTextField
0815: .getText(),
0816: otherStateProvinceCountyTextField.getText(),
0817: otherCountryTextField.getText(),
0818: otherAddressTextArea.getText(), type);
0819: destModel.addAddress(model);
0820: }
0821:
0822: /**
0823: * Fill email model using values from ui-controls.
0824: *
0825: * @param destModel
0826: * @param emailComboBox
0827: * @param emailTextField
0828: *
0829: */
0830: private void fillEmailModel(JTextField emailTextField,
0831: JComboBox emailComboBox, ContactModel destModel) {
0832: if (emailTextField.getText() != null) {
0833: if (emailComboBox.getSelectedIndex() == 0)
0834: destModel.addEmail(new EmailModel(emailTextField
0835: .getText(), EmailModel.TYPE_WORK));
0836: if (emailComboBox.getSelectedIndex() == 1)
0837: destModel.addEmail(new EmailModel(emailTextField
0838: .getText(), EmailModel.TYPE_HOME));
0839: if (emailComboBox.getSelectedIndex() == 2)
0840: destModel.addEmail(new EmailModel(emailTextField
0841: .getText(), EmailModel.TYPE_OTHER));
0842: }
0843: }
0844:
0845: /**
0846: * Fill all email ui-controls from model.
0847: *
0848: */
0849: private void fillEmailView(IEmailModel m, JComboBox comboBox,
0850: JTextField textField) {
0851: if (m.getType() == EmailModel.TYPE_WORK)
0852: comboBox.setSelectedIndex(0);
0853: else if (m.getType() == EmailModel.TYPE_HOME)
0854: comboBox.setSelectedIndex(1);
0855: else if (m.getType() == EmailModel.TYPE_OTHER)
0856: comboBox.setSelectedIndex(2);
0857:
0858: textField.setText(m.getAddress());
0859: }
0860:
0861: /**
0862: * Fill all address ui-controls from model.
0863: *
0864: * @param m
0865: * address model
0866: */
0867: private void fillAddressView(AddressModel m) {
0868: if (m.getType() == AddressModel.TYPE_WORK) {
0869: workCityTextField.setText(m.getCity());
0870: workCountryTextField.setText(m.getCountry());
0871: workPOBoxTextField.setText(m.getPoBox());
0872: workStateProvinceCountyTextField.setText(m
0873: .getStateProvinceCounty());
0874: workZipPostalCodeTextField.setText(m.getZipPostalCode());
0875: workAddressTextArea.setText(m.getLabel());
0876: workStreetTextField.setText(m.getStreet());
0877: } else if (m.getType() == AddressModel.TYPE_HOME) {
0878: privateCityTextField.setText(m.getCity());
0879: privateCountryTextField.setText(m.getCountry());
0880: privatePOBoxTextField.setText(m.getPoBox());
0881: privateStateProvinceCountyTextField.setText(m
0882: .getStateProvinceCounty());
0883: privateZipPostalCodeTextField.setText(m.getZipPostalCode());
0884: privateAddressTextArea.setText(m.getLabel());
0885: privateStreetTextField.setText(m.getStreet());
0886: } else if (m.getType() == AddressModel.TYPE_OTHER) {
0887: otherCityTextField.setText(m.getCity());
0888: otherCountryTextField.setText(m.getCountry());
0889: otherPOBoxTextField.setText(m.getPoBox());
0890: otherStateProvinceCountyTextField.setText(m
0891: .getStateProvinceCounty());
0892: otherZipPostalCodeTextField.setText(m.getZipPostalCode());
0893: otherAddressTextArea.setText(m.getLabel());
0894: otherStreetTextField.setText(m.getStreet());
0895: }
0896: }
0897:
0898: public void actionPerformed(ActionEvent event) {
0899: String action = event.getActionCommand();
0900: if (action.equals("OK")) {
0901: result = true;
0902:
0903: updateComponents(false);
0904:
0905: setVisible(false);
0906: } else if (action.equals("CANCEL")) {
0907: result = false;
0908: setVisible(false);
0909: } else if (action.equals("FORMATTED_NAME_DIALOG")) {
0910: fullNameDialog.setVisible(true);
0911:
0912: boolean success = fullNameDialog.getResult();
0913: if (success) {
0914:
0915: String fn = fullNameDialog.getFormattedName();
0916: // fill formatted textfield
0917: formattedNameTextField.setText(fn);
0918:
0919: fillSortStringComboBox();
0920: }
0921: }
0922:
0923: }
0924:
0925: public boolean getResult() {
0926: return result;
0927: }
0928:
0929: private void initComponents() {
0930:
0931: DefaultComponentFactory compFactory = DefaultComponentFactory
0932: .getInstance();
0933:
0934: dialogPane = new JPanel();
0935: contentPane = new JPanel();
0936: tabbedPane2 = new JTabbedPane();
0937: contactPanel = new JPanel();
0938: panel7 = new JPanel();
0939: pictureButton = new JButton();
0940: formattedNameButton = new JButton();
0941: formattedNameButton.setActionCommand("FORMATTED_NAME_DIALOG");
0942: formattedNameButton.addActionListener(this );
0943:
0944: formattedNameTextField = new JTextField();
0945: nicknameLabel = new JLabel();
0946: nicknameTextField = new JTextField();
0947: fileunderLabel = new JLabel();
0948: fileunderComboBox = new JComboBox();
0949: whereLabel = new JLabel("Where:");
0950: whereComboBox = new FolderComboBox(false);
0951: whereLabel.setLabelFor(whereComboBox);
0952: categoriesButton = new JButton();
0953: categoriesButton.setEnabled(false);
0954: categoriesTextField = new JTextField();
0955: categoriesTextField.setEnabled(false);
0956: emailSeparator = compFactory.createSeparator(bundle
0957: .getString("emailSeparator.text"));
0958: String[] emailTypes = new String[] { "Work", "Home", "Other" };
0959: emailComboBox1 = new JComboBox(emailTypes);
0960: emailTextField1 = new JTextField();
0961: emailComboBox2 = new JComboBox(emailTypes);
0962: emailTextField2 = new JTextField();
0963: emailComboBox3 = new JComboBox(emailTypes);
0964: emailTextField3 = new JTextField();
0965: emailComboBox4 = new JComboBox(emailTypes);
0966: emailTextField4 = new JTextField();
0967: preferHtmlCheckBox = new JCheckBox();
0968: preferHtmlCheckBox.setEnabled(false);
0969: telephoneSeparator = compFactory.createSeparator(bundle
0970: .getString("telephoneSeparator.text"));
0971: String[] phoneTypes = new String[] { "Business Phone",
0972: "Assistant Phone", "Business Fax", "Callback Phone",
0973: "Car Phone", "Company Phone", "Home Phone", "Home Fax",
0974: "ISDN", "Mobile Phone", "Other Phone", "Other Fax",
0975: "Pager", "Primary Phone", "Radio", "Telex", "TTY" };
0976: telephoneComboBox1 = new JComboBox(phoneTypes);
0977: telephoneTextField1 = new JTextField();
0978: telephoneComboBox2 = new JComboBox(phoneTypes);
0979: telephoneTextField2 = new JTextField();
0980: telephoneComboBox3 = new JComboBox(phoneTypes);
0981: telephoneTextField3 = new JTextField();
0982: telephoneComboBox4 = new JComboBox(phoneTypes);
0983: telephoneTextField4 = new JTextField();
0984: imSeparator = compFactory.createSeparator(bundle
0985: .getString("imSeparator.text"));
0986: String[] imTypes = new String[] { "Jabber", "AIM", "Yahoo",
0987: "MSN", "ICQ" };
0988: imComboBox1 = new JComboBox(imTypes);
0989: imTextField1 = new JTextField();
0990: imComboBox2 = new JComboBox(imTypes);
0991: imTextField2 = new JTextField();
0992: imComboBox3 = new JComboBox(imTypes);
0993: imTextField3 = new JTextField();
0994: imComboBox4 = new JComboBox(imTypes);
0995: imTextField4 = new JTextField();
0996: personalInfoPanel = new JPanel();
0997: webAddressSeparator = compFactory.createSeparator(bundle
0998: .getString("webAddressSeparator.text"));
0999: homepageLabel = new JLabel();
1000: panel1 = new JPanel();
1001: homepageTextField = new JTextField();
1002: homepageButton = new JButton(ImageLoader
1003: .getSmallIcon(IconKeys.INTERNET));
1004: homepageButton.setMargin(new Insets(0, 0, 0, 0));
1005: homepageButton.addActionListener(new ActionListener() {
1006: public void actionPerformed(ActionEvent e) {
1007: String s = homepageTextField.getText();
1008: try {
1009: URL url = new URL(s);
1010: ColumbaDesktop.getInstance().browse(url);
1011: } catch (MalformedURLException e1) {
1012: e1.printStackTrace();
1013: }
1014: }
1015: });
1016:
1017: weblogLabel = new JLabel();
1018: panel5 = new JPanel();
1019: weblogTextField = new JTextField();
1020: weblogButton = new JButton(ImageLoader
1021: .getSmallIcon(IconKeys.INTERNET));
1022: weblogButton.setMargin(new Insets(0, 0, 0, 0));
1023: weblogButton.addActionListener(new ActionListener() {
1024: public void actionPerformed(ActionEvent e) {
1025: String s = weblogTextField.getText();
1026: try {
1027: URL url = new URL(s);
1028: ColumbaDesktop.getInstance().browse(url);
1029: } catch (MalformedURLException e1) {
1030: e1.printStackTrace();
1031: }
1032: }
1033: });
1034: calendarLabel = new JLabel();
1035: panel6 = new JPanel();
1036: calendarTextField = new JTextField();
1037: calendarButton = new JButton(ImageLoader
1038: .getSmallIcon(IconKeys.INTERNET));
1039: calendarButton.setMargin(new Insets(0, 0, 0, 0));
1040: calendarButton.addActionListener(new ActionListener() {
1041: public void actionPerformed(ActionEvent e) {
1042: String s = calendarTextField.getText();
1043: try {
1044: URL url = new URL(s);
1045: ColumbaDesktop.getInstance().browse(url);
1046: } catch (MalformedURLException e1) {
1047: e1.printStackTrace();
1048: }
1049: }
1050: });
1051: freebusyLabel = new JLabel();
1052: panel8 = new JPanel();
1053: freebusyTextField = new JTextField();
1054: freebusyButton = new JButton(ImageLoader
1055: .getSmallIcon(IconKeys.INTERNET));
1056: freebusyButton.setMargin(new Insets(0, 0, 0, 0));
1057: freebusyButton.addActionListener(new ActionListener() {
1058: public void actionPerformed(ActionEvent e) {
1059: String s = freebusyTextField.getText();
1060: try {
1061: URL url = new URL(s);
1062: ColumbaDesktop.getInstance().browse(url);
1063: } catch (MalformedURLException e1) {
1064: e1.printStackTrace();
1065: }
1066: }
1067: });
1068: jobSeparator = compFactory.createSeparator(bundle
1069: .getString("jobSeparator.text"));
1070: professionLabel = new JLabel();
1071: professionTextField = new JTextField();
1072: titleLabel = new JLabel();
1073: titleTextField = new JTextField();
1074: companyLabel = new JLabel();
1075: companyTextField = new JTextField();
1076: departmentLabel = new JLabel();
1077: departmentTextField = new JTextField();
1078: managerLabel = new JLabel();
1079: managerTextField = new JTextField();
1080: officeLabel = new JLabel();
1081: officeTextField = new JTextField();
1082: miscellaneousSeparator = compFactory.createSeparator(bundle
1083: .getString("miscellaneousSeparator.text"));
1084: birthdayLabel = new JLabel();
1085: birthdayComboBox = new JComboBox();
1086: notesLabel = new JLabel();
1087: scrollPane3 = new JScrollPane();
1088: notesTextArea = new JTextArea();
1089: mailingAddressPanel = new JPanel();
1090: privateSeparator = compFactory.createSeparator(bundle
1091: .getString("privateSeparator.text"));
1092: privateAddressLabel = new JLabel();
1093: scrollPane1 = new JScrollPane();
1094: privateAddressTextArea = new JTextArea();
1095: privateCityLabel = new JLabel();
1096: privateCityTextField = new JTextField();
1097: privateZipPostalCodeLabel = new JLabel();
1098: privateZipPostalCodeTextField = new JTextField();
1099: label1 = new JLabel();
1100: privateStreetTextField = new JTextField();
1101: privateStateProvinceCountyLabel = new JLabel();
1102: privateStateProvinceCountyTextField = new JTextField();
1103: privatePOBoxLabel = new JLabel();
1104: privatePOBoxTextField = new JTextField();
1105: privateCountryLabel = new JLabel();
1106: privateCountryTextField = new JTextField();
1107: workSeparator = compFactory.createSeparator(bundle
1108: .getString("workSeparator.text"));
1109: workAddressLabel = new JLabel();
1110: scrollPane2 = new JScrollPane();
1111: workAddressTextArea = new JTextArea();
1112: workCityLabel = new JLabel();
1113: workCityTextField = new JTextField();
1114: workZipPostalCodeLabel = new JLabel();
1115: workZipPostalCodeTextField = new JTextField();
1116: label2 = new JLabel();
1117: workStreetTextField = new JTextField();
1118: workStateProvinceCountyLabel = new JLabel();
1119: workStateProvinceCountyTextField = new JTextField();
1120: workPOBoxLabel = new JLabel();
1121: workPOBoxTextField = new JTextField();
1122: workCountryLabel = new JLabel();
1123: workCountryTextField = new JTextField();
1124: otherSeparator = compFactory.createSeparator(bundle
1125: .getString("otherSeparator.text"));
1126: otherAddressLabel = compFactory.createLabel(bundle
1127: .getString("otherAddressLabel.textWithMnemonic"));
1128: scrollPane4 = new JScrollPane();
1129: otherAddressTextArea = new JTextArea();
1130: otherCityLabel = new JLabel();
1131: otherCityTextField = new JTextField();
1132: otherZipPostalCodeLabel = new JLabel();
1133: otherZipPostalCodeTextField = new JTextField();
1134: label3 = new JLabel();
1135: otherStreetTextField = new JTextField();
1136: otherStateProvinceCountyLabel = new JLabel();
1137: otherStateProvinceCountyTextField = new JTextField();
1138: otherPOBoxLabel = new JLabel();
1139: otherPOBoxTextField = new JTextField();
1140: otherCountryLabel = new JLabel();
1141: otherCountryTextField = new JTextField();
1142:
1143: buttonBar = new JPanel();
1144: okButton = new JButton();
1145: okButton.setActionCommand("OK");
1146: okButton.addActionListener(this );
1147: cancelButton = new JButton();
1148: cancelButton.setActionCommand("CANCEL");
1149: cancelButton.addActionListener(this );
1150:
1151: }
1152:
1153: private void layoutComponents() {
1154: CellConstraints cc = new CellConstraints();
1155:
1156: // ======== this ========
1157: Container contentPane2 = getContentPane();
1158: contentPane2.setLayout(new BorderLayout());
1159:
1160: // ======== dialogPane ========
1161: {
1162: dialogPane.setBorder(Borders.DIALOG_BORDER);
1163: dialogPane.setLayout(new BorderLayout());
1164:
1165: // ======== contentPane ========
1166: {
1167: contentPane.setLayout(new BorderLayout());
1168:
1169: // ======== tabbedPane2 ========
1170: {
1171: tabbedPane2
1172: .setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
1173:
1174: // ======== contactPanel ========
1175: {
1176: contactPanel.setBorder(Borders.DIALOG_BORDER);
1177: contactPanel
1178: .setLayout(new FormLayout(
1179: new ColumnSpec[] {
1180: FormFactory.DEFAULT_COLSPEC,
1181: FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
1182: new ColumnSpec(
1183: ColumnSpec.FILL,
1184: Sizes.DEFAULT,
1185: FormSpec.DEFAULT_GROW),
1186: FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
1187: FormFactory.DEFAULT_COLSPEC,
1188: FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
1189: new ColumnSpec(
1190: ColumnSpec.FILL,
1191: Sizes.DEFAULT,
1192: FormSpec.DEFAULT_GROW) },
1193: new RowSpec[] {
1194: FormFactory.DEFAULT_ROWSPEC,
1195: FormFactory.LINE_GAP_ROWSPEC,
1196: FormFactory.DEFAULT_ROWSPEC,
1197: FormFactory.LINE_GAP_ROWSPEC,
1198: FormFactory.DEFAULT_ROWSPEC,
1199: FormFactory.LINE_GAP_ROWSPEC,
1200: new RowSpec(
1201: RowSpec.FILL,
1202: Sizes.DEFAULT,
1203: FormSpec.NO_GROW),
1204: FormFactory.LINE_GAP_ROWSPEC,
1205: new RowSpec(
1206: RowSpec.FILL,
1207: Sizes.DEFAULT,
1208: FormSpec.NO_GROW),
1209: FormFactory.LINE_GAP_ROWSPEC,
1210: new RowSpec(
1211: RowSpec.FILL,
1212: Sizes.DEFAULT,
1213: FormSpec.NO_GROW),
1214: FormFactory.LINE_GAP_ROWSPEC,
1215: FormFactory.DEFAULT_ROWSPEC,
1216: FormFactory.LINE_GAP_ROWSPEC,
1217: FormFactory.DEFAULT_ROWSPEC,
1218: FormFactory.LINE_GAP_ROWSPEC,
1219: new RowSpec(
1220: RowSpec.FILL,
1221: Sizes.DEFAULT,
1222: FormSpec.NO_GROW),
1223: FormFactory.LINE_GAP_ROWSPEC,
1224: new RowSpec(
1225: RowSpec.FILL,
1226: Sizes.DEFAULT,
1227: FormSpec.NO_GROW),
1228: FormFactory.LINE_GAP_ROWSPEC,
1229: FormFactory.DEFAULT_ROWSPEC,
1230: FormFactory.LINE_GAP_ROWSPEC,
1231: FormFactory.DEFAULT_ROWSPEC,
1232: FormFactory.LINE_GAP_ROWSPEC,
1233: new RowSpec(
1234: RowSpec.FILL,
1235: Sizes.DEFAULT,
1236: FormSpec.NO_GROW),
1237: FormFactory.LINE_GAP_ROWSPEC,
1238: new RowSpec(
1239: RowSpec.FILL,
1240: Sizes.DEFAULT,
1241: FormSpec.NO_GROW) }));
1242: ((FormLayout) contactPanel.getLayout())
1243: .setRowGroups(new int[][] { { 7, 9, 11,
1244: 17, 19, 25, 27 } });
1245:
1246: // ======== panel7 ========
1247: {
1248: panel7
1249: .setLayout(new FormLayout(
1250: new ColumnSpec[] {
1251: FormFactory.DEFAULT_COLSPEC,
1252: FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
1253: FormFactory.DEFAULT_COLSPEC,
1254: FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
1255:
1256: FormFactory.DEFAULT_COLSPEC,
1257: FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
1258:
1259: FormFactory.DEFAULT_COLSPEC,
1260: FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
1261: new ColumnSpec(
1262: ColumnSpec.FILL,
1263: Sizes.DEFAULT,
1264: FormSpec.DEFAULT_GROW), },
1265: new RowSpec[] {
1266: new RowSpec(
1267: RowSpec.FILL,
1268: Sizes.DEFAULT,
1269: FormSpec.NO_GROW),
1270: FormFactory.LINE_GAP_ROWSPEC,
1271: new RowSpec(
1272: RowSpec.FILL,
1273: Sizes.DEFAULT,
1274: FormSpec.NO_GROW),
1275: FormFactory.LINE_GAP_ROWSPEC,
1276: new RowSpec(
1277: RowSpec.FILL,
1278: Sizes.DEFAULT,
1279: FormSpec.NO_GROW) }));
1280: ((FormLayout) panel7.getLayout())
1281: .setRowGroups(new int[][] { { 1, 3,
1282: 5 } });
1283:
1284: // ---- pictureButton ----
1285:
1286: panel7.add(pictureButton, cc.xywh(1, 1, 1,
1287: 5));
1288:
1289: // ---- fullnameButton ----
1290: formattedNameButton
1291: .setText(bundle
1292: .getString("formattedNameButton.text"));
1293: panel7
1294: .add(formattedNameButton, cc.xy(3,
1295: 1));
1296: panel7.add(formattedNameTextField, cc.xy(5,
1297: 1));
1298:
1299: // ---- nicknameLabel ----
1300: nicknameLabel.setText(bundle
1301: .getString("nicknameLabel.text"));
1302: nicknameLabel
1303: .setLabelFor(nicknameTextField);
1304: panel7.add(nicknameLabel, cc.xywh(7, 1, 1,
1305: 1, CellConstraints.RIGHT,
1306: CellConstraints.DEFAULT));
1307: panel7.add(nicknameTextField, cc.xy(9, 1));
1308:
1309: // ---- fileunderLabel ----
1310: fileunderLabel.setText(bundle
1311: .getString("fileunderLabel.text"));
1312: fileunderLabel
1313: .setLabelFor(fileunderComboBox);
1314: panel7.add(fileunderLabel, cc.xywh(3, 3, 1,
1315: 1, CellConstraints.RIGHT,
1316: CellConstraints.DEFAULT));
1317: panel7.add(fileunderComboBox, cc.xy(5, 3));
1318:
1319: panel7.add(whereLabel, cc.xywh(7, 3, 1, 1,
1320: CellConstraints.RIGHT,
1321: CellConstraints.DEFAULT));
1322: panel7.add(whereComboBox, cc.xy(9, 3));
1323: // ---- categoriesButton ----
1324: categoriesButton
1325: .setText(bundle
1326: .getString("categoriesButton.text"));
1327: panel7.add(categoriesButton, cc.xy(3, 5));
1328: panel7.add(categoriesTextField, cc.xywh(5,
1329: 5, 5, 1));
1330: }
1331: contactPanel.add(panel7, cc.xywh(1, 1, 7, 1));
1332: contactPanel.add(emailSeparator, cc.xywh(1, 5,
1333: 7, 1));
1334: contactPanel.add(emailComboBox1, cc.xy(1, 7));
1335:
1336: // ---- emailTextField1 ----
1337: emailTextField1.setColumns(20);
1338: contactPanel.add(emailTextField1, cc.xy(3, 7));
1339: contactPanel.add(emailComboBox2, cc.xy(5, 7));
1340:
1341: // ---- emailTextField2 ----
1342: emailTextField2.setColumns(20);
1343: contactPanel.add(emailTextField2, cc.xy(7, 7));
1344: contactPanel.add(emailComboBox3, cc.xy(1, 9));
1345:
1346: // ---- emailTextField3 ----
1347: emailTextField3.setColumns(20);
1348: contactPanel.add(emailTextField3, cc.xy(3, 9));
1349: contactPanel.add(emailComboBox4, cc.xy(5, 9));
1350:
1351: // ---- emailTextField4 ----
1352: emailTextField4.setColumns(20);
1353: contactPanel.add(emailTextField4, cc.xy(7, 9));
1354:
1355: // ---- preferHtmlCheckBox ----
1356: preferHtmlCheckBox.setText(bundle
1357: .getString("preferHtmlCheckBox.text"));
1358: contactPanel.add(preferHtmlCheckBox, cc.xy(3,
1359: 11));
1360: contactPanel.add(telephoneSeparator, cc.xywh(1,
1361: 15, 7, 1));
1362: contactPanel.add(telephoneComboBox1, cc.xy(1,
1363: 17));
1364:
1365: // ---- telephoneTextField1 ----
1366: telephoneTextField1.setColumns(20);
1367: contactPanel.add(telephoneTextField1, cc.xy(3,
1368: 17));
1369: contactPanel.add(telephoneComboBox2, cc.xy(5,
1370: 17));
1371:
1372: // ---- telephoneTextField2 ----
1373: telephoneTextField2.setColumns(20);
1374: contactPanel.add(telephoneTextField2, cc.xy(7,
1375: 17));
1376: contactPanel.add(telephoneComboBox3, cc.xy(1,
1377: 19));
1378:
1379: // ---- telephoneTextField3 ----
1380: telephoneTextField3.setColumns(20);
1381: contactPanel.add(telephoneTextField3, cc.xy(3,
1382: 19));
1383: contactPanel.add(telephoneComboBox4, cc.xy(5,
1384: 19));
1385:
1386: // ---- telephoneTextField4 ----
1387: telephoneTextField4.setColumns(20);
1388: contactPanel.add(telephoneTextField4, cc.xy(7,
1389: 19));
1390: contactPanel.add(imSeparator, cc.xywh(1, 23, 7,
1391: 1));
1392: contactPanel.add(imComboBox1, cc.xy(1, 25));
1393:
1394: // ---- imTextField1 ----
1395: imTextField1.setColumns(20);
1396: contactPanel.add(imTextField1, cc.xy(3, 25));
1397: contactPanel.add(imComboBox2, cc.xy(5, 25));
1398:
1399: // ---- imTextField2 ----
1400: imTextField2.setColumns(20);
1401: contactPanel.add(imTextField2, cc.xy(7, 25));
1402: contactPanel.add(imComboBox3, cc.xy(1, 27));
1403:
1404: // ---- imTextField3 ----
1405: imTextField3.setColumns(20);
1406: contactPanel.add(imTextField3, cc.xy(3, 27));
1407: contactPanel.add(imComboBox4, cc.xy(5, 27));
1408:
1409: // ---- imTextField4 ----
1410: imTextField4.setColumns(20);
1411: contactPanel.add(imTextField4, cc.xy(7, 27));
1412: }
1413: tabbedPane2.addTab(bundle
1414: .getString("contactPanel.tab.title"),
1415: contactPanel);
1416:
1417: // ======== personalInfoPanel ========
1418: {
1419: personalInfoPanel
1420: .setBorder(Borders.DIALOG_BORDER);
1421: personalInfoPanel
1422: .setLayout(new FormLayout(
1423: new ColumnSpec[] {
1424: FormFactory.DEFAULT_COLSPEC,
1425: FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
1426: new ColumnSpec(
1427: ColumnSpec.FILL,
1428: Sizes.DEFAULT,
1429: FormSpec.DEFAULT_GROW),
1430: FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
1431: FormFactory.DEFAULT_COLSPEC,
1432: FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
1433: new ColumnSpec(
1434: ColumnSpec.FILL,
1435: Sizes.DEFAULT,
1436: FormSpec.DEFAULT_GROW) },
1437: new RowSpec[] {
1438: FormFactory.DEFAULT_ROWSPEC,
1439: FormFactory.LINE_GAP_ROWSPEC,
1440: new RowSpec(
1441: RowSpec.FILL,
1442: Sizes.DEFAULT,
1443: FormSpec.NO_GROW),
1444: FormFactory.LINE_GAP_ROWSPEC,
1445: new RowSpec(
1446: RowSpec.FILL,
1447: Sizes.DEFAULT,
1448: FormSpec.NO_GROW),
1449: FormFactory.LINE_GAP_ROWSPEC,
1450: new RowSpec(
1451: RowSpec.FILL,
1452: Sizes.DEFAULT,
1453: FormSpec.NO_GROW),
1454: FormFactory.LINE_GAP_ROWSPEC,
1455: new RowSpec(
1456: RowSpec.FILL,
1457: Sizes.DEFAULT,
1458: FormSpec.NO_GROW),
1459: FormFactory.LINE_GAP_ROWSPEC,
1460: FormFactory.DEFAULT_ROWSPEC,
1461: FormFactory.LINE_GAP_ROWSPEC,
1462: FormFactory.DEFAULT_ROWSPEC,
1463: FormFactory.LINE_GAP_ROWSPEC,
1464: new RowSpec(
1465: RowSpec.FILL,
1466: Sizes.DEFAULT,
1467: FormSpec.NO_GROW),
1468: FormFactory.LINE_GAP_ROWSPEC,
1469: new RowSpec(
1470: RowSpec.FILL,
1471: Sizes.DEFAULT,
1472: FormSpec.NO_GROW),
1473: FormFactory.LINE_GAP_ROWSPEC,
1474: new RowSpec(
1475: RowSpec.FILL,
1476: Sizes.DEFAULT,
1477: FormSpec.NO_GROW),
1478: FormFactory.LINE_GAP_ROWSPEC,
1479: FormFactory.DEFAULT_ROWSPEC,
1480: FormFactory.LINE_GAP_ROWSPEC,
1481: FormFactory.DEFAULT_ROWSPEC,
1482: FormFactory.LINE_GAP_ROWSPEC,
1483: new RowSpec(
1484: RowSpec.FILL,
1485: Sizes.DEFAULT,
1486: FormSpec.NO_GROW),
1487: FormFactory.LINE_GAP_ROWSPEC,
1488: FormFactory.DEFAULT_ROWSPEC }));
1489: ((FormLayout) personalInfoPanel.getLayout())
1490: .setRowGroups(new int[][] { { 3, 5, 7,
1491: 9, 15, 17, 19, 25 } });
1492: personalInfoPanel.add(webAddressSeparator, cc
1493: .xywh(1, 1, 7, 1));
1494:
1495: // ---- homepageLabel ----
1496: homepageLabel.setText(bundle
1497: .getString("homepageLabel.text"));
1498: homepageLabel.setLabelFor(homepageTextField);
1499: personalInfoPanel.add(homepageLabel, cc.xywh(1,
1500: 3, 1, 1, CellConstraints.RIGHT,
1501: CellConstraints.DEFAULT));
1502:
1503: // ======== panel1 ========
1504: {
1505: panel1
1506: .setLayout(new FormLayout(
1507: new ColumnSpec[] {
1508: new ColumnSpec(
1509: ColumnSpec.FILL,
1510: Sizes.DEFAULT,
1511: FormSpec.DEFAULT_GROW),
1512: FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
1513: new ColumnSpec(
1514: ColumnSpec.CENTER,
1515: Sizes.DEFAULT,
1516: FormSpec.NO_GROW) },
1517: RowSpec
1518: .decodeSpecs("fill:default")));
1519:
1520: // ---- homepageTextField ----
1521: homepageTextField.setColumns(20);
1522: panel1.add(homepageTextField, cc.xy(1, 1));
1523:
1524: // ---- homepageButton ----
1525:
1526: panel1.add(homepageButton, cc.xy(3, 1));
1527: }
1528: personalInfoPanel.add(panel1, cc.xywh(3, 3, 5,
1529: 1));
1530:
1531: // ---- weblogLabel ----
1532: weblogLabel.setText(bundle
1533: .getString("weblogLabel.text"));
1534: weblogLabel.setLabelFor(weblogTextField);
1535: personalInfoPanel.add(weblogLabel, cc.xywh(1,
1536: 5, 1, 1, CellConstraints.RIGHT,
1537: CellConstraints.DEFAULT));
1538:
1539: // ======== panel5 ========
1540: {
1541: panel5
1542: .setLayout(new FormLayout(
1543: new ColumnSpec[] {
1544: new ColumnSpec(
1545: ColumnSpec.FILL,
1546: Sizes.DEFAULT,
1547: FormSpec.DEFAULT_GROW),
1548: FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
1549: FormFactory.DEFAULT_COLSPEC },
1550: RowSpec
1551: .decodeSpecs("fill:default")));
1552:
1553: // ---- weblogTextField ----
1554: weblogTextField.setColumns(20);
1555: panel5.add(weblogTextField, cc.xy(1, 1));
1556:
1557: // ---- weblogButton ----
1558:
1559: panel5.add(weblogButton, cc.xy(3, 1));
1560: }
1561: personalInfoPanel.add(panel5, cc.xywh(3, 5, 5,
1562: 1));
1563:
1564: // ---- calendarLabel ----
1565: calendarLabel.setText(bundle
1566: .getString("calendarLabel.text"));
1567: calendarLabel.setLabelFor(calendarTextField);
1568: personalInfoPanel.add(calendarLabel, cc.xywh(1,
1569: 7, 1, 1, CellConstraints.RIGHT,
1570: CellConstraints.DEFAULT));
1571:
1572: // ======== panel6 ========
1573: {
1574: panel6
1575: .setLayout(new FormLayout(
1576: new ColumnSpec[] {
1577: new ColumnSpec(
1578: ColumnSpec.FILL,
1579: Sizes.DEFAULT,
1580: FormSpec.DEFAULT_GROW),
1581: FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
1582: FormFactory.DEFAULT_COLSPEC },
1583: RowSpec
1584: .decodeSpecs("fill:default")));
1585:
1586: // ---- calendarTextField ----
1587: calendarTextField.setColumns(20);
1588: panel6.add(calendarTextField, cc.xy(1, 1));
1589:
1590: // ---- calendarButton ----
1591: panel6.add(calendarButton, cc.xy(3, 1));
1592: }
1593: personalInfoPanel.add(panel6, cc.xywh(3, 7, 5,
1594: 1));
1595:
1596: // ---- freebusyLabel ----
1597: freebusyLabel.setText(bundle
1598: .getString("freebusyLabel.text"));
1599: freebusyLabel.setLabelFor(freebusyTextField);
1600: personalInfoPanel.add(freebusyLabel, cc.xywh(1,
1601: 9, 1, 1, CellConstraints.RIGHT,
1602: CellConstraints.DEFAULT));
1603:
1604: // ======== panel8 ========
1605: {
1606: panel8
1607: .setLayout(new FormLayout(
1608: new ColumnSpec[] {
1609: new ColumnSpec(
1610: ColumnSpec.FILL,
1611: Sizes.DEFAULT,
1612: FormSpec.DEFAULT_GROW),
1613: FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
1614: FormFactory.DEFAULT_COLSPEC },
1615: RowSpec
1616: .decodeSpecs("fill:default")));
1617:
1618: // ---- freebusyTextField ----
1619: freebusyTextField.setColumns(20);
1620: panel8.add(freebusyTextField, cc.xy(1, 1));
1621:
1622: // ---- freebusyButton ----
1623:
1624: panel8.add(freebusyButton, cc.xy(3, 1));
1625: }
1626: personalInfoPanel.add(panel8, cc.xywh(3, 9, 5,
1627: 1));
1628: personalInfoPanel.add(jobSeparator, cc.xywh(1,
1629: 13, 7, 1));
1630:
1631: // ---- professionLabel ----
1632: professionLabel.setText(bundle
1633: .getString("professionLabel.text"));
1634: professionLabel
1635: .setLabelFor(professionTextField);
1636: personalInfoPanel.add(professionLabel, cc.xywh(
1637: 1, 15, 1, 1, CellConstraints.RIGHT,
1638: CellConstraints.DEFAULT));
1639:
1640: // ---- professionTextField ----
1641: professionTextField.setColumns(20);
1642: personalInfoPanel.add(professionTextField, cc
1643: .xy(3, 15));
1644:
1645: // ---- titleLabel ----
1646: titleLabel.setText(bundle
1647: .getString("titleLabel.text"));
1648: titleLabel.setLabelFor(titleTextField);
1649: personalInfoPanel.add(titleLabel, cc.xywh(5,
1650: 15, 1, 1, CellConstraints.RIGHT,
1651: CellConstraints.DEFAULT));
1652:
1653: // ---- titleTextField ----
1654: titleTextField.setColumns(20);
1655: personalInfoPanel.add(titleTextField, cc.xy(7,
1656: 15));
1657:
1658: // ---- companyLabel ----
1659: companyLabel.setText(bundle
1660: .getString("companyLabel.text"));
1661: companyLabel.setLabelFor(companyTextField);
1662: personalInfoPanel.add(companyLabel, cc.xywh(1,
1663: 17, 1, 1, CellConstraints.RIGHT,
1664: CellConstraints.DEFAULT));
1665:
1666: // ---- companyTextField ----
1667: companyTextField.setColumns(20);
1668: personalInfoPanel.add(companyTextField, cc.xy(
1669: 3, 17));
1670:
1671: // ---- departmentLabel ----
1672: departmentLabel.setText(bundle
1673: .getString("departmentLabel.text"));
1674: departmentLabel
1675: .setLabelFor(departmentTextField);
1676: personalInfoPanel.add(departmentLabel, cc.xywh(
1677: 5, 17, 1, 1, CellConstraints.RIGHT,
1678: CellConstraints.DEFAULT));
1679:
1680: // ---- departmentTextField ----
1681: departmentTextField.setColumns(20);
1682: personalInfoPanel.add(departmentTextField, cc
1683: .xy(7, 17));
1684:
1685: // ---- managerLabel ----
1686: managerLabel.setText(bundle
1687: .getString("managerLabel.text"));
1688: managerLabel.setLabelFor(managerTextField);
1689: personalInfoPanel.add(managerLabel, cc.xywh(1,
1690: 19, 1, 1, CellConstraints.RIGHT,
1691: CellConstraints.DEFAULT));
1692:
1693: // ---- managerTextField ----
1694: managerTextField.setColumns(20);
1695: personalInfoPanel.add(managerTextField, cc.xy(
1696: 3, 19));
1697:
1698: // ---- officeLabel ----
1699: officeLabel.setText(bundle
1700: .getString("officeLabel.text"));
1701: officeLabel.setLabelFor(officeTextField);
1702: personalInfoPanel.add(officeLabel, cc.xywh(5,
1703: 19, 1, 1, CellConstraints.RIGHT,
1704: CellConstraints.DEFAULT));
1705:
1706: // ---- officeTextField ----
1707: officeTextField.setColumns(10);
1708: personalInfoPanel.add(officeTextField, cc.xy(7,
1709: 19));
1710: personalInfoPanel.add(miscellaneousSeparator,
1711: cc.xywh(1, 23, 7, 1));
1712:
1713: // ---- birthdayLabel ----
1714: birthdayLabel.setText(bundle
1715: .getString("birthdayLabel.text"));
1716: birthdayLabel.setLabelFor(birthdayComboBox);
1717: personalInfoPanel.add(birthdayLabel, cc.xywh(1,
1718: 25, 1, 1, CellConstraints.RIGHT,
1719: CellConstraints.DEFAULT));
1720: personalInfoPanel.add(birthdayComboBox, cc.xy(
1721: 3, 25));
1722:
1723: // ---- notesLabel ----
1724: notesLabel.setText(bundle
1725: .getString("notesLabel.text"));
1726: notesLabel.setLabelFor(notesTextArea);
1727: personalInfoPanel.add(notesLabel, cc.xywh(1,
1728: 27, 1, 1, CellConstraints.RIGHT,
1729: CellConstraints.TOP));
1730:
1731: // ======== scrollPane3 ========
1732: {
1733: scrollPane3
1734: .setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
1735:
1736: // ---- notesTextArea ----
1737: notesTextArea.setRows(5);
1738: notesTextArea.setColumns(20);
1739: notesTextArea.setTabSize(4);
1740: scrollPane3.setViewportView(notesTextArea);
1741: }
1742: personalInfoPanel.add(scrollPane3, cc.xywh(3,
1743: 27, 5, 1));
1744: }
1745: tabbedPane2.addTab(bundle
1746: .getString("personalInfoPanel.tab.title"),
1747: personalInfoPanel);
1748:
1749: // ======== mailingAddressPanel ========
1750: {
1751: mailingAddressPanel
1752: .setBorder(Borders.DIALOG_BORDER);
1753: mailingAddressPanel
1754: .setLayout(new FormLayout(
1755: new ColumnSpec[] {
1756: FormFactory.DEFAULT_COLSPEC,
1757: FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
1758: new ColumnSpec(
1759: ColumnSpec.FILL,
1760: Sizes.DEFAULT,
1761: FormSpec.DEFAULT_GROW),
1762: FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
1763: FormFactory.DEFAULT_COLSPEC,
1764: FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
1765: new ColumnSpec(
1766: ColumnSpec.FILL,
1767: Sizes.DEFAULT,
1768: FormSpec.DEFAULT_GROW) },
1769: new RowSpec[] {
1770: FormFactory.DEFAULT_ROWSPEC,
1771: FormFactory.LINE_GAP_ROWSPEC,
1772: new RowSpec(
1773: RowSpec.FILL,
1774: Sizes.DEFAULT,
1775: FormSpec.NO_GROW),
1776: FormFactory.LINE_GAP_ROWSPEC,
1777: new RowSpec(
1778: RowSpec.FILL,
1779: Sizes.DEFAULT,
1780: FormSpec.NO_GROW),
1781: FormFactory.LINE_GAP_ROWSPEC,
1782: new RowSpec(
1783: RowSpec.FILL,
1784: Sizes.DEFAULT,
1785: FormSpec.NO_GROW),
1786: FormFactory.LINE_GAP_ROWSPEC,
1787: new RowSpec(
1788: RowSpec.FILL,
1789: Sizes.DEFAULT,
1790: FormSpec.NO_GROW),
1791: FormFactory.LINE_GAP_ROWSPEC,
1792: FormFactory.DEFAULT_ROWSPEC,
1793: FormFactory.LINE_GAP_ROWSPEC,
1794: FormFactory.DEFAULT_ROWSPEC,
1795: FormFactory.LINE_GAP_ROWSPEC,
1796: new RowSpec(
1797: RowSpec.FILL,
1798: Sizes.DEFAULT,
1799: FormSpec.NO_GROW),
1800: FormFactory.LINE_GAP_ROWSPEC,
1801: new RowSpec(
1802: RowSpec.FILL,
1803: Sizes.DEFAULT,
1804: FormSpec.NO_GROW),
1805: FormFactory.LINE_GAP_ROWSPEC,
1806: new RowSpec(
1807: RowSpec.FILL,
1808: Sizes.DEFAULT,
1809: FormSpec.NO_GROW),
1810: FormFactory.LINE_GAP_ROWSPEC,
1811: new RowSpec(
1812: RowSpec.FILL,
1813: Sizes.DEFAULT,
1814: FormSpec.NO_GROW),
1815: FormFactory.LINE_GAP_ROWSPEC,
1816: FormFactory.DEFAULT_ROWSPEC,
1817: FormFactory.LINE_GAP_ROWSPEC,
1818: FormFactory.DEFAULT_ROWSPEC,
1819: FormFactory.LINE_GAP_ROWSPEC,
1820: new RowSpec(
1821: RowSpec.FILL,
1822: Sizes.DEFAULT,
1823: FormSpec.NO_GROW),
1824: FormFactory.LINE_GAP_ROWSPEC,
1825: new RowSpec(
1826: RowSpec.FILL,
1827: Sizes.DEFAULT,
1828: FormSpec.NO_GROW),
1829: FormFactory.LINE_GAP_ROWSPEC,
1830: new RowSpec(
1831: RowSpec.FILL,
1832: Sizes.DEFAULT,
1833: FormSpec.NO_GROW),
1834: FormFactory.LINE_GAP_ROWSPEC,
1835: new RowSpec(
1836: RowSpec.FILL,
1837: Sizes.DEFAULT,
1838: FormSpec.NO_GROW),
1839: FormFactory.LINE_GAP_ROWSPEC,
1840: FormFactory.DEFAULT_ROWSPEC }));
1841: mailingAddressPanel.add(privateSeparator, cc
1842: .xywh(1, 1, 7, 1));
1843:
1844: // ---- privateAddressLabel ----
1845: privateAddressLabel.setText(bundle
1846: .getString("privateAddressLabel.text"));
1847: privateAddressLabel
1848: .setLabelFor(privateAddressTextArea);
1849: mailingAddressPanel.add(privateAddressLabel, cc
1850: .xywh(1, 3, 1, 1,
1851: CellConstraints.RIGHT,
1852: CellConstraints.DEFAULT));
1853:
1854: // ======== scrollPane1 ========
1855: {
1856: scrollPane1
1857: .setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
1858: scrollPane1
1859: .setViewportView(privateAddressTextArea);
1860: }
1861: mailingAddressPanel.add(scrollPane1, cc.xywh(3,
1862: 3, 1, 3));
1863:
1864: // ---- privateCityLabel ----
1865: privateCityLabel.setText(bundle
1866: .getString("privateCityLabel.text"));
1867: privateCityLabel
1868: .setLabelFor(privateCityTextField);
1869: mailingAddressPanel.add(privateCityLabel, cc
1870: .xywh(5, 3, 1, 1,
1871: CellConstraints.RIGHT,
1872: CellConstraints.DEFAULT));
1873:
1874: // ---- privateCityTextField ----
1875: privateCityTextField.setColumns(5);
1876: mailingAddressPanel.add(privateCityTextField,
1877: cc.xy(7, 3));
1878:
1879: // ---- privateZipPostalCodeLabel ----
1880: privateZipPostalCodeLabel
1881: .setText(bundle
1882: .getString("privateZipPostalCodeLabel.text"));
1883: privateZipPostalCodeLabel
1884: .setLabelFor(privateZipPostalCodeTextField);
1885: mailingAddressPanel.add(
1886: privateZipPostalCodeLabel, cc.xywh(5,
1887: 5, 1, 1, CellConstraints.RIGHT,
1888: CellConstraints.DEFAULT));
1889: mailingAddressPanel.add(
1890: privateZipPostalCodeTextField, cc.xy(7,
1891: 5));
1892:
1893: // ---- label1 ----
1894: label1.setText(bundle
1895: .getString("streetLabel.text"));
1896: label1.setLabelFor(privateStreetTextField);
1897: mailingAddressPanel.add(label1, cc.xywh(1, 7,
1898: 1, 1, CellConstraints.RIGHT,
1899: CellConstraints.DEFAULT));
1900: mailingAddressPanel.add(privateStreetTextField,
1901: cc.xy(3, 7));
1902:
1903: // ---- privateStateProvinceCountyLabel ----
1904: privateStateProvinceCountyLabel
1905: .setText(bundle
1906: .getString("privateStateProvinceCountyLabel.text"));
1907: privateStateProvinceCountyLabel
1908: .setLabelFor(privateStateProvinceCountyTextField);
1909: mailingAddressPanel.add(
1910: privateStateProvinceCountyLabel,
1911: cc.xywh(5, 7, 1, 1,
1912: CellConstraints.RIGHT,
1913: CellConstraints.DEFAULT));
1914: mailingAddressPanel.add(
1915: privateStateProvinceCountyTextField, cc
1916: .xy(7, 7));
1917:
1918: // ---- privatePOBoxLabel ----
1919: privatePOBoxLabel.setText(bundle
1920: .getString("privatePOBoxLabel.text"));
1921: privatePOBoxLabel
1922: .setLabelFor(privatePOBoxTextField);
1923: mailingAddressPanel.add(privatePOBoxLabel, cc
1924: .xywh(1, 9, 1, 1,
1925: CellConstraints.RIGHT,
1926: CellConstraints.DEFAULT));
1927: mailingAddressPanel.add(privatePOBoxTextField,
1928: cc.xy(3, 9));
1929:
1930: // ---- privateCountryLabel ----
1931: privateCountryLabel.setText(bundle
1932: .getString("privateCountryLabel.text"));
1933: privateCountryLabel
1934: .setLabelFor(privateCountryTextField);
1935: mailingAddressPanel.add(privateCountryLabel, cc
1936: .xywh(5, 9, 1, 1,
1937: CellConstraints.RIGHT,
1938: CellConstraints.DEFAULT));
1939: mailingAddressPanel.add(
1940: privateCountryTextField, cc.xy(7, 9));
1941: mailingAddressPanel.add(workSeparator, cc.xywh(
1942: 1, 13, 7, 1));
1943:
1944: // ---- workAddressLabel ----
1945: workAddressLabel.setText(bundle
1946: .getString("workAddressLabel.text"));
1947: workAddressLabel
1948: .setLabelFor(workAddressTextArea);
1949: mailingAddressPanel.add(workAddressLabel, cc
1950: .xywh(1, 15, 1, 1,
1951: CellConstraints.RIGHT,
1952: CellConstraints.DEFAULT));
1953:
1954: // ======== scrollPane2 ========
1955: {
1956: scrollPane2
1957: .setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
1958: scrollPane2
1959: .setViewportView(workAddressTextArea);
1960: }
1961: mailingAddressPanel.add(scrollPane2, cc.xywh(3,
1962: 15, 1, 3));
1963:
1964: // ---- workCityLabel ----
1965: workCityLabel.setText(bundle
1966: .getString("workCityLabel.text"));
1967: workCityLabel.setLabelFor(workCityTextField);
1968: mailingAddressPanel.add(workCityLabel, cc.xywh(
1969: 5, 15, 1, 1, CellConstraints.RIGHT,
1970: CellConstraints.DEFAULT));
1971:
1972: // ---- workCityTextField ----
1973: workCityTextField.setColumns(5);
1974: mailingAddressPanel.add(workCityTextField, cc
1975: .xy(7, 15));
1976:
1977: // ---- workZipPostalCodeLabel ----
1978: workZipPostalCodeLabel
1979: .setText(bundle
1980: .getString("workZipPostalCodeLabel.text"));
1981: workZipPostalCodeLabel
1982: .setLabelFor(workZipPostalCodeTextField);
1983: mailingAddressPanel.add(workZipPostalCodeLabel,
1984: cc.xywh(5, 17, 1, 1,
1985: CellConstraints.RIGHT,
1986: CellConstraints.DEFAULT));
1987: mailingAddressPanel.add(
1988: workZipPostalCodeTextField, cc
1989: .xy(7, 17));
1990:
1991: // ---- label2 ----
1992: label2.setText(bundle
1993: .getString("streetLabel.text"));
1994: label2.setLabelFor(workStreetTextField);
1995: mailingAddressPanel.add(label2, cc.xywh(1, 19,
1996: 1, 1, CellConstraints.RIGHT,
1997: CellConstraints.DEFAULT));
1998: mailingAddressPanel.add(workStreetTextField, cc
1999: .xy(3, 19));
2000:
2001: // ---- workStateProvinceCountyLabel ----
2002: workStateProvinceCountyLabel
2003: .setText(bundle
2004: .getString("workStateProvinceCountyLabel.text"));
2005: workStateProvinceCountyLabel
2006: .setLabelFor(workStateProvinceCountyTextField);
2007: mailingAddressPanel.add(
2008: workStateProvinceCountyLabel, cc.xywh(
2009: 5, 19, 1, 1,
2010: CellConstraints.RIGHT,
2011: CellConstraints.DEFAULT));
2012: mailingAddressPanel.add(
2013: workStateProvinceCountyTextField, cc
2014: .xy(7, 19));
2015:
2016: // ---- workPOBoxLabel ----
2017: workPOBoxLabel.setText(bundle
2018: .getString("workPOBoxLabel.text"));
2019: workPOBoxLabel.setLabelFor(workPOBoxTextField);
2020: mailingAddressPanel.add(workPOBoxLabel, cc
2021: .xywh(1, 21, 1, 1,
2022: CellConstraints.RIGHT,
2023: CellConstraints.DEFAULT));
2024: mailingAddressPanel.add(workPOBoxTextField, cc
2025: .xy(3, 21));
2026:
2027: // ---- workCountryLabel ----
2028: workCountryLabel.setText(bundle
2029: .getString("workCountryLabel.text"));
2030: workCountryLabel
2031: .setLabelFor(workCountryTextField);
2032: mailingAddressPanel.add(workCountryLabel, cc
2033: .xywh(5, 21, 1, 1,
2034: CellConstraints.RIGHT,
2035: CellConstraints.DEFAULT));
2036: mailingAddressPanel.add(workCountryTextField,
2037: cc.xy(7, 21));
2038: mailingAddressPanel.add(otherSeparator, cc
2039: .xywh(1, 25, 7, 1));
2040:
2041: // ---- otherAddressLabel ----
2042: otherAddressLabel
2043: .setLabelFor(otherAddressTextArea);
2044: mailingAddressPanel.add(otherAddressLabel, cc
2045: .xywh(1, 27, 1, 1,
2046: CellConstraints.RIGHT,
2047: CellConstraints.DEFAULT));
2048:
2049: // ======== scrollPane4 ========
2050: {
2051: scrollPane4
2052: .setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
2053: scrollPane4
2054: .setViewportView(otherAddressTextArea);
2055: }
2056: mailingAddressPanel.add(scrollPane4, cc.xywh(3,
2057: 27, 1, 3));
2058:
2059: // ---- otherCityLabel ----
2060: otherCityLabel.setText(bundle
2061: .getString("otherCityLabel.text"));
2062: otherCityLabel.setLabelFor(otherCityTextField);
2063: mailingAddressPanel.add(otherCityLabel, cc
2064: .xywh(5, 27, 1, 1,
2065: CellConstraints.RIGHT,
2066: CellConstraints.DEFAULT));
2067: mailingAddressPanel.add(otherCityTextField, cc
2068: .xy(7, 27));
2069:
2070: // ---- otherZipPostalCodeLabel ----
2071: otherZipPostalCodeLabel
2072: .setText(bundle
2073: .getString("otherZipPostalCodeLabel.text"));
2074: otherZipPostalCodeLabel
2075: .setLabelFor(otherZipPostalCodeTextField);
2076: mailingAddressPanel.add(
2077: otherZipPostalCodeLabel, cc.xywh(5, 29,
2078: 1, 1, CellConstraints.RIGHT,
2079: CellConstraints.DEFAULT));
2080: mailingAddressPanel.add(
2081: otherZipPostalCodeTextField, cc.xy(7,
2082: 29));
2083:
2084: // ---- label3 ----
2085: label3.setText(bundle
2086: .getString("streetLabel.text"));
2087: label3.setLabelFor(otherStreetTextField);
2088: mailingAddressPanel.add(label3, cc.xywh(1, 31,
2089: 1, 1, CellConstraints.RIGHT,
2090: CellConstraints.DEFAULT));
2091: mailingAddressPanel.add(otherStreetTextField,
2092: cc.xy(3, 31));
2093:
2094: // ---- otherStateProvinceCountyLabel ----
2095: otherStateProvinceCountyLabel
2096: .setText(bundle
2097: .getString("otherStateProvinceCountyLabel.text"));
2098: otherStateProvinceCountyLabel
2099: .setLabelFor(otherStateProvinceCountyTextField);
2100: mailingAddressPanel.add(
2101: otherStateProvinceCountyLabel, cc.xywh(
2102: 5, 31, 1, 1,
2103: CellConstraints.RIGHT,
2104: CellConstraints.DEFAULT));
2105: mailingAddressPanel.add(
2106: otherStateProvinceCountyTextField, cc
2107: .xy(7, 31));
2108:
2109: // ---- otherPOBoxLabel ----
2110: otherPOBoxLabel.setText(bundle
2111: .getString("otherPOBoxLabel.text"));
2112: otherPOBoxLabel
2113: .setLabelFor(otherPOBoxTextField);
2114: mailingAddressPanel.add(otherPOBoxLabel, cc
2115: .xywh(1, 33, 1, 1,
2116: CellConstraints.RIGHT,
2117: CellConstraints.DEFAULT));
2118: mailingAddressPanel.add(otherPOBoxTextField, cc
2119: .xy(3, 33));
2120:
2121: // ---- otherCountryLabel ----
2122: otherCountryLabel.setText(bundle
2123: .getString("otherCountryLabel.text"));
2124: otherCountryLabel
2125: .setLabelFor(otherCountryTextField);
2126: mailingAddressPanel.add(otherCountryLabel, cc
2127: .xywh(5, 33, 1, 1,
2128: CellConstraints.RIGHT,
2129: CellConstraints.DEFAULT));
2130: mailingAddressPanel.add(otherCountryTextField,
2131: cc.xy(7, 33));
2132: }
2133: tabbedPane2
2134: .addTab(
2135: bundle
2136: .getString("mailingAddressPanel.tab.title"),
2137: mailingAddressPanel);
2138:
2139: }
2140: contentPane.add(tabbedPane2, BorderLayout.NORTH);
2141: }
2142: dialogPane.add(contentPane, BorderLayout.CENTER);
2143:
2144: // ======== buttonBar ========
2145: {
2146: buttonBar.setBorder(Borders.BUTTON_BAR_GAP_BORDER);
2147: buttonBar.setLayout(new FormLayout(new ColumnSpec[] {
2148: FormFactory.GLUE_COLSPEC,
2149: FormFactory.BUTTON_COLSPEC,
2150: FormFactory.RELATED_GAP_COLSPEC,
2151: FormFactory.BUTTON_COLSPEC }, RowSpec
2152: .decodeSpecs("pref")));
2153:
2154: // ---- okButton ----
2155: okButton.setText(bundle.getString("okButton.text"));
2156: buttonBar.add(okButton, cc.xy(2, 1));
2157:
2158: // ---- cancelButton ----
2159: cancelButton.setText(bundle
2160: .getString("cancelButton.text"));
2161: buttonBar.add(cancelButton, cc.xy(4, 1));
2162: }
2163: dialogPane.add(buttonBar, BorderLayout.SOUTH);
2164: }
2165: contentPane2.add(dialogPane, BorderLayout.CENTER);
2166: }
2167:
2168: /**
2169: * @return Returns the destModel.
2170: */
2171: public ContactModel getDestModel() {
2172: return destModel;
2173: }
2174:
2175: }
|