Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 195 Rev 201
Line 1... Line 1...
1
package org.tela_botanica.client.vues.observation;
1
package org.tela_botanica.client.vues.observation;
Line 2... Line -...
2
 
-
 
-
 
2
 
Line 3... Line 3...
3
 
3
// TODO Detecter redim et supprimer ajuster
Line 4... Line 4...
4
 
4
 
5
import java.util.Iterator;
5
import java.util.Iterator;
Line 29... Line 29...
29
import com.gwtext.client.widgets.Panel;
29
import com.gwtext.client.widgets.Panel;
30
import com.gwtext.client.widgets.Toolbar;
30
import com.gwtext.client.widgets.Toolbar;
31
import com.gwtext.client.widgets.event.BoxComponentListenerAdapter;
31
import com.gwtext.client.widgets.event.BoxComponentListenerAdapter;
32
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
32
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
33
import com.gwtext.client.widgets.event.ContainerListenerAdapter;
33
import com.gwtext.client.widgets.event.ContainerListenerAdapter;
-
 
34
import com.gwtext.client.widgets.event.PanelListenerAdapter;
34
import com.gwtext.client.widgets.form.ComboBox;
35
import com.gwtext.client.widgets.form.ComboBox;
35
import com.gwtext.client.widgets.form.DateField;
36
import com.gwtext.client.widgets.form.DateField;
36
import com.gwtext.client.widgets.form.FormPanel;
37
import com.gwtext.client.widgets.form.FormPanel;
37
import com.gwtext.client.widgets.form.TextArea;
38
import com.gwtext.client.widgets.form.TextArea;
38
import com.gwtext.client.widgets.form.TextField;
39
import com.gwtext.client.widgets.form.TextField;
39
import com.gwtext.client.widgets.form.event.ComboBoxListenerAdapter;
40
import com.gwtext.client.widgets.form.event.ComboBoxListenerAdapter;
-
 
41
import com.gwtext.client.widgets.layout.AnchorLayoutData;
40
import com.gwtext.client.widgets.layout.ColumnLayout;
42
import com.gwtext.client.widgets.layout.ColumnLayout;
41
import com.gwtext.client.widgets.layout.ColumnLayoutData;
43
import com.gwtext.client.widgets.layout.ColumnLayoutData;
42
import com.gwtext.client.widgets.layout.FormLayout;
44
import com.gwtext.client.widgets.layout.FormLayout;
43
import com.gwtext.client.data.Record;
45
import com.gwtext.client.data.Record;
Line 101... Line 103...
101
	private final int KEY_RIGHT = 39;
103
	private final int KEY_RIGHT = 39;
102
	private final int KEY_SHIFT = 16;
104
	private final int KEY_SHIFT = 16;
103
	private final int KEY_TAB = 9;
105
	private final int KEY_TAB = 9;
104
	private final int KEY_UP = 38;
106
	private final int KEY_UP = 38;
Line 105... Line -...
105
	
-
 
Line 106... Line 107...
106
	private int tailleChamps = 350 ;
107
	
107
	
108
	
108
	/**
109
	/**
109
	 * Combobox permettant de selectionner le mode
110
	 * Combobox permettant de selectionner le mode
Line 134... Line 135...
134
	public FormulaireSaisieObservationVue(ObservationMediateur obs)
135
	public FormulaireSaisieObservationVue(ObservationMediateur obs)
135
	{
136
	{
136
		// on associe le médiateur
137
		// on associe le médiateur
137
		observationMediateur = obs ;
138
		observationMediateur = obs ;
Line 138... Line 139...
138
		
139
		
139
		
-
 
140
		setHeader(true);
-
 
141
		
140
	     	
142
		FormPanel panneauFormulaire = new FormPanel(Position.RIGHT);
141
		FormPanel panneauFormulaire = new FormPanel(Position.RIGHT);
Line 143... Line 142...
143
		panneauFormulaire.setBorder(false);
142
		panneauFormulaire.setBorder(false);
Line 144... Line 143...
144
		
143
		
145
		// Panneau intermediaire qui contient deux colonnes de formulaire
144
		// Panneau intermediaire qui contient deux colonnes de formulaire
146
		
145
		
Line 147... Line 146...
147
		Panel panneauIntermediaire = new Panel();  
146
		final Panel panneauIntermediaire = new Panel();  
148
		panneauIntermediaire.setLayout(new ColumnLayout());  
147
		panneauIntermediaire.setLayout(new ColumnLayout());  
Line 160... Line 159...
160
		
159
		
Line 161... Line 160...
161
		this.setPaddings(5) ;
160
		this.setPaddings(5) ;
Line 162... Line 161...
162
	
161
	
Line 163... Line 162...
163
		// Accesskey pour debugging
162
		// Accesskey pour debugging
164
		
163
		
165
		commune=new ComboBox("Commune","commune\" accesskey=\"1",tailleChamps );  
164
		commune=new ComboBox("Commune","commune\" accesskey=\"1");  
166
		
165
		
Line 173... Line 172...
173
		commune.setLoadingText("Recherche...");  
172
		commune.setLoadingText("Recherche...");  
Line 174... Line 173...
174
		  
173
		  
175
		commune.setHideTrigger(true);
174
		commune.setHideTrigger(true);
Line 176... Line 175...
176
		commune.setTabIndex(1);
175
		commune.setTabIndex(1);
Line 177... Line 176...
177
		
176
		
178
	    panneauPremierColonne.add(commune);  
177
	    panneauPremierColonne.add(commune, new AnchorLayoutData("95%"));  
179
 
178
 
180
	    station = new TextField("Station", "station", tailleChamps);  
179
	    station = new TextField("Station", "station");  
Line 181... Line 180...
181
	    station.setAllowBlank(true);
180
	    station.setAllowBlank(true);
182
	    station.setTabIndex(3);
181
	    station.setTabIndex(3);
183
	    panneauPremierColonne.add(station);  
182
	    panneauPremierColonne.add(station, new AnchorLayoutData("95%"));  
184
	    
183
	    
185
	    date = new DateField("Date", "date", 100);  
184
	    date = new DateField("Date", "date", 100);  
186
	    date.setAllowBlank(true);
185
	    date.setAllowBlank(true);
Line 187... Line 186...
187
	    formatDate = "d/m/Y";
186
	    formatDate = "d/m/Y";
Line 188... Line 187...
188
	    date.setFormat(formatDate) ;
187
	    date.setFormat(formatDate) ;
Line 204... Line 203...
204
		espece.setLoadingText("Recherche...");  
203
		espece.setLoadingText("Recherche...");  
Line 205... Line 204...
205
		  
204
		  
206
		espece.setHideTrigger(true);
205
		espece.setHideTrigger(true);
Line 207... Line 206...
207
		espece.setTabIndex(6);
206
		espece.setTabIndex(6);
Line 208... Line 207...
208
 
207
 
209
	    panneauPremierColonne.add(espece);   
208
	    panneauPremierColonne.add(espece, new AnchorLayoutData("95%"));   
210
	    
209
	    
211
	    lieudit = new TextField("Lieu-dit", "lieudit", tailleChamps);  
210
	    lieudit = new TextField("Lieu-dit", "lieudit");  
Line 212... Line 211...
212
	    lieudit.setAllowBlank(true);
211
	    lieudit.setAllowBlank(true);
213
	    lieudit.setTabIndex(2);
212
	    lieudit.setTabIndex(2);
214
	    panneauSecondeColonne.add(lieudit);  
213
	    panneauSecondeColonne.add(lieudit,  new AnchorLayoutData("95%"));  
215
	       
214
	       
Line 216... Line 215...
216
	
215
	
217
	    milieu = new TextField("Milieu", "milieu", tailleChamps);  
216
	    milieu = new TextField("Milieu", "milieu");  
218
	    milieu.setAllowBlank(true);
217
	    milieu.setAllowBlank(true);
219
	    milieu.setTabIndex(4);
-
 
220
	    panneauSecondeColonne.add(milieu);
218
	    milieu.setTabIndex(4);
221
	    
219
	    panneauSecondeColonne.add(milieu,  new AnchorLayoutData("95%"));
Line 222... Line 220...
222
	    comment = new TextArea("Notes", "comment");  
220
	    
223
	    comment.setAllowBlank(true);
221
	    comment = new TextArea("Notes", "comment");  
Line 224... Line 222...
224
	    comment.setHeight(50);
222
	    comment.setAllowBlank(true);
Line 268... Line 266...
268
	
266
	
269
		this.add(panneauFormulaire) ;
267
		this.add(panneauFormulaire) ;
Line 270... Line 268...
270
		this.setTopToolbar(bt) ;
268
		this.setTopToolbar(bt) ;
271
		
269
		
Line -... Line 270...
-
 
270
		this.setAutoScroll(true);
-
 
271
		this.setAutoHeight(true);
-
 
272
	
-
 
273
	
-
 
274
		
-
 
275
		panneauFormulaire.addListener(new PanelListenerAdapter() {
-
 
276
	        public void onResize(BoxComponent component, int adjWidth, int adjHeight, int rawWidth, int rawHeight) {
-
 
277
	        	panneauIntermediaire.setWidth(rawWidth);
272
		this.setAutoScroll(true);
278
	        	panneauIntermediaire.setHeight(rawHeight);
-
 
279
	     }});
-
 
280
		
273
		//this.setAutoHeight(true);
281
		
Line 274... Line 282...
274
	
282
		// on ajoute les listeners
Line 275... Line 283...
275
	
283
		
276
		// on ajoute les listeners
284
		
-
 
285
		ajouterListeners() ;
-
 
286
		
-
 
287
	}
-
 
288
	
277
		ajouterListeners() ;
289
	private void ajouterListeners()
Line 278... Line 290...
278
		
290
	{	
279
	}
291
		
280
	
292
		
Line 523... Line 535...
523
			
535
			
Line 524... Line 536...
524
		});
536
		});
525
		
537
		
526
		this.addListener(new ContainerListenerAdapter() {
-
 
527
			public void onAfterLayout(Container self) {
-
 
528
				
538
		this.addListener(new ContainerListenerAdapter() {
529
				ajusterTailleChamps();
539
			public void onAfterLayout(Container self) {
530
				commune.focus();
540
				commune.focus();
Line 531... Line -...
531
			}
-
 
532
		});	
-
 
533
		
-
 
534
		this.addListener(new BoxComponentListenerAdapter() {
-
 
535
				public void onResize(BoxComponent component, int adjWidth, int adjHeight, int rawWidth, int rawHeight)  {
-
 
536
				
-
 
537
				ajusterTailleChamps();
541
			}
Line 538... Line 542...
538
			}
542
		});	
539
		});
543
		
540
	}
544
	}
Line 905... Line 909...
905
		else {
909
		else {
906
			return false;
910
			return false;
907
		}
911
		}
908
	}
912
	}
Line 909... Line -...
909
	
-
 
910
	private void ajusterTailleChamps() {
-
 
911
		
-
 
912
		int tailleChamps = (this.getInnerWidth()/100)*40;
-
 
913
		
-
 
914
		this.tailleChamps = tailleChamps ;
-
 
915
		
-
 
916
		commune.setWidth(tailleChamps);
-
 
917
		station.setWidth(tailleChamps);
-
 
918
		espece.setWidth(tailleChamps);
-
 
919
		lieudit.setWidth(tailleChamps);
-
 
920
		milieu.setWidth(tailleChamps);
-
 
921
		comment.setWidth(tailleChamps);
-
 
922
 
-
 
Line 923... Line 913...
923
	}
913