Project

General

Profile

« Previous | Next » 

Revision 05a68539

Added by Alex Theys about 12 years ago

AT: commiting latest changes to the Palm Use data extension

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/UsesLabelProvider.java
50 50
			//TextData textData = categoricalDescriptionBuilder.build((CategoricalData) element, getLanguageList());
51 51
			if (!((CategoricalData) element).getStates().isEmpty()) {
52 52
				for (StateData statedata : ((CategoricalData) element).getStates()) {
53
					if(statedata.getState() != null) {
53
					if(statedata.getState() != null && statedata.getModifyingText().get(CdmStore.getDefaultLanguage()) !=null && statedata.getModifyingText().get(CdmStore.getDefaultLanguage()).getText().equals("Use Category")) {
54
						text = text + statedata.getState().getTitleCache() + "; ";
55
					}
56
				}
57
				for (StateData statedata : ((CategoricalData) element).getStates()) {
58
					if(statedata.getState() != null && statedata.getModifyingText().get(CdmStore.getDefaultLanguage()) !=null && statedata.getModifyingText().get(CdmStore.getDefaultLanguage()).getText().equals("Use SubCategory")) {
54 59
						text = text + statedata.getState().getTitleCache() + "; ";
55 60
					}
56
					/*else {
57
						text = "No data provided";
58
					}*/
59 61
				}
60 62
			}
61
			
62 63
			if (!((CategoricalData) element).getModifiers().isEmpty()) {
63
				for (Modifier modifier : ((CategoricalData) element).getModifiers()) {
64
					text = text + modifier.getTitleCache();
64
				for (Modifier modifier: ((CategoricalData) element).getModifiers()){
65
					if(GetVocabularyType(modifier, "Country")) {
66
						text = text +  modifier.getTitleCache()+ "; ";
67
					}
68
					
69
				}
70
				for (Modifier modifier: ((CategoricalData) element).getModifiers()){
71
					if(GetVocabularyType(modifier, "Plant Part")) {
72
						text = text +  modifier.getTitleCache()+ "; ";
73
					}
74
					
75
				}
76
				for (Modifier modifier: ((CategoricalData) element).getModifiers()){
77
					if(GetVocabularyType(modifier, "Human Group")) {
78
						text = text +  modifier.getTitleCache()+ "; ";
79
					}
80
					
81
				}
82
				for (Modifier modifier: ((CategoricalData) element).getModifiers()){
83
					if(GetVocabularyType(modifier, "Ethnic Group")) {
84
						text = text +  modifier.getTitleCache()+ "; ";
85
					}
86
					
65 87
				}
66 88
			}
67

  
68
			
69
			//text = textData.getText(CdmStore.getDefaultLanguage());
89
		
70 90
			if (text == null || text.length() == 0) {
71 91
				text = "No data provided";
72 92
			}
73 93
			return text;
74 94
		}
75
		/*else  if (element instanceof DescriptionElementBase) {
76
			Map useRecordText = ((DescriptionElementBase) element).getModifyingText();
77
			
78
			
79
			if (text == null || text.length() == 0) {
80
				text = "Use Record: No label provided";
81
			}
82
			text = useRecordText.toString();
83
			//text = "Something else";
84
		}*/
95

  
85 96
		else{
86 97
			text = "Use Record";
87 98
		}
......
89 100
		return  text;
90 101
	}
91 102

  
103
	
104
	private boolean GetVocabularyType(Modifier term, String vocabularyExpected) {
105
		if ((term.getPartOf() != null) && (term.getPartOf().getTitleCache().equals(vocabularyExpected))) {
106
			return true;
107
		}
108
		else if ((term.getVocabulary() != null) && (term.getVocabulary().getTitleCache().equals(vocabularyExpected))) {
109
			return true;
110
		}
111
		return false;
112
	}
92 113
	@Override
93 114
	public StyledString getStyledText(Object element) {
94 115
		return new StyledString(this.getText(element),

Also available in: Unified diff