Project

General

Profile

Revision 0ab85ea9

ID0ab85ea9762bc0d2a129b7d796fdc940401984e7
Parent 0238c919
Child 3fa460e5

Added by Katja Luther over 5 years ago

#4018: fix title of defined term details if global language is not the cdm default language

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractCdmDetailSection.java
21 21
import org.eclipse.ui.forms.widgets.TableWrapLayout;
22 22

  
23 23
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
24
import eu.etaxonomy.cdm.model.common.DefinedTermBase;
24 25
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
26
import eu.etaxonomy.cdm.model.common.Language;
27
import eu.etaxonomy.cdm.model.description.TextData;
25 28
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
29
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
26 30
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
27 31
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
28 32
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
......
127 131

  
128 132
	protected void setSectionTitle() {
129 133
		String title = "";
134
		String label = "";
130 135
		if (getEntity() != null && (getEntity() instanceof IdentifiableEntity) && !(getEntity() instanceof SpecimenOrObservationBase)) {
131
			title = ": " + ((IdentifiableEntity) getEntity()).getTitleCache();
136
			if (getEntity() instanceof DefinedTermBase<?> ){
137
				label = ((DefinedTermBase<?>)getEntity()).getLabel(PreferencesUtil.getGlobalLanguage());
138
				if (label == null){
139
					label = ((DefinedTermBase<?>)getEntity()).getLabel();
140
				}
141
				
142
			} else if (getEntity() instanceof TextData){
143
				label = ((TextData)getEntity()).getLanguageText(PreferencesUtil.getGlobalLanguage()).getText();
144
				if (label == null){
145
					label = ((TextData)getEntity()).getLanguageText(Language.DEFAULT()).getText();
146
				}
147
			} else{
148
				label =((IdentifiableEntity) getEntity()).getTitleCache();
149
			}
150
			title = ": " + label;
151
			
132 152
			// we have to duplicate ampersands otherwise they are treated as
133 153
			// mnenomic (see Label.setText() documentation)
134 154
			// see also #4302

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)