Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 401 Rev 408
Line 5... Line 5...
5
import org.tela_botanica.client.interfaces.Rafraichissable;
5
import org.tela_botanica.client.interfaces.Rafraichissable;
6
import org.tela_botanica.client.interfaces.VueListable;
6
import org.tela_botanica.client.interfaces.VueListable;
7
import org.tela_botanica.client.vues.BarrePaginationVue;
7
import org.tela_botanica.client.vues.BarrePaginationVue;
Line 8... Line 8...
8
 
8
 
-
 
9
import com.google.gwt.core.client.GWT;
9
import com.google.gwt.core.client.GWT;
10
import com.google.gwt.user.client.Window;
10
import com.gwtext.client.core.EventObject;
11
import com.gwtext.client.core.EventObject;
11
import com.gwtext.client.data.FieldDef;
12
import com.gwtext.client.data.FieldDef;
12
import com.gwtext.client.data.IntegerFieldDef;
13
import com.gwtext.client.data.IntegerFieldDef;
13
import com.gwtext.client.data.Record;
14
import com.gwtext.client.data.Record;
Line 172... Line 173...
172
				String nomObs = record.getAsString("obs_associees");
173
				String nomObs = record.getAsString("obs_associees");
173
				if(nomObs == null) {
174
				if(nomObs == null) {
174
					return "";
175
					return "";
175
				}
176
				}
Line 176... Line -...
176
				
-
 
177
				String[] obsTab = nomObs.split(";;");
-
 
178
				String valeurTransmis = "0";
-
 
179
 
-
 
180
				if(obsTab.length >= 1) {
-
 
181
					String[] elementsObs = obsTab[0].split("#");
-
 
182
					
-
 
183
					if(elementsObs.length >= 3) {
177
				
184
						nomObs = elementsObs[1];
-
 
185
						//if(elementsObs[2] == "1") {
-
 
186
							valeurTransmis = "1";
-
 
187
						//}
-
 
188
					}
-
 
Line 189... Line 178...
189
				}
178
				boolean transmise = estAssocieeTransmise(nomObs)[1];
190
				
179
				
191
				if(valeurTransmis.equals("1"))
180
				if(transmise)
192
				{
181
				{
193
					return "<img src=\"tela.png\"/></img>" ;
182
					return "<img src=\"tela.png\"/></img>" ;
194
				}
183
				}
Line 335... Line 324...
335
 
324
 
336
				String nomObs = record.getAsString("obs_associees");
325
				String nomObs = record.getAsString("obs_associees");
337
				if(nomObs == null) {
326
				if(nomObs == null) {
338
					return "";
327
					return "";
339
				}
-
 
340
				String[] obsTab = nomObs.split(";;");
-
 
341
 
-
 
342
				if(obsTab.length >= 1) {
-
 
343
					String[] elementsObs = obsTab[0].split("#");
-
 
344
					
-
 
345
					if(elementsObs.length >= 3) {
-
 
346
						nomObs = elementsObs[1];
-
 
347
					}
-
 
Line -... Line 328...
-
 
328
				}
-
 
329
				
348
				}
330
				String nomFormate = getNomsObservationsFormatees(nomObs);
349
				
331
				
350
				return "<div class=\"centered-list\">" + nomObs
332
				return "<div class=\"centered-list\">" + nomFormate
Line 351... Line 333...
351
						+ "</div>";
333
						+ "</div>";
Line 429... Line 411...
429
 
411
 
Line 430... Line 412...
430
		this.addGridRowListener(new GridRowListener() {
412
		this.addGridRowListener(new GridRowListener() {
431
 
413
 
432
			// gestion du clic sur une ligne
414
			// gestion du clic sur une ligne
433
			public void onRowClick(GridPanel grid, int rowIndex, EventObject e) {
415
			public void onRowClick(GridPanel grid, int rowIndex, EventObject e) {
434
 
416
			
435
				// on notifie le médiateur et on lui passe le nuémro de ligne
417
				// on notifie le médiateur et on lui passe le numéro de ligne
Line 436... Line 418...
436
				getIMediateur().clicListeImage(rowIndex);
418
				getIMediateur().clicListeImage(rowIndex);
437
			}
419
			}
Line 682... Line 664...
682
        
664
        
Line 683... Line 665...
683
        int[] res = {Math.round(XYresize[0]),Math.round(XYresize[1])} ;
665
        int[] res = {Math.round(XYresize[0]),Math.round(XYresize[1])} ;
684
        
666
        
-
 
667
        return res;
-
 
668
    }
-
 
669
	
-
 
670
	private String getNomsObservationsFormatees(String nomObs) {
-
 
671
		
-
 
672
		String htmlInfobulle = "";
-
 
673
		
-
 
674
		String[][] obs = getObservationsAssociees(nomObs);
-
 
675
		
-
 
676
		for(int i = 0; i < obs.length; i++) {
-
 
677
						
-
 
678
			if(obs[i].length == 3 && obs[i][1] != null && !obs[i][1].equals("")) {
-
 
679
				htmlInfobulle += ", "+obs[i][1];
-
 
680
			}
-
 
681
		}
-
 
682
		
-
 
683
		htmlInfobulle = htmlInfobulle.replaceFirst(", ", "");
-
 
684
		
-
 
685
		return htmlInfobulle;
-
 
686
	}
-
 
687
	
-
 
688
	private String[][] getObservationsAssociees(String nomObs) {
-
 
689
		
-
 
690
		if(nomObs.trim().equals("")) {
-
 
691
			return new String[0][0];
-
 
692
		}
-
 
693
		
-
 
694
		String[] obsTab = nomObs.split(";;");
-
 
695
		String[][] obsAnalysees = new String[obsTab.length][3];
-
 
696
		
-
 
697
		for(int i = 0; i < obsTab.length; i++) {
-
 
698
			
-
 
699
			obsAnalysees[i] = obsTab[i].split("#");
-
 
700
			
-
 
701
		}
-
 
702
		
-
 
703
		return obsAnalysees;
-
 
704
	}
-
 
705
	
-
 
706
	private boolean[] estAssocieeTransmise(String nomObs) {
-
 
707
		
-
 
708
		String[][] obs = getObservationsAssociees(nomObs);
-
 
709
		boolean[] associeesTranmises = {false, false};
-
 
710
		
-
 
711
		if(obs.length > 0) {
-
 
712
			associeesTranmises[0] = true;
-
 
713
		}
-
 
714
		
-
 
715
		for(int i = 0; i < obs.length; i++) {
-
 
716
			
-
 
717
			if(obs[i].length == 3 && obs[i][2] != null && obs[i][2].equals("1")) {
-
 
718
				associeesTranmises[1] = true;
-
 
719
			}
-
 
720
		}
-
 
721
		
Line 685... Line 722...
685
        return res;
722
		return associeesTranmises;