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