Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 70 Rev 72
Line 6... Line 6...
6
import org.tela_botanica.client.interfaces.Rafraichissable;
6
import org.tela_botanica.client.interfaces.Rafraichissable;
7
import org.tela_botanica.client.modeles.EntiteGeographiqueObservation;
7
import org.tela_botanica.client.modeles.EntiteGeographiqueObservation;
8
import org.tela_botanica.client.modeles.ListeEntiteGeographiqueObservation;
8
import org.tela_botanica.client.modeles.ListeEntiteGeographiqueObservation;
9
import org.tela_botanica.client.observation.ObservationMediateur;
9
import org.tela_botanica.client.observation.ObservationMediateur;
Line -... Line 10...
-
 
10
 
10
 
11
import com.google.gwt.core.client.GWT;
11
import com.google.gwt.json.client.JSONArray;
12
import com.google.gwt.json.client.JSONArray;
12
import com.google.gwt.json.client.JSONObject;
13
import com.google.gwt.json.client.JSONObject;
13
import com.google.gwt.user.client.Window;
14
import com.google.gwt.user.client.Window;
14
import com.google.gwt.user.client.ui.Label;
15
import com.google.gwt.user.client.ui.Label;
Line 111... Line 112...
111
			public void onRender(Component component) {
112
			public void onRender(Component component) {
Line 112... Line 113...
112
 
113
 
113
				// on interdit le drag and drop dans l'arbre
114
				// on interdit le drag and drop dans l'arbre
114
				arbreEntitesGeographiques.setEnableDD(false);
115
				arbreEntitesGeographiques.setEnableDD(false);
115
				arbreEntitesGeographiques.setId("x-view-tree-filter");
116
				arbreEntitesGeographiques.setId("x-view-tree-filter");
-
 
117
				arbreEntitesGeographiques.setAutoWidth(false);
-
 
118
				
116
			//	arbreEntitesGeographiques.setAutoWidth(false);
119
				if (GWT.isScript()) {
-
 
120
					arbreEntitesGeographiques.setAutoScroll(true);
-
 
121
				}
117
			//	arbreEntitesGeographiques.setAutoScroll(true);
122
				
Line 118... Line 123...
118
			//	arbreEntitesGeographiques.setBorder(false);
123
				arbreEntitesGeographiques.setBorder(false);
119
 
124
 
120
				// on crée une racine pour l'arbre
125
				// on crée une racine pour l'arbre
121
				TreeNode root = new TreeNode("Localité");
126
				TreeNode root = new TreeNode("Localités");
122
				root.setId("racine_entite");
127
				root.setId("racine_entite");
Line 123... Line 128...
123
				String[] usObject = { "Localités", "racine" };
128
				String[] usObject = { "Localités" };
124
				root.setUserObject(usObject);
129
				root.setUserObject(usObject);
125
 
130
 
Line 159... Line 164...
159
 
164
 
Line -... Line 165...
-
 
165
 
160
 
166
		if (nouvelleDonnees instanceof ListeEntiteGeographiqueObservation) {
-
 
167
		
161
		if (nouvelleDonnees instanceof ListeEntiteGeographiqueObservation) {
168
			
Line 162... Line 169...
162
		
169
			
Line 163... Line 170...
163
			
170
			String entite=null;
164
			String entite=null;
171
			String idEntite=null;
165
			String parent=null;
172
			String idParent=null;
166
			
173
			
167
			ListeEntiteGeographiqueObservation data = (ListeEntiteGeographiqueObservation) nouvelleDonnees ;
174
			ListeEntiteGeographiqueObservation data = (ListeEntiteGeographiqueObservation) nouvelleDonnees ;
168
		
175
		
169
			
176
			
170
			if (data.isEmpty()) {
177
			if (data.isEmpty()) {
Line 171... Line 178...
171
				// on crée un arbre vide
178
				// on crée un arbre vide
Line 182... Line 189...
182
			for (Iterator<String> it= data.keySet().iterator(); it.hasNext();) {
189
			for (Iterator<String> it= data.keySet().iterator(); it.hasNext();) {
Line 183... Line 190...
183
				
190
				
Line 184... Line 191...
184
				EntiteGeographiqueObservation ent=(EntiteGeographiqueObservation) data.get(it.next());
191
				EntiteGeographiqueObservation ent=(EntiteGeographiqueObservation) data.get(it.next());
-
 
192
				
185
				
193
				entite=ent.getEntite();
Line 186... Line 194...
186
				entite=ent.getEntite();
194
				idEntite=ent.getIdEntite();
187
				parent=ent.getParent();
195
				idParent=ent.getIdParent();
Line 188... Line 196...
188
				
196
				
189
			
197
		
190
				String[] usObj = { entite };
198
				String[] usObj = { entite };
191
 
199
 
192
					// et on construit l'arbre à partir de la racine (qui est
200
					// et on construit l'arbre à partir de la racine (qui est
193
					// toujours le premier élément)
201
					// toujours le premier élément)
194
					if (entite.equals("racine")) {
202
					if (entite.equals("racine_entite")) {
195
						TreeNode root = new TreeNode();
203
						TreeNode root = new TreeNode();
196
						root.setId(entite);
204
						root.setId(idEntite);
197
						root.setText(entite);
205
						root.setText(entite);
198
						root.setUserObject(usObj);
206
						root.setUserObject(usObj);
199
						donneeEntitesGeographiques.setRootNode(root);
207
						donneeEntitesGeographiques.setRootNode(root);
200
					} else {
208
					} else {
201
						// et en ajoutant les noeuds un à un (qui sont renvoyé
209
						// et en ajoutant les noeuds un à un (qui sont renvoyé
202
						// dans l'ordre hierarchique de leur niveau
210
						// dans l'ordre hierarchique de leur niveau
203
						// ce qui permet de les traiter séquentiellement)
-
 
204
						TreeNode node = new TreeNode();
211
						// ce qui permet de les traiter séquentiellement)
205
						node.setId(entite);
212
						TreeNode node = new TreeNode();
206
						node.setText(entite);
213
						node.setId(idEntite);
207
						node.setChecked(false);
214
						node.setText(entite);					
208
						Node parentNode = donneeEntitesGeographiques.getNodeById(parent);
215
						Node parentNode = donneeEntitesGeographiques.getNodeById(idParent);
Line 291... Line 298...
291
			for (int i = 0; i < ndNodeFils.length; i++) {
298
			for (int i = 0; i < ndNodeFils.length; i++) {
Line 292... Line 299...
292
 
299
 
293
				String[] usObj = (String[]) ndNodeFils[i].getUserObject();
300
				String[] usObj = (String[]) ndNodeFils[i].getUserObject();
294
				TreeNode child = new TreeNode(usObj[0]);
301
				TreeNode child = new TreeNode(usObj[0]);
295
				child.setId(usObj[0] + "_filtre");
-
 
296
				child.setChecked(false);
302
				child.setId(usObj[0] + "_filtre");
297
				child.setUserObject(usObj);
303
				child.setUserObject(usObj);
Line 298... Line 304...
298
				ndPereCopie.appendChild(child);
304
				ndPereCopie.appendChild(child);
299
 
305