Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 101 Rev 138
Line 1... Line 1...
1
package org.tela_botanica.client;
1
package org.tela_botanica.client;
Line 2... Line 2...
2
 
2
 
3
import org.tela_botanica.client.image.ImageMediateur;
3
import org.tela_botanica.client.image.ImageMediateur;
-
 
4
import org.tela_botanica.client.interfaces.Rafraichissable;
4
import org.tela_botanica.client.interfaces.Rafraichissable;
5
import org.tela_botanica.client.modeles.Configuration;
Line 5... Line 6...
5
import org.tela_botanica.client.modeles.Utilisateur;
6
import org.tela_botanica.client.modeles.Utilisateur;
6
 
7
 
7
import org.tela_botanica.client.observation.ObservationMediateur;
8
import org.tela_botanica.client.observation.ObservationMediateur;
Line -... Line 9...
-
 
9
import org.tela_botanica.client.vues.EtatConnexionVue;
-
 
10
import org.tela_botanica.client.vues.FormulaireDeConnexionVue;
-
 
11
 
-
 
12
import com.google.gwt.core.client.JavaScriptObject;
8
import org.tela_botanica.client.vues.EtatConnexionVue;
13
import com.google.gwt.user.client.DOM;
9
import org.tela_botanica.client.vues.FormulaireDeConnexionVue;
14
import com.google.gwt.user.client.Event;
-
 
15
import com.google.gwt.user.client.Timer;
10
 
16
import com.google.gwt.user.client.Window;
11
import com.google.gwt.user.client.Window;
17
import com.google.gwt.user.client.ui.Image;
-
 
18
import com.gwtext.client.core.EventObject;
-
 
19
import com.gwtext.client.core.Function;
12
import com.google.gwt.user.client.ui.Image;
20
import com.gwtext.client.widgets.BoxComponent;
13
import com.gwtext.client.core.Function;
21
import com.gwtext.client.widgets.Component;
14
import com.gwtext.client.widgets.BoxComponent;
22
import com.gwtext.client.widgets.Container;
-
 
23
import com.gwtext.client.widgets.Panel;
-
 
24
import com.gwtext.client.widgets.TabPanel;
-
 
25
import com.gwtext.client.widgets.Tool;
-
 
26
import com.gwtext.client.widgets.ToolTip;
15
import com.gwtext.client.widgets.Panel;
27
import com.gwtext.client.widgets.event.ContainerListener;
16
import com.gwtext.client.widgets.TabPanel;
28
import com.gwtext.client.widgets.event.ContainerListenerAdapter;
17
import com.gwtext.client.widgets.Tool;
29
import com.gwtext.client.widgets.event.PanelListener;
18
import com.gwtext.client.widgets.event.PanelListenerAdapter;
30
import com.gwtext.client.widgets.event.PanelListenerAdapter;
Line 92... Line 104...
92
	/**
104
	/**
93
	 * 
105
	 * 
94
	 */
106
	 */
95
	private Panel bandeau = null ;
107
	private Panel bandeau = null ;
Line -... Line 108...
-
 
108
	
Line 96... Line 109...
96
	
109
	Tool cacherPanneau = null ;
97
	
110
	
98
	/**
111
	/**
Line 105... Line 118...
105
	 * Mediateur Gestion des observations
118
	 * Mediateur Gestion des observations
106
	 */
119
	 */
Line 107... Line 120...
107
	
120
	
Line -... Line 121...
-
 
121
	private ObservationMediateur observationMediateur=null;
-
 
122
	
-
 
123
	/**
-
 
124
	 * Un tooltip pour l'aide
Line 108... Line 125...
108
	private ObservationMediateur observationMediateur=null;
125
	 */
109
	
126
	private ToolTip tp = new ToolTip() ;
110
 
127
 
Line 149... Line 166...
149
		
166
		
Line 150... Line 167...
150
		carnetEnLigneModele=CarnetEnLigneModele.Instance();
167
		carnetEnLigneModele=CarnetEnLigneModele.Instance();
151
		
168
		
-
 
169
		
-
 
170
		//Image bandeau = new Image("Bandeau-haut.gif") ;
152
		
171
		bandeau = new Panel();
-
 
172
		Image logoND = new Image("logo_n_d.gif") ;
-
 
173
		logoND.setStylePrimaryName("x-img-logo_nd") ;
-
 
174
		final Image img = new Image("bandeau-haut.gif") {
-
 
175
			public void onBrowserEvent(Event e) {
-
 
176
				
-
 
177
				if(DOM.eventGetType(e) == Event.ONCLICK)
-
 
178
				{
-
 
179
					bandeau.toggleCollapse(true);
-
 
180
				}
-
 
181
				if(DOM.eventGetType(e) == Event.ONMOUSEOVER) {
-
 
182
					tp.setHtml("<div class=\"x-tooltip-help\"> Cliquez sur l'image ou sur la flèche en haut à droite pour replier le panneau </div>");
-
 
183
					tp.showAt(0,0);
-
 
184
				}
-
 
185
				
-
 
186
				
-
 
187
				if(DOM.eventGetType(e) == Event.ONMOUSEOUT) {
-
 
188
					if(tp.isVisible()) {
-
 
189
						tp.hide();
-
 
190
					}
-
 
191
				}
-
 
192
			}
-
 
193
		};
-
 
194
		bandeau.add(img) ;
153
		//Image bandeau = new Image("Bandeau-haut.gif") ;
195
		img.setSize("50%", "100%");
154
		bandeau = new Panel() ;
196
		bandeau.add(logoND) ;
155
		bandeau.add(new Image("bandeau-haut.gif")) ;
197
		logoND.setSize("10%", "100%");
156
		bandeau.setId("x-up-bandeau") ;
198
		bandeau.setId("x-up-bandeau") ;
157
		bandeau.setBorder(false) ;
199
		bandeau.setBorder(false) ;
158
		// La vue affichant le statut de la connexion 
200
		// La vue affichant le statut de la connexion 
Line 159... Line 201...
159
		bandeau.setSize(800,100) ;
201
		bandeau.setSize("60%","80%") ;
Line 160... Line 202...
160
		etatConnexionVue=new EtatConnexionVue(this);
202
		etatConnexionVue=new EtatConnexionVue(this);
Line 161... Line 203...
161
		etatConnexionVue.setLayout(new FitLayout()) ;
203
		etatConnexionVue.setLayout(new FitLayout()) ;
162
		
204
		
Line -... Line 205...
-
 
205
		// Le panneau à onglet qui contient les 2 applications Observation et Images 
163
		// Le panneau à onglet qui contient les 2 applications Observation et Images 
206
		
-
 
207
		ongletsObservationsImages = new TabPanel();
Line 164... Line 208...
164
		
208
		
165
		ongletsObservationsImages = new TabPanel();
-
 
166
		
209
		panneauPrincipalCarnetEnLigne.add(etatConnexionVue,new RowLayoutData(20));
Line 167... Line 210...
167
		panneauPrincipalCarnetEnLigne.add(etatConnexionVue,new RowLayoutData(20));
210
		panneauPrincipalCarnetEnLigne.add(bandeau, new RowLayoutData("10%")) ;
Line 168... Line 211...
168
		panneauPrincipalCarnetEnLigne.add(bandeau) ;
211
		
169
		
-
 
170
		//	on ajoute le panneau a onglet au panneau principal
-
 
171
		
212
		img.sinkEvents(Event.ONCLICK);
172
		panneauPrincipalCarnetEnLigne.add(ongletsObservationsImages);
-
 
173
		
213
		img.sinkEvents(Event.ONMOUSEOVER);
174
		panneauPrincipalCarnetEnLigne.addTool(new Tool(Tool.UP, new Function() {
214
		img.sinkEvents(Event.ONMOUSEOUT);
175
 
-
 
176
			public void execute() {
215
		
177
				
216
		//	on ajoute le panneau a onglet au panneau principal
Line 178... Line 217...
178
				if(!bandeau.isCollapsed()) {
217
		cacherPanneau = new Tool(Tool.TOGGLE, new Function() {
Line 179... Line 218...
179
					
218
 
-
 
219
			public void execute() {
-
 
220
				
-
 
221
				if(!bandeau.isCollapsed()) {
-
 
222
					bandeau.toggleCollapse(true) ;
-
 
223
				}
-
 
224
				else {
-
 
225
					bandeau.toggleCollapse(true) ;
-
 
226
				}
-
 
227
				
-
 
228
			}
-
 
229
			
-
 
230
		}) ;
-
 
231
		
-
 
232
		
-
 
233
		Tool iconeAide = new Tool(Tool.HELP, new Function() {
-
 
234
 
Line 180... Line -...
180
					etatConnexionVue.toggleCollapse(true) ;
-
 
181
					bandeau.toggleCollapse(true) ;
235
			public void execute() {
182
					
236
				String aideUrl = Configuration.getAideBaseUrl() ;
183
				}
237
				Window.open(aideUrl, "", "") ;		
Line 184... Line 238...
184
				else {
238
			}
185
					etatConnexionVue.toggleCollapse(true) ;
239
			
186
					bandeau.toggleCollapse(true) ;
-
 
187
				}
-
 
188
				
-
 
189
			}
-
 
190
			
-
 
Line 191... Line 240...
191
		})) ;
240
		}) ;
192
		
241
		
193
	
242
		panneauPrincipalCarnetEnLigne.add(ongletsObservationsImages);
Line 236... Line 285...
236
	/**
285
	/**
237
	 * Deconnecte l'utilisateur passe en parametre
286
	 * Deconnecte l'utilisateur passe en parametre
238
	 */
287
	 */
239
    public void deconnecterUtilisateur() {
288
    public void deconnecterUtilisateur() {
Line 240... Line -...
240
 
-
 
-
 
289
 
241
			
290
    	// TODO: vider proprement toutes les vues (méthode à voir)
Line -... Line 291...
-
 
291
		carnetEnLigneModele.deconnecterUtilisateur(this, utilisateur.getIdentifiant());
242
		carnetEnLigneModele.deconnecterUtilisateur(this, utilisateur.getIdentifiant());
292
		
Line 243... Line 293...
243
		
293
		observationMediateur.deconnecterUtilisateur() ;
Line 244... Line 294...
244
	}
294
	}
Line 285... Line 335...
285
		  
335
		  
286
		  // On le positionne à peu près au milieu de l'écran
336
		  // On le positionne à peu près au milieu de l'écran
287
		  int left = (Window.getClientWidth() - 512) / 2;
337
		  int left = (Window.getClientWidth() - 512) / 2;
Line 288... Line -...
288
		  int top = (Window.getClientHeight() - 256) / 2;
-
 
289
		  
338
		  int top = (Window.getClientHeight() - 256) / 2;
290
		  
339
		  
Line 291... Line 340...
291
		  formulaireDeConnexionVue.setPopupPosition(left, top);
340
		  formulaireDeConnexionVue.setPopupPosition(left, top);
Line 306... Line 355...
306
	public void rafraichir(Object nouvelleDonnees, boolean repandreRaffraichissement) {
355
	public void rafraichir(Object nouvelleDonnees, boolean repandreRaffraichissement) {
Line 307... Line 356...
307
 
356
 
Line 308... Line 357...
308
			if (nouvelleDonnees instanceof Utilisateur) {
357
			if (nouvelleDonnees instanceof Utilisateur) {
309
							      
-
 
310
				utilisateur = (Utilisateur) nouvelleDonnees;
-
 
Line 311... Line 358...
311
				
358
							      
Line 312... Line 359...
312
				imageMediateur.connecterUtilisateur() ;
359
				utilisateur = (Utilisateur) nouvelleDonnees;
Line 321... Line 368...
321
					if ((tentativeConnection) && utilisateur.isIdentifie()) {						
368
					if ((tentativeConnection) && utilisateur.isIdentifie()) {						
322
						formulaireDeConnexionVue.hide();
369
						formulaireDeConnexionVue.hide();
323
					}
370
					}
324
				}
371
				}
Line 325... Line -...
325
 
-
 
-
 
372
 
326
				
373
				imageMediateur.setIdentifiant(utilisateur.getIdentifiant());
327
			// On lance l'affichage des observations
374
			// On lance l'affichage des observations
Line 328... Line 375...
328
				observationMediateur.obtenirNombreObservation();
375
				observationMediateur.obtenirNombreObservation();