Subversion Repositories eFlore/Applications.cel

Rev

Details | Last modification | View Log | RSS feed

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