Revision 5ab46e89
Added by Katja Luther over 3 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/ChecklistEditorE4.java | ||
---|---|---|
473 | 473 |
Representation rep = term.getPreferredRepresentation(CdmStore.getDefaultLanguage()); |
474 | 474 |
String label = rep.getLabel(); |
475 | 475 |
if (label == null){ |
476 |
term.getTitleCache(); |
|
476 |
label = term.getTitleCache();
|
|
477 | 477 |
} |
478 | 478 |
if (PreferencesUtil.isShowIdInVocabularyInChecklistEditor()){ |
479 | 479 |
if (term.getIdInVocabulary() != null){ |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/DistributionEditor.java | ||
---|---|---|
78 | 78 |
import eu.etaxonomy.cdm.model.common.Language; |
79 | 79 |
import eu.etaxonomy.cdm.model.common.OrderedTermBase; |
80 | 80 |
import eu.etaxonomy.cdm.model.common.OrderedTermComparator; |
81 |
import eu.etaxonomy.cdm.model.common.Representation; |
|
81 | 82 |
import eu.etaxonomy.cdm.model.common.TermIdInVocabularyComparator; |
82 | 83 |
import eu.etaxonomy.cdm.model.common.TermLanguageComparator; |
83 | 84 |
import eu.etaxonomy.cdm.model.common.TermVocabulary; |
... | ... | |
533 | 534 |
loadNamedAreas(); |
534 | 535 |
for (DefinedTermBase area: areas) { |
535 | 536 |
this.areaToColumnIndexMap.put(index++, (NamedArea)area); |
536 |
|
|
537 |
String areaLabel; |
|
537 | 538 |
//TODO: adapt to preference |
538 |
String areaLabel = area.getLabel(); |
|
539 |
Representation rep = area.getPreferredRepresentation(CdmStore.getDefaultLanguage()); |
|
540 |
String label = rep.getLabel(); |
|
541 |
if (label == null){ |
|
542 |
label = area.getTitleCache(); |
|
543 |
} |
|
544 |
if (PreferencesUtil.isShowIdInVocabularyInChecklistEditor()){ |
|
545 |
if (area.getIdInVocabulary() != null){ |
|
546 |
areaLabel = area.getIdInVocabulary(); |
|
547 |
} else{ |
|
548 |
areaLabel = label; |
|
549 |
} |
|
550 |
}else if (PreferencesUtil.isShowSymbol1InChecklistEditor()){ |
|
551 |
if (area.getSymbol() != null){ |
|
552 |
areaLabel = area.getSymbol(); |
|
553 |
} else{ |
|
554 |
areaLabel = label; |
|
555 |
} |
|
556 |
}else if (PreferencesUtil.isShowSymbol2InChecklistEditor()){ |
|
557 |
if (area.getSymbol2() != null){ |
|
558 |
areaLabel = area.getSymbol2(); |
|
559 |
} else{ |
|
560 |
areaLabel = label; |
|
561 |
} |
|
562 |
}else{ |
|
563 |
areaLabel = label; |
|
564 |
} |
|
565 |
|
|
566 |
|
|
567 |
//String areaLabel = area.getLabel(); |
|
539 | 568 |
String property = areaLabel; |
540 | 569 |
propertyToLabelMap.put(property, areaLabel); |
541 | 570 |
} |
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/StatusDisplayConverter.java | ||
---|---|---|
8 | 8 |
*/ |
9 | 9 |
package eu.etaxonomy.taxeditor.editor.view.checklist.e4; |
10 | 10 |
|
11 |
import org.apache.commons.lang.StringUtils; |
|
11 | 12 |
import org.eclipse.nebula.widgets.nattable.data.convert.DisplayConverter; |
12 | 13 |
|
14 |
import eu.etaxonomy.cdm.model.common.Representation; |
|
13 | 15 |
import eu.etaxonomy.cdm.model.description.Distribution; |
14 | 16 |
import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm; |
17 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
|
18 |
import eu.etaxonomy.taxeditor.preference.TermDisplayEnum; |
|
19 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
|
15 | 20 |
|
16 | 21 |
/** |
17 | 22 |
* @author k.luther |
... | ... | |
19 | 24 |
* |
20 | 25 |
*/ |
21 | 26 |
public class StatusDisplayConverter extends DisplayConverter{ |
22 |
|
|
27 |
public static final String DEFAULT_ENTRY = ""; |
|
23 | 28 |
/** |
24 | 29 |
* {@inheritDoc} |
25 | 30 |
*/ |
... | ... | |
28 | 33 |
if(canonicalValue instanceof Distribution){ |
29 | 34 |
Distribution distribution = (Distribution)canonicalValue; |
30 | 35 |
if (distribution.getStatus() != null){ |
31 |
return distribution.getStatus().getLabel(); |
|
36 |
PresenceAbsenceTerm term = distribution.getStatus(); |
|
37 |
Representation rep = distribution.getStatus().getPreferredRepresentation(CdmStore.getDefaultLanguage()); |
|
38 |
String label = rep.getLabel(); |
|
39 |
|
|
40 |
if (label == null){ |
|
41 |
label = distribution.getStatus().getTitleCache(); |
|
42 |
} |
|
43 |
if (PreferencesUtil.displayStatusInChecklistEditor() != null){ |
|
44 |
if(PreferencesUtil.displayStatusInChecklistEditor().equals(TermDisplayEnum.IdInVocabulary.getKey())){ |
|
45 |
return (StringUtils.isNotBlank(distribution.getStatus().getIdInVocabulary()))?distribution.getStatus().getIdInVocabulary():label; |
|
46 |
}else if(PreferencesUtil.displayStatusInChecklistEditor().equals(TermDisplayEnum.Symbol1.getKey())){ |
|
47 |
|
|
48 |
return (StringUtils.isNotBlank(distribution.getStatus().getSymbol() ))?distribution.getStatus().getSymbol():label; |
|
49 |
}else if(PreferencesUtil.displayStatusInChecklistEditor().equals(TermDisplayEnum.Symbol2.getKey())){ |
|
50 |
return (StringUtils.isNotBlank(distribution.getStatus().getSymbol2() ))?distribution.getStatus().getSymbol2():label; |
|
51 |
}else{ |
|
52 |
return (label != null)?label:DEFAULT_ENTRY; |
|
53 |
} |
|
54 |
|
|
55 |
}else{ |
|
56 |
return (label != null)?label:DEFAULT_ENTRY; |
|
57 |
} |
|
32 | 58 |
} |
33 | 59 |
|
34 | 60 |
return ""; |
Also available in: Unified diff
ref #7854: show label corresponding to preferences