1 package org.argeo.people.web.pages;
2
3 import javax.jcr.Node;
4 import javax.jcr.RepositoryException;
5
6 import org.argeo.cms.ui.CmsUiProvider;
7 import org.argeo.connect.resources.ResourcesService;
8 import org.argeo.eclipse.ui.EclipseUiUtils;
9 import org.argeo.people.PeopleService;
10 import org.argeo.people.web.parts.ActivitiesPart;
11 import org.argeo.people.web.parts.ContactButtonsPart;
12 import org.argeo.people.web.parts.ContactsWithNotePart;
13 import org.argeo.people.web.parts.PersonHeaderPart;
14 import org.argeo.people.web.parts.SingleContactPart;
15 import org.eclipse.swt.SWT;
16 import org.eclipse.swt.layout.GridData;
17 import org.eclipse.swt.widgets.Composite;
18 import org.eclipse.swt.widgets.Control;
19
20
21
22
23
24 public class PersonPage implements CmsUiProvider {
25
26
27 private PersonHeaderPart personHeaderPart;
28 private ContactsWithNotePart contactsWithNotePart;
29 private ActivitiesPart activitiesPart;
30
31 public PersonPage() {
32 }
33
34 public PersonPage(PeopleService peopleService, ResourcesService resourcesService) {
35 personHeaderPart = new PersonHeaderPart(peopleService);
36
37 ContactButtonsPart cbp = new ContactButtonsPart();
38 SingleContactPart scp = new SingleContactPart();
39 scp.setResourcesService(resourcesService);
40 scp.setContactButtonsPart(cbp);
41 contactsWithNotePart = new ContactsWithNotePart(scp);
42
43 activitiesPart = new ActivitiesPart(peopleService);
44 }
45
46 @Override
47 public Control createUi(Composite parent, Node context) throws RepositoryException {
48
49
50 Composite body = new Composite(parent, SWT.NO_FOCUS);
51 body.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
52 body.setLayout(EclipseUiUtils.noSpaceGridLayout());
53
54
55 Composite headerCmp = new Composite(body, SWT.NO_FOCUS);
56 headerCmp.setLayoutData(EclipseUiUtils.fillWidth());
57 personHeaderPart.createUi(headerCmp, context);
58
59
60 Composite contactCmp = new Composite(body, SWT.NO_FOCUS);
61 contactCmp.setLayoutData(EclipseUiUtils.fillWidth());
62 contactsWithNotePart.createUi(contactCmp, context);
63
64
65 Composite activitiesCmp = new Composite(body, SWT.NO_FOCUS);
66 activitiesCmp.setLayoutData(EclipseUiUtils.fillWidth());
67 activitiesPart.createUi(activitiesCmp, context);
68
69 parent.layout();
70 return body;
71 }
72
73
74 public void setPersonHeaderPart(PersonHeaderPart personHeaderPart) {
75 this.personHeaderPart = personHeaderPart;
76 }
77
78 public void setContactsWithNotePart(ContactsWithNotePart contactsWithNotePart) {
79 this.contactsWithNotePart = contactsWithNotePart;
80 }
81
82 public void setActivitiesPart(ActivitiesPart activitiesPart) {
83 this.activitiesPart = activitiesPart;
84 }
85 }