Fixes an issue with derived unit editing where the editor was using deprecated interf...
authorn.hoffmann <n.hoffmann@localhost>
Tue, 15 Feb 2011 10:34:49 +0000 (10:34 +0000)
committern.hoffmann <n.hoffmann@localhost>
Tue, 15 Feb 2011 10:34:49 +0000 (10:34 +0000)
taxeditor-editor/src/main/java/eu/etaxonomy/taxeditor/editor/newWizard/NewDerivedUnitBaseWizard.java
taxeditor-editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptionElementDropAdapter.java
taxeditor-editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/MoveDescriptionElementsHandler.java
taxeditor-editor/src/main/java/eu/etaxonomy/taxeditor/forms/selection/DerivedUnitBaseSelectionElement.java
taxeditor-editor/src/main/java/eu/etaxonomy/taxeditor/forms/selection/EditFromSelectionWizard.java
taxeditor-editor/src/main/java/eu/etaxonomy/taxeditor/section/occurrence/DerivedUnitFacadeWizardPage.java

index b8cbdd700bf37c0a41489f999f49e8360114af93..c9aed5ddb28c84243981bd7758bf88d13d3ce590 100644 (file)
@@ -41,13 +41,10 @@ public class NewDerivedUnitBaseWizard extends AbstractNewEntityWizard<DerivedUni
        /** {@inheritDoc} */
        @Override
        public void addPages() {
-//             addPage(new DerivedUnitFacadeWizardPage(formFactory, getConversationHolder(), entity));
-               
                addPage(new GeneralWizardPage(formFactory, getConversationHolder(), getFacade()));
                addPage(new GatheringEventWizardPage(formFactory, getConversationHolder(), getFacade()));
                addPage(new FieldObservationWizardPage(formFactory, getConversationHolder(), getFacade()));
                addPage(new DerivedUnitBaseWizardPage(formFactory, getConversationHolder(), getFacade()));
-               
        }
        
        /**
index 028cd0b5b9abbe08a78147b775b3787b56084fc3..15fea804f96fe3b2caf7db7c653af77aed187737 100644 (file)
@@ -85,6 +85,7 @@ public class DescriptionElementDropAdapter extends ViewerDropAdapter {
                        TransferData transferData) {
                boolean transferDataIsSupported = DescriptionElementTransfer.getInstance().isSupportedType(
                                transferData);
+               System.out.println(target);
                return target instanceof TaxonDescription && transferDataIsSupported;
        }
 
index 5711dc0648b4075338087894e30bce2f37c5b05f..4d8241abfef367f27aad41f9054d5d16431c9298 100644 (file)
@@ -22,7 +22,6 @@ import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.ui.handlers.HandlerUtil;
 
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.service.IDescriptionService;
 import eu.etaxonomy.cdm.api.service.ITaxonService;
 import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
index 7f6d7012aa88e4573a70a12da045c7caaaa80381..ea44f60510de87e0b1cb39254e5253481c2c5680 100644 (file)
@@ -10,7 +10,6 @@
 
 package eu.etaxonomy.taxeditor.forms.selection;
 
-import org.apache.log4j.Logger;
 import org.eclipse.swt.events.SelectionEvent;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
@@ -28,9 +27,6 @@ import eu.etaxonomy.taxeditor.forms.ICdmFormElement;
  */
 public class DerivedUnitBaseSelectionElement extends AbstractSelectionElement<DerivedUnitBase> {
 
-       private static final Logger logger = Logger
-                       .getLogger(DerivedUnitBaseSelectionElement.class);
-
        /**
         * <p>Constructor for DerivedUnitBaseSelectionElement.</p>
         *
index 27151e17682106ce9f959e25f0e886581d8419b0..69279a821b42042068aad6de2cf67873052986f5 100644 (file)
 package eu.etaxonomy.taxeditor.forms.selection;
 
 import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.wizard.IWizardPage;
 import org.eclipse.jface.wizard.Wizard;
 import org.eclipse.jface.wizard.WizardDialog;
 import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.events.SelectionListener;
 
+import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException;
 import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
 import eu.etaxonomy.cdm.model.agent.Institution;
 import eu.etaxonomy.cdm.model.agent.Person;
@@ -26,14 +29,17 @@ import eu.etaxonomy.cdm.model.occurrence.Collection;
 import eu.etaxonomy.cdm.model.occurrence.DerivedUnitBase;
 import eu.etaxonomy.cdm.model.reference.Reference;
 import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.forms.AbstractCdmEntityWizardPage;
 import eu.etaxonomy.taxeditor.forms.CdmFormFactory;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.section.agent.InstitutionWizardPage;
 import eu.etaxonomy.taxeditor.section.agent.PersonWizardPage;
 import eu.etaxonomy.taxeditor.section.agent.TeamWizardPage;
 import eu.etaxonomy.taxeditor.section.name.NonViralNameWizardPage;
 import eu.etaxonomy.taxeditor.section.occurrence.CollectionWizardPage;
-import eu.etaxonomy.taxeditor.section.occurrence.DerivedUnitFacadeWizardPage;
+import eu.etaxonomy.taxeditor.section.occurrence.DerivedUnitBaseWizardPage;
+import eu.etaxonomy.taxeditor.section.occurrence.FieldObservationWizardPage;
+import eu.etaxonomy.taxeditor.section.occurrence.GatheringEventWizardPage;
+import eu.etaxonomy.taxeditor.section.occurrence.GeneralWizardPage;
 import eu.etaxonomy.taxeditor.section.reference.ReferenceWizardPage;
 
 /**
@@ -46,9 +52,6 @@ import eu.etaxonomy.taxeditor.section.reference.ReferenceWizardPage;
 public class EditFromSelectionWizard extends Wizard implements SelectionListener {
        
        private AbstractSelectionElement selectionElement;
-
-
-       AbstractCdmEntityWizardPage page;
        
        /**
         * <p>Constructor for EditFromSelectionWizard.</p>
@@ -68,31 +71,45 @@ public class EditFromSelectionWizard extends Wizard implements SelectionListener
                IdentifiableEntity entity = (IdentifiableEntity) HibernateProxyHelper.deproxy(selectionElement.getEntity());
                
                if(entity instanceof Reference){
-                       page = new ReferenceWizardPage(formFactory, selectionElement.getConversationHolder(), (Reference) entity);
+                       addPage(new ReferenceWizardPage(formFactory, selectionElement.getConversationHolder(), (Reference) entity));
                }
                else if(entity instanceof Team){
-                       page = new TeamWizardPage(formFactory, selectionElement.getConversationHolder(), (Team) entity);
+                       addPage(new TeamWizardPage(formFactory, selectionElement.getConversationHolder(), (Team) entity));
                }
                else if(entity instanceof Person){
-                       page = new PersonWizardPage(formFactory, selectionElement.getConversationHolder(), (Person) entity);
+                       addPage(new PersonWizardPage(formFactory, selectionElement.getConversationHolder(), (Person) entity));
                }
                else if(entity instanceof NonViralName){
-                       page = new NonViralNameWizardPage(formFactory, selectionElement.getConversationHolder(), (NonViralName) entity);
+                       addPage(new NonViralNameWizardPage(formFactory, selectionElement.getConversationHolder(), (NonViralName) entity));
                }
                else if (entity instanceof DerivedUnitBase){
-                       page = new DerivedUnitFacadeWizardPage(formFactory, selectionElement.getConversationHolder(), (DerivedUnitBase) entity);
+                       
+                       
+//                     addPage(new DerivedUnitFacadeWizardPage(formFactory, selectionElement.getConversationHolder(), (DerivedUnitBase) entity));
+                       
+                       DerivedUnitFacade facade;
+                       try {
+                               facade = DerivedUnitFacade.NewInstance((DerivedUnitBase) entity, PreferencesUtil.getDerivedUnitConfigurator());
+                       } catch (DerivedUnitFacadeNotSupportedException e) {
+                               // we should never get here
+                               throw new IllegalStateException();
+                       }
+                       
+                       addPage(new GeneralWizardPage(formFactory, selectionElement.getConversationHolder(), facade));
+                       addPage(new GatheringEventWizardPage(formFactory, selectionElement.getConversationHolder(), facade));
+                       addPage(new FieldObservationWizardPage(formFactory, selectionElement.getConversationHolder(), facade));
+                       addPage(new DerivedUnitBaseWizardPage(formFactory, selectionElement.getConversationHolder(), facade));
                }
                else if(entity instanceof Collection){
-                       page = new CollectionWizardPage(formFactory, selectionElement.getConversationHolder(), (Collection) entity);
+                       addPage(new CollectionWizardPage(formFactory, selectionElement.getConversationHolder(), (Collection) entity));
                }
                else if(entity instanceof Institution){
-                       page = new InstitutionWizardPage(formFactory, selectionElement.getConversationHolder(), (Institution) entity);
+                       addPage(new InstitutionWizardPage(formFactory, selectionElement.getConversationHolder(), (Institution) entity));
                }
                else{
                        EditorUtil.warningDialog("Missing interface", this, "No detail element for current selection");
                }
                
-               addPage(page);
        }
        
        /* (non-Javadoc)
@@ -101,7 +118,9 @@ public class EditFromSelectionWizard extends Wizard implements SelectionListener
        /** {@inheritDoc} */
        @Override
        public boolean performFinish() {
-               page.dispose();
+               for(IWizardPage page : getPages()){
+                       page.dispose();
+               }
                return true;
        }
 
index 7e529b16729d6d89c43ad32907279c8469c4ea1e..07edae2da8bd657cd9eb39a8770f0b2bdb4163c9 100644 (file)
@@ -27,6 +27,7 @@ import eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement;
  * @created Jun 16, 2010
  * @version 1.0
  */
+@Deprecated // use the specific pages instead (e.g. GeneralWizardPage, GatheringEventPage, s.o.)
 public class DerivedUnitFacadeWizardPage extends AbstractCdmEntityWizardPage<DerivedUnitBase> {
 
        /**