- added missing enum switches with logger warnings
authorPatric Plitzner <p.plitzner@bgbm.org>
Tue, 1 Oct 2013 09:57:31 +0000 (09:57 +0000)
committerPatric Plitzner <p.plitzner@bgbm.org>
Tue, 1 Oct 2013 09:57:31 +0000 (09:57 +0000)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NameDetailElement.java

index 8cba9f9f0ca9113660f1018db9968b96166a4ee8..0f4356a0b094ff5845eb88c7dbfabd0b97b855e4 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.
 */
@@ -12,6 +12,7 @@ package eu.etaxonomy.taxeditor.ui.section.name;
 
 import java.util.Arrays;
 
+import org.apache.log4j.Logger;
 import org.eclipse.swt.SWT;
 
 import eu.etaxonomy.cdm.model.name.BotanicalName;
@@ -40,6 +41,8 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractIdentifiableEntityDetailElement
  */
 public class NameDetailElement extends AbstractIdentifiableEntityDetailElement<NonViralName> implements ISelectableElement, IEnableableFormElement{
 
+    private final Logger logger = Logger.getLogger(NameDetailElement.class);
+
        private TermComboElement<Rank> combo_rank;
        private TextWithLabelElement text_appendedPhrase;
        private TextWithLabelElement text_uninomial;
@@ -52,7 +55,7 @@ public class NameDetailElement extends AbstractIdentifiableEntityDetailElement<N
        private NumberWithLabelElement text_publicationYear;
        private NumberWithLabelElement text_originalPublicationYear;
        private int cursorPosition;
-       
+
        /**
         * <p>Constructor for NameDetailElement.</p>
         *
@@ -72,20 +75,20 @@ public class NameDetailElement extends AbstractIdentifiableEntityDetailElement<N
        /** {@inheritDoc} */
        @Override
        protected void createControls(ICdmFormElement formElement, NonViralName nonViralName, int style) {
-               
+
                toggleable_cache = formFactory.createToggleableTextField(this, "Name Cache", nonViralName.getNameCache(), nonViralName.isProtectedNameCache(), style);
-               
+
                combo_rank = formFactory.createTermComboElement(Rank.class, this, "Rank", nonViralName.getRank(), style);
-               
+
                createGenusOrUninomialControls(this, nonViralName, style);
                createInfragenerericEpithetControls(this, nonViralName, style);
                createSpecificEpithetControls(this, nonViralName, style);
                createInfraSpecificEpithetControls(this, nonViralName, style);
-               
+
                createSpecificNameParts(this, nonViralName, style);
-               
+
                text_appendedPhrase = formFactory.createTextWithLabelElement(formElement, "Appended Phrase", nonViralName.getAppendedPhrase(), style);
-               
+
        }
 
        /**
@@ -94,22 +97,22 @@ public class NameDetailElement extends AbstractIdentifiableEntityDetailElement<N
        protected void clearCheckRankWarnings() {
                if(getEntity().hasProblem(ParserProblem.CheckRank)){
                        getEntity().removeParsingProblem(ParserProblem.CheckRank);
-                       
+
                        // FIXME this has to be reafctored completely. See tickets #1959, #1663, #1957, #1958
 //                     TaxonNameEditor nameEditor = (TaxonNameEditor) EditorUtil.getActiveEditorPage(Page.NAME);
 //                     nameEditor.getSelectedContainer().getNameViewer().clearErrors();
                }
        }
-       
+
        /** {@inheritDoc} */
        @Override
        protected void updateContent() {
                if(getEntity() == null){
                        setEntity(NonViralName.NewInstance(null));
                }
-               
+
                super.updateContent();
-               
+
                if(isIrrelevant()){
                        setIrrelevant(isIrrelevant());
                }else{
@@ -129,10 +132,22 @@ public class NameDetailElement extends AbstractIdentifiableEntityDetailElement<N
                        case ICZN:
                                createZoologicalNameParts(formElement, nonViralName, style);
                                break;
+                       case ICVCN:
+                           //TODO implement
+                           logger.warn("ICVCN not yet implemented");
+                           break;
+                       case ICNB:
+                //TODO implement
+                           logger.warn("ICNB not yet implemented");
+                           break;
+                       case ICNCP:
+                //TODO implement
+                           logger.warn("ICNCP not yet implemented");
+                           break;
                        }
                }
        }
-       
+
        private void createBotanicalNameParts(ICdmFormElement formElement, NonViralName nonViralName, int style){
                BotanicalName botanicalName = (BotanicalName) nonViralName;
                checkbox_anamorphic = formFactory.createCheckbox(formElement, "Anamorphic", botanicalName.isAnamorphic(), style);
@@ -144,49 +159,50 @@ public class NameDetailElement extends AbstractIdentifiableEntityDetailElement<N
                text_publicationYear = formFactory.createNumberTextWithLabelElement(formElement, "Publication Year", zoologicalName.getPublicationYear(), style);
                text_originalPublicationYear = formFactory.createNumberTextWithLabelElement(formElement, "Orig. Publication Year", zoologicalName.getOriginalPublicationYear(), style);
        }
-       
-       private void createGenusOrUninomialControls(ICdmFormElement element, NonViralName nonViralName, int style){             
+
+       private void createGenusOrUninomialControls(ICdmFormElement element, NonViralName nonViralName, int style){
                String title = "Genus";
                Rank rank = nonViralName.getRank();
                if(rank != null && rank.isSupraGeneric()){
-                       title = "Uninomial";                    
+                       title = "Uninomial";
                }
                text_uninomial = formFactory.createTextWithLabelElement(element, title, nonViralName.getGenusOrUninomial(), style);
        }
-       
+
        private void createInfragenerericEpithetControls(ICdmFormElement element, NonViralName nonViralName, int style){
                if(nonViralName.getRank() != null && nonViralName.getRank().isInfraGeneric() && !nonViralName.getRank().isSpeciesAggregate()){
                        text_infragenericEpithet = formFactory.createTextWithLabelElement(element, "Infrageneric Epithet", nonViralName.getInfraGenericEpithet(), style);
                }
        }
-       
+
        private void createSpecificEpithetControls(ICdmFormElement element, NonViralName nonViralName, int style){
                if(nonViralName.getRank() != null && (nonViralName.getRank().isSpecies()  || nonViralName.getRank().isInfraSpecific() || nonViralName.getRank().isSpeciesAggregate())){
                        text_specificEpithet = formFactory.createTextWithLabelElement(element, "Specific Epithet", nonViralName.getSpecificEpithet(), SWT.NULL);
                }
        }
-       
+
        private void createInfraSpecificEpithetControls(ICdmFormElement element, NonViralName nonViralName, int style){
                if(nonViralName.getRank() != null && nonViralName.getRank().isInfraSpecific()){
                        text_infraspecificEpithet = formFactory.createTextWithLabelElement(element, "Infraspecific Epithet", nonViralName.getInfraSpecificEpithet(), SWT.NULL);
                }
        }
-       
+
        /** {@inheritDoc} */
        @Override
        public void handleEvent(Object eventSource){
                if (eventSource == toggleable_cache) {
                        getEntity().setNameCache(toggleable_cache.getText(),
                                        toggleable_cache.getState());
-                       if (!isIrrelevant())
-                               setIrrelevant(toggleable_cache.getState(),
+                       if (!isIrrelevant()) {
+                setIrrelevant(toggleable_cache.getState(),
                                                Arrays.asList(new Object[] { toggleable_cache }));
+            }
                }
                else if(eventSource == combo_rank){
                        getEntity().setRank(combo_rank.getSelection());
                        clearCheckRankWarnings();
                        updateContent();
-               }               
+               }
                else if(eventSource == text_appendedPhrase){
                        getEntity().setAppendedPhrase(text_appendedPhrase.getText());
                }
@@ -201,12 +217,12 @@ public class NameDetailElement extends AbstractIdentifiableEntityDetailElement<N
                }
                else if(eventSource == text_uninomial){
                        getEntity().setGenusOrUninomial(text_uninomial.getText());
-               }               
+               }
                else if(eventSource == checkbox_anamorphic){
                        ((BotanicalName)getEntity()).setAnamorphic(checkbox_anamorphic.getSelection());
                }
        }
-               
+
        /*
         * (non-Javadoc)
         * @see eu.etaxonomy.taxeditor.forms.section.cdmdetail.ISelectableElement#getSelectionArbitrator()
@@ -216,10 +232,11 @@ public class NameDetailElement extends AbstractIdentifiableEntityDetailElement<N
         *
         * @return a {@link eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator} object.
         */
-       public SelectionArbitrator getSelectionArbitrator() {
+       @Override
+    public SelectionArbitrator getSelectionArbitrator() {
                return selectionArbitrator;
        }
-       
+
        @Override
        public void updateToggleableCacheField() {
                if(! getEntity().isProtectedNameCache()){