/branches/v1.0-syrah/src/org/tela_botanica/client/modeles/commentaire/CommentaireAsyncDao.java |
---|
9,6 → 9,7 |
import org.tela_botanica.client.interfaces.Rafraichissable; |
import org.tela_botanica.client.modeles.Information; |
import org.tela_botanica.client.modeles.structure.StructureListe; |
import org.tela_botanica.client.util.Debug; |
import org.tela_botanica.client.util.UtilDAO; |
import com.extjs.gxt.ui.client.Registry; |
37,6 → 38,8 |
restrictions.put("limit", String.valueOf(nbElements)); |
} |
restrictions.put("orderby", "ccac_id_collection DESC"); |
final JsonRestRequestBuilder rb = UtilDAO.construireRequete(SERVICE_NOM, parametres, restrictions); |
rb.envoyerRequete(null, new JsonRestRequestCallback() { |
@Override |
44,6 → 47,7 |
if (responseValue != null) { |
// Si la requête est un succès, réception d'un objet ou d'un tableau |
JSONArray responseArray = responseValue.isArray(); |
if (responseArray.get(1).isObject() != null) { |
final JSONObject reponse = responseArray.get(1).isObject(); |
// Transformation du tableau JSON réponse en ListeInstitution |
/branches/v1.0-syrah/src/org/tela_botanica/client/modeles/commentaire/Commentaire.java |
---|
4,6 → 4,7 |
import org.tela_botanica.client.modeles.aDonnee; |
import org.tela_botanica.client.modeles.collection.Collection; |
import org.tela_botanica.client.modeles.collection.CollectionACommentaire; |
import org.tela_botanica.client.util.Debug; |
import com.google.gwt.json.client.JSONObject; |
28,7 → 29,9 |
public void initialiserCommentaire(JSONObject commentaire, boolean chargerCollectionACommentaire) { |
initialiserModele(commentaire); |
collection = new Collection(commentaire); |
if (chargerCollectionACommentaire) { |
collectionACommentaire = new CollectionACommentaire(commentaire); |
} else { |
/branches/v1.0-syrah/src/org/tela_botanica/client/modeles/commentaire/CommentaireListe.java |
---|
5,8 → 5,10 |
import org.tela_botanica.client.interfaces.ListePaginable; |
import org.tela_botanica.client.interfaces.Rafraichissable; |
import org.tela_botanica.client.modeles.aDonneeListe; |
import org.tela_botanica.client.util.Debug; |
import com.extjs.gxt.ui.client.Registry; |
import com.extjs.gxt.ui.client.util.Util; |
import com.google.gwt.i18n.client.Dictionary; |
import com.google.gwt.json.client.JSONArray; |
import com.google.gwt.json.client.JSONNumber; |
53,14 → 55,21 |
private void initialiserCommentaireListe(JSONArray ListeDeCommentaires) { |
boolean chargerCollectionACommentaire = true; |
final int taillemax = ListeDeCommentaires.size(); |
for (int i = 0; i < taillemax; i++) { |
JSONObject commentaireCourant = ListeDeCommentaires.get(i).isObject() ; |
if (commentaireCourant != null) { |
Commentaire commentaire = new Commentaire(commentaireCourant, chargerCollectionACommentaire); |
if (!Util.isEmptyString(commentaire.getCollectionACommentaire().getId())) { |
this.put(commentaire.getCollectionACommentaire().getId(), commentaire); |
} |
else { |
this.put(commentaire.getId(), commentaire); |
} |
} |
} |
} |
public void changerNumeroPage(int pageCourante) { |
currentPage = pageCourante; |
104,7 → 113,7 |
* @return le nombre de pages |
*/ |
public int calculerNbPages() { |
// À cause de la bétise de java pour les conversion implicite, on fait quelques conversions manuellement |
// À cause de la bétise de java pour les conversions implicites, on fait quelques conversions manuellement |
// pour eviter qu'il arrondisse mal la division nombre de pages = (nombre d'element / taille de la page) |
// arrondie à l'entier supérieur. |
double nPage = (1.0 * nbElementsTotal) / (1.0 * nbElementsPage); |