Improve UI, take "dirty" check into account, move launcher to Main.java
[jvcard.git] / src / be / nikiroo / jvcard / tui / panes / ContactDetails.java
CommitLineData
fae07ea7
NR
1package be.nikiroo.jvcard.tui.panes;
2
3import java.util.List;
4
5import be.nikiroo.jvcard.Contact;
6import be.nikiroo.jvcard.Data;
7import be.nikiroo.jvcard.tui.KeyAction;
8import be.nikiroo.jvcard.tui.KeyAction.DataType;
9import be.nikiroo.jvcard.tui.KeyAction.Mode;
10
11import com.googlecode.lanterna.gui2.Direction;
12import com.googlecode.lanterna.gui2.Label;
13
14public 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() {
0b0b2b0f
NR
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;
fae07ea7
NR
60 }
61
62 @Override
63 public String move(int x, int y) {
64 // TODO Auto-generated method stub
65 return null;
66 }
67}