minor
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / model / NomenclaturalCodeHelper.java
index 0930a3bdf80e834f863c0ff1e14a93d75531a09f..692312d0bdec2bcf9b95cbbc418178ca6ec8d2bc 100644 (file)
@@ -1,9 +1,8 @@
-// $Id$
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
-* 
+*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
@@ -15,6 +14,7 @@ import java.util.Arrays;
 import java.util.List;
 
 import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 
 /**
  * <p>NomenclaturalCodeHelper class.</p>
@@ -24,7 +24,7 @@ import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
  * @version 1.0
  */
 public class NomenclaturalCodeHelper {
-               
+
        /**
         * <p>getAllCodes</p>
         *
@@ -44,18 +44,22 @@ public class NomenclaturalCodeHelper {
                List<NomenclaturalCode> supportedCodes = new ArrayList<NomenclaturalCode>();
                for (NomenclaturalCode code : getAllCodes()) {
                        if (isSupported(code)) {
-                               supportedCodes.add(code);
+                           if (PreferencesUtil.getPreferredNomenclaturalCode(false).equals(code)){
+                               supportedCodes.add(0, code);
+                           }else{
+                               supportedCodes.add(code);
+                           }
                        }
                }
                return supportedCodes;
        }
-       
+
        /**
         * @param code
         * @return
         */
        private static boolean isSupported(NomenclaturalCode code) {
-               if (code.equals(NomenclaturalCode.ICBN) || code.equals(NomenclaturalCode.ICZN)) {
+               if (code.equals(NomenclaturalCode.ICNAFP ) || code.equals(NomenclaturalCode.ICZN)) {
                        return true;
                } else {
                        return false;
@@ -73,27 +77,27 @@ public class NomenclaturalCodeHelper {
                if (code.equals(NomenclaturalCode.ICNB)) {
                        return "International Code of Nomenclature of Bacteria (ICNB)";
                }
-               if (code.equals(NomenclaturalCode.ICBN)) {
-                       return "International Code of Botanical Nomenclature (ICBN)";
+               if (code.equals(NomenclaturalCode.ICNAFP )) {
+                       return "International Code of Botanical Nomenclature (ICNAFP )";
                }
                if (code.equals(NomenclaturalCode.ICNCP)) {
                        return "International Code of Cultivated Plants (ICNCP)";
                }
                if (code.equals(NomenclaturalCode.ICZN)) {
                        return "International Code of Zoological Nomenclature (ICZN)";
-               }               
+               }
                if (code.equals(NomenclaturalCode.ICVCN)) {
                        return "International Code for Virus Classification and Nomenclature (ICVCN)";
-               } 
+               }
                return code.name();
        }
-       
+
        /**
         * <p>getDefaultCode</p>
         *
         * @return a {@link eu.etaxonomy.cdm.model.name.NomenclaturalCode} object.
         */
        public static NomenclaturalCode getDefaultCode() {
-               return NomenclaturalCode.ICBN;
+               return NomenclaturalCode.ICNAFP ;
        }
 }