| 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 |
|
2 |
|
| 3 |
import java.util.Iterator;
|
3 |
import java.util.Iterator;
|
| Line -... |
Line 4... |
| - |
|
4 |
import java.util.Map;
|
| 4 |
import java.util.Map;
|
5 |
|
| - |
|
6 |
import org.tela_botanica.client.i18n.I18n;
|
| - |
|
7 |
import org.tela_botanica.client.i18n.Msg;
|
| 5 |
|
8 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
| - |
|
9 |
import org.tela_botanica.client.modeles.dao.ListeReferentielChampsEtendusDAO;
|
| 6 |
import org.tela_botanica.client.i18n.Msg;
|
10 |
import org.tela_botanica.client.modeles.objets.Configuration;
|
| 7 |
import org.tela_botanica.client.modeles.objets.Configuration;
|
11 |
import org.tela_botanica.client.modeles.objets.ListeGroupesChampsEtendus;
|
| 8 |
import org.tela_botanica.client.modeles.objets.Utilisateur;
|
12 |
import org.tela_botanica.client.modeles.objets.Utilisateur;
|
| Line 9... |
Line 13... |
| 9 |
import org.tela_botanica.client.observation.ObservationMediateur;
|
13 |
import org.tela_botanica.client.observation.ObservationMediateur;
|
| - |
|
14 |
import org.tela_botanica.client.util.Util;
|
| - |
|
15 |
|
| 10 |
import org.tela_botanica.client.util.Util;
|
16 |
import com.google.gwt.core.client.Callback;
|
| 11 |
|
17 |
import com.google.gwt.event.dom.client.ClickEvent;
|
| 12 |
import com.google.gwt.core.client.Callback;
|
18 |
import com.google.gwt.event.dom.client.ClickHandler;
|
| 13 |
import com.google.gwt.user.client.ui.FileUpload;
|
19 |
import com.google.gwt.user.client.ui.FileUpload;
|
| 14 |
import com.google.gwt.user.client.ui.FormPanel;
|
20 |
import com.google.gwt.user.client.ui.FormPanel;
|
| 15 |
import com.google.gwt.user.client.ui.FormPanel.SubmitCompleteEvent;
|
21 |
import com.google.gwt.user.client.ui.FormPanel.SubmitCompleteEvent;
|
| 16 |
import com.google.gwt.user.client.ui.FormPanel.SubmitCompleteHandler;
|
22 |
import com.google.gwt.user.client.ui.FormPanel.SubmitCompleteHandler;
|
| - |
|
23 |
import com.google.gwt.user.client.ui.HTML;
|
| - |
|
24 |
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
|
| 17 |
import com.google.gwt.user.client.ui.HTML;
|
25 |
import com.google.gwt.user.client.ui.Hidden;
|
| - |
|
26 |
import com.google.gwt.user.client.ui.HorizontalPanel;
|
| 18 |
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
|
27 |
import com.google.gwt.user.client.ui.ListBox;
|
| 19 |
import com.google.gwt.user.client.ui.Hidden;
|
28 |
import com.google.gwt.user.client.ui.VerticalPanel;
|
| 20 |
import com.google.gwt.user.client.ui.VerticalPanel;
|
29 |
import com.google.gwt.user.client.ui.Widget;
|
| 21 |
import com.gwtext.client.core.EventObject;
|
30 |
import com.gwtext.client.core.EventObject;
|
| Line 22... |
Line 31... |
| 22 |
import com.gwtext.client.widgets.Button;
|
31 |
import com.gwtext.client.widgets.Button;
|
| Line 23... |
Line 32... |
| 23 |
import com.gwtext.client.widgets.Window;
|
32 |
import com.gwtext.client.widgets.Window;
|
| 24 |
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
|
33 |
import com.gwtext.client.widgets.event.ButtonListenerAdapter;
|
| 25 |
|
34 |
|
| Line -... |
Line 35... |
| - |
|
35 |
public class FormulaireImportObservationVue implements Rafraichissable {
|
| - |
|
36 |
|
| Line 26... |
Line 37... |
| 26 |
public class FormulaireImportObservationVue {
|
37 |
private ObservationMediateur oMediateur = null;
|
| Line 27... |
Line 38... |
| 27 |
|
38 |
private Window nPan = null;
|
| Line 42... |
Line 53... |
| 42 |
final FormPanel form = new FormPanel();
|
53 |
final FormPanel form = new FormPanel();
|
| 43 |
final Button boutonValidation = new Button(Msg.get("envoyer"));
|
54 |
final Button boutonValidation = new Button(Msg.get("envoyer"));
|
| Line 44... |
Line 55... |
| 44 |
|
55 |
|
| 45 |
form.setEncoding(FormPanel.ENCODING_MULTIPART);
|
56 |
form.setEncoding(FormPanel.ENCODING_MULTIPART);
|
| 46 |
form.setMethod(FormPanel.METHOD_POST);
|
57 |
form.setMethod(FormPanel.METHOD_POST);
|
| 47 |
form.setWidth("275px");
|
58 |
form.setWidth("450px");
|
| Line 48... |
Line 59... |
| 48 |
nPan.setWidth("275px");
|
59 |
nPan.setWidth("450px");
|
| Line 49... |
Line 60... |
| 49 |
|
60 |
|
| 50 |
VerticalPanel holder = new VerticalPanel();
|
61 |
VerticalPanel holder = new VerticalPanel();
|
| 51 |
|
62 |
|
| 52 |
FileUpload upload = new FileUpload();
|
63 |
FileUpload upload = new FileUpload();
|
| 53 |
upload.setName("upload");
|
64 |
upload.setName("upload");
|
| Line -... |
Line 65... |
| - |
|
65 |
holder.add(upload);
|
| - |
|
66 |
holder.add(boutonValidation);
|
| - |
|
67 |
holder.add(identifiant);
|
| - |
|
68 |
|
| - |
|
69 |
listeGroupeChampsEtendus = new ListBox();
|
| - |
|
70 |
listeGroupeChampsEtendus.addStyleName("liste_projets_import");
|
| - |
|
71 |
|
| - |
|
72 |
if(cacheGroupes == null) {
|
| - |
|
73 |
ListeReferentielChampsEtendusDAO lrceDao = new ListeReferentielChampsEtendusDAO(null);
|
| - |
|
74 |
lrceDao.obtenirGroupesChampsEtendus(this);
|
| 54 |
holder.add(upload);
|
75 |
} else {
|
| - |
|
76 |
this.rafraichir(cacheGroupes, false);
|
| - |
|
77 |
}
|
| - |
|
78 |
|
| - |
|
79 |
HTML lienVersDocumentModele = new HTML("<a href=\"#\">" + Msg.get("telecharger-modele") + "</a>");
|
| - |
|
80 |
lienVersDocumentModele.addClickHandler(new ClickHandler() {
|
| - |
|
81 |
@Override
|
| - |
|
82 |
public void onClick(ClickEvent event) {
|
| - |
|
83 |
String groupeimport = listeGroupeChampsEtendus.getValue(listeGroupeChampsEtendus.getSelectedIndex());
|
| - |
|
84 |
String urlTplImport = Configuration.getServiceBaseUrl() + "/ImportXLS/template?groupe="+groupeimport;
|
| - |
|
85 |
com.google.gwt.user.client.Window.open(urlTplImport, "", "");
|
| 55 |
holder.add(boutonValidation);
|
86 |
}
|
| - |
|
87 |
});
|
| - |
|
88 |
|
| 56 |
holder.add(identifiant);
|
89 |
HorizontalPanel holHoriz = new HorizontalPanel();
|
| 57 |
|
90 |
holHoriz.add(lienVersDocumentModele);
|
| Line 58... |
Line 91... |
| 58 |
HTML lienVersDocumentModele = new HTML("<a href=\"modele_import.xls\">" + Msg.get("telecharger-modele") + "</a>");
|
91 |
holHoriz.add(listeGroupeChampsEtendus);
|
| 59 |
holder.add(lienVersDocumentModele);
|
92 |
holder.add(holHoriz);
|
| Line 124... |
Line 157... |
| 124 |
}
|
157 |
}
|
| Line 125... |
Line 158... |
| 125 |
|
158 |
|
| 126 |
public void afficher() {
|
159 |
public void afficher() {
|
| 127 |
nPan.show();
|
160 |
nPan.show();
|
| - |
|
161 |
}
|
| - |
|
162 |
|
| - |
|
163 |
public void rafraichir(Object nouvelleDonnees, boolean repandreRaffraichissement) {
|
| - |
|
164 |
if(nouvelleDonnees instanceof ListeGroupesChampsEtendus) {
|
| - |
|
165 |
cacheGroupes = (ListeGroupesChampsEtendus)nouvelleDonnees;
|
| - |
|
166 |
listeGroupeChampsEtendus.addItem(Msg.get("import-standard"), "");
|
| - |
|
167 |
for (Iterator<String> iterator = cacheGroupes.getCorrespondancesCorrespondancesIdsNomsGroupes().keySet().iterator(); iterator.hasNext();) {
|
| - |
|
168 |
String cleGroupe = iterator.next();
|
| - |
|
169 |
String[] strParams = {cleGroupe};
|
| - |
|
170 |
listeGroupeChampsEtendus.addItem(Msg.get("import-champs-projets", strParams), cleGroupe);
|
| - |
|
171 |
}
|
| - |
|
172 |
}
|
| 128 |
}
|
173 |
}
|