fixes #780
authorn.hoffmann <n.hoffmann@localhost>
Wed, 10 Jun 2009 15:40:58 +0000 (15:40 +0000)
committern.hoffmann <n.hoffmann@localhost>
Wed, 10 Jun 2009 15:40:58 +0000 (15:40 +0000)
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/preference/RankMenuPreferences.java
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/store/CdmStore.java

index d6cb75706adeb2fb284a3fd33f8b2ea6056b7c3e..5935306790f178ea23cae1d5b65d2e388c7cb1b2 100644 (file)
@@ -189,18 +189,14 @@ public class PreferencesUtil {
                if (preferredRankList == null) {\r
                        \r
                        setPreferredRanks(new ArrayList<Rank>());       \r
                if (preferredRankList == null) {\r
                        \r
                        setPreferredRanks(new ArrayList<Rank>());       \r
-                                               \r
-                       SortedSet<Rank> ranks = CdmStore.getRanks();\r
-                       if (ranks != null) {\r
                        \r
                        \r
-                               for (Rank rank : CdmStore.getRanks()) {\r
-                                       \r
-                                       // If the feature is set to show, add it to preferredFeatureSet\r
-                                       if (PreferencesUtil.getRankPreference(rank)) {\r
-                                               addPreferredRank(rank);\r
-                                       }\r
+                       for (Rank rank : CdmStore.getDefault().getRanksInternal()) {\r
+                               \r
+                               // If the feature is set to show, add it to preferredFeatureSet\r
+                               if (PreferencesUtil.getRankPreference(rank)) {\r
+                                       addPreferredRank(rank);\r
                                }\r
                                }\r
-                       } // else { TODO: error message\r
+                       }\r
                        \r
                        Collections.sort(preferredRankList, new Comparator<Rank>(){\r
 \r
                        \r
                        Collections.sort(preferredRankList, new Comparator<Rank>(){\r
 \r
index 72cbe43789bc8095b3e5aec2272184cb564e7c04..3796b0febc568f9f5eca108e346ee56adf53b9c4 100644 (file)
@@ -9,6 +9,7 @@
 package eu.etaxonomy.taxeditor.preference;\r
 \r
 import java.util.HashMap;\r
 package eu.etaxonomy.taxeditor.preference;\r
 \r
 import java.util.HashMap;\r
+import java.util.List;\r
 import java.util.Map;\r
 import java.util.SortedSet;\r
 \r
 import java.util.Map;\r
 import java.util.SortedSet;\r
 \r
@@ -60,7 +61,7 @@ public class RankMenuPreferences extends PreferencePage implements
                container.setLayout(gridLayout);\r
 \r
                CdmStore.getDefault();\r
                container.setLayout(gridLayout);\r
 \r
                CdmStore.getDefault();\r
-               SortedSet<Rank> ranks = CdmStore.getRanks();\r
+               List<Rank> ranks = CdmStore.getPreferredRanks();\r
                \r
                for (Rank rank : ranks) {\r
                                                \r
                \r
                for (Rank rank : ranks) {\r
                                                \r
index e75cb9125331aa37c28d91ca1b0d02d52b6a8303..357d0891c9485b09e6dcd2af48f82b62eeb306f1 100644 (file)
@@ -50,6 +50,7 @@ import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
 import eu.etaxonomy.cdm.persistence.query.MatchMode;
 import eu.etaxonomy.taxeditor.datasource.CdmDataSourceRepository;
 import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
 import eu.etaxonomy.cdm.persistence.query.MatchMode;
 import eu.etaxonomy.taxeditor.datasource.CdmDataSourceRepository;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 
 /**
  * This implementation of ICdmDataRepository depends on hibernate sessions to store the data correctly 
 
 /**
  * This implementation of ICdmDataRepository depends on hibernate sessions to store the data correctly 
@@ -166,16 +167,15 @@ public class CdmStore{
                return getDefault().getNomenclaturalStatusTypesInternal().getTerms();
        }
        
                return getDefault().getNomenclaturalStatusTypesInternal().getTerms();
        }
        
-       private SortedSet<Rank> getRanksInternal() {
-               OrderedTermVocabulary rankVocabulary = HibernateProxyHelper.deproxy(applicationController.getTermService().getVocabulary(VocabularyEnum.Rank), OrderedTermVocabulary.class);
-               return rankVocabulary.getOrderedTerms(null);
+       public OrderedTermVocabulary<Rank> getRanksInternal(){
+               TermVocabulary<Rank> vocabulary = applicationController.getTermService().getVocabulary(VocabularyEnum.Rank);
+               return HibernateProxyHelper.deproxy(vocabulary, OrderedTermVocabulary.class);
        }
        
        }
        
-       public static SortedSet<Rank> getRanks() {
-               return getDefault().getRanksInternal();
+       public static List<Rank> getPreferredRanks(){
+               return PreferencesUtil.getPreferredRanks();
        }
 
        }
 
-
        public List<Taxon> getRootTaxa() {
                boolean onlyWithChildren = false;
                boolean withMisapplications = true;
        public List<Taxon> getRootTaxa() {
                boolean onlyWithChildren = false;
                boolean withMisapplications = true;