2212 |
arthur |
1 |
package org.tela_botanica.del.client.composants.rss;
|
|
|
2 |
|
|
|
3 |
import org.tela_botanica.del.client.composants.presenteur.Presenteur;
|
|
|
4 |
import org.tela_botanica.del.client.config.Config;
|
|
|
5 |
import org.tela_botanica.del.client.modeles.InformationsRecherche;
|
|
|
6 |
import org.tela_botanica.del.client.modeles.Observation;
|
|
|
7 |
|
|
|
8 |
import com.google.gwt.user.client.Window;
|
|
|
9 |
import com.google.gwt.user.client.ui.HasWidgets;
|
|
|
10 |
import com.google.gwt.user.client.ui.IsWidget;
|
|
|
11 |
|
|
|
12 |
public class RssPresenteur extends Presenteur {
|
|
|
13 |
|
|
|
14 |
// Définition de la vue
|
|
|
15 |
public abstract interface Vue extends IsWidget {
|
|
|
16 |
void setLien(String lien);
|
|
|
17 |
void setLabelLien(String label);
|
|
|
18 |
}
|
|
|
19 |
|
|
|
20 |
// Variables
|
|
|
21 |
private Vue vue;
|
|
|
22 |
private String lien = "";
|
|
|
23 |
private Config config = new Config();
|
|
|
24 |
|
|
|
25 |
//Constructeur
|
|
|
26 |
public RssPresenteur(Vue vue) {
|
|
|
27 |
this.vue = vue;
|
|
|
28 |
}
|
|
|
29 |
|
|
|
30 |
public RssPresenteur(Vue vue, InformationsRecherche recherche, String label) {
|
|
|
31 |
this.vue = vue;
|
|
|
32 |
vue.setLabelLien(label);
|
|
|
33 |
genererLien(recherche);
|
|
|
34 |
}
|
|
|
35 |
|
|
|
36 |
public RssPresenteur(Vue vue, Observation observation, String label) {
|
|
|
37 |
this.vue = vue;
|
|
|
38 |
vue.setLabelLien(label);
|
|
|
39 |
genererLien(observation);
|
|
|
40 |
}
|
|
|
41 |
|
|
|
42 |
public void genererLien(InformationsRecherche recherche) {
|
|
|
43 |
this.lien = config.getUrl("rss") + recherche.versChaineRequete();
|
|
|
44 |
gererEvenements();
|
|
|
45 |
}
|
|
|
46 |
|
|
|
47 |
public void genererLien(Observation observation) {
|
|
|
48 |
String idObs = observation.getId();
|
|
|
49 |
this.lien = config.getUrl("rss") + "&masque.observation=" + idObs;
|
|
|
50 |
}
|
|
|
51 |
|
|
|
52 |
@Override
|
|
|
53 |
public void go(HasWidgets composite) {
|
|
|
54 |
composite.add(vue.asWidget());
|
|
|
55 |
gererEvenements();
|
|
|
56 |
}
|
|
|
57 |
|
|
|
58 |
@Override
|
|
|
59 |
protected void gererEvenements() {
|
|
|
60 |
vue.setLien(this.lien);
|
|
|
61 |
}
|
|
|
62 |
|
|
|
63 |
}
|