- break;
- // mode with windows:
- case CONTACT_LIST:
- Card card = action.getCard();
- if (card != null) {
- pushContent(new ContactList(card));
- }
- break;
- case CONTACT_DETAILS:
- Contact contact = action.getContact();
- if (contact != null) {
- pushContent(new ContactDetails(contact));
+ MainContent content = getContent();
+ handled = true;
+
+ if (action.onAction()) {
+ switch (action.getMode()) {
+ case MOVE:
+ int x = 0;
+ int y = 0;
+
+ if (action.getKey().getKeyType() == KeyType.ArrowUp)
+ x = -1;
+ if (action.getKey().getKeyType() == KeyType.ArrowDown)
+ x = 1;
+ if (action.getKey().getKeyType() == KeyType.ArrowLeft)
+ y = -1;
+ if (action.getKey().getKeyType() == KeyType.ArrowRight)
+ y = 1;
+
+ if (content != null) {
+ String err = content.move(x, y);
+ if (err != null)
+ setMessage(err, true);
+ }
+
+ break;
+ // mode with windows:
+ case CONTACT_LIST:
+ Card card = action.getCard();
+ if (card != null) {
+ pushContent(new ContactList(card));
+ }
+ break;
+ case CONTACT_DETAILS:
+ Contact contact = action.getContact();
+ if (contact != null) {
+ pushContent(new ContactDetails(contact));
+ }
+ break;
+ // mode interpreted by MainWindow:
+ case HELP:
+ // TODO
+ // setMessage("Help! I need somebody! Help!", false);
+ if (answer == null) {
+ setQuestion(key, "Test question?", false);
+ } else {
+ setMessage("You answered: " + answer, false);
+ }
+
+ handled = true;
+ break;
+ case BACK:
+ if (content != null) {
+ String warning = content.getExitWarning();
+ if (warning != null) {
+ if (answer == null) {
+ setQuestion(key, warning, true);
+ } else {
+ if (answer.equalsIgnoreCase("y")) {
+ popContent();
+ }
+ }
+ } else {
+ popContent();