- completely removed DetailType enum and all its uses
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / description / DescriptionElementDetailSection.java
index 8f43590dd54e9dec345fa2e0bd42c810f92a9dcd..2fe95883904f4c6b43a56b3bf15e2627354f3666 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.
 */
@@ -22,8 +22,8 @@ import eu.etaxonomy.cdm.model.description.TextData;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.taxeditor.store.StoreUtil;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.description.operation.ChangeDescriptionElementType;
 
@@ -36,7 +36,7 @@ import eu.etaxonomy.taxeditor.ui.section.description.operation.ChangeDescription
  */
 public class DescriptionElementDetailSection extends
                AbstractCdmDetailSection<DescriptionElementBase> {
-       
+
        /**
         * <p>Constructor for DescriptionElementDetailSection.</p>
         *
@@ -50,19 +50,20 @@ public class DescriptionElementDetailSection extends
                        ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
                super(cdmFormFactory, conversation, parentElement, selectionProvider, style);
        }
-       
-       
-       protected Control createToolbar() {
+
+
+       @Override
+    protected Control createToolbar() {
                if(! hasSpecificElement()){
                        return null;
                }
-               
+
                ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
-               
+
                final String destinationString = (getEntity() instanceof TextData) ? "the specific element" : "free text";
-               
-               final String label = "Change to " + destinationString; 
-               
+
+               final String label = "Change to " + destinationString;
+
                Action addAction = new Action("Change Type", Action.AS_PUSH_BUTTON) {
                        /* (non-Javadoc)
                         * @see org.eclipse.jface.action.Action#run()
@@ -73,52 +74,54 @@ public class DescriptionElementDetailSection extends
                                                + destinationString + "? Current data will be lost.");
                                if (confirmed) {
                                        // FIXME
-                                       ChangeDescriptionElementType operation = new ChangeDescriptionElementType(label, 
+                                       ChangeDescriptionElementType operation = new ChangeDescriptionElementType(label,
                                                        getEntity(), StoreUtil.getDetailsView(), StoreUtil.getUndoContext());
                                        StoreUtil.executeOperation(operation);
                                }
                        }
                };
-               // TODO enable this once a proper icon has been found 
+               // TODO enable this once a proper icon has been found
 //             addAction.setImageDescriptor(new ImageDescriptor() {
-//                     
+//
 //                     @Override
 //                     public ImageData getImageData() {
 //                             return ImageResources.getImage(ImageResources.ADD_ICON).getImageData();
 //                     }
 //             });
                addAction.setToolTipText(label);
-               
+
                toolBarManager.add(addAction);
-               
+
                return toolBarManager.createControl(this);
        }
-       
+
        /** {@inheritDoc} */
        @Override
        public String getHeading() {
                return "Description Element";
        }
 
-       /** {@inheritDoc} */
-       @Override
-       protected DetailType getDetailType() {
-               return DetailType.DESCRIPTIONELEMENT;
-       }
-       
        /** {@inheritDoc} */
        @Override
        protected void setSectionTitle() {
                this.setText(getHeading() + ": " + getEntity().getFeature().getLabel(CdmStore.getDefaultLanguage()));
                setTextClient(createToolbar());
        }
-       
+
        private boolean hasSpecificElement(){
-               return  getEntity().getFeature().isSupportsCategoricalData() 
+               return  getEntity().getFeature().isSupportsCategoricalData()
                                || getEntity().getFeature().isSupportsCommonTaxonName()
                                || getEntity().getFeature().isSupportsDistribution()
                                || getEntity().getFeature().isSupportsIndividualAssociation()
                                || getEntity().getFeature().isSupportsQuantitativeData()
                                || getEntity().getFeature().isSupportsTaxonInteraction();
        }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
+        */
+       @Override
+       protected AbstractCdmDetailElement<DescriptionElementBase> createCdmDetailElement(AbstractCdmDetailSection<DescriptionElementBase> parentElement, int style) {
+           return formFactory.createDescriptionElementDetailElement(parentElement, style);
+       }
 }