/trunk/src/org/tela_botanica/client/vues/ListeUtilisateurAdminVue.java |
---|
9,7 → 9,6 |
import com.google.gwt.user.client.ui.Widget; |
import com.gwtext.client.core.EventCallback; |
import com.gwtext.client.core.EventObject; |
import com.gwtext.client.core.RegionPosition; |
import com.gwtext.client.data.ArrayReader; |
import com.gwtext.client.data.FieldDef; |
import com.gwtext.client.data.MemoryProxy; |
19,7 → 18,6 |
import com.gwtext.client.data.StringFieldDef; |
import com.gwtext.client.widgets.BoxComponent; |
import com.gwtext.client.widgets.Component; |
import com.gwtext.client.widgets.Panel; |
import com.gwtext.client.widgets.Window; |
import com.gwtext.client.widgets.event.ButtonListener; |
import com.gwtext.client.widgets.event.ButtonListenerAdapter; |
28,10 → 26,6 |
import com.gwtext.client.widgets.form.event.ComboBoxCallback; |
import com.gwtext.client.widgets.form.event.ComboBoxListener; |
import com.gwtext.client.widgets.form.event.ComboBoxListenerAdapter; |
import com.gwtext.client.widgets.layout.BorderLayout; |
import com.gwtext.client.widgets.layout.BorderLayoutData; |
import com.gwtext.client.widgets.layout.HorizontalLayout; |
import com.gwtext.client.widgets.layout.RowLayout; |
import com.gwtext.client.widgets.menu.Menu; |
public class ListeUtilisateurAdminVue extends Window implements Rafraichissable { |
40,7 → 34,6 |
private ComboBox listeUtil = null ; |
private Store storeUtil = null ; |
private com.gwtext.client.widgets.Button OK = null; |
private com.gwtext.client.widgets.Button annuler = null; |
private boolean selectionUtilisateur =false; |
private final int KEY_ALT = 18; |
67,7 → 60,6 |
listeUtil=new ComboBox("Utilisateurs","utilisateur",280); |
this.setLayout(new RowLayout()); |
final String resultTplUtil = "<div class=\"search-item-utilisateur\">{utilisateur}</div>"; |
82,18 → 74,10 |
listeUtil.setLoadingText("Recherche..."); |
OK= new com.gwtext.client.widgets.Button("OK"); |
annuler = new com.gwtext.client.widgets.Button("Annuler"); |
Panel boutonPanel = new Panel(); |
boutonPanel.setLayout(new HorizontalLayout(0)); |
add(listeUtil); |
add(OK); |
boutonPanel.add(OK); |
boutonPanel.add(annuler); |
add(boutonPanel); |
this.setSize(300, 75); |
OK.addListener(new ButtonListenerAdapter() { |
101,19 → 85,10 |
public void onClick(com.gwtext.client.widgets.Button button, |
EventObject e) { |
cMediateur.changerIdentite(listeUtil.getValue()); |
close(); |
} |
}); |
annuler.addListener(new ButtonListenerAdapter() { |
public void onClick(com.gwtext.client.widgets.Button button, |
EventObject e) { |
cMediateur.changerIdentite(listeUtil.getValue()); |
close(); |
} |
}); |
final ListeUtilisateurAdminVue l = this ; |
listeUtil.addKeyPressListener(new EventCallback() { |
197,10 → 172,12 |
String valeur = listeUtil.getRawValue(); |
cMediateur.obtenirListeUtilisateurs(valeur,this) ; |
/* |
String esp=espece.getText().replaceAll(" ","/"); |
esp=esp.replaceAll("%",""); |
observationMediateur.obtenirListeReferentielNom(this,esp); |
*/ |
} |
public void focusChampUtilisateur() { |
listeUtil.focus(); |
} |
} |
/trunk/src/org/tela_botanica/client/vues/ArbreMotsClesFiltreVue.java |
---|
439,42 → 439,40 |
public void raz() { |
if(arbreInitialise) { |
// on vide tous les noeuds de l'ancien arbre |
Node[] rootChild = arbreMotsCles.getRootNode().getChildNodes(); |
for (int i = 0; i < rootChild.length; i++) { |
rootChild[i].remove(); |
} |
// on vide tous les noeuds de l'ancien arbre |
Node[] rootChild = arbreMotsCles.getRootNode().getChildNodes(); |
for (int i = 0; i < rootChild.length; i++) { |
arbreInitialise = false ; |
// on crée une racine pour l'arbre |
TreeNode root = new TreeNode("Tags"); |
root.setId("racine"+prefixe); |
String[] usObject = { "Mots clés", "racine" }; |
root.setUserObject(usObject); |
root.setExpandable(true); |
arbreMotsCles.setRootNode(root); |
arbreMotsCles.getRootNode().addListener(new TreeNodeListenerAdapter() { |
public void onClick(Node node, EventObject e) { |
if(!arbreInitialise) { |
expand(); |
} |
rootChild[i].remove(); |
} |
arbreInitialise = false ; |
// on crée une racine pour l'arbre |
TreeNode root = new TreeNode("Tags"); |
root.setId("racine"+prefixe); |
String[] usObject = { "Mots clés", "racine" }; |
root.setUserObject(usObject); |
root.setExpandable(true); |
arbreMotsCles.setRootNode(root); |
arbreMotsCles.getRootNode().addListener(new TreeNodeListenerAdapter() { |
public void onClick(Node node, EventObject e) { |
if(!arbreInitialise) { |
expand(); |
} |
public void onExpand(Node node) { |
if(!arbreInitialise) { |
obtenirArbreMotsCles(); |
arbreInitialise = true; |
} |
} |
public void onExpand(Node node) { |
if(!arbreInitialise) { |
obtenirArbreMotsCles(); |
arbreInitialise = true; |
} |
}); |
} |
} |
}); |
} |
} |
/trunk/src/org/tela_botanica/client/vues/observation/filtres/RechercheLibreVue.java |
---|
File deleted |
/trunk/src/org/tela_botanica/client/vues/observation/FormulaireSaisieObservationVue.java |
---|
18,16 → 18,12 |
import com.google.gwt.core.client.JavaScriptObject; |
import com.google.gwt.maps.client.geom.LatLng; |
import com.google.gwt.user.client.Timer; |
import com.google.gwt.user.client.Window; |
import com.google.gwt.user.client.ui.ClickListener; |
import com.google.gwt.user.client.ui.HTML; |
import com.google.gwt.user.client.ui.Widget; |
import com.gwtext.client.core.EventCallback; |
import com.gwtext.client.core.EventObject; |
import com.gwtext.client.core.Ext; |
import com.gwtext.client.core.ExtElement; |
import com.gwtext.client.core.Function; |
import com.gwtext.client.core.ListenerConfig; |
import com.gwtext.client.core.Position; |
import com.gwtext.client.data.ArrayReader; |
56,12 → 52,10 |
import com.gwtext.client.widgets.form.DateField; |
import com.gwtext.client.widgets.form.Field; |
import com.gwtext.client.widgets.form.FormPanel; |
import com.gwtext.client.widgets.form.Label; |
import com.gwtext.client.widgets.form.MultiFieldPanel; |
import com.gwtext.client.widgets.form.TextArea; |
import com.gwtext.client.widgets.form.TextField; |
import com.gwtext.client.widgets.form.event.ComboBoxListenerAdapter; |
import com.gwtext.client.widgets.form.event.TextFieldListener; |
import com.gwtext.client.widgets.form.event.TextFieldListenerAdapter; |
import com.gwtext.client.widgets.layout.AnchorLayoutData; |
import com.gwtext.client.widgets.layout.ColumnLayout; |
207,8 → 201,6 |
private MultiFieldPanel coordPanel; |
private TextField coordonnees; |
private Label lienSelectionCommune = null; |
private HTML accesformulaire; |
219,10 → 211,6 |
private boolean latModifiee; |
private boolean longModifiee; |
protected boolean rechercheCommuneEnCours = false; |
private Timer tCoord; |
/** |
* Constructeur sans argument (privé car ne doit pas être utilisé) |
294,28 → 282,11 |
commune.setHideTrigger(true); |
//commune.setTabIndex(1); |
//création du lien "Accès carto" dans le formulaire |
basculerverscarto = new HTML(""); |
basculerverscarto = new HTML(" <a id=\"lien_carto\" href=\"#\" tabindex=\"2\">Localiser</a>"); |
basculerverscarto.addStyleName("lien_actif"); |
//création info bulle sur le lien "accès carto" |
ToolTip tip2 = new ToolTip(); |
tip2.setHtml("Via une carte, obtenez les coordonnées (longitude/latitude) de votre observation "); |
tip2.applyTo(basculerverscarto.getElement()); |
//Sur une meme ligne, ajout de plusieurs champs |
final MultiFieldPanel htmlCommunePanel = new MultiFieldPanel(); |
htmlCommunePanel.addToRow(commune,new ColumnLayoutData(0.5)); |
htmlCommunePanel.addToRow(basculerverscarto,100); |
htmlCommunePanel.setBorder(false); |
htmlCommunePanel.setId("x-commune-panel"); |
panneauPremierColonne.add(commune, new AnchorLayoutData("95%")); |
panneauPremierColonne.add(htmlCommunePanel); |
station = new TextField("Station", "station"); |
station.setAllowBlank(true); |
//station.setTabIndex(3); |
panneauPremierColonne.add(station, new AnchorLayoutData("95%")); |
latitude = new TextField("X", "x", 100); |
323,23 → 294,18 |
longitude = new TextField("Y", "y", 100); |
longitude.setAllowBlank(true); |
lienSelectionCommune = new Label(); |
lienSelectionCommune.setId("conteneur_selection_commune"); |
lienSelectionCommune.setStyleName("conteneur_selection_commune"); |
// Panneau de type plusieurs champs de formulaire sur une meme ligne, où seront renseignés X/Y |
coordPanel = new MultiFieldPanel(); |
coordPanel.setVisible(false); |
coordPanel.addToRow(latitude, new ColumnLayoutData(0.3)); |
coordPanel.addToRow(longitude, new ColumnLayoutData(0.3)); |
coordPanel.addToRow(lienSelectionCommune, new ColumnLayoutData(0.4)); |
coordPanel.addToRow(latitude, new ColumnLayoutData(0.5)); |
coordPanel.addToRow(longitude, new ColumnLayoutData(0.5)); |
coordPanel.setBorder(false); |
//création du champs coordonnées |
referentielGeo = Configuration.getReferentielGeo(); |
coordonnees = new TextField("Coordonnées", "", 0); |
coordonnees = new TextField("Coordonnées ("+referentielGeo+")", "", 0); |
coordonnees.setMaxLength(0); |
coordonnees.setReadOnly(true); |
coordonnees.setCls("fieldname"); |
346,8 → 312,8 |
//création du lien "saisie X/Y" dans le formulaire |
accesformulaire = new HTML("<a id=\"lien_coord\" href=\"#\" tabindex=\"6\">Saisie X/Y ("+referentielGeo+")</a>"); |
accesformulaire.addStyleName("lien_actif"); |
accesformulaire = new HTML("<a id=\"lien_coord\" href=\"#\" tabindex=\"7\">Saisie X/Y</a>"); |
accesformulaire.addStyleName("lien"); |
//création info bulle sur le lien "saisie X/Y" |
ToolTip tip1 = new ToolTip(); |
373,12 → 339,16 |
public void execute(EventObject e) { |
if(commune.getValue() != null && !commune.getValue().equals("")) { |
obtenirInformationCommune(); |
longlatAjoutee = true; |
if(coordonneesValides() == null) { |
if(commune.getValue() != null && !commune.getValue().equals("")) { |
obtenirInformationCommune(); |
longlatAjoutee = true; |
} else { |
Window.alert("Veuillez renseigner au moins une commune ou des coordonnées pour la géolocalisation"); |
} |
} else { |
Window.alert("Veuillez renseigner une commune à préciser"); |
obtenirInformationCoord(); |
} |
} |
}); |
385,10 → 355,21 |
} |
}); |
//création du lien "Accès carto" dans le formulaire |
basculerverscarto = new HTML(" <a id=\"lien_carto\" href=\"#\" tabindex=\"6\">Selection depuis une carte</a>"); |
basculerverscarto.addStyleName("lien"); |
//création info bulle sur le lien "accès carto" |
ToolTip tip2 = new ToolTip(); |
tip2.setHtml("Via une carte, obtenez les coordonnées (longitude/latitude) de votre observation "); |
tip2.applyTo(basculerverscarto.getElement()); |
//Sur une meme ligne, ajout de plusieurs champs |
final MultiFieldPanel htmlPanel = new MultiFieldPanel(); |
htmlPanel.addToRow(coordonnees, 100); |
htmlPanel.addToRow(basculerverscarto, new ColumnLayoutData(0.5)); |
htmlPanel.addToRow(accesformulaire, new ColumnLayoutData(0.5)); |
htmlPanel.setBorder(false); |
htmlPanel.setId("x-coord-panel"); |
468,7 → 449,10 |
bt.addText("Mode de saisie ") ; |
bt.addField(selecteurMode) ; |
boutonOK.setTabIndex(8); |
boutonAnnuler.setTabIndex(9); |
if (Ext.isIE6()) { |
panneauPremierColonne.setButtonAlign(Position.RIGHT); |
panneauPremierColonne.addButton(boutonOK); |
518,7 → 502,6 |
private void ajouterListeners() |
{ |
// Listener completion communne |
final Rafraichissable r = this; |
commune.addListener(new ComboBoxListenerAdapter() { |
public void onSelect(ComboBox comboBox, Record record, int index) { |
817,19 → 800,6 |
} |
}); |
tCoord = new Timer() { |
public void run() { |
double[] coord = coordonneesValides(); |
if(!rechercheCommuneEnCours && coord != null && (longModifiee || latModifiee)) { |
rechercheCommuneEnCours = true; |
Ext.get(lienSelectionCommune.getElement()).mask("recherche"); |
observationMediateur.obtenirInformationCoord(r,LatLng.newInstance(coord[0], coord[1])); |
} |
} |
}; |
latitude.addKeyPressListener(new EventCallback() { |
public void execute(EventObject e) { |
856,8 → 826,6 |
default: |
latModifiee = true; |
tCoord.cancel(); |
tCoord.schedule(250); |
} |
} |
}); |
866,7 → 834,6 |
public void execute(EventObject e) { |
switch(e.getKey()) { |
case KEY_ALT: |
case KEY_CTRL: |
case KEY_DOWN: |
878,22 → 845,23 |
case KEY_PAGEUP: |
case KEY_RIGHT: |
case KEY_SHIFT: |
case KEY_TAB: |
case KEY_UP: |
case KEY_TAB: |
break; |
break; |
case KEY_ENTER: |
validerSaisie(Champs.LONGITUDE); |
break; |
break; |
default: |
longModifiee = true; |
tCoord.cancel(); |
tCoord.schedule(250); |
longModifiee = true; |
} |
} |
}); |
boutonOK.addListener(new ButtonListenerAdapter() { |
public void onClick(Button button, EventObject e) { |
926,6 → 894,8 |
{ |
raz(); |
} |
} |
}); |
1089,62 → 1059,16 |
if(nouvelleDonnees instanceof EntiteGeographiqueObservation) |
{ |
EntiteGeographiqueObservation infosComm = (EntiteGeographiqueObservation)nouvelleDonnees ; |
if(rechercheCommuneEnCours) { |
afficherIndicationCommune(infosComm); |
} else { |
rafraichirCommuneEtCoord(infosComm); |
} |
rafraichirCommuneEtCoord(infosComm); |
} |
} |
private void afficherIndicationCommune( |
final EntiteGeographiqueObservation infosCom) { |
private void rafraichirCommuneEtCoord(EntiteGeographiqueObservation infosCom) { |
String nCommune = ""; |
if(infosCom != null && !infosCom.getCommune().trim().equals("")){ |
nCommune += infosCom.getCommune(); |
if(!infosCom.getIdLocalite().trim().equals("")) |
nCommune += " ("+infosCom.getIdLocalite()+")"; |
} |
lienSelectionCommune.setHtml("<a id=\"lien_selection_commune\" tabindex=\"9\">"+nCommune+"</a>"); |
lienSelectionCommune.setStyleName("img-curseur-depl"); |
Ext.get("lien_selection_commune").addListener("click",new EventCallback() { |
public void execute(EventObject e) { |
rafraichirCommune(infosCom); |
} |
}); |
Ext.get("lien_selection_commune").addListener("keypress",new EventCallback() { |
public void execute(EventObject e) { |
if(e.getCharCode() == KEY_ENTER) { |
rafraichirCommune(infosCom); |
} |
} |
}); |
Ext.get("lien_selection_commune").addListener("focus",new EventCallback() { |
public void execute(EventObject e) { |
Ext.get("lien_selection_commune").toggleClass("lien_sel"); |
} |
}); |
Ext.get("lien_selection_commune").addListener("blur",new EventCallback() { |
public void execute(EventObject e) { |
Ext.get("lien_selection_commune").toggleClass("lien_sel"); |
} |
}); |
Ext.get(lienSelectionCommune.getElement()).unmask(); |
rechercheCommuneEnCours = false; |
latModifiee = false; |
longModifiee = false; |
} |
private void rafraichirCommune(EntiteGeographiqueObservation infosCom) { |
String nCommune = ""; |
if(infosCom.getCommune() != null && !infosCom.getCommune().equals("")) { |
nCommune += infosCom.getCommune(); |
1154,13 → 1078,9 |
nCommune += " ("+infosCom.getIdLocalite()+")"; |
departement = infosCom.getIdLocalite(); |
} |
commune.setValue(nCommune); |
} |
private void rafraichirCommuneEtCoord(EntiteGeographiqueObservation infosCom) { |
rafraichirCommune(infosCom); |
if(infosCom.getLat() != null && !infosCom.getLat().equals("")) { |
latitude.setValue(infosCom.getLat()); |
} |
1171,13 → 1091,13 |
coordPanel.setVisible(true); |
latModifiee = false; |
longModifiee = false; |
latModifiee = true; |
longModifiee = true; |
} |
public void obtenirListeReferentielCommune() { |
String com=commune.getText(); |
String com=commune.getText()/*.replaceAll(" ","/")*/; |
com=com.replaceAll("%",""); |
observationMediateur.obtenirListeReferentielCommune(this,com); |
1499,8 → 1419,6 |
case COMMUNE: |
commune.reset() ; |
departement =""; |
latitude.reset(); |
longitude.reset(); |
break; |
case ESPECE: |
1511,12 → 1429,10 |
case LATITUDE: |
latitude.reset(); |
afficherIndicationCommune(null); |
break; |
case LONGITUDE: |
longitude.reset(); |
afficherIndicationCommune(null); |
break; |
case TOUT: |
1533,7 → 1449,6 |
espece.reset(); |
numeroNom = "" ; |
numeroOrdre = ""; |
afficherIndicationCommune(null); |
break; |
} |
1673,9 → 1588,9 |
selecteurMode.setTabIndex(0); |
commune.setTabIndex(1); |
lieudit.setTabIndex(3); |
station.setTabIndex(4); |
milieu.setTabIndex(5); |
lieudit.setTabIndex(2); |
station.setTabIndex(3); |
milieu.setTabIndex(4); |
coordonnees.setTabIndex(-1); |
coordonnees.addListener(new TextFieldListenerAdapter() { |
1688,8 → 1603,8 |
} |
}); |
latitude.setTabIndex(7); |
longitude.setTabIndex(8); |
latitude.setTabIndex(8); |
longitude.setTabIndex(9); |
comment.setTabIndex(10); |
date.setTabIndex(11); |
espece.setTabIndex(12); |
1778,15 → 1693,29 |
return departement; |
} |
public String getCommune() { |
return commune.getValue(); |
} |
public String getDepartement() { |
return obtenirDepartementAPartirChampCommune(); |
} |
public boolean communeInitialisee() { |
return communeModifiee; |
} |
/*private Field obtenirCorrespondanceChampsEnum(Champs champ) { |
switch(champ) { |
case DATE: |
return date; |
case COMMUNE: |
return commune; |
case LIEUDIT: |
return lieudit; |
case STATION: |
return station; |
case MILIEU: |
return milieu; |
case COMMENT: |
return comment; |
case ESPECE: |
return espece; |
} |
return null; |
}*/ |
} |
/trunk/src/org/tela_botanica/client/vues/observation/CartographieObservationVue.java |
---|
9,7 → 9,6 |
import com.google.gwt.maps.client.MapType; |
import com.google.gwt.maps.client.MapWidget; |
import com.google.gwt.maps.client.control.LargeMapControl; |
import com.google.gwt.maps.client.event.InfoWindowRestoreEndHandler; |
import com.google.gwt.maps.client.event.MapZoomEndHandler; |
import com.google.gwt.maps.client.event.MarkerClickHandler; |
import com.google.gwt.maps.client.event.MarkerDragEndHandler; |
19,7 → 18,6 |
import com.google.gwt.maps.client.geom.LatLng; |
import com.google.gwt.maps.client.overlay.Marker; |
import com.google.gwt.maps.client.overlay.MarkerOptions; |
import com.google.gwt.user.client.Timer; |
import com.google.gwt.user.client.Window; |
import com.google.gwt.user.client.ui.HTML; |
import com.gwtext.client.core.EventCallback; |
64,8 → 62,6 |
private InfoWindow info; |
private boolean listenerInitialise = false; |
public CartographieObservationVue(ObservationMediateur om) { |
oMediateur = om; |
87,7 → 83,7 |
public void onAfterLayout(Container c) { |
if(!carteAjoutee) { |
initialiserCarte(false); |
initialiserCarte(); |
} |
recentrerCarte(); |
} |
119,7 → 115,7 |
public void mettreAJourInfos(final LatLng pointNouvelleCommune, String infosComplementaires, int zoom) { |
if (!carteAjoutee) { |
initialiserCarte(true); |
initialiserCarte(); |
} |
pointCommune = pointNouvelleCommune; |
130,15 → 126,12 |
recentrerCarte(); |
} |
public void initialiserCarte(boolean commune) { |
public void initialiserCarte() { |
map = new MapWidget(pointCommune, niveauZoom); |
panneauCarto.add(map); |
panneauCarto.doLayout(); |
info = map.getInfoWindow(); |
if(!commune) { |
fabriquerMarqueurIndication(); |
} |
map.checkResizeAndCenter(); |
map.setUIToDefault(); |
map.addControl(new LargeMapControl()); |
154,17 → 147,6 |
}); |
} |
public void fabriquerMarqueurIndication() { |
Marker marker = fabriquerMarqueur(pointCommune,""); |
map.addOverlay(marker); |
info.open(marker, new InfoWindowContent("<div id=\"info_contenu\">"+ |
"Déplacez ce marqueur pour localiser votre observation (commune et coordonnées)<br />" |
+"longitude=" |
+ marker.getLatLng().getLongitude() + "<br />latitude=" |
+ marker.getLatLng().getLatitude() + "</div>")); |
map.setZoomLevel(3); |
} |
public void AfficherMessageAucuneInfos() { |
mettreAJourInfos(centreFrance,"", niveauZoom); |
175,22 → 157,11 |
return niveauZoom; |
} |
private void ajouterListenerBouton(final String idBouton) { |
final ExtElement bouton = Ext.get(idBouton); |
if(bouton == null) { |
Timer t = new Timer() { |
public void run() { |
ajouterListenerBouton(idBouton); |
} |
}; |
t.schedule(500); |
return; |
} |
private void ajouterListenerBouton(String idBouton) { |
ExtElement bouton = Ext.get(idBouton); |
bouton.addListener("click", new EventCallback() { |
public void execute(EventObject e) { |
EntiteGeographiqueObservation infosCommune = new EntiteGeographiqueObservation(codeCommune,valeurCommune,null,null); |
infosCommune.setLat(pointCommune.getLatitude()+""); |
197,9 → 168,8 |
infosCommune.setLon(pointCommune.getLongitude()+""); |
oMediateur.rafraichirSaisieCommuneObservation(infosCommune); |
} |
}); |
bouton.focus(); |
}); |
} |
public void rafraichir(Object nouvelleDonnees, |
211,15 → 181,14 |
} |
} |
if (nouvelleDonnees instanceof EntiteGeographiqueObservation) { |
if (nouvelleDonnees instanceof Object[]) { |
EntiteGeographiqueObservation infos = (EntiteGeographiqueObservation) nouvelleDonnees; |
LatLng coord = LatLng.newInstance(Double.parseDouble(infos.getLat()), |
Double.parseDouble(infos.getLon())); |
Object[] infos = (Object[]) nouvelleDonnees; |
LatLng coord = LatLng.newInstance((Double) infos[0], |
(Double) infos[1]); |
valeurCommune = infos.getCommune(); |
codeCommune = infos.getIdLocalite(); |
pointCommune = coord; |
valeurCommune = (String)infos[3]; |
codeCommune = (String)infos[2]; |
mettreAJourInfos(coord, "", niveauZoom); |
} |
261,6 → 230,7 |
} |
public void recentrerCarte() { |
//mettreAJourInfos(pointCommune,"", niveauZoom); |
map.setSize((this.getWidth() - 12)+"px" , (this.getHeight() - 24)+"px"); |
panneauCarto.setSize((this.getWidth() - 12)+"px" , (this.getHeight() - 12)+"px"); |
map.setCenter(pointCommune, niveauZoom); |
272,7 → 242,6 |
} |
public void afficherInfoMarker(Marker marker) { |
final String htmlBoutonOk = "<br /><button id=\"okMap\" class=\"x-btn-text\" type=\"button\">OK</button>"; |
info.open(marker, new InfoWindowContent("" |
280,8 → 249,7 |
+"longitude=" |
+ marker.getLatLng().getLongitude() + "<br />latitude=" |
+ marker.getLatLng().getLatitude() + htmlBoutonOk)); |
recentrerCarte(); |
ajouterListenerBouton("okMap"); |
} |
/trunk/src/org/tela_botanica/client/vues/image/ZoomImageVue.java |
---|
1,30 → 1,21 |
package org.tela_botanica.client.vues.image; |
import org.tela_botanica.client.image.ImageMediateur; |
import org.tela_botanica.client.interfaces.Rafraichissable; |
import com.google.gwt.core.client.JavaScriptObject; |
import com.google.gwt.user.client.Event; |
import com.google.gwt.user.client.Timer; |
import com.google.gwt.user.client.Window; |
import com.google.gwt.user.client.ui.ClickListener; |
import com.google.gwt.user.client.ui.Image; |
import com.google.gwt.user.client.ui.KeyboardListener; |
import com.google.gwt.user.client.ui.KeyboardListenerCollection; |
import com.google.gwt.user.client.ui.LoadListener; |
import com.google.gwt.user.client.ui.MouseListener; |
import com.google.gwt.user.client.ui.MouseWheelListener; |
import com.google.gwt.user.client.ui.MouseWheelVelocity; |
import com.google.gwt.user.client.ui.ToggleButton; |
import com.google.gwt.user.client.ui.Widget; |
import com.gwtext.client.core.AnimationConfig; |
import com.gwtext.client.core.Direction; |
import com.gwtext.client.core.DomConfig; |
import com.gwtext.client.core.EventObject; |
import com.gwtext.client.core.Ext; |
import com.gwtext.client.core.ExtElement; |
import com.gwtext.client.core.Function; |
import com.gwtext.client.core.RegionPosition; |
import com.gwtext.client.dd.DragData; |
31,21 → 22,13 |
import com.gwtext.client.dd.DragSource; |
import com.gwtext.client.dd.DropTarget; |
import com.gwtext.client.dd.DropTargetConfig; |
import com.gwtext.client.widgets.Button; |
import com.gwtext.client.widgets.Component; |
import com.gwtext.client.widgets.Container; |
import com.gwtext.client.widgets.Panel; |
import com.gwtext.client.widgets.ToolTip; |
import com.gwtext.client.widgets.Toolbar; |
import com.gwtext.client.widgets.ToolbarButton; |
import com.gwtext.client.widgets.ToolbarTextItem; |
import com.gwtext.client.widgets.event.ButtonListener; |
import com.gwtext.client.widgets.event.ButtonListenerAdapter; |
import com.gwtext.client.widgets.event.PanelListenerAdapter; |
import com.gwtext.client.widgets.grid.GridDragData; |
import com.gwtext.client.widgets.layout.BorderLayout; |
import com.gwtext.client.widgets.layout.BorderLayoutData; |
import com.gwtext.client.widgets.menu.Menu; |
/** |
* Panneau d'affichage d'une image avec des boutons précdents et suivant |
119,28 → 102,6 |
*/ |
private boolean enClic = false; |
private ToolbarButton modeZoom = null; |
private ToolbarTextItem valeurZoom = new ToolbarTextItem("x 1"); |
private int sourisX = 0; |
private int sourisY = 0; |
private int sourisXFin = 0; |
private int sourisYFin = 0; |
private float niveauZoom = 1; |
private float pasZoom = new Float(0.1); |
private int maxZoom = 10; |
private float minZoom = new Float(0.5); |
protected boolean scroll = false; |
/** |
* Constructeur sans argument (privé car ne doit être utilisé) |
*/ |
189,14 → 150,6 |
prev.setWidth("60px"); |
suiv.setWidth("60px"); |
modeZoom = new ToolbarButton("Mode Zoom"); |
Toolbar tb = new Toolbar(); |
tb.addButton(modeZoom); |
tb.addItem(valeurZoom); |
//setTopToolbar(tb); |
this.add(prev, new BorderLayoutData(RegionPosition.WEST)); |
this.add(imageConteneur, new BorderLayoutData(RegionPosition.CENTER)); |
this.add(suiv, new BorderLayoutData(RegionPosition.EAST)); |
212,7 → 165,7 |
// on ajoute les listeners |
ajouterListeners(); |
tp.setDismissDelay(1050); |
tp.setDismissDelay(1750); |
tp.applyTo(image.getElement()) ; |
} |
228,7 → 181,6 |
public void rafraichir(Object nouvelleDonnees, |
boolean repandreRafraichissement) { |
//niveauZoom = 1; |
// si on reçoit une string |
if (nouvelleDonnees instanceof String[] && initialise |
&& conteneurInitialise) { |
286,32 → 238,7 |
* Ajoute les listeners pour la gestions d'évènement |
*/ |
public void ajouterListeners() { |
modeZoom.addListener(new ButtonListenerAdapter() { |
public void onClick(Button button, EventObject e) { |
// TODO Auto-generated method stub |
if(modeZoom.isPressed()) { |
modeZoom.toggle(false); |
} else { |
modeZoom.toggle(true); |
} |
} |
public void onToggle(Button button, boolean pressed) { |
if(pressed) { |
scroll = true; |
image.addStyleName("img-curseur-depl"); |
} else { |
scroll = false; |
image.removeStyleName("img-curseur-depl"); |
niveauZoom = 1; |
verifierEtRetaillerImage(); |
Ext.get(image.getElement()).center(imageConteneur.getElement()); |
} |
} |
}); |
image.addLoadListener(new LoadListener() { |
public void onError(Widget sender) { |
320,7 → 247,7 |
public void onLoad(Widget sender) { |
/*int max = Math.min(imageConteneur.getHeight(), imageConteneur.getWidth()); |
int max = Math.min(imageConteneur.getHeight(), imageConteneur.getWidth()); |
int[] tailleImage = calculerDimensions(getTailleImage(), max, max); |
ExtElement imgElement = Ext.get(image.getElement()); |
if(animerTransition) { |
331,9 → 258,7 |
} else { |
imgElement.setHeight(tailleImage[1], false); |
imgElement.setWidth(tailleImage[0], false); |
}*/ |
verifierEtRetaillerImage(); |
Ext.get(image.getElement()).center(imageConteneur.getElement()); |
} |
demasquerChargement(); |
} |
342,7 → 267,7 |
image.addClickListener(new ClickListener() { |
public void onClick(Widget sender) { |
if(!scroll) { |
if(enClic) { |
getIMediateur().doubleClicZoomImage(); |
} else { |
355,7 → 280,6 |
enClic = true; |
t.schedule(800); |
} |
} |
} |
}); |
365,76 → 289,14 |
public void onMouseWheel(Widget sender, MouseWheelVelocity velocity) { |
if(velocity.getDeltaY() > 0) { |
if(scroll) { |
zoomOut(); |
} else { |
suiv.click(); |
} |
suiv.click(); |
} else { |
if(scroll) { |
zoomIn(); |
} else { |
prev.click(); |
} |
prev.click(); |
} |
} |
}); |
image.addMouseListener(new MouseListener() { |
public void onMouseDown(Widget sender, int x, int y) { |
if(scroll) { |
Event.getCurrentEvent().preventDefault(); |
scroll = true; |
sourisX = x; |
sourisY = y; |
image.addStyleName("img-curseur-depl"); |
} |
} |
public void onMouseEnter(Widget sender) { |
// TODO Auto-generated method stub |
} |
public void onMouseLeave(Widget sender) { |
// TODO Auto-generated method stub |
} |
public void onMouseMove(Widget sender, int x, int y) { |
sourisXFin = x; |
sourisYFin = y; |
Event.getCurrentEvent().preventDefault(); |
} |
public void onMouseUp(Widget sender, int x, int y) { |
if(scroll) { |
Event.getCurrentEvent().preventDefault(); |
if(sourisX - sourisXFin > 0) { |
Ext.get(image.getElement()).move(Direction.LEFT, sourisX - sourisXFin, false); |
} |
if(sourisXFin - sourisX > 0) { |
Ext.get(image.getElement()).move(Direction.RIGHT, sourisXFin - sourisX, false); |
} |
if(sourisY - sourisYFin > 0) { |
Ext.get(image.getElement()).move(Direction.UP, sourisY - sourisYFin, false); |
} |
if(sourisYFin - sourisY > 0) { |
Ext.get(image.getElement()).move(Direction.DOWN, sourisYFin - sourisY, false); |
} |
} |
} |
}); |
// gestion du clic sur le bouton précedent |
prev.addClickListener(new ClickListener() { |
495,7 → 357,7 |
} |
// on prend la taille originale de l'image |
/*int originalX = getTailleImage()[0]; |
int originalX = getTailleImage()[0]; |
int originalY = getTailleImage()[1]; |
// on la transforme en float (la division entre entier donne de curieux |
512,7 → 374,7 |
// on prend la taille du conteneur |
int tailleConteneurX = imageConteneur.getWidth(); |
int tailleConteneurY = imageConteneur.getHeight();*/ |
int tailleConteneurY = imageConteneur.getHeight(); |
// si celle-ci est égale à 0 (conteneur mal initialisé) |
/* |
522,7 → 384,7 |
* this.getWidth() - prev.getOffsetWidth() * 2 ; |
* } |
*/ |
/* |
// si l'image ne rentre pas telle quelle (longueur ou hauteur trop |
// grande) |
if (originalY > tailleConteneurY || originalX > tailleConteneurX) { |
543,39 → 405,10 |
* rapportTaille); |
} |
} |
*/ |
// on modifie enfin la taille de l'image pour qu'elle soit affichée |
int max = Math.min(imageConteneur.getHeight(), imageConteneur.getWidth()); |
int[] tailleImage = new int[2]; |
ExtElement imgElement = Ext.get(image.getElement()); |
if(max == imageConteneur.getHeight()) { |
//tailleImage[0] = getTailleImage()[0]; |
//tailleImage[1] = max; |
imgElement.setHeight(max, false); |
} else { |
//tailleImage[1] = getTailleImage()[0]; |
//tailleImage[0] = max; |
imgElement.setWidth(max, false); |
} |
//int[] tailleImage = calculerDimensions(getTailleImage(), max, max); |
//imgElement. |
/*if(animerTransition) { |
AnimationConfig a = new AnimationConfig() ; |
a.setDuration((float) dureeAnimation); |
imgElement.setHeight(tailleImage[1], a); |
imgElement.setWidth(tailleImage[0], a); |
} else { |
imgElement.setHeight(tailleImage[1], false); |
imgElement.setWidth(tailleImage[0], false); |
}*/ |
String strZoom = ""+niveauZoom+""; |
strZoom = strZoom.substring(0,3); |
valeurZoom.setText("x "+strZoom); |
getImage().setSize("" + nouvelleTailleX + "px", |
"" + nouvelleTailleY + "px"); |
} |
public int[] calculerDimensions(int[] tailleXY, double tailleMax, double tailleConteneur) { |
595,7 → 428,7 |
XYresize[0] = tailleOr*rapport ; |
} |
int[] res = {(int)Math.round(XYresize[0]*niveauZoom),(int) Math.round(XYresize[1]*niveauZoom)} ; |
int[] res = {Math.round(XYresize[0]),Math.round(XYresize[1])} ; |
return res; |
} |
717,74 → 550,4 |
return imageConteneur; |
} |
private void zoomOut() { |
if(niveauZoom >= minZoom) { |
niveauZoom -= pasZoom; |
if(niveauZoom <= minZoom) { |
niveauZoom = minZoom; |
} |
verifierEtRetaillerImage(); |
gererDecalage(false); |
} |
} |
private void zoomIn() { |
if(niveauZoom < maxZoom ) { |
niveauZoom += pasZoom; |
if(niveauZoom >= maxZoom) { |
niveauZoom = maxZoom; |
} |
verifierEtRetaillerImage(); |
gererDecalage(true); |
} |
} |
private void gererDecalage(boolean in) { |
float nZoom = niveauZoom; |
if(niveauZoom < 1) { |
nZoom = 1/niveauZoom; |
} |
if(!in) { |
int diffX = imageConteneur.getWidth()/2 - sourisX; |
int diffY = imageConteneur.getHeight()/2 - sourisY; |
if(diffX > 0) { |
Ext.get(image.getElement()).move(Direction.RIGHT, (int)((diffX/maxZoom)/nZoom), false); |
} |
if(-diffX > 0) { |
Ext.get(image.getElement()).move(Direction.LEFT, (int)(-(diffX/maxZoom)/nZoom), false); |
} |
if(diffY > 0) { |
Ext.get(image.getElement()).move(Direction.DOWN, (int)((diffY/maxZoom)/nZoom), false); |
} |
if(-diffY > 0) { |
Ext.get(image.getElement()).move(Direction.UP, (int)(-(diffY/maxZoom)/nZoom), false); |
} |
} else { |
int diffX = imageConteneur.getWidth()/2; |
int diffY = imageConteneur.getHeight()/2; |
if(diffX > 0) { |
Ext.get(image.getElement()).move(Direction.LEFT, (int)((diffX/maxZoom)/nZoom), false); |
} |
if(-diffX > 0) { |
Ext.get(image.getElement()).move(Direction.RIGHT, (int)((-diffX/maxZoom)/nZoom), false); |
} |
if(diffY > 0) { |
Ext.get(image.getElement()).move(Direction.UP, (int)((diffY/maxZoom)/nZoom), false); |
} |
if(-diffY > 0) { |
Ext.get(image.getElement()).move(Direction.DOWN, (int)(-(diffY/maxZoom)/nZoom), false); |
} |
} |
} |
} |