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