Fixes a problem in supplemental data view that occurred when the entity was not of...
authorn.hoffmann <n.hoffmann@localhost>
Thu, 16 Jun 2011 11:52:37 +0000 (11:52 +0000)
committern.hoffmann <n.hoffmann@localhost>
Thu, 16 Jun 2011 11:52:37 +0000 (11:52 +0000)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NonViralNameDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/supplemental/HeadlineSection.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java

index 819e6f6e3d7313180d446bf29e547dde44865788..d15dd2eb8c8d3c552d31c4c6bf16126e629d4469 100644 (file)
@@ -11,7 +11,6 @@
 package eu.etaxonomy.taxeditor.ui.section.name;
 
 import java.util.Arrays;
-import java.util.List;
 
 import org.eclipse.ui.forms.widgets.Section;
 
@@ -19,7 +18,6 @@ import eu.etaxonomy.cdm.model.name.NonViralName;
 import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.DetailType;
 import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.EnumComboType;
-import eu.etaxonomy.taxeditor.ui.forms.CdmPropertyChangeEvent;
 import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.AbstractIdentifiableEntityDetailElement;
@@ -40,6 +38,7 @@ public class NonViralNameDetailElement extends
        private NameDetailSection section_name;
        private AuthorshipDetailSection section_author;
        private NomenclaturalCodeComboElement combo_nomenclaturalCode;
+       private HybridDetailSection section_hybrid;
 
        /**
         * <p>
@@ -93,6 +92,13 @@ public class NonViralNameDetailElement extends
                section_author.setLayoutData(CdmFormFactory.FILL_HORIZONTALLY(2, 1));
                addControl(section_author);
                addElement(section_author);
+               
+               section_hybrid = (HybridDetailSection) formFactory.createCdmDetailSection(DetailType.HYBRID, 
+                                               getConversationHolder(), formElement, null, 
+                                               Section.TWISTIE);
+               section_hybrid.setLayoutData(CdmFormFactory.FILL_HORIZONTALLY(2, 1));
+               addControl(section_hybrid);
+               addElement(section_hybrid);
        }
 
        /** {@inheritDoc} */
@@ -114,6 +120,7 @@ public class NonViralNameDetailElement extends
                super.setEntity(entity);
                section_name.setEntity(entity);
                section_author.setEntity(entity);
+               section_hybrid.setEntity(entity);
        }
 
        /** {@inheritDoc} */
index 4ca3086f04ce919f611aa98e31d929dc5f17072c..8c5f93b24d713c2d1c07fe9cb2ab01bdf0e579d5 100644 (file)
@@ -5,12 +5,11 @@ package eu.etaxonomy.taxeditor.ui.section.supplemental;
 
 
 import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
+import eu.etaxonomy.cdm.model.common.ICdmBase;
 import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
-import eu.etaxonomy.cdm.model.common.VersionableEntity;
 import eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection;
 import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
-import eu.etaxonomy.taxeditor.ui.section.EmptyElement;
 
 /**
  * <p>HeadlineSection class.</p>
@@ -18,9 +17,7 @@ import eu.etaxonomy.taxeditor.ui.section.EmptyElement;
  * @author n.hoffmann
  * @version $Id: $
  */
-public class HeadlineSection extends AbstractFormSection<VersionableEntity> {
-
-       private EmptyElement emptyElement;
+public class HeadlineSection extends AbstractFormSection<ICdmBase> {
 
        /**
         * <p>Constructor for HeadlineSection.</p>
@@ -32,13 +29,12 @@ public class HeadlineSection extends AbstractFormSection<VersionableEntity> {
        public HeadlineSection(CdmFormFactory cdmFormFactory, ICdmFormElement parentElement,
                        int style) {
                super(cdmFormFactory, null, parentElement, style);
-               emptyElement = cdmFormFactory.createEmptyElement(this);
        }
        
        /** {@inheritDoc} */
        @Override
-       public void setEntity(VersionableEntity versionableEntity) {
-               VersionableEntity entity = (VersionableEntity) HibernateProxyHelper.deproxy(versionableEntity);
+       public void setEntity(ICdmBase cdmBase) {
+               ICdmBase entity = (ICdmBase) HibernateProxyHelper.deproxy(cdmBase);
                super.setEntity(entity);
                setText(entity.getClass().getSimpleName() + (entity instanceof IdentifiableEntity ? ": " + ((IdentifiableEntity) entity).getTitleCache() : ""));
                layout();
index e9ed4f3d393429d18390ac80262673ebe7bef048..8183d13ea5be1d22f5455af2d1f4aed3d0f3cb3c 100644 (file)
@@ -364,12 +364,6 @@ public class DetailsViewer extends AbstractCdmDataViewer {
 
                formFactory.createHorizontalSeparator(parent, SWT.BORDER);
 
-               HybridDetailSection hybridDetailSection = (HybridDetailSection) formFactory
-                               .createCdmDetailSection(DetailType.HYBRID,
-                                               getConversationHolder(), parent, this, Section.TWISTIE);
-
-               formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
                ParsingMessagesSection parsingMessagesSection = (ParsingMessagesSection) formFactory
                                .createCdmDetailSection(DetailType.PARSINGMESSAGE,
                                                getConversationHolder(), parent, this, Section.EXPANDED);
@@ -381,7 +375,6 @@ public class DetailsViewer extends AbstractCdmDataViewer {
                addPart(referenceDetailSection);
                addPart(typeDesignationSection);
                addPart(nameRelationshipSection);
-               addPart(hybridDetailSection);
                addPart(parsingMessagesSection);
        }
 
@@ -425,19 +418,12 @@ public class DetailsViewer extends AbstractCdmDataViewer {
 
                formFactory.createHorizontalSeparator(parent, SWT.BORDER);
 
-               HybridDetailSection hybridDetailSection = (HybridDetailSection) formFactory
-                               .createCdmDetailSection(DetailType.HYBRID,
-                                               getConversationHolder(), parent, this, Section.TWISTIE);
-
-               formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
                addPart(nonViralNameSection);
                addPart(nomenclaturalStatusSection);
                addPart(protologSection);
                addPart(referenceDetailSection);
                addPart(typeDesignationSection);
                addPart(nameRelationshipSection);
-               addPart(hybridDetailSection);
        }
 
        private void createReferenceSections(RootElement parent) {