Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 481 Rev 989
1
package org.tela_botanica.client.vues.observation;
1
package org.tela_botanica.client.vues.observation;
2
 
2
 
3
import org.tela_botanica.client.modeles.Configuration;
3
import org.tela_botanica.client.modeles.objets.Configuration;
4
import org.tela_botanica.client.observation.ObservationMediateur;
4
import org.tela_botanica.client.observation.ObservationMediateur;
5
import com.google.gwt.user.client.ui.FileUpload;
5
import com.google.gwt.user.client.ui.FileUpload;
6
import com.google.gwt.user.client.ui.FormPanel;
6
import com.google.gwt.user.client.ui.FormPanel;
7
import com.google.gwt.user.client.ui.FormPanel.SubmitCompleteEvent;
7
import com.google.gwt.user.client.ui.FormPanel.SubmitCompleteEvent;
8
import com.google.gwt.user.client.ui.FormPanel.SubmitCompleteHandler;
8
import com.google.gwt.user.client.ui.FormPanel.SubmitCompleteHandler;
9
import com.google.gwt.user.client.ui.HTML;
9
import com.google.gwt.user.client.ui.HTML;
10
import com.google.gwt.user.client.ui.HasAlignment;
10
import com.google.gwt.user.client.ui.HasAlignment;
11
import com.google.gwt.user.client.ui.Hidden;
11
import com.google.gwt.user.client.ui.Hidden;
12
import com.google.gwt.user.client.ui.VerticalPanel;
12
import com.google.gwt.user.client.ui.VerticalPanel;
13
import com.gwtext.client.core.EventObject;
13
import com.gwtext.client.core.EventObject;
14
import com.gwtext.client.widgets.Button;
14
import com.gwtext.client.widgets.Button;
15
import com.gwtext.client.widgets.Window;
15
import com.gwtext.client.widgets.Window;
16
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
16
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
17
 
17
 
18
public class FormulaireImportObservationVue {
18
public class FormulaireImportObservationVue {
19
	
19
	
20
	private ObservationMediateur oMediateur = null;
20
	private ObservationMediateur oMediateur = null;
21
	private  Window nPan = null;
21
	private  Window nPan = null;
22
	private Hidden identifiant = null;
22
	private Hidden identifiant = null;
23
	
23
	
24
	
24
	
25
	public FormulaireImportObservationVue(ObservationMediateur om) {
25
	public FormulaireImportObservationVue(ObservationMediateur om) {
26
	
26
	
27
		this.oMediateur = om;
27
		this.oMediateur = om;
28
 
28
 
29
		nPan = new Window("Import d'observations");
29
		nPan = new Window("Import d'observations");
30
		identifiant = new Hidden();
30
		identifiant = new Hidden();
31
		identifiant.setName("identifiant");
31
		identifiant.setName("identifiant");
32
		
32
		
33
		final FormPanel form = new FormPanel();
33
		final FormPanel form = new FormPanel();
34
		final Button boutonValidation = new Button("envoyer");
34
		final Button boutonValidation = new Button("envoyer");
35
		
35
		
36
		form.setEncoding(FormPanel.ENCODING_MULTIPART);
36
		form.setEncoding(FormPanel.ENCODING_MULTIPART);
37
		form.setMethod(FormPanel.METHOD_POST);
37
		form.setMethod(FormPanel.METHOD_POST);
38
		form.setWidth("275px");
38
		form.setWidth("275px");
39
		nPan.setWidth("275px");
39
		nPan.setWidth("275px");
40
 
40
 
41
		VerticalPanel holder = new VerticalPanel();
41
		VerticalPanel holder = new VerticalPanel();
42
 
42
 
43
		FileUpload upload = new FileUpload();
43
		FileUpload upload = new FileUpload();
44
		upload.setName("upload");
44
		upload.setName("upload");
45
		holder.add(upload);
45
		holder.add(upload);
46
		holder.add(boutonValidation);
46
		holder.add(boutonValidation);
47
		holder.add(identifiant);
47
		holder.add(identifiant);
48
		
48
		
49
		HTML lienVersDocumentModele = new HTML("<a href=\"modele_import.xls\">T&eacute;l&eacute;charger le mod&egrave;le de document </a>");
49
		HTML lienVersDocumentModele = new HTML("<a href=\"modele_import.xls\">T&eacute;l&eacute;charger le mod&egrave;le de document </a>");
50
		
50
		
51
		holder.add(lienVersDocumentModele);
51
		holder.add(lienVersDocumentModele);
52
 
52
 
53
		holder.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT);
53
		holder.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT);
54
		
54
		
55
		boutonValidation.addListener(new ButtonListenerAdapter() {
55
		boutonValidation.addListener(new ButtonListenerAdapter() {
56
						
56
						
57
			public void onClick(Button button, EventObject e) {
57
			public void onClick(Button button, EventObject e) {
58
				form.submit();
58
				form.submit();
59
			}
59
			}
60
		});
60
		});
61
 
61
 
62
		form.add(holder);
62
		form.add(holder);
63
		
63
		
64
		nPan.add(form);
64
		nPan.add(form);
65
		form.setAction(Configuration.getServiceBaseUrl() + "/InventoryImportExcel");
65
		form.setAction(Configuration.getServiceBaseUrl() + "/InventoryImportExcel");
66
		
66
		
67
		form.addSubmitCompleteHandler(new SubmitCompleteHandler() {
67
		form.addSubmitCompleteHandler(new SubmitCompleteHandler() {
68
			
68
			
69
			public void onSubmitComplete(SubmitCompleteEvent event) {
69
			public void onSubmitComplete(SubmitCompleteEvent event) {
70
				
70
				
71
				
71
				
72
				nPan.close();
72
				nPan.close();
73
				com.google.gwt.user.client.Window.alert(""+event.getResults()+" observations créees");
73
				com.google.gwt.user.client.Window.alert(""+event.getResults()+" observations créees");
74
				oMediateur.obtenirDernierePageObservation();
74
				oMediateur.obtenirDernierePageObservation();
75
			}
75
			}
76
		});
76
		});
77
		
77
		
78
		
78
		
79
	}
79
	}
80
	
80
	
81
	public void afficher() {
81
	public void afficher() {
82
		nPan.show();
82
		nPan.show();
83
	}
83
	}
84
	
84
	
85
	public void initialiserUtilisateur(String id) {
85
	public void initialiserUtilisateur(String id) {
86
		identifiant.setValue(id);
86
		identifiant.setValue(id);
87
	}
87
	}
88
	
88
	
89
	
89
	
90
 
90
 
91
}
91
}