51 |
jpm |
1 |
package org.tela_botanica.client.controleurs;
|
|
|
2 |
|
|
|
3 |
import java.util.List;
|
|
|
4 |
|
|
|
5 |
import org.tela_botanica.client.AppEvenements;
|
|
|
6 |
import org.tela_botanica.client.vues.InstitutionMenuVue;
|
|
|
7 |
import org.tela_botanica.client.vues.InstitutionVue;
|
|
|
8 |
|
|
|
9 |
import com.extjs.gxt.ui.client.Registry;
|
|
|
10 |
import com.extjs.gxt.ui.client.mvc.AppEvent;
|
|
|
11 |
import com.extjs.gxt.ui.client.mvc.Controller;
|
|
|
12 |
import com.extjs.gxt.ui.client.mvc.Dispatcher;
|
|
|
13 |
import com.google.gwt.user.client.rpc.AsyncCallback;
|
|
|
14 |
|
|
|
15 |
public class InstitutionControleur extends Controller {
|
|
|
16 |
|
|
|
17 |
//private MailServiceAsync service;
|
|
|
18 |
private InstitutionMenuVue institutionMenuVue;
|
|
|
19 |
private InstitutionVue institutionVue;
|
|
|
20 |
|
|
|
21 |
public InstitutionControleur() {
|
|
|
22 |
registerEventTypes(AppEvenements.Init);
|
|
|
23 |
registerEventTypes(AppEvenements.NavInstitution);
|
|
|
24 |
registerEventTypes(AppEvenements.VoirInstitutionListe);
|
|
|
25 |
registerEventTypes(AppEvenements.VoirInstitutionDetail);
|
|
|
26 |
}
|
|
|
27 |
|
|
|
28 |
@Override
|
|
|
29 |
public void handleEvent(AppEvent event) {
|
|
|
30 |
switch (event.type) {
|
|
|
31 |
case AppEvenements.Init:
|
|
|
32 |
forwardToView(institutionMenuVue, event);
|
|
|
33 |
break;
|
|
|
34 |
case AppEvenements.NavInstitution:
|
|
|
35 |
forwardToView(institutionMenuVue, event);
|
|
|
36 |
forwardToView(institutionVue, event);
|
|
|
37 |
break;
|
|
|
38 |
case AppEvenements.VoirInstitutionListe:
|
|
|
39 |
//onViewMailItems(event);
|
|
|
40 |
break;
|
|
|
41 |
case AppEvenements.VoirInstitutionDetail:
|
|
|
42 |
forwardToView(institutionVue, event);
|
|
|
43 |
break;
|
|
|
44 |
}
|
|
|
45 |
}
|
|
|
46 |
/*
|
|
|
47 |
private void onViewMailItems(final AppEvent<Folder> event) {
|
|
|
48 |
final Folder f = event.data;
|
|
|
49 |
if (f != null) {
|
|
|
50 |
service.getMailItems(f, new AsyncCallback<List<MailItem>>() {
|
|
|
51 |
|
|
|
52 |
public void onSuccess(List<MailItem> result) {
|
|
|
53 |
AppEvent ae = new AppEvent(event.type, result);
|
|
|
54 |
ae.setData("folder", f);
|
|
|
55 |
forwardToView(institutionVue, ae);
|
|
|
56 |
}
|
|
|
57 |
|
|
|
58 |
public void onFailure(Throwable caught) {
|
|
|
59 |
Dispatcher.forwardEvent(AppEvenements.Error, caught);
|
|
|
60 |
}
|
|
|
61 |
|
|
|
62 |
});
|
|
|
63 |
}
|
|
|
64 |
}*/
|
|
|
65 |
|
|
|
66 |
public void initialize() {
|
|
|
67 |
//service = (MailServiceAsync) Registry.get(Mail.SERVICE);
|
|
|
68 |
|
|
|
69 |
institutionMenuVue = new InstitutionMenuVue(this);
|
|
|
70 |
institutionVue = new InstitutionVue(this);
|
|
|
71 |
}
|
|
|
72 |
}
|