latest changes from trunk
authorAlexander Oppermann <a.oppermann@bgbm.org>
Mon, 24 Nov 2014 14:23:52 +0000 (14:23 +0000)
committerAlexander Oppermann <a.oppermann@bgbm.org>
Mon, 24 Nov 2014 14:23:52 +0000 (14:23 +0000)
31 files changed:
.gitattributes
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/BulkEditor.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/OpenDerivateViewHandler.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateContentProvider.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateDropListener.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateView.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateViewEditorInput.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/DeleteDerivateHandler.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/operation/DeleteDerivateOperation.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/operation/MoveDerivateOperation.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/plugin.xml
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/SpecimenOrObservationPreferences.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitBaseDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitGeneralDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/FieldUnitGeneralDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/GatheringEventDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/AmplificationGeneralDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/DnaQualityDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/DnaSampleGeneralDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/PrimerGeneralDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/TissueSampleGeneralDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/LivingPlantPhotoGeneralDetailElement.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/LivingPlantPhotoGeneralDetailSection.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/SpecimenScanGeneralDetailElement.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/SpecimenScanGeneralDetailSection.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/derivateSearch/DerivateLabelProvider.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/derivateSearch/DerivateSearchComposite.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/derivateSearch/DerivateSearchView.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java

index 35d0eabba15409243b592f856ec7636d09383372..ea7f63847a4416d6cdb79c86132524de76fc3801 100644 (file)
@@ -541,6 +541,7 @@ eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/d
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/contextMenu/SingleReadSequenceContextMenu.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/DeleteDerivateHandler.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/operation/DeleteDerivateOperation.java -text
+eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/operation/MoveDerivateOperation.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptionElementDragListener.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptionElementDropAdapter.java -text
 eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/DescriptionElementTransfer.java -text
@@ -1668,12 +1669,8 @@ eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occ
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/SingleReadPherogramCollectionDetailSection.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/TissueSampleGeneralDetailElement.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/TissueSampleGeneralDetailSection.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/LivingPlantPhotoGeneralDetailElement.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/LivingPlantPhotoGeneralDetailSection.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/MediaSpecimenGeneralDetailElement.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/MediaSpecimenGeneralDetailSection.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/SpecimenScanGeneralDetailElement.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/SpecimenScanGeneralDetailSection.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/NomenclaturalReferenceDetailElement.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/NomenclaturalReferenceDetailSection.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/ReferenceDetailElement.java -text
index 48e604b2dfa5827112b73199ebd58b4c68cb387a..364dcdf72fbe1c59416a1d528febc125e6ac5c8b 100644 (file)
@@ -44,7 +44,6 @@ import eu.etaxonomy.taxeditor.annotatedlineeditor.LineAnnotationModel;
 import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
 import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
 import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
-import eu.etaxonomy.taxeditor.model.IPartContentHasMedia;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 
@@ -57,7 +56,7 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
  * @created 07.07.2009
  * @version 1.0
  */
-public class BulkEditor extends AnnotatedLineEditor implements IPartContentHasDetails, IPartContentHasMedia,
+public class BulkEditor extends AnnotatedLineEditor implements IPartContentHasDetails,
         IDirtyMarkable {
 
        /** Constant <code>ID="bulkeditor.editor"</code> */
@@ -267,7 +266,8 @@ public class BulkEditor extends AnnotatedLineEditor implements IPartContentHasDe
            }
        }
 
-       public void forceDirty(){
+       @Override
+    public void forceDirty(){
            isDirty = true;
            firePropertyChange(PROP_DIRTY);
        }
index d6f0df7e6295919e1ff516db44d7c115dfe021f8..f06996ef75511a31a2a26274e2bca1d27a9e1759 100644 (file)
@@ -1,5 +1,10 @@
 package eu.etaxonomy.taxeditor.editor.handler;
 
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+import java.util.UUID;
+
 import org.eclipse.core.commands.AbstractHandler;
 import org.eclipse.core.commands.ExecutionEvent;
 import org.eclipse.core.commands.ExecutionException;
@@ -22,18 +27,22 @@ public class OpenDerivateViewHandler extends AbstractHandler {
     public Object execute(ExecutionEvent event) throws ExecutionException {
         ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
         if(currentSelection instanceof IStructuredSelection){
-            Object selectedElement = ((IStructuredSelection) currentSelection).getFirstElement();
-            if(selectedElement instanceof SpecimenOrObservationBase<?>){
-
-                DerivateViewEditorInput input = new DerivateViewEditorInput(((SpecimenOrObservationBase<?>) selectedElement).getUuid());
-                try {
-                    EditorUtil.open(input);
-                } catch (PartInitException e) {
-                    MessagingUtils.error(OpenDerivateViewHandler.class, "Could not open DerivateView", e);
-                } catch (NullPointerException npe){
-                    MessagingUtils.messageDialog("Failed to open Editor", OpenDerivateViewHandler.class, "Could not open DerivateView. The derivate hierarchy is corrupted!", npe);
+            Iterator<?> selectionIterator = ((IStructuredSelection) currentSelection).iterator();
+            Set<UUID> selectedElementUUIDs = new HashSet<UUID>();
+            while(selectionIterator.hasNext()){
+                Object object = selectionIterator.next();
+                if(object instanceof SpecimenOrObservationBase<?>){
+                    selectedElementUUIDs.add(((SpecimenOrObservationBase<?>) object).getUuid());
                 }
             }
+            DerivateViewEditorInput input = new DerivateViewEditorInput(selectedElementUUIDs);
+            try {
+                EditorUtil.open(input);
+            } catch (PartInitException e) {
+                MessagingUtils.error(OpenDerivateViewHandler.class, "Could not open DerivateView", e);
+            } catch (NullPointerException npe){
+                MessagingUtils.messageDialog("Failed to open Editor", OpenDerivateViewHandler.class, "Could not open DerivateView. The derivate hierarchy is corrupted!", npe);
+            }
         }
         return null;
     }
index 1e1da7b5bde030cb6e32e859edfdf8541fd86672..023d217fe6d72aa596ad31e8fbe230a877775a1b 100644 (file)
@@ -1,10 +1,10 @@
 package eu.etaxonomy.taxeditor.editor.view.derivate;
 
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.LinkedHashSet;
 import java.util.List;
 import java.util.Set;
+import java.util.UUID;
 
 import org.eclipse.jface.viewers.ITreeContentProvider;
 import org.eclipse.jface.viewers.TreeNode;
@@ -34,17 +34,17 @@ public class DerivateContentProvider implements ITreeContentProvider {
 
        @Override
        public Object[] getElements(Object inputElement) {
-           SpecimenOrObservationBase<?> rootElement = null;
+           List<TreeNode> rootElements = new ArrayList<TreeNode>();
            if(inputElement instanceof DerivateViewEditorInput){
-               rootElement = CdmStore.getService(IOccurrenceService.class).load(((DerivateViewEditorInput) inputElement).getRootElementUUID());
-           }
-
-           if(rootElement!=null){
-               //show topmost element in the derivate hierarchy if no field unit was found
-               TreeNode node = new TreeNode(rootElement);
-            return Collections.singleton(node).toArray();
+               Set<UUID> rootUUIDs = ((DerivateViewEditorInput) inputElement).getRootUUIDs();
+               for (UUID uuid : rootUUIDs) {
+                   SpecimenOrObservationBase<?> rootElement = CdmStore.getService(IOccurrenceService.class).load(uuid);
+                if(rootElement!=null){
+                    rootElements.add(new TreeNode(rootElement));
+                }
+            }
            }
-           return null;
+           return rootElements.toArray();
        }
 
        @Override
index d9a10fe892d5c6bd67b694dbbe61e315cde7a395..e5148ff67db0b187cbdd377c87d89f87205265e8 100644 (file)
@@ -9,23 +9,16 @@
 */
 package eu.etaxonomy.taxeditor.editor.view.derivate;
 
+import org.eclipse.core.runtime.Status;
 import org.eclipse.jface.util.LocalSelectionTransfer;
 import org.eclipse.jface.viewers.TreeNode;
 import org.eclipse.jface.viewers.ViewerDropAdapter;
 import org.eclipse.swt.dnd.TransferData;
 
-import eu.etaxonomy.cdm.api.service.IOccurrenceService;
-import eu.etaxonomy.cdm.api.service.molecular.ISequenceService;
-import eu.etaxonomy.cdm.model.molecular.DnaSample;
-import eu.etaxonomy.cdm.model.molecular.Sequence;
-import eu.etaxonomy.cdm.model.molecular.SingleRead;
-import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
-import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
-import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
 import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.view.derivate.operation.MoveDerivateOperation;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.view.derivateSearch.DerivateLabelProvider;
 
 /**
  * @author pplitzner
@@ -36,9 +29,6 @@ public class DerivateDropListener extends ViewerDropAdapter {
 
     private final DerivateView derivateView;
 
-    /**
-     * @param derivateView
-     */
     protected DerivateDropListener(DerivateView derivateView) {
         super(derivateView.getViewer());
         this.derivateView = derivateView;
@@ -57,30 +47,10 @@ public class DerivateDropListener extends ViewerDropAdapter {
         if(target instanceof TreeNode && data instanceof DerivateViewSelection){
             DerivateViewSelection derivateViewSelection = (DerivateViewSelection)data;
             TreeNode targetNode = (TreeNode) target;
-            TreeNode draggednode = EditorUtil.getTreeNodeOfSelection(derivateViewSelection.getSelection());
-            if(draggednode!=null){
-                if(moveTreeNode(draggednode, targetNode)){
-                    //update DerivateView
-                    derivateView.getConversationHolder().commit();
-                    derivateView.refreshTree();
-
-                    // update source DerivateView if dragging between different views occurred
-                    DerivateView sourceDerivateView = derivateViewSelection.getDerivateView();
-                    if(sourceDerivateView!=derivateView){
-                        sourceDerivateView.getConversationHolder().commit();
-                        sourceDerivateView.refreshTree();
-                    }
-
-                    //FIXME: way too much overhead for just refreshing the other DerivateView
-//                    CdmStore.getContextManager().notifyContextRefresh();
-                    LocalSelectionTransfer.getTransfer().setSelection(null);
-                    return true;
-                }
-                else{
-                    DerivateLabelProvider derivateLabelProvider = new DerivateLabelProvider();
-                    derivateLabelProvider.setConversation(derivateView.getConversationHolder());
-                    MessagingUtils.warningDialog("Moving derivate not possible!", derivateView, "Moving \""+derivateLabelProvider.getDerivateText(draggednode)+"\" to \""+derivateLabelProvider.getDerivateText(targetNode)+"\" is not possible!");
-                }
+            TreeNode draggedNode = EditorUtil.getTreeNodeOfSelection(derivateViewSelection.getSelection());
+            if(draggedNode!=null){
+                MoveDerivateOperation moveDerivateOperation = new MoveDerivateOperation("Moving \""+derivateView.getLabelProvider().getDerivateText(draggedNode)+"\" to \""+derivateView.getLabelProvider().getDerivateText(targetNode)+"\"", EditorUtil.getUndoContext(), derivateView, draggedNode, targetNode);
+                return AbstractUtility.executeOperation(moveDerivateOperation).equals(Status.OK_STATUS)?true:false;
             }
         }
         return false;
@@ -94,48 +64,4 @@ public class DerivateDropListener extends ViewerDropAdapter {
         return LocalSelectionTransfer.getTransfer().isSupportedType(transferType) && target instanceof TreeNode;
     }
 
-    /**
-     * @param value
-     * @return
-     */
-    private boolean moveTreeNode(TreeNode draggedNode, TreeNode targetNode) {
-        Object draggedNodeValue = draggedNode.getValue();
-        Object targetNodeValue = targetNode.getValue();
-        TreeNode fromParentNode = draggedNode.getParent();
-        Object fromParentSpecimen = null;
-        if(fromParentNode!=null){
-            fromParentSpecimen = fromParentNode.getValue();
-        }
-
-        // drag'n'drop for SpecimenOrObservationBase
-        IOccurrenceService occurrenceService = CdmStore.getService(IOccurrenceService.class);
-        if(draggedNodeValue instanceof DerivedUnit && targetNodeValue instanceof SpecimenOrObservationBase<?>){
-            DerivedUnit draggedSpecimen = (DerivedUnit) draggedNodeValue;
-            SpecimenOrObservationBase<?> targetSpecimen = (SpecimenOrObservationBase<?>) targetNodeValue;
-            //check if type is a sub derivate type
-            if(fromParentSpecimen instanceof SpecimenOrObservationBase<?>
-            && fromParentNode!=null
-            && !fromParentNode.equals(targetNode)){//don't drag on direct parent node)
-                return occurrenceService.moveDerivate((SpecimenOrObservationBase<?>)fromParentSpecimen, targetSpecimen, draggedSpecimen);
-            }
-        }
-
-        // drag'n'drop for SingleRead
-        else if(draggedNodeValue instanceof SingleRead && targetNodeValue instanceof Sequence){
-            SingleRead singleRead = (SingleRead) draggedNodeValue;
-            if(fromParentSpecimen instanceof Sequence){
-                return CdmStore.getService(ISequenceService.class).moveSingleRead((Sequence)fromParentSpecimen, (Sequence)targetNodeValue, singleRead);
-            }
-        }
-
-        // drag'n'drop for Sequence
-        else if(draggedNodeValue instanceof Sequence && targetNodeValue instanceof DnaSample && ((SpecimenOrObservationBase<?>) targetNodeValue).getRecordBasis()==SpecimenOrObservationType.DnaSample){
-            Sequence sequence = (Sequence)draggedNodeValue;
-            if(fromParentSpecimen instanceof DnaSample && ((SpecimenOrObservationBase<?>) targetNodeValue).getRecordBasis()==SpecimenOrObservationType.DnaSample){
-                return occurrenceService.moveSequence((DnaSample)fromParentSpecimen, (DnaSample)targetNodeValue, sequence);
-            }
-        }
-        return false;
-    }
-
 }
index 963cd911fb11615a7d962ff2abe1953a7e7fb145..66eff4ca5514d777fb87f21a99147a3fc6f168ce 100644 (file)
@@ -4,6 +4,7 @@ import java.util.Collection;
 import java.util.HashSet;
 import java.util.Map.Entry;
 import java.util.Set;
+import java.util.UUID;
 
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.jface.action.MenuManager;
@@ -41,7 +42,6 @@ import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
 import eu.etaxonomy.taxeditor.model.IDirtyMarkable;
 import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
 import eu.etaxonomy.taxeditor.model.IPartContentHasFactualData;
-import eu.etaxonomy.taxeditor.model.IPartContentHasMedia;
 import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
 import eu.etaxonomy.taxeditor.store.CdmStore;
@@ -52,7 +52,7 @@ import eu.etaxonomy.taxeditor.view.derivateSearch.DerivateLabelProvider;
  *
  */
 public class DerivateView extends EditorPart implements IPartContentHasFactualData, IDirtyMarkable,
-        IConversationEnabled, IPartContentHasDetails, IPartContentHasMedia, IPartContentHasSupplementalData,
+        IConversationEnabled, IPartContentHasDetails, IPartContentHasSupplementalData,
         ISelectionChangedListener, IPostOperationEnabled {
 
     public static final String ID = "eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView";
@@ -104,11 +104,15 @@ public class DerivateView extends EditorPart implements IPartContentHasFactualDa
         labelProvider.setMultiLinkSingleReads(multiLinkSingleReads);
         IEditorInput editorInput = getEditorInput();
         viewer.setInput(editorInput);
+        //set selection to selected derivate if only one was selected
         if(editorInput instanceof DerivateViewEditorInput){
-            SpecimenOrObservationBase<?> specimen = CdmStore.getService(IOccurrenceService.class).load(((DerivateViewEditorInput) editorInput).getDerivateUUID());
-            SpecimenOrObservationBase<?> rootElement = CdmStore.getService(IOccurrenceService.class).load(((DerivateViewEditorInput) editorInput).getRootElementUUID());
-            setPartName(labelProvider.getDerivateText(rootElement));
-            viewer.setSelection(new StructuredSelection(new TreeNode(specimen)));
+            Set<UUID> derivateUUIDs = ((DerivateViewEditorInput) editorInput).getDerivateUUIDs();
+            if(derivateUUIDs.size()==1){
+                SpecimenOrObservationBase<?> specimen = CdmStore.getService(IOccurrenceService.class).load(derivateUUIDs.iterator().next());
+                if(specimen!=null){
+                    viewer.setSelection(new StructuredSelection(new TreeNode(specimen)));
+                }
+            }
         }
 
         //add drag'n'drop support
@@ -122,7 +126,12 @@ public class DerivateView extends EditorPart implements IPartContentHasFactualDa
      */
     @Override
     public void doSave(IProgressMonitor monitor) {
-        monitor.beginTask("Saving Derivates", 3);
+        String taskName = "Saving hierarchy";
+        if(getEditorInput() instanceof DerivateViewEditorInput){
+            DerivateViewEditorInput derivateViewEditorInput = (DerivateViewEditorInput) getEditorInput();
+            taskName += " "+derivateViewEditorInput.getName();
+        }
+        monitor.beginTask(taskName, 3);
         if (!conversation.isBound()) {
             conversation.bind();
         }
@@ -151,6 +160,10 @@ public class DerivateView extends EditorPart implements IPartContentHasFactualDa
      */
     @Override
     public String getTitleToolTip() {
+        if(getEditorInput() instanceof DerivateViewEditorInput){
+            DerivateViewEditorInput derivateViewEditorInput = (DerivateViewEditorInput) getEditorInput();
+            return derivateViewEditorInput.getName();
+        }
         return "Derivate View";
     }
 
@@ -162,7 +175,9 @@ public class DerivateView extends EditorPart implements IPartContentHasFactualDa
         setSite(site);
         setInput(input);
         if(input instanceof DerivateViewEditorInput){
-            conversation = ((DerivateViewEditorInput) input).getConversationHolder();
+            DerivateViewEditorInput derivateViewEditorInput = (DerivateViewEditorInput) input;
+            conversation = derivateViewEditorInput.getConversationHolder();
+            setPartName(derivateViewEditorInput.getName());
         }
     }
 
@@ -290,13 +305,14 @@ public class DerivateView extends EditorPart implements IPartContentHasFactualDa
         this.selection  = event.getSelection();
     }
 
-    /**
-     * @return the selection
-     */
     public ISelection getSelection() {
         return selection;
     }
 
+    public DerivateLabelProvider getLabelProvider() {
+        return labelProvider;
+    }
+
     /* (non-Javadoc)
      * @see eu.etaxonomy.taxeditor.operation.IPostOperationEnabled#postOperation(eu.etaxonomy.cdm.model.common.CdmBase)
      */
@@ -304,19 +320,9 @@ public class DerivateView extends EditorPart implements IPartContentHasFactualDa
     public boolean postOperation(CdmBase objectAffectedByOperation) {
         refreshTree();
         if(objectAffectedByOperation!=null){
-            DerivateViewEditorInput derivateViewEditorInput = (DerivateViewEditorInput) getEditorInput();
-            if(objectAffectedByOperation.getUuid().equals(derivateViewEditorInput.getRootElementUUID())){
-                // TODO close derivate view if root element is deleted
-//                this.getViewer().setEditorSite().getPage().close();
-                return true;
-            }
-            else if(objectAffectedByOperation.getUuid().equals(derivateViewEditorInput.getDerivateUUID())){
-                derivateViewEditorInput.setRootAsDerivate();
-            }
             changed(objectAffectedByOperation);
-            return true;
         }
-        return false;
+        return true;
     }
 
     /* (non-Javadoc)
index c323cb3f0621f4e74b88a409a45499e2a0cab642..0d677cd096f6738ac89c2d2b26d8428aacd90a06 100644 (file)
@@ -9,6 +9,8 @@
 */
 package eu.etaxonomy.taxeditor.editor.view.derivate;
 
+import java.util.HashSet;
+import java.util.Set;
 import java.util.UUID;
 
 import org.eclipse.jface.resource.ImageDescriptor;
@@ -23,6 +25,7 @@ import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
 import eu.etaxonomy.taxeditor.editor.EditorUtil;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.view.derivateSearch.DerivateLabelProvider;
 
 /**
  * Editor input for the {@link DerivateView} which holds the currently selected derivate for which
@@ -35,38 +38,43 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
 public class DerivateViewEditorInput implements IEditorInput{
 
     /**
-     * The selected derivate {@link UUID}
+     * The selected derivate {@link UUID}s
      */
-    private UUID derivateUUID;
+    private Set<UUID> derivateUUIDs;
     /**
-     * The {@link UUID} of the root of the hierarchy (may be the same object as the derivate)
+     * List of the {@link UUID}s of the root elements of the hierarchy (may be the same objects as the derivates)
      */
-    private UUID rootUUID;
+    private Set<UUID> rootUUIDs;
 
     private final ConversationHolder conversationHolder;
 
     /**
-     * Creates an editor input for the {@link DerivateView} with the currently selected derivate and the
-     * corresponding {@link FieldUnit} (both may be the same object).
-     * @param derivateUuid the {@link UUID} of the derivate for which the derivate hierarchy should be shown
-     * @param rootUUID the root of the hierarchy
+     * Creates an editor input for the {@link DerivateView} with the currently selected derivates and the
+     * corresponding {@link FieldUnit}s (both may be the same object).
+     * @param derivateUuids the {@link UUID}s of the derivates for which the derivate hierarchy should be shown
+     * @param rootUUIDs the root of the hierarchy
      */
-    public DerivateViewEditorInput(UUID derivateUuid) {
+    public DerivateViewEditorInput(Set<UUID> derivateUuids) {
         super();
         this.conversationHolder = CdmStore.createConversation();
-        this.derivateUUID = derivateUuid;
-        SpecimenOrObservationBase<?> derivate = CdmStore.getService(IOccurrenceService.class).load(derivateUuid);
-        if(derivate instanceof FieldUnit){
-            this.rootUUID = derivateUUID;
-        }
-        else if(derivate instanceof DerivedUnit){
-            SpecimenOrObservationBase<?> topMostDerivate = EditorUtil.getTopMostDerivate(derivate);
-            rootUUID = topMostDerivate==null?null:topMostDerivate.getUuid();
-            if(rootUUID==null){
-                rootUUID = derivateUUID;
+        this.derivateUUIDs = derivateUuids;
+        this.rootUUIDs = new HashSet<UUID>();
+        for (UUID uuid : derivateUuids) {
+            SpecimenOrObservationBase<?> derivate = CdmStore.getService(IOccurrenceService.class).load(uuid);
+            if(derivate instanceof FieldUnit){
+                rootUUIDs.add(uuid);
+            }
+            else if(derivate instanceof DerivedUnit){
+                SpecimenOrObservationBase<?> topMostDerivate = EditorUtil.getTopMostDerivate(derivate);
+                if(topMostDerivate!=null){
+                    rootUUIDs.add(topMostDerivate.getUuid());
+                }
             }
         }
-        if(rootUUID==null){
+        if(rootUUIDs.isEmpty()){
+            rootUUIDs = derivateUUIDs;
+        }
+        if(rootUUIDs.isEmpty()){
             MessagingUtils.messageDialog("Failed initializing editor", DerivateViewEditorInput.class, "No root element found!");
         }
     }
@@ -102,7 +110,7 @@ public class DerivateViewEditorInput implements IEditorInput{
      */
     @Override
     public String getName() {
-        return derivateUUID.toString();
+        return getEditorName();
     }
 
     /* (non-Javadoc)
@@ -118,19 +126,35 @@ public class DerivateViewEditorInput implements IEditorInput{
      */
     @Override
     public String getToolTipText() {
-        return derivateUUID.toString();
+        return getEditorName();
+    }
+
+    private String getEditorName() {
+        String name = null;
+        for(UUID uuid:rootUUIDs){
+            SpecimenOrObservationBase<?> specimen = CdmStore.getService(IOccurrenceService.class).load(uuid);
+            if(specimen!=null){
+                if(name==null){
+                    name = DerivateLabelProvider.getDerivateText(specimen, conversationHolder);
+                }
+                else{
+                    name += " + "+DerivateLabelProvider.getDerivateText(specimen, conversationHolder);
+                }
+            }
+        }
+        return name;
     }
 
-    public UUID getDerivateUUID() {
-        return derivateUUID;
+    public Set<UUID> getRootUUIDs() {
+        return rootUUIDs;
     }
 
-    public UUID getRootElementUUID() {
-        return rootUUID;
+    public Set<UUID> getDerivateUUIDs() {
+        return derivateUUIDs;
     }
 
     public void setRootAsDerivate(){
-        this.derivateUUID = this.rootUUID;
+        this.derivateUUIDs = this.rootUUIDs;
     }
 
     public ConversationHolder getConversationHolder() {
@@ -144,7 +168,7 @@ public class DerivateViewEditorInput implements IEditorInput{
     public int hashCode() {
         final int prime = 31;
         int result = 1;
-        result = prime * result + ((rootUUID == null) ? 0 : rootUUID.hashCode());
+        result = prime * result + ((rootUUIDs == null) ? 0 : rootUUIDs.hashCode());
         return result;
     }
 
@@ -163,14 +187,15 @@ public class DerivateViewEditorInput implements IEditorInput{
             return false;
         }
         DerivateViewEditorInput other = (DerivateViewEditorInput) obj;
-        if (rootUUID == null) {
-            if (other.rootUUID != null) {
+        if (rootUUIDs == null) {
+            if (other.rootUUIDs != null) {
                 return false;
             }
-        } else if (!rootUUID.equals(other.rootUUID)) {
+        } else if (!rootUUIDs.equals(other.rootUUIDs)) {
             return false;
         }
         return true;
     }
 
+
 }
index 7a38d5936199b5310d1aa4a86be70157c1d745cc..1e8e5e87db67b6b8cfb1e9fab5715a6136721df1 100644 (file)
@@ -20,6 +20,8 @@ import org.eclipse.jface.viewers.TreeNode;
 import org.eclipse.ui.IWorkbenchPart;
 import org.eclipse.ui.handlers.HandlerUtil;
 
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
 import eu.etaxonomy.cdm.api.service.config.SpecimenDeleteConfigurator;
 import eu.etaxonomy.cdm.model.common.CdmBase;
 import eu.etaxonomy.cdm.model.molecular.Sequence;
@@ -30,6 +32,7 @@ import eu.etaxonomy.taxeditor.editor.view.derivate.operation.DeleteDerivateOpera
 import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.view.derivateSearch.DerivateLabelProvider;
 
 /**
  *
@@ -59,9 +62,12 @@ public class DeleteDerivateHandler extends AbstractHandler {
                 Object object = selection.iterator().next();
 
                 if(object instanceof TreeNode){
-                    TreeNode treeNode = (TreeNode)object;
                     Object value = ((TreeNode) object).getValue();
                     if(value instanceof SpecimenOrObservationBase<?> || value instanceof Sequence || value instanceof SingleRead){
+                        if(postOperationEnabled instanceof IConversationEnabled){
+                            ConversationHolder conversationHolder = ((IConversationEnabled) postOperationEnabled).getConversationHolder();
+                            label += " "+DerivateLabelProvider.getDerivateText(value, conversationHolder);
+                        }
                         SpecimenDeleteConfigurator config = new SpecimenDeleteConfigurator();
                         config.setDeleteChildren(false);
                         config.setShiftHierarchyUp(false);
index 5032dde4168c692c542897a6675c5be41ed89a75..b480a0f83cd27dd8cd55c462180f8746a03391f6 100644 (file)
@@ -14,11 +14,14 @@ import org.eclipse.core.commands.operations.IUndoContext;
 import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.ui.ISaveablePart;
 
 import eu.etaxonomy.cdm.api.service.DeleteResult;
 import eu.etaxonomy.cdm.api.service.IOccurrenceService;
 import eu.etaxonomy.cdm.api.service.config.SpecimenDeleteConfigurator;
 import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
@@ -56,17 +59,34 @@ public class DeleteDerivateOperation extends AbstractPostOperation<CdmBase> {
     /** {@inheritDoc} */
     @Override
     public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+        if(getPostOperationEnabled() instanceof ISaveablePart){
+            if(!MessagingUtils.confirmDialog("Confirm deletion", "Do you really want to delete the selected element?")){
+                return Status.CANCEL_STATUS;
+            }
+            if(((ISaveablePart) getPostOperationEnabled()).isDirty()){
+                MessagingUtils.warningDialog("View has unsaved changes", this, "You need to save before performing this action");
+                return Status.CANCEL_STATUS;
+            }
+        }
         DeleteResult deleteResult = CdmStore.getService(IOccurrenceService.class).deleteDerivateHierarchy(element, deleteConfigurator);
-        if(!deleteResult.isOk()){
+        if(deleteResult.isOk()){
+            if(getPostOperationEnabled() instanceof DerivateView){
+                DerivateView derivateView = (DerivateView) getPostOperationEnabled();
+                //update DerivateView
+                derivateView.getConversationHolder().commit();
+                return postExecute(null);
+            }
+        }
+        else{
             String exceptionMessage = "";
             for(Exception exception:deleteResult.getExceptions()){
                 exceptionMessage += exception.getLocalizedMessage();
             }
             //TODO: add method to DeleteResult to sum up exceptions
             MessagingUtils.warningDialog("Deletion failed", this, exceptionMessage);
-            return postExecute(null);
+            return Status.CANCEL_STATUS;
         }
-        return postExecute(element);
+        return Status.OK_STATUS;
     }
 
     /*
@@ -79,7 +99,8 @@ public class DeleteDerivateOperation extends AbstractPostOperation<CdmBase> {
     /** {@inheritDoc} */
     @Override
     public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-        return execute(monitor, info);
+        //no redo possible
+        return Status.CANCEL_STATUS ;
     }
 
     /*
@@ -92,6 +113,7 @@ public class DeleteDerivateOperation extends AbstractPostOperation<CdmBase> {
     /** {@inheritDoc} */
     @Override
     public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
-        return postExecute(element);
+        //no undo possible
+        return Status.CANCEL_STATUS;
     }
 }
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/operation/MoveDerivateOperation.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/operation/MoveDerivateOperation.java
new file mode 100644 (file)
index 0000000..9605489
--- /dev/null
@@ -0,0 +1,147 @@
+// $Id$
+/**
+* Copyright (C) 2014 EDIT
+* 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.
+*/
+package eu.etaxonomy.taxeditor.editor.view.derivate.operation;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.IUndoContext;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.util.LocalSelectionTransfer;
+import org.eclipse.jface.viewers.TreeNode;
+
+import eu.etaxonomy.cdm.api.service.IOccurrenceService;
+import eu.etaxonomy.cdm.api.service.molecular.ISequenceService;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.molecular.DnaSample;
+import eu.etaxonomy.cdm.model.molecular.Sequence;
+import eu.etaxonomy.cdm.model.molecular.SingleRead;
+import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
+import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;
+import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author pplitzner
+ * @date Nov 18, 2014
+ *
+ */
+public class MoveDerivateOperation extends AbstractPostOperation<CdmBase>  {
+
+    private final TreeNode draggedNode;
+    private TreeNode fromNode;
+    private TreeNode targetNode;
+
+    public MoveDerivateOperation(String label, IUndoContext undoContext,
+            IPostOperationEnabled postOperationEnabled, TreeNode draggedNode, TreeNode targetNode) {
+            super(label, undoContext, null, postOperationEnabled);
+        this.draggedNode = draggedNode;
+        this.targetNode = targetNode;
+    }
+
+    /* (non-Javadoc)
+     * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+     */
+    @Override
+    public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+        DerivateView derivateView = null;
+        if(getPostOperationEnabled() instanceof DerivateView){
+            derivateView = (DerivateView) getPostOperationEnabled();
+        }
+        if(derivateView==null){
+            MessagingUtils.operationDialog(this, new NullPointerException("DerivateView was null"), TaxeditorEditorPlugin.PLUGIN_ID, this.getLabel(), getLabel());
+            return Status.CANCEL_STATUS;
+        }
+        if(derivateView.isDirty()){
+            MessagingUtils.warningDialog("View has unsaved changes", this, "You need to save before performing this action");
+            return Status.CANCEL_STATUS;
+        }
+
+        fromNode = draggedNode.getParent();
+        if(moveTreeNode(draggedNode, fromNode, targetNode)){
+            //update DerivateView
+            derivateView.getConversationHolder().commit();
+            LocalSelectionTransfer.getTransfer().setSelection(null);
+            return postExecute(null);
+        }
+        else{
+            MessagingUtils.warningDialog("Moving derivate not possible!", derivateView, "Moving \""+derivateView.getLabelProvider().getDerivateText(draggedNode)+"\" to \""+derivateView.getLabelProvider().getDerivateText(targetNode)+"\" is not possible!");
+        }
+        return Status.CANCEL_STATUS;
+    }
+
+    private boolean moveTreeNode(TreeNode draggedNode, TreeNode fromNode, TreeNode targetNode) {
+        Object draggedNodeValue = draggedNode.getValue();
+        Object targetNodeValue = targetNode.getValue();
+        Object fromParentSpecimen = null;
+        if(fromNode!=null){
+            fromParentSpecimen = fromNode.getValue();
+        }
+
+        // drag'n'drop for SpecimenOrObservationBase
+        IOccurrenceService occurrenceService = CdmStore.getService(IOccurrenceService.class);
+        if(draggedNodeValue instanceof DerivedUnit && targetNodeValue instanceof SpecimenOrObservationBase<?>){
+            DerivedUnit draggedSpecimen = (DerivedUnit) draggedNodeValue;
+            SpecimenOrObservationBase<?> targetSpecimen = (SpecimenOrObservationBase<?>) targetNodeValue;
+            //check if type is a sub derivate type
+            if(fromParentSpecimen instanceof SpecimenOrObservationBase<?>
+            && fromNode!=null
+            && !fromNode.equals(targetNode)){//don't drag on direct parent node)
+                return occurrenceService.moveDerivate((SpecimenOrObservationBase<?>)fromParentSpecimen, targetSpecimen, draggedSpecimen);
+            }
+        }
+
+        // drag'n'drop for SingleRead
+        else if(draggedNodeValue instanceof SingleRead && targetNodeValue instanceof Sequence){
+            SingleRead singleRead = (SingleRead) draggedNodeValue;
+            if(fromParentSpecimen instanceof Sequence){
+                return CdmStore.getService(ISequenceService.class).moveSingleRead((Sequence)fromParentSpecimen, (Sequence)targetNodeValue, singleRead);
+            }
+        }
+
+        // drag'n'drop for Sequence
+        else if(draggedNodeValue instanceof Sequence && targetNodeValue instanceof DnaSample && ((SpecimenOrObservationBase<?>) targetNodeValue).getRecordBasis()==SpecimenOrObservationType.DnaSample){
+            Sequence sequence = (Sequence)draggedNodeValue;
+            if(fromParentSpecimen instanceof DnaSample && ((SpecimenOrObservationBase<?>) targetNodeValue).getRecordBasis()==SpecimenOrObservationType.DnaSample){
+                return occurrenceService.moveSequence((DnaSample)fromParentSpecimen, (DnaSample)targetNodeValue, sequence);
+            }
+        }
+        return false;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+     */
+    @Override
+    public IStatus redo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+        //swap fromNode and targetNode
+        this.targetNode = this.fromNode;
+        return execute(new NullProgressMonitor(), null);
+    }
+
+    /* (non-Javadoc)
+     * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+     */
+    @Override
+    public IStatus undo(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
+        //swap fromNode and targetNode
+        this.targetNode = this.fromNode;
+        return execute(new NullProgressMonitor(), null);
+    }
+
+}
index 58b9538aeb7ba543ae85a84732bc993395c09394..44d489e5a759533a2f63881b7fa8d69902a4d258 100644 (file)
             </visibleWhen>
          </command>
       </menuContribution>
+      <menuContribution
+            allPopups="false"
+            locationURI="popup:eu.etaxonomy.taxeditor.view.derivateSearch.DerivateSearchView">
+         <command
+               commandId="eu.etaxonomy.taxeditor.editor.handler.openDerivateView"
+               label="Open in Derivate Editor"
+               style="push">
+         </command>
+      </menuContribution>
    </extension>
    <extension
          point="org.eclipse.ui.handlers">
          </activeWhen>
       </handler>
    </extension>
-   <extension
-         point="org.eclipse.ui.commands">
-      <command
-            defaultHandler="eu.etaxonomy.taxeditor.view.datasource.handler.ChangeConnectionHandler"
-            id="eu.etaxonomy.taxeditor.datasource.connect"
-            name="Connect">
-      </command>
-   </extension>
    <extension
          name="Popup Menu Commands"
          point="org.eclipse.ui.commands">
             id="eu.etaxonomy.taxeditor.store.open.OpenDistributionEditorWizardHandler"
             name="Open Distribution Editor Wizard">
       </command>
+      <command
+            defaultHandler="eu.etaxonomy.taxeditor.view.datasource.handler.ChangeConnectionHandler"
+            id="eu.etaxonomy.taxeditor.datasource.connect"
+            name="Connect">
+      </command>
    </extension>
    <extension
          point="org.eclipse.ui.importWizards">
index 08bc4d8256d1d9855a5548c9a90c87cc5d535ca5..dfc178da04deaec541c5d07fb840d1a0a2b061da 100644 (file)
@@ -119,6 +119,8 @@ public interface IPreferenceKeys {
 
     public static final String DETERMINATION_ONLY_FOR_FIELD_UNITS = "eu.etaxonomy.taxeditor.specimen.determinationOnlyOnFieldUnitLevel";
 
+    public static final String SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION = "eu.etaxonomy.taxeditor.specimen.showCollectingAreasInGeneralSection";
+
 
     public static final String DISTRIBUTION_AREA_PREFRENCES_ACTIVE = "eu.etaxonomy.taxeditor.checklist.distributionAreaPreferencesActive";
 
index f217610d4d4999a3fd3fad28eb900a33d3178564..93ebade8b6d5af2adbbd2c6445a2f1ac5d3d363c 100644 (file)
@@ -37,6 +37,9 @@ public class SpecimenOrObservationPreferences extends FieldEditorPreferencePage
         addField(new BooleanFieldEditor(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS,
                 "Taxon determination only on FieldUnit level",
                 getFieldEditorParent()));
+        addField(new BooleanFieldEditor(IPreferenceKeys.SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION,
+                "Show \"Collecting Areas\" in \"General\" section of details view",
+                getFieldEditorParent()));
 
     }
 
index 03f76ed7ce5a57d1fe595afa9768eed9e01d7775..9e450f39bcca21d3dc52bfec836b3ce9a7746efb 100644 (file)
@@ -261,12 +261,8 @@ import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadGeneralDetailS
 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadPherogramCollectionDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.TissueSampleGeneralDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.TissueSampleGeneralDetailSection;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.media.LivingPlantPhotoGeneralDetailElement;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.media.LivingPlantPhotoGeneralDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.media.MediaSpecimenGeneralDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.media.MediaSpecimenGeneralDetailSection;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.media.SpecimenScanGeneralDetailElement;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.media.SpecimenScanGeneralDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailElement;
@@ -1777,18 +1773,6 @@ public class CdmFormFactory extends FormToolkit {
         return section;
     }
 
-    public SpecimenScanGeneralDetailSection createSpecimenScanGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
-        SpecimenScanGeneralDetailSection section = new SpecimenScanGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
-        addAndAdaptSection(parentElement, section);
-        return section;
-    }
-
-    public LivingPlantPhotoGeneralDetailSection createLivingPlantPhotoGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
-        LivingPlantPhotoGeneralDetailSection section = new LivingPlantPhotoGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
-        addAndAdaptSection(parentElement, section);
-        return section;
-    }
-
     public MediaSpecimenGeneralDetailSection createMediaSpecimenGeneralDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
         MediaSpecimenGeneralDetailSection section = new MediaSpecimenGeneralDetailSection(this, conversation, parentElement, selectionProvider, style);
         addAndAdaptSection(parentElement, section);
@@ -2127,18 +2111,6 @@ public class CdmFormFactory extends FormToolkit {
         return element;
     }
 
-    public SpecimenScanGeneralDetailElement createSpecimenScanGeneralDetailElement(ICdmFormElement parentElement){
-        SpecimenScanGeneralDetailElement element = new SpecimenScanGeneralDetailElement(this, parentElement);
-        addAndAdaptElement(parentElement, element);
-        return element;
-    }
-
-    public LivingPlantPhotoGeneralDetailElement createLivingPlantPhotoGeneralDetailElement(ICdmFormElement parentElement){
-        LivingPlantPhotoGeneralDetailElement element = new LivingPlantPhotoGeneralDetailElement(this, parentElement);
-        addAndAdaptElement(parentElement, element);
-        return element;
-    }
-
     public MediaSpecimenGeneralDetailElement createMediaSpecimenGeneralDetailElement(ICdmFormElement parentElement){
         MediaSpecimenGeneralDetailElement element = new MediaSpecimenGeneralDetailElement(this, parentElement);
         addAndAdaptElement(parentElement, element);
index 97207a2babd51d458d8e3e61580928f74bcdea31..e67aaaf80293886b14adaeddef50f59d5a338a4c 100644 (file)
@@ -40,8 +40,6 @@ import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
 public class DerivedUnitBaseDetailElement extends
                AbstractCdmDetailElement<DerivedUnitFacade> {
 
-    private TextWithLabelElement textOriginalLabelData;
-
        private TextWithLabelElement text_derivedUnitDefinitions;
 
        private TextWithLabelElement text_barcode;
@@ -84,9 +82,6 @@ public class DerivedUnitBaseDetailElement extends
                // "Specimen Definition",
                // facade.getDerivedUnitDefinition(CdmStore.getDefaultLanguage()),
                // style);
-           //FIXME map original label data to corresponding model field
-           //commented because we do not use this yet in the trunk
-//         textOriginalLabelData = formFactory.createTextWithLabelElement(formElement, "Original Label Data", null, style);
         text_barcode = formFactory.createTextWithLabelElement(formElement, "Barcode", entity.getBarcode(), style);
         text_catalogNumber = formFactory.createTextWithLabelElement(formElement, "Catalog Number", entity.getCatalogNumber(), style);
 
index a2be5ed29e1f1417ad5bb9efae318074bb3b323a..c388bee71d579f04efeba6bb5491a767299052f2 100644 (file)
 package eu.etaxonomy.taxeditor.ui.section.occurrence;
 
 import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
-import eu.etaxonomy.cdm.model.agent.AgentBase;
-import eu.etaxonomy.cdm.model.common.LanguageString;
-import eu.etaxonomy.cdm.model.location.NamedArea;
 import eu.etaxonomy.cdm.model.occurrence.Collection;
-import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
-import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.GatheringEventUnitElement;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
-import eu.etaxonomy.taxeditor.ui.element.LanguageStringWithLabelElement;
-import eu.etaxonomy.taxeditor.ui.element.MinMaxTextSection;
-import eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement;
-import eu.etaxonomy.taxeditor.ui.element.PointElement;
 import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
-import eu.etaxonomy.taxeditor.ui.element.TimePeriodElement;
 import eu.etaxonomy.taxeditor.ui.element.ToggleableTextElement;
 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
 import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
@@ -39,17 +28,8 @@ public class DerivedUnitGeneralDetailElement extends
                AbstractCdmDetailElement<DerivedUnitFacade> {
 
        private ToggleableTextElement toggleableText_titleCache;
-       private EnumComboElement<SpecimenOrObservationType> combo_specorobstype;
-       private EntitySelectionElement<NamedArea> selection_country;
-       private LanguageStringWithLabelElement languageText_locality;
-       private PointElement element_point;
-       private NumberWithLabelElement number_elevation;
-       private TimePeriodElement element_date;
-       private EntitySelectionElement<AgentBase> selection_collector;
-       private TextWithLabelElement text_collectingNumber;
        private EntitySelectionElement<Collection> selection_collection;
        private TextWithLabelElement text_accessionNumber;
-       private GatheringEventUnitElement element_elevation;
 
 
 
@@ -75,29 +55,7 @@ public class DerivedUnitGeneralDetailElement extends
                toggleableText_titleCache = formFactory.createToggleableTextField(
                                formElement, "Title Cache", entity.getTitleCache(),
                                entity.isProtectedTitleCache(), style);
-
-        combo_specorobstype = formFactory.createEnumComboElement(SpecimenOrObservationType.class, formElement, style);
-               combo_specorobstype.setSelection(entity.getType());
-               selection_country = formFactory.createSelectionElement(NamedArea.class, getConversationHolder(),
-                               formElement, "Country",
-                               entity.getCountry(), EntitySelectionElement.NOTHING, style);
-               languageText_locality = formFactory
-                               .createLanguageStringWithLabelElement(formElement, "Locality",
-                                               entity.getLocality(), style);
-               element_point = formFactory.createPointElement(formElement,
-                               entity.getExactLocation(), style);
-               element_elevation = formFactory.createGatheringEventUnitElement(
-                               formElement, "Elevation : ", entity, MinMaxTextSection.UnitType.ELEVATION,  style);
-
-               element_date = formFactory.createTimePeriodElement(formElement, "Date",
-                               entity.getGatheringPeriod(), style);
-               selection_collector = formFactory
-                               .createSelectionElement(AgentBase.class,
-                                               getConversationHolder(), formElement, "Collector",
-                                               entity.getCollector(), EntitySelectionElement.ALL,
-                                               style);
-               text_collectingNumber = formFactory.createTextWithLabelElement(formElement,
-                               "Collecting number", entity.getFieldNumber(), style);
+               toggleableText_titleCache.setEnabled(false);
                selection_collection = formFactory
                                .createSelectionElement(Collection.class,
                                                getConversationHolder(), formElement, "Collection",
@@ -118,36 +76,18 @@ public class DerivedUnitGeneralDetailElement extends
         */
        @Override
        public void handleEvent(Object eventSource) {
-               if (eventSource == toggleableText_titleCache) {
-                       getEntity().setTitleCache(toggleableText_titleCache.getText(),
-                                       toggleableText_titleCache.getState());
-               } else if (eventSource == selection_country) {
-                       getEntity().setCountry(selection_country.getSelection());
-               } else if (eventSource == languageText_locality) {
-                       LanguageString locality = languageText_locality.getLanguageString();
-                       getEntity().setLocality(locality);
-               } else if (eventSource == element_point) {
-                       getEntity().setExactLocation(element_point.getPoint());
-               } else if (eventSource == number_elevation) {
-                       getEntity().setAbsoluteElevation(number_elevation.getInteger());
-               } else if (eventSource == element_date) {
-                       getEntity().setGatheringPeriod(element_date.getTimePeriod());
-               } else if (eventSource == selection_collector) {
-                       getEntity().setCollector(selection_collector.getSelection());
-               } else if (eventSource == text_collectingNumber) {
-                       getEntity().setFieldNumber(text_collectingNumber.getText());
-               }
-                 else if (eventSource == selection_collection) {
-                       getEntity().setCollection(selection_collection.getSelection());
-               } else if (eventSource == text_accessionNumber) {
-                       getEntity().setAccessionNumber(text_accessionNumber.getText());
-               } else if (eventSource == combo_specorobstype) {
-                       getEntity().setType(combo_specorobstype.getSelection());
-               }
-
-               if (eventSource != toggleableText_titleCache) {
-                       toggleableText_titleCache.setText(getEntity().getTitleCache());
-               }
+           if (eventSource == toggleableText_titleCache) {
+               getEntity().setTitleCache(toggleableText_titleCache.getText(),
+                       toggleableText_titleCache.getState());
+           }
+           else if (eventSource == selection_collection) {
+               getEntity().setCollection(selection_collection.getSelection());
+           } else if (eventSource == text_accessionNumber) {
+               getEntity().setAccessionNumber(text_accessionNumber.getText());
+           }
+           if (eventSource != toggleableText_titleCache) {
+               toggleableText_titleCache.setText(getEntity().getTitleCache());
+           }
        }
 
 }
index e68552eb8649dca1603261beef1fe56d181f1b42..e127f9dd8b9aad7111a113a9a9627383ad8bf05f 100644 (file)
@@ -9,16 +9,21 @@
  */
 package eu.etaxonomy.taxeditor.ui.section.occurrence;
 
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+
 import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
 import eu.etaxonomy.cdm.model.agent.AgentBase;
 import eu.etaxonomy.cdm.model.common.LanguageString;
 import eu.etaxonomy.cdm.model.location.NamedArea;
 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
+import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.GatheringEventUnitElement;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
 import eu.etaxonomy.taxeditor.ui.element.LanguageStringWithLabelElement;
+import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
 import eu.etaxonomy.taxeditor.ui.element.MinMaxTextSection;
 import eu.etaxonomy.taxeditor.ui.element.NumberWithLabelElement;
 import eu.etaxonomy.taxeditor.ui.element.PointElement;
@@ -38,6 +43,7 @@ public class FieldUnitGeneralDetailElement extends AbstractCdmDetailElement<Deri
     private ToggleableTextElement toggleableText_titleCache;
     private EnumComboElement<SpecimenOrObservationType> combo_specorobstype;
     private EntitySelectionElement<NamedArea> selection_country;
+    private CollectingAreasDetailSection section_collectingAreas;
     private LanguageStringWithLabelElement languageText_locality;
     private PointElement element_point;
     private NumberWithLabelElement number_elevation;
@@ -70,6 +76,12 @@ public class FieldUnitGeneralDetailElement extends AbstractCdmDetailElement<Deri
         combo_specorobstype.setSelection(entity.getType());
         selection_country = formFactory.createSelectionElement(NamedArea.class, getConversationHolder(), formElement,
                 "Country", entity.getCountry(), EntitySelectionElement.NOTHING, style);
+        if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION)){
+            section_collectingAreas = formFactory.createCollectingAreasDetailSection(getConversationHolder(), formElement, ExpandableComposite.TWISTIE);
+            section_collectingAreas.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+            section_collectingAreas.setEntity(entity);
+        }
+
         languageText_locality = formFactory.createLanguageStringWithLabelElement(formElement, "Locality",
                 entity.getLocality(), style);
         element_point = formFactory.createPointElement(formElement, entity.getExactLocation(), style);
index 73af807ee5d6cb342285672fd45d1379466f9443..cf19f5b32ac77071481322125b8e5b8ca1f0de1b 100644 (file)
@@ -13,6 +13,8 @@ package eu.etaxonomy.taxeditor.ui.section.occurrence;
 import org.eclipse.ui.forms.widgets.ExpandableComposite;
 
 import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.GatheringEventUnitElement;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
@@ -36,9 +38,9 @@ public class GatheringEventDetailElement extends
        private GatheringEventUnitElement element_elevation;
 
        private GatheringEventUnitElement element_distToGround;
-       
+
        private GatheringEventUnitElement element_distToWater;
-       
+
        private TextWithLabelElement text_collectingMethod;
 
        private TextWithLabelElement text_gatheringEventDescription;
@@ -65,30 +67,24 @@ public class GatheringEventDetailElement extends
        /** {@inheritDoc} */
        @Override
        protected void createControls(ICdmFormElement formElement, DerivedUnitFacade entity, int style) {
-               
-
-               // collectingArea
-
-
-        text_collectingMethod = formFactory.createTextWithLabelElement(formElement, "Collecting Method", entity.getCollectingMethod(), style);
 
+           text_collectingMethod = formFactory.createTextWithLabelElement(formElement, "Collecting Method", entity.getCollectingMethod(), style);
 
-               // exactLocation
         text_gatheringEventDescription = formFactory.createTextWithLabelElement(
                        formElement, "Gathering Event Description", entity.getGatheringEventDescription(), style);
-//             element_elevation = formFactory.createGatheringEventUnitElement(
-//                             formElement, "Elevation : ", entity, MinMaxTextSection.UnitType.ELEVATION,  style);
-               
-               
+
                element_distToGround = formFactory.createGatheringEventUnitElement(
                                formElement, "Dist. To Ground : ", entity, MinMaxTextSection.UnitType.DIST_TO_GROUND,  style);
-               
+
                element_distToWater = formFactory.createGatheringEventUnitElement(
                                formElement, "Dist. To Watersurface : ", entity, MinMaxTextSection.UnitType.DIST_TO_WATER,  style);
-               
-        section_collectingAreas = formFactory.createCollectingAreasDetailSection(getConversationHolder(), formElement, ExpandableComposite.TWISTIE);
-        section_collectingAreas.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
-               section_collectingAreas.setEntity(entity);
+
+
+        if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_COLLECTING_AREAS_IN_GENERAL_SECTION)){
+            section_collectingAreas = formFactory.createCollectingAreasDetailSection(getConversationHolder(), formElement, ExpandableComposite.TWISTIE);
+            section_collectingAreas.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+            section_collectingAreas.setEntity(entity);
+        }
 
        }
 
index 1844b0025fa89a8b0a55d6788074123e5edb5d35..3aaf5d51a3554ad69a831eac7abd2678c6121da0 100644 (file)
@@ -19,9 +19,11 @@ import eu.etaxonomy.cdm.model.molecular.Primer;
 import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
 import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
 import eu.etaxonomy.taxeditor.ui.element.TimePeriodElement;
 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.supplemental.AnnotationSection;
 import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
 
 /**
@@ -39,17 +41,6 @@ public class AmplificationGeneralDetailElement extends AbstractCdmDetailElement<
     private EntitySelectionElement<AgentBase> selectionAmplificationStaff;
     private EntitySelectionElement<Primer> selectionPrimerFW;
     private EntitySelectionElement<Primer> selectionPrimerRW;
-//    private CheckboxElement checkBoxAmplificationSuccess;
-//    private TextWithLabelElement textAmplificationSuccessDetails;
-//    private TermComboElement<DefinedTerm> comboAmplificationMaterialOrMethod;
-
-//    private NumberWithLabelElement numberGelVoltage;
-//    private NumberWithLabelElement numberGelConcentration;
-//    private NumberWithLabelElement numberGelRunningTime;
-//    private TextWithLabelElement textLadderUsed;
-
-//    private TermComboElement<DefinedTerm> comboPurificationMaterialOrMethod;
-
 
     /**
      * @param formFactory
@@ -71,21 +62,17 @@ public class AmplificationGeneralDetailElement extends AbstractCdmDetailElement<
         textDesignation = formFactory.createTextWithLabelElement(formElement, "Designation", entity.getDescription(), style);
         textDesignation.setEnabled(false);
         //TODO institution
+//        selectionInstitution = formFactory.createSelectionElement(Institution.class, getConversationHolder(), formElement, "Institution", entity.getInstitution(), EntitySelectionElement.ALL, style);
         selectionAmplificationStaff = formFactory.createSelectionElement(AgentBase.class, getConversationHolder(), formElement, "Amplification staff", entity.getActor(), EntitySelectionElement.ALL, style);
         dateAmplification = formFactory.createTimePeriodElement(formElement, "Date", entity.getTimeperiod(), style);
         comboMarker = formFactory.createDefinedTermComboElement(TermType.DnaMarker, formElement, "DNA Marker", entity.getDnaMarker(), style);
         selectionPrimerFW = formFactory.createSelectionElement(Primer.class, getConversationHolder(), formElement, "Primer FW", entity.getForwardPrimer(), EntitySelectionElement.ALL, style);
         selectionPrimerRW = formFactory.createSelectionElement(Primer.class, getConversationHolder(), formElement, "Primer RW", entity.getReversePrimer(), EntitySelectionElement.ALL, style);
-//        checkBoxAmplificationSuccess = formFactory.createCheckbox(formElement, "Amplification Success", entity.getSuccessful(), style);
-//        textAmplificationSuccessDetails = formFactory.createTextWithLabelElement(formElement, "Ampl. Success Details", entity.getSuccessText(), style);
-//        comboAmplificationMaterialOrMethod = formFactory.createTermComboElement(DefinedTerm.class, formElement, "Ampl. Mat. & Meth.", entity.get, style)
-//        numberGelVoltage = formFactory.createNumberTextWithLabelElement(formElement, "Gel Voltage (V)", entity.getElectrophoresisVoltage(), style);
-//        numberGelConcentration = formFactory.createNumberTextWithLabelElement(formElement, "Gel Concentration", entity.getGelConcentration(), style);
-//        numberGelRunningTime = formFactory.createNumberTextWithLabelElement(formElement, "Gel Ruinning Time (Min)", entity.getGelRunningTime(), style);
-//        textLadderUsed = formFactory.createTextWithLabelElement(formElement, "Ladder Used", entity.getLadderUsed(), style);
-//        comboPurificationMaterialOrMethod = formFactory.createDefinedTermComboElement(TermType.MaterialOrMethod, formElement, "Purification Mat. & Meth.",
-//                entity.getPurification()==null?null:entity.getPurification().getDefinedMaterialOrMethod(), style);
-        //TODO notes
+
+        AnnotationSection annotationSection = formFactory.createAnnotationSection(getConversationHolder(), formElement, style);
+        annotationSection.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+        annotationSection.setEntity(entity);
+
         updateDesignationText();
     }
 
@@ -150,7 +137,8 @@ public class AmplificationGeneralDetailElement extends AbstractCdmDetailElement<
             updateDesignationText();
         }
         else if(eventSource==selectionInstitution){
-            //TODO implement
+            //TODO institution
+//            getEntity().setInstitution(selectionInstitution.getSelection());
             updateDesignationText();
         }
         else if(eventSource==selectionPrimerFW){
@@ -159,34 +147,5 @@ public class AmplificationGeneralDetailElement extends AbstractCdmDetailElement<
         else if(eventSource==selectionPrimerRW){
             getEntity().setReversePrimer(selectionPrimerRW.getSelection());
         }
-//        else if(eventSource==checkBoxAmplificationSuccess){
-//            getEntity().setSuccessful(checkBoxAmplificationSuccess.getSelection());
-//        }
-//        else if(eventSource==textAmplificationSuccessDetails){
-//            getEntity().setSuccessText(textAmplificationSuccessDetails.getText());
-//        }
-//        else if(eventSource==comboAmplificationMaterialOrMethod){
-//
-//        }
-//        else if(eventSource==numberGelVoltage){
-//            getEntity().setElectrophoresisVoltage(numberGelVoltage.getDouble());
-//        }
-//        else if(eventSource==numberGelConcentration){
-//            getEntity().setGelConcentration(numberGelConcentration.getDouble());
-//        }
-//        else if(eventSource==numberGelRunningTime){
-//            getEntity().setGelRunningTime(numberGelRunningTime.getDouble());
-//        }
-//        else if(eventSource==textLadderUsed){
-//            getEntity().setLadderUsed(textLadderUsed.getText());
-//        }
-//        else if(eventSource==comboPurificationMaterialOrMethod){
-//            MaterialOrMethodEvent purification = getEntity().getPurification();
-//            if(purification==null){
-//                purification = MaterialOrMethodEvent.NewInstance();
-//                getEntity().setPurification(purification);
-//            }
-//            purification.setDefinedMaterialOrMethod(comboPurificationMaterialOrMethod.getSelection());
-//        }
     }
 }
\ No newline at end of file
index 3384b2571cc00ef67a3ea55fca4ae88fbe0b5fbe..b790953560aab56433c37980439a89bbb8f52e2e 100644 (file)
@@ -11,7 +11,8 @@ package eu.etaxonomy.taxeditor.ui.section.occurrence.dna;
 
 import org.joda.time.DateTime;
 
-import eu.etaxonomy.cdm.model.common.DefinedTerm;
+import eu.etaxonomy.cdm.model.common.OrderedTerm;
+import eu.etaxonomy.cdm.model.common.TermType;
 import eu.etaxonomy.cdm.model.molecular.DnaQuality;
 import eu.etaxonomy.cdm.model.molecular.DnaSample;
 import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
@@ -29,14 +30,11 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
  */
 public class DnaQualityDetailElement extends AbstractCdmDetailElement<DnaSample> {
 
-    //TODO: add vocabulary
-//    private final TermType qualityTermVocabulary = CdmStore.getService(IVocabularyService.class).find(VocabularyEnum.DnaQualityTerm.getUuid());
-
     private TextWithLabelElement textPurificationMethod;
     private NumberWithLabelElement numberRatioOfAbsorbance260_280;
     private NumberWithLabelElement numberRatioOfAbsorbance260_230;
     private NumberWithLabelElement numberConcentration;
-    private TermComboElement<DefinedTerm> comboQualityTerm;
+    private TermComboElement<OrderedTerm> comboQualityTerm;
     private DateElement dateQualityCheck;
 
     /**
@@ -64,14 +62,13 @@ public class DnaQualityDetailElement extends AbstractCdmDetailElement<DnaSample>
         Double ratioOfAbsorbance260_230 = dnaQuality.getRatioOfAbsorbance260_230();
         Double ratioOfAbsorbance260_280 = dnaQuality.getRatioOfAbsorbance260_280();
         Double concentration = dnaQuality.getConcentration();
-        //TODO quality term
-        DefinedTerm qualityTerm = dnaQuality.getQualityTerm();
+        OrderedTerm qualityTerm = dnaQuality.getQualityTerm();
 
         textPurificationMethod = formFactory.createTextWithLabelElement(formElement, "DNA Purification Details", dnaQuality.getPurificationMethod(), style);
         numberRatioOfAbsorbance260_280 = formFactory.createNumberTextWithLabelElement(formElement, "Ratio of absorbance 260-280", ratioOfAbsorbance260_280, style);
         numberRatioOfAbsorbance260_230 = formFactory.createNumberTextWithLabelElement(formElement, "Ratio of absorbance 260-230", ratioOfAbsorbance260_230, style);
         numberConcentration = formFactory.createNumberTextWithLabelElement(formElement, "Concentration", concentration, style);
-//        comboQualityTerm = formFactory.createDefinedTermComboElement(qualityTermVocabulary, formElement, "Quality Term", qualityTerm, style);
+        comboQualityTerm = formFactory.createDefinedTermComboElement(TermType.DnaQualityType, formElement, "Quality Term", qualityTerm, style);
         dateQualityCheck = formFactory.createDateElement(formElement, "Quality Check", dnaQuality.getQualityCheckDate(), style);
     }
 
index 4461471b5c0074fec33bd38b66e406a670fbb6a5..dd1faa70e9e7c599c5ec2a82f04d548752947bb8 100644 (file)
 package eu.etaxonomy.taxeditor.ui.section.occurrence.dna;
 
 import eu.etaxonomy.cdm.model.agent.AgentBase;
+import eu.etaxonomy.cdm.model.agent.Institution;
 import eu.etaxonomy.cdm.model.common.DefinedTerm;
 import eu.etaxonomy.cdm.model.common.TermType;
+import eu.etaxonomy.cdm.model.common.TimePeriod;
 import eu.etaxonomy.cdm.model.molecular.DnaSample;
 import eu.etaxonomy.cdm.model.occurrence.PreservationMethod;
 import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
@@ -30,8 +32,9 @@ import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
  */
 public class DnaSampleGeneralDetailElement extends AbstractCdmDetailElement<DnaSample> {
 
+    private EntitySelectionElement<Institution> selectionInstitution;
+    private EntitySelectionElement<AgentBase> selectionStaff;
     private TimePeriodElement datePreservationDate;
-    private EntitySelectionElement<AgentBase> selectionPreparedBy;
     private NumberWithLabelElement numberPreservationTemperature;
     private TermComboElement<DefinedTerm> comboMaterialOrMethods;
     private TextWithLabelElement textBarcode;
@@ -53,18 +56,27 @@ public class DnaSampleGeneralDetailElement extends AbstractCdmDetailElement<DnaS
      */
     @Override
     protected void createControls(ICdmFormElement formElement, DnaSample entity, int style) {
+        Institution institution = null;
+        AgentBase<?> staff = null;
+        TimePeriod preparationDate = null;
+        if(entity.getDerivedFrom()!=null){
+//            institution = entity.getDerivedFrom().getInstitution();
+            staff = entity.getDerivedFrom().getActor();
+            preparationDate = entity.getDerivedFrom().getTimeperiod();
+        }
+
         Double temperature = null;
         DefinedTerm definedMaterialOrMethod = null;
         if(entity.getPreservation()!=null){
             temperature = entity.getPreservation().getTemperature();
             definedMaterialOrMethod = entity.getPreservation().getDefinedMaterialOrMethod();
         }
-//        datePreservationDate = formFactory.createTimePeriodElement(formElement, "Preparation date", timePeriod, style);
-//        selectionPreparedBy = formFactory.createSelectionElement(AgentBase.class, getConversationHolder(), formElement, "Prepared by", actor, EntitySelectionElement.ALL, style);
+        //TODO institution
+//        selectionInstitution = formFactory.createSelectionElement(Institution.class, getConversationHolder(), formElement, "Institution", staff, EntitySelectionElement.ALL, style);
+        selectionStaff = formFactory.createSelectionElement(AgentBase.class, getConversationHolder(), formElement, "Staff", staff, EntitySelectionElement.ALL, style);
+        datePreservationDate = formFactory.createTimePeriodElement(formElement, "Preparation date", preparationDate, style);
         numberPreservationTemperature = formFactory.createNumberTextWithLabelElement(formElement, "Preservation Temp. [C°]", temperature, style);
         comboMaterialOrMethods = formFactory.createDefinedTermComboElement(TermType.MaterialOrMethod, formElement, "Materials & Methods", definedMaterialOrMethod, style);
-        //TODO preparation date
-        //TODO sample type
         textBarcode = formFactory.createTextWithLabelElement(formElement, "Barcode", entity.getBarcode(), style);
 
     }
@@ -81,8 +93,8 @@ public class DnaSampleGeneralDetailElement extends AbstractCdmDetailElement<DnaS
         if(eventSource==datePreservationDate){
             addPreservationMethod().setTimeperiod(datePreservationDate.getTimePeriod());
         }
-        else if(eventSource==selectionPreparedBy){
-            addPreservationMethod().setActor(selectionPreparedBy.getSelection());
+        else if(eventSource==selectionStaff){
+            addPreservationMethod().setActor(selectionStaff.getSelection());
         }
         else if(eventSource==numberPreservationTemperature){
             addPreservationMethod().setTemperature(numberPreservationTemperature.getDouble());
index b415ef04b0a65718f88ad38e78545eca3dd3c068..da429331e916ea70ce080e7f115b1afefd4d1f19 100644 (file)
@@ -16,8 +16,10 @@ import eu.etaxonomy.cdm.model.reference.Reference;
 import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
 import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.supplemental.AnnotationSection;
 import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
 
 /**
@@ -29,15 +31,11 @@ public class PrimerGeneralDetailElement extends AbstractCdmDetailElement<Primer>
 
 
     private TextWithLabelElement textPrimerName;
-    //TODO we are using a basic text field which is backed up by a Sequence object modelwise.
+    // we are using a basic text field which is backed up by a Sequence object modelwise.
     // This is a bit of a overhead as we may just need the sequence string. This may change in future in both directions:
     // either extending this view to support the remaining fields of Sequence or by switching to the more basic SequenceString model element
     private TextWithLabelElement textPrimerSequence;
     private TermComboElement<DefinedTerm> comboMarker;
-    /**
-     * free text notes field is backed up by an annotation
-     */
-    private TextWithLabelElement textNotes;
     private EntitySelectionElement<Reference> selectionReference;
 
     /**
@@ -63,14 +61,19 @@ public class PrimerGeneralDetailElement extends AbstractCdmDetailElement<Primer>
             sequenceString = entity.getSequence().getString();
         }
         textPrimerSequence = formFactory.createTextWithLabelElement(formElement, "Primer seq. 5'->3'", sequenceString, style);
-        //TODO: marker
-        //TODO: notes
+
+        //TODO dnaMarker
+//        comboMarker = formFactory.createDefinedTermComboElement(TermType.DnaMarker, formElement, "DNA Marker", entity.getDnaMarker(), style);
 
         selectionReference = formFactory
                 .createSelectionElement(Reference.class,
                         getConversationHolder(), formElement, "Reference",
                         entity.getPublishedIn(),
                         EntitySelectionElement.ALL, style);
+
+        AnnotationSection annotationSection = formFactory.createAnnotationSection(getConversationHolder(), formElement, style);
+        annotationSection.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+        annotationSection.setEntity(entity);
     }
 
     /*
@@ -85,6 +88,10 @@ public class PrimerGeneralDetailElement extends AbstractCdmDetailElement<Primer>
         if(eventSource==textPrimerName){
             getEntity().setLabel(textPrimerName.getText());
         }
+        else if(eventSource==comboMarker){
+            //TODO dnaMarker
+//            getEntity().setDnaMarker(comboMarker.getSelection());
+        }
         else if(eventSource==textPrimerSequence){
             SequenceString sequenceString = getEntity().getSequence();
             if(sequenceString==null){
index 00ff3de6b4b45b3b30edf53881076dc9e3c80ae4..ea72fbadf2ca383eabbc212bbda48a0dfde23667 100644 (file)
@@ -64,19 +64,19 @@ public class TissueSampleGeneralDetailElement extends AbstractCdmDetailElement<D
     protected void createControls(ICdmFormElement formElement, DnaSample entity, int style) {
         //TODO handle all parameters here and in handleEvent()
         comboKindOfTissue = formFactory.createDefinedTermComboElement(TermType.KindOfUnit, formElement, "Kind Of Tissue", entity.getKindOfUnit(), style);
-        //TODO staff
-//        selectionStaff = formFactory.createSelectionElement(AgentBase.class, getConversationHolder(), formElement, "Staff", null, EntitySelectionElement.ALL, style);
         //TODO: institute
-        TimePeriod preservationDate = null;
+        TimePeriod preparationDate = null;
         DefinedTerm preservationMedium = null;
-//        TimePeriod preparationDate = null;
+        AgentBase<?> staff = null;
+        if(entity.getDerivedFrom()!=null){
+            staff = entity.getDerivedFrom().getActor();
+            preparationDate = entity.getDerivedFrom().getTimeperiod();
+        }
         if(entity.getPreservation()!=null){
-            preservationDate = entity.getPreservation().getTimeperiod();
             preservationMedium = entity.getPreservation().getMedium();
-
         }
-        //TODO preparation date
-//        datePreparation = formFactory.createTimePeriodElement(formElement, "Preparation date", preparationDate, style);
+        selectionStaff = formFactory.createSelectionElement(AgentBase.class, getConversationHolder(), formElement, "Staff", staff, EntitySelectionElement.ALL,style);
+        datePreparation = formFactory.createTimePeriodElement(formElement, "Preparation date", preparationDate, style);
         comboPreservationMedium = formFactory.createDefinedTermComboElement(TermType.MaterialOrMethod, formElement, "Preservation medium", preservationMedium, style);
         selectionCollection = formFactory.createSelectionElement(Collection.class, getConversationHolder(), formElement, "Collection", entity.getCollection(), EntitySelectionElement.ALL, style);
         textAccessionNumber = formFactory.createTextWithLabelElement(formElement, "Accession Number", entity.getAccessionNumber(), style);
@@ -93,7 +93,7 @@ public class TissueSampleGeneralDetailElement extends AbstractCdmDetailElement<D
      */
     @Override
     public void handleEvent(Object eventSource) {
-        //TODO: institute, preparation date, prepared by, staff
+        //TODO: institute
         if(eventSource==comboKindOfTissue) {
             getEntity().setKindOfUnit(comboKindOfTissue.getSelection());
         }
@@ -109,6 +109,16 @@ public class TissueSampleGeneralDetailElement extends AbstractCdmDetailElement<D
         else if(eventSource==textBarcode){
             getEntity().setBarcode(textBarcode.getText());
         }
+        else if(eventSource==datePreparation){
+            if(getEntity().getDerivedFrom()!=null){
+                getEntity().getDerivedFrom().setTimeperiod(datePreparation.getTimePeriod());
+            }
+        }
+        else if(eventSource==selectionStaff){
+            if(getEntity().getDerivedFrom()!=null){
+                getEntity().getDerivedFrom().setActor(selectionStaff.getSelection());
+            }
+        }
     }
 
     private PreservationMethod addPreservationMethod(){
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/LivingPlantPhotoGeneralDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/LivingPlantPhotoGeneralDetailElement.java
deleted file mode 100644 (file)
index 523f297..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-// $Id$
-/**
-* Copyright (C) 2013 EDIT
-* 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.
-*/
-package eu.etaxonomy.taxeditor.ui.section.occurrence.media;
-
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
-import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
-import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
-
-/**
- * @author pplitzner
- * @date 16.12.2013
- *
- */
-public class LivingPlantPhotoGeneralDetailElement extends AbstractCdmDetailElement<DerivedUnitFacade> {
-
-    /**
-     * @param formFactory
-     * @param formElement
-     */
-    public LivingPlantPhotoGeneralDetailElement(CdmFormFactory formFactory, ICdmFormElement formElement) {
-        super(formFactory, formElement);
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls
-     * (eu.etaxonomy.taxeditor.forms.ICdmFormElement, java.lang.Object, int)
-     */
-    @Override
-    protected void createControls(ICdmFormElement formElement, DerivedUnitFacade entity, int style) {
-
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
-     * .lang.Object)
-     */
-    @Override
-    public void handleEvent(Object eventSource) {
-    }
-
-}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/LivingPlantPhotoGeneralDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/LivingPlantPhotoGeneralDetailSection.java
deleted file mode 100644 (file)
index b1b8974..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-// $Id$
-/**
-* Copyright (C) 2013 EDIT
-* 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.
-*/
-package eu.etaxonomy.taxeditor.ui.section.occurrence.media;
-
-import org.eclipse.jface.viewers.ISelectionProvider;
-
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
-import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
-import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
-import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
-
-/**
- * @author pplitzner
- * @date 12.12.2013
- *
- */
-public class LivingPlantPhotoGeneralDetailSection extends AbstractCdmDetailSection<DerivedUnitFacade> {
-
-    /**
-     * @param formFactory
-     * @param conversation
-     * @param parentElement
-     * @param selectionProvider
-     * @param style
-     */
-    public LivingPlantPhotoGeneralDetailSection(CdmFormFactory formFactory,
-            ConversationHolder conversation, ICdmFormElement parentElement,
-            ISelectionProvider selectionProvider, int style) {
-        super(formFactory, conversation, parentElement, selectionProvider, style);
-    }
-
-
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#getHeading()
-     */
-    @Override
-    public String getHeading() {
-        return "General";
-    }
-
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
-     */
-    @Override
-    protected AbstractCdmDetailElement<DerivedUnitFacade> createCdmDetailElement(AbstractCdmDetailSection<DerivedUnitFacade> parentElement, int style) {
-        return formFactory.createLivingPlantPhotoGeneralDetailElement(parentElement);
-    }
-}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/SpecimenScanGeneralDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/SpecimenScanGeneralDetailElement.java
deleted file mode 100644 (file)
index fada3bb..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-// $Id$
-/**
-* Copyright (C) 2013 EDIT
-* 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.
-*/
-package eu.etaxonomy.taxeditor.ui.section.occurrence.media;
-
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
-import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
-import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
-
-/**
- * @author pplitzner
- * @date 16.12.2013
- *
- */
-public class SpecimenScanGeneralDetailElement extends AbstractCdmDetailElement<DerivedUnitFacade> {
-
-    /**
-     * @param formFactory
-     * @param formElement
-     */
-    public SpecimenScanGeneralDetailElement(CdmFormFactory formFactory, ICdmFormElement formElement) {
-        super(formFactory, formElement);
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls
-     * (eu.etaxonomy.taxeditor.forms.ICdmFormElement, java.lang.Object, int)
-     */
-    @Override
-    protected void createControls(ICdmFormElement formElement, DerivedUnitFacade entity, int style) {
-
-    }
-
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
-     * .lang.Object)
-     */
-    @Override
-    public void handleEvent(Object eventSource) {
-    }
-
-}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/SpecimenScanGeneralDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/media/SpecimenScanGeneralDetailSection.java
deleted file mode 100644 (file)
index 497d96a..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-// $Id$
-/**
-* Copyright (C) 2013 EDIT
-* 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.
-*/
-package eu.etaxonomy.taxeditor.ui.section.occurrence.media;
-
-import org.eclipse.jface.viewers.ISelectionProvider;
-
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
-import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
-import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
-import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
-
-/**
- * @author pplitzner
- * @date 12.12.2013
- *
- */
-public class SpecimenScanGeneralDetailSection  extends AbstractCdmDetailSection<DerivedUnitFacade> {
-
-    /**
-     * @param formFactory
-     * @param conversation
-     * @param parentElement
-     * @param selectionProvider
-     * @param style
-     */
-    public SpecimenScanGeneralDetailSection(CdmFormFactory formFactory,
-            ConversationHolder conversation, ICdmFormElement parentElement,
-            ISelectionProvider selectionProvider, int style) {
-        super(formFactory, conversation, parentElement, selectionProvider, style);
-    }
-
-
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#getHeading()
-     */
-    @Override
-    public String getHeading() {
-        return "General";
-    }
-
-    /* (non-Javadoc)
-     * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
-     */
-    @Override
-    protected AbstractCdmDetailElement<DerivedUnitFacade> createCdmDetailElement(AbstractCdmDetailSection<DerivedUnitFacade> parentElement, int style) {
-        return formFactory.createSpecimenScanGeneralDetailElement(parentElement);
-    }
-}
index 2d06fd31650d5461ff1bfef90095c9eef95f6da9..b304ca85199a1a73b9793b8f3878309c5663d992 100644 (file)
@@ -58,6 +58,7 @@ public class DerivateLabelProvider extends ColumnLabelProvider {
     private static DefinedTerm detailImageTerm = null;
     private static DefinedTerm sampleDesignationTerm = null;
 
+    //FIXME: move static term getters to new singleton utility class
     private static void initializeTerms() {
         List<DefinedTerm> preferredTerms = CdmStore.getTermManager().getPreferredTerms(DefinedTerm.class);
         for (DefinedTerm definedTerm : preferredTerms) {
@@ -134,12 +135,11 @@ public class DerivateLabelProvider extends ColumnLabelProvider {
         this.conversation = conversation;
     }
 
-    /**
-     *
-     * @param derivate
-     * @return
-     */
     public String getDerivateText(Object element){
+        return getDerivateText(element, conversation);
+    }
+
+    public static String getDerivateText(Object element, ConversationHolder conversation){
         //TODO: use list of strings to assemble labels to avoid adding the separator every time and to allow null values
         TreeNode parentNode = null;
         TreeNode node = null;
index 60bc2a1c4472182457dcba856b82f9086a149134..8ef16a6422f2345a218b9e70f4f8a4c9698707dc 100644 (file)
@@ -70,7 +70,7 @@ public class DerivateSearchComposite extends Composite {
         new Label(this, SWT.NONE);
         new Label(this, SWT.NONE);
 
-        resultViewer = new TableViewer(this, SWT.BORDER | SWT.FULL_SELECTION);
+        resultViewer = new TableViewer(this, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI);
         table = resultViewer.getTable();
         table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 6, 4));
 
index 6da90e1e38064d4a2a8e00ae462ef5d7e7c357f0..9f950fa3fbffe21c7aedfb871b02b86ab3cd00b1 100644 (file)
 package eu.etaxonomy.taxeditor.view.derivateSearch;
 
 import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.action.MenuManager;
 import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Menu;
 import org.eclipse.ui.IMemento;
 import org.eclipse.ui.part.ViewPart;
 
@@ -44,6 +47,13 @@ public class DerivateSearchView extends ViewPart implements IContextListener {
         derivateSearchCompositeController = new DerivateSearchCompositeController(parent, this);
         getSite().setSelectionProvider(derivateSearchCompositeController.getResultViewer());
         derivateSearchCompositeController.setEnabled(CdmStore.isActive());
+
+        //create context menu
+        MenuManager menuManager = new MenuManager();
+        getSite().registerContextMenu(menuManager, derivateSearchCompositeController.getResultViewer());
+        Control control = derivateSearchCompositeController.getResultViewer().getControl();
+        Menu menu = menuManager.createContextMenu(control);
+        control.setMenu(menu);
     }
 
     /* (non-Javadoc)
index bf7088c7109b9d01546993cc2eb6ecba7fc98098..a03175185795dc9df7af384fb35f90209afaa8ac 100644 (file)
@@ -92,9 +92,6 @@ import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitGeneralDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.OriginalLabelDataSection;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenDetailSection;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenDeterminationDetailSection;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.derivedUnit.PreservedSpecimenGeneralDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationCloningDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationGelPhotoCollectionDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.AmplificationGeneralDetailSection;
@@ -108,11 +105,10 @@ import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceReferenceCollect
 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadGeneralDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadPherogramCollectionDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.TissueSampleGeneralDetailSection;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.media.LivingPlantPhotoGeneralDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.media.MediaSpecimenGeneralDetailSection;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.media.SpecimenScanGeneralDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.supplemental.RightsSection;
 import eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessagesSection;
 import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonBaseDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonRelationshipDetailSection;
@@ -296,15 +292,6 @@ public class DetailsViewer extends AbstractCdmDataViewer {
                 //in future using only one class with different SpecimenOrObservationTypes is desired
 //                createTissueSampleSection(rootElement);
             }
-            else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.StillImage){
-                createSpecimenScanSection(rootElement);
-            }
-            else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.StillImage){
-                createLivingPlantPhotoSection(rootElement);
-            }
-            else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.StillImage){
-                createMediaSpecimenSection(rootElement);
-            }
             else{
                 createDerivedUnitBaseElementSection(rootElement);
             }
@@ -675,7 +662,7 @@ public class DetailsViewer extends AbstractCdmDataViewer {
 
             formFactory.createHorizontalSeparator(parent, SWT.BORDER);
 
-            OriginalLabelDataSection originalLabelDataSection = formFactory.createOriginalLabelDataSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
+            OriginalLabelDataSection originalLabelDataSection = formFactory.createOriginalLabelDataSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
             addPart(originalLabelDataSection);
 
             formFactory.createHorizontalSeparator(parent, SWT.BORDER);
@@ -683,15 +670,6 @@ public class DetailsViewer extends AbstractCdmDataViewer {
             DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = formFactory.createDerivedUnitBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
             addPart(derivedUnitBaseDetailSection);
 
-            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
-            GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
-            addPart(gatheringEventDetailSection);
-
-            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
-            FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
-            addPart(fieldUnitDetailSection);
         }
         else{
             DerivedUnitGeneralDetailSection derivedUnitGeneralDetailSection = formFactory.createDerivedUnitGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
@@ -744,24 +722,6 @@ public class DetailsViewer extends AbstractCdmDataViewer {
         }
     }
 
-    private void createPreservedSpecimenSpecimenSection(RootElement parent) {
-        destroySections();
-
-        PreservedSpecimenGeneralDetailSection section = formFactory.createPreservedSpecimenGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
-
-        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
-        PreservedSpecimenDetailSection derivedUnitBaseDetailSection = formFactory.createPreservedSpecimenDetailsSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
-
-        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
-        PreservedSpecimenDeterminationDetailSection determinationDetailSection = formFactory.createPreservedSpecimenDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
-
-        addPart(section);
-        addPart(derivedUnitBaseDetailSection);
-        addPart(determinationDetailSection);
-    }
-
     private void createTissueSampleSection(RootElement parent) {
         destroySections();
 
@@ -848,25 +808,17 @@ public class DetailsViewer extends AbstractCdmDataViewer {
         addPart(pherogramSection);
     }
 
-    private void createSpecimenScanSection(RootElement parent) {
+    private void createMediaSpecimenSection(RootElement parent) {
         destroySections();
-        SpecimenScanGeneralDetailSection section = formFactory.createSpecimenScanGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
-
-        addPart(section);
-    }
 
-    private void createLivingPlantPhotoSection(RootElement parent) {
-        destroySections();
-        LivingPlantPhotoGeneralDetailSection section = formFactory.createLivingPlantPhotoGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        MediaSpecimenGeneralDetailSection generalSection = formFactory.createMediaSpecimenGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        addPart(generalSection);
 
-        addPart(section);
-    }
+        formFactory.createHorizontalSeparator(parent, SWT.BORDER);
 
-    private void createMediaSpecimenSection(RootElement parent) {
-        destroySections();
-        MediaSpecimenGeneralDetailSection section = formFactory.createMediaSpecimenGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+        RightsSection rightsSection = formFactory.createRightsSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
+        addPart(rightsSection);
 
-        addPart(section);
     }