Subversion Repositories eFlore/Applications.cel

Rev

Rev 2033 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2033 Rev 2392
Line 1... Line 1...
1
package org.tela_botanica.client.util;
1
package org.tela_botanica.client.util;
Line 2... Line 2...
2
 
2
 
3
import java.util.ArrayList;
3
import java.util.ArrayList;
4
import java.util.Iterator;
4
import java.util.Iterator;
5
import java.util.List;
-
 
6
 
5
import java.util.List;
7
import org.tela_botanica.client.interfaces.Rafraichissable;
6
import org.tela_botanica.client.interfaces.Rafraichissable;
8
import org.tela_botanica.client.modeles.dao.ListeReferentielChampsEtendusDAO;
7
import org.tela_botanica.client.modeles.dao.ListeReferentielChampsEtendusDAO;
Line -... Line 8...
-
 
8
import org.tela_botanica.client.modeles.objets.Configuration;
9
import org.tela_botanica.client.modeles.objets.Configuration;
9
 
10
 
10
import com.google.gwt.core.client.Callback;
11
import com.google.gwt.user.client.Timer;
11
import com.google.gwt.user.client.Timer;
12
import com.gwtext.client.core.EventCallback;
12
import com.gwtext.client.core.EventCallback;
13
import com.gwtext.client.core.EventObject;
13
import com.gwtext.client.core.EventObject;
Line 19... Line 19...
19
import com.gwtext.client.data.Record;
19
import com.gwtext.client.data.Record;
20
import com.gwtext.client.data.RecordDef;
20
import com.gwtext.client.data.RecordDef;
21
import com.gwtext.client.data.Store;
21
import com.gwtext.client.data.Store;
22
import com.gwtext.client.data.StringFieldDef;
22
import com.gwtext.client.data.StringFieldDef;
23
import com.gwtext.client.widgets.Component;
23
import com.gwtext.client.widgets.Component;
24
import com.gwtext.client.widgets.event.ComponentListenerAdapter;
24
import com.gwtext.client.widgets.ToolTip;
25
import com.gwtext.client.widgets.form.ComboBox;
25
import com.gwtext.client.widgets.form.ComboBox;
26
import com.gwtext.client.widgets.form.Field;
26
import com.gwtext.client.widgets.form.Field;
27
import com.gwtext.client.widgets.form.event.ComboBoxListenerAdapter;
27
import com.gwtext.client.widgets.form.event.ComboBoxListenerAdapter;
Line 28... Line 28...
28
 
28
 
Line 57... Line 57...
57
		
57
		
58
		private List<String> cacheValeurs;
58
		private List<String> cacheValeurs;
59
		private Record rdSelectionne = null;
59
		private Record rdSelectionne = null;
Line -... Line 60...
-
 
60
		private String valeurBrute = "";
-
 
61
		
-
 
62
		private String description = null;
60
		private String valeurBrute = "";
63
		private ToolTip tpDesc = null;
61
		
64
		
62
		public ChampSaisieEtendu(String label, String cle) {
-
 
63
			
65
		public ChampSaisieEtendu(String label, String cle) {
Line 64... Line 66...
64
			// Accesskey pour debugging
66
 
65
			super(label,cle);  
67
			super(label,cle);  
Line 150... Line 152...
150
	            		setRawValue(valeurBrute);
152
	            		setRawValue(valeurBrute);
151
	            	}
153
	            	}
152
	            }
154
	            }
153
	         });
155
	         });
Line -... Line 156...
-
 
156
			
-
 
157
			// A activer pour télécharger la description
154
			
158
			// si jamais on le décide
155
			this.addListener(new ComponentListenerAdapter() {
159
			addListener(new ComboBoxListenerAdapter() {
156
				@Override
160
				@Override
157
				public void onRender(Component component) {
161
				public void onRender(Component component) {
-
 
162
					setLargeurChamp();
-
 
163
					ChampSaisieEtendu.this.getEl().addListener("mouseover", new EventCallback() {
-
 
164
						@Override
-
 
165
						public void execute(EventObject e) {
-
 
166
							if(description == null) {
-
 
167
								telechargerEtAfficherDescriptionDistante();
-
 
168
							} else {
-
 
169
								afficherDescription(description);
-
 
170
							}
-
 
171
						}
158
					setLargeurChamp();
172
					});
159
				}
173
				}
160
			});
174
			});
Line -... Line 175...
-
 
175
		}
-
 
176
 
-
 
177
		private void telechargerEtAfficherDescriptionDistante() {
-
 
178
			ListeReferentielChampsEtendusDAO.telechargerDescriptionWikini(cle, new Callback<String, String>() {		
-
 
179
				@Override
-
 
180
				public void onSuccess(String description) {
-
 
181
					ChampSaisieEtendu.this.description = description;
-
 
182
					afficherDescription(description);
-
 
183
				}
-
 
184
				
-
 
185
				@Override
-
 
186
				public void onFailure(String description) {
-
 
187
					afficherDescription(description);
-
 
188
				}
-
 
189
			});
-
 
190
		}
-
 
191
		
-
 
192
		private void afficherDescription(String description) {
-
 
193
			if(!description.trim().isEmpty()) {
-
 
194
				if(tpDesc == null) {
-
 
195
					tpDesc = new ToolTip(description);
-
 
196
					tpDesc.applyTo(this.getElement());
-
 
197
					tpDesc.showAt(ChampSaisieEtendu.this.getEl().getX(), ChampSaisieEtendu.this.getEl().getY());
-
 
198
				} else {
-
 
199
					tpDesc.show();
-
 
200
				}
-
 
201
			}
161
		}
202
		}
162
 
203
		
Line 163... Line 204...
163
		@Override
204
		@Override
164
		public void rafraichir(Object nouvelleDonnees, boolean repandreRaffraichissement) {
205
		public void rafraichir(Object nouvelleDonnees, boolean repandreRaffraichissement) {