Revision 21cbdd69
Added by Katja Luther over 5 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/container/ConceptContainerE4.java | ||
---|---|---|
9 | 9 |
|
10 | 10 |
package eu.etaxonomy.taxeditor.editor.name.e4.container; |
11 | 11 |
|
12 |
import org.apache.commons.lang.StringUtils; |
|
12 |
import java.util.ArrayList; |
|
13 |
import java.util.List; |
|
14 |
|
|
13 | 15 |
import org.eclipse.swt.graphics.Font; |
14 | 16 |
|
17 |
import eu.etaxonomy.cdm.format.taxon.TaxonRelationshipFormatter; |
|
15 | 18 |
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper; |
19 |
import eu.etaxonomy.cdm.model.common.Language; |
|
16 | 20 |
import eu.etaxonomy.cdm.model.name.TaxonName; |
17 | 21 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
18 | 22 |
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship; |
23 |
import eu.etaxonomy.cdm.strategy.cache.TaggedCacheHelper; |
|
24 |
import eu.etaxonomy.cdm.strategy.cache.TaggedText; |
|
19 | 25 |
import eu.etaxonomy.taxeditor.editor.l10n.Messages; |
20 | 26 |
import eu.etaxonomy.taxeditor.editor.name.container.EditorAnnotation; |
21 | 27 |
import eu.etaxonomy.taxeditor.editor.name.e4.TaxonNameEditorE4; |
22 | 28 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
23 | 29 |
import eu.etaxonomy.taxeditor.model.NameHelper; |
24 | 30 |
import eu.etaxonomy.taxeditor.preference.Resources; |
31 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
|
25 | 32 |
|
26 | 33 |
/** |
27 | 34 |
* |
... | ... | |
31 | 38 |
*/ |
32 | 39 |
public class ConceptContainerE4 extends AbstractGroupedContainerE4<Taxon> { |
33 | 40 |
TaxonRelationship relationship; |
41 |
TaxonRelationshipFormatter misappliedFormatter; |
|
42 |
|
|
34 | 43 |
private boolean isMisapplication; |
35 | 44 |
|
36 | 45 |
public ConceptContainerE4(AbstractGroupE4 group, Taxon misappliedName, boolean isMisapplication) { |
37 | 46 |
super(group, misappliedName); |
38 | 47 |
this.isMisapplication = isMisapplication; |
48 |
misappliedFormatter = new TaxonRelationshipFormatter(); |
|
39 | 49 |
|
40 | 50 |
} |
41 | 51 |
|
... | ... | |
78 | 88 |
String title = ""; |
79 | 89 |
String author = ""; |
80 | 90 |
TaxonName conceptName = HibernateProxyHelper.deproxy(getMisappliedName().getName()); |
81 |
if (isMisapplication && StringUtils.isNotBlank(conceptName.getAuthorshipCache())){ |
|
82 |
author = ", non " + conceptName.getAuthorshipCache(); |
|
83 |
} |
|
84 |
if ((isMisapplication &&getMisappliedName().getSec() == null) || (!isMisapplication && relationship.getCitation() == null)) { |
|
85 |
if (getMisappliedName().getAppendedPhrase() != null ){ |
|
86 |
title = getMisappliedName().getAppendedPhrase(); |
|
87 |
}else if (isMisapplication){ |
|
88 |
title = "auct."; |
|
91 |
List<Language> languages = new ArrayList<>(); |
|
92 |
languages.add(CdmStore.getDefaultLanguage()); |
|
93 |
List<TaggedText> taggedText = misappliedFormatter.getTaggedText(relationship, true, languages); |
|
89 | 94 |
|
90 |
} |
|
91 |
|
|
92 |
} else { |
|
93 |
String sec ; |
|
94 |
if (isMisapplication){ |
|
95 |
sec = " sensu "; |
|
96 |
}else{ |
|
97 |
sec = " syn. sec. "; |
|
98 |
} |
|
99 |
if (getMisappliedName().getAppendedPhrase() != null ){ |
|
100 |
sec = getMisappliedName().getAppendedPhrase() + " " + sec; |
|
101 |
} |
|
102 |
if (isMisapplication){ |
|
103 |
title += sec + getMisappliedName().getSec().getCacheStrategy().getCitation(getMisappliedName().getSec()); |
|
104 |
}else{ |
|
105 |
title += sec + relationship.getCitation().getCacheStrategy().getCitation(relationship.getCitation()); |
|
106 |
} |
|
107 |
} |
|
108 |
if (relationship.getType().isProParte() && isMisapplication){ |
|
109 |
title += " p.p. "; |
|
110 |
} |
|
111 |
title += author; |
|
112 |
title = title.replace("&", "&&"); |
|
113 |
setNonEditableInfo(title, false); |
|
95 |
String title2 = TaggedCacheHelper.createString(taggedText.subList(4, taggedText.size())); |
|
96 |
setNonEditableInfo(title2, false); |
|
114 | 97 |
} |
115 | 98 |
|
116 | 99 |
public Taxon getMisappliedName() { |
Also available in: Unified diff
use TaxonRelationshipFormatter for NameEditor