Moved "Original Name" field to subclass (#5133)
authorPatrick Plitzner <p.plitzner@bgbm.org>
Wed, 9 Sep 2015 14:01:48 +0000 (16:01 +0200)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Wed, 9 Sep 2015 14:03:12 +0000 (16:03 +0200)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NameTypeDesignationElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NomenclaturalStatusElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/SpecimenTypeDesignationElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/supplemental/AbstractOriginalSourceElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/supplemental/AbstractReferencedEntityElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/supplemental/IdentifiableSourceElement.java

index bacf0fd..291694a 100644 (file)
@@ -25,9 +25,6 @@ import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
 import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
 
 /**
- * <p>
- * NameTypeDesignationElement class.
- * </p>
  *
  * @author n.hoffmann
  * @created May 17, 2010
@@ -41,25 +38,6 @@ public class NameTypeDesignationElement extends
        private EntitySelectionElement<TaxonNameBase> selection_typeName;
        private TermComboElement<NameTypeDesignationStatus> combo_typeStatus;
 
-       /**
-        * <p>
-        * Constructor for NameTypeDesignationElement.
-        * </p>
-        *
-        * @param formFactory
-        *            a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
-        *            object.
-        * @param section
-        *            a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
-        *            object.
-        * @param entity
-        *            a {@link eu.etaxonomy.cdm.model.name.NameTypeDesignation}
-        *            object.
-        * @param removeListener
-        *            a {@link org.eclipse.swt.events.SelectionListener} object.
-        * @param style
-        *            a int.
-        */
        public NameTypeDesignationElement(CdmFormFactory formFactory,
                        AbstractFormSection section, NameTypeDesignation entity,
                        SelectionListener removeListener, int style) {
@@ -116,9 +94,6 @@ public class NameTypeDesignationElement extends
                } else if (eventSource == text_referenceDetail) {
                        getEntity().setCitationMicroReference(
                                        text_referenceDetail.getText());
-               } else if (eventSource == text_originaleNameString) {
-                       getEntity().setOriginalNameString(
-                                       text_originaleNameString.getText());
                }
        }
 }
index a3ce821..37ade07 100644 (file)
@@ -26,8 +26,6 @@ import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
 import eu.etaxonomy.taxeditor.ui.section.supplemental.AbstractReferencedEntityElement;
 
 /**
- * <p>NomenclaturalStatusElement class.</p>
- *
  * @author n.hoffmann
  * @created Nov 5, 2009
  * @version 1.0
@@ -40,24 +38,12 @@ public class NomenclaturalStatusElement extends AbstractReferencedEntityElement<
 
        private final SelectionArbitrator selectionArbitrator;
 
-       /**
-        * <p>Constructor for NomenclaturalStatusElement.</p>
-        *
-        * @param formElement a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection} object.
-        * @param element a {@link eu.etaxonomy.cdm.model.name.NomenclaturalStatus} object.
-        * @param removeListener a {@link org.eclipse.swt.events.SelectionListener} object.
-        * @param style a int.
-        * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
-        */
        public NomenclaturalStatusElement(CdmFormFactory cdmFormFactory, AbstractFormSection formElement,
                        NomenclaturalStatus element, SelectionListener removeListener, int style) {
                super(cdmFormFactory, formElement, element, removeListener, style);
                selectionArbitrator = cdmFormFactory.createSelectionArbitrator(this);
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.forms.entitysections.AbstractEntitySetElementComposite#createControls(org.eclipse.swt.widgets.Composite, int)
-        */
        /** {@inheritDoc} */
        @Override
        public void createControls(ICdmFormElement element, int style) {
@@ -67,9 +53,6 @@ public class NomenclaturalStatusElement extends AbstractReferencedEntityElement<
                super.createControls(element, style);
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.forms.entitysections.AbstractEntitySetElementComposite#setElement(eu.etaxonomy.cdm.model.common.VersionableEntity)
-        */
        /** {@inheritDoc} */
        @Override
        public void setEntity(NomenclaturalStatus entity) {
@@ -88,10 +71,6 @@ public class NomenclaturalStatusElement extends AbstractReferencedEntityElement<
                return selectionArbitrator;
        }
 
-       /*
-        * (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionElement#handleEvent(java.lang.Object)
-        */
        /** {@inheritDoc} */
        @Override
        public void handleEvent(Object eventSource) {
@@ -107,8 +86,5 @@ public class NomenclaturalStatusElement extends AbstractReferencedEntityElement<
                else if(eventSource == text_referenceDetail){
                        getEntity().setCitationMicroReference(text_referenceDetail.getText());
                }
-               else if(eventSource == text_originaleNameString){
-                       getEntity().setOriginalNameString(text_originaleNameString.getText());
-               }
        }
 }
index 8a6a13f..9c8d801 100644 (file)
@@ -26,10 +26,6 @@ import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
 import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
 
 /**
- * <p>
- * SpecimenTypeDesignationElement class.
- * </p>
- *
  * @author n.hoffmann
  * @created May 17, 2010
  * @version 1.0
@@ -41,25 +37,6 @@ public class SpecimenTypeDesignationElement extends
        private EntitySelectionElement<DerivedUnit> selection_typeSpecimen;
        private TextWithLabelElement text_specimenTypeText;
 
-       /**
-        * <p>
-        * Constructor for SpecimenTypeDesignationElement.
-        * </p>
-        *
-        * @param formFactory
-        *            a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
-        *            object.
-        * @param section
-        *            a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
-        *            object.
-        * @param entity
-        *            a {@link eu.etaxonomy.cdm.model.name.SpecimenTypeDesignation}
-        *            object.
-        * @param removeListener
-        *            a {@link org.eclipse.swt.events.SelectionListener} object.
-        * @param style
-        *            a int.
-        */
        public SpecimenTypeDesignationElement(CdmFormFactory formFactory,
                        AbstractFormSection section, SpecimenTypeDesignation entity,
                        SelectionListener removeListener, int style) {
@@ -116,9 +93,6 @@ public class SpecimenTypeDesignationElement extends
                } else if (eventSource == text_referenceDetail) {
                        getEntity().setCitationMicroReference(
                                        text_referenceDetail.getText());
-               } else if (eventSource == text_originaleNameString) {
-                       getEntity().setOriginalNameString(
-                                       text_originaleNameString.getText());
                }
        }
 }
index 3905297..b84e353 100644 (file)
@@ -10,6 +10,7 @@
 
 package eu.etaxonomy.taxeditor.ui.section.supplemental;
 
+import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.SelectionListener;
 
 import eu.etaxonomy.cdm.model.common.OriginalSourceBase;
@@ -21,8 +22,6 @@ import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
 import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
 
 /**
- * <p>Abstract AbstractOriginalSourceElement class.</p>
- *
  * @author n.hoffmann
  * @created Mar 16, 2010
  * @version 1.0
@@ -31,17 +30,8 @@ public abstract class AbstractOriginalSourceElement<T extends OriginalSourceBase
        protected EnumComboElement<OriginalSourceType> combo_origsourcetype;
        protected TextWithLabelElement text_idInSource;
        protected TextWithLabelElement text_idNamespace;
+    protected TextWithLabelElement text_originaleNameString;
 
-       /**
-        * <p>Constructor for AbstractOriginalSourceElement.</p>
-        *
-        * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
-        * @param section a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection} object.
-        * @param element a T object.
-        * @param removeListener a {@link org.eclipse.swt.events.SelectionListener} object.
-        * @param style a int.
-        * @param <T> a T object.
-        */
        public AbstractOriginalSourceElement(CdmFormFactory formFactory,
                        AbstractFormSection section,
                        T element, SelectionListener removeListener,
@@ -49,11 +39,13 @@ public abstract class AbstractOriginalSourceElement<T extends OriginalSourceBase
                super(formFactory, section, element, removeListener, style);
        }
 
-       /** {@inheritDoc} */
+       /**
+        * {@inheritDoc}
+        */
        @Override
-       public void init() {
-               super.init();
-               setHasOriginalNameString(true);
+       public void setEntity(T entity) {
+           super.setEntity(entity);
+        text_originaleNameString.setText(entity.getOriginalNameString());
        }
 
        /** {@inheritDoc} */
@@ -65,5 +57,7 @@ public abstract class AbstractOriginalSourceElement<T extends OriginalSourceBase
                super.createControls(formElement, style);
                text_idInSource = formFactory.createTextWithLabelElement(formElement, "Id In Source", null, style);
                text_idNamespace = formFactory.createTextWithLabelElement(formElement, "ID Namespace", null, style);
+               text_originaleNameString = formFactory.createTextWithLabelElement(
+                       formElement, "Original Name", null, SWT.NULL);
        }
 }
index c77b537..aea6e2d 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.
  */
@@ -23,10 +23,6 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
 import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
 
 /**
- * <p>
- * Abstract AbstractReferencedEntityElement class.
- * </p>
- * 
  * @author n.hoffmann
  * @created Mar 25, 2010
  * @version 1.0
@@ -37,43 +33,12 @@ public abstract class AbstractReferencedEntityElement<T extends ReferencedEntity
        protected EntitySelectionElement<Reference> selection_reference;
        protected TextWithLabelElement text_referenceDetail;
 
-       protected TextWithLabelElement text_originaleNameString;
-
-       private boolean hasOriginalNameString = false;
-
-       /**
-        * <p>
-        * Constructor for AbstractReferencedEntityElement.
-        * </p>
-        * 
-        * @param formFactory
-        *            a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
-        *            object.
-        * @param section
-        *            a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection}
-        *            object.
-        * @param entity
-        *            a T object.
-        * @param removeListener
-        *            a {@link org.eclipse.swt.events.SelectionListener} object.
-        * @param style
-        *            a int.
-        * @param <T>
-        *            a T object.
-        */
        public AbstractReferencedEntityElement(CdmFormFactory formFactory,
                        AbstractFormSection section, T entity,
                        SelectionListener removeListener, int style) {
                super(formFactory, section, entity, removeListener, null, style);
        }
 
-       /*
-        * (non-Javadoc)
-        * 
-        * @see
-        * eu.etaxonomy.taxeditor.forms.section.AbstractEntityCollectionElement#
-        * createControls(eu.etaxonomy.taxeditor.forms.ICdmFormElement, int)
-        */
        /** {@inheritDoc} */
        @Override
        public void createControls(ICdmFormElement formElement, int style) {
@@ -83,69 +48,14 @@ public abstract class AbstractReferencedEntityElement<T extends ReferencedEntity
                                                null, EntitySelectionElement.ALL, style);
                text_referenceDetail = formFactory.createTextWithLabelElement(
                                formElement, "Reference Detail", null, SWT.NULL);
-               if (hasOriginalNameString)
-                       text_originaleNameString = formFactory.createTextWithLabelElement(
-                                       formElement, "Original Name", null, SWT.NULL);
        }
 
-       /**
-        * <p>
-        * setEntity
-        * </p>
-        * 
-        * @param entity
-        *            a T object.
-        */
        @Override
        public void setEntity(T entity) {
                this.entity = entity;
 
                selection_reference.setEntity(entity.getCitation());
                text_referenceDetail.setText(entity.getCitationMicroReference());
-               if (hasOriginalNameString)
-                       text_originaleNameString.setText(entity.getOriginalNameString());
-               // // remove old listeners
-               // clearEditButtonSelectionListener();
-               //
-               // addEditButtonSelectionListener(new
-               // BulkEditorOpeningSelectionListener(entity.getCitation()));
-               //
-       };
-
-       //
-       // public void addEditButtonSelectionListener(SelectionListener listener){
-       // selection_reference.addEditButtonSelectionListener(listener);
-       // }
-       //
-       // public void removeEditButtonSelectionListener(SelectionListener
-       // listener){
-       // selection_reference.removeEditorButtonSelectionListener(listener);
-       // }
-       //
-       // public void clearEditButtonSelectionListener(){
-       // selection_reference.clearEditButtonSelectionListener();
-       // }
-
-       /**
-        * <p>
-        * Setter for the field <code>hasOriginalNameString</code>.
-        * </p>
-        * 
-        * @param hasOriginalNameString
-        *            a boolean.
-        */
-       public void setHasOriginalNameString(boolean hasOriginalNameString) {
-               this.hasOriginalNameString = hasOriginalNameString;
        }
 
-       /**
-        * <p>
-        * hasOriginalNameString
-        * </p>
-        * 
-        * @return a boolean.
-        */
-       public boolean hasOriginalNameString() {
-               return hasOriginalNameString;
-       }
 }
index f28b943..a5f50e1 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * 
+ *
  */
 package eu.etaxonomy.taxeditor.ui.section.supplemental;
 
@@ -11,41 +11,23 @@ import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
 
 /**
- * <p>IdentifiableSourceElement class.</p>
- *
  * @author n.hoffmann
  * @created Nov 16, 2009
  * @version 1.0
  */
 public class IdentifiableSourceElement extends AbstractOriginalSourceElement<IdentifiableSource>{
-       
-       /**
-        * <p>Constructor for IdentifiableSourceElement.</p>
-        *
-        * @param formElement a {@link eu.etaxonomy.taxeditor.ui.element.AbstractFormSection} object.
-        * @param element a {@link eu.etaxonomy.cdm.model.common.IdentifiableSource} object.
-        * @param removeListener a {@link org.eclipse.swt.events.SelectionListener} object.
-        * @param style a int.
-        * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
-        */
+
        public IdentifiableSourceElement(CdmFormFactory cdmFormFactory, AbstractFormSection formElement, IdentifiableSource element,
                        SelectionListener removeListener, int style) {
                super(cdmFormFactory, formElement, element, removeListener, style);
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.forms.entitysections.AbstractEntitySetElementComposite#createControls(org.eclipse.swt.widgets.Composite, int)
-        */
        /** {@inheritDoc} */
        @Override
        public void createControls(ICdmFormElement formElement, int style) {
                super.createControls(formElement, style);
        }
 
-
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.forms.entitysections.AbstractEntitySetElementComposite#setElement(eu.etaxonomy.cdm.model.common.VersionableEntity)
-        */
        /** {@inheritDoc} */
        @Override
        public void setEntity(IdentifiableSource entity) {
@@ -56,9 +38,9 @@ public class IdentifiableSourceElement extends AbstractOriginalSourceElement<Ide
                selection_reference.setEntity(entity.getCitation());
                text_referenceDetail.setText(entity.getCitationMicroReference());
                combo_origsourcetype.setSelection(entity.getType());
-               if(hasOriginalNameString()) text_originaleNameString.setText(entity.getOriginalNameString());
-       }       
-       
+               text_originaleNameString.setText(entity.getOriginalNameString());
+       }
+
        /** {@inheritDoc} */
        @Override
        public void handleEvent(Object eventSource) {