/branches/v1.0-syrah/src/org/tela_botanica/client/modeles/personne/PersonneListe.java |
---|
13,20 → 13,16 |
import com.google.gwt.json.client.JSONObject; |
/** |
* 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 |
* Classe contenant les informations sur les Personnes renvoyées par un objet de type DAO. |
* |
* @author david delon |
* @author Grégoire DUCHÉ |
* |
*/ |
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; |
40,8 → 36,7 |
/** |
* 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); |
52,53 → 47,39 |
* |
* @param dates |
*/ |
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) { |
super(ListeDePersonnes.size()); |
initialiserPersonneListe(ListeDePersonnes); |
} |
public PersonneListe(JSONArray personneListe, JSONNumber nbElements, |
Rafraichissable vueARafraichir) { |
super(personneListe.size()); |
public PersonneListe(JSONArray ListeDePersonnes, JSONNumber nbElements, Rafraichissable vueARafraichir) { |
super(ListeDePersonnes.size()); |
this.nbElementsTotal = Integer.valueOf(nbElements.toString()); |
final int taillemax = personneListe.size(); |
this.vueARafraichir = vueARafraichir; |
initialiserPersonneListe(ListeDePersonnes); |
} |
private void initialiserPersonneListe(JSONArray ListeDePersonnes) { |
final int taillemax = ListeDePersonnes.size(); |
for (int i = 0; i < taillemax; i++) { |
JSONObject personneCourante = personneListe.get(i).isObject(); |
JSONObject personneCourante = ListeDePersonnes.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; |
} |
109,17 → 90,14 |
* @return le nombre de pages |
*/ |
public int calculerNbPages() { |
// 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 |
// À 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. |
double nPage = (1.0 * nbElementsTotal) / (1.0 * nbElementsPage); |
double nPageRound = Math.ceil(nPage); |
Double nPageInt = new Double(nPageRound); |
// on convertit en entier |
// Convertion en entier |
return nPageInt.intValue(); |
} |
147,8 → 125,7 |
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) { |
155,8 → 132,6 |
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); |
} |
} |
/branches/v1.0-syrah/src/org/tela_botanica/client/modeles/collection/CollectionListe.java |
---|
5,7 → 5,6 |
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; |
14,13 → 13,12 |
import com.google.gwt.json.client.JSONObject; |
/** |
* 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 |
* Classe contenant les informations sur les Collections renvoyées par un objet de type DAO. |
* |
* @author david delon |
* @author Jean-Pascal MILCENT |
* |
*/ |
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; |
36,45 → 34,31 |
super(taille); |
} |
/** |
* Constructeur pour une liste d'institutions |
* @param dates |
*/ |
public CollectionListe(JSONArray structures) { |
super(structures.size()) ; |
final int taillemax = structures.size(); |
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(); |
for (int i = 0; i < taillemax; i++) { |
JSONObject collectionCourante = structures.get(i).isObject() ; |
JSONObject collectionCourante = collections.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(); |
99,19 → 83,14 |
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; |
} |
122,17 → 101,14 |
* @return le nombre de pages |
*/ |
public int calculerNbPages() { |
// 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 |
// À 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. |
double nPage = (1.0 * nbElementsTotal) / (1.0 * nbElementsPage); |
double nPageRound = Math.ceil(nPage); |
Double nPageInt = new Double(nPageRound); |
// on convertit en entier |
// Convertion en entier |
return nPageInt.intValue(); |
} |
144,7 → 120,5 |
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,7 → 5,6 |
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; |
14,13 → 13,12 |
import com.google.gwt.json.client.JSONObject; |
/** |
* 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 |
* Classe contenant les informations sur les Structures renvoyées par un objet de type DAO. |
* |
* @author david delon |
* @author Jean-Pascal MILCENT |
* |
*/ |
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; |
36,17 → 34,22 |
super(taille); |
} |
/** |
* Constructeur pour une liste d'institutions |
* @param dates |
*/ |
public StructureListe(JSONArray structures) { |
super(structures.size()) ; |
final int taillemax = structures.size(); |
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(); |
for (int i = 0; i < taillemax; i++) { |
JSONObject structureCourante = structures.get(i).isObject() ; |
JSONObject structureCourante = ListeDeStructures.get(i).isObject(); |
if (structureCourante != null) { |
Structure structure = new Structure(structureCourante); |
StructureValorisation valorisation = new StructureValorisation(structureCourante); |
58,23 → 61,6 |
} |
} |
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(); |
99,19 → 85,14 |
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; |
} |
122,27 → 103,24 |
* @return le nombre de pages |
*/ |
public int calculerNbPages() { |
// 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 |
// À 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. |
double nPage = (1.0 * nbElementsTotal) / (1.0 * nbElementsPage); |
double nPageRound = Math.ceil(nPage); |
Double nPageInt = new Double(nPageRound); |
// on convertit en entier |
// Convertion 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,7 → 5,6 |
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; |
14,8 → 13,7 |
import com.google.gwt.json.client.JSONObject; |
/** |
* 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. |
* Classe contenant les informations sur les Structures renvoyées par un objet de type DAO. |
* |
* @author Grégoire DUCHÉ |
* |
27,9 → 25,7 |
private int nbElementsPage = Integer.valueOf(((Dictionary) Dictionary.getDictionary("configuration")).get("nbElementsPage")); |
private int nbElementsTotal; |
private Rafraichissable vueARafraichir; |
/** |
* Constructeur sans paramètres |
*/ |
public ProjetListe() { |
super(); |
} |
46,13 → 42,22 |
* Constructeur pour une liste de projets |
* @param dates |
*/ |
public ProjetListe(JSONArray projetsListe) { |
super(projetsListe.size()); |
final int taillemax = projetsListe.size(); |
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(); |
for (int i = 0; i < taillemax; i++) { |
JSONObject projetCourant = projetsListe.get(i).isObject() ; |
JSONObject projetCourant = ListeDeProjets.get(i).isObject(); |
if (projetCourant != null) { |
Projet projet = new Projet(projetCourant); |
this.put(projet.getId(), projet); |
60,23 → 65,6 |
} |
} |
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(); |
101,19 → 89,14 |
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; |
} |
124,28 → 107,24 |
* @return le nombre de pages |
*/ |
public int calculerNbPages() { |
// 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 |
// À 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. |
double nPage = (1.0 * nbElementsTotal) / (1.0 * nbElementsPage); |
double nPageRound = Math.ceil(nPage); |
Double nPageInt = new Double(nPageRound); |
// on convertit en entier |
// Convertion 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,7 → 5,6 |
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,6 → 12,12 |
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; |
33,36 → 38,28 |
* Constructeur pour une liste de commentaires |
* @param dates |
*/ |
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) { |
super(ListeDeCommentaires.size()); |
initialiserCommentaireListe(ListeDeCommentaires); |
} |
public CommentaireListe(JSONArray commentaireListe, JSONNumber nbElements, Rafraichissable vueARafraichir) { |
super(commentaireListe.size()); |
public CommentaireListe(JSONArray ListeDeCommentaires, JSONNumber nbElements, Rafraichissable vueARafraichir) { |
super(ListeDeCommentaires.size()); |
this.nbElementsTotal = Integer.valueOf(nbElements.toString()); |
final int taillemax = commentaireListe.size(); |
this.vueARafraichir = vueARafraichir; |
initialiserCommentaireListe(ListeDeCommentaires); |
} |
private void initialiserCommentaireListe(JSONArray ListeDeCommentaires) { |
boolean chargerCollectionACommentaire = true; |
final int taillemax = ListeDeCommentaires.size(); |
for (int i = 0; i < taillemax; i++) { |
JSONObject commentaire = commentaireListe.get(i).isObject() ; |
if (commentaire != null) { |
Commentaire commentaireCourant = new Commentaire(commentaire); |
this.put(commentaireCourant.getId(), commentaireCourant); |
JSONObject commentaireCourant = ListeDeCommentaires.get(i).isObject() ; |
if (commentaireCourant != null) { |
Commentaire commentaire = new Commentaire(commentaireCourant, chargerCollectionACommentaire); |
this.put(commentaire.getId(), commentaire); |
} |
} |
this.vueARafraichir = vueARafraichir; |
} |
public void changerNumeroPage(int pageCourante) { |
89,19 → 86,14 |
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; |
} |
112,30 → 104,24 |
* @return le nombre de pages |
*/ |
public int calculerNbPages() { |
// 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 |
// À 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. |
double nPage = (1.0 * nbElementsTotal) / (1.0 * nbElementsPage); |
double nPageRound = Math.ceil(nPage); |
Double nPageInt = new Double(nPageRound); |
// on convertit en entier |
// Convertion 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,7 → 6,6 |
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; |
13,6 → 12,12 |
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; |
29,17 → 34,22 |
super(taille); |
} |
/** |
* Constructeur pour une liste d'institutions |
* @param dates |
*/ |
public PublicationListe(JSONArray publications) { |
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); |
} |
super(publications.size()); |
int taille = publications.size(); |
private void initialiserPublicationListe(JSONArray ListeDePublications) { |
int taille = ListeDePublications.size(); |
for (int i = 0; i < taille; i++) { |
JSONObject publicationCourante = publications.get(i).isObject() ; |
JSONObject publicationCourante = ListeDePublications.get(i).isObject() ; |
if (publicationCourante != null) { |
Publication publication = new Publication(publicationCourante); |
48,23 → 58,6 |
} |
} |
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(); |
89,19 → 82,14 |
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; |
} |
112,27 → 100,24 |
* @return le nombre de pages |
*/ |
public int calculerNbPages() { |
// 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 |
// À 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. |
double nPage = (1.0 * nbElementsTotal) / (1.0 * nbElementsPage); |
double nPageRound = Math.ceil(nPage); |
Double nPageInt = new Double(nPageRound); |
// on convertit en entier |
// Convertion 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 + "%"); |
} |
} |
} |