Line 9... |
Line 9... |
9 |
import org.tela_botanica.del.client.services.rest.ProtocoleService;
|
9 |
import org.tela_botanica.del.client.services.rest.ProtocoleService;
|
10 |
import org.tela_botanica.del.client.services.rest.ProtocoleServiceConcret;
|
10 |
import org.tela_botanica.del.client.services.rest.ProtocoleServiceConcret;
|
11 |
import org.tela_botanica.del.client.services.rest.async.ProtocolesCallback;
|
11 |
import org.tela_botanica.del.client.services.rest.async.ProtocolesCallback;
|
12 |
import org.tela_botanica.del.client.vues.rechercheimages.resultats.ResultatRechercheImagePresenteur;
|
12 |
import org.tela_botanica.del.client.vues.rechercheimages.resultats.ResultatRechercheImagePresenteur;
|
13 |
import org.tela_botanica.del.client.vues.rechercheimages.resultats.ResultatRechercheImageVue;
|
13 |
import org.tela_botanica.del.client.vues.rechercheimages.resultats.ResultatRechercheImageVue;
|
- |
|
14 |
|
14 |
import com.google.gwt.user.client.ui.HasWidgets;
|
15 |
import com.google.gwt.user.client.ui.HasWidgets;
|
15 |
import com.google.gwt.user.client.ui.IsWidget;
|
16 |
import com.google.gwt.user.client.ui.IsWidget;
|
Line 16... |
Line 17... |
16 |
|
17 |
|
Line 17... |
Line 18... |
17 |
public class MoteurRechercheImagePresenteur {
|
18 |
public class MoteurRechercheImagePresenteur {
|
18 |
|
19 |
|
- |
|
20 |
public interface Vue extends IsWidget {
|
19 |
public interface Vue extends IsWidget {
|
21 |
public HasWidgets getZoneResultats();
|
- |
|
22 |
|
20 |
public HasWidgets getZoneResultats();
|
23 |
public HasWidgets getZoneRecherche();
|
21 |
public HasWidgets getZoneRecherche();
|
24 |
|
Line 22... |
Line 25... |
22 |
public void ajouterVue(HasWidgets composite);
|
25 |
public void ajouterVue(HasWidgets composite);
|
23 |
}
|
26 |
}
|
24 |
|
27 |
|
25 |
private Vue vue;
|
28 |
private Vue vue;
|
26 |
private final ProtocoleService protocoleService = new ProtocoleServiceConcret();
|
29 |
private final ProtocoleService protocoleService = new ProtocoleServiceConcret();
|
27 |
|
30 |
|
28 |
/**
|
31 |
/**
|
29 |
* Constructeur
|
32 |
* Constructeur
|
30 |
* */
|
33 |
* */
|
31 |
public MoteurRechercheImagePresenteur(Vue vue) {
|
34 |
public MoteurRechercheImagePresenteur(Vue vue) {
|
32 |
this.vue = vue;
|
35 |
this.vue = vue;
|
33 |
//TODO: le code ci dessous sert à ne pas recharger les protocoles
|
36 |
// TODO: le code ci dessous sert à ne pas recharger les protocoles
|
34 |
// à chaque fois, voir si on peut le factoriser quelque part
|
37 |
// à chaque fois, voir si on peut le factoriser quelque part
|
- |
|
38 |
if (CacheClient.getInstance().getProtocoleCourant() == null) {
|
35 |
if (CacheClient.getInstance().getProtocoleCourant() == null) {
|
39 |
if (CacheClient.getInstance().getListeProtocoles() == null) {
|
36 |
if(CacheClient.getInstance().getListeProtocoles() == null) {
|
40 |
protocoleService.getProtocoles(new ProtocolesCallback() {
|
37 |
protocoleService.getProtocoles(new ProtocolesCallback() {
|
41 |
|
38 |
@Override
|
42 |
@Override
|
39 |
public void surProtocolesRecus(ProtocoleServiceResultat protocolesRecus) {
|
43 |
public void surRetour(ProtocoleServiceResultat protocolesRecus) {
|
40 |
CacheClient.getInstance().setListeProtocoles(protocolesRecus.getProtocoles());
|
44 |
CacheClient.getInstance().setListeProtocoles(protocolesRecus.getProtocoles());
|
41 |
if(protocolesRecus.getProtocoles().size() > 0) {
|
45 |
if (protocolesRecus.getProtocoles().size() > 0) {
|
- |
|
46 |
CacheClient.getInstance().setProtocoleCourant(protocolesRecus.getProtocoles().get(0));
|
42 |
CacheClient.getInstance().setProtocoleCourant(protocolesRecus.getProtocoles().get(0));
|
47 |
} else {
|
43 |
} else {
|
48 |
// TODO afficher message indiquant que la liste des
|
44 |
//TODO afficher message indiquant que la liste des protocoles de votes n'est pas fourni
|
49 |
// protocoles de votes n'est pas fourni
|
45 |
}
|
50 |
}
|
46 |
}
|
51 |
}
|
Line 53... |
Line 58... |
53 |
|
58 |
|
54 |
public void go(HasWidgets composite) {
|
59 |
public void go(HasWidgets composite) {
|
55 |
vue.ajouterVue(composite);
|
60 |
vue.ajouterVue(composite);
|
56 |
chargerMoteurRechercheAvancee();
|
61 |
chargerMoteurRechercheAvancee();
|
57 |
}
|
62 |
}
|
58 |
|
63 |
|
59 |
public void chargerMoteurRechercheAvancee() {
|
64 |
public void chargerMoteurRechercheAvancee() {
|
60 |
MoteurRecherchePresenteur presenteurRecherche = new MoteurRecherchePresenteur(new MoteurRechercheVue(""), ModeRecherche.MODE_IMAGE) {
|
65 |
MoteurRecherchePresenteur presenteurRecherche = new MoteurRecherchePresenteur(new MoteurRechercheVue(""), ModeRecherche.MODE_IMAGE) {
|
61 |
public void lancerRecherche() {
|
66 |
public void lancerRecherche() {
|
62 |
chercherImages();
|
67 |
chercherImages();
|