Subversion Repositories eFlore/Applications.del

Compare Revisions

Ignore whitespace Rev 1933 → Rev 1934

/trunk/src/org/tela_botanica/del/client/vues/comparaisoneflore/ComparaisonEfloreVue.ui.xml
68,7 → 68,7
<g:Label text="{constants.auteur}" styleName="petit" />
<g:Label ui:field="nomAuteurEflore" />
 
<g:Label text="{constants.transmisLe}" styleName="petit" />
<g:Label text="{constants.publieLe}" styleName="petit" />
<g:Label ui:field="dateObservationEflore" />
</g:HTMLPanel>
</g:VerticalPanel>
/trunk/src/org/tela_botanica/del/client/vues/identiplante/resultats/ResultatsIdentiplanteVue.ui.xml
13,9 → 13,15
<g:HTMLPanel ui:field="zoneTri" styleName="droite {style.zoneTri} petit">
<g:Label text="{constants.tri}" styleName="gauche"/>
<g:HTMLPanel ui:field="triParDate" styleName="gauche">
<g:Label text="{constants.triParDate}" title="{constants.triParDateObsTooltip}" styleName="gauche {style.date}" ui:field="labelDate"/>
<g:Button title="{constants.triParDateObsAscendant}" ui:field="triParDateAscendant" styleName="{style.boutonTriAsc} gauche" />
<g:Button title="{constants.triParDateObsDescendant}" ui:field="triParDateDescendant" styleName="{style.boutonTriDesc} gauche" />
<g:Label text="{constants.triParDateObs}" title="{constants.triParDateObsTooltip}" styleName="gauche {style.date}" ui:field="labelDateObservation"/>
<g:Button title="{constants.triParDateObsAscendant}" ui:field="triParDateObservationAscendant" styleName="{style.boutonTriAsc} gauche" />
<g:Button title="{constants.triParDateObsDescendant}" ui:field="triParDateObservationDescendant" styleName="{style.boutonTriDesc} gauche" />
<g:Label text="{constants.triParDatePubli}" title="{constants.triParDatePubliTooltip}" styleName="gauche {style.date}" ui:field="labelDatePublication"/>
<g:Button title="{constants.triParDatePubliAscendant}" ui:field="triParDatePublicationAscendant" styleName="{style.boutonTriAsc} gauche" />
<g:Button title="{constants.triParDatePubliDescendant}" ui:field="triParDatePublicationDescendant" styleName="{style.boutonTriDesc} gauche" />
<g:Label text="{constants.triParNbCommentaires}" title="{constants.triParDatePubliTooltip}" styleName="gauche {style.date}" ui:field="labelNbCommentaires"/>
<g:Button title="{constants.triParDatePubliAscendant}" ui:field="triParNbCommentairesAscendant" styleName="{style.boutonTriAsc} gauche" />
<g:Button title="{constants.triParDatePubliDescendant}" ui:field="triParNbCommentairesDescendant" styleName="{style.boutonTriDesc} gauche" />
</g:HTMLPanel>
</g:HTMLPanel>
</g:HTMLPanel>
/trunk/src/org/tela_botanica/del/client/vues/identiplante/resultats/ResultatsIdentiplantePresenteur.java
22,6 → 22,7
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.HasWidgets;
import com.google.gwt.user.client.ui.IsWidget;
import com.google.gwt.user.client.ui.Label;
 
public class ResultatsIdentiplantePresenteur extends Presenteur {
 
41,22 → 42,40
 
public void nettoyer();
 
public HasClickHandlers getTriParDateAscendant();
public HasClickHandlers getTriParDateObservationAscendant();
 
public HasClickHandlers getTriParDateDescendant();
public HasClickHandlers getTriParDateObservationDescendant();
public HasClickHandlers getTriParDatePublicationAscendant();
 
public HasClickHandlers getTriParDatePublicationDescendant();
public HasClickHandlers getTriParNbCommentairesAscendant();
 
public HasClickHandlers getTriParNbCommentairesDescendant();
 
public void afficherElementsAucunResultatTrouve();
 
public void afficherElementsResultatsTrouves();
 
public HasClickHandlers getLabelDate();
public HasClickHandlers getLabelDateObservation();
public HasClickHandlers getLabelDatePublication();
public HasClickHandlers getLabelNbCommentaires();
 
public void setModeTri(ModeTri mode);
void setModeTriPublication(ModeTri mode);
 
void setModeTriObservation(ModeTri mode);
 
void setModeTriNbCommentaires(ModeTri mode);
}
 
private Vue vue;
private ObservationService serviceObs;
private ModeTri triCourantDate = ModeTri.TRI_DESCENDANT;
private ModeTri triCourantDatePublication = ModeTri.TRI_DESCENDANT;
private ModeTri triCourantDateObservation = ModeTri.PAS_DE_TRI;
private ModeTri triCourantNbCommentaires = ModeTri.PAS_DE_TRI;
private CacheClient cache = CacheClient.getInstance();
private String statut;
 
70,10 → 89,23
public ResultatsIdentiplantePresenteur(ObservationService serviceObs, Vue vue) {
String statut = CacheClient.getInstance().getFiltreStatut();
this.vue = vue;
ModeTri initTriCourantDate = CacheClient.getInstance().getInformationsRechercheObservation().getTriParDate();
initTriCourantDate = (initTriCourantDate == null) ? triCourantDate : initTriCourantDate;
triCourantDate = initTriCourantDate;
vue.setModeTri(triCourantDate);
InformationsRecherche infos = CacheClient.getInstance().getInformationsRechercheObservation();
if (infos.getTriParDatePublication() != ModeTri.PAS_DE_TRI) {
triCourantDatePublication = infos.getTriParDatePublication();
vue.setModeTriPublication(triCourantDatePublication);
}
if (infos.getTriParDateObservation() != ModeTri.PAS_DE_TRI) {
triCourantDateObservation = infos.getTriParDateObservation();
vue.setModeTriObservation(triCourantDatePublication);
}
if (infos.getTriParNbCommentaires() != ModeTri.PAS_DE_TRI) {
triCourantNbCommentaires = infos.getTriParNbCommentaires();
vue.setModeTriNbCommentaires(triCourantNbCommentaires);
}
this.serviceObs = serviceObs;
this.statut = statut;
}
162,39 → 194,118
* */
protected void gererEvenements() {
 
ClickHandler surClicDate = new ClickHandler() {
ClickHandler surClicDateObservation = new ClickHandler() {
/**
* Gestion du clic sur l'option de tri par date d'observation Masque
* les éléments de tri qui sont en cours et affiche les autres
* */
public void onClick(ClickEvent event) {
toggleModeTri();
toggleModeTriObservation();
 
InformationsRecherche informationsRechercheObservations = cache.getInformationsRechercheObservation();
informationsRechercheObservations.setTriParDate(triCourantDate);
informationsRechercheObservations.setTriParDatePublication(ModeTri.PAS_DE_TRI);
informationsRechercheObservations.setTriParNbCommentaires(ModeTri.PAS_DE_TRI);
informationsRechercheObservations.setTriParDateObservation(triCourantDateObservation);
chercherEtAfficherObservationsPageEnCours();
}
};
ClickHandler surClicDatePublication = new ClickHandler() {
/**
* Gestion du clic sur l'option de tri par date d'observation Masque
* les éléments de tri qui sont en cours et affiche les autres
* */
public void onClick(ClickEvent event) {
toggleModeTriPublication();
 
vue.getLabelDate().addClickHandler(surClicDate);
vue.getTriParDateAscendant().addClickHandler(surClicDate);
vue.getTriParDateDescendant().addClickHandler(surClicDate);
InformationsRecherche informationsRechercheObservations = cache.getInformationsRechercheObservation();
informationsRechercheObservations.setTriParDateObservation(ModeTri.PAS_DE_TRI);
informationsRechercheObservations.setTriParNbCommentaires(ModeTri.PAS_DE_TRI);
informationsRechercheObservations.setTriParDatePublication(triCourantDatePublication);
 
chercherEtAfficherObservationsPageEnCours();
}
};
ClickHandler surClicNbCommentaires = new ClickHandler() {
/**
* Même comportement qu'au dessus mais pour le tri par nb de commentaires
*/
public void onClick(ClickEvent event) {
toggleModeTriNbCommentaires();
 
InformationsRecherche informationsRechercheObservations = cache.getInformationsRechercheObservation();
informationsRechercheObservations.setTriParDateObservation(ModeTri.PAS_DE_TRI);
informationsRechercheObservations.setTriParDatePublication(ModeTri.PAS_DE_TRI);
informationsRechercheObservations.setTriParNbCommentaires(triCourantNbCommentaires);
chercherEtAfficherObservationsPageEnCours();
}
};
 
vue.getLabelDateObservation().addClickHandler(surClicDateObservation);
vue.getTriParDateObservationAscendant().addClickHandler(surClicDateObservation);
vue.getTriParDateObservationDescendant().addClickHandler(surClicDateObservation);
vue.getLabelDatePublication().addClickHandler(surClicDatePublication);
vue.getTriParDatePublicationAscendant().addClickHandler(surClicDatePublication);
vue.getTriParDatePublicationDescendant().addClickHandler(surClicDatePublication);
vue.getLabelNbCommentaires().addClickHandler(surClicNbCommentaires);
vue.getTriParNbCommentairesAscendant().addClickHandler(surClicNbCommentaires);
vue.getTriParNbCommentairesDescendant().addClickHandler(surClicNbCommentaires);
}
 
/**
* Inverser le mode de tri en fonction du précédent
* */
public void toggleModeTri() {
if (triCourantDate == ModeTri.TRI_ASCENDANT) {
triCourantDate = ModeTri.TRI_DESCENDANT;
public void toggleModeTriPublication() {
if (triCourantDatePublication == ModeTri.TRI_ASCENDANT) {
triCourantDatePublication = ModeTri.TRI_DESCENDANT;
} else {
triCourantDate = ModeTri.TRI_ASCENDANT;
triCourantDatePublication = ModeTri.TRI_ASCENDANT;
}
triCourantDateObservation = ModeTri.PAS_DE_TRI;
triCourantNbCommentaires = ModeTri.PAS_DE_TRI;
 
vue.setModeTri(triCourantDate);
vue.setModeTriPublication(triCourantDatePublication);
}
/**
* Inverser le mode de tri en fonction du précédent
* */
public void toggleModeTriObservation() {
if (triCourantDateObservation == ModeTri.TRI_ASCENDANT) {
triCourantDateObservation = ModeTri.TRI_DESCENDANT;
} else {
triCourantDateObservation = ModeTri.TRI_ASCENDANT;
}
triCourantDatePublication = ModeTri.PAS_DE_TRI;
triCourantNbCommentaires = ModeTri.PAS_DE_TRI;
 
vue.setModeTriObservation(triCourantDateObservation);
}
/**
* Inverser le mode de tri en fonction du précédent
* */
public void toggleModeTriNbCommentaires() {
if (triCourantNbCommentaires == ModeTri.TRI_ASCENDANT) {
triCourantNbCommentaires = ModeTri.TRI_DESCENDANT;
} else {
triCourantNbCommentaires = ModeTri.TRI_ASCENDANT;
}
System.out.println(triCourantNbCommentaires);
triCourantDateObservation = ModeTri.PAS_DE_TRI;
triCourantDatePublication = ModeTri.PAS_DE_TRI;
 
vue.setModeTriNbCommentaires(triCourantNbCommentaires);
}
 
/**
* Initialiser les variable de début et fin et lancer le chargement des
* observations
* */
/trunk/src/org/tela_botanica/del/client/vues/identiplante/resultats/ResultatsIdentiplanteVue.java
3,6 → 3,7
import org.tela_botanica.del.client.modeles.ModeTri;
 
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Button;
27,10 → 28,12
Panel zoneObservations, zonePaginationHaut, zonePaginationBas, zoneTri;
 
@UiField
Button triParDateAscendant, triParDateDescendant;
Button triParDateObservationAscendant, triParDateObservationDescendant,
triParDatePublicationAscendant, triParDatePublicationDescendant,
triParNbCommentairesAscendant, triParNbCommentairesDescendant;
 
@UiField
Label aucunResultat, labelDate;
Label aucunResultat, labelDateObservation, labelDatePublication, labelNbCommentaires;
 
// Constructeur de la vue
87,32 → 90,102
zoneTri.setVisible(true);
}
 
public Button getTriParDateAscendant() {
return triParDateAscendant;
public Button getTriParDateObservationAscendant() {
return triParDateObservationAscendant;
}
 
public Button getTriParDateDescendant() {
return triParDateDescendant;
public Button getTriParDateObservationDescendant() {
return triParDateObservationDescendant;
}
public Button getTriParDatePublicationAscendant() {
return triParDatePublicationAscendant;
}
 
public Button getTriParDatePublicationDescendant() {
return triParDatePublicationDescendant;
}
@Override
public Label getLabelDate() {
return labelDate;
public Label getLabelDateObservation() {
return labelDateObservation;
}
@Override
public Label getLabelDatePublication() {
return labelDatePublication;
}
@Override
public Label getLabelNbCommentaires() {
return labelNbCommentaires;
}
@Override
public HasClickHandlers getTriParNbCommentairesAscendant() {
return triParNbCommentairesAscendant;
}
 
@Override
public HasClickHandlers getTriParNbCommentairesDescendant() {
return triParNbCommentairesDescendant;
}
private void cacherTris() {
triParDateObservationAscendant.setVisible(false);
triParDateObservationDescendant.setVisible(false);
triParDatePublicationDescendant.setVisible(false);
triParDatePublicationAscendant.setVisible(false);
triParNbCommentairesAscendant.setVisible(false);
triParNbCommentairesDescendant.setVisible(false);
}
/**
* En fonction du sens du tri (ascendant ou descendant), on change l'affichage des
* boutons de tri pour masquer que celui qui doit être cliquable.
* @param ModeTri le mode Ascendant ou Descendant
* */
public void setModeTri(ModeTri mode) {
@Override
public void setModeTriPublication(ModeTri mode) {
cacherTris();
if (mode == ModeTri.TRI_ASCENDANT) {
triParDateAscendant.setVisible(true);
triParDateDescendant.setVisible(false);
triParDatePublicationAscendant.setVisible(true);
triParDatePublicationDescendant.setVisible(false);
} else {
triParDateDescendant.setVisible(true);
triParDateAscendant.setVisible(false);
triParDatePublicationDescendant.setVisible(true);
triParDatePublicationAscendant.setVisible(false);
}
}
/**
* En fonction du sens du tri (ascendant ou descendant), on change l'affichage des
* boutons de tri pour masquer que celui qui doit être cliquable.
* @param ModeTri le mode Ascendant ou Descendant
* */
@Override
public void setModeTriObservation(ModeTri mode) {
cacherTris();
if (mode == ModeTri.TRI_ASCENDANT) {
triParDateObservationAscendant.setVisible(true);
triParDateObservationDescendant.setVisible(false);
} else {
triParDateObservationDescendant.setVisible(true);
triParDateObservationAscendant.setVisible(false);
}
}
 
@Override
public void setModeTriNbCommentaires(ModeTri mode) {
cacherTris();
if (mode == ModeTri.TRI_ASCENDANT) {
triParNbCommentairesAscendant.setVisible(true);
triParNbCommentairesDescendant.setVisible(false);
} else {
triParNbCommentairesDescendant.setVisible(true);
triParNbCommentairesAscendant.setVisible(false);
}
}
}
/trunk/src/org/tela_botanica/del/client/vues/identiplante/resultats/observations/observation.css
95,4 → 95,7
}
.ajouterProposition {
margin-top:10px;
}
.plusDeDetails {
width: 130px;
}
/trunk/src/org/tela_botanica/del/client/vues/identiplante/resultats/observations/ObservationVue.ui.xml
30,7 → 30,7
text="{constants.proposerSaDetermination}" />
<g:Button ui:field="boutonAjoutCommentaire" styleName="bouton-petit"
text="{constants.ajouterCommentaire}" />
<g:Button ui:field="boutonPlusDeDetails" styleName="bouton-petit {style.ajouterProposition}"
<g:Button ui:field="boutonPlusDeDetails" styleName="bouton-petit {style.ajouterProposition} {style.plusDeDetails}"
text="Voir tous les commentaires" />
</g:HTMLPanel>
</g:HTMLPanel>
/trunk/src/org/tela_botanica/del/client/vues/identiplante/resultats/observations/ObservationPresenteur.java
33,6 → 33,7
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.HasWidgets;
import com.google.gwt.user.client.ui.IsWidget;
 
51,6 → 52,8
 
public void setNomEspece(String nomEspece);
public void setNbCommentaires(String nbCommentaires);
public HasClickHandlers getBoutonAjoutCommentaire();
public HasClickHandlers getBoutonPlusDeDetails();
}
78,6 → 81,7
observationDeterminationPresenteur = new ObservationDeterminationPresenteur(new ObservationDeterminationVue(), observation.getPropositionDeterminations());
observationDeterminationPresenteur.go(vue.getDeterminationsPanel());
vue.setNomEspece(observation.getNomRetenu());
vue.setNbCommentaires(observation.getNbCommentaires());
gererEvenements();
}
 
/trunk/src/org/tela_botanica/del/client/vues/identiplante/resultats/observations/ObservationVue.java
73,4 → 73,9
this.nomEspece.setText(nomEspece);
}
 
@Override
public void setNbCommentaires(String nbCommentaires) {
boutonPlusDeDetails.setText(boutonPlusDeDetails.getText()+" ("+nbCommentaires+")");
}
 
}
/trunk/src/org/tela_botanica/del/client/vues/identiplante/moteur/MoteurIdentiplanteVue.ui.xml
14,11 → 14,11
<g:HTMLPanel ui:field="zoneRecherche" />
</g:HTMLPanel>
<g:HTMLPanel styleName="zone-onglets">
<g:Label styleName="onglet onglet-actif" text="Tout" ui:field="ongletTout"></g:Label>
<g:Label styleName="onglet" text="A déterminer" ui:field="ongletADeterminer"></g:Label>
<g:Label styleName="onglet" text="En discussion" ui:field="ongletEnDiscussion"></g:Label>
<g:Label styleName="onglet onglet-actif" text="{constants.ongletTous}" ui:field="ongletTout"></g:Label>
<g:Label styleName="onglet" text="{constants.ongletADeterminer}" ui:field="ongletADeterminer"></g:Label>
<g:Label styleName="onglet" text="{constants.ongletAConfirmer}" ui:field="ongletAConfirmer"></g:Label>
<!-- terme Validées/Vérifiées sujet à changement, "Vérifiées" en texte, "Validées" partout ailleurs dans le code -->
<g:Label styleName="onglet" text="Vérifiées" ui:field="ongletValidees"></g:Label>
<g:Label styleName="onglet" text="{constants.ongletVerifiees}" ui:field="ongletValidees"></g:Label>
</g:HTMLPanel>
<g:HTMLPanel>
<g:HTMLPanel ui:field="zoneResultats" />
/trunk/src/org/tela_botanica/del/client/vues/identiplante/moteur/MoteurIdentiplantePresenteur.java
28,7 → 28,7
 
public HasWidgets getZoneResultats();
 
public HasClickHandlers getOngletEnDiscussion();
public HasClickHandlers getOngletAConfirmer();
public HasClickHandlers getOngletADeterminer();
40,7 → 40,7
public void setOngletToutActif();
public void setOngletEnDiscussionActif();
public void setOngletAConfirmerActif();
 
public void setOngletValideesActif();
102,14 → 102,14
}
});
vue.getOngletEnDiscussion().addClickHandler(new ClickHandler() {
vue.getOngletAConfirmer().addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
CacheClient.getInstance().setFiltreStatut("endiscussion");
CacheClient.getInstance().setFiltreStatut("aconfirmer");
CacheClient.getInstance().setPageCouranteRechercheObservations(1);
chercherObservations();
vue.setOngletEnDiscussionActif();
vue.setOngletAConfirmerActif();
}
});
 
/trunk/src/org/tela_botanica/del/client/vues/identiplante/moteur/MoteurIdentiplanteVue.java
24,7 → 24,7
Panel zoneRecherche, zoneResultats;
 
@UiField
Label ongletTout, ongletADeterminer, ongletEnDiscussion, ongletValidees;
Label ongletTout, ongletADeterminer, ongletAConfirmer, ongletValidees;
 
public HasWidgets getZoneRecherche() {
return zoneRecherche;
41,8 → 41,8
}
@Override
public HasClickHandlers getOngletEnDiscussion() {
return ongletEnDiscussion;
public HasClickHandlers getOngletAConfirmer() {
return ongletAConfirmer;
}
 
@Override
73,9 → 73,9
}
 
@Override
public void setOngletEnDiscussionActif() {
public void setOngletAConfirmerActif() {
nettoyerOngletsActifs();
ongletEnDiscussion.addStyleName("onglet-actif");
ongletAConfirmer.addStyleName("onglet-actif");
}
 
@Override
87,7 → 87,7
public void nettoyerOngletsActifs() {
ongletTout.removeStyleName("onglet-actif");
ongletADeterminer.removeStyleName("onglet-actif");
ongletEnDiscussion.removeStyleName("onglet-actif");
ongletAConfirmer.removeStyleName("onglet-actif");
ongletValidees.removeStyleName("onglet-actif");
}
97,8 → 97,8
setOngletToutActif();
} else if (statut.equals("adeterminer")) {
setOngletADeterminerActif();
} else if (statut.equals("endiscussion")) {
setOngletEnDiscussionActif();
} else if (statut.equals("aconfirmer")) {
setOngletAConfirmerActif();
} else if (statut.equals("validees")) {
setOngletValideesActif();
}
/trunk/src/org/tela_botanica/del/client/vues/pictoflora/resultats/ResultatPictofloraVue.ui.xml
15,9 → 15,9
<g:HTMLPanel ui:field="zoneTri" styleName="gauche {style.zoneTri} petit">
<g:Label text="{constants.tri}" styleName="gauche {style.labeltri}"/>
<g:HTMLPanel ui:field="triParDate" styleName="gauche">
<g:Label text="{constants.triParDate}" title="{constants.triParDateTooltip}" styleName="gauche {style.date}" ui:field="labelDate"/>
<g:Button title="{constants.triParDateAscendant}" ui:field="triParDateAscendant" styleName="{style.boutonTriAsc} gauche" />
<g:Button title="{constants.triParDateDescendant}" ui:field="triParDateDescendant" styleName="{style.boutonTriDesc} gauche" />
<g:Label text="{constants.triParDatePubli}" title="{constants.triParDatePubliTooltip}" styleName="gauche {style.date}" ui:field="labelDate"/>
<g:Button title="{constants.triParDatePubliAscendant}" ui:field="triParDateAscendant" styleName="{style.boutonTriAsc} gauche" />
<g:Button title="{constants.triParDatePubliDescendant}" ui:field="triParDateDescendant" styleName="{style.boutonTriDesc} gauche" />
</g:HTMLPanel>
<g:HTMLPanel ui:field="triParMoyenneArithmetique" styleName="gauche">
<g:Label text="{constants.triParMoyenneArithmetique}" title="{constants.triParMoyenneArithmetiqueTooltip}" styleName="gauche {style.moyenneArithmetique}" ui:field="labelMoyenneArithmetique"/>
/trunk/src/org/tela_botanica/del/client/vues/pictoflora/resultats/ResultatPictofloraPresenteur.java
1,436 → 1,436
package org.tela_botanica.del.client.vues.pictoflora.resultats;
 
import java.util.List;
 
import org.tela_botanica.del.client.cache.CacheClient;
import org.tela_botanica.del.client.composants.pagination.PaginationPresenteur;
import org.tela_botanica.del.client.composants.pagination.PaginationVue;
import org.tela_botanica.del.client.modeles.Image;
import org.tela_botanica.del.client.modeles.ImageServiceResultat;
import org.tela_botanica.del.client.modeles.InformationsRecherche;
import org.tela_botanica.del.client.modeles.ModeTri;
import org.tela_botanica.del.client.modeles.Protocole;
import org.tela_botanica.del.client.modeles.ProtocoleServiceResultat;
import org.tela_botanica.del.client.navigation.evenement.BusEvenementiel;
import org.tela_botanica.del.client.navigation.evenement.changementprotocole.EvenementChangementProtocole;
import org.tela_botanica.del.client.navigation.evenement.changementprotocole.GestionnaireEvenementChangementProtocole;
import org.tela_botanica.del.client.services.rest.ImageService;
import org.tela_botanica.del.client.services.rest.ProtocoleService;
import org.tela_botanica.del.client.services.rest.async.ImagesParTaxonCallback;
import org.tela_botanica.del.client.services.rest.async.ProtocolesCallback;
import org.tela_botanica.del.client.vues.pictoflora.resultats.images.ImagePresenteur;
import org.tela_botanica.del.client.vues.pictoflora.resultats.images.ImageVue;
 
import com.google.gwt.core.shared.GWT;
import com.google.gwt.dom.client.NodeList;
import com.google.gwt.dom.client.OptionElement;
import com.google.gwt.dom.client.SelectElement;
import com.google.gwt.event.dom.client.ChangeEvent;
import com.google.gwt.event.dom.client.ChangeHandler;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.HasChangeHandlers;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.HasWidgets;
import com.google.gwt.user.client.ui.IsWidget;
import com.google.gwt.user.client.ui.ListBox;
 
public class ResultatPictofloraPresenteur {
public interface Vue extends IsWidget {
public void startChargement();
 
public void nettoyer();
 
public void creerPanneauxObservations(int size);
 
public void stopChargement();
 
public List<HasWidgets> getPanneauxImages();
 
public HasWidgets getPanneauPagination();
 
public HasWidgets getPanneauPaginationHaut();
 
public HasClickHandlers getTriParMoyenneArithmetiqueAscendant();
 
public HasClickHandlers getTriParMoyenneArithmetiqueDescendant();
 
public HasClickHandlers getTriParPointsAscendant();
 
public HasClickHandlers getTriParPointsDescendant();
 
public HasClickHandlers getTriParDateAscendant();
 
public HasClickHandlers getTriParDateDescendant();
public HasClickHandlers getTriParNbTagsAscendant();
 
public HasClickHandlers getTriParNbTagsDescendant();
 
public void afficherElementsAucunResultatTrouve();
 
public void afficherElementsResultatsTrouve();
 
public HTMLPanel getImageTable();
 
public HasClickHandlers getLabelMoyenneArithmetique();
 
public void masquerMoyenneArithmetiqueAscendant();
 
public void masquerMoyenneArithmetiqueDescendant();
 
public void afficherMoyenneArithmetiqueAscendant();
 
public void afficherMoyenneArithmetiqueDescendant();
 
public HasClickHandlers getLabelDate();
 
public void masquerDateAscendant();
 
public void masquerDateDescendant();
 
public void afficherDateAscendant();
 
public void afficherDateDescendant();
public HasClickHandlers getLabelTag();
 
public void masquerTagAscendant();
 
public void afficherTagDescendant();
 
public void masquerTagDescendant();
 
public void afficherTagAscendant();
 
public HasClickHandlers getLabelPoints();
 
public void afficherPointsAscendant();
 
public void afficherPointsDescendant();
 
public void masquerPointsAscendant();
 
public void masquerPointsDescendant();
 
}
 
private Vue vue;
private ImageService imageService;
private final ProtocoleService protocoleService;
private ModeTri triCourantMoyenneArithmetique = ModeTri.TRI_ASCENDANT;
private ModeTri triCourantPoints = ModeTri.TRI_ASCENDANT;
private ModeTri triCourantDate = ModeTri.TRI_DESCENDANT;
private ModeTri triCourantTag = ModeTri.TRI_DESCENDANT;
 
public ResultatPictofloraPresenteur(ImageService imageService, ProtocoleService protocoleService, Vue vue) {
this.vue = vue;
this.imageService = imageService;
this.protocoleService=protocoleService;
}
 
public void go(HasWidgets composite) {
composite.add(vue.asWidget());
vue.startChargement();
rechercherImagesEtCreerWidgetPagination();
gererEvenements();
vue.masquerMoyenneArithmetiqueDescendant();
vue.masquerMoyenneArithmetiqueAscendant();
vue.masquerDateDescendant();
vue.masquerDateAscendant();
vue.masquerTagAscendant();
vue.masquerTagDescendant();
vue.masquerPointsAscendant();
vue.masquerPointsDescendant();
initialiserAPartirInfosCache();
}
private void initialiserAPartirInfosCache() {
InformationsRecherche infos = CacheClient.getInstance().getInformationsRechercheImage();
if (infos.getTriParDate() != ModeTri.PAS_DE_TRI) {
triCourantDate = infos.getTriParDate();
mettreAJourAffichageTriDate();
}
if (infos.getTriParMoyenneArithmetique() != ModeTri.PAS_DE_TRI) {
triCourantMoyenneArithmetique = infos.getTriParMoyenneArithmetique();
mettreAJourAffichageTriMoyenneArithmetique();
}
if (infos.getTriParNbPoints() != ModeTri.PAS_DE_TRI) {
triCourantPoints = infos.getTriParNbPoints();
mettreAJourAffichageTriPoints();
}
if (infos.getTriParNbTags() != ModeTri.PAS_DE_TRI) {
triCourantTag = infos.getTriParNbTags();
mettreAjourAffichageTriTag();
}
}
 
public void gererEvenements() {
ClickHandler surClicTriMoyenneArithmetique = new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
surClicTriMoyenneArithmetique();
}
};
 
vue.getLabelMoyenneArithmetique().addClickHandler(surClicTriMoyenneArithmetique);
vue.getTriParMoyenneArithmetiqueAscendant().addClickHandler(surClicTriMoyenneArithmetique);
vue.getTriParMoyenneArithmetiqueDescendant().addClickHandler(surClicTriMoyenneArithmetique);
 
ClickHandler surClicTriPoints = new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
surClicTriPoints();
}
};
 
vue.getLabelPoints().addClickHandler(surClicTriPoints);
vue.getTriParPointsAscendant().addClickHandler(surClicTriPoints);
vue.getTriParPointsDescendant().addClickHandler(surClicTriPoints);
 
ClickHandler surClicTriDate = new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
surClicTriDate();
}
};
 
vue.getLabelDate().addClickHandler(surClicTriDate);
vue.getTriParDateAscendant().addClickHandler(surClicTriDate);
vue.getTriParDateDescendant().addClickHandler(surClicTriDate);
ClickHandler surClicTriTag = new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
surClicTriTag();
}
};
vue.getLabelTag().addClickHandler(surClicTriTag);
vue.getTriParNbTagsAscendant().addClickHandler(surClicTriTag);
vue.getTriParNbTagsDescendant().addClickHandler(surClicTriTag);
 
BusEvenementiel.getInstance().addHandler(EvenementChangementProtocole.TYPE, new GestionnaireEvenementChangementProtocole() {
@Override
public void onChangementProtocole(EvenementChangementProtocole event) {
InformationsRecherche informationsRechercheImages = CacheClient.getInstance().getInformationsRechercheImage();
if (informationsRechercheImages.getTriParMoyenneArithmetique() != ModeTri.PAS_DE_TRI) {
informationsRechercheImages.setIdProtocoleSelectionne(event.getProtocole().getId() + "");
chargerEtAfficherImagesPageEnCours();
}
}
});
}
 
protected void surClicTriTag() {
triCourantTag = (triCourantTag == ModeTri.TRI_ASCENDANT) ? ModeTri.TRI_DESCENDANT : ModeTri.TRI_ASCENDANT;
mettreAjourAffichageTriTag();
InformationsRecherche informationsRechercheImages = CacheClient.getInstance().getInformationsRechercheImage();
informationsRechercheImages.setTriParNbTags(triCourantTag);
informationsRechercheImages.setTriParDate(ModeTri.PAS_DE_TRI);
informationsRechercheImages.setTriParMoyenneArithmetique(ModeTri.PAS_DE_TRI);
informationsRechercheImages.setTriParNbPoints(ModeTri.PAS_DE_TRI);
chargerEtAfficherImagesPageEnCours();
}
private void mettreAjourAffichageTriTag() {
vue.masquerDateDescendant();
vue.masquerDateAscendant();
vue.masquerMoyenneArithmetiqueDescendant();
vue.masquerMoyenneArithmetiqueAscendant();
vue.masquerPointsAscendant();
vue.masquerPointsDescendant();
if (triCourantTag == ModeTri.TRI_ASCENDANT) {
vue.masquerTagDescendant();
vue.afficherTagAscendant();
} else {
vue.masquerTagAscendant();
vue.afficherTagDescendant();
}
}
 
public void surClicTriMoyenneArithmetique() {
triCourantMoyenneArithmetique = (triCourantMoyenneArithmetique == ModeTri.TRI_ASCENDANT) ? ModeTri.TRI_DESCENDANT : ModeTri.TRI_ASCENDANT;
mettreAJourAffichageTriMoyenneArithmetique();
InformationsRecherche informationsRechercheImages = CacheClient.getInstance().getInformationsRechercheImage();
int IdProtocole = CacheClient.getInstance().getProtocoleCourant().getId();
informationsRechercheImages.setTriParMoyenneArithmetique(triCourantMoyenneArithmetique);
informationsRechercheImages.setIdProtocoleSelectionne(IdProtocole + "");
informationsRechercheImages.setTriParDate(ModeTri.PAS_DE_TRI);
informationsRechercheImages.setTriParNbTags(ModeTri.PAS_DE_TRI);
informationsRechercheImages.setTriParNbPoints(ModeTri.PAS_DE_TRI);
chargerEtAfficherImagesPageEnCours();
}
private void mettreAJourAffichageTriMoyenneArithmetique() {
vue.masquerDateDescendant();
vue.masquerDateAscendant();
vue.masquerTagAscendant();
vue.masquerTagDescendant();
vue.masquerPointsAscendant();
vue.masquerPointsDescendant();
if (triCourantMoyenneArithmetique == ModeTri.TRI_ASCENDANT) {
vue.masquerMoyenneArithmetiqueDescendant();
vue.afficherMoyenneArithmetiqueAscendant();
} else {
vue.masquerMoyenneArithmetiqueAscendant();
vue.afficherMoyenneArithmetiqueDescendant();
}
}
 
public void surClicTriPoints() {
triCourantPoints = (triCourantPoints == ModeTri.TRI_ASCENDANT) ? ModeTri.TRI_DESCENDANT : ModeTri.TRI_ASCENDANT;
mettreAJourAffichageTriPoints();
InformationsRecherche informationsRechercheImages = CacheClient.getInstance().getInformationsRechercheImage();
int IdProtocole = CacheClient.getInstance().getProtocoleCourant().getId();
informationsRechercheImages.setTriParNbPoints(triCourantPoints);
informationsRechercheImages.setIdProtocoleSelectionne(IdProtocole + "");
informationsRechercheImages.setTriParDate(ModeTri.PAS_DE_TRI);
informationsRechercheImages.setTriParNbTags(ModeTri.PAS_DE_TRI);
informationsRechercheImages.setTriParMoyenneArithmetique(ModeTri.PAS_DE_TRI);
chargerEtAfficherImagesPageEnCours();
}
private void mettreAJourAffichageTriPoints() {
vue.masquerDateDescendant();
vue.masquerDateAscendant();
vue.masquerTagAscendant();
vue.masquerTagDescendant();
vue.masquerMoyenneArithmetiqueAscendant();
vue.masquerMoyenneArithmetiqueDescendant();
if (triCourantPoints == ModeTri.TRI_ASCENDANT) {
vue.masquerPointsDescendant();
vue.afficherPointsAscendant();
} else {
vue.masquerPointsAscendant();
vue.afficherPointsDescendant();
}
}
 
public void surClicTriDate() {
triCourantDate = (triCourantDate == ModeTri.TRI_ASCENDANT) ? ModeTri.TRI_DESCENDANT : ModeTri.TRI_ASCENDANT;
mettreAJourAffichageTriDate();
InformationsRecherche informationsRechercheImages = CacheClient.getInstance().getInformationsRechercheImage();
informationsRechercheImages.setTriParDate(triCourantDate);
informationsRechercheImages.setTriParMoyenneArithmetique(ModeTri.PAS_DE_TRI);
informationsRechercheImages.setTriParNbTags(ModeTri.PAS_DE_TRI);
informationsRechercheImages.setTriParNbPoints(ModeTri.PAS_DE_TRI);
chargerEtAfficherImagesPageEnCours();
}
private void mettreAJourAffichageTriDate() {
vue.masquerTagAscendant();
vue.masquerTagDescendant();
vue.masquerMoyenneArithmetiqueDescendant();
vue.masquerMoyenneArithmetiqueAscendant();
vue.masquerPointsAscendant();
vue.masquerPointsDescendant();
if (triCourantDate == ModeTri.TRI_ASCENDANT) {
vue.masquerDateDescendant();
vue.afficherDateAscendant();
} else {
vue.masquerDateAscendant();
vue.afficherDateDescendant();
}
}
 
public void rechercherImagesEtCreerWidgetPagination() {
// appel du service d'image pour avoir le nb total d'elements pour la
// pagination
ImagesParTaxonCallback callback = new ImagesParTaxonCallback() {
 
@Override
public void surRetour(ImageServiceResultat imagesRecues) {
creerWidgetPagination(imagesRecues.getNbTotalImagesPourLaRecherche());
afficherImages(imagesRecues);
 
}
 
@Override
public void surErreur(String messageErreur) {
Window.alert(messageErreur);
 
}
};
final int debut = (CacheClient.getInstance().getPageCouranteRechercheImage() - 1) * CacheClient.getInstance().getPasPagination();
final int fin = (CacheClient.getInstance().getPageCouranteRechercheImage()) * CacheClient.getInstance().getPasPagination();
imageService.getImagesParTaxon(CacheClient.getInstance().getInformationsRechercheImage(), debut, fin, callback);
}
 
private void chargerEtAfficherImages(final int premier, final int dernier) {
vue.startChargement();
vue.nettoyer();
ImagesParTaxonCallback callback = new ImagesParTaxonCallback() {
 
@Override
public void surRetour(ImageServiceResultat imagesRecues) {
afficherImages(imagesRecues);
}
 
@Override
public void surErreur(String messageErreur) {
Window.alert(messageErreur);
}
 
};
imageService.getImagesParTaxon(CacheClient.getInstance().getInformationsRechercheImage(), premier, dernier, callback);
}
 
public void afficherImages(ImageServiceResultat imageServiceResult) {
List<Image> images = imageServiceResult.getImages();
if (images == null || images.size() == 0) {
vue.afficherElementsAucunResultatTrouve();
} else {
vue.afficherElementsResultatsTrouve();
for (Image image : images) {
ImagePresenteur imagePresenteur = new ImagePresenteur(image, imageService, CacheClient.getInstance().getProtocoleCourant(), new ImageVue());
imagePresenteur.go(vue.getImageTable());
}
}
CacheClient.getInstance().mettreAjourUrlCourante();
vue.stopChargement();
}
 
private void creerWidgetPagination(int nbImages) {
PaginationPresenteur imagesPaginationPresenteurHaut = creerPresenteurPagination(nbImages);
PaginationPresenteur imagesPaginationPresenteurBas = creerPresenteurPagination(nbImages);
imagesPaginationPresenteurHaut.setGroupePagination("pagination_images");
imagesPaginationPresenteurBas.setGroupePagination("pagination_images");
imagesPaginationPresenteurHaut.go(vue.getPanneauPaginationHaut());
imagesPaginationPresenteurBas.go(vue.getPanneauPagination());
}
 
public PaginationPresenteur creerPresenteurPagination(int nbImages) {
PaginationPresenteur imagesPaginationPresenteur = new PaginationPresenteur(new PaginationVue(), nbImages, CacheClient.getInstance().getPasPagination(), CacheClient.getInstance().getPageCouranteRechercheImage()) {
@Override
public void chargerElements(int debut, int fin) {
chargerEtAfficherImages(debut, fin);
CacheClient.getInstance().setPageCouranteRechercheImages(getPageCourante());
}
 
@Override
public void actualiserPasCache(int pas) {
CacheClient.getInstance().setPasPagination(pas);
}
};
return imagesPaginationPresenteur;
}
 
public void chargerEtAfficherImagesPageEnCours() {
final int debut = (CacheClient.getInstance().getPageCouranteRechercheImage() - 1) * CacheClient.getInstance().getPasPagination();
final int fin = (CacheClient.getInstance().getPageCouranteRechercheImage()) * CacheClient.getInstance().getPasPagination();
chargerEtAfficherImages(debut, fin);
}
 
public Vue getVue() {
return vue;
}
}
package org.tela_botanica.del.client.vues.pictoflora.resultats;
 
import java.util.List;
 
import org.tela_botanica.del.client.cache.CacheClient;
import org.tela_botanica.del.client.composants.pagination.PaginationPresenteur;
import org.tela_botanica.del.client.composants.pagination.PaginationVue;
import org.tela_botanica.del.client.modeles.Image;
import org.tela_botanica.del.client.modeles.ImageServiceResultat;
import org.tela_botanica.del.client.modeles.InformationsRecherche;
import org.tela_botanica.del.client.modeles.ModeTri;
import org.tela_botanica.del.client.modeles.Protocole;
import org.tela_botanica.del.client.modeles.ProtocoleServiceResultat;
import org.tela_botanica.del.client.navigation.evenement.BusEvenementiel;
import org.tela_botanica.del.client.navigation.evenement.changementprotocole.EvenementChangementProtocole;
import org.tela_botanica.del.client.navigation.evenement.changementprotocole.GestionnaireEvenementChangementProtocole;
import org.tela_botanica.del.client.services.rest.ImageService;
import org.tela_botanica.del.client.services.rest.ProtocoleService;
import org.tela_botanica.del.client.services.rest.async.ImagesParTaxonCallback;
import org.tela_botanica.del.client.services.rest.async.ProtocolesCallback;
import org.tela_botanica.del.client.vues.pictoflora.resultats.images.ImagePresenteur;
import org.tela_botanica.del.client.vues.pictoflora.resultats.images.ImageVue;
 
import com.google.gwt.core.shared.GWT;
import com.google.gwt.dom.client.NodeList;
import com.google.gwt.dom.client.OptionElement;
import com.google.gwt.dom.client.SelectElement;
import com.google.gwt.event.dom.client.ChangeEvent;
import com.google.gwt.event.dom.client.ChangeHandler;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.HasChangeHandlers;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.HTMLPanel;
import com.google.gwt.user.client.ui.HasWidgets;
import com.google.gwt.user.client.ui.IsWidget;
import com.google.gwt.user.client.ui.ListBox;
 
public class ResultatPictofloraPresenteur {
public interface Vue extends IsWidget {
public void startChargement();
 
public void nettoyer();
 
public void creerPanneauxObservations(int size);
 
public void stopChargement();
 
public List<HasWidgets> getPanneauxImages();
 
public HasWidgets getPanneauPagination();
 
public HasWidgets getPanneauPaginationHaut();
 
public HasClickHandlers getTriParMoyenneArithmetiqueAscendant();
 
public HasClickHandlers getTriParMoyenneArithmetiqueDescendant();
 
public HasClickHandlers getTriParPointsAscendant();
 
public HasClickHandlers getTriParPointsDescendant();
 
public HasClickHandlers getTriParDateAscendant();
 
public HasClickHandlers getTriParDateDescendant();
public HasClickHandlers getTriParNbTagsAscendant();
 
public HasClickHandlers getTriParNbTagsDescendant();
 
public void afficherElementsAucunResultatTrouve();
 
public void afficherElementsResultatsTrouve();
 
public HTMLPanel getImageTable();
 
public HasClickHandlers getLabelMoyenneArithmetique();
 
public void masquerMoyenneArithmetiqueAscendant();
 
public void masquerMoyenneArithmetiqueDescendant();
 
public void afficherMoyenneArithmetiqueAscendant();
 
public void afficherMoyenneArithmetiqueDescendant();
 
public HasClickHandlers getLabelDate();
 
public void masquerDateAscendant();
 
public void masquerDateDescendant();
 
public void afficherDateAscendant();
 
public void afficherDateDescendant();
public HasClickHandlers getLabelTag();
 
public void masquerTagAscendant();
 
public void afficherTagDescendant();
 
public void masquerTagDescendant();
 
public void afficherTagAscendant();
 
public HasClickHandlers getLabelPoints();
 
public void afficherPointsAscendant();
 
public void afficherPointsDescendant();
 
public void masquerPointsAscendant();
 
public void masquerPointsDescendant();
 
}
 
private Vue vue;
private ImageService imageService;
private final ProtocoleService protocoleService;
private ModeTri triCourantMoyenneArithmetique = ModeTri.TRI_ASCENDANT;
private ModeTri triCourantPoints = ModeTri.TRI_ASCENDANT;
private ModeTri triCourantDate = ModeTri.TRI_DESCENDANT;
private ModeTri triCourantTag = ModeTri.TRI_DESCENDANT;
 
public ResultatPictofloraPresenteur(ImageService imageService, ProtocoleService protocoleService, Vue vue) {
this.vue = vue;
this.imageService = imageService;
this.protocoleService=protocoleService;
}
 
public void go(HasWidgets composite) {
composite.add(vue.asWidget());
vue.startChargement();
rechercherImagesEtCreerWidgetPagination();
gererEvenements();
vue.masquerMoyenneArithmetiqueDescendant();
vue.masquerMoyenneArithmetiqueAscendant();
vue.masquerDateDescendant();
vue.masquerDateAscendant();
vue.masquerTagAscendant();
vue.masquerTagDescendant();
vue.masquerPointsAscendant();
vue.masquerPointsDescendant();
initialiserAPartirInfosCache();
}
private void initialiserAPartirInfosCache() {
InformationsRecherche infos = CacheClient.getInstance().getInformationsRechercheImage();
if (infos.getTriParDatePublication() != ModeTri.PAS_DE_TRI) {
triCourantDate = infos.getTriParDatePublication();
mettreAJourAffichageTriDate();
}
if (infos.getTriParMoyenneArithmetique() != ModeTri.PAS_DE_TRI) {
triCourantMoyenneArithmetique = infos.getTriParMoyenneArithmetique();
mettreAJourAffichageTriMoyenneArithmetique();
}
if (infos.getTriParNbPoints() != ModeTri.PAS_DE_TRI) {
triCourantPoints = infos.getTriParNbPoints();
mettreAJourAffichageTriPoints();
}
if (infos.getTriParNbTags() != ModeTri.PAS_DE_TRI) {
triCourantTag = infos.getTriParNbTags();
mettreAjourAffichageTriTag();
}
}
 
public void gererEvenements() {
ClickHandler surClicTriMoyenneArithmetique = new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
surClicTriMoyenneArithmetique();
}
};
 
vue.getLabelMoyenneArithmetique().addClickHandler(surClicTriMoyenneArithmetique);
vue.getTriParMoyenneArithmetiqueAscendant().addClickHandler(surClicTriMoyenneArithmetique);
vue.getTriParMoyenneArithmetiqueDescendant().addClickHandler(surClicTriMoyenneArithmetique);
 
ClickHandler surClicTriPoints = new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
surClicTriPoints();
}
};
 
vue.getLabelPoints().addClickHandler(surClicTriPoints);
vue.getTriParPointsAscendant().addClickHandler(surClicTriPoints);
vue.getTriParPointsDescendant().addClickHandler(surClicTriPoints);
 
ClickHandler surClicTriDate = new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
surClicTriDate();
}
};
 
vue.getLabelDate().addClickHandler(surClicTriDate);
vue.getTriParDateAscendant().addClickHandler(surClicTriDate);
vue.getTriParDateDescendant().addClickHandler(surClicTriDate);
ClickHandler surClicTriTag = new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
surClicTriTag();
}
};
vue.getLabelTag().addClickHandler(surClicTriTag);
vue.getTriParNbTagsAscendant().addClickHandler(surClicTriTag);
vue.getTriParNbTagsDescendant().addClickHandler(surClicTriTag);
 
BusEvenementiel.getInstance().addHandler(EvenementChangementProtocole.TYPE, new GestionnaireEvenementChangementProtocole() {
@Override
public void onChangementProtocole(EvenementChangementProtocole event) {
InformationsRecherche informationsRechercheImages = CacheClient.getInstance().getInformationsRechercheImage();
if (informationsRechercheImages.getTriParMoyenneArithmetique() != ModeTri.PAS_DE_TRI) {
informationsRechercheImages.setIdProtocoleSelectionne(event.getProtocole().getId() + "");
chargerEtAfficherImagesPageEnCours();
}
}
});
}
 
protected void surClicTriTag() {
triCourantTag = (triCourantTag == ModeTri.TRI_ASCENDANT) ? ModeTri.TRI_DESCENDANT : ModeTri.TRI_ASCENDANT;
mettreAjourAffichageTriTag();
InformationsRecherche informationsRechercheImages = CacheClient.getInstance().getInformationsRechercheImage();
informationsRechercheImages.setTriParNbTags(triCourantTag);
informationsRechercheImages.setTriParDatePublication(ModeTri.PAS_DE_TRI);
informationsRechercheImages.setTriParMoyenneArithmetique(ModeTri.PAS_DE_TRI);
informationsRechercheImages.setTriParNbPoints(ModeTri.PAS_DE_TRI);
chargerEtAfficherImagesPageEnCours();
}
private void mettreAjourAffichageTriTag() {
vue.masquerDateDescendant();
vue.masquerDateAscendant();
vue.masquerMoyenneArithmetiqueDescendant();
vue.masquerMoyenneArithmetiqueAscendant();
vue.masquerPointsAscendant();
vue.masquerPointsDescendant();
if (triCourantTag == ModeTri.TRI_ASCENDANT) {
vue.masquerTagDescendant();
vue.afficherTagAscendant();
} else {
vue.masquerTagAscendant();
vue.afficherTagDescendant();
}
}
 
public void surClicTriMoyenneArithmetique() {
triCourantMoyenneArithmetique = (triCourantMoyenneArithmetique == ModeTri.TRI_ASCENDANT) ? ModeTri.TRI_DESCENDANT : ModeTri.TRI_ASCENDANT;
mettreAJourAffichageTriMoyenneArithmetique();
InformationsRecherche informationsRechercheImages = CacheClient.getInstance().getInformationsRechercheImage();
int IdProtocole = CacheClient.getInstance().getProtocoleCourant().getId();
informationsRechercheImages.setTriParMoyenneArithmetique(triCourantMoyenneArithmetique);
informationsRechercheImages.setIdProtocoleSelectionne(IdProtocole + "");
informationsRechercheImages.setTriParDatePublication(ModeTri.PAS_DE_TRI);
informationsRechercheImages.setTriParNbTags(ModeTri.PAS_DE_TRI);
informationsRechercheImages.setTriParNbPoints(ModeTri.PAS_DE_TRI);
chargerEtAfficherImagesPageEnCours();
}
private void mettreAJourAffichageTriMoyenneArithmetique() {
vue.masquerDateDescendant();
vue.masquerDateAscendant();
vue.masquerTagAscendant();
vue.masquerTagDescendant();
vue.masquerPointsAscendant();
vue.masquerPointsDescendant();
if (triCourantMoyenneArithmetique == ModeTri.TRI_ASCENDANT) {
vue.masquerMoyenneArithmetiqueDescendant();
vue.afficherMoyenneArithmetiqueAscendant();
} else {
vue.masquerMoyenneArithmetiqueAscendant();
vue.afficherMoyenneArithmetiqueDescendant();
}
}
 
public void surClicTriPoints() {
triCourantPoints = (triCourantPoints == ModeTri.TRI_ASCENDANT) ? ModeTri.TRI_DESCENDANT : ModeTri.TRI_ASCENDANT;
mettreAJourAffichageTriPoints();
InformationsRecherche informationsRechercheImages = CacheClient.getInstance().getInformationsRechercheImage();
int IdProtocole = CacheClient.getInstance().getProtocoleCourant().getId();
informationsRechercheImages.setTriParNbPoints(triCourantPoints);
informationsRechercheImages.setIdProtocoleSelectionne(IdProtocole + "");
informationsRechercheImages.setTriParDatePublication(ModeTri.PAS_DE_TRI);
informationsRechercheImages.setTriParNbTags(ModeTri.PAS_DE_TRI);
informationsRechercheImages.setTriParMoyenneArithmetique(ModeTri.PAS_DE_TRI);
chargerEtAfficherImagesPageEnCours();
}
private void mettreAJourAffichageTriPoints() {
vue.masquerDateDescendant();
vue.masquerDateAscendant();
vue.masquerTagAscendant();
vue.masquerTagDescendant();
vue.masquerMoyenneArithmetiqueAscendant();
vue.masquerMoyenneArithmetiqueDescendant();
if (triCourantPoints == ModeTri.TRI_ASCENDANT) {
vue.masquerPointsDescendant();
vue.afficherPointsAscendant();
} else {
vue.masquerPointsAscendant();
vue.afficherPointsDescendant();
}
}
 
public void surClicTriDate() {
triCourantDate = (triCourantDate == ModeTri.TRI_ASCENDANT) ? ModeTri.TRI_DESCENDANT : ModeTri.TRI_ASCENDANT;
mettreAJourAffichageTriDate();
InformationsRecherche informationsRechercheImages = CacheClient.getInstance().getInformationsRechercheImage();
informationsRechercheImages.setTriParDatePublication(triCourantDate);
informationsRechercheImages.setTriParMoyenneArithmetique(ModeTri.PAS_DE_TRI);
informationsRechercheImages.setTriParNbTags(ModeTri.PAS_DE_TRI);
informationsRechercheImages.setTriParNbPoints(ModeTri.PAS_DE_TRI);
chargerEtAfficherImagesPageEnCours();
}
private void mettreAJourAffichageTriDate() {
vue.masquerTagAscendant();
vue.masquerTagDescendant();
vue.masquerMoyenneArithmetiqueDescendant();
vue.masquerMoyenneArithmetiqueAscendant();
vue.masquerPointsAscendant();
vue.masquerPointsDescendant();
if (triCourantDate == ModeTri.TRI_ASCENDANT) {
vue.masquerDateDescendant();
vue.afficherDateAscendant();
} else {
vue.masquerDateAscendant();
vue.afficherDateDescendant();
}
}
 
public void rechercherImagesEtCreerWidgetPagination() {
// appel du service d'image pour avoir le nb total d'elements pour la
// pagination
ImagesParTaxonCallback callback = new ImagesParTaxonCallback() {
 
@Override
public void surRetour(ImageServiceResultat imagesRecues) {
creerWidgetPagination(imagesRecues.getNbTotalImagesPourLaRecherche());
afficherImages(imagesRecues);
 
}
 
@Override
public void surErreur(String messageErreur) {
Window.alert(messageErreur);
 
}
};
final int debut = (CacheClient.getInstance().getPageCouranteRechercheImage() - 1) * CacheClient.getInstance().getPasPagination();
final int fin = (CacheClient.getInstance().getPageCouranteRechercheImage()) * CacheClient.getInstance().getPasPagination();
imageService.getImagesParTaxon(CacheClient.getInstance().getInformationsRechercheImage(), debut, fin, callback);
}
 
private void chargerEtAfficherImages(final int premier, final int dernier) {
vue.startChargement();
vue.nettoyer();
ImagesParTaxonCallback callback = new ImagesParTaxonCallback() {
 
@Override
public void surRetour(ImageServiceResultat imagesRecues) {
afficherImages(imagesRecues);
}
 
@Override
public void surErreur(String messageErreur) {
Window.alert(messageErreur);
}
 
};
imageService.getImagesParTaxon(CacheClient.getInstance().getInformationsRechercheImage(), premier, dernier, callback);
}
 
public void afficherImages(ImageServiceResultat imageServiceResult) {
List<Image> images = imageServiceResult.getImages();
if (images == null || images.size() == 0) {
vue.afficherElementsAucunResultatTrouve();
} else {
vue.afficherElementsResultatsTrouve();
for (Image image : images) {
ImagePresenteur imagePresenteur = new ImagePresenteur(image, imageService, CacheClient.getInstance().getProtocoleCourant(), new ImageVue());
imagePresenteur.go(vue.getImageTable());
}
}
CacheClient.getInstance().mettreAjourUrlCourante();
vue.stopChargement();
}
 
private void creerWidgetPagination(int nbImages) {
PaginationPresenteur imagesPaginationPresenteurHaut = creerPresenteurPagination(nbImages);
PaginationPresenteur imagesPaginationPresenteurBas = creerPresenteurPagination(nbImages);
imagesPaginationPresenteurHaut.setGroupePagination("pagination_images");
imagesPaginationPresenteurBas.setGroupePagination("pagination_images");
imagesPaginationPresenteurHaut.go(vue.getPanneauPaginationHaut());
imagesPaginationPresenteurBas.go(vue.getPanneauPagination());
}
 
public PaginationPresenteur creerPresenteurPagination(int nbImages) {
PaginationPresenteur imagesPaginationPresenteur = new PaginationPresenteur(new PaginationVue(), nbImages, CacheClient.getInstance().getPasPagination(), CacheClient.getInstance().getPageCouranteRechercheImage()) {
@Override
public void chargerElements(int debut, int fin) {
chargerEtAfficherImages(debut, fin);
CacheClient.getInstance().setPageCouranteRechercheImages(getPageCourante());
}
 
@Override
public void actualiserPasCache(int pas) {
CacheClient.getInstance().setPasPagination(pas);
}
};
return imagesPaginationPresenteur;
}
 
public void chargerEtAfficherImagesPageEnCours() {
final int debut = (CacheClient.getInstance().getPageCouranteRechercheImage() - 1) * CacheClient.getInstance().getPasPagination();
final int fin = (CacheClient.getInstance().getPageCouranteRechercheImage()) * CacheClient.getInstance().getPasPagination();
chargerEtAfficherImages(debut, fin);
}
 
public Vue getVue() {
return vue;
}
}