fixes #1348
authorn.hoffmann <n.hoffmann@localhost>
Tue, 22 Dec 2009 12:11:04 +0000 (12:11 +0000)
committern.hoffmann <n.hoffmann@localhost>
Tue, 22 Dec 2009 12:11:04 +0000 (12:11 +0000)
taxeditor-editor/src/main/java/eu/etaxonomy/taxeditor/forms/termcombos/AbstractTermComboComposite.java
taxeditor-editor/src/main/java/eu/etaxonomy/taxeditor/forms/termcombos/LanguageComboComposite.java

index 31362575394bb4e66ed76f1d5536fabe4e880c02..bf4573e6f1a4e06ac4503f554b16d1ae1e2d28e0 100644 (file)
@@ -106,7 +106,7 @@ public abstract class AbstractTermComboComposite<T extends DefinedTermBase> exte
                if(termComparator != null)
                        Collections.sort(preferredTerms, termComparator);
                for (T term : preferredTerms) {
-                       String label = term.getLabel(CdmStore.getDefaultLanguage()); 
+                       String label = getLabel(term); 
                        if (label == null) {
                                logger.warn("No label for " + term + " - not added to combo");
                                continue;
@@ -143,6 +143,17 @@ public abstract class AbstractTermComboComposite<T extends DefinedTermBase> exte
         * @return
         */
        protected abstract List<T> preferredTerms();
+       
+       /**
+        * May be overridden by derived classes if the desired label string does not
+        * reside in term.getLabel();
+        * 
+        * @param term
+        * @return
+        */
+       protected String getLabel(T term){
+               return term.getLabel(CdmStore.getDefaultLanguage());
+       }
 
        private void createTermNotInPreferredTerms(T term) {
                
index 14b83638f2502a6af402c8b06ee2e1ec0de4f595..424b59d04788b51578630b7d9c1cb4d01cbdbced 100644 (file)
@@ -10,9 +10,10 @@ import org.eclipse.swt.widgets.Composite;
 
 import eu.etaxonomy.cdm.model.common.Language;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.store.CdmStore;
 
 /**
- * @author nho
+ * @author n.hoffmann
  *
  */
 public class LanguageComboComposite extends AbstractTermComboComposite<Language> {
@@ -37,4 +38,12 @@ public class LanguageComboComposite extends AbstractTermComboComposite<Language>
        protected List<Language> preferredTerms() {
                return PreferencesUtil.getPreferredLanguages();
        }
+       
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.forms.termcombos.AbstractTermComboComposite#getLabel(eu.etaxonomy.cdm.model.common.DefinedTermBase)
+        */
+       @Override
+       protected String getLabel(Language term) {
+               return term.getDescription(CdmStore.getDefaultLanguage());
+       }
 }