KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > nightlabs > ipanema > person > edit > PersonEditor


1 /*
2  * Created on Jan 9, 2005
3  * by alex
4  *
5  */

6 package com.nightlabs.ipanema.person.edit;
7
8 import org.eclipse.swt.widgets.Composite;
9 import org.eclipse.swt.widgets.Control;
10
11 import com.nightlabs.ipanema.person.Person;
12
13 /**
14  * A interface for common methods of all PersonEditors, either
15  * block or field based.<br/>
16  * Common useage is:<br/>
17  * <ul>
18  * <li>Create a the Editor with parameterless constructor or one specific to the type your using.</li>
19  * <li>Link the editor to a person by using {@link #setPerson(Person)</li>
20  * <li>Create the UI representation by calling {@link #createControl(Composite, PersonDataBlockEditorChangedListener, boolean)}</li>
21  * <li>If not done with {@link #createControl(Composite, PersonDataBlockEditorChangedListener, boolean)} set the field values by
22  * calling {@link #refreshControl(PersonDataBlockEditorChangedListener)}.
23  * </li>
24  * <li>To update the person with the values of the editor call {@link #updatePeson()}</li>
25  * </ul>
26  *
27  * @author Alexander Bieber <alex[AT]nightlabs[DOT]de>
28  *
29  */

30 public interface PersonEditor {
31     
32     /**
33      * Link the editor to a Person.
34      * @param person
35      */

36     public void setPerson(Person person);
37     /**
38      * Link the editor to a Person and refresh the Control
39      * if refresh is true.
40      *
41      * @param person
42      * @param refresh
43      */

44     public void setPerson(Person person, boolean refresh);
45     
46     /**
47      * Create the UI representation of the PersonEditor and associate
48      * the passed changeListener with the fields. If refresh is true
49      * refresh the UI representation. This should be done synchronously
50      * on the GUI-Thread to avoid InvalidThreadAccessExceptions.
51      *
52      * @param parent
53      * @param refresh
54      * @return
55      */

56     public Control createControl(Composite parent, boolean refresh);
57     
58     public void disposeControl();
59     
60     /**
61      * Refresh the UI representation.
62      * Implementors should refresh on the GUI-Thread to avoid
63      * InvalidThreadAccessExceptions.
64      *
65      * @param changeListener
66      */

67     public void refreshControl();
68     
69     /**
70      * Set the values from the editor to the Person it
71      * is associated with.
72      *
73      */

74     public void updatePerson();
75 }
76
Popular Tags