Subversion Repositories eFlore/Applications.del

Rev

Rev 564 | Rev 674 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 564 Rev 570
1
package org.tela_botanica.del.client.composants.metadonnees;
1
package org.tela_botanica.del.client.composants.metadonnees;
2
 
2
 
3
import org.tela_botanica.del.client.cache.CacheClient;
3
import org.tela_botanica.del.client.cache.CacheClient;
4
import org.tela_botanica.del.client.composants.presenteur.Presenteur;
4
import org.tela_botanica.del.client.composants.presenteur.Presenteur;
5
import org.tela_botanica.del.client.modeles.InformationsRecherche;
5
import org.tela_botanica.del.client.modeles.InformationsRecherche;
6
import org.tela_botanica.del.client.modeles.ModeRecherche;
6
import org.tela_botanica.del.client.modeles.ModeRecherche;
7
import org.tela_botanica.del.client.modeles.Observation;
7
import org.tela_botanica.del.client.modeles.Observation;
8
import org.tela_botanica.del.client.navigation.evenement.BusEvenementiel;
8
import org.tela_botanica.del.client.navigation.evenement.BusEvenementiel;
9
import org.tela_botanica.del.client.navigation.evenement.detailsimage.EvenementRechercheImage;
9
import org.tela_botanica.del.client.navigation.evenement.detailsimage.EvenementRechercheImage;
10
import org.tela_botanica.del.client.navigation.evenement.rechercheobservation.EvenementRechercheObservation;
10
import org.tela_botanica.del.client.navigation.evenement.rechercheobservation.EvenementRechercheObservation;
11
 
11
 
12
import com.google.gwt.event.dom.client.ClickEvent;
12
import com.google.gwt.event.dom.client.ClickEvent;
13
import com.google.gwt.event.dom.client.ClickHandler;
13
import com.google.gwt.event.dom.client.ClickHandler;
14
import com.google.gwt.event.dom.client.HasClickHandlers;
14
import com.google.gwt.event.dom.client.HasClickHandlers;
15
import com.google.gwt.user.client.ui.HasText;
15
import com.google.gwt.user.client.ui.HasText;
16
import com.google.gwt.user.client.ui.HasWidgets;
16
import com.google.gwt.user.client.ui.HasWidgets;
17
import com.google.gwt.user.client.ui.IsWidget;
17
import com.google.gwt.user.client.ui.IsWidget;
18
 
18
 
19
public class MetadonneesPresenteur extends Presenteur {
19
public class MetadonneesPresenteur extends Presenteur {
20
 
20
 
21
	public abstract interface Vue extends IsWidget {
21
	public abstract interface Vue extends IsWidget {
22
		public HasText getNomRetenu();
22
		public HasText getNomRetenu();
23
 
23
 
24
		public HasClickHandlers getLienNomRetenu();
24
		public HasClickHandlers getLienNomRetenu();
25
 
25
 
26
		public HasText getNomCommun();
26
		public HasText getNomCommun();
27
 
27
 
28
		public HasText getFamille();
28
		public HasText getFamille();
29
 
29
 
30
		public HasText getLocalite();
30
		public HasText getLocalite();
31
 
31
 
32
		public HasText getLieuDit();
32
		public HasText getLieuDit();
33
 
33
 
34
		public HasText getMilieu();
34
		public HasText getMilieu();
35
 
35
 
36
		public HasText getCommentaire();
36
		public HasText getCommentaire();
37
 
37
 
38
		public HasText getAuteur();
38
		public HasText getAuteur();
39
 
39
 
40
		public HasText getDateTransmission();
40
		public HasText getDateTransmission();
41
 
41
 
42
		public HasText getMotsClefs();
42
		public HasText getMotsClefs();
43
 
43
 
44
		public HasText getNumNomenclatural();
44
		public HasText getNumNomenclatural();
45
 
45
 
46
		public HasText getDateReleve();
46
		public HasText getDateReleve();
47
 
47
 
48
		public HasClickHandlers getLienFamille();
48
		public HasClickHandlers getLienFamille();
49
 
49
 
50
		public HasClickHandlers getLienAuteur();
50
		public HasClickHandlers getLienAuteur();
51
 
51
 
52
		public HasClickHandlers getLienDateTransmission();
52
		public HasClickHandlers getLienDateTransmission();
53
 
53
 
54
		public HasClickHandlers getLienDateReleve();
54
		public HasClickHandlers getLienDateReleve();
55
 
55
 
56
		public HasClickHandlers getLienLocalite();
56
		public HasClickHandlers getLienLocalite();
57
 
57
 
58
		public HasClickHandlers getLienMotsClefs();
58
		public HasClickHandlers getLienMotsClefs();
59
 
59
 
60
		public HasClickHandlers getLienNumNomenclatural();
60
		public HasClickHandlers getLienNumNomenclatural();
61
 
61
 
62
		public HasClickHandlers getLienNomCommun();
62
		public HasClickHandlers getLienNomCommun();
63
 
63
 
64
		public HasClickHandlers getLienMilieu();
64
		public HasClickHandlers getLienMilieu();
65
 
65
 
66
		public HasClickHandlers getLienCommentaire();
66
		public HasClickHandlers getLienCommentaire();
-
 
67
		
-
 
68
		public void masquerChampsVides();
67
	}
69
	}
68
 
70
 
69
	private Vue vue;
71
	private Vue vue;
70
	private Observation observation;
72
	private Observation observation;
71
	private ModeRecherche modeRecherche;
73
	private ModeRecherche modeRecherche;
72
 
74
 
73
	public MetadonneesPresenteur(Vue vue, Observation observation, ModeRecherche modeRecherche) {
75
	public MetadonneesPresenteur(Vue vue, Observation observation, ModeRecherche modeRecherche) {
74
		this.vue = vue;
76
		this.vue = vue;
75
		this.modeRecherche = modeRecherche;
77
		this.modeRecherche = modeRecherche;
76
		setObservation(observation);
78
		setObservation(observation);
77
	}
79
	}
78
 
80
 
79
	public void setObservation(Observation observation) {
81
	public void setObservation(Observation observation) {
80
		this.observation = observation;
82
		this.observation = observation;
81
	}
83
	}
82
 
84
 
83
	public void chargerMetaDonnees() {
85
	public void chargerMetaDonnees() {
84
		vue.getNomRetenu().setText(observation.getNomRetenu());
86
		vue.getNomRetenu().setText(observation.getNomRetenu());
85
		vue.getNomCommun().setText(observation.getNomCommun());
87
		vue.getNomCommun().setText(observation.getNomCommun());
86
		vue.getFamille().setText(observation.getFamille());
88
		vue.getFamille().setText(observation.getFamille());
87
		vue.getLocalite().setText(observation.getLocaliteAvecIdFormatee());
89
		vue.getLocalite().setText(observation.getLocaliteAvecIdFormatee());
88
		vue.getLieuDit().setText(observation.getLieuDit());
90
		vue.getLieuDit().setText(observation.getLieuDit());
89
		vue.getMilieu().setText(observation.getMilieu());
91
		vue.getMilieu().setText(observation.getMilieu());
90
		vue.getCommentaire().setText(observation.getCommentaire());
92
		vue.getCommentaire().setText(observation.getCommentaire());
91
		vue.getAuteur().setText(observation.getAuteur());
93
		vue.getAuteur().setText(observation.getAuteur());
92
		vue.getDateTransmission().setText(observation.getDateTransmission());
94
		vue.getDateTransmission().setText(observation.getDateTransmission());
93
		vue.getDateReleve().setText(observation.getDateReleve());
95
		vue.getDateReleve().setText(observation.getDateReleve());
-
 
96
		
-
 
97
		vue.masquerChampsVides();
94
	}
98
	}
95
 
99
 
96
	@Override
100
	@Override
97
	public void go(HasWidgets composite) {
101
	public void go(HasWidgets composite) {
98
		composite.add(vue.asWidget());
102
		composite.add(vue.asWidget());
99
		chargerMetaDonnees();
103
		chargerMetaDonnees();
100
		gererEvenements();
104
		gererEvenements();
101
	}
105
	}
102
 
106
 
103
	@Override
107
	@Override
104
	protected void gererEvenements() {
108
	protected void gererEvenements() {
105
 
109
 
106
		vue.getLienAuteur().addClickHandler(new ClickHandler() {
110
		vue.getLienAuteur().addClickHandler(new ClickHandler() {
107
 
111
 
108
			@Override
112
			@Override
109
			public void onClick(ClickEvent arg0) {
113
			public void onClick(ClickEvent arg0) {
110
				InformationsRecherche informationsRecherche = new InformationsRecherche();
114
				InformationsRecherche informationsRecherche = new InformationsRecherche();
111
				informationsRecherche.setAuteur(vue.getAuteur().getText());
115
				informationsRecherche.setAuteur(vue.getAuteur().getText());
112
				setInfosRechercheEnCacheEtLancerEvenement(informationsRecherche);
116
				setInfosRechercheEnCacheEtLancerEvenement(informationsRecherche);
113
			}
117
			}
114
		});
118
		});
115
 
119
 
116
		vue.getLienDateReleve().addClickHandler(new ClickHandler() {
120
		vue.getLienDateReleve().addClickHandler(new ClickHandler() {
117
 
121
 
118
			@Override
122
			@Override
119
			public void onClick(ClickEvent arg0) {
123
			public void onClick(ClickEvent arg0) {
120
				InformationsRecherche informationsRecherche = new InformationsRecherche();
124
				InformationsRecherche informationsRecherche = new InformationsRecherche();
121
				informationsRecherche.setDate(vue.getDateReleve().getText());
125
				informationsRecherche.setDate(vue.getDateReleve().getText());
122
				setInfosRechercheEnCacheEtLancerEvenement(informationsRecherche);
126
				setInfosRechercheEnCacheEtLancerEvenement(informationsRecherche);
123
			}
127
			}
124
		});
128
		});
125
 
129
 
126
		vue.getLienDateTransmission().addClickHandler(new ClickHandler() {
130
		vue.getLienDateTransmission().addClickHandler(new ClickHandler() {
127
 
131
 
128
			@Override
132
			@Override
129
			public void onClick(ClickEvent arg0) {
133
			public void onClick(ClickEvent arg0) {
130
				InformationsRecherche informationsRecherche = new InformationsRecherche();
134
				InformationsRecherche informationsRecherche = new InformationsRecherche();
131
				informationsRecherche.setDate(vue.getDateReleve().getText());
135
				informationsRecherche.setDate(vue.getDateReleve().getText());
132
				setInfosRechercheEnCacheEtLancerEvenement(informationsRecherche);
136
				setInfosRechercheEnCacheEtLancerEvenement(informationsRecherche);
133
			}
137
			}
134
		});
138
		});
135
 
139
 
136
		vue.getLienFamille().addClickHandler(new ClickHandler() {
140
		vue.getLienFamille().addClickHandler(new ClickHandler() {
137
 
141
 
138
			@Override
142
			@Override
139
			public void onClick(ClickEvent arg0) {
143
			public void onClick(ClickEvent arg0) {
140
				InformationsRecherche informationsRecherche = new InformationsRecherche();
144
				InformationsRecherche informationsRecherche = new InformationsRecherche();
141
				informationsRecherche.setFamille(vue.getFamille().getText());
145
				informationsRecherche.setFamille(vue.getFamille().getText());
142
				setInfosRechercheEnCacheEtLancerEvenement(informationsRecherche);
146
				setInfosRechercheEnCacheEtLancerEvenement(informationsRecherche);
143
			}
147
			}
144
		});
148
		});
145
 
149
 
146
		vue.getLienLocalite().addClickHandler(new ClickHandler() {
150
		vue.getLienLocalite().addClickHandler(new ClickHandler() {
147
 
151
 
148
			@Override
152
			@Override
149
			public void onClick(ClickEvent arg0) {
153
			public void onClick(ClickEvent arg0) {
150
				InformationsRecherche informationsRecherche = new InformationsRecherche();
154
				InformationsRecherche informationsRecherche = new InformationsRecherche();
151
				informationsRecherche.setCommune(vue.getLocalite().getText());
155
				informationsRecherche.setCommune(vue.getLocalite().getText());
152
				setInfosRechercheEnCacheEtLancerEvenement(informationsRecherche);
156
				setInfosRechercheEnCacheEtLancerEvenement(informationsRecherche);
153
			}
157
			}
154
		});
158
		});
155
 
159
 
156
		vue.getLienMotsClefs().addClickHandler(new ClickHandler() {
160
		vue.getLienMotsClefs().addClickHandler(new ClickHandler() {
157
 
161
 
158
			@Override
162
			@Override
159
			public void onClick(ClickEvent arg0) {
163
			public void onClick(ClickEvent arg0) {
160
				InformationsRecherche informationsRecherche = new InformationsRecherche();
164
				InformationsRecherche informationsRecherche = new InformationsRecherche();
161
				informationsRecherche.setMotClef(vue.getMotsClefs().getText());
165
				informationsRecherche.setMotClef(vue.getMotsClefs().getText());
162
				setInfosRechercheEnCacheEtLancerEvenement(informationsRecherche);
166
				setInfosRechercheEnCacheEtLancerEvenement(informationsRecherche);
163
			}
167
			}
164
		});
168
		});
165
 
169
 
166
		vue.getLienNomCommun().addClickHandler(new ClickHandler() {
170
		vue.getLienNomCommun().addClickHandler(new ClickHandler() {
167
 
171
 
168
			@Override
172
			@Override
169
			public void onClick(ClickEvent arg0) {
173
			public void onClick(ClickEvent arg0) {
170
				InformationsRecherche informationsRecherche = new InformationsRecherche();
174
				InformationsRecherche informationsRecherche = new InformationsRecherche();
171
				informationsRecherche.setRechercheLibre(vue.getNomCommun().getText());
175
				informationsRecherche.setRechercheLibre(vue.getNomCommun().getText());
172
				setInfosRechercheEnCacheEtLancerEvenement(informationsRecherche);
176
				setInfosRechercheEnCacheEtLancerEvenement(informationsRecherche);
173
			}
177
			}
174
		});
178
		});
175
 
179
 
176
		vue.getLienNomRetenu().addClickHandler(new ClickHandler() {
180
		vue.getLienNomRetenu().addClickHandler(new ClickHandler() {
177
 
181
 
178
			@Override
182
			@Override
179
			public void onClick(ClickEvent arg0) {
183
			public void onClick(ClickEvent arg0) {
180
				InformationsRecherche informationsRecherche = new InformationsRecherche();
184
				InformationsRecherche informationsRecherche = new InformationsRecherche();
181
				informationsRecherche.setRechercheLibre(vue.getNomRetenu().getText());
185
				informationsRecherche.setRechercheLibre(vue.getNomRetenu().getText());
182
				setInfosRechercheEnCacheEtLancerEvenement(informationsRecherche);
186
				setInfosRechercheEnCacheEtLancerEvenement(informationsRecherche);
183
			}
187
			}
184
		});
188
		});
185
 
189
 
186
		vue.getLienMilieu().addClickHandler(new ClickHandler() {
190
		vue.getLienMilieu().addClickHandler(new ClickHandler() {
187
 
191
 
188
			@Override
192
			@Override
189
			public void onClick(ClickEvent arg0) {
193
			public void onClick(ClickEvent arg0) {
190
				InformationsRecherche informationsRecherche = new InformationsRecherche();
194
				InformationsRecherche informationsRecherche = new InformationsRecherche();
191
				informationsRecherche.setRechercheLibre(vue.getMilieu().getText());
195
				informationsRecherche.setRechercheLibre(vue.getMilieu().getText());
192
				setInfosRechercheEnCacheEtLancerEvenement(informationsRecherche);
196
				setInfosRechercheEnCacheEtLancerEvenement(informationsRecherche);
193
			}
197
			}
194
		});
198
		});
195
 
199
 
196
		vue.getLienCommentaire().addClickHandler(new ClickHandler() {
200
		vue.getLienCommentaire().addClickHandler(new ClickHandler() {
197
 
201
 
198
			@Override
202
			@Override
199
			public void onClick(ClickEvent arg0) {
203
			public void onClick(ClickEvent arg0) {
200
				InformationsRecherche informationsRecherche = new InformationsRecherche();
204
				InformationsRecherche informationsRecherche = new InformationsRecherche();
201
				informationsRecherche.setRechercheLibre(vue.getCommentaire().getText());
205
				informationsRecherche.setRechercheLibre(vue.getCommentaire().getText());
202
				setInfosRechercheEnCacheEtLancerEvenement(informationsRecherche);
206
				setInfosRechercheEnCacheEtLancerEvenement(informationsRecherche);
203
			}
207
			}
204
		});
208
		});
205
 
209
 
206
	}
210
	}
207
 
211
 
208
	public void setInfosRechercheEnCacheEtLancerEvenement(InformationsRecherche informationsRecherche) {
212
	public void setInfosRechercheEnCacheEtLancerEvenement(InformationsRecherche informationsRecherche) {
209
 
213
 
210
		switch (modeRecherche) {
214
		switch (modeRecherche) {
211
		case MODE_IMAGE:
215
		case MODE_IMAGE:
212
			CacheClient.getInstance().setPageCouranteRechercheImages(1);
216
			CacheClient.getInstance().setPageCouranteRechercheImages(1);
213
			CacheClient.getInstance().setInformationsRechercheImage(informationsRecherche);
217
			CacheClient.getInstance().setInformationsRechercheImage(informationsRecherche);
214
			BusEvenementiel.getInstance().fireEvent(new EvenementRechercheImage());
218
			BusEvenementiel.getInstance().fireEvent(new EvenementRechercheImage());
215
			break;
219
			break;
216
 
220
 
217
		case MODE_OBSERVATION:
221
		case MODE_OBSERVATION:
218
			CacheClient.getInstance().setPageCouranteRechercheObservations(1);
222
			CacheClient.getInstance().setPageCouranteRechercheObservations(1);
219
			CacheClient.getInstance().setInformationsRechercheObservation(informationsRecherche);
223
			CacheClient.getInstance().setInformationsRechercheObservation(informationsRecherche);
220
			BusEvenementiel.getInstance().fireEvent(new EvenementRechercheObservation());
224
			BusEvenementiel.getInstance().fireEvent(new EvenementRechercheObservation());
221
 
225
 
222
		default:
226
		default:
223
			break;
227
			break;
224
		}
228
		}
225
 
229
 
226
	}
230
	}
227
}
231
}