Subversion Repositories eFlore/Applications.del

Rev

Rev 500 | Rev 1069 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 500 Rev 1062
Line 1... Line 1...
1
package org.tela_botanica.del.client.vues.comparaisoneflore;
1
package org.tela_botanica.del.client.vues.comparaisoneflore;
Line 2... Line -...
2
 
-
 
3
import java.util.Date;
2
 
Line -... Line 3...
-
 
3
import java.util.List;
4
import java.util.List;
4
 
Line 5... Line 5...
5
 
5
import org.tela_botanica.del.client.i18n.I18n;
6
import org.tela_botanica.del.client.modeles.VoteProtocole;
6
import org.tela_botanica.del.client.utils.StringUtils;
7
 
-
 
8
import com.google.gwt.core.client.GWT;
-
 
9
import com.google.gwt.event.dom.client.HasClickHandlers;
7
 
10
import com.google.gwt.i18n.client.DateTimeFormat;
8
import com.google.gwt.core.client.GWT;
11
import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat;
9
import com.google.gwt.event.dom.client.HasClickHandlers;
-
 
10
import com.google.gwt.uibinder.client.UiBinder;
12
import com.google.gwt.uibinder.client.UiBinder;
11
import com.google.gwt.uibinder.client.UiField;
13
import com.google.gwt.uibinder.client.UiField;
12
import com.google.gwt.user.client.ui.Composite;
14
import com.google.gwt.user.client.ui.Composite;
13
import com.google.gwt.user.client.ui.HTMLPanel;
15
import com.google.gwt.user.client.ui.Image;
14
import com.google.gwt.user.client.ui.Image;
Line 21... Line 20...
21
 
20
 
22
	interface MyUiBinder extends UiBinder<Widget, ComparaisonEfloreVue> {
21
	interface MyUiBinder extends UiBinder<Widget, ComparaisonEfloreVue> {
Line 23... Line 22...
23
	}
22
	}
24
 
23
 
Line 25... Line 24...
25
	private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);
24
	private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);
26
	private int currentIndexImages;
25
	private int currentIndexImages=0;
-
 
26
 
-
 
27
	@UiField
-
 
28
	Label nomAuteur, dateObservation, famille, motsClefs, nomRetenu, nomCommun, localite, milieu, commentaires, nomEspeceEflore, nomAuteurEflore, localiteEflore, dateObservationEflore, texteEflore;
Line 27... Line 29...
27
 
29
 
28
	@UiField
30
	@UiField
Line 29... Line 31...
29
	Label nomAuteur, dateObservation, famille, motsClefs, validateurs, dateValidation, nomEspeceEflore, nomAuteurEflore, localiteEflore, dateObservationEflore;
31
	Label nomAuteurTitre, dateObservationTitre, familleTitre, motsClefsTitre, nomRetenuTitre, nomCommunTitre, localiteTitre, milieuTitre, commentairesTitre;
30
 
32
 
Line -... Line 33...
-
 
33
	@UiField
-
 
34
	Image imagePrincipale, imageEflore, scrollLeftImage, scrollRightImage;
-
 
35
 
31
	@UiField
36
	@UiField
32
	Image imagePrincipale, imageEflore, scrollLeftImage, scrollRightImage;
37
	Panel panneauChargement;
33
 
38
 
Line 34... Line 39...
34
	@UiField
39
	@UiField
Line 49... Line 54...
49
			motsClefsConcatenes = motsClefsConcatenes.subSequence(0, motsClefsConcatenes.lastIndexOf(",")).toString();
54
			motsClefsConcatenes = motsClefsConcatenes.subSequence(0, motsClefsConcatenes.lastIndexOf(",")).toString();
50
		} catch (Exception e) {
55
		} catch (Exception e) {
51
			// TODO: handle exception
56
			// TODO: handle exception
52
		}
57
		}
Line 53... Line 58...
53
 
58
 
54
		// validateurs
59
		if (StringUtils.checkStringNotNull(motsClefsConcatenes)) {
55
		String validateursConcatenes = "";
60
			motsClefs.setText(motsClefsConcatenes);
56
		try {
-
 
57
			/*for (VoteProtocole observationValidation : image.getVoteProtocoles()) {
61
		} else {
58
				validateursConcatenes += observationValidation.getContributeur() + ", ";
-
 
59
			}*/
-
 
60
			validateursConcatenes = validateursConcatenes.subSequence(0, validateursConcatenes.lastIndexOf(",")).toString();
62
			motsClefs.setVisible(false);
61
		} catch (Exception e) {
-
 
62
 
63
			motsClefsTitre.setVisible(false);
63
		}
-
 
64
 
64
		}
65
		// date derniere validation
65
		if (StringUtils.checkStringNotNull(image.getObservation().getAuteur())) {
66
		Date dateDerniereValidation = null;
66
			nomAuteur.setText(image.getObservation().getAuteur());
67
		try {
-
 
68
			/*for (VoteProtocole observationValidation : image.getVoteProtocoles()) {
67
		} else {
69
				if (dateDerniereValidation == null) {
-
 
70
					dateDerniereValidation = observationValidation.getDate();
-
 
71
				} else if (dateDerniereValidation.before(observationValidation.getDate())) {
68
			nomAuteur.setVisible(false);
72
					dateDerniereValidation = observationValidation.getDate();
-
 
73
				}
-
 
74
			}*/
-
 
75
		} catch (Exception e) {
69
			nomAuteurTitre.setVisible(false);
-
 
70
		}
-
 
71
		if (StringUtils.checkStringNotNull(image.getUrl())) {
76
		}
72
			imagePrincipale.setUrl(image.getUrl());
-
 
73
		}
-
 
74
		if (StringUtils.checkStringNotNull(image.getObservation().getDateReleve())) {
-
 
75
			dateObservation.setText(image.getObservation().getDateReleve());
-
 
76
		} else {
-
 
77
			dateObservation.setVisible(false);
-
 
78
			dateObservationTitre.setVisible(false);
-
 
79
		}
77
 
80
		if (StringUtils.checkStringNotNull(image.getObservation().getFamille())) {
-
 
81
			famille.setText(image.getObservation().getFamille());
-
 
82
		} else {
-
 
83
			famille.setVisible(false);
-
 
84
			familleTitre.setVisible(false);
-
 
85
		}
78
		motsClefs.setText(motsClefsConcatenes);
86
		if (StringUtils.checkStringNotNull(image.getObservation().getNomRetenu())) {
-
 
87
			nomRetenu.setText(image.getObservation().getNomRetenu());
-
 
88
		} else {
79
		nomAuteur.setText(image.getObservation().getAuteur());
89
			nomRetenu.setVisible(false);
-
 
90
			nomRetenuTitre.setVisible(false);
-
 
91
		}
80
		imagePrincipale.setUrl(image.getUrl());
92
		if (StringUtils.checkStringNotNull(image.getObservation().getNomCommun())) {
-
 
93
			nomCommun.setText(image.getObservation().getNomCommun());
-
 
94
		} else {
-
 
95
			nomCommun.setVisible(false);
-
 
96
			nomCommunTitre.setVisible(false);
-
 
97
		}
-
 
98
		if (StringUtils.checkStringNotNull(image.getObservation().getLocaliteAvecIdFormatee())) {
-
 
99
			localite.setText(image.getObservation().getLocaliteAvecIdFormatee());
-
 
100
		} else {
-
 
101
			localite.setVisible(false);
-
 
102
			localiteTitre.setVisible(false);
-
 
103
		}
81
		dateObservation.setText(image.getObservation().getDateReleve());
104
		if (StringUtils.checkStringNotNull(image.getObservation().getMilieu())) {
-
 
105
			milieu.setText(image.getObservation().getMilieu());
-
 
106
		} else {
82
		famille.setText(image.getObservation().getFamille());
107
			milieu.setVisible(false);
83
		validateurs.setText(validateursConcatenes);
108
			milieuTitre.setVisible(false);
84
 
109
		}
85
		if (dateDerniereValidation != null) {
110
		if (StringUtils.checkStringNotNull(image.getObservation().getCommentaire())) {
-
 
111
			commentaires.setText(image.getObservation().getCommentaire());
-
 
112
		} else {
-
 
113
			commentaires.setVisible(false);
86
			dateValidation.setText(DateTimeFormat.getFormat(PredefinedFormat.DATE_SHORT).format(dateDerniereValidation));
114
			commentairesTitre.setVisible(false);
Line 87... Line 115...
87
		}
115
		}
Line 88... Line 116...
88
 
116
 
Line -... Line 117...
-
 
117
	}
-
 
118
 
89
	}
119
	public void chargerImagesEflore(List<org.tela_botanica.del.client.modeles.Image> observationsEflore, int indexImage) {
90
 
120
 
91
	public void chargerImagesEflore(List<org.tela_botanica.del.client.modeles.Image> observationsEflore, int indexImage) {
121
		texteEflore.setText(I18n.getVocabulary().imageEflore());
Line 92... Line 122...
92
 
122
 
Line 99... Line 129...
99
		nomEspeceEflore.setText(observationEflore.getObservation().getNomRetenu());
129
		nomEspeceEflore.setText(observationEflore.getObservation().getNomRetenu());
100
		nomAuteurEflore.setText(observationEflore.getObservation().getAuteur());
130
		nomAuteurEflore.setText(observationEflore.getObservation().getAuteur());
101
		imageEflore.setUrl(observationEflore.getUrl());
131
		imageEflore.setUrl(observationEflore.getUrl());
102
		dateObservationEflore.setText(observationEflore.getObservation().getDateReleve());
132
		dateObservationEflore.setText(observationEflore.getObservation().getDateReleve());
103
		localiteEflore.setText(observationEflore.getObservation().getLocalite());
133
		localiteEflore.setText(observationEflore.getObservation().getLocalite());
-
 
134
		metadonneesEflore.setVisible(true);
-
 
135
		imageEflore.setVisible(true);
Line -... Line 136...
-
 
136
 
-
 
137
		if (observationsEflore.size() > 1) {
-
 
138
			scrollLeftImage.setVisible(true);
-
 
139
			scrollRightImage.setVisible(true);
104
 
140
		}
Line 105... Line 141...
105
	}
141
	}
106
 
142
 
107
	public void setScrollLeftImage(Image scrollLeftImage) {
143
	public void setScrollLeftImage(Image scrollLeftImage) {
Line 121... Line 157...
121
	public HasClickHandlers getScrollRightImage() {
157
	public HasClickHandlers getScrollRightImage() {
122
		return scrollRightImage;
158
		return scrollRightImage;
123
	}
159
	}
Line 124... Line 160...
124
 
160
 
-
 
161
	public void startChargement() {
-
 
162
		texteEflore.setText(I18n.getVocabulary().chargement());
-
 
163
		metadonneesEflore.setVisible(false);
-
 
164
		imageEflore.setVisible(false);
-
 
165
		scrollLeftImage.setVisible(false);
125
	public void startChargement() {
166
		scrollRightImage.setVisible(false);
126
		panneauChargement.setVisible(true);
167
		panneauChargement.setVisible(true);
Line 127... Line 168...
127
	}
168
	}
128
 
169
 
129
	public void stopChargement() {
170
	public void stopChargement() {
Line -... Line 171...
-
 
171
		panneauChargement.setVisible(false);
-
 
172
	}
-
 
173
 
-
 
174
	public void afficherAucuneImageTrouvee() {
-
 
175
		texteEflore.setText(I18n.getVocabulary().aucunResultat());
-
 
176
		scrollLeftImage.setVisible(false);
-
 
177
		scrollRightImage.setVisible(false);
130
		panneauChargement.setVisible(false);
178
		panneauChargement.setVisible(false);
131
	}
179
	}
132
 
180
 
Line 133... Line 181...
133
	public Label getNomAuteur() {
181
	public Label getNomAuteur() {
134
		return nomAuteur;
182
		return nomAuteur;
135
	}
183
	}
Line -... Line 184...
-
 
184
 
-
 
185
	public Image getImagePrincipale() {
-
 
186
		return imagePrincipale;
-
 
187
	}
-
 
188
 
-
 
189
	public HTMLPanel getFormulaireRecherche() {
-
 
190
		return formulaireRecherche;
136
 
191
	}