c1e86c3d1fca92fbda2798a7bc16aae2542b92e9
[jvcard.git] / src / be / nikiroo / jvcard / tui / panes / ContactDetails.java
1 package be.nikiroo.jvcard.tui.panes;
2
3 import java.util.List;
4
5 import be.nikiroo.jvcard.Contact;
6 import be.nikiroo.jvcard.Data;
7 import be.nikiroo.jvcard.tui.KeyAction;
8 import be.nikiroo.jvcard.tui.KeyAction.DataType;
9 import be.nikiroo.jvcard.tui.KeyAction.Mode;
10
11 import com.googlecode.lanterna.gui2.Direction;
12 import com.googlecode.lanterna.gui2.Label;
13
14 public class ContactDetails extends MainContent {
15 private Contact contact;
16
17 public ContactDetails(Contact contact) {
18 super(Direction.VERTICAL);
19
20 this.contact = contact;
21
22 for (Data data : contact.getContent()) {
23 addComponent(new Label(data.getName() + ": " + data.getValue()));
24 }
25 }
26
27 @Override
28 public DataType getDataType() {
29 return DataType.CONTACT;
30 }
31
32 @Override
33 public String getExitWarning() {
34 // TODO Auto-generated method stub
35 return null;
36 }
37
38 @Override
39 public List<KeyAction> getKeyBindings() {
40 // TODO Auto-generated method stub
41 return null;
42 }
43
44 @Override
45 public Mode getMode() {
46 return Mode.CONTACT_DETAILS;
47 }
48
49 @Override
50 public String getTitle() {
51 String title = null;
52
53 if (contact != null) {
54 title = contact.getPreferredDataValue("FN");
55 if (title == null || title.length() == 0)
56 title = contact.getPreferredDataValue("N");
57 }
58
59 return title;
60 }
61
62 @Override
63 public String move(int x, int y) {
64 // TODO Auto-generated method stub
65 return null;
66 }
67 }