01: /*
02: * MyGWT Widget Library
03: * Copyright(c) 2007, MyGWT.
04: * licensing@mygwt.net
05: *
06: * http://mygwt.net/license
07: */
08: package net.mygwt.samples.mail.client;
09:
10: import net.mygwt.ui.client.mvc.AppEvent;
11: import net.mygwt.ui.client.mvc.Controller;
12:
13: public class MailController extends Controller {
14:
15: private MailFolderView folderView;
16: private MailListView listView;
17: private MailItemView itemView;
18:
19: public MailController() {
20: registerEventType(AppEvents.NavMail);
21: registerEventType(AppEvents.ViewMailItems);
22: registerEventType(AppEvents.ViewMailItem);
23: }
24:
25: public void handleEvent(AppEvent event) {
26: switch (event.type) {
27: case AppEvents.NavMail:
28: forwardToView(folderView, event);
29: break;
30: case AppEvents.ViewMailItems:
31: forwardToView(listView, event);
32: break;
33: case AppEvents.ViewMailItem:
34: forwardToView(itemView, event);
35: break;
36: }
37: }
38:
39: public void initialize() {
40: folderView = new MailFolderView(this );
41: listView = new MailListView(this );
42: itemView = new MailItemView(this);
43: }
44:
45: }
|