Subversion Repositories eFlore/Applications.coel

Compare Revisions

Ignore whitespace Rev 1166 → Rev 1150

/branches/v1.0-syrah/src/org/tela_botanica/client/modeles/collection/CollectionListe.java
5,6 → 5,7
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.modeles.structure.Structure;
 
import com.extjs.gxt.ui.client.Registry;
import com.google.gwt.i18n.client.Dictionary;
13,12 → 14,13
import com.google.gwt.json.client.JSONObject;
 
/**
* Classe contenant les informations sur les Collections renvoyées par un objet de type DAO.
* Table de hachage composée d'informations sur les Structures, renvoyé par un objet de type DAO
* La clé est le nom de l'entite + le nom de l'entite parente
*
* @author Jean-Pascal MILCENT
* @author david delon
*
*/
public class CollectionListe extends aDonneeListe<Collection> implements ListePaginable {
public class CollectionListe extends aDonneeListe<Collection> implements ListePaginable{
private static final long serialVersionUID = 8024454926649039456L;
private int currentPage = 0;
34,31 → 36,45
super(taille);
}
public CollectionListe(JSONArray ListeDeCollections) {
super(ListeDeCollections.size());
initialiserCollectionListe(ListeDeCollections);
}
public CollectionListe(JSONArray ListeDeCollections, JSONNumber nbElements, Rafraichissable vueARafraichir) {
super(ListeDeCollections.size());
this.nbElementsTotal = Integer.valueOf(nbElements.toString());
this.vueARafraichir = vueARafraichir;
initialiserCollectionListe(ListeDeCollections);
}
private void initialiserCollectionListe(JSONArray collections) {
final int taillemax = collections.size();
/**
* Constructeur pour une liste d'institutions
* @param dates
*/
public CollectionListe(JSONArray structures) {
super(structures.size()) ;
final int taillemax = structures.size();
for (int i = 0; i < taillemax; i++) {
JSONObject collectionCourante = collections.get(i).isObject() ;
JSONObject collectionCourante = structures.get(i).isObject() ;
if (collectionCourante != null) {
Collection collection = new Collection(collectionCourante);
CollectionBotanique botanique = new CollectionBotanique(collectionCourante);
collection.setBotanique(botanique);
this.put(collection.getId(), collection);
}
}
}
public CollectionListe(JSONArray collectionListe, JSONNumber nbElements, Rafraichissable vueARafraichir) {
super(collectionListe.size());
this.nbElementsTotal = Integer.valueOf(nbElements.toString());
final int taillemax = collectionListe.size();
for (int i = 0; i < taillemax; i++) {
JSONObject collection = collectionListe.get(i).isObject() ;
if (collection != null) {
Collection collectionCourante = new Collection(collection);
this.put(collectionCourante.getId(), collectionCourante);
}
}
this.vueARafraichir = vueARafraichir;
}
 
 
public void changerNumeroPage(int pageCourante) {
currentPage = pageCourante;
selectionnerCollection();
83,14 → 99,19
public int[] getPageTable() {
int[] page = new int[4];
// Nombre de pages au total
 
// nombre de pages au total
page[0] = calculerNbPages();
 
// Page En Cours
page[1] = currentPage;
 
// nbElementsParPage
page[2] = nbElementsPage;
 
// et le dernier le nombre total d'éléments
page[3] = nbElementsTotal;
 
return page;
}
101,14 → 122,17
* @return le nombre de pages
*/
public int calculerNbPages() {
// À cause de la bétise de java pour les conversion implicite, 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.
// A cause de la betise de java pour les conversion implicite 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 superieur
 
double nPage = (1.0 * nbElementsTotal) / (1.0 * nbElementsPage);
double nPageRound = Math.ceil(nPage);
Double nPageInt = new Double(nPageRound);
 
// Convertion en entier
// on convertit en entier
return nPageInt.intValue();
}
120,5 → 144,7
public void filtrerParNom(String nom) {
Mediateur mediateur =(Mediateur) Registry.get(RegistreId.MEDIATEUR);
mediateur.selectionnerCollection(vueARafraichir, null, "%" + nom + "%", 0, nbElementsPage);
}
}
/branches/v1.0-syrah/src/org/tela_botanica/client/modeles/structure/StructureListe.java
5,6 → 5,7
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.modeles.personne.Personne;
 
import com.extjs.gxt.ui.client.Registry;
import com.google.gwt.i18n.client.Dictionary;
13,12 → 14,13
import com.google.gwt.json.client.JSONObject;
 
/**
* Classe contenant les informations sur les Structures renvoyées par un objet de type DAO.
* Table de hachage composée d'informations sur les Structures, renvoyé par un objet de type DAO
* La clé est le nom de l'entite + le nom de l'entite parente
*
* @author Jean-Pascal MILCENT
* @author david delon
*
*/
public class StructureListe extends aDonneeListe<Structure> implements ListePaginable {
public class StructureListe extends aDonneeListe<Structure> implements ListePaginable{
private static final long serialVersionUID = 7384579567038300856L;
private int currentPage = 0;
34,22 → 36,17
super(taille);
}
public StructureListe(JSONArray ListeDeStructures) {
super(ListeDeStructures.size()) ;
initialiserStructureListe(ListeDeStructures);
}
public StructureListe(JSONArray ListeDeStructures, JSONNumber nbElements, Rafraichissable vueARafraichir) {
super(ListeDeStructures.size());
this.nbElementsTotal = Integer.valueOf(nbElements.toString());
this.vueARafraichir = vueARafraichir;
initialiserStructureListe(ListeDeStructures);
}
private void initialiserStructureListe(JSONArray ListeDeStructures) {
final int taillemax = ListeDeStructures.size();
/**
* Constructeur pour une liste d'institutions
* @param dates
*/
public StructureListe(JSONArray structures) {
super(structures.size()) ;
final int taillemax = structures.size();
for (int i = 0; i < taillemax; i++) {
JSONObject structureCourante = ListeDeStructures.get(i).isObject();
JSONObject structureCourante = structures.get(i).isObject() ;
if (structureCourante != null) {
Structure structure = new Structure(structureCourante);
StructureValorisation valorisation = new StructureValorisation(structureCourante);
61,6 → 58,23
}
}
public StructureListe(JSONArray structureListe, JSONNumber nbElements, Rafraichissable vueARafraichir) {
super(structureListe.size());
this.nbElementsTotal = Integer.valueOf(nbElements.toString());
final int taillemax = structureListe.size();
for (int i = 0; i < taillemax; i++) {
JSONObject structure = structureListe.get(i).isObject() ;
if (structure != null) {
Structure structureCourante = new Structure(structure);
this.put(structureCourante.getId(), structureCourante);
}
}
this.vueARafraichir = vueARafraichir;
}
 
public void changerNumeroPage(int pageCourante) {
currentPage = pageCourante;
selectionnerStructure();
85,14 → 99,19
public int[] getPageTable() {
int[] page = new int[4];
// Nombre de pages au total
 
// nombre de pages au total
page[0] = calculerNbPages();
 
// Page En Cours
page[1] = currentPage;
 
// nbElementsParPage
page[2] = nbElementsPage;
 
// et le dernier le nombre total d'éléments
page[3] = nbElementsTotal;
 
return page;
}
103,24 → 122,27
* @return le nombre de pages
*/
public int calculerNbPages() {
// À cause de la bétise de java pour les conversion implicite, 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.
// A cause de la betise de java pour les conversion implicite 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 superieur
 
double nPage = (1.0 * nbElementsTotal) / (1.0 * nbElementsPage);
double nPageRound = Math.ceil(nPage);
Double nPageInt = new Double(nPageRound);
 
// Convertion en entier
// on convertit en entier
return nPageInt.intValue();
}
public void selectionnerStructure() {
Mediateur mediateur = (Mediateur) Registry.get(RegistreId.MEDIATEUR);
Mediateur mediateur =(Mediateur) Registry.get(RegistreId.MEDIATEUR);
mediateur.selectionnerStructure(vueARafraichir, null, null, null, currentPage, nbElementsPage);
}
public void filtrerParNom(String nom) {
Mediateur mediateur = (Mediateur) Registry.get(RegistreId.MEDIATEUR);
Mediateur mediateur =(Mediateur) Registry.get(RegistreId.MEDIATEUR);
mediateur.selectionnerStructure(vueARafraichir, null, null, "%" + nom + "%", 0, nbElementsPage);
}
/branches/v1.0-syrah/src/org/tela_botanica/client/modeles/projet/ProjetListe.java
5,6 → 5,7
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.modeles.structure.Structure;
 
import com.extjs.gxt.ui.client.Registry;
import com.google.gwt.i18n.client.Dictionary;
13,7 → 14,8
import com.google.gwt.json.client.JSONObject;
 
/**
* Classe contenant les informations sur les Structures renvoyées par un objet de type DAO.
* Table de hachage composée d'informations sur les Valeurs des listes, renvoyé par un objet de type DAO
* La clé est l'id de l'entite.
*
* @author Grégoire DUCHÉ
*
25,7 → 27,9
private int nbElementsPage = Integer.valueOf(((Dictionary) Dictionary.getDictionary("configuration")).get("nbElementsPage"));
private int nbElementsTotal;
private Rafraichissable vueARafraichir;
 
/**
* Constructeur sans paramètres
*/
public ProjetListe() {
super();
}
42,22 → 46,13
* Constructeur pour une liste de projets
* @param dates
*/
public ProjetListe(JSONArray ListeDeProjets) {
super(ListeDeProjets.size());
initialiserProjetListe(ListeDeProjets);
}
public ProjetListe(JSONArray ListeDeProjets, JSONNumber nbElements, Rafraichissable vueARafraichir) {
super(ListeDeProjets.size());
this.nbElementsTotal = Integer.valueOf(nbElements.toString());
this.vueARafraichir = vueARafraichir;
initialiserProjetListe(ListeDeProjets);
}
private void initialiserProjetListe(JSONArray ListeDeProjets) {
final int taillemax = ListeDeProjets.size();
public ProjetListe(JSONArray projetsListe) {
super(projetsListe.size());
final int taillemax = projetsListe.size();
for (int i = 0; i < taillemax; i++) {
JSONObject projetCourant = ListeDeProjets.get(i).isObject();
JSONObject projetCourant = projetsListe.get(i).isObject() ;
if (projetCourant != null) {
Projet projet = new Projet(projetCourant);
this.put(projet.getId(), projet);
65,6 → 60,23
}
}
public ProjetListe(JSONArray projetListe, JSONNumber nbElements, Rafraichissable vueARafraichir) {
super(projetListe.size());
this.nbElementsTotal = Integer.valueOf(nbElements.toString());
final int taillemax = projetListe.size();
for (int i = 0; i < taillemax; i++) {
JSONObject projet = projetListe.get(i).isObject() ;
if (projet != null) {
Projet projetCourant = new Projet(projet);
this.put(projetCourant.getId(), projetCourant);
}
}
this.vueARafraichir = vueARafraichir;
}
public void changerNumeroPage(int pageCourante) {
currentPage = pageCourante;
selectionnerStructure();
89,14 → 101,19
public int[] getPageTable() {
int[] page = new int[4];
 
// nombre de pages au total
page[0] = calculerNbPages();
 
// Page En Cours
page[1] = currentPage;
 
// nbElementsParPage
page[2] = nbElementsPage;
 
// et le dernier le nombre total d'éléments
page[3] = nbElementsTotal;
 
return page;
}
107,24 → 124,28
* @return le nombre de pages
*/
public int calculerNbPages() {
// À cause de la bétise de java pour les conversion implicite, 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.
// A cause de la betise de java pour les conversion implicite 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 superieur
 
double nPage = (1.0 * nbElementsTotal) / (1.0 * nbElementsPage);
double nPageRound = Math.ceil(nPage);
Double nPageInt = new Double(nPageRound);
 
// Convertion en entier
// on convertit en entier
return nPageInt.intValue();
}
public void selectionnerStructure() {
Mediateur mediateur = (Mediateur) Registry.get(RegistreId.MEDIATEUR);
Mediateur mediateur =(Mediateur) Registry.get(RegistreId.MEDIATEUR);
mediateur.selectionnerProjet(vueARafraichir, null, null, currentPage, nbElementsPage);
}
public void filtrerParNom(String nom) {
Mediateur mediateur = (Mediateur) Registry.get(RegistreId.MEDIATEUR);
Mediateur mediateur =(Mediateur) Registry.get(RegistreId.MEDIATEUR);
mediateur.selectionnerProjet(vueARafraichir, null, "%" + nom + "%", 0, nbElementsPage);
}
}
/branches/v1.0-syrah/src/org/tela_botanica/client/modeles/commentaire/CommentaireListe.java
5,6 → 5,7
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.modeles.structure.Structure;
 
import com.extjs.gxt.ui.client.Registry;
import com.google.gwt.i18n.client.Dictionary;
12,12 → 13,6
import com.google.gwt.json.client.JSONNumber;
import com.google.gwt.json.client.JSONObject;
 
/**
* Classe contenant les informations sur les Commentaires renvoyées par un objet de type DAO.
*
* @author Jean-Pascal MILCENT
*
*/
public class CommentaireListe extends aDonneeListe<Commentaire> implements ListePaginable {
 
private static final long serialVersionUID = 2600314321196345072L;
38,28 → 33,36
* Constructeur pour une liste de commentaires
* @param dates
*/
public CommentaireListe(JSONArray ListeDeCommentaires) {
super(ListeDeCommentaires.size());
initialiserCommentaireListe(ListeDeCommentaires);
public CommentaireListe(JSONArray commentaires) {
super(commentaires.size());
boolean chargerCollectionACommentaire = true;
int taille = commentaires.size();
for (int i = 0; i < taille; i++) {
JSONObject commentaireCourant = commentaires.get(i).isObject() ;
if (commentaireCourant != null) {
Commentaire commentaire = new Commentaire(commentaireCourant, chargerCollectionACommentaire);
this.put(commentaire.getId(), commentaire);
}
}
}
public CommentaireListe(JSONArray ListeDeCommentaires, JSONNumber nbElements, Rafraichissable vueARafraichir) {
super(ListeDeCommentaires.size());
public CommentaireListe(JSONArray commentaireListe, JSONNumber nbElements, Rafraichissable vueARafraichir) {
super(commentaireListe.size());
this.nbElementsTotal = Integer.valueOf(nbElements.toString());
this.vueARafraichir = vueARafraichir;
initialiserCommentaireListe(ListeDeCommentaires);
}
private void initialiserCommentaireListe(JSONArray ListeDeCommentaires) {
boolean chargerCollectionACommentaire = true;
final int taillemax = ListeDeCommentaires.size();
final int taillemax = commentaireListe.size();
for (int i = 0; i < taillemax; i++) {
JSONObject commentaireCourant = ListeDeCommentaires.get(i).isObject() ;
if (commentaireCourant != null) {
Commentaire commentaire = new Commentaire(commentaireCourant, chargerCollectionACommentaire);
this.put(commentaire.getId(), commentaire);
JSONObject commentaire = commentaireListe.get(i).isObject() ;
if (commentaire != null) {
Commentaire commentaireCourant = new Commentaire(commentaire);
this.put(commentaireCourant.getId(), commentaireCourant);
}
}
this.vueARafraichir = vueARafraichir;
}
public void changerNumeroPage(int pageCourante) {
86,14 → 89,19
public int[] getPageTable() {
int[] page = new int[4];
 
// nombre de pages au total
page[0] = calculerNbPages();
 
// Page En Cours
page[1] = currentPage;
 
// nbElementsParPage
page[2] = nbElementsPage;
 
// et le dernier le nombre total d'éléments
page[3] = nbElementsTotal;
 
return page;
}
104,24 → 112,30
* @return le nombre de pages
*/
public int calculerNbPages() {
// À cause de la bétise de java pour les conversion implicite, 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.
// A cause de la betise de java pour les conversion implicite 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 superieur
 
double nPage = (1.0 * nbElementsTotal) / (1.0 * nbElementsPage);
double nPageRound = Math.ceil(nPage);
Double nPageInt = new Double(nPageRound);
 
// Convertion en entier
// on convertit en entier
return nPageInt.intValue();
}
public void selectionnerCommentaire() {
Mediateur mediateur = (Mediateur) Registry.get(RegistreId.MEDIATEUR);
Mediateur mediateur =(Mediateur) Registry.get(RegistreId.MEDIATEUR);
mediateur.selectionnerCommentaire(vueARafraichir, null, null, currentPage, nbElementsPage);
}
public void filtrerParNom(String nom) {
Mediateur mediateur = (Mediateur) Registry.get(RegistreId.MEDIATEUR);
Mediateur mediateur =(Mediateur) Registry.get(RegistreId.MEDIATEUR);
mediateur.selectionnerCommentaireParTitre(vueARafraichir, "%" + nom + "%");
}
}
 
}
/branches/v1.0-syrah/src/org/tela_botanica/client/modeles/publication/PublicationListe.java
6,6 → 6,7
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.modeles.structure.Structure;
 
import com.extjs.gxt.ui.client.Registry;
import com.google.gwt.json.client.JSONArray;
12,12 → 13,6
import com.google.gwt.json.client.JSONNumber;
import com.google.gwt.json.client.JSONObject;
 
/**
* Classe contenant les informations sur les Publications renvoyées par un objet de type DAO.
*
* @author Aurélien PERONNET
*
*/
public class PublicationListe extends aDonneeListe<Publication> implements ListePaginable {
 
private static final long serialVersionUID = 2600314321196345072L;
34,22 → 29,17
super(taille);
}
public PublicationListe(JSONArray ListeDePublications) {
super(ListeDePublications.size());
initialiserPublicationListe(ListeDePublications);
}
public PublicationListe(JSONArray ListeDePublications, JSONNumber nbElements, Rafraichissable vueARafraichir) {
super(ListeDePublications.size());
this.nbElementsTotal = Integer.valueOf(nbElements.toString());
this.vueARafraichir = vueARafraichir;
initialiserPublicationListe(ListeDePublications);
}
/**
* Constructeur pour une liste d'institutions
* @param dates
*/
public PublicationListe(JSONArray publications) {
 
private void initialiserPublicationListe(JSONArray ListeDePublications) {
int taille = ListeDePublications.size();
super(publications.size());
int taille = publications.size();
for (int i = 0; i < taille; i++) {
JSONObject publicationCourante = ListeDePublications.get(i).isObject() ;
JSONObject publicationCourante = publications.get(i).isObject() ;
if (publicationCourante != null) {
Publication publication = new Publication(publicationCourante);
58,6 → 48,23
}
}
public PublicationListe(JSONArray publicationListe, JSONNumber nbElements, Rafraichissable vueARafraichir) {
super(publicationListe.size());
this.nbElementsTotal = Integer.valueOf(nbElements.toString());
final int taillemax = publicationListe.size();
for (int i = 0; i < taillemax; i++) {
JSONObject publication = publicationListe.get(i).isObject() ;
if (publication != null) {
Publication publicationCourante = new Publication(publication);
this.put(publicationCourante.getId(), publicationCourante);
}
}
this.vueARafraichir = vueARafraichir;
}
public void changerNumeroPage(int pageCourante) {
currentPage = pageCourante;
selectionnerPublication();
82,14 → 89,19
public int[] getPageTable() {
int[] page = new int[4];
 
// nombre de pages au total
page[0] = calculerNbPages();
 
// Page En Cours
page[1] = currentPage;
 
// nbElementsParPage
page[2] = nbElementsPage;
 
// et le dernier le nombre total d'éléments
page[3] = nbElementsTotal;
 
return page;
}
100,24 → 112,27
* @return le nombre de pages
*/
public int calculerNbPages() {
// À cause de la bétise de java pour les conversion implicite, 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.
// A cause de la betise de java pour les conversion implicite 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 superieur
 
double nPage = (1.0 * nbElementsTotal) / (1.0 * nbElementsPage);
double nPageRound = Math.ceil(nPage);
Double nPageInt = new Double(nPageRound);
 
// Convertion en entier
// on convertit en entier
return nPageInt.intValue();
}
public void selectionnerPublication() {
Mediateur mediateur = (Mediateur) Registry.get(RegistreId.MEDIATEUR);
Mediateur mediateur =(Mediateur) Registry.get(RegistreId.MEDIATEUR);
mediateur.selectionnerPublication(vueARafraichir, null, null, null, currentPage, nbElementsPage);
}
public void filtrerParNom(String nom) {
Mediateur mediateur = (Mediateur) Registry.get(RegistreId.MEDIATEUR);
Mediateur mediateur =(Mediateur) Registry.get(RegistreId.MEDIATEUR);
mediateur.selectionnerPublicationParNomComplet(vueARafraichir, null, "%" + nom + "%");
}
}
}
/branches/v1.0-syrah/src/org/tela_botanica/client/modeles/personne/PersonneListe.java
13,16 → 13,20
import com.google.gwt.json.client.JSONObject;
 
/**
* Classe contenant les informations sur les Personnes renvoyées par un objet de type DAO.
* Table de hachage composée d'informations sur les Valeurs des listes, renvoyé
* par un objet de type DAO La clé est le nom de l'entite + le nom de l'entite
* parente
*
* @author Grégoire DUCHÉ
* @author david delon
*
*/
public class PersonneListe extends aDonneeListe<Personne> implements ListePaginable {
public class PersonneListe extends aDonneeListe<Personne> implements
ListePaginable {
 
private static final long serialVersionUID = 2930530504922300155L;
private int currentPage = 0;
private int nbElementsPage = Integer.valueOf(((Dictionary) Dictionary.getDictionary("configuration")).get("nbElementsPage"));
private int nbElementsPage = Integer.valueOf(((Dictionary) Dictionary
.getDictionary("configuration")).get("nbElementsPage"));
private int nbElementsTotal;
private Rafraichissable vueARafraichir;
 
36,7 → 40,8
/**
* Constructeur avec paramètre
*
* @param taille la taille de la table de hachage
* @param taille
* la taille de la table de hachage
*/
public PersonneListe(int taille) {
super(taille);
47,39 → 52,53
*
* @param dates
*/
public PersonneListe(JSONArray ListeDePersonnes) {
super(ListeDePersonnes.size());
initialiserPersonneListe(ListeDePersonnes);
public PersonneListe(JSONArray personneListe) {
super(personneListe.size());
 
final int taillemax = personneListe.size();
for (int i = 0; i < taillemax; i++) {
JSONObject personneCourante = personneListe.get(i).isObject();
 
if (personneCourante != null) {
Personne personne = new Personne(personneCourante);
this.put(personne.getId(), personne);
}
}
}
 
public PersonneListe(JSONArray ListeDePersonnes, JSONNumber nbElements, Rafraichissable vueARafraichir) {
super(ListeDePersonnes.size());
public PersonneListe(JSONArray personneListe, JSONNumber nbElements,
Rafraichissable vueARafraichir) {
super(personneListe.size());
 
this.nbElementsTotal = Integer.valueOf(nbElements.toString());
this.vueARafraichir = vueARafraichir;
initialiserPersonneListe(ListeDePersonnes);
}
private void initialiserPersonneListe(JSONArray ListeDePersonnes) {
final int taillemax = ListeDePersonnes.size();
final int taillemax = personneListe.size();
for (int i = 0; i < taillemax; i++) {
JSONObject personneCourante = ListeDePersonnes.get(i).isObject();
JSONObject personneCourante = personneListe.get(i).isObject();
 
if (personneCourante != null) {
Personne personne = new Personne(personneCourante);
this.put(personne.getId(), personne);
}
}
 
this.vueARafraichir = vueARafraichir;
}
 
public int[] getPageTable() {
int[] page = new int[4];
 
// nombre de pages au total
page[0] = calculerNbPages();
 
// Page En Cours
page[1] = currentPage;
 
// nbElementsParPage
page[2] = nbElementsPage;
 
// et le dernier le nombre total d'éléments
page[3] = nbElementsTotal;
 
return page;
}
 
90,14 → 109,17
* @return le nombre de pages
*/
public int calculerNbPages() {
// À cause de la bétise de java pour les conversion implicite, 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.
// A cause de la betise de java pour les conversion implicite 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 superieur
 
double nPage = (1.0 * nbElementsTotal) / (1.0 * nbElementsPage);
double nPageRound = Math.ceil(nPage);
Double nPageInt = new Double(nPageRound);
 
// Convertion en entier
// on convertit en entier
return nPageInt.intValue();
}
 
125,7 → 147,8
 
public void selectionnerPersonne() {
Mediateur mediateur = (Mediateur) Registry.get(RegistreId.MEDIATEUR);
mediateur.selectionnerPersonne(vueARafraichir, null, null, currentPage, nbElementsPage);
mediateur.selectionnerPersonne(vueARafraichir, null, null, currentPage,
nbElementsPage);
}
 
public void filtrerParNom(String nom) {
132,6 → 155,8
Mediateur mediateur = (Mediateur) Registry.get(RegistreId.MEDIATEUR);
Personne personne = new Personne();
personne.setNom("%" + nom + "%");
mediateur.selectionnerPersonne(vueARafraichir, personne, null, currentPage, nbElementsPage);
mediateur.selectionnerPersonne(vueARafraichir, personne, null, currentPage,
nbElementsPage);
}
 
}