Revision 4e956294
Added by Andreas Müller over 5 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/container/ConceptContainerE4.java | ||
---|---|---|
18 | 18 |
import eu.etaxonomy.cdm.model.common.Language; |
19 | 19 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
20 | 20 |
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship; |
21 |
import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType; |
|
22 | 21 |
import eu.etaxonomy.cdm.strategy.cache.TaggedCacheHelper; |
23 | 22 |
import eu.etaxonomy.cdm.strategy.cache.TaggedText; |
24 | 23 |
import eu.etaxonomy.taxeditor.editor.l10n.Messages; |
25 | 24 |
import eu.etaxonomy.taxeditor.editor.name.container.EditorAnnotation; |
26 | 25 |
import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4; |
27 |
import eu.etaxonomy.taxeditor.editor.name.e4.container.MisappliedGroupE4.ConceptType; |
|
28 | 26 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
29 | 27 |
import eu.etaxonomy.taxeditor.model.NameHelper; |
30 | 28 |
import eu.etaxonomy.taxeditor.preference.Resources; |
... | ... | |
39 | 37 |
public class ConceptContainerE4 extends AbstractGroupedContainerE4<Taxon> { |
40 | 38 |
TaxonRelationship relationship; |
41 | 39 |
TaxonRelationshipFormatter misappliedFormatter; |
42 |
ConceptType conceptType; |
|
43 | 40 |
|
41 |
private boolean isMisapplication; |
|
44 | 42 |
|
45 |
|
|
46 |
public ConceptContainerE4(AbstractGroupE4 group, Taxon misappliedName, ConceptType conceptType) { |
|
43 |
public ConceptContainerE4(AbstractGroupE4 group, Taxon misappliedName, boolean isMisapplication) { |
|
47 | 44 |
super(group, misappliedName); |
48 |
this.conceptType = conceptType;
|
|
45 |
this.isMisapplication = isMisapplication;
|
|
49 | 46 |
misappliedFormatter = new TaxonRelationshipFormatter(); |
50 | 47 |
|
51 | 48 |
} |
... | ... | |
58 | 55 |
TaxonNameEditorE4 editor = getEditor(); |
59 | 56 |
Taxon taxon = editor.getTaxon(); |
60 | 57 |
for (TaxonRelationship rel: taxon.getTaxonRelations(getMisappliedName())){ |
61 |
if (rel.getType().isAnyMisappliedName() && this.conceptType.equals(ConceptType.Misapplication)){
|
|
58 |
if (rel.getType().isAnyMisappliedName() && isMisapplication){
|
|
62 | 59 |
relationship = rel; |
63 | 60 |
break; |
64 |
}else if (rel.getType().isAnySynonym() && this.conceptType.equals(ConceptType.Synonym)){
|
|
61 |
}else if (rel.getType().isAnySynonym() && !isMisapplication){
|
|
65 | 62 |
relationship = rel; |
66 | 63 |
break; |
67 |
}else if (rel.getType().equals(TaxonRelationshipType.INVALID_DESIGNATION_FOR()) && this.conceptType.equals(ConceptType.InvalidDesignation)){ |
|
68 |
relationship = rel; |
|
69 |
break; |
|
70 |
} |
|
71 |
|
|
64 |
} |
|
72 | 65 |
} |
73 | 66 |
showSec(); |
74 | 67 |
|
... | ... | |
77 | 70 |
|
78 | 71 |
@Override |
79 | 72 |
protected void updateIcon() { |
80 |
if (relationship.getType().isMisappliedNameOrInvalidDesignation()){
|
|
73 |
if (relationship.getType().isAnyMisappliedName()){
|
|
81 | 74 |
setIcon(MISAPPLIEDNAME_ICON); |
82 | 75 |
}else if (relationship.getType().isProParte()){ |
83 | 76 |
setIcon(PRO_PARTE_SYNONYM_ICON); |
84 |
} |
|
77 |
}else { |
|
78 |
setIcon(PARTIAL_SYNONYM_ICON); |
|
79 |
} |
|
85 | 80 |
} |
86 | 81 |
|
87 | 82 |
private void showSec() { |
... | ... | |
91 | 86 |
List<Language> languages = new ArrayList<>(); |
92 | 87 |
languages.add(CdmStore.getDefaultLanguage()); |
93 | 88 |
List<TaggedText> taggedText = misappliedFormatter.getTaggedText(relationship, true, languages, true); |
94 |
if (taggedText != null){ |
|
95 |
String title = TaggedCacheHelper.createString(taggedText); |
|
96 |
title = title.replace("&", "&&"); |
|
97 |
setNonEditableInfo(title, false); |
|
98 |
} |
|
99 | 89 |
|
90 |
String title = TaggedCacheHelper.createString(taggedText); |
|
91 |
title = title.replace("&", "&&"); |
|
92 |
setNonEditableInfo(title, false); |
|
100 | 93 |
} |
101 | 94 |
|
102 | 95 |
public Taxon getMisappliedName() { |
... | ... | |
139 | 132 |
|
140 | 133 |
updateIcon(); |
141 | 134 |
String text; |
142 |
if (!conceptType.equals(ConceptType.Synonym) ){
|
|
135 |
if (isMisapplication){
|
|
143 | 136 |
text = NameHelper.getDisplayNameCache(getData()); |
144 | 137 |
}else{ |
145 | 138 |
text = NameHelper.getDisplayName(getData()); |
... | ... | |
158 | 151 |
public void refresh() { |
159 | 152 |
// showNameRelations(); |
160 | 153 |
if (relationship.getType().isAnyMisappliedName()){ |
161 |
conceptType = ConceptType.Misapplication; |
|
162 |
}else if (relationship.getType().isAnySynonym()){ |
|
163 |
conceptType = ConceptType.Synonym; |
|
164 |
} else{ |
|
165 |
conceptType = ConceptType.InvalidDesignation; |
|
154 |
isMisapplication = true; |
|
155 |
}else{ |
|
156 |
isMisapplication = false; |
|
166 | 157 |
} |
167 | 158 |
String text; |
168 |
if (!conceptType.equals(ConceptType.Synonym) ){
|
|
159 |
if (isMisapplication){
|
|
169 | 160 |
text = NameHelper.getDisplayNameCache(getData()); |
170 | 161 |
}else{ |
171 | 162 |
text = NameHelper.getDisplayName(getData()); |
Also available in: Unified diff
Revert "ref #7761: invalid designations are displayed in name editor and details view like MAN"
This reverts commit 8e0e024c985ffbbe2ce2421270927059c9abf0cc.