Subversion Repositories eFlore/Archives.cel-v1

Rev

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

Rev 13 Rev 14
Line 28... Line 28...
28
import com.google.gwt.user.client.ui.Composite;
28
import com.google.gwt.user.client.ui.Composite;
29
import com.google.gwt.user.client.ui.FlexTable;
29
import com.google.gwt.user.client.ui.FlexTable;
30
import com.google.gwt.user.client.ui.Grid;
30
import com.google.gwt.user.client.ui.Grid;
31
import com.google.gwt.user.client.ui.HTML;
31
import com.google.gwt.user.client.ui.HTML;
32
import com.google.gwt.user.client.ui.HorizontalPanel;
32
import com.google.gwt.user.client.ui.HorizontalPanel;
-
 
33
import com.google.gwt.user.client.ui.Image;
33
import com.google.gwt.user.client.ui.SourcesTableEvents;
34
import com.google.gwt.user.client.ui.SourcesTableEvents;
34
import com.google.gwt.user.client.ui.TableListener;
35
import com.google.gwt.user.client.ui.TableListener;
35
import com.google.gwt.user.client.ui.VerticalPanel;
36
import com.google.gwt.user.client.ui.VerticalPanel;
36
import com.google.gwt.user.client.ui.DockPanel;
37
import com.google.gwt.user.client.ui.DockPanel;
37
import com.google.gwt.user.client.ui.Button;
38
import com.google.gwt.user.client.ui.Button;
Line 156... Line 157...
156
	private int  selectedRow = -1;
157
	private int  selectedRow = -1;
Line 157... Line 158...
157
	
158
	
158
	private String location = "all";
159
	private String location = "all";
159
	private String date = "all";
160
	private String date = "all";
-
 
161
	private String search = "all";
Line 160... Line 162...
160
	private String search = "all";
162
	private String station = "all";
Line 161... Line 163...
161
 
163
 
Line 211... Line 213...
211
			  public void onCellClicked(SourcesTableEvents sender, int row, int cell) {
213
			  public void onCellClicked(SourcesTableEvents sender, int row, int cell) {
Line 212... Line 214...
212
				   
214
				   
213
				  if (table.getWidget(row, 0)!=null) {
215
				  if (table.getWidget(row, 0)!=null) {
214
				      selectRow(row);
216
				      selectRow(row);
215
				      // Numero d'ordre
217
				      // Numero d'ordre
216
				      mediator.onInventoryItemSelected(table.getText(row, 4));
218
				      mediator.onInventoryItemSelected(table.getText(row, 5));
217
				  }
219
				  }
Line 218... Line 220...
218
			  }
220
			  }
Line 423... Line 425...
423
					location=loc;
425
					location=loc;
424
					if (location.compareTo("")==0) {
426
					if (location.compareTo("")==0) {
425
						location="000null";
427
						location="000null";
426
					}
428
					}
427
					add=true;
429
					add=true;
-
 
430
					mediator.onInventoryUpdated(location);
428
					updateCount();
431
					updateCount();
429
			}
432
			}
430
		});
433
		});
431
	}
434
	}
Line 452... Line 455...
452
 
455
 
453
	private void updateElement(String ordre, String nom_sel, String num_nom_sel, String nom_ret,
456
	private void updateElement(String ordre, String nom_sel, String num_nom_sel, String nom_ret,
Line 454... Line 457...
454
			String num_nom_ret, String num_taxon, String famille,final String loc, String id_location,String dat, String complementLocation, String comment) {
457
			String num_nom_ret, String num_taxon, String famille,final String loc, String id_location,String dat, String complementLocation, String comment) {
455
 
458
 
456
 
459
 
457
		HTTPRequest.asyncPost(serviceBaseUrl + "/Inventory/" +ordre + "/", "identifiant="
460
		HTTPRequest.asyncPost(serviceBaseUrl + "/Inventory/" + user + "/" +ordre + "/",
458
				+ user + "&nom_sel=" + nom_sel + "&num_nom_sel=" + num_nom_sel
461
				 "&nom_sel=" + nom_sel + "&num_nom_sel=" + num_nom_sel
Line 459... Line 462...
459
				+ "&nom_ret=" + nom_ret + "&num_nom_ret=" + num_nom_ret
462
				+ "&nom_ret=" + nom_ret + "&num_nom_ret=" + num_nom_ret
Line 460... Line 463...
460
				+ "&num_taxon=" + num_taxon + "&famille=" + famille + "&location=" + loc + "&id_location=" + id_location + "&date_observation=" + dat
463
				+ "&num_taxon=" + num_taxon + "&famille=" + famille + "&location=" + loc + "&id_location=" + id_location + "&date_observation=" + dat
461
				+ "&station="+ complementLocation + "&commentaire="+ comment,
464
				+ "&station="+ complementLocation + "&commentaire="+ comment,
-
 
465
 
462
 
466
		new ResponseTextHandler() {
463
		new ResponseTextHandler() {
467
 
464
 
468
			public void onCompletion(String str) {
465
			public void onCompletion(String str) {
469
				add=false;
Line -... Line 470...
-
 
470
				mediator.onInventoryUpdated(location);
-
 
471
				update();
-
 
472
			}
-
 
473
		});
-
 
474
	}
-
 
475
 
-
 
476
	/**
-
 
477
	 * Transmission de releve à Tela
-
 
478
	 * 
-
 
479
	 */
-
 
480
 
-
 
481
	
-
 
482
	
-
 
483
	public void transmitElement() {
-
 
484
	
-
 
485
		setStatusDisabled();
-
 
486
		Vector parseChecked = new Vector();
-
 
487
 
-
 
488
		// TODO : optimiser
-
 
489
		// Lifo ...
-
 
490
		for (int i = table.getRowCount() - 1; i >= 0; i--) {
-
 
491
			 if (table.getWidget(i, 0)!=null) {
-
 
492
				 if (((CheckBox) table.getWidget(i, 0)).isChecked()) {
-
 
493
					 // Numero ordre
-
 
494
					 parseChecked.add(table.getText(i, 5));
-
 
495
				 }
-
 
496
			 }
-
 
497
		}
-
 
498
		StringBuffer ids=new StringBuffer();
-
 
499
		for (Iterator it = parseChecked.iterator(); it.hasNext();) {
-
 
500
			ids.append((String)it.next());
-
 
501
			if (it.hasNext()) ids.append(",");
-
 
502
		}
-
 
503
		
-
 
504
		if (ids.length()>0) {
-
 
505
		
-
 
506
			HTTPRequest.asyncPost(serviceBaseUrl + "/InventoryTransmit/" + user
-
 
507
							+ "/" + ids.toString(), "transmission=1",
-
 
508
							
-
 
509
							new ResponseTextHandler() {
-
 
510
								public void onCompletion(String str) {
-
 
511
											update();
-
 
512
								}
-
 
513
							});
-
 
514
		}
Line 466... Line 515...
466
				add=false;
515
	
467
				update();
516
		setStatusEnabled();
468
			}
517
 
469
		});
518
		
Line 470... Line 519...
470
	}
519
	}
Line 471... Line 520...
471
 
520
	
472
	
-
 
473
	/**
521
	
Line 474... Line 522...
474
	 * Suppression d'un element lde l'inventaire, a partir de son numero d'ordre
522
	/**
475
	 * 
523
	 * Suppression d'un element lde l'inventaire, a partir de son numero d'ordre
476
	 */
524
	 * 
477
 
525
	 */
478
	public void deleteElement() {
526
 
479
 
-
 
480
		setStatusDisabled();
527
	public void deleteElement() {
481
		boolean checked = false;
528
 
482
		Vector parseChecked = new Vector();
529
		setStatusDisabled();
483
 
530
		Vector parseChecked = new Vector();
484
		// TODO : optimiser
531
 
485
		// Lifo ...
532
		// TODO : optimiser
486
		for (int i = table.getRowCount() - 1; i >= 0; i--) {
533
		// Lifo ...
487
			 if (table.getWidget(i, 0)!=null) {
534
		for (int i = table.getRowCount() - 1; i >= 0; i--) {
488
				 if (((CheckBox) table.getWidget(i, 0)).isChecked()) {
535
			 if (table.getWidget(i, 0)!=null) {
489
					 checked = true;
536
				 if (((CheckBox) table.getWidget(i, 0)).isChecked()) {
490
					 // Numero ordre
537
					 // Numero ordre
-
 
538
					 parseChecked.add(table.getText(i, 5));
-
 
539
					 count--;
491
					 parseChecked.add(table.getText(i, 4));
540
				 }
492
					 count--;
541
			 }
493
				 }
542
		}
494
			 }
543
		StringBuffer ids=new StringBuffer();
495
		}
544
		for (Iterator it = parseChecked.iterator(); it.hasNext();) {
-
 
545
			ids.append((String)it.next());
496
		StringBuffer ids=new StringBuffer();
546
			if (it.hasNext()) ids.append(",");
497
		for (Iterator it = parseChecked.iterator(); it.hasNext();) {
547
		}
498
			ids.append((String)it.next());
548
		if (ids.length()>0) {
499
			if (it.hasNext()) ids.append(",");
-
 
500
		}
-
 
501
		HTTPRequest.asyncPost(serviceBaseUrl + "/Inventory/" + user
-
 
502
						+ "/" + ids.toString(), "action=DELETE",
549
			
-
 
550
			HTTPRequest.asyncPost(serviceBaseUrl + "/Inventory/" + user
-
 
551
							+ "/" + ids.toString(), "action=DELETE",
503
						
552
							
Line 504... Line 553...
504
						new ResponseTextHandler() {
553
							new ResponseTextHandler() {
505
							public void onCompletion(String str) {
554
								public void onCompletion(String str) {
506
										updateCount();
555
											mediator.onInventoryUpdated("all");
Line 548... Line 597...
548
		String adate="all";
597
		String adate="all";
549
		if (date.compareTo("all")!=0) {
598
		if (date.compareTo("all")!=0) {
550
			adate=date.substring(6,10)+"-"+date.substring(3,5)+"-"+date.substring(0,2)+" 00:00:00";
599
			adate=date.substring(6,10)+"-"+date.substring(3,5)+"-"+date.substring(0,2)+" 00:00:00";
551
		}
600
		}
Line 552... Line 601...
552
 
601
 
553
		HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryItemList/" + user + "/" + location + "/" + adate  + "/" + search, 
602
		HTTPRequest.asyncGet(serviceBaseUrl + "/InventoryItemList/" + user + "/" + location + "/" + adate  + "/" + search +  "/" + station, 
Line 554... Line 603...
554
				new ResponseTextHandler() {
603
				new ResponseTextHandler() {
Line 555... Line 604...
555
 
604
 
Line 564... Line 613...
564
								location="all";
613
								location="all";
565
							}
614
							}
566
							*/
615
							*/
567
							if (location.compareTo("")==0)
616
							if (location.compareTo("")==0)
568
								location="000null";
617
								location="000null";
569
							mediator.onInventoryItemUpdate(location);
618
						//	mediator.onInventoryItemUpdate(location);
570
							gotoEnd(); // Derniere page
619
							gotoEnd(); // Derniere page
571
							update();
620
							update();
572
						}
621
						}
573
					}
622
					}
574
				});
623
				});
Line 604... Line 653...
604
		if (location.compareTo("all")==0) {
653
		if (location.compareTo("all")==0) {
605
			com="Toutes communes";
654
			com="Toutes communes";
606
		}
655
		}
607
		else {
656
		else {
608
			if (location.compareTo("000null")==0) {
657
			if (location.compareTo("000null")==0) {
609
				com="Communes non précisées";
658
				com="Communes non renseignées";
610
			}
659
			}
611
			else {
660
			else {
612
			com="Commune de "+location;
661
			com="Commune de "+location;
613
			}
662
			}
614
		}
663
		}
Line 615... Line 664...
615
 
664
 
Line 616... Line 665...
616
		
665
		
617
		String dat;
666
		String dat;
618
		
667
		
619
		if (date.compareTo("all")==0) {
668
		if (date.compareTo("all")==0) {
620
			dat=", toute période";
669
			dat=", toutes périodes";
621
		}
670
		}
622
		else {
671
		else {
623
			if (date.compareTo("00/00/0000")==0) {
672
			if (date.compareTo("00/00/0000")==0) {
624
				dat=", période non précisé";
673
				dat=", périodes non renseignées";
625
			}
674
			}
626
			else {
675
			else {
-
 
676
				dat=", le "+ date;
Line 627... Line 677...
627
				dat=", le "+ date;
677
			}
Line -... Line 678...
-
 
678
		}
-
 
679
	
-
 
680
		
-
 
681
		String stat;
-
 
682
		
-
 
683
		if (station.compareTo("all")==0) {
-
 
684
			stat=", toutes stations";
-
 
685
		}
-
 
686
		else {
-
 
687
			if (station.compareTo("000null")==0) {
-
 
688
				stat=", stations non renseignées";
-
 
689
			}
-
 
690
			else {
-
 
691
				stat=", station "+ station;
-
 
692
			}
628
			}
693
		}
629
		}
694
	
Line 630... Line 695...
630
		
695
		
Line 631... Line 696...
631
		header.setHTML(0, 0, com +  dat );
696
		header.setHTML(0, 0, com +  dat + stat );
Line 642... Line 707...
642
				JSONArray jsonArrayNested;
707
				JSONArray jsonArrayNested;
Line 643... Line 708...
643
				
708
				
644
				StringBuffer left=new StringBuffer();
709
				StringBuffer left=new StringBuffer();
645
				StringBuffer center=new StringBuffer();
710
				StringBuffer center=new StringBuffer();
-
 
711
				StringBuffer right=new StringBuffer();
-
 
712
				
Line 646... Line 713...
646
				StringBuffer right=new StringBuffer();
713
				
647
 
714
 
648
				
715
				
Line 663... Line 730...
663
							center=new StringBuffer();
730
							center=new StringBuffer();
664
							right=new StringBuffer();
731
							right=new StringBuffer();
Line 665... Line 732...
665
							
732
							
666
							// Case a cocher
733
							// Case a cocher
-
 
734
							table.setWidget(row, 0, new CheckBox());
-
 
735
							
667
							table.setWidget(row, 0, new CheckBox());
736
							
-
 
737
							// Observation transmise
-
 
738
							
-
 
739
							
668
							// Nom saisi
740
							String atransmit=((JSONString) jsonArrayNested .get(11)).stringValue();
-
 
741
							
-
 
742
							if (atransmit.compareTo("1")==0) {
-
 
743
								table.setWidget(row,1,new Image("tela.gif"));
-
 
744
							}
-
 
745
							else {
-
 
746
								table.setWidget(row,1,new HTML(" "));
-
 
747
							}
669
 
748
							
Line 670... Line 749...
670
							left.append("<b>"+((JSONString) jsonArrayNested .get(0)).stringValue()+"</b>");
749
							left.append("<b>"+((JSONString) jsonArrayNested .get(0)).stringValue()+"</b>");
671
							
750
							
Line 735... Line 814...
735
								
814
								
Line 736... Line 815...
736
								String alieudit=((JSONString) jsonArrayNested .get(9)).stringValue();
815
								String alieudit=((JSONString) jsonArrayNested .get(9)).stringValue();
Line 737... Line 816...
737
							
816
							
738
//								Localisation - Lieu dit
817
//								Localisation - Lieu dit
739
								
818
								
Line 740... Line 819...
740
								if (alieudit.compareTo("null")!=0) {
819
								if (alieudit.compareTo("000null")!=0) {
741
									center.append(", "+alieudit);
820
									center.append(", "+alieudit);
Line 742... Line 821...
742
								}
821
								}
743
							
822
							
744
								String acomment=((JSONString) jsonArrayNested .get(10)).stringValue();
823
								String acomment=((JSONString) jsonArrayNested .get(10)).stringValue();
745
//								Commentaire
-
 
Line 746... Line -...
746
								
-
 
747
								if (acomment.compareTo("null")!=0) {
-
 
748
									center.append(", "+acomment);
824
//								Commentaire
Line 749... Line 825...
749
								}
825
								
750
							
826
								if (acomment.compareTo("null")!=0) {
751
 
827
									center.append(", "+acomment);
Line 761... Line 837...
761
								else {
837
								else {
762
//									right.append("<b>00/00/0000</b>"); 
838
//									right.append("<b>00/00/0000</b>"); 
763
								}
839
								}
Line 764... Line -...
764
								
-
 
765
							
-
 
766
 
-
 
767
							
-
 
768
								
840
								
769
								
841
							
770
							table.setHTML(row, 1, subLeft("&nbsp;"+left,40));
842
							table.setHTML(row, 2, subLeft("&nbsp;"+left,40));
Line 771... Line 843...
771
							table.setHTML(row, 2, subLeft("&nbsp;"+center,120));
843
							table.setHTML(row, 3, subLeft("&nbsp;"+center,120));
Line 772... Line 844...
772
							table.setHTML(row, 3, subLeft("&nbsp;"+right,25));
844
							table.setHTML(row, 4, subLeft("&nbsp;"+right,25));
773
							
845
							
774
							table.getRowFormatter().removeStyleName(row, "inventoryItem-SelectedRow");
846
							table.getRowFormatter().removeStyleName(row, "inventoryItem-SelectedRow");
-
 
847
							
775
							
848
						
-
 
849
							table.getCellFormatter().setWidth(row,0,"2%");
776
						
850
							table.getCellFormatter().setWidth(row,1,"2%");
Line 777... Line 851...
777
							table.getCellFormatter().setWordWrap(row,1,false);
851
							table.getCellFormatter().setWordWrap(row,2,false);
Line 778... Line 852...
778
							table.getCellFormatter().setWidth(row,1,"10%");
852
							table.getCellFormatter().setWidth(row,2,"10%");
-
 
853
							table.getCellFormatter().setWordWrap(row,3,false);
-
 
854
							table.getCellFormatter().setWordWrap(row,4,false);
779
							table.getCellFormatter().setWordWrap(row,2,false);
855
							table.getCellFormatter().setWidth(row,4,"7%");
Line 780... Line 856...
780
							table.getCellFormatter().setWordWrap(row,3,false);
856
							
781
							table.getCellFormatter().setWidth(row,3,"7%");
857
							
782
							
858
							String aordre=((JSONString) jsonArrayNested.get(7)).stringValue();
783
							
859
						
Line 797... Line 873...
797
								if ((mediator.getEntryPanel().getOrdre()!=null) && (mediator.getEntryPanel().getOrdre().compareTo(aordre)==0)) {
873
								if ((mediator.getEntryPanel().getOrdre()!=null) && (mediator.getEntryPanel().getOrdre().compareTo(aordre)==0)) {
798
									selectRow(row);
874
									selectRow(row);
799
								}
875
								}
800
							}
876
							}
Line 801... Line 877...
801
 
877
 
Line 802... Line 878...
802
							table.getCellFormatter().setVisible(row, 4, false);
878
							table.getCellFormatter().setVisible(row, 5, false);
Line 803... Line 879...
803
 
879
 
Line 813... Line 889...
813
						 table.setHTML(j,0,"&nbsp;");
889
						 table.setHTML(j,0,"&nbsp;");
814
						 table.setHTML(j,1,"&nbsp;");
890
						 table.setHTML(j,1,"&nbsp;");
815
						 table.setHTML(j,2,"&nbsp;");
891
						 table.setHTML(j,2,"&nbsp;");
816
						 table.setHTML(j,3,"&nbsp;");
892
						 table.setHTML(j,3,"&nbsp;");
817
						 table.setHTML(j,4,"&nbsp;");
893
						 table.setHTML(j,4,"&nbsp;");
-
 
894
						 table.setHTML(j,5,"&nbsp;");
818
						table.getCellFormatter().setVisible(j, 4, false);
895
						table.getCellFormatter().setVisible(j, 5, false);
819
						table.getRowFormatter().removeStyleName(j, "inventoryItem-SelectedRow");
896
						table.getRowFormatter().removeStyleName(j, "inventoryItem-SelectedRow");
820
				}
897
				}
Line 821... Line 898...
821
				
898
				
Line 931... Line 1008...
931
 
1008
 
932
 
1009
 
933
	public void setDate(String date) {
1010
	public void setDate(String date) {
-
 
1011
		this.date = date;
-
 
1012
	}
-
 
1013
 
-
 
1014
 
-
 
1015
	public void setUser(String user) {
Line -... Line 1016...
-
 
1016
		this.user = user;
-
 
1017
	}
-
 
1018
	
-
 
1019
 
-
 
1020
	public void setStation(String station) {
-
 
1021
		this.station = station;