Subversion Repositories eFlore/Applications.cel

Rev

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

Rev 1641 Rev 1672
Line 817... Line 817...
817
            }
817
            }
818
        }); 
818
        }); 
Line 819... Line 819...
819
		 
819
		 
820
		selecteurReferentielTaxo.addListener(new ComboBoxListenerAdapter() {  
820
		selecteurReferentielTaxo.addListener(new ComboBoxListenerAdapter() {  
821
             @Override
821
             @Override
822
			public void onSelect(ComboBox comboBox, Record record, int index) { 
-
 
823
            	 espece.setValue("");
-
 
824
            	 numeroNom = "";
-
 
825
            	 especeModifiee = true;
822
			public void onSelect(ComboBox comboBox, Record record, int index) {
826
            	 referentielTaxo = record.getAsString("valeur");
823
            	 referentielTaxo = record.getAsString("valeur");
827
                 observationMediateur.setRefTaxSelectionne(index);
824
                 observationMediateur.setRefTaxSelectionne(index);
828
                 referentielTaxoModifie = true;
825
                 referentielTaxoModifie = true;
829
             }  
826
             }  
Line 1076... Line 1073...
1076
 
1073
 
1077
	@Override
1074
	@Override
Line 1078... Line 1075...
1078
	public void rafraichir(Object nouvelleDonnees, boolean repandreRaffraichissement) {
1075
	public void rafraichir(Object nouvelleDonnees, boolean repandreRaffraichissement) {
1079
		
1076
		
1080
		// si l'on a reçu une liste du referentiel commune (completion referentiel commune)
1077
		// si l'on a reçu une liste du referentiel commune (completion referentiel commune)
1081
			if(nouvelleDonnees instanceof ListeReferentielCommune)
1078
		if(nouvelleDonnees instanceof ListeReferentielCommune)
1082
			{
1079
		{
1083
				ListeReferentielCommune data = (ListeReferentielCommune) nouvelleDonnees ;
1080
			ListeReferentielCommune data = (ListeReferentielCommune) nouvelleDonnees ;
1084
				Object[][] communeData = new Object[data.size()][3];
1081
			Object[][] communeData = new Object[data.size()][3];
1085
				int i = 0 ;
1082
			int i = 0 ;
1086
			
1083
		
1087
				// on la parse et on récupère les informations quiç nous interessent
1084
			// on la parse et on récupère les informations quiç nous interessent
1088
				for (Iterator it = data.keySet().iterator(); it.hasNext();) 
1085
			for (Iterator it = data.keySet().iterator(); it.hasNext();) 
1089
				{					
-
 
1090
					ReferentielCommune ref=data.get(it.next());
-
 
1091
					
-
 
1092
					communeData[i][0]= ref.getCommune();
-
 
1093
					communeData[i][1]= ref.getDepartement();
-
 
1094
					communeData[i][2]= ref.getCodeInsee();
-
 
1095
					i++ ;
-
 
1096
				}
-
 
1097
				
-
 
1098
				// creation du store
-
 
1099
				FieldDef defCommune = new StringFieldDef("commune");
-
 
1100
				FieldDef defDepartement = new StringFieldDef("departement");
-
 
1101
				FieldDef defCodeInsee = new StringFieldDef("codeInsee");
-
 
1102
							
-
 
1103
				FieldDef[] defTab = { defCommune, defDepartement, defCodeInsee};
-
 
1104
				
-
 
1105
				RecordDef rd = new RecordDef(defTab);
-
 
1106
				
-
 
1107
				final MemoryProxy dataProxy = new MemoryProxy(communeData);
-
 
1108
				final ArrayReader reader = new ArrayReader(rd);		
-
 
1109
								
-
 
1110
				Store store=new Store(dataProxy,reader);	
-
 
Line -... Line 1086...
-
 
1086
			{					
-
 
1087
				ReferentielCommune ref=data.get(it.next());
-
 
1088
				
-
 
1089
				communeData[i][0]= ref.getCommune();
1111
				commune.setStore(store);
1090
				communeData[i][1]= ref.getDepartement();
Line 1112... Line -...
1112
				store.load();
-
 
1113
				
-
 
1114
			}
-
 
1115
			
-
 
1116
			// si l'on a reçu une liste du référentiel nom (complétion referentiel nom)
-
 
1117
			if(nouvelleDonnees instanceof ListeReferentielNom)
-
 
1118
			{
-
 
1119
				ListeReferentielNom data = (ListeReferentielNom) nouvelleDonnees ;
-
 
1120
				Object[][] nomData = new Object[data.size()][3];
-
 
1121
				int i = 0 ;
-
 
1122
 
-
 
1123
				// on la parse et on récupère les informations qui nous interessent
-
 
1124
				for (Iterator it = data.keySet().iterator(); it.hasNext();) 
-
 
1125
				{
-
 
1126
					
-
 
1127
					ReferentielNom ref=data.get(it.next());
-
 
1128
					
-
 
1129
					nomData[i][0]= ref.getNom();
-
 
1130
					nomData[i][1]= ref.getNumeroNom();
-
 
1131
					if (ref.getStatut().equals("3")) {
1091
				communeData[i][2]= ref.getCodeInsee();
1132
						nomData[i][2]="nom_retenu";
-
 
1133
					}
-
 
1134
					else {
-
 
1135
						nomData[i][2]="";
-
 
1136
					}														
1092
				i++ ;
1137
					i++ ;
1093
			}
1138
				}
1094
			
Line 1139... Line 1095...
1139
 
1095
			// creation du store
1140
				FieldDef defNom = new StringFieldDef("nom");
-
 
1141
				FieldDef defNumeroNom = new StringFieldDef("numeroNom");
-
 
1142
				FieldDef indicateurNomRetenu = new StringFieldDef("indicateurNomRetenu");
-
 
1143
						
-
 
1144
				FieldDef[] defTab = { defNom, defNumeroNom, indicateurNomRetenu};
-
 
1145
				
-
 
1146
				RecordDef rd = new RecordDef(defTab);
-
 
1147
				
-
 
1148
				final MemoryProxy dataProxy = new MemoryProxy(nomData);
-
 
1149
				final ArrayReader reader = new ArrayReader(rd);		
-
 
Line 1150... Line 1096...
1150
				
1096
			FieldDef defCommune = new StringFieldDef("commune");
Line -... Line 1097...
-
 
1097
			FieldDef defDepartement = new StringFieldDef("departement");
1151
				Store store=new Store(dataProxy,reader);	
1098
			FieldDef defCodeInsee = new StringFieldDef("codeInsee");
1152
				espece.setStore(store);
1099
						
1153
				store.load() ;
1100
			FieldDef[] defTab = { defCommune, defDepartement, defCodeInsee};
1154
			}
1101
			
1155
			
1102
			RecordDef rd = new RecordDef(defTab);
1156
			// On recoit une observation dont on veut afficher le detail 
-
 
Line -... Line 1103...
-
 
1103
			
-
 
1104
			final MemoryProxy dataProxy = new MemoryProxy(communeData);
-
 
1105
			final ArrayReader reader = new ArrayReader(rd);		
1157
			
1106
							
-
 
1107
			Store store=new Store(dataProxy,reader);	
-
 
1108
			commune.setStore(store);
-
 
1109
			store.load();
-
 
1110
			
-
 
1111
		}
-
 
1112
		
-
 
1113
		// si l'on a reçu une liste du référentiel nom (complétion referentiel nom)
-
 
1114
		if(nouvelleDonnees instanceof ListeReferentielNom)
Line 1158... Line 1115...
1158
			if(nouvelleDonnees instanceof Observation)
1115
		{
-
 
1116
			ListeReferentielNom data = (ListeReferentielNom) nouvelleDonnees ;
1159
			{
1117
			Object[][] nomData = new Object[data.size()][3];
-
 
1118
			int i = 0 ;
1160
				Observation obs = (Observation)nouvelleDonnees ;
1119
 
-
 
1120
			// on la parse et on récupère les informations qui nous interessent
-
 
1121
			for (Iterator it = data.keySet().iterator(); it.hasNext();) 
-
 
1122
			{
-
 
1123
				
-
 
1124
				ReferentielNom ref=data.get(it.next());
-
 
1125
				
1161
				setSelectionMultiple(false);
1126
				nomData[i][0]= ref.getNom();
-
 
1127
				nomData[i][1]= ref.getNumeroNom();
-
 
1128
				if (ref.getStatut().equals("3")) {
-
 
1129
					nomData[i][2]="nom_retenu";
-
 
1130
				}
-
 
1131
				else {
-
 
1132
					nomData[i][2]="";
Line 1162... Line 1133...
1162
				afficherDetailsObservation(obs) ;
1133
				}														
1163
			}
-
 
1164
			
-
 
1165
			if(nouvelleDonnees instanceof ListeObservation) {
-
 
1166
				
-
 
Line 1167... Line 1134...
1167
				ListeObservation listeObs = (ListeObservation)nouvelleDonnees;
1134
				i++ ;
1168
				setSelectionMultiple(true);
1135
			}
1169
				calculerAfficherDifferences(listeObs);
-
 
1170
			}
-
 
1171
			
-
 
Line -... Line 1136...
-
 
1136
 
-
 
1137
			FieldDef defNom = new StringFieldDef("nom");
-
 
1138
			FieldDef defNumeroNom = new StringFieldDef("numeroNom");
-
 
1139
			FieldDef indicateurNomRetenu = new StringFieldDef("indicateurNomRetenu");
-
 
1140
					
-
 
1141
			FieldDef[] defTab = { defNom, defNumeroNom, indicateurNomRetenu};
-
 
1142
			
-
 
1143
			RecordDef rd = new RecordDef(defTab);
-
 
1144
			
-
 
1145
			final MemoryProxy dataProxy = new MemoryProxy(nomData);
-
 
1146
			final ArrayReader reader = new ArrayReader(rd);		
-
 
1147
			
-
 
1148
			Store store=new Store(dataProxy,reader);	
-
 
1149
			espece.setStore(store);
-
 
1150
			store.load() ;
-
 
1151
		}
-
 
1152
		
-
 
1153
		// On recoit une observation dont on veut afficher le detail 
-
 
1154
		
-
 
1155
		if(nouvelleDonnees instanceof Observation)
-
 
1156
		{
-
 
1157
			Observation obs = (Observation)nouvelleDonnees ;
-
 
1158
			setSelectionMultiple(false);
-
 
1159
			afficherDetailsObservation(obs) ;
-
 
1160
		}
-
 
1161
		
-
 
1162
		if(nouvelleDonnees instanceof ListeObservation) {
-
 
1163
			
-
 
1164
			ListeObservation listeObs = (ListeObservation)nouvelleDonnees;
-
 
1165
			setSelectionMultiple(true);
-
 
1166
			calculerAfficherDifferences(listeObs);
-
 
1167
		}
-
 
1168
		
1172
			if(nouvelleDonnees instanceof String)
1169
		if(nouvelleDonnees instanceof String)
1173
			{
1170
		{
1174
				String str = (String)nouvelleDonnees ;
1171
			String str = (String)nouvelleDonnees ;
1175
				observationMediateur.obtenirNombreObservation() ;
1172
			observationMediateur.obtenirNombreObservation() ;
1176
			}
1173
		}
1177
			
1174
		
1178
			if(nouvelleDonnees instanceof String[]) {
1175
		if(nouvelleDonnees instanceof String[]) {
1179
				String[] anumNom = (String[])nouvelleDonnees ;
-
 
1180
				numeroNom = anumNom[1];
1176
			String[] anumNom = (String[])nouvelleDonnees ;
1181
				espece.setValue(anumNom[0]);
1177
			numeroNom = anumNom[1];
1182
			}
1178
			espece.setValue(anumNom[0]);
Line 1183... Line 1179...
1183
			
1179
		}
1184
			if(nouvelleDonnees instanceof EntiteGeographiqueObservation)
1180
		
Line 1312... Line 1308...
1312
		observationMediateur.obtenirListeReferentielPerso(this,TypesReferentiels.REFERENTIEL_LIEU_DIT,lieudit.getText());
1308
		observationMediateur.obtenirListeReferentielPerso(this,TypesReferentiels.REFERENTIEL_LIEU_DIT,lieudit.getText());
1313
	}
1309
	}
Line 1314... Line 1310...
1314
   
1310
   
Line 1315... Line 1311...
1315
	public void ajouterObservation() {
1311
	public void ajouterObservation() {
1316
		
1312
		
1317
		if(!Util.verifierDateFormatCel(date.getRawValue()) && !date.getRawValue().equals("")) {
1313
		if(date.getRawValue() != null && !date.getRawValue().equals("") && !Util.verifierDateFormatCel(date.getRawValue())) {
1318
			Window.alert("Attention la date saisie est invalide, la date doit être au format jj/mm/aaaa");
1314
			Window.alert("Attention la date saisie est invalide, la date doit être au format jj/mm/aaaa");
1319
			date.setInvalidText("Date invalide");
1315
			date.setInvalidText("Date invalide");
Line 1364... Line 1360...
1364
		observationMediateur.ajouterObservation(obs);
1360
		observationMediateur.ajouterObservation(obs);
1365
	}
1361
	}
Line 1366... Line 1362...
1366
 
1362
 
Line -... Line 1363...
-
 
1363
	private void modifierObservation() {
-
 
1364
		
-
 
1365
		if(!Window.confirm("Êtes-vous sur de vouloir modifier l'observation sélectionnée ?")) {
-
 
1366
			return;
1367
	private void modifierObservation() {
1367
		}
1368
		
1368
		 
1369
		if(!Util.verifierDateFormatCel(date.getRawValue()) && !date.getRawValue().equals("")) {
1369
		if(date.getRawValue() != null && !date.getRawValue().equals("") && !Util.verifierDateFormatCel(date.getRawValue())) {
1370
			Window.alert("Attention la date saisie est invalide, la date doit être au format jj/mm/aaaa");
1370
			Window.alert("Attention la date saisie est invalide, la date doit être au format jj/mm/aaaa");
1371
			date.setInvalidText("Date invalide");
1371
			date.setInvalidText("Date invalide");
Line 1397... Line 1397...
1397
		
1397
		
Line 1398... Line 1398...
1398
		String dateObs = Util.remplacerSeparateursDateFormatCel(date.getRawValue());
1398
		String dateObs = Util.remplacerSeparateursDateFormatCel(date.getRawValue());
1399
		
1399
		
1400
		Observation obs=new Observation(espece.getText(),numeroNom,commune.getText(),departement,lieudit.getText(),station.getText(),milieu.getText(), comment.getText(),dateObs);
1400
		Observation obs=new Observation(espece.getText(),numeroNom,commune.getText(),departement,lieudit.getText(),station.getText(),milieu.getText(), comment.getText(),dateObs);
1401
		obs.setNumeroOrdre(numeroOrdre);
1401
		obs.setNumeroOrdre(numeroOrdre);
Line 1402... Line 1402...
1402
		
1402
				
1403
		String[] coords = getValeurCoordonnees();
1403
		String[] coords = getValeurCoordonnees();
1404
		
1404
		
Line 1714... Line 1714...
1714
	private void afficherChampsEtendus(Observation obs) {
1714
	private void afficherChampsEtendus(Observation obs) {
1715
		viderChampsEtendus();
1715
		viderChampsEtendus();
1716
		conteneurChampEtenduGauche = new FormPanel();
1716
		conteneurChampEtenduGauche = new FormPanel();
1717
		conteneurChampEtenduDroite = new FormPanel();
1717
		conteneurChampEtenduDroite = new FormPanel();
Line 1718... Line 1718...
1718
		
1718
		
1719
		if(obs.getChampsEtendus().size() > 0) {
1719
		if(obs.getChampsEtendus() != null && obs.getChampsEtendus().size() > 0) {
1720
			lienAfficherChampsEtendus.setVisible(true);
1720
			lienAfficherChampsEtendus.setVisible(true);
1721
			conteneurChampEtenduGauche.setAutoWidth(true);
1721
			conteneurChampEtenduGauche.setAutoWidth(true);
1722
			conteneurChampEtenduGauche.setStyle("conteneurChampsEtendus");
1722
			conteneurChampEtenduGauche.setStyle("conteneurChampsEtendus");
1723
			conteneurChampEtenduGauche.setLabelWidth(150);
1723
			conteneurChampEtenduGauche.setLabelWidth(150);