KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > sync4j > syncclient > demo > ContactForm


1 /**
2  * Copyright (C) 2003-2005 Funambol
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  */

18 package sync4j.syncclient.demo;
19
20 import java.awt.Button JavaDoc;
21 import java.awt.BorderLayout JavaDoc;
22 import java.awt.CardLayout JavaDoc;
23 import java.awt.CheckboxGroup JavaDoc;
24 import java.awt.GridLayout JavaDoc;
25 import java.awt.Label JavaDoc;
26 import java.awt.Panel JavaDoc;
27 import java.awt.ScrollPane JavaDoc;
28 import java.awt.TextField JavaDoc;
29 import java.awt.event.ActionEvent JavaDoc;
30 import java.awt.event.ActionListener JavaDoc;
31 import java.awt.event.MouseEvent JavaDoc;
32 import java.awt.event.MouseListener JavaDoc;
33
34 import java.util.List JavaDoc;
35 import java.util.Iterator JavaDoc;
36
37 import sync4j.foundation.pdi.contact.Contact;
38 import sync4j.foundation.pdi.contact.Email;
39 import sync4j.foundation.pdi.contact.Note;
40 import sync4j.foundation.pdi.contact.Phone;
41 import sync4j.foundation.pdi.contact.Title;
42 import sync4j.foundation.pdi.contact.WebPage;
43 import sync4j.foundation.pdi.common.*;
44
45 /**
46  * A form containing all the fields concerning a contact.
47  * This form will be a subpanel for ContactModify and ContactNew
48  *
49  * @author Fabio Maggi @ Funambol
50  * @author Alessandro Morandi, Giorgio Orsi
51  * @version $Id: ContactForm.java,v 1.13 2005/05/27 11:08:34 luigiafassina Exp $
52  */

53 public class ContactForm extends Panel JavaDoc
54 implements ActionListener JavaDoc, MouseListener JavaDoc, ConfigurationParameters {
55
56     //---------------------------------------------------------- Constants
57

58     //
59
// Note this is NOT the actual size of the TextField.
60
// It's just a way to avoid horizontal scrolling
61
//
62
public static final int TF_COLUMNS = 10 ;
63     
64     private static final String JavaDoc TK_MOBILEPHONE = "MobileTelephoneNumber" ;
65     private static final String JavaDoc TK_HOMEPHONE = "HomeTelephoneNumber" ;
66     private static final String JavaDoc TK_HOME2PHONE = "Home2TelephoneNumber" ;
67     private static final String JavaDoc TK_HOMEFAX = "HomeFaxNumber" ;
68     private static final String JavaDoc TK_OTHERPHONE = "OtherTelephoneNumber" ;
69     private static final String JavaDoc TK_BUSINESSPHONE = "BusinessTelephoneNumber" ;
70     private static final String JavaDoc TK_BUSINESS2PHONE = "Business2TelephoneNumber";
71     private static final String JavaDoc TK_BUSINESSFAX = "BusinessFaxNumber" ;
72     private static final String JavaDoc TK_PAGERNUMBER = "PagerNumber" ;
73     private static final String JavaDoc TK_EMAIL1 = "Email1Address" ;
74     private static final String JavaDoc TK_EMAIL2 = "Email2Address" ;
75     private static final String JavaDoc TK_EMAIL3 = "Email3Address" ;
76
77     //---------------------------------------------------------- Private data
78

79     //
80
// The window containing this panel
81
//
82
private MainWindow mw = null;
83
84     private Language ln = new Language();
85     
86     //
87
// The currently displayed tab (general,personal,business)
88
//
89
private String JavaDoc currentTab = null;
90
91     private TextField JavaDoc tf2 = null;
92     private TextField JavaDoc tf3 = null;
93     private TextField JavaDoc tf4 = null;
94     private TextField JavaDoc tf5 = null;
95     private TextField JavaDoc tf6 = null;
96     private TextField JavaDoc tf7 = null;
97     private TextField JavaDoc tf11 = null;
98     private TextField JavaDoc tf13 = null;
99     private TextField JavaDoc tf14 = null;
100     private TextField JavaDoc tf15 = null;
101     private TextField JavaDoc tf16 = null;
102     private TextField JavaDoc tf17 = null;
103     private TextField JavaDoc tf19 = null;
104     private TextField JavaDoc tf20 = null;
105     private TextField JavaDoc tf22 = null;
106     private TextField JavaDoc tf23 = null;
107     private TextField JavaDoc tf24 = null;
108     private TextField JavaDoc tf25 = null;
109     private TextField JavaDoc tf31 = null;
110     private TextField JavaDoc tf32 = null;
111     private TextField JavaDoc tf33 = null;
112     private TextField JavaDoc tf34 = null;
113     private TextField JavaDoc tf35 = null;
114     private TextField JavaDoc tf36 = null;
115     private TextField JavaDoc tf37 = null;
116     private TextField JavaDoc tf38 = null;
117     private TextField JavaDoc tf39 = null;
118     private TextField JavaDoc tf41 = null;
119     private TextField JavaDoc tf42 = null;
120     private TextField JavaDoc tf45 = null;
121     private TextField JavaDoc tf46 = null;
122     private TextField JavaDoc tf47 = null;
123     private TextField JavaDoc tf48 = null;
124     private TextField JavaDoc tf49 = null;
125     private TextField JavaDoc tf50 = null;
126
127     private Button JavaDoc butGeneral = null;
128     private Button JavaDoc butPersonal = null;
129     private Button JavaDoc butBusiness = null;
130     private CardLayout JavaDoc cardLayout = null;
131     private Panel JavaDoc fieldPanel = null;
132     private ScrollPane JavaDoc scrollGeneralPane = null;
133     private ScrollPane JavaDoc scrollPersonalPane = null;
134     private ScrollPane JavaDoc scrollBusinessPane = null;
135
136     //---------------------------------------------------------- Public methods
137

138     public String JavaDoc getBirthdayDate() {
139         return tf19.getText();
140     }
141
142     /**
143      * Creates the form subpanel.
144      *
145      * @param mw the window containing this panel
146      */

147     public ContactForm(MainWindow mw) {
148
149         Panel JavaDoc generalPanel = null;
150         Panel JavaDoc personalPanel = null;
151         Panel JavaDoc businessPanel = null;
152
153         //
154
// Generic Labels
155
//
156
Label JavaDoc lb2 = null;
157         Label JavaDoc lb3 = null;
158         Label JavaDoc lb4 = null;
159         Label JavaDoc lb5 = null;
160         Label JavaDoc lb6 = null;
161         Label JavaDoc lb7 = null;
162         Label JavaDoc lb11 = null;
163
164         //
165
// Personal Labels
166
//
167
Label JavaDoc lb13 = null;
168         Label JavaDoc lb14 = null;
169         Label JavaDoc lb15 = null;
170         Label JavaDoc lb16 = null;
171         Label JavaDoc lb17 = null;
172         Label JavaDoc lb19 = null;
173         Label JavaDoc lb20 = null;
174         Label JavaDoc lb22 = null;
175         Label JavaDoc lb23 = null;
176         Label JavaDoc lb24 = null;
177         Label JavaDoc lb25 = null;
178
179         //
180
// Business Labels
181
//
182
Label JavaDoc lb31 = null;
183         Label JavaDoc lb32 = null;
184         Label JavaDoc lb33 = null;
185         Label JavaDoc lb34 = null;
186         Label JavaDoc lb35 = null;
187         Label JavaDoc lb36 = null;
188         Label JavaDoc lb37 = null;
189         Label JavaDoc lb38 = null;
190         Label JavaDoc lb39 = null;
191         Label JavaDoc lb41 = null;
192         Label JavaDoc lb42 = null;
193         Label JavaDoc lb45 = null;
194         Label JavaDoc lb46 = null;
195         Label JavaDoc lb47 = null;
196         Label JavaDoc lb48 = null;
197         Label JavaDoc lb49 = null;
198         Label JavaDoc lb50 = null;
199
200         this.mw = mw;
201
202         Panel JavaDoc buttonMenu = new Panel JavaDoc();
203         buttonMenu.setLayout(new GridLayout JavaDoc(1,3));
204
205         butGeneral = new Button JavaDoc (ln.getString("general") );
206         butGeneral.setActionCommand ("general" );
207         butGeneral.addActionListener (this );
208         butGeneral.setEnabled (false );
209         butPersonal = new Button JavaDoc (ln.getString("personal"));
210         butPersonal.setActionCommand ("personal" );
211         butPersonal.addActionListener(this );
212         butBusiness = new Button JavaDoc (ln.getString("business"));
213         butBusiness.setActionCommand ("business" );
214         butBusiness.addActionListener(this );
215
216         buttonMenu.add(butGeneral );
217         buttonMenu.add(butPersonal);
218         buttonMenu.add(butBusiness);
219
220         //
221
// Generic Textfields
222
//
223
tf2 = new TextField JavaDoc(TF_COLUMNS);
224         tf3 = new TextField JavaDoc(TF_COLUMNS);
225         tf4 = new TextField JavaDoc(TF_COLUMNS);
226         tf5 = new TextField JavaDoc(TF_COLUMNS);
227         tf6 = new TextField JavaDoc(TF_COLUMNS);
228         tf7 = new TextField JavaDoc(TF_COLUMNS);
229         tf11 = new TextField JavaDoc(TF_COLUMNS);
230
231         tf2.addMouseListener (this);
232         tf3.addMouseListener (this);
233         tf4.addMouseListener (this);
234         tf5.addMouseListener (this);
235         tf6.addMouseListener (this);
236         tf7.addMouseListener (this);
237         tf11.addMouseListener(this);
238
239         //
240
// Personal Textfields
241
//
242
tf13 = new TextField JavaDoc(TF_COLUMNS);
243         tf14 = new TextField JavaDoc(TF_COLUMNS);
244         tf15 = new TextField JavaDoc(TF_COLUMNS);
245         tf16 = new TextField JavaDoc(TF_COLUMNS);
246         tf17 = new TextField JavaDoc(TF_COLUMNS);
247         tf19 = new TextField JavaDoc(TF_COLUMNS);
248         tf20 = new TextField JavaDoc(TF_COLUMNS);
249         tf22 = new TextField JavaDoc(TF_COLUMNS);
250         tf23 = new TextField JavaDoc(TF_COLUMNS);
251         tf24 = new TextField JavaDoc(TF_COLUMNS);
252         tf25 = new TextField JavaDoc(TF_COLUMNS);
253
254         tf13.addMouseListener(this);
255         tf14.addMouseListener(this);
256         tf15.addMouseListener(this);
257         tf16.addMouseListener(this);
258         tf17.addMouseListener(this);
259         tf19.addMouseListener(this);
260         tf20.addMouseListener(this);
261         tf22.addMouseListener(this);
262         tf23.addMouseListener(this);
263         tf24.addMouseListener(this);
264         tf25.addMouseListener(this);
265
266         //
267
// Business Textfields
268
//
269
tf31 = new TextField JavaDoc(TF_COLUMNS);
270         tf32 = new TextField JavaDoc(TF_COLUMNS);
271         tf33 = new TextField JavaDoc(TF_COLUMNS);
272         tf34 = new TextField JavaDoc(TF_COLUMNS);
273         tf35 = new TextField JavaDoc(TF_COLUMNS);
274         tf36 = new TextField JavaDoc(TF_COLUMNS);
275         tf37 = new TextField JavaDoc(TF_COLUMNS);
276         tf38 = new TextField JavaDoc(TF_COLUMNS);
277         tf39 = new TextField JavaDoc(TF_COLUMNS);
278         tf41 = new TextField JavaDoc(TF_COLUMNS);
279         tf42 = new TextField JavaDoc(TF_COLUMNS);
280         tf45 = new TextField JavaDoc(TF_COLUMNS);
281         tf46 = new TextField JavaDoc(TF_COLUMNS);
282         tf47 = new TextField JavaDoc(TF_COLUMNS);
283         tf48 = new TextField JavaDoc(TF_COLUMNS);
284         tf49 = new TextField JavaDoc(TF_COLUMNS);
285         tf50 = new TextField JavaDoc(TF_COLUMNS);
286
287         tf31.addMouseListener(this);
288         tf32.addMouseListener(this);
289         tf33.addMouseListener(this);
290         tf34.addMouseListener(this);
291         tf35.addMouseListener(this);
292         tf36.addMouseListener(this);
293         tf37.addMouseListener(this);
294         tf38.addMouseListener(this);
295         tf39.addMouseListener(this);
296         tf41.addMouseListener(this);
297         tf42.addMouseListener(this);
298         tf45.addMouseListener(this);
299         tf46.addMouseListener(this);
300         tf47.addMouseListener(this);
301         tf48.addMouseListener(this);
302         tf49.addMouseListener(this);
303         tf50.addMouseListener(this);
304
305         //
306
// General Labels
307
//
308
lb2 = new Label JavaDoc(ln.getString("title" ));
309         lb3 = new Label JavaDoc(ln.getString("first_name" ));
310         lb4 = new Label JavaDoc(ln.getString("middle_name" ));
311         lb5 = new Label JavaDoc(ln.getString("last_name" ));
312         lb6 = new Label JavaDoc(ln.getString("suffix" ));
313         lb7 = new Label JavaDoc(ln.getString("nickname" ));
314         lb11 = new Label JavaDoc(ln.getString("note" ));
315
316         //
317
// Personal Labels
318
//
319
lb13 = new Label JavaDoc(ln.getString("street" ));
320         lb14 = new Label JavaDoc(ln.getString("city" ));
321         lb15 = new Label JavaDoc(ln.getString("state" ));
322         lb16 = new Label JavaDoc(ln.getString("postal_code" ));
323         lb17 = new Label JavaDoc(ln.getString("country" ));
324         lb19 = new Label JavaDoc(ln.getString("birthday" ));
325         lb20 = new Label JavaDoc(ln.getString("cell_phone" ));
326         lb22 = new Label JavaDoc(ln.getString("home_phone" ));
327         lb23 = new Label JavaDoc(ln.getString("home_phone2" ));
328         lb24 = new Label JavaDoc(ln.getString("home_fax" ));
329         lb25 = new Label JavaDoc(ln.getString("gen_phone" ));
330
331         //
332
// Business Labels
333
//
334
lb31 = new Label JavaDoc(ln.getString("street" ));
335         lb32 = new Label JavaDoc(ln.getString("city" ));
336         lb33 = new Label JavaDoc(ln.getString("state" ));
337         lb34 = new Label JavaDoc(ln.getString("postal_code" ));
338         lb35 = new Label JavaDoc(ln.getString("country" ));
339         lb36 = new Label JavaDoc(ln.getString("role" ));
340         lb37 = new Label JavaDoc(ln.getString("job_title" ));
341         lb38 = new Label JavaDoc(ln.getString("company" ));
342         lb39 = new Label JavaDoc(ln.getString("department" ));
343         lb41 = new Label JavaDoc(ln.getString("business_phone" ));
344         lb42 = new Label JavaDoc(ln.getString("business_phone2"));
345         lb45 = new Label JavaDoc(ln.getString("business_fax" ));
346         lb46 = new Label JavaDoc(ln.getString("pager_number" ));
347         lb47 = new Label JavaDoc(ln.getString("email1" ));
348         lb48 = new Label JavaDoc(ln.getString("email2" ));
349         lb49 = new Label JavaDoc(ln.getString("email3" ));
350         lb50 = new Label JavaDoc(ln.getString("webpage" ));
351
352         //
353
// Generic panel
354
//
355
generalPanel = new Panel JavaDoc();
356         generalPanel.setLayout(new GridLayout JavaDoc(17, 2));
357
358         generalPanel.add(lb2 );
359         generalPanel.add(tf2 );
360         generalPanel.add(lb3 );
361         generalPanel.add(tf3 );
362         generalPanel.add(lb4 );
363         generalPanel.add(tf4 );
364         generalPanel.add(lb5 );
365         generalPanel.add(tf5 );
366         generalPanel.add(lb6 );
367         generalPanel.add(tf6 );
368         generalPanel.add(lb7 );
369         generalPanel.add(tf7 );
370         generalPanel.add(lb11 );
371         generalPanel.add(tf11 );
372         generalPanel.add(new Label JavaDoc());
373         generalPanel.add(new Label JavaDoc());
374         generalPanel.add(new Label JavaDoc());
375         generalPanel.add(new Label JavaDoc());
376         generalPanel.add(new Label JavaDoc());
377         generalPanel.add(new Label JavaDoc());
378         generalPanel.add(new Label JavaDoc());
379         generalPanel.add(new Label JavaDoc());
380         generalPanel.add(new Label JavaDoc());
381         generalPanel.add(new Label JavaDoc());
382
383         //
384
// Personal panel
385
//
386
personalPanel = new Panel JavaDoc();
387         personalPanel.setLayout(new GridLayout JavaDoc(22, 2));
388
389         personalPanel.add(lb13 );
390         personalPanel.add(tf13 );
391         personalPanel.add(lb14 );
392         personalPanel.add(tf14 );
393         personalPanel.add(lb15 );
394         personalPanel.add(tf15 );
395         personalPanel.add(lb16 );
396         personalPanel.add(tf16 );
397         personalPanel.add(lb17 );
398         personalPanel.add(tf17 );
399         personalPanel.add(lb19 );
400         personalPanel.add(tf19 );
401         personalPanel.add(lb25 );
402         personalPanel.add(tf25 );
403         personalPanel.add(lb20 );
404         personalPanel.add(tf20 );
405         personalPanel.add(lb22 );
406         personalPanel.add(tf22 );
407         personalPanel.add(lb23 );
408         personalPanel.add(tf23 );
409         personalPanel.add(lb24 );
410         personalPanel.add(tf24 );
411         personalPanel.add(new Label JavaDoc());
412         personalPanel.add(new Label JavaDoc());
413         personalPanel.add(new Label JavaDoc());
414         personalPanel.add(new Label JavaDoc());
415         personalPanel.add(new Label JavaDoc());
416         personalPanel.add(new Label JavaDoc());
417         personalPanel.add(new Label JavaDoc());
418         personalPanel.add(new Label JavaDoc());
419         personalPanel.add(new Label JavaDoc());
420         personalPanel.add(new Label JavaDoc());
421
422         //
423
// Business panel
424
//
425
businessPanel = new Panel JavaDoc();
426         businessPanel.setLayout(new GridLayout JavaDoc(27, 2));
427
428         businessPanel.add(lb31 );
429         businessPanel.add(tf31 );
430         businessPanel.add(lb32 );
431         businessPanel.add(tf32 );
432         businessPanel.add(lb33 );
433         businessPanel.add(tf33 );
434         businessPanel.add(lb34 );
435         businessPanel.add(tf34 );
436         businessPanel.add(lb35 );
437         businessPanel.add(tf35 );
438         businessPanel.add(lb36 );
439         businessPanel.add(tf36 );
440         businessPanel.add(lb37 );
441         businessPanel.add(tf37 );
442         businessPanel.add(lb38 );
443         businessPanel.add(tf38 );
444         businessPanel.add(lb39 );
445         businessPanel.add(tf39 );
446         businessPanel.add(lb41 );
447         businessPanel.add(tf41 );
448         businessPanel.add(lb42 );
449         businessPanel.add(tf42 );
450         businessPanel.add(lb45 );
451         businessPanel.add(tf45 );
452         businessPanel.add(lb46 );
453         businessPanel.add(tf46 );
454         businessPanel.add(lb47 );
455         businessPanel.add(tf47 );
456         businessPanel.add(lb48 );
457         businessPanel.add(tf48 );
458         businessPanel.add(lb49 );
459         businessPanel.add(tf49 );
460         businessPanel.add(lb50 );
461         businessPanel.add(tf50 );
462         businessPanel.add(new Label JavaDoc());
463         businessPanel.add(new Label JavaDoc());
464         businessPanel.add(new Label JavaDoc());
465         businessPanel.add(new Label JavaDoc());
466         businessPanel.add(new Label JavaDoc());
467         businessPanel.add(new Label JavaDoc());
468         businessPanel.add(new Label JavaDoc());
469         businessPanel.add(new Label JavaDoc());
470         businessPanel.add(new Label JavaDoc());
471         businessPanel.add(new Label JavaDoc());
472
473         scrollGeneralPane = new ScrollPane JavaDoc(ScrollPane.SCROLLBARS_NEVER );
474         scrollGeneralPane.add(generalPanel );
475
476         scrollPersonalPane = new ScrollPane JavaDoc(ScrollPane.SCROLLBARS_NEVER );
477         scrollPersonalPane.add(personalPanel);
478
479         scrollBusinessPane = new ScrollPane JavaDoc(ScrollPane.SCROLLBARS_AS_NEEDED);
480         scrollBusinessPane.add(businessPanel);
481
482         fieldPanel = new Panel JavaDoc();
483         fieldPanel.setSize(100,100);
484         cardLayout = new CardLayout JavaDoc();
485         fieldPanel.setLayout(cardLayout);
486
487         fieldPanel.add(scrollGeneralPane , "general" );
488         fieldPanel.add(scrollPersonalPane, "personal");
489         fieldPanel.add(scrollBusinessPane, "business");
490
491         cardLayout.show(fieldPanel, "general");
492         currentTab = "general";
493
494         setLayout(new BorderLayout JavaDoc());
495
496         add (buttonMenu, BorderLayout.NORTH );
497         add (fieldPanel, BorderLayout.CENTER);
498     }
499
500     /**
501      * Invoked when an action occurs (i.e. a button is pressed).
502      *
503      * @param evt the occurred action
504      */

505     public void actionPerformed(ActionEvent JavaDoc evt) {
506
507         if (evt.getActionCommand().equals ("general")) {
508             butGeneral.setEnabled (false);
509             butPersonal.setEnabled(true );
510             butBusiness.setEnabled(true );
511             cardLayout.show(fieldPanel,"general");
512             currentTab = "general";
513         } else if (evt.getActionCommand().equals ("personal")) {
514             butGeneral.setEnabled (true );
515             butPersonal.setEnabled(false);
516             butBusiness.setEnabled(true );
517             cardLayout.show(fieldPanel,"personal");
518             currentTab = "personal";
519         } else if (evt.getActionCommand().equals ("business")) {
520             butGeneral.setEnabled (true );
521             butPersonal.setEnabled(true );
522             butBusiness.setEnabled(false);
523             cardLayout.show(fieldPanel,"business");
524             currentTab = "business";
525         }
526     }
527
528     /**
529      * Invoked when the mouse button has been clicked
530      * (pressed and released) on a component.
531      * This method adjusts the scrollpanes so that
532      * the selected textfield is placed
533      * on top of the pane.
534      *
535      * @param evt the occurred event
536      */

537     public void mouseClicked(MouseEvent JavaDoc evt) {
538         TextField JavaDoc tmptxt = (TextField JavaDoc)evt.getComponent();
539         if (currentTab.equals("business")) {
540             scrollBusinessPane.setScrollPosition(0, tmptxt.getLocation().y);
541         }
542     }
543
544     /**
545      * Invoked when a mouse button has been
546      * pressed on a component.
547      * Not used.
548      *
549      * @param evt the occurred event
550      */

551     public void mousePressed(MouseEvent JavaDoc evt) {
552         // do nothing
553
}
554
555     /**
556      * Invoked when a mouse button has been
557      * released on a component.
558      * Not used.
559      *
560      * @param evt the occurred event
561      */

562     public void mouseReleased(MouseEvent JavaDoc evt) {
563         // do nothing
564
}
565
566     /**
567      * Invoked when the mouse enters a component.
568      * Not used.
569      *
570      * @param evt the occurred event
571      */

572     public void mouseEntered(MouseEvent JavaDoc evt) {
573         // do nothing
574
}
575
576     /**
577      * Invoked when the mouse exits a component.
578      * Not used.
579      *
580      * @param evt the occurred event
581      */

582     public void mouseExited(MouseEvent JavaDoc evt) {
583         // do nothing
584
}
585
586     //---------------------------------------------------------- Protected methods
587

588     /**
589      * Sets the fields with the values contained in the specified Contact object.
590      * Used to display the old value of contact
591      *
592      * @param contact the Contact object which is the source of the values
593      */

594     protected void setFields(Contact contact) {
595
596         //
597
// General
598
//
599
tf2.setText((String JavaDoc)contact.getName().getSalutation().getPropertyValue());
600         tf3.setText((String JavaDoc)contact.getName().getFirstName().getPropertyValue());
601         tf4.setText((String JavaDoc)contact.getName().getMiddleName().getPropertyValue());
602         tf5.setText((String JavaDoc)contact.getName().getLastName().getPropertyValue());
603         tf6.setText((String JavaDoc)contact.getName().getSuffix().getPropertyValue());
604         tf7.setText((String JavaDoc)contact.getName().getNickname().getPropertyValue());
605
606         List JavaDoc notes = contact.getNotes();
607         if (notes != null && notes.size() > 0) {
608             Note tmpNote = (Note)notes.get(0);
609             tf11.setText((String JavaDoc)tmpNote.getPropertyValue());
610         } else {
611             tf11.setText("");
612         }
613
614         //
615
// Personal
616
//
617
tf13.setText((String JavaDoc)contact.getPersonalDetail()
618                              .getAddress().getStreet().getPropertyValue());
619         tf14.setText((String JavaDoc)contact.getPersonalDetail()
620                              .getAddress().getCity().getPropertyValue());
621         tf15.setText((String JavaDoc)contact.getPersonalDetail()
622                              .getAddress().getState().getPropertyValue());
623         tf16.setText((String JavaDoc)contact.getPersonalDetail()
624                              .getAddress().getPostalCode().getPropertyValue());
625         tf17.setText((String JavaDoc)contact.getPersonalDetail()
626                              .getAddress().getCountry().getPropertyValue());
627
628         String JavaDoc birthday = null;
629         birthday = FieldsHelper.convertBirthdayFrom(
630             (String JavaDoc)contact.getPersonalDetail().getBirthday()
631         );
632
633         if (birthday.length() > 10) {
634             birthday = birthday.substring(0, 10);
635         }
636
637         //
638
// 01/01/4501 is the dummy date of outlook...
639
//
640
if (birthday.indexOf("01/01/4501") != -1) {
641             birthday = "";
642         }
643
644         tf19.setText(birthday);
645
646         List JavaDoc phones = contact.getPersonalDetail().getPhones();
647
648         tf20.setText("");
649         tf22.setText("");
650         tf23.setText("");
651         tf24.setText("");
652         tf25.setText("");
653
654         if (phones != null) {
655             Iterator JavaDoc itPhones = phones.iterator();
656             while(itPhones.hasNext()) {
657                 Phone phone = (Phone)itPhones.next();
658                 if (phone.getPhoneType() == null) {
659                     continue;
660                 }
661                 if (phone.getPhoneType().equals(TK_MOBILEPHONE)) {
662                     tf20.setText((String JavaDoc)phone.getPropertyValue());
663                 } else if (phone.getPhoneType().equals(TK_HOMEPHONE)) {
664                     tf22.setText((String JavaDoc)phone.getPropertyValue());
665                 } else if (phone.getPhoneType().equals(TK_HOME2PHONE)) {
666                     tf23.setText((String JavaDoc)phone.getPropertyValue());
667                 } else if (phone.getPhoneType().equals(TK_HOMEFAX)) {
668                     tf24.setText((String JavaDoc)phone.getPropertyValue());
669                 } else if (phone.getPhoneType().equals(TK_OTHERPHONE)) {
670                     tf25.setText((String JavaDoc)phone.getPropertyValue());
671                 }
672             }
673         }
674         
675         //
676 </