Project

General

Profile

« Previous | Next » 

Revision eab43f53

Added by Alex Theys about 12 years ago

AT: Comminting bug fixing for TaxEditor

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/userecords/UseRecordDetailElement.java
261 261
		if (eventSource == combo_UseCategory) {
262 262
			if (combo_UseCategory.getSelection() != null) {
263 263
				boolean isChanged = false;
264
				boolean isUnchanged =false;
264 265
				if (!getEntity().getStates().isEmpty()) {
265 266
					for (StateData existingStateData : getEntity().getStates()) {
266 267
						Map<Language, LanguageString> modifyingText = existingStateData
267 268
								.getModifyingText();
268
	
269 269
						if (modifyingText.get(CdmStore.getDefaultLanguage()) != null) {
270
							if (modifyingText.get(CdmStore.getDefaultLanguage())
271
									.getText() == "Use Category") {
272
								getEntity().removeState(existingStateData);
273
								StateData stateData = StateData.NewInstance(combo_UseCategory.getSelection());
274
								stateData.setState(combo_UseCategory.getSelection());
275
								//stateData.addModifyingText("Use Category", CdmStore.getDefaultLanguage());
276
								stateData.putModifyingText(CdmStore.getDefaultLanguage(),"Use Category");
277
								getEntity().addState(stateData);
270
							if (modifyingText.get(CdmStore.getDefaultLanguage()).getText().equals("Use Category")) {
278 271
								isChanged = true;
279
							} 
280
							
272
								if(!existingStateData.getState().getTitleCache().equals(combo_UseCategory.getSelection().getTitleCache())) {
273
									getEntity().removeState(existingStateData);
274
									StateData stateData = StateData.NewInstance(combo_UseCategory.getSelection());
275
									stateData.setState(combo_UseCategory.getSelection());
276
									//stateData.addModifyingText("Use Category", CdmStore.getDefaultLanguage());
277
									stateData.putModifyingText(CdmStore.getDefaultLanguage(),"Use Category");
278
									getEntity().addState(stateData);
279
								}
280
							}
281 281
						}
282 282
					}
283 283
				}
......
319 319
								.getModifyingText();
320 320
	
321 321
						if (modifyingText.get(CdmStore.getDefaultLanguage()) != null) {
322
							if (modifyingText.get(CdmStore.getDefaultLanguage())
323
									.getText() == "Use SubCategory") {
324
								getEntity().removeState(existingStateData);
325
								StateData stateData = StateData.NewInstance(combo_UseSubCategory.getSelection());
326
								stateData.setState(combo_UseSubCategory.getSelection());
327
								//stateData.addModifyingText("Use SubCategory", CdmStore.getDefaultLanguage());
328
								stateData.putModifyingText(CdmStore.getDefaultLanguage(),"Use SubCategory");
329
								getEntity().addState(stateData);
322
							if (modifyingText.get(CdmStore.getDefaultLanguage()).getText().equals("Use SubCategory")) {
330 323
								isChanged = true;
324
								if(!existingStateData.getState().getTitleCache().equals(combo_UseSubCategory	.getSelection().getTitleCache())) {
325
									getEntity().removeState(existingStateData);
326
									StateData stateData = StateData.NewInstance(combo_UseSubCategory.getSelection());
327
									stateData.setState(combo_UseSubCategory.getSelection());
328
									//stateData.addModifyingText("Use SubCategory", CdmStore.getDefaultLanguage());
329
									stateData.putModifyingText(CdmStore.getDefaultLanguage(),"Use SubCategory");
330
									getEntity().addState(stateData);
331
								}
331 332
							} 
332 333
							
333 334
						}
......
490 491
	
491 492

  
492 493
	private boolean GetVocabularyType(Modifier term, String vocabularyExpected) {
493
			if ((term.getPartOf() != null) && (term.getPartOf().getTitleCache().equals(vocabularyExpected))) {
494
				return true;
495
			}
496
			else if ((term.getVocabulary() != null) && (term.getVocabulary().getTitleCache().equals(vocabularyExpected))) {
497
				return true;
498
			}
499
		return false;
494
		if ((term.getPartOf() != null)  && (term.getPartOf().getTitleCache().equals(vocabularyExpected))) {
495
			return true;
496
		}
497
		else if ((term.getVocabulary() != null) && (term.getPartOf()==null) && (term.getVocabulary().getTitleCache().equals(vocabularyExpected))) {
498
			return true;
499
		}
500
		else if ((vocabularyExpected.equals("Ethnic Group"))  && (term.getVocabulary() != null) && ((term.getPartOf() != null))) {
501
			return true;
502
		}
503
	return false;
500 504
	}
501 505
	
502 506
	
......
515 519
				State selectedUseCategory = combo_UseCategory.getSelection();
516 520
				if (selectedUseCategory != null) {
517 521
					if (!getEntity().getStates().isEmpty()) {
518
						for (StateData existingStateData : getEntity().getStates()) {
519
							Map<Language, LanguageString> modifyingText = existingStateData
520
									.getModifyingText();
521
		
522
						Iterator<StateData> itrExistingState = getEntity().getStates().iterator();
523
						while(itrExistingState.hasNext()) {
524
							StateData existingStateData = (StateData) itrExistingState.next();
525
							Map<Language, LanguageString> modifyingText = existingStateData.getModifyingText();
522 526
							if (modifyingText.get(CdmStore.getDefaultLanguage()) != null) {
523 527
								if (modifyingText.get(CdmStore.getDefaultLanguage())
524 528
										.getText() == "Use SubCategory") {
525
									getEntity().removeState(existingStateData);
529
									itrExistingState.remove();
526 530
									combo_UseSubCategory.setSelection(null);
527 531
									combo_UseSubCategory.getSelection();
528 532
								}
529 533
							}
530 534
						}
535
						/*for (StateData existingStateData : getEntity().getStates()) {
536
							
537
							if (modifyingText.get(CdmStore.getDefaultLanguage()) != null) {
538
								if (modifyingText.get(CdmStore.getDefaultLanguage())
539
										.getText() == "Use SubCategory") {
540
									getEntity().removeState(existingStateData);
541
									
542
								}
543
							}
544
						}*/
531 545
					}
532 546
					
533 547
					List<State> newSubCategories = setUseCategoryComboTerms(TermStore.getTerms(State.class, null, false),selectedUseCategory);

Also available in: Unified diff