1 package org.argeo.people.web.parts;
2
3 import javax.jcr.Node;
4 import javax.jcr.Property;
5 import javax.jcr.RepositoryException;
6
7 import org.argeo.connect.util.ConnectJcrUtils;
8 import org.argeo.eclipse.ui.EclipseUiUtils;
9 import org.eclipse.swt.SWT;
10 import org.eclipse.swt.layout.GridData;
11 import org.eclipse.swt.layout.GridLayout;
12 import org.eclipse.swt.widgets.Composite;
13 import org.eclipse.swt.widgets.Control;
14 import org.eclipse.swt.widgets.Group;
15 import org.eclipse.swt.widgets.Label;
16
17
18
19
20
21 public class ContactsWithNotePart extends ContactsPart {
22
23 public ContactsWithNotePart() {
24 }
25
26 public ContactsWithNotePart(SingleContactPart singleContactPart) {
27 super(singleContactPart);
28 }
29
30 @Override
31 public Control createUi(Composite parent, Node context) throws RepositoryException {
32 parent.setLayout(EclipseUiUtils.noSpaceGridLayout(new GridLayout(2, false)));
33 Composite left = new Composite(parent, SWT.NO_FOCUS);
34 left.setLayoutData(EclipseUiUtils.fillWidth());
35 createContactPanel(left, context);
36
37 Composite right = new Composite(parent, SWT.NO_FOCUS);
38 GridData gd = EclipseUiUtils.fillAll();
39
40 right.setLayoutData(gd);
41 createNotePanel(right, context);
42 return parent;
43 }
44
45 private void createNotePanel(Composite parent, Node context) throws RepositoryException {
46 parent.setLayout(EclipseUiUtils.noSpaceGridLayout());
47
48
49 if (context.hasProperty(Property.JCR_TITLE)) {
50 Group group = new Group(parent, SWT.NO_FOCUS);
51 group.setLayout(EclipseUiUtils.noSpaceGridLayout());
52 group.setLayoutData(EclipseUiUtils.fillAll());
53
54 group.setText("Note");
55 Label label = new Label(group, SWT.WRAP);
56 label.setText(ConnectJcrUtils.get(context, Property.JCR_TITLE));
57 }
58 }
59 }