Line 3... |
Line 3... |
3 |
import org.tela_botanica.client.Mediateur;
|
3 |
import org.tela_botanica.client.Mediateur;
|
4 |
import org.tela_botanica.client.RegistreId;
|
4 |
import org.tela_botanica.client.RegistreId;
|
5 |
import org.tela_botanica.client.interfaces.ListePaginable;
|
5 |
import org.tela_botanica.client.interfaces.ListePaginable;
|
6 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
6 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
7 |
import org.tela_botanica.client.modeles.aDonneeListe;
|
7 |
import org.tela_botanica.client.modeles.aDonneeListe;
|
- |
|
8 |
import org.tela_botanica.client.util.Debug;
|
Line 8... |
Line 9... |
8 |
|
9 |
|
- |
|
10 |
import com.extjs.gxt.ui.client.Registry;
|
9 |
import com.extjs.gxt.ui.client.Registry;
|
11 |
import com.extjs.gxt.ui.client.util.Util;
|
10 |
import com.google.gwt.i18n.client.Dictionary;
|
12 |
import com.google.gwt.i18n.client.Dictionary;
|
11 |
import com.google.gwt.json.client.JSONArray;
|
13 |
import com.google.gwt.json.client.JSONArray;
|
12 |
import com.google.gwt.json.client.JSONNumber;
|
14 |
import com.google.gwt.json.client.JSONNumber;
|
Line 42... |
Line 44... |
42 |
super(ListeDeCommentaires.size());
|
44 |
super(ListeDeCommentaires.size());
|
43 |
initialiserCommentaireListe(ListeDeCommentaires);
|
45 |
initialiserCommentaireListe(ListeDeCommentaires);
|
44 |
}
|
46 |
}
|
Line 45... |
Line 47... |
45 |
|
47 |
|
46 |
public CommentaireListe(JSONArray ListeDeCommentaires, JSONNumber nbElements, Rafraichissable vueARafraichir) {
|
48 |
public CommentaireListe(JSONArray ListeDeCommentaires, JSONNumber nbElements, Rafraichissable vueARafraichir) {
|
47 |
super(ListeDeCommentaires.size());
|
49 |
super(ListeDeCommentaires.size());
|
48 |
this.nbElementsTotal = Integer.valueOf(nbElements.toString());
|
50 |
this.nbElementsTotal = Integer.valueOf(nbElements.toString());
|
49 |
this.vueARafraichir = vueARafraichir;
|
51 |
this.vueARafraichir = vueARafraichir;
|
50 |
initialiserCommentaireListe(ListeDeCommentaires);
|
52 |
initialiserCommentaireListe(ListeDeCommentaires);
|
Line 51... |
Line 53... |
51 |
}
|
53 |
}
|
52 |
|
54 |
|
53 |
private void initialiserCommentaireListe(JSONArray ListeDeCommentaires) {
|
55 |
private void initialiserCommentaireListe(JSONArray ListeDeCommentaires) {
|
- |
|
56 |
boolean chargerCollectionACommentaire = true;
|
54 |
boolean chargerCollectionACommentaire = true;
|
57 |
final int taillemax = ListeDeCommentaires.size();
|
55 |
final int taillemax = ListeDeCommentaires.size();
|
58 |
|
56 |
for (int i = 0; i < taillemax; i++) {
|
59 |
for (int i = 0; i < taillemax; i++) {
|
57 |
JSONObject commentaireCourant = ListeDeCommentaires.get(i).isObject() ;
|
60 |
JSONObject commentaireCourant = ListeDeCommentaires.get(i).isObject() ;
|
- |
|
61 |
if (commentaireCourant != null) {
|
- |
|
62 |
Commentaire commentaire = new Commentaire(commentaireCourant, chargerCollectionACommentaire);
|
- |
|
63 |
|
- |
|
64 |
if (!Util.isEmptyString(commentaire.getCollectionACommentaire().getId())) {
|
- |
|
65 |
this.put(commentaire.getCollectionACommentaire().getId(), commentaire);
|
58 |
if (commentaireCourant != null) {
|
66 |
}
|
- |
|
67 |
else {
|
59 |
Commentaire commentaire = new Commentaire(commentaireCourant, chargerCollectionACommentaire);
|
68 |
this.put(commentaire.getId(), commentaire);
|
60 |
this.put(commentaire.getId(), commentaire);
|
69 |
}
|
61 |
}
|
70 |
}
|
Line 62... |
Line 71... |
62 |
}
|
71 |
}
|
Line 102... |
Line 111... |
102 |
* donnés en fonction de la taille de page en cours
|
111 |
* donnés en fonction de la taille de page en cours
|
103 |
*
|
112 |
*
|
104 |
* @return le nombre de pages
|
113 |
* @return le nombre de pages
|
105 |
*/
|
114 |
*/
|
106 |
public int calculerNbPages() {
|
115 |
public int calculerNbPages() {
|
107 |
// À cause de la bétise de java pour les conversion implicite, on fait quelques conversions manuellement
|
116 |
// À cause de la bétise de java pour les conversions implicites, on fait quelques conversions manuellement
|
108 |
// pour eviter qu'il arrondisse mal la division nombre de pages = (nombre d'element / taille de la page)
|
117 |
// pour eviter qu'il arrondisse mal la division nombre de pages = (nombre d'element / taille de la page)
|
109 |
// arrondie à l'entier supérieur.
|
118 |
// arrondie à l'entier supérieur.
|
110 |
double nPage = (1.0 * nbElementsTotal) / (1.0 * nbElementsPage);
|
119 |
double nPage = (1.0 * nbElementsTotal) / (1.0 * nbElementsPage);
|
111 |
double nPageRound = Math.ceil(nPage);
|
120 |
double nPageRound = Math.ceil(nPage);
|
112 |
Double nPageInt = new Double(nPageRound);
|
121 |
Double nPageInt = new Double(nPageRound);
|
Line 115... |
Line 124... |
115 |
return nPageInt.intValue();
|
124 |
return nPageInt.intValue();
|
116 |
}
|
125 |
}
|
Line 117... |
Line 126... |
117 |
|
126 |
|
118 |
public void selectionnerCommentaire() {
|
127 |
public void selectionnerCommentaire() {
|
119 |
Mediateur mediateur = (Mediateur) Registry.get(RegistreId.MEDIATEUR);
|
128 |
Mediateur mediateur = (Mediateur) Registry.get(RegistreId.MEDIATEUR);
|
120 |
mediateur.selectionnerCommentaire(vueARafraichir, null, null, currentPage, nbElementsPage);
|
129 |
mediateur.selectionnerCommentaire(vueARafraichir, null, null, currentPage, nbElementsPage);
|
Line 121... |
Line 130... |
121 |
}
|
130 |
}
|
122 |
|
131 |
|
123 |
public void filtrerParNom(String nom) {
|
132 |
public void filtrerParNom(String nom) {
|