- adapted WaterbodyOrCountry separation
authorPatric Plitzner <p.plitzner@bgbm.org>
Tue, 17 Sep 2013 12:27:50 +0000 (12:27 +0000)
committerPatric Plitzner <p.plitzner@bgbm.org>
Tue, 17 Sep 2013 12:27:50 +0000 (12:27 +0000)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/NamedAreaSelectionDialog.java

index cf39589ad5b5d0257308742ac2ce10faa265d947..a8d278d3b47e0a7064e137512b7c3e1c9f6bdc34 100644 (file)
@@ -1,9 +1,9 @@
 // $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.
 */
@@ -55,21 +55,22 @@ public class NamedAreaSelectionDialog extends
                        super(vocabulary.getTitleCache(), IAction.AS_CHECK_BOX);
                        this.vocabulary = vocabulary;
                }
-               
-               public void run(){
+
+               @Override
+        public void run(){
                        if(isChecked()){
                                selectedVocabularies.add(vocabulary);
                        }else{
                                selectedVocabularies.remove(vocabulary);
                        }
-                       
+
                        initModel();
                }
        }
-       
+
        private Collection<TermVocabulary<NamedArea>> selectedVocabularies;
-       
-       
+
+
        /**
         * Creates a filtered selection dialog to select a named area.
         *
@@ -85,7 +86,7 @@ public class NamedAreaSelectionDialog extends
                                "Choose an area", false, namedArea);
                return getSelectionFromDialog(dialog);
        }
-       
+
        /**
         * <p>Constructor for FilteredNamedAreaSelectionDialog.</p>
         *
@@ -96,22 +97,22 @@ public class NamedAreaSelectionDialog extends
         * @param namedArea a {@link eu.etaxonomy.cdm.model.location.NamedArea} object.
         */
        protected NamedAreaSelectionDialog(Shell shell, ConversationHolder conversation, String title, boolean multi, NamedArea namedArea) {
-               super(shell, conversation, title, multi, NamedAreaSelectionDialog.class.getCanonicalName(), namedArea);         
+               super(shell, conversation, title, multi, NamedAreaSelectionDialog.class.getCanonicalName(), namedArea);
        }
-       
+
        /** {@inheritDoc} */
        @Override
        protected void fillViewMenu(IMenuManager menuManager) {
-                               
+
                super.fillViewMenu(menuManager);
-                               
+
                for(TermVocabulary<NamedArea> vocabulary : getVocabularies()){
                        IncludeNamedAreaVocabulary action = new IncludeNamedAreaVocabulary(vocabulary);
                        menuManager.add(action);
                        action.setChecked(true);
                }
        }
-       
+
        /** {@inheritDoc} */
        @Override
        protected NamedArea getPersistentObject(UUID uuid) {
@@ -125,17 +126,18 @@ public class NamedAreaSelectionDialog extends
                }
                return null;
        }
-       
+
        /** {@inheritDoc} */
        @Override
        protected void init() {
                selectedVocabularies = getVocabularies();
        }
-       
+
        private List<TermVocabulary<NamedArea>> getVocabularies(){
                List<TermVocabulary<NamedArea>> vocabularies = CdmStore.getService(IVocabularyService.class).listByTermClass(NamedArea.class, null, null, null, null);
                vocabularies.add(CdmStore.getService(IVocabularyService.class).getVocabulary(VocabularyEnum.TdwgArea));
-               vocabularies.add(CdmStore.getService(IVocabularyService.class).getVocabulary(VocabularyEnum.WaterbodyOrCountry));
+               vocabularies.add(CdmStore.getService(IVocabularyService.class).getVocabulary(VocabularyEnum.Country));
+               vocabularies.add(CdmStore.getService(IVocabularyService.class).getVocabulary(VocabularyEnum.Waterbody));
                vocabularies.add(CdmStore.getService(IVocabularyService.class).getVocabulary(VocabularyEnum.Continent));
                return vocabularies;
        }
@@ -143,19 +145,19 @@ public class NamedAreaSelectionDialog extends
        /** {@inheritDoc} */
        @Override
        protected void initModel() {
-               
+
                Set<NamedArea> terms = new HashSet<NamedArea>();
                for(TermVocabulary<NamedArea> vocabulary : selectedVocabularies){
                        terms.addAll(vocabulary.getTermsOrderedByLabels(CdmStore.getDefaultLanguage()));
                }
-               
+
                if(model == null){
                        model = new ArrayList<UuidAndTitleCache<NamedArea>>();
                }
                model.clear();
                for(Object areaObject : terms){
                        NamedArea area = (NamedArea) HibernateProxyHelper.deproxy(areaObject);
-                       UuidAndTitleCache<NamedArea> element = new UuidAndTitleCache<NamedArea>(NamedArea.class, area.getUuid(), getTitle(area)); 
+                       UuidAndTitleCache<NamedArea> element = new UuidAndTitleCache<NamedArea>(NamedArea.class, area.getUuid(), getTitle(area));
                        model.add(element);
                }
        }
@@ -165,7 +167,7 @@ public class NamedAreaSelectionDialog extends
        protected Control createExtendedContentArea(Composite parent) {
                return null;
        }
-       
+
        /** {@inheritDoc} */
        @Override
        protected String getTitle(NamedArea namedArea) {
@@ -178,7 +180,7 @@ public class NamedAreaSelectionDialog extends
                        return namedArea.getTitleCache();
                }
        }
-       
+
        /** {@inheritDoc} */
        @Override
        protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {