-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShowNoteForm.java
More file actions
64 lines (56 loc) · 1.92 KB
/
Copy pathShowNoteForm.java
File metadata and controls
64 lines (56 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Form;
import javax.microedition.lcdui.ImageItem;
import javax.microedition.lcdui.StringItem;
public class ShowNoteForm extends Form implements CommandListener {
private Command back;
private Displayable backDisplay;
private Display display;
private Note note;
private ImageItem imageItem;
private StringItem titleItem;
private StringItem contentItem;
private StringItem dateItem;
private StringItem priorityItem;
public ShowNoteForm(Displayable backDisplay, Note note) {
super("Note informations");
display = MainMidlet.getDisplay();
this.backDisplay = backDisplay;
this.note = note;
setupCommands();
setupFields();
inflateView();
}
public void commandAction(Command c, Displayable d) {
if(c == back)
display.setCurrent(backDisplay);
}
private void setupFields() {
imageItem = new ImageItem("Category: " + note.getCategory().toString(), note.getCategory().getIcon(), 0, "ctgimg");
titleItem = new StringItem("Title", null);
titleItem.setFont(Font.getFont(Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_LARGE));
contentItem = new StringItem("Content", null);
dateItem = new StringItem("Date", null);
priorityItem = new StringItem("Priority", null);
this.append(imageItem);
this.append(titleItem);
this.append(contentItem);
this.append(dateItem);
this.append(priorityItem);
}
private void setupCommands() {
back = new Command("Back", Command.BACK, 0);
this.addCommand(back);
this.setCommandListener(this);
}
private void inflateView() {
titleItem.setText(note.getTitle());
contentItem.setText(note.getContent());
dateItem.setText(Utils.getReadableDate(note.getTimestamp()));
priorityItem.setText(String.valueOf(note.getPriority()));
}
}