commit f8cdd23e968ae515f1ba07e0ca0f4689d4fd9282
Author: Patrick Plitzner <p.plitzner@bgbm.org>
Date:   Tue Jan 22 14:36:57 2019 +0100

    Refactoring
    
     - created "search" package for search UI classes

diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateView.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateView.java
index de003d5ec..d50b764b7 100644
--- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateView.java
+++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateView.java
@@ -72,8 +72,8 @@ import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
 import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
 import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
 import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.view.derivateSearch.DerivateContentProvider;
-import eu.etaxonomy.taxeditor.view.derivateSearch.DerivateLabelProvider;
+import eu.etaxonomy.taxeditor.view.search.derivative.DerivateContentProvider;
+import eu.etaxonomy.taxeditor.view.search.derivative.DerivateLabelProvider;
 import eu.etaxonomy.taxeditor.workbench.part.ICollapsableExpandable;
 import eu.etaxonomy.taxeditor.workbench.part.IE4SavablePart;
 
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/searchFilter/DerivateSearchCompositeController.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/searchFilter/DerivateSearchCompositeController.java
index d03d68062..65ecb3bfc 100644
--- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/searchFilter/DerivateSearchCompositeController.java
+++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/searchFilter/DerivateSearchCompositeController.java
@@ -34,7 +34,7 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.taxeditor.store.SearchManager;
 import eu.etaxonomy.taxeditor.ui.dialog.selection.SelectionDialogFactory;
 import eu.etaxonomy.taxeditor.ui.mvc.combo.EnumTermComboController;
-import eu.etaxonomy.taxeditor.view.derivateSearch.DerivateLabelProvider;
+import eu.etaxonomy.taxeditor.view.search.derivative.DerivateLabelProvider;
 
 /**
  * Controller class for the {@link DerivateSearchComposite}.<br>
diff --git a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/AlignmentEditorE4.java b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/AlignmentEditorE4.java
index 80f61f3d6..97b329079 100644
--- a/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/AlignmentEditorE4.java
+++ b/eu.etaxonomy.taxeditor.molecular/src/main/java/eu/etaxonomy/taxeditor/molecular/editor/e4/AlignmentEditorE4.java
@@ -55,7 +55,7 @@ import eu.etaxonomy.taxeditor.molecular.editor.e4.handler.ToggleInsertOverwriteH
 import eu.etaxonomy.taxeditor.molecular.editor.e4.handler.ToggleLeftRightInsertionHandlerE4;
 import eu.etaxonomy.taxeditor.molecular.l10n.Messages;
 import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.view.derivateSearch.DerivateLabelProvider;
+import eu.etaxonomy.taxeditor.view.search.derivative.DerivateLabelProvider;
 import info.bioinfweb.commons.swt.SWTUtils;
 import info.bioinfweb.libralign.alignmentarea.AlignmentArea;
 import info.bioinfweb.libralign.alignmentarea.selection.SelectionModel;
diff --git a/eu.etaxonomy.taxeditor.store/META-INF/MANIFEST.MF b/eu.etaxonomy.taxeditor.store/META-INF/MANIFEST.MF
index 2c64b661c..9cb1a878f 100644
--- a/eu.etaxonomy.taxeditor.store/META-INF/MANIFEST.MF
+++ b/eu.etaxonomy.taxeditor.store/META-INF/MANIFEST.MF
@@ -64,12 +64,12 @@ Export-Package: eu.etaxonomy.cdm,
  eu.etaxonomy.taxeditor.view,
  eu.etaxonomy.taxeditor.view.datasource,
  eu.etaxonomy.taxeditor.view.datasource.handler,
- eu.etaxonomy.taxeditor.view.derivateSearch,
  eu.etaxonomy.taxeditor.view.detail,
  eu.etaxonomy.taxeditor.view.e4,
  eu.etaxonomy.taxeditor.view.e4.details,
  eu.etaxonomy.taxeditor.view.e4.supplementaldata,
- eu.etaxonomy.taxeditor.view.specimenSearch,
+ eu.etaxonomy.taxeditor.view.search.derivative,
+ eu.etaxonomy.taxeditor.view.search.specimen,
  org.eclipse.wb.swt
 Require-Bundle: org.eclipse.osgi,
  org.eclipse.ui,
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/AbstractSampleDesignationDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/AbstractSampleDesignationDetailSection.java
index 36bd524a4..ec9030b62 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/AbstractSampleDesignationDetailSection.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/AbstractSampleDesignationDetailSection.java
@@ -15,7 +15,7 @@ import eu.etaxonomy.cdm.model.common.Identifier;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
 import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
-import eu.etaxonomy.taxeditor.view.derivateSearch.DerivateLabelProvider;
+import eu.etaxonomy.taxeditor.view.search.derivative.DerivateLabelProvider;
 
 /**
  *
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/CurrentSampleDesignationDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/CurrentSampleDesignationDetailSection.java
index 3f4b04e62..ed847e71b 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/CurrentSampleDesignationDetailSection.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/CurrentSampleDesignationDetailSection.java
@@ -19,7 +19,7 @@ import eu.etaxonomy.cdm.model.common.Identifier;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
 import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator;
-import eu.etaxonomy.taxeditor.view.derivateSearch.DerivateLabelProvider;
+import eu.etaxonomy.taxeditor.view.search.derivative.DerivateLabelProvider;
 
 /**
  *
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/SampleDesignationHistoryDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/SampleDesignationHistoryDetailSection.java
index bdc31e1bd..5cbdc1e37 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/SampleDesignationHistoryDetailSection.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/dna/SampleDesignationHistoryDetailSection.java
@@ -19,7 +19,7 @@ import eu.etaxonomy.cdm.model.common.Identifier;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
 import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator;
-import eu.etaxonomy.taxeditor.view.derivateSearch.DerivateLabelProvider;
+import eu.etaxonomy.taxeditor.view.search.derivative.DerivateLabelProvider;
 
 /**
  * @author n.hoffmann
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/SpecimenProviderSelectionWizardPage.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/SpecimenProviderSelectionWizardPage.java
index 731cf0e60..cdb720b8c 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/SpecimenProviderSelectionWizardPage.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/SpecimenProviderSelectionWizardPage.java
@@ -18,7 +18,7 @@ import org.eclipse.swt.widgets.Composite;
 
 import eu.etaxonomy.cdm.ext.common.ServiceWrapperBase;
 import eu.etaxonomy.cdm.ext.occurrence.bioCase.BioCaseQueryServiceWrapper;
-import eu.etaxonomy.taxeditor.view.specimenSearch.SpecimenProviderSelectionController;
+import eu.etaxonomy.taxeditor.view.search.specimen.SpecimenProviderSelectionController;
 
 
 /**
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/SpecimenSearchWizardPage.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/SpecimenSearchWizardPage.java
index 9cdc9b123..6207f1dfa 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/SpecimenSearchWizardPage.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/SpecimenSearchWizardPage.java
@@ -14,7 +14,7 @@ import org.eclipse.jface.wizard.WizardPage;
 import org.eclipse.swt.widgets.Composite;
 
 import eu.etaxonomy.cdm.ext.occurrence.OccurenceQuery;
-import eu.etaxonomy.taxeditor.view.specimenSearch.SpecimenSearchController;
+import eu.etaxonomy.taxeditor.view.search.specimen.SpecimenSearchController;
 
 
 /**
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/e4/SpecimenProviderSelectionWizardPageE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/e4/SpecimenProviderSelectionWizardPageE4.java
index 22d57246f..531834883 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/e4/SpecimenProviderSelectionWizardPageE4.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/e4/SpecimenProviderSelectionWizardPageE4.java
@@ -21,7 +21,7 @@ import org.eclipse.swt.widgets.Composite;
 import eu.etaxonomy.cdm.ext.common.ServiceWrapperBase;
 import eu.etaxonomy.cdm.ext.occurrence.bioCase.BioCaseQueryServiceWrapper;
 import eu.etaxonomy.taxeditor.view.dataimport.QueryType;
-import eu.etaxonomy.taxeditor.view.specimenSearch.SpecimenProviderSelectionController;
+import eu.etaxonomy.taxeditor.view.search.specimen.SpecimenProviderSelectionController;
 
 
 /**
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/e4/SpecimenSearchWizardPageE4.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/e4/SpecimenSearchWizardPageE4.java
index c6728e4ef..76e01ceb8 100644
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/e4/SpecimenSearchWizardPageE4.java
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/dataimport/e4/SpecimenSearchWizardPageE4.java
@@ -16,7 +16,7 @@ import org.eclipse.jface.wizard.WizardPage;
 import org.eclipse.swt.widgets.Composite;
 
 import eu.etaxonomy.cdm.ext.occurrence.OccurenceQuery;
-import eu.etaxonomy.taxeditor.view.specimenSearch.SpecimenSearchController;
+import eu.etaxonomy.taxeditor.view.search.specimen.SpecimenSearchController;
 
 
 /**
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/derivateSearch/DerivateContentProvider.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/derivateSearch/DerivateContentProvider.java
deleted file mode 100755
index 0aedc17a0..000000000
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/derivateSearch/DerivateContentProvider.java
+++ /dev/null
@@ -1,168 +0,0 @@
-package eu.etaxonomy.taxeditor.view.derivateSearch;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.TreeNode;
-import org.eclipse.jface.viewers.Viewer;
-
-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.DerivationEvent;
-import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
-import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
-import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
-
-public class DerivateContentProvider implements ITreeContentProvider {
-
-    private List<TreeNode> rootNodes;
-
-	@Override
-	public void dispose() {
-		// TODO Auto-generated method stub
-
-	}
-
-	public List<SpecimenOrObservationBase> getRootElements() {
-	    List<SpecimenOrObservationBase> elements = new ArrayList<SpecimenOrObservationBase>();
-
-	    if(rootNodes != null) {
-	        for(TreeNode node : rootNodes) {
-	            elements.add((SpecimenOrObservationBase)node.getValue());
-	        }
-	    }
-	    return elements;
-	}
-
-	@Override
-	public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
-	}
-
-	@Override
-	public Object[] getElements(Object inputElement) {
-	    rootNodes = new ArrayList<>();
-	    if(inputElement instanceof Collection){
-	        for (Object o: (Collection)inputElement) {
-	            if(o instanceof SpecimenOrObservationBase){
-	                SpecimenOrObservationBase<?> rootElement = (SpecimenOrObservationBase<?>)o;
-	                if(rootElement!=null){
-	                    rootNodes.add(new TreeNode(rootElement));
-	                }
-	            }
-            }
-	    }
-	    Collections.sort(rootNodes, new TreeNodeComparator());
-	    return rootNodes.toArray();
-	}
-
-	@Override
-	public Object[] getChildren(Object element) {
-	    TreeNode currentnode = null;
-	    Object value = null;
-        if(element instanceof TreeNode){
-            currentnode = (TreeNode) element;
-            value = ((TreeNode) element).getValue();
-        }
-        Set<Object> children = new LinkedHashSet<Object>();
-        if(value instanceof DnaSample && ((DnaSample) value).getRecordBasis()==SpecimenOrObservationType.DnaSample){
-            DnaSample dnaSample = (DnaSample)value;
-            Set<Sequence> sequences = dnaSample.getSequences();
-            for (Sequence sequence : sequences) {
-                TreeNode node = new TreeNode(sequence);
-                node.setParent(currentnode);
-                children.add(node);
-            }
-        }
-        else if(value instanceof Sequence){
-            Set<SingleRead> singleReads = ((Sequence) value).getSingleReads();
-            for(SingleRead singleRead:singleReads){
-                TreeNode node = new TreeNode(singleRead);
-                node.setParent(currentnode);
-                children.add(node);
-            }
-            return children.toArray();
-        }
-
-        if(value instanceof SpecimenOrObservationBase){
-	        List<DerivedUnit> derivates = getDerivates((SpecimenOrObservationBase<?>) value);
-	        for (DerivedUnit derivedUnit:derivates) {
-                TreeNode node = new TreeNode(derivedUnit);
-                node.setParent(currentnode);
-                children.add(node);
-            }
-            return children.toArray();
-	    }
-	    return null;
-	}
-
-	@Override
-	public Object getParent(Object element) {
-        if(element instanceof TreeNode){
-            return ((TreeNode) element).getParent();
-        }
-		return null;
-	}
-
-	@Override
-	public boolean hasChildren(Object element) {
-        if(element instanceof TreeNode){
-            element = ((TreeNode) element).getValue();
-        }
-
-        if(element instanceof DnaSample && ((DnaSample) element).getRecordBasis()==SpecimenOrObservationType.DnaSample){
-            DnaSample dnaSample = (DnaSample)element;
-            if(!dnaSample.getSequences().isEmpty()){// || !dnaSample.getAmplifications().isEmpty()){
-                return true;
-            }
-        }
-        else if(element instanceof Sequence){
-            return !((Sequence)element).getSingleReads().isEmpty();
-        }
-
-        if(element instanceof SpecimenOrObservationBase){
-	        SpecimenOrObservationBase<?> specimenOrObservation = (SpecimenOrObservationBase<?>)element;
-	        for(DerivationEvent event:specimenOrObservation.getDerivationEvents()){
-	            if(!event.getDerivatives().isEmpty()){
-	                return true;
-	            }
-	        }
-	    }
-		return false;
-	}
-
-	private List<DerivedUnit> getDerivates(SpecimenOrObservationBase<?> specimenOrObservation){
-	    List<DerivedUnit> derivates = new ArrayList<DerivedUnit>();
-	    for(DerivationEvent derivationEvent:specimenOrObservation.getDerivationEvents()){
-	        derivates.addAll(derivationEvent.getDerivatives());
-	    }
-	    return derivates;
-	}
-
-	private class TreeNodeComparator implements Comparator<TreeNode>{
-
-		@Override
-		public int compare(TreeNode o1, TreeNode o2) {
-			if(o1!=null && o2==null){
-				return -1;
-			}
-			else if(o1==null && o2!=null){
-				return 1;
-			}
-			else if(o1!=null && o2!=null){
-				SpecimenOrObservationBase<?> specimenOrObservation1 = (SpecimenOrObservationBase<?>) o1.getValue();
-				SpecimenOrObservationBase<?> specimenOrObservation2 = (SpecimenOrObservationBase<?>) o2.getValue();
-				return specimenOrObservation1.getTitleCache().compareTo(specimenOrObservation2.getTitleCache());
-			}
-			return 0;
-		}
-
-	}
-
-}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/derivateSearch/DerivateLabelProvider.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/derivateSearch/DerivateLabelProvider.java
deleted file mode 100644
index 0e25d05e8..000000000
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/derivateSearch/DerivateLabelProvider.java
+++ /dev/null
@@ -1,527 +0,0 @@
-/**
-* 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.view.derivateSearch;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.UUID;
-
-import org.eclipse.jface.viewers.ColumnLabelProvider;
-import org.eclipse.jface.viewers.TreeNode;
-import org.eclipse.swt.graphics.Image;
-import org.hibernate.LazyInitializationException;
-
-import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
-import eu.etaxonomy.cdm.api.service.IOccurrenceService;
-import eu.etaxonomy.cdm.api.service.molecular.ISequenceService;
-import eu.etaxonomy.cdm.common.CdmUtils;
-import eu.etaxonomy.cdm.format.CdmFormatterFactory;
-import eu.etaxonomy.cdm.format.ICdmFormatter.FormatKey;
-import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
-import eu.etaxonomy.cdm.model.common.CdmBase;
-import eu.etaxonomy.cdm.model.common.DefinedTerm;
-import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
-import eu.etaxonomy.cdm.model.common.Identifier;
-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.name.SpecimenTypeDesignation;
-import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
-import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
-import eu.etaxonomy.cdm.model.occurrence.GatheringEvent;
-import eu.etaxonomy.cdm.model.occurrence.MediaSpecimen;
-import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
-import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
-import eu.etaxonomy.cdm.strategy.cache.common.IdentifiableEntityDefaultCacheStrategy;
-import eu.etaxonomy.taxeditor.model.ImageResources;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-
-/**
- * Label provider for the views to show {@link SpecimenOrObservationBase}s.<br>
- * <br>
- * <b>Note:</b> If you use this label provider you need to assure that you
- * created a {@link ConversationHolder} resp. have an open session because
- * the labels are generated from various fields of the derivate hierarchy which
- * are lazy loaded and could therefore throw a {@link LazyInitializationException}.<br>
- * Use <b>{@link #setConversation(ConversationHolder)}</b> to assign the session to this provider.
- */
-public class DerivateLabelProvider extends ColumnLabelProvider {
-
-    private static final String NO_SAMPLE_DESIGNATION = "[no sample designation]";
-
-    private static Set<SingleRead> multiLinkSingleReads;
-
-    private static Map<DerivedUnit, Collection<SpecimenTypeDesignation>> typeDesignations;
-
-    private ConversationHolder conversation;
-
-    private static DefinedTerm photoTerm = null;
-    private static DefinedTerm drawingTerm = null;
-    private static DefinedTerm specimenScanTerm = null;
-    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) {
-            if(definedTerm.getUuid().equals(UUID.fromString("c5c59c42-f254-471e-96c6-09f459f7c903"))){
-                photoTerm = definedTerm;
-            }
-            else if(definedTerm.getUuid().equals(UUID.fromString("669b0409-4aa4-4695-aae4-a95ed27bad4c"))){
-                drawingTerm = definedTerm;
-            }
-            else if(definedTerm.getUuid().equals(UUID.fromString("acda15be-c0e2-4ea8-8783-b9b0c4ad7f03"))){
-                specimenScanTerm = definedTerm;
-            }
-            else if(definedTerm.getUuid().equals(UUID.fromString("31eb8d02-bf5d-437c-bcc6-87a626445f34"))){
-                detailImageTerm = definedTerm;
-            }
-            else if(definedTerm.getUuid().equals(UUID.fromString("fadeba12-1be3-4bc7-9ff5-361b088d86fc"))){
-                sampleDesignationTerm = definedTerm;
-            }
-        }
-    }
-
-    public static DefinedTerm getLivingPlantPhotoTerm(){
-        if(photoTerm==null){
-            initializeTerms();
-        }
-        return photoTerm;
-    }
-
-    public static DefinedTerm getArtworkTerm(){
-        if(drawingTerm==null){
-            initializeTerms();
-        }
-        return drawingTerm;
-    }
-
-    public static DefinedTerm getSpecimenScanTerm(){
-        if(specimenScanTerm==null){
-            initializeTerms();
-        }
-        return specimenScanTerm;
-    }
-
-    public static DefinedTerm getDetailImageTerm(){
-        if(detailImageTerm==null){
-            initializeTerms();
-        }
-        return detailImageTerm;
-    }
-
-    public static DefinedTerm getSampleDesignationTerm(){
-        if(sampleDesignationTerm==null){
-            initializeTerms();
-        }
-        return sampleDesignationTerm;
-    }
-
-
-    /** {@inheritDoc} */
-    @Override
-    public String getText(Object element) {
-        if(element instanceof TreeNode){
-            element = ((TreeNode) element).getValue();
-        }
-        String text = null;
-        if(element instanceof IdentifiableEntity
-                && ((IdentifiableEntity) element).isProtectedTitleCache()){
-            return ((IdentifiableEntity) element).getTitleCache();
-        }
-
-
-        //check if collection code does not exist -> use collection name then
-        FormatKey collectionKey = FormatKey.COLLECTION_CODE;
-        text = CdmFormatterFactory.format(element,new FormatKey[]{FormatKey.COLLECTION_CODE});
-        if(CdmUtils.isBlank(text)){
-            collectionKey = FormatKey.COLLECTION_NAME;
-        }
-
-        //Use titlecache for FieldUnits
-        if(element instanceof FieldUnit){
-            text = ((FieldUnit) element).getTitleCache();
-        }
-        else if(element instanceof MediaSpecimen){
-            text = CdmFormatterFactory.format(element,
-                    new FormatKey[]{
-//                            FormatKey.MEDIA_TITLE_CACHE, FormatKey.SPACE,
-                            collectionKey, FormatKey.SPACE,
-                            FormatKey.MOST_SIGNIFICANT_IDENTIFIER, FormatKey.SPACE,
-                            FormatKey.MEDIA_TITLE, FormatKey.SPACE,
-                            FormatKey.MEDIA_ARTIST, FormatKey.SPACE,
-                            });
-        }
-        else if (element instanceof DnaSample) {
-            text = CdmFormatterFactory.format(element,
-                    new FormatKey[] {
-                            collectionKey, FormatKey.SPACE,
-                            FormatKey.MOST_SIGNIFICANT_IDENTIFIER, FormatKey.SPACE,
-                            FormatKey.SAMPLE_DESIGNATION, FormatKey.SPACE
-                            });
-        }
-        else if (element instanceof DerivedUnit) {
-            text = CdmFormatterFactory.format(element,
-                    new FormatKey[] {
-                            collectionKey, FormatKey.SPACE,
-                            FormatKey.MOST_SIGNIFICANT_IDENTIFIER, FormatKey.SPACE
-                            });
-        }
-        else if (element instanceof Sequence) {
-            text = CdmFormatterFactory.format(element,
-                    new FormatKey[] {
-                            FormatKey.SEQUENCE_DNA_MARKER, FormatKey.SPACE
-                            });
-        }
-        else if (element instanceof SingleRead) {
-            text = CdmFormatterFactory.format(element,
-                    new FormatKey[] {
-                            FormatKey.SINGLE_READ_PHEROGRAM_TITLE_CACHE, FormatKey.SPACE,
-                            FormatKey.AMPLIFICATION_LABEL, FormatKey.SPACE,
-            });
-        }
-        else if(element instanceof IdentifiableEntity){
-
-        	IdentifiableEntity identifiableEntity = (IdentifiableEntity) element;
-        	if(identifiableEntity.isProtectedTitleCache()){
-        		text = identifiableEntity.getTitleCache();
-        	}
-        }
-        if(CdmUtils.isBlank(text) || text.equals(IdentifiableEntityDefaultCacheStrategy.TITLE_CACHE_GENERATION_NOT_IMPLEMENTED)){
-            if(element instanceof CdmBase){
-                text = ((CdmBase) element).getUuid().toString();
-            }
-            else{
-                text = element.toString();
-            }
-        }
-        //remove dot at the end
-        if(text.endsWith(".")){
-            text = text.substring(0, text.length()-1);
-        }
-		return text;
-    }
-
-    /** {@inheritDoc} */
-    @Override
-    public String getToolTipText(Object element) {
-        return getDerivateText(element);
-    }
-
-    /**
-     * @param conversation the conversation to set
-     */
-    public void setConversation(ConversationHolder conversation) {
-        this.conversation = conversation;
-    }
-
-    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;
-        Object derivate = element;
-        if(element instanceof TreeNode){
-            node = (TreeNode) element;
-            parentNode = node.getParent();
-            //unwrap specimen from TreeNode
-            derivate = node.getValue();
-        }
-
-        if(conversation!=null){
-            conversation.bind();
-        }
-
-        final String emptyString = "";
-        final String separator = " ";
-
-        String label = emptyString;
-
-        //Field Unit
-        if(derivate instanceof FieldUnit){
-            FieldUnit fieldUnit = (FieldUnit)derivate;
-            if(fieldUnit.getGatheringEvent()!=null){
-                GatheringEvent gatheringEvent = fieldUnit.getGatheringEvent();
-                label += gatheringEvent.getCountry()!=null?gatheringEvent.getCountry().getLabel()+separator:emptyString;
-                label += gatheringEvent.getLocality()!=null?gatheringEvent.getLocality().getText()+separator:emptyString;
-                label += gatheringEvent.getGatheringDate()!=null?gatheringEvent.getGatheringDate()+separator:emptyString;
-                label += gatheringEvent.getCollector()!=null?gatheringEvent.getCollector()+separator:emptyString;
-            }
-            label += fieldUnit.getFieldNumber()!=null?fieldUnit.getFieldNumber():emptyString;
-        }
-        //MediaSpecimen
-        else if(derivate instanceof MediaSpecimen){
-            MediaSpecimen mediaSpecimen = (MediaSpecimen)derivate;
-            if(mediaSpecimen.getMediaSpecimen()!=null){
-                label += mediaSpecimen.getMediaSpecimen().getTitle()!=null?mediaSpecimen.getMediaSpecimen().getTitle().getText()+separator:"[no motif]";
-                label += mediaSpecimen.getMediaSpecimen().getArtist()!=null?mediaSpecimen.getMediaSpecimen().getArtist()+separator:emptyString;
-            }
-            eu.etaxonomy.cdm.model.occurrence.Collection collection = mediaSpecimen.getCollection();
-            if(collection!=null){
-                label += collection.getName()!=null?collection.getName()+" ":emptyString;
-                label += collection.getCode()!=null?"("+collection.getCode()+")"+separator:emptyString;
-            }
-            label += mediaSpecimen.getAccessionNumber()!=null?mediaSpecimen.getAccessionNumber()+separator:emptyString;
-            label += mediaSpecimen.getBarcode()!=null?mediaSpecimen.getBarcode()+separator:emptyString;
-        }
-        //TissueSample + DnaSample
-        else if(derivate instanceof DnaSample){
-            DnaSample dnaSample = (DnaSample)derivate;
-            if(((DnaSample) derivate).getRecordBasis()==SpecimenOrObservationType.DnaSample){
-                Identifier<DnaSample> currentSampleDesignation = getCurrentSampleDesignation(dnaSample);
-                if(currentSampleDesignation!=null && currentSampleDesignation.getIdentifier()!=null){
-                    label += currentSampleDesignation.getIdentifier()+separator;
-                }
-                else{
-                    label += NO_SAMPLE_DESIGNATION+separator;
-                }
-            }
-            else if(((DnaSample) derivate).getRecordBasis()==SpecimenOrObservationType.TissueSample){
-                if(dnaSample.getKindOfUnit()!=null){
-                    label += dnaSample.getKindOfUnit()+separator;
-                }
-                Identifier<DnaSample> currentSampleDesignation = getCurrentSampleDesignation(dnaSample);
-                if(currentSampleDesignation!=null && currentSampleDesignation.getIdentifier()!=null){
-                    label += currentSampleDesignation.getIdentifier()+separator;
-                }
-                else{
-                    label += NO_SAMPLE_DESIGNATION+separator;
-                }
-            }
-
-        }
-        //DerivedUnit + TissueSample
-        else if(derivate instanceof DerivedUnit){
-            DerivedUnit derivedUnit = (DerivedUnit)derivate;
-            if(derivedUnit.getRecordBasis()==SpecimenOrObservationType.PreservedSpecimen){
-                //check for type designation
-                if(typeDesignations.get(derivedUnit)==null){
-                    for (SpecimenTypeDesignation specimenTypeDesignation : derivedUnit.getSpecimenTypeDesignations()) {
-                        addTypeDesignation(derivedUnit, specimenTypeDesignation);
-                    }
-                }
-                //java.util.Collection<FieldUnit> fieldUnits = CdmStore.getService(IOccurrenceService.class).getFieldUnits(derivedUnit.getUuid());
-                //TODO : This is not generic anymore for performance reasons
-                Set<SpecimenOrObservationBase> originals = derivedUnit.getOriginals();
-                if(originals!=null && originals.size() ==1) {
-                    SpecimenOrObservationBase specimen = originals.iterator().next();
-                    if(specimen instanceof FieldUnit) {
-                        FieldUnit fieldUnit = (FieldUnit)specimen;
-                        GatheringEvent gatheringEvent = fieldUnit.getGatheringEvent();
-                        if(gatheringEvent!=null){
-                            label += gatheringEvent.getCollector()!=null?gatheringEvent.getCollector()+separator:emptyString;
-                        }
-                        label += fieldUnit.getFieldNumber()!=null?fieldUnit.getFieldNumber()+separator:emptyString;
-                    }
-                }
-
-                eu.etaxonomy.cdm.model.occurrence.Collection collection = derivedUnit.getCollection();
-                if(collection!=null){
-                    label += collection.getCode()!=null?"("+collection.getCode()+")"+separator:emptyString;
-                }
-                String mostSignificantIdentifier = derivedUnit.getMostSignificantIdentifier();
-                label += mostSignificantIdentifier!=null?mostSignificantIdentifier+separator:emptyString;
-            }
-            else if(derivedUnit.getRecordBasis()==SpecimenOrObservationType.TissueSample){
-                //TissueSample should only be created by using it's own class
-                //in future using only one class with different SpecimenOrObservationTypes is desired
-//                label += derivedUnit.getKindOfUnit() + NO_SAMPLE_DESIGNATION;
-            }
-        }
-        //Sequence
-        else if(derivate instanceof Sequence){
-            Sequence sequence = (Sequence)derivate;
-            Identifier<DnaSample> currentSampleDesignation = getCurrentSampleDesignation(sequence);
-            if(currentSampleDesignation!=null && currentSampleDesignation.getIdentifier()!=null){
-                label += currentSampleDesignation.getIdentifier()+separator;
-            }
-            else{
-                label += NO_SAMPLE_DESIGNATION+separator;
-            }
-            label += sequence.getDnaMarker()!=null?sequence.getDnaMarker():emptyString;
-        }
-        //SingleRead
-        else if(derivate instanceof SingleRead){
-            SingleRead singleRead = (SingleRead)derivate;
-            if(parentNode!=null && parentNode.getValue() instanceof Sequence){
-                Sequence sequence = (Sequence) parentNode.getValue();
-                Identifier<DnaSample> currentSampleDesignation = getCurrentSampleDesignation(sequence);
-                if(currentSampleDesignation!=null && currentSampleDesignation.getIdentifier()!=null){
-                    label = currentSampleDesignation.getIdentifier()+separator;
-                }
-                else{
-                    label += NO_SAMPLE_DESIGNATION+separator;
-                }
-                label += singleRead.getPrimer()!=null?singleRead.getPrimer().getLabel()+separator:emptyString;
-                if(sequence!=null && sequence.getDnaMarker()!=null){
-                    label += sequence.getDnaMarker()+separator;
-                }
-                if(singleRead.getAmplificationResult()!=null && singleRead.getAmplificationResult().getAmplification()!=null){
-                    label += singleRead.getAmplificationResult().getAmplification().getLabelCache()+separator;
-                }
-            }
-        }
-        //SOOB
-        else if(derivate instanceof SpecimenOrObservationBase){
-            SpecimenOrObservationBase<?> specimen = (SpecimenOrObservationBase<?>) derivate;
-            SpecimenOrObservationType type = specimen.getRecordBasis();
-            return specimen.getTitleCache() + (type!=null?" ["+type.toString()+"]":emptyString);
-        }
-        if(label.isEmpty()){
-            label = derivate.toString();
-        }
-        //remove last comma
-        else if(label.endsWith(separator)){
-            label = label.substring(0, label.length()-separator.length());
-        }
-        return label;
-    }
-
-    @Override
-    public Image getImage(Object element) {
-        if(element instanceof TreeNode){
-            element = ((TreeNode) element).getValue();
-        }
-        if(element instanceof CdmBase){
-            CdmBase cdmBase = (CdmBase)element;
-            boolean hasCharacterData = false;
-            if(cdmBase.isInstanceOf(SpecimenOrObservationBase.class)){
-                SpecimenOrObservationBase<?> specimen = HibernateProxyHelper.deproxy(cdmBase, SpecimenOrObservationBase.class);
-                if(specimen.hasCharacterData()){
-                    hasCharacterData = true;
-                }
-            }
-            if(cdmBase.isInstanceOf(FieldUnit.class)){
-                return hasCharacterData?ImageResources.getImage(ImageResources.FIELD_UNIT_CHARACTER_DATA):ImageResources.getImage(ImageResources.FIELD_UNIT);
-            }
-            else if(cdmBase.isInstanceOf(DerivedUnit.class)){
-                DerivedUnit derivedUnit = HibernateProxyHelper.deproxy(element, DerivedUnit.class);
-
-                if(derivedUnit.getRecordBasis()==SpecimenOrObservationType.FieldUnit){
-                    return hasCharacterData?ImageResources.getImage(ImageResources.FIELD_UNIT_CHARACTER_DATA):ImageResources.getImage(ImageResources.FIELD_UNIT);
-                }
-                else if(derivedUnit.getRecordBasis()==SpecimenOrObservationType.DnaSample){
-                    return hasCharacterData?ImageResources.getImage(ImageResources.DNA_SAMPLE_DERIVATE_CHARACTER_DATA):ImageResources.getImage(ImageResources.DNA_SAMPLE_DERIVATE);
-                }
-                else if(derivedUnit.getRecordBasis()==SpecimenOrObservationType.TissueSample){
-                    return hasCharacterData?ImageResources.getImage(ImageResources.TISSUE_SAMPLE_DERIVATE_CHARACTER_DATA):ImageResources.getImage(ImageResources.TISSUE_SAMPLE_DERIVATE);
-                }
-                else if(derivedUnit.getRecordBasis()==SpecimenOrObservationType.PreservedSpecimen){
-                    if(typeDesignations.get(derivedUnit)!=null && !typeDesignations.get(derivedUnit).isEmpty()){
-                        return ImageResources.getImage(ImageResources.SPECIMEN_DERIVATE_TYPE);
-                    }
-                    return hasCharacterData?ImageResources.getImage(ImageResources.SPECIMEN_DERIVATE_CHARACTER_DATA):ImageResources.getImage(ImageResources.SPECIMEN_DERIVATE);
-                }
-                else if(derivedUnit.getRecordBasis().isMedia()
-                        || derivedUnit.getRecordBasis().isKindOf(SpecimenOrObservationType.Media)){
-                    if(derivedUnit.getKindOfUnit()!=null){
-                        if(derivedUnit.getKindOfUnit().equals(getArtworkTerm())){
-                            return hasCharacterData?ImageResources.getImage(ImageResources.ARTWORK_DERIVATE_CHARACTER_DATA):ImageResources.getImage(ImageResources.ARTWORK_DERIVATE);
-                        }
-                        else if(derivedUnit.getKindOfUnit().equals(getLivingPlantPhotoTerm())){
-                            return hasCharacterData?ImageResources.getImage(ImageResources.LIVING_PLANT_PHOTO_DERIVATE_CHARACTER_DATA):ImageResources.getImage(ImageResources.LIVING_PLANT_PHOTO_DERIVATE);
-                        }
-                        else if(derivedUnit.getKindOfUnit().equals(getSpecimenScanTerm())){
-                            return hasCharacterData?ImageResources.getImage(ImageResources.SPECIMEN_SCAN_DERIVATE_CHARACTER_DATA):ImageResources.getImage(ImageResources.SPECIMEN_SCAN_DERIVATE);
-                        }
-                        else if(derivedUnit.getKindOfUnit().equals(getDetailImageTerm())){
-                            return hasCharacterData?ImageResources.getImage(ImageResources.DETAIL_IMAGE_DERIVATE_CHARACTER_DATA):ImageResources.getImage(ImageResources.DETAIL_IMAGE_DERIVATE);
-                        }
-                    }
-                }
-            }
-            else if(cdmBase.isInstanceOf(Sequence.class)){
-                return ImageResources.getImage(ImageResources.SEQUENCE_DERIVATE);
-            }
-
-            else if(cdmBase.isInstanceOf(SingleRead.class)){
-                if(multiLinkSingleReads!=null && multiLinkSingleReads.contains(element)){
-                    return ImageResources.getImage(ImageResources.SINGLE_READ_DERIVATE_MULTILINK);
-                }
-                else{
-                    return ImageResources.getImage(ImageResources.SINGLE_READ_DERIVATE);
-                }
-            }
-        }
-        return ImageResources.getImage(ImageResources.DEFAULT_DERIVATIVE);
-    }
-
-    public static Identifier<DnaSample> getCurrentSampleDesignation(CdmBase entity) {
-        if(entity.isInstanceOf(DnaSample.class)){
-            DnaSample dnaSample = HibernateProxyHelper.deproxy(entity, DnaSample.class);
-            for (Identifier<DnaSample> identifier : dnaSample.getIdentifiers()) {
-                if(identifier.getType()!=null && identifier.getType().equals(DerivateLabelProvider.getSampleDesignationTerm())){
-                    //first sample designation is the current
-                    return identifier;
-                }
-            }
-        }
-        else if(entity.isInstanceOf(Sequence.class)){
-            Sequence sequence = HibernateProxyHelper.deproxy(entity, Sequence.class);
-            if(sequence.getDnaSample()!=null){
-                return getCurrentSampleDesignation(sequence.getDnaSample());
-            }
-        }
-        return null;
-    }
-
-    private static void addTypeDesignation(DerivedUnit derivedUnit, SpecimenTypeDesignation typeDesignation){
-        Collection<SpecimenTypeDesignation> list = typeDesignations.get(derivedUnit);
-        if(list==null){
-            list = new ArrayList<SpecimenTypeDesignation>();
-        }
-        list.add(typeDesignation);
-        typeDesignations.put(derivedUnit, list);
-    }
-
-    public static Set<SingleRead> getMultiLinkSingleReads() {
-        return multiLinkSingleReads;
-    }
-
-    public void updateLabelCache(Collection<SpecimenOrObservationBase<?>> rootElements) {
-        multiLinkSingleReads = new HashSet<SingleRead>();
-        typeDesignations = new HashMap<DerivedUnit, Collection<SpecimenTypeDesignation>>();
-        for(Entry<SingleRead, Collection<Sequence>> entry:CdmStore.getService(ISequenceService.class).getSingleReadSequencesMap().entrySet()){
-            if(entry.getValue().size()>1){
-                multiLinkSingleReads.add(entry.getKey());
-            }
-        }
-        if(rootElements!=null){
-            Collection<DerivedUnit> derivedUnits = new ArrayList<DerivedUnit>();
-            for (SpecimenOrObservationBase specimenOrObservationBase : rootElements) {
-                List<DerivedUnit> childUnits = CdmStore.getService(IOccurrenceService.class).getAllChildDerivatives(specimenOrObservationBase.getUuid());
-                if (childUnits != null){
-                    derivedUnits.addAll(childUnits);
-                }
-                if(specimenOrObservationBase.isInstanceOf(DerivedUnit.class)){
-                    specimenOrObservationBase = CdmStore.getService(IOccurrenceService.class).load(specimenOrObservationBase.getUuid());
-                    if (specimenOrObservationBase != null){
-                        derivedUnits.add(HibernateProxyHelper.deproxy(specimenOrObservationBase, DerivedUnit.class));
-                    }
-                }
-            }
-            for (DerivedUnit derivedUnit : derivedUnits) {
-                if(!derivedUnit.getSpecimenTypeDesignations().isEmpty()){
-                    typeDesignations.put(derivedUnit, derivedUnit.getSpecimenTypeDesignations());
-                }
-            }
-        }
-    }
-
-}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/search/derivative/DerivateContentProvider.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/search/derivative/DerivateContentProvider.java
new file mode 100755
index 000000000..9244c93d0
--- /dev/null
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/search/derivative/DerivateContentProvider.java
@@ -0,0 +1,168 @@
+package eu.etaxonomy.taxeditor.view.search.derivative;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.TreeNode;
+import org.eclipse.jface.viewers.Viewer;
+
+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.DerivationEvent;
+import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
+
+public class DerivateContentProvider implements ITreeContentProvider {
+
+    private List<TreeNode> rootNodes;
+
+	@Override
+	public void dispose() {
+		// TODO Auto-generated method stub
+
+	}
+
+	public List<SpecimenOrObservationBase> getRootElements() {
+	    List<SpecimenOrObservationBase> elements = new ArrayList<SpecimenOrObservationBase>();
+
+	    if(rootNodes != null) {
+	        for(TreeNode node : rootNodes) {
+	            elements.add((SpecimenOrObservationBase)node.getValue());
+	        }
+	    }
+	    return elements;
+	}
+
+	@Override
+	public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+	}
+
+	@Override
+	public Object[] getElements(Object inputElement) {
+	    rootNodes = new ArrayList<>();
+	    if(inputElement instanceof Collection){
+	        for (Object o: (Collection)inputElement) {
+	            if(o instanceof SpecimenOrObservationBase){
+	                SpecimenOrObservationBase<?> rootElement = (SpecimenOrObservationBase<?>)o;
+	                if(rootElement!=null){
+	                    rootNodes.add(new TreeNode(rootElement));
+	                }
+	            }
+            }
+	    }
+	    Collections.sort(rootNodes, new TreeNodeComparator());
+	    return rootNodes.toArray();
+	}
+
+	@Override
+	public Object[] getChildren(Object element) {
+	    TreeNode currentnode = null;
+	    Object value = null;
+        if(element instanceof TreeNode){
+            currentnode = (TreeNode) element;
+            value = ((TreeNode) element).getValue();
+        }
+        Set<Object> children = new LinkedHashSet<Object>();
+        if(value instanceof DnaSample && ((DnaSample) value).getRecordBasis()==SpecimenOrObservationType.DnaSample){
+            DnaSample dnaSample = (DnaSample)value;
+            Set<Sequence> sequences = dnaSample.getSequences();
+            for (Sequence sequence : sequences) {
+                TreeNode node = new TreeNode(sequence);
+                node.setParent(currentnode);
+                children.add(node);
+            }
+        }
+        else if(value instanceof Sequence){
+            Set<SingleRead> singleReads = ((Sequence) value).getSingleReads();
+            for(SingleRead singleRead:singleReads){
+                TreeNode node = new TreeNode(singleRead);
+                node.setParent(currentnode);
+                children.add(node);
+            }
+            return children.toArray();
+        }
+
+        if(value instanceof SpecimenOrObservationBase){
+	        List<DerivedUnit> derivates = getDerivates((SpecimenOrObservationBase<?>) value);
+	        for (DerivedUnit derivedUnit:derivates) {
+                TreeNode node = new TreeNode(derivedUnit);
+                node.setParent(currentnode);
+                children.add(node);
+            }
+            return children.toArray();
+	    }
+	    return null;
+	}
+
+	@Override
+	public Object getParent(Object element) {
+        if(element instanceof TreeNode){
+            return ((TreeNode) element).getParent();
+        }
+		return null;
+	}
+
+	@Override
+	public boolean hasChildren(Object element) {
+        if(element instanceof TreeNode){
+            element = ((TreeNode) element).getValue();
+        }
+
+        if(element instanceof DnaSample && ((DnaSample) element).getRecordBasis()==SpecimenOrObservationType.DnaSample){
+            DnaSample dnaSample = (DnaSample)element;
+            if(!dnaSample.getSequences().isEmpty()){// || !dnaSample.getAmplifications().isEmpty()){
+                return true;
+            }
+        }
+        else if(element instanceof Sequence){
+            return !((Sequence)element).getSingleReads().isEmpty();
+        }
+
+        if(element instanceof SpecimenOrObservationBase){
+	        SpecimenOrObservationBase<?> specimenOrObservation = (SpecimenOrObservationBase<?>)element;
+	        for(DerivationEvent event:specimenOrObservation.getDerivationEvents()){
+	            if(!event.getDerivatives().isEmpty()){
+	                return true;
+	            }
+	        }
+	    }
+		return false;
+	}
+
+	private List<DerivedUnit> getDerivates(SpecimenOrObservationBase<?> specimenOrObservation){
+	    List<DerivedUnit> derivates = new ArrayList<DerivedUnit>();
+	    for(DerivationEvent derivationEvent:specimenOrObservation.getDerivationEvents()){
+	        derivates.addAll(derivationEvent.getDerivatives());
+	    }
+	    return derivates;
+	}
+
+	private class TreeNodeComparator implements Comparator<TreeNode>{
+
+		@Override
+		public int compare(TreeNode o1, TreeNode o2) {
+			if(o1!=null && o2==null){
+				return -1;
+			}
+			else if(o1==null && o2!=null){
+				return 1;
+			}
+			else if(o1!=null && o2!=null){
+				SpecimenOrObservationBase<?> specimenOrObservation1 = (SpecimenOrObservationBase<?>) o1.getValue();
+				SpecimenOrObservationBase<?> specimenOrObservation2 = (SpecimenOrObservationBase<?>) o2.getValue();
+				return specimenOrObservation1.getTitleCache().compareTo(specimenOrObservation2.getTitleCache());
+			}
+			return 0;
+		}
+
+	}
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/search/derivative/DerivateLabelProvider.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/search/derivative/DerivateLabelProvider.java
new file mode 100644
index 000000000..b3c8c1fb1
--- /dev/null
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/search/derivative/DerivateLabelProvider.java
@@ -0,0 +1,527 @@
+/**
+* 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.view.search.derivative;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+import java.util.UUID;
+
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.TreeNode;
+import org.eclipse.swt.graphics.Image;
+import org.hibernate.LazyInitializationException;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.service.IOccurrenceService;
+import eu.etaxonomy.cdm.api.service.molecular.ISequenceService;
+import eu.etaxonomy.cdm.common.CdmUtils;
+import eu.etaxonomy.cdm.format.CdmFormatterFactory;
+import eu.etaxonomy.cdm.format.ICdmFormatter.FormatKey;
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.common.DefinedTerm;
+import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
+import eu.etaxonomy.cdm.model.common.Identifier;
+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.name.SpecimenTypeDesignation;
+import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
+import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
+import eu.etaxonomy.cdm.model.occurrence.GatheringEvent;
+import eu.etaxonomy.cdm.model.occurrence.MediaSpecimen;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
+import eu.etaxonomy.cdm.strategy.cache.common.IdentifiableEntityDefaultCacheStrategy;
+import eu.etaxonomy.taxeditor.model.ImageResources;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * Label provider for the views to show {@link SpecimenOrObservationBase}s.<br>
+ * <br>
+ * <b>Note:</b> If you use this label provider you need to assure that you
+ * created a {@link ConversationHolder} resp. have an open session because
+ * the labels are generated from various fields of the derivate hierarchy which
+ * are lazy loaded and could therefore throw a {@link LazyInitializationException}.<br>
+ * Use <b>{@link #setConversation(ConversationHolder)}</b> to assign the session to this provider.
+ */
+public class DerivateLabelProvider extends ColumnLabelProvider {
+
+    private static final String NO_SAMPLE_DESIGNATION = "[no sample designation]";
+
+    private static Set<SingleRead> multiLinkSingleReads;
+
+    private static Map<DerivedUnit, Collection<SpecimenTypeDesignation>> typeDesignations;
+
+    private ConversationHolder conversation;
+
+    private static DefinedTerm photoTerm = null;
+    private static DefinedTerm drawingTerm = null;
+    private static DefinedTerm specimenScanTerm = null;
+    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) {
+            if(definedTerm.getUuid().equals(UUID.fromString("c5c59c42-f254-471e-96c6-09f459f7c903"))){
+                photoTerm = definedTerm;
+            }
+            else if(definedTerm.getUuid().equals(UUID.fromString("669b0409-4aa4-4695-aae4-a95ed27bad4c"))){
+                drawingTerm = definedTerm;
+            }
+            else if(definedTerm.getUuid().equals(UUID.fromString("acda15be-c0e2-4ea8-8783-b9b0c4ad7f03"))){
+                specimenScanTerm = definedTerm;
+            }
+            else if(definedTerm.getUuid().equals(UUID.fromString("31eb8d02-bf5d-437c-bcc6-87a626445f34"))){
+                detailImageTerm = definedTerm;
+            }
+            else if(definedTerm.getUuid().equals(UUID.fromString("fadeba12-1be3-4bc7-9ff5-361b088d86fc"))){
+                sampleDesignationTerm = definedTerm;
+            }
+        }
+    }
+
+    public static DefinedTerm getLivingPlantPhotoTerm(){
+        if(photoTerm==null){
+            initializeTerms();
+        }
+        return photoTerm;
+    }
+
+    public static DefinedTerm getArtworkTerm(){
+        if(drawingTerm==null){
+            initializeTerms();
+        }
+        return drawingTerm;
+    }
+
+    public static DefinedTerm getSpecimenScanTerm(){
+        if(specimenScanTerm==null){
+            initializeTerms();
+        }
+        return specimenScanTerm;
+    }
+
+    public static DefinedTerm getDetailImageTerm(){
+        if(detailImageTerm==null){
+            initializeTerms();
+        }
+        return detailImageTerm;
+    }
+
+    public static DefinedTerm getSampleDesignationTerm(){
+        if(sampleDesignationTerm==null){
+            initializeTerms();
+        }
+        return sampleDesignationTerm;
+    }
+
+
+    /** {@inheritDoc} */
+    @Override
+    public String getText(Object element) {
+        if(element instanceof TreeNode){
+            element = ((TreeNode) element).getValue();
+        }
+        String text = null;
+        if(element instanceof IdentifiableEntity
+                && ((IdentifiableEntity) element).isProtectedTitleCache()){
+            return ((IdentifiableEntity) element).getTitleCache();
+        }
+
+
+        //check if collection code does not exist -> use collection name then
+        FormatKey collectionKey = FormatKey.COLLECTION_CODE;
+        text = CdmFormatterFactory.format(element,new FormatKey[]{FormatKey.COLLECTION_CODE});
+        if(CdmUtils.isBlank(text)){
+            collectionKey = FormatKey.COLLECTION_NAME;
+        }
+
+        //Use titlecache for FieldUnits
+        if(element instanceof FieldUnit){
+            text = ((FieldUnit) element).getTitleCache();
+        }
+        else if(element instanceof MediaSpecimen){
+            text = CdmFormatterFactory.format(element,
+                    new FormatKey[]{
+//                            FormatKey.MEDIA_TITLE_CACHE, FormatKey.SPACE,
+                            collectionKey, FormatKey.SPACE,
+                            FormatKey.MOST_SIGNIFICANT_IDENTIFIER, FormatKey.SPACE,
+                            FormatKey.MEDIA_TITLE, FormatKey.SPACE,
+                            FormatKey.MEDIA_ARTIST, FormatKey.SPACE,
+                            });
+        }
+        else if (element instanceof DnaSample) {
+            text = CdmFormatterFactory.format(element,
+                    new FormatKey[] {
+                            collectionKey, FormatKey.SPACE,
+                            FormatKey.MOST_SIGNIFICANT_IDENTIFIER, FormatKey.SPACE,
+                            FormatKey.SAMPLE_DESIGNATION, FormatKey.SPACE
+                            });
+        }
+        else if (element instanceof DerivedUnit) {
+            text = CdmFormatterFactory.format(element,
+                    new FormatKey[] {
+                            collectionKey, FormatKey.SPACE,
+                            FormatKey.MOST_SIGNIFICANT_IDENTIFIER, FormatKey.SPACE
+                            });
+        }
+        else if (element instanceof Sequence) {
+            text = CdmFormatterFactory.format(element,
+                    new FormatKey[] {
+                            FormatKey.SEQUENCE_DNA_MARKER, FormatKey.SPACE
+                            });
+        }
+        else if (element instanceof SingleRead) {
+            text = CdmFormatterFactory.format(element,
+                    new FormatKey[] {
+                            FormatKey.SINGLE_READ_PHEROGRAM_TITLE_CACHE, FormatKey.SPACE,
+                            FormatKey.AMPLIFICATION_LABEL, FormatKey.SPACE,
+            });
+        }
+        else if(element instanceof IdentifiableEntity){
+
+        	IdentifiableEntity identifiableEntity = (IdentifiableEntity) element;
+        	if(identifiableEntity.isProtectedTitleCache()){
+        		text = identifiableEntity.getTitleCache();
+        	}
+        }
+        if(CdmUtils.isBlank(text) || text.equals(IdentifiableEntityDefaultCacheStrategy.TITLE_CACHE_GENERATION_NOT_IMPLEMENTED)){
+            if(element instanceof CdmBase){
+                text = ((CdmBase) element).getUuid().toString();
+            }
+            else{
+                text = element.toString();
+            }
+        }
+        //remove dot at the end
+        if(text.endsWith(".")){
+            text = text.substring(0, text.length()-1);
+        }
+		return text;
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public String getToolTipText(Object element) {
+        return getDerivateText(element);
+    }
+
+    /**
+     * @param conversation the conversation to set
+     */
+    public void setConversation(ConversationHolder conversation) {
+        this.conversation = conversation;
+    }
+
+    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;
+        Object derivate = element;
+        if(element instanceof TreeNode){
+            node = (TreeNode) element;
+            parentNode = node.getParent();
+            //unwrap specimen from TreeNode
+            derivate = node.getValue();
+        }
+
+        if(conversation!=null){
+            conversation.bind();
+        }
+
+        final String emptyString = "";
+        final String separator = " ";
+
+        String label = emptyString;
+
+        //Field Unit
+        if(derivate instanceof FieldUnit){
+            FieldUnit fieldUnit = (FieldUnit)derivate;
+            if(fieldUnit.getGatheringEvent()!=null){
+                GatheringEvent gatheringEvent = fieldUnit.getGatheringEvent();
+                label += gatheringEvent.getCountry()!=null?gatheringEvent.getCountry().getLabel()+separator:emptyString;
+                label += gatheringEvent.getLocality()!=null?gatheringEvent.getLocality().getText()+separator:emptyString;
+                label += gatheringEvent.getGatheringDate()!=null?gatheringEvent.getGatheringDate()+separator:emptyString;
+                label += gatheringEvent.getCollector()!=null?gatheringEvent.getCollector()+separator:emptyString;
+            }
+            label += fieldUnit.getFieldNumber()!=null?fieldUnit.getFieldNumber():emptyString;
+        }
+        //MediaSpecimen
+        else if(derivate instanceof MediaSpecimen){
+            MediaSpecimen mediaSpecimen = (MediaSpecimen)derivate;
+            if(mediaSpecimen.getMediaSpecimen()!=null){
+                label += mediaSpecimen.getMediaSpecimen().getTitle()!=null?mediaSpecimen.getMediaSpecimen().getTitle().getText()+separator:"[no motif]";
+                label += mediaSpecimen.getMediaSpecimen().getArtist()!=null?mediaSpecimen.getMediaSpecimen().getArtist()+separator:emptyString;
+            }
+            eu.etaxonomy.cdm.model.occurrence.Collection collection = mediaSpecimen.getCollection();
+            if(collection!=null){
+                label += collection.getName()!=null?collection.getName()+" ":emptyString;
+                label += collection.getCode()!=null?"("+collection.getCode()+")"+separator:emptyString;
+            }
+            label += mediaSpecimen.getAccessionNumber()!=null?mediaSpecimen.getAccessionNumber()+separator:emptyString;
+            label += mediaSpecimen.getBarcode()!=null?mediaSpecimen.getBarcode()+separator:emptyString;
+        }
+        //TissueSample + DnaSample
+        else if(derivate instanceof DnaSample){
+            DnaSample dnaSample = (DnaSample)derivate;
+            if(((DnaSample) derivate).getRecordBasis()==SpecimenOrObservationType.DnaSample){
+                Identifier<DnaSample> currentSampleDesignation = getCurrentSampleDesignation(dnaSample);
+                if(currentSampleDesignation!=null && currentSampleDesignation.getIdentifier()!=null){
+                    label += currentSampleDesignation.getIdentifier()+separator;
+                }
+                else{
+                    label += NO_SAMPLE_DESIGNATION+separator;
+                }
+            }
+            else if(((DnaSample) derivate).getRecordBasis()==SpecimenOrObservationType.TissueSample){
+                if(dnaSample.getKindOfUnit()!=null){
+                    label += dnaSample.getKindOfUnit()+separator;
+                }
+                Identifier<DnaSample> currentSampleDesignation = getCurrentSampleDesignation(dnaSample);
+                if(currentSampleDesignation!=null && currentSampleDesignation.getIdentifier()!=null){
+                    label += currentSampleDesignation.getIdentifier()+separator;
+                }
+                else{
+                    label += NO_SAMPLE_DESIGNATION+separator;
+                }
+            }
+
+        }
+        //DerivedUnit + TissueSample
+        else if(derivate instanceof DerivedUnit){
+            DerivedUnit derivedUnit = (DerivedUnit)derivate;
+            if(derivedUnit.getRecordBasis()==SpecimenOrObservationType.PreservedSpecimen){
+                //check for type designation
+                if(typeDesignations.get(derivedUnit)==null){
+                    for (SpecimenTypeDesignation specimenTypeDesignation : derivedUnit.getSpecimenTypeDesignations()) {
+                        addTypeDesignation(derivedUnit, specimenTypeDesignation);
+                    }
+                }
+                //java.util.Collection<FieldUnit> fieldUnits = CdmStore.getService(IOccurrenceService.class).getFieldUnits(derivedUnit.getUuid());
+                //TODO : This is not generic anymore for performance reasons
+                Set<SpecimenOrObservationBase> originals = derivedUnit.getOriginals();
+                if(originals!=null && originals.size() ==1) {
+                    SpecimenOrObservationBase specimen = originals.iterator().next();
+                    if(specimen instanceof FieldUnit) {
+                        FieldUnit fieldUnit = (FieldUnit)specimen;
+                        GatheringEvent gatheringEvent = fieldUnit.getGatheringEvent();
+                        if(gatheringEvent!=null){
+                            label += gatheringEvent.getCollector()!=null?gatheringEvent.getCollector()+separator:emptyString;
+                        }
+                        label += fieldUnit.getFieldNumber()!=null?fieldUnit.getFieldNumber()+separator:emptyString;
+                    }
+                }
+
+                eu.etaxonomy.cdm.model.occurrence.Collection collection = derivedUnit.getCollection();
+                if(collection!=null){
+                    label += collection.getCode()!=null?"("+collection.getCode()+")"+separator:emptyString;
+                }
+                String mostSignificantIdentifier = derivedUnit.getMostSignificantIdentifier();
+                label += mostSignificantIdentifier!=null?mostSignificantIdentifier+separator:emptyString;
+            }
+            else if(derivedUnit.getRecordBasis()==SpecimenOrObservationType.TissueSample){
+                //TissueSample should only be created by using it's own class
+                //in future using only one class with different SpecimenOrObservationTypes is desired
+//                label += derivedUnit.getKindOfUnit() + NO_SAMPLE_DESIGNATION;
+            }
+        }
+        //Sequence
+        else if(derivate instanceof Sequence){
+            Sequence sequence = (Sequence)derivate;
+            Identifier<DnaSample> currentSampleDesignation = getCurrentSampleDesignation(sequence);
+            if(currentSampleDesignation!=null && currentSampleDesignation.getIdentifier()!=null){
+                label += currentSampleDesignation.getIdentifier()+separator;
+            }
+            else{
+                label += NO_SAMPLE_DESIGNATION+separator;
+            }
+            label += sequence.getDnaMarker()!=null?sequence.getDnaMarker():emptyString;
+        }
+        //SingleRead
+        else if(derivate instanceof SingleRead){
+            SingleRead singleRead = (SingleRead)derivate;
+            if(parentNode!=null && parentNode.getValue() instanceof Sequence){
+                Sequence sequence = (Sequence) parentNode.getValue();
+                Identifier<DnaSample> currentSampleDesignation = getCurrentSampleDesignation(sequence);
+                if(currentSampleDesignation!=null && currentSampleDesignation.getIdentifier()!=null){
+                    label = currentSampleDesignation.getIdentifier()+separator;
+                }
+                else{
+                    label += NO_SAMPLE_DESIGNATION+separator;
+                }
+                label += singleRead.getPrimer()!=null?singleRead.getPrimer().getLabel()+separator:emptyString;
+                if(sequence!=null && sequence.getDnaMarker()!=null){
+                    label += sequence.getDnaMarker()+separator;
+                }
+                if(singleRead.getAmplificationResult()!=null && singleRead.getAmplificationResult().getAmplification()!=null){
+                    label += singleRead.getAmplificationResult().getAmplification().getLabelCache()+separator;
+                }
+            }
+        }
+        //SOOB
+        else if(derivate instanceof SpecimenOrObservationBase){
+            SpecimenOrObservationBase<?> specimen = (SpecimenOrObservationBase<?>) derivate;
+            SpecimenOrObservationType type = specimen.getRecordBasis();
+            return specimen.getTitleCache() + (type!=null?" ["+type.toString()+"]":emptyString);
+        }
+        if(label.isEmpty()){
+            label = derivate.toString();
+        }
+        //remove last comma
+        else if(label.endsWith(separator)){
+            label = label.substring(0, label.length()-separator.length());
+        }
+        return label;
+    }
+
+    @Override
+    public Image getImage(Object element) {
+        if(element instanceof TreeNode){
+            element = ((TreeNode) element).getValue();
+        }
+        if(element instanceof CdmBase){
+            CdmBase cdmBase = (CdmBase)element;
+            boolean hasCharacterData = false;
+            if(cdmBase.isInstanceOf(SpecimenOrObservationBase.class)){
+                SpecimenOrObservationBase<?> specimen = HibernateProxyHelper.deproxy(cdmBase, SpecimenOrObservationBase.class);
+                if(specimen.hasCharacterData()){
+                    hasCharacterData = true;
+                }
+            }
+            if(cdmBase.isInstanceOf(FieldUnit.class)){
+                return hasCharacterData?ImageResources.getImage(ImageResources.FIELD_UNIT_CHARACTER_DATA):ImageResources.getImage(ImageResources.FIELD_UNIT);
+            }
+            else if(cdmBase.isInstanceOf(DerivedUnit.class)){
+                DerivedUnit derivedUnit = HibernateProxyHelper.deproxy(element, DerivedUnit.class);
+
+                if(derivedUnit.getRecordBasis()==SpecimenOrObservationType.FieldUnit){
+                    return hasCharacterData?ImageResources.getImage(ImageResources.FIELD_UNIT_CHARACTER_DATA):ImageResources.getImage(ImageResources.FIELD_UNIT);
+                }
+                else if(derivedUnit.getRecordBasis()==SpecimenOrObservationType.DnaSample){
+                    return hasCharacterData?ImageResources.getImage(ImageResources.DNA_SAMPLE_DERIVATE_CHARACTER_DATA):ImageResources.getImage(ImageResources.DNA_SAMPLE_DERIVATE);
+                }
+                else if(derivedUnit.getRecordBasis()==SpecimenOrObservationType.TissueSample){
+                    return hasCharacterData?ImageResources.getImage(ImageResources.TISSUE_SAMPLE_DERIVATE_CHARACTER_DATA):ImageResources.getImage(ImageResources.TISSUE_SAMPLE_DERIVATE);
+                }
+                else if(derivedUnit.getRecordBasis()==SpecimenOrObservationType.PreservedSpecimen){
+                    if(typeDesignations.get(derivedUnit)!=null && !typeDesignations.get(derivedUnit).isEmpty()){
+                        return ImageResources.getImage(ImageResources.SPECIMEN_DERIVATE_TYPE);
+                    }
+                    return hasCharacterData?ImageResources.getImage(ImageResources.SPECIMEN_DERIVATE_CHARACTER_DATA):ImageResources.getImage(ImageResources.SPECIMEN_DERIVATE);
+                }
+                else if(derivedUnit.getRecordBasis().isMedia()
+                        || derivedUnit.getRecordBasis().isKindOf(SpecimenOrObservationType.Media)){
+                    if(derivedUnit.getKindOfUnit()!=null){
+                        if(derivedUnit.getKindOfUnit().equals(getArtworkTerm())){
+                            return hasCharacterData?ImageResources.getImage(ImageResources.ARTWORK_DERIVATE_CHARACTER_DATA):ImageResources.getImage(ImageResources.ARTWORK_DERIVATE);
+                        }
+                        else if(derivedUnit.getKindOfUnit().equals(getLivingPlantPhotoTerm())){
+                            return hasCharacterData?ImageResources.getImage(ImageResources.LIVING_PLANT_PHOTO_DERIVATE_CHARACTER_DATA):ImageResources.getImage(ImageResources.LIVING_PLANT_PHOTO_DERIVATE);
+                        }
+                        else if(derivedUnit.getKindOfUnit().equals(getSpecimenScanTerm())){
+                            return hasCharacterData?ImageResources.getImage(ImageResources.SPECIMEN_SCAN_DERIVATE_CHARACTER_DATA):ImageResources.getImage(ImageResources.SPECIMEN_SCAN_DERIVATE);
+                        }
+                        else if(derivedUnit.getKindOfUnit().equals(getDetailImageTerm())){
+                            return hasCharacterData?ImageResources.getImage(ImageResources.DETAIL_IMAGE_DERIVATE_CHARACTER_DATA):ImageResources.getImage(ImageResources.DETAIL_IMAGE_DERIVATE);
+                        }
+                    }
+                }
+            }
+            else if(cdmBase.isInstanceOf(Sequence.class)){
+                return ImageResources.getImage(ImageResources.SEQUENCE_DERIVATE);
+            }
+
+            else if(cdmBase.isInstanceOf(SingleRead.class)){
+                if(multiLinkSingleReads!=null && multiLinkSingleReads.contains(element)){
+                    return ImageResources.getImage(ImageResources.SINGLE_READ_DERIVATE_MULTILINK);
+                }
+                else{
+                    return ImageResources.getImage(ImageResources.SINGLE_READ_DERIVATE);
+                }
+            }
+        }
+        return ImageResources.getImage(ImageResources.DEFAULT_DERIVATIVE);
+    }
+
+    public static Identifier<DnaSample> getCurrentSampleDesignation(CdmBase entity) {
+        if(entity.isInstanceOf(DnaSample.class)){
+            DnaSample dnaSample = HibernateProxyHelper.deproxy(entity, DnaSample.class);
+            for (Identifier<DnaSample> identifier : dnaSample.getIdentifiers()) {
+                if(identifier.getType()!=null && identifier.getType().equals(DerivateLabelProvider.getSampleDesignationTerm())){
+                    //first sample designation is the current
+                    return identifier;
+                }
+            }
+        }
+        else if(entity.isInstanceOf(Sequence.class)){
+            Sequence sequence = HibernateProxyHelper.deproxy(entity, Sequence.class);
+            if(sequence.getDnaSample()!=null){
+                return getCurrentSampleDesignation(sequence.getDnaSample());
+            }
+        }
+        return null;
+    }
+
+    private static void addTypeDesignation(DerivedUnit derivedUnit, SpecimenTypeDesignation typeDesignation){
+        Collection<SpecimenTypeDesignation> list = typeDesignations.get(derivedUnit);
+        if(list==null){
+            list = new ArrayList<SpecimenTypeDesignation>();
+        }
+        list.add(typeDesignation);
+        typeDesignations.put(derivedUnit, list);
+    }
+
+    public static Set<SingleRead> getMultiLinkSingleReads() {
+        return multiLinkSingleReads;
+    }
+
+    public void updateLabelCache(Collection<SpecimenOrObservationBase<?>> rootElements) {
+        multiLinkSingleReads = new HashSet<SingleRead>();
+        typeDesignations = new HashMap<DerivedUnit, Collection<SpecimenTypeDesignation>>();
+        for(Entry<SingleRead, Collection<Sequence>> entry:CdmStore.getService(ISequenceService.class).getSingleReadSequencesMap().entrySet()){
+            if(entry.getValue().size()>1){
+                multiLinkSingleReads.add(entry.getKey());
+            }
+        }
+        if(rootElements!=null){
+            Collection<DerivedUnit> derivedUnits = new ArrayList<DerivedUnit>();
+            for (SpecimenOrObservationBase specimenOrObservationBase : rootElements) {
+                List<DerivedUnit> childUnits = CdmStore.getService(IOccurrenceService.class).getAllChildDerivatives(specimenOrObservationBase.getUuid());
+                if (childUnits != null){
+                    derivedUnits.addAll(childUnits);
+                }
+                if(specimenOrObservationBase.isInstanceOf(DerivedUnit.class)){
+                    specimenOrObservationBase = CdmStore.getService(IOccurrenceService.class).load(specimenOrObservationBase.getUuid());
+                    if (specimenOrObservationBase != null){
+                        derivedUnits.add(HibernateProxyHelper.deproxy(specimenOrObservationBase, DerivedUnit.class));
+                    }
+                }
+            }
+            for (DerivedUnit derivedUnit : derivedUnits) {
+                if(!derivedUnit.getSpecimenTypeDesignations().isEmpty()){
+                    typeDesignations.put(derivedUnit, derivedUnit.getSpecimenTypeDesignations());
+                }
+            }
+        }
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/search/specimen/SpecimenProviderSelectionComposite.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/search/specimen/SpecimenProviderSelectionComposite.java
new file mode 100644
index 000000000..dd09377e3
--- /dev/null
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/search/specimen/SpecimenProviderSelectionComposite.java
@@ -0,0 +1,99 @@
+/**
+* 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.view.search.specimen;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
+
+import eu.etaxonomy.cdm.model.metadata.CdmPreference;
+import eu.etaxonomy.taxeditor.preference.EditorPreferencePredicate;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+
+/**
+ * @author pplitzner
+ * @date 22.05.2014
+ *
+ */
+public class SpecimenProviderSelectionComposite extends Composite {
+
+    private final FormToolkit toolkit = new FormToolkit(Display.getCurrent());
+    private final Combo txtAccessPoint;
+    private final Button btnGbif;
+    private final Button btnBioCaseProvider;
+    private final Label lblAccessPointUrl;
+
+    /**
+     * Create the composite.
+     * @param parent
+     * @param style
+     */
+    public SpecimenProviderSelectionComposite(Composite parent, int style) {
+        super(parent, style);
+        addDisposeListener(new DisposeListener() {
+            @Override
+            public void widgetDisposed(DisposeEvent e) {
+                toolkit.dispose();
+            }
+        });
+        toolkit.adapt(this);
+        toolkit.paintBordersFor(this);
+        {
+            TableWrapLayout tableWrapLayout = new TableWrapLayout();
+            tableWrapLayout.numColumns = 2;
+            setLayout(tableWrapLayout);
+        }
+
+        btnGbif = new Button(this, SWT.RADIO);
+        toolkit.adapt(btnGbif, true, true);
+        btnGbif.setText("GBIF");
+        new Label(this, SWT.NONE);
+
+        btnBioCaseProvider = new Button(this, SWT.RADIO);
+        toolkit.adapt(btnBioCaseProvider, true, true);
+        btnBioCaseProvider.setText("BioCASE Provider");
+        txtAccessPoint = new Combo(this, SWT.BORDER);
+        CdmPreference biocaseProvider = PreferencesUtil.getPreferenceFromDB(EditorPreferencePredicate.BioCaseProvider);
+        if (biocaseProvider != null){
+            String items[] = biocaseProvider.getValue().split(";");
+            txtAccessPoint.setItems(items);
+        }
+
+
+        txtAccessPoint.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+        toolkit.adapt(txtAccessPoint, true, true);
+
+        lblAccessPointUrl = new Label(this, SWT.NONE);
+        lblAccessPointUrl.setLayoutData(new TableWrapData(TableWrapData.LEFT, TableWrapData.MIDDLE, 1, 1));
+        toolkit.adapt(lblAccessPointUrl, true, true);
+        lblAccessPointUrl.setText("Access Point URL");
+
+    }
+
+    public Button getBtnGbif() {
+        return btnGbif;
+    }
+    public Button getBtnBioCaseProvider() {
+        return btnBioCaseProvider;
+    }
+    public Combo getTxtAccessPoint() {
+        return txtAccessPoint;
+    }
+    public Label getLblAccessPointUrl() {
+        return lblAccessPointUrl;
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/search/specimen/SpecimenProviderSelectionController.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/search/specimen/SpecimenProviderSelectionController.java
new file mode 100644
index 000000000..51f12af7e
--- /dev/null
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/search/specimen/SpecimenProviderSelectionController.java
@@ -0,0 +1,111 @@
+/**
+* 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.view.search.specimen;
+
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+
+/**
+ * Controller class for handling {@link SpecimenProviderSelectionComposite}
+ * @author pplitzner
+ * @date 22.05.2014
+ *
+ */
+public class SpecimenProviderSelectionController implements Listener{
+
+    private SpecimenProviderSelectionComposite composite;
+    private IWizard wizard;
+    private String lastAccessPoint;
+
+    private static SpecimenProviderSelectionController instance;
+
+    public static SpecimenProviderSelectionController getInstance(Composite parent, IWizard wizard){
+        if(instance==null){
+            instance = new SpecimenProviderSelectionController(parent, wizard);
+            return instance;
+        }
+        instance.init(parent, wizard);
+        return instance;
+    }
+
+
+    /**
+     * Constructs a new controller which will itself construct the composite
+     * @param parent the parent {@link Composite} for the one handles by this controller
+     */
+    private SpecimenProviderSelectionController(Composite parent, IWizard wizard) {
+        init(parent, wizard);
+    }
+
+    /**
+     * @param parent
+     * @param wizard
+     */
+    private void init(Composite parent, IWizard wizard) {
+        this.wizard = wizard;
+        composite = new SpecimenProviderSelectionComposite(parent, SWT.NONE);
+        composite.getBtnBioCaseProvider().addListener(SWT.Selection, this);
+        composite.getBtnGbif().addListener(SWT.Selection, this);
+        composite.getTxtAccessPoint().addListener(SWT.Modify, this);
+        composite.getBtnGbif().setSelection(true);
+        composite.getTxtAccessPoint().setEnabled(false);
+        composite.getLblAccessPointUrl().setEnabled(false);
+
+        loadLastState();
+    }
+
+    private void loadLastState() {
+        if(lastAccessPoint!=null){
+            Combo text = composite.getTxtAccessPoint();
+            Listener[] listeners = text.getListeners(SWT.Modify);
+            for (int i = 0; i < listeners.length; i++) {
+                text.removeListener(SWT.Modify, listeners[i]);
+            }
+            text.setText(lastAccessPoint);
+            for (int i = 0; i < listeners.length; i++) {
+                text.addListener(SWT.Modify, listeners[i]);
+            }
+
+        }
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
+     */
+    @Override
+    public void handleEvent(Event event) {
+        if(event.widget==composite.getBtnBioCaseProvider()){
+            composite.getTxtAccessPoint().setEnabled(true);
+            composite.getLblAccessPointUrl().setEnabled(true);
+        }
+        else if(event.widget==composite.getBtnGbif()){
+            composite.getLblAccessPointUrl().setEnabled(false);
+            composite.getTxtAccessPoint().setEnabled(false);
+        }
+        wizard.getContainer().updateButtons();
+    }
+
+    /**
+     * @return the composite
+     */
+    public SpecimenProviderSelectionComposite getComposite() {
+        return composite;
+    }
+
+
+    public void saveLastState() {
+        lastAccessPoint = composite.getTxtAccessPoint().getText();
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/search/specimen/SpecimenSearchComposite.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/search/specimen/SpecimenSearchComposite.java
new file mode 100644
index 000000000..2e49fda49
--- /dev/null
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/search/specimen/SpecimenSearchComposite.java
@@ -0,0 +1,176 @@
+/**
+* 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.view.search.specimen;
+
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.DateTime;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
+
+import eu.etaxonomy.cdm.model.location.Country;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+
+/**
+ * @author pplitzner
+ * @date 03.09.2013
+ *
+ */
+public class SpecimenSearchComposite extends Composite {
+    private final FormToolkit formToolkit = new FormToolkit(Display.getDefault());
+    private final Text textTaxonName;
+    private final Text textCollector;
+    private final Text textCollectorNumber;
+    private final Text textAccessionNumber;
+    private final Text textLocality;
+    private final Text textHerbarium;
+    private final Combo textCountry;
+    private final DateTime dateFrom;
+    private final DateTime dateTo;
+    private final Button btnShowDate;
+
+    /**
+     * Create the composite.
+     * @param parent
+     * @setBackgroundMode(SWT.INHERIT_DEFAULT);
+        param style
+     */
+    public SpecimenSearchComposite(Composite parent, int style) {
+        super(parent, style);
+        {
+            TableWrapLayout tableWrapLayout = new TableWrapLayout();
+            tableWrapLayout.numColumns = 2;
+            setLayout(tableWrapLayout);
+        }
+        CdmFormFactory formFactory = new CdmFormFactory(parent.getDisplay());
+        Label lblTaxonName = new Label(this, SWT.NONE);
+        lblTaxonName.setText("Taxon Name");
+
+        textTaxonName = new Text(this, SWT.NONE);
+        textTaxonName.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+        Label lblCollectors = new Label(this, SWT.NONE);
+        lblCollectors.setText("Collector(s)");
+
+        textCollector = new Text(this, SWT.NONE);
+        textCollector.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+        formToolkit.adapt(textCollector, true, true);
+
+        Label lblCollectorsNumber = new Label(this, SWT.NONE);
+        lblCollectorsNumber.setText("Collector(s) Number");
+
+        textCollectorNumber = new Text(this, SWT.NONE);
+        textCollectorNumber.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+        formToolkit.adapt(textCollectorNumber, true, true);
+
+        Label lblAccessionNumber = new Label(this, SWT.NONE);
+        lblAccessionNumber.setText("Accession Number");
+
+        textAccessionNumber = new Text(this, SWT.NONE);
+        textAccessionNumber.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+        formToolkit.adapt(textAccessionNumber, true, true);
+
+        Label lblHerbarium = new Label(this, SWT.NONE);
+        lblHerbarium.setText("Collection");
+
+        textHerbarium = new Text(this, SWT.NONE);
+        textHerbarium.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+
+        Label lblCountry = new Label(this, SWT.NONE);
+        lblCountry.setText("Country");
+
+        textCountry = new Combo(this, SWT.NONE);
+        textCountry.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+        List<Country> items = CdmStore.getTermManager().getPreferredTerms(Country.class);
+        String[] itemsArray = new String[items.size()];
+        int i = 0;
+        for (Country country: items){
+            itemsArray[i]= country.getIso3166_A2() + " - " + country.getLabel();
+            i++;
+        }
+
+        textCountry.setItems(itemsArray);
+
+
+
+        Label lblLocality = new Label(this, SWT.NONE);
+        lblLocality.setText("Locality");
+
+        textLocality = new Text(this, SWT.NONE);
+        textLocality.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
+        formToolkit.adapt(textLocality, true, true);
+
+        Label lblCollectionDate = new Label(this, SWT.NONE);
+        lblCollectionDate.setText("Collection Date");
+
+        btnShowDate = new Button(this, SWT.CHECK);
+
+        Label lblFrom = new Label(this, SWT.NONE);
+        lblFrom.setLayoutData(new TableWrapData(TableWrapData.RIGHT, TableWrapData.TOP, 1, 1));
+        lblFrom.setText("from");
+
+        dateFrom = new DateTime(this, SWT.SHORT);
+        dateFrom.setLayoutData(new TableWrapData(TableWrapData.FILL, TableWrapData.TOP, 1, 1));
+        formToolkit.paintBordersFor(dateFrom);
+
+        Label lblTo = new Label(this, SWT.NONE);
+        lblTo.setLayoutData(new TableWrapData(TableWrapData.RIGHT, TableWrapData.TOP, 1, 1));
+        lblTo.setText("to");
+
+        dateTo = new DateTime(this, SWT.SHORT);
+        dateTo.setLayoutData(new TableWrapData(TableWrapData.FILL, TableWrapData.TOP, 1, 1));
+        formToolkit.paintBordersFor(dateTo);
+
+    }
+
+    @Override
+    protected void checkSubclass() {
+        // Disable the check that prevents subclassing of SWT components
+    }
+
+    public Text getTextTaxonName() {
+        return textTaxonName;
+    }
+    public Text getTextCollector() {
+        return textCollector;
+    }
+    public Text getTextCollectorNumber() {
+        return textCollectorNumber;
+    }
+    public Text getTextAccessionNumber() {
+        return textAccessionNumber;
+    }
+    public Text getTextHerbarium() {
+        return textHerbarium;
+    }
+    public Combo getTextCountry() {
+        return textCountry;
+    }
+    public Text getTextLocality() {
+        return textLocality;
+    }
+    public DateTime getDateFrom() {
+        return dateFrom;
+    }
+    public DateTime getDateTo() {
+        return dateTo;
+    }
+    public Button getBtnShowDate() {
+        return btnShowDate;
+    }
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/search/specimen/SpecimenSearchController.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/search/specimen/SpecimenSearchController.java
new file mode 100644
index 000000000..f897a5c96
--- /dev/null
+++ b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/search/specimen/SpecimenSearchController.java
@@ -0,0 +1,208 @@
+/**
+* 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.view.search.specimen;
+
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+
+import eu.etaxonomy.cdm.ext.occurrence.OccurenceQuery;
+
+/**
+ * Controller class for handling a {@link SpecimenSearchComposite}.
+ * @author pplitzner
+ * @date 03.09.2013
+ *
+ */
+public class SpecimenSearchController implements Listener{
+
+    private SpecimenSearchComposite specimenSearchComposite;
+    private OccurenceQuery lastQuery = null;
+
+    private static SpecimenSearchController instance = null;
+
+    public static SpecimenSearchController getInstance(Composite parent){
+        if(instance==null){
+            instance = new SpecimenSearchController(parent);
+            return instance;
+        }
+        instance.init(parent);
+        return instance;
+    }
+
+    /**
+     * Constructs a new controller which will itself construct the composite
+     * @param parent the parent {@link Composite} for the one handles by this controller
+     */
+    private SpecimenSearchController(Composite parent) {
+        init(parent);
+    }
+
+    private void init(Composite parent){
+        this.specimenSearchComposite = new SpecimenSearchComposite(parent, SWT.NONE);
+        this.specimenSearchComposite.addListener(SWT.Selection, this);
+        specimenSearchComposite.getBtnShowDate().addListener(SWT.Selection, this);
+        specimenSearchComposite.getBtnShowDate().setSelection(false);
+        specimenSearchComposite.getDateFrom().setEnabled(false);
+        specimenSearchComposite.getDateTo().setEnabled(false);
+
+        loadLastState();
+    }
+
+    /* (non-Javadoc)
+     * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
+     */
+    @Override
+    public void handleEvent(Event event) {
+        Button btnShowDate = specimenSearchComposite.getBtnShowDate();
+        if(event.widget==btnShowDate){
+            specimenSearchComposite.getDateFrom().setEnabled(btnShowDate.getSelection());
+            specimenSearchComposite.getDateTo().setEnabled(btnShowDate.getSelection());
+        }
+    }
+
+
+    private void loadLastState(){
+        if(lastQuery!=null){
+            specimenSearchComposite.getTextAccessionNumber().setText(lastQuery.accessionNumber);
+            specimenSearchComposite.getTextCollector().setText(lastQuery.collector);
+            specimenSearchComposite.getTextCollectorNumber().setText(lastQuery.collectorsNumber);
+            specimenSearchComposite.getTextCountry().setText(lastQuery.country);
+            specimenSearchComposite.getTextHerbarium().setText(lastQuery.herbarium);
+            specimenSearchComposite.getTextLocality().setText(lastQuery.locality);
+            specimenSearchComposite.getTextTaxonName().setText(lastQuery.taxonName);
+            if(lastQuery.dateFrom!=null){
+                specimenSearchComposite.getDateFrom().setDate(lastQuery.dateFrom.get(Calendar.YEAR), lastQuery.dateFrom.get(Calendar.MONTH), lastQuery.dateFrom.get(Calendar.DAY_OF_MONTH));
+            }
+            if(lastQuery.dateTo!=null){
+                specimenSearchComposite.getDateTo().setDate(lastQuery.dateTo.get(Calendar.YEAR), lastQuery.dateTo.get(Calendar.MONTH), lastQuery.dateTo.get(Calendar.DAY_OF_MONTH));
+            }
+        }
+    }
+
+    public void saveLastSate() {
+        lastQuery = new OccurenceQuery(getTaxonName(), getCollector(), getCollectorNumber(), getAccessionNumber(), getHerbarium(), getCountry(false), getLocality(), getDateFrom(), getDateTo(), false);
+    }
+
+    /**
+     * Returns the {@link Composite} handled by this controller
+     * @return
+     */
+    public Composite getComposite() {
+        return specimenSearchComposite;
+    }
+
+    /**
+     * Returns the taxon name entered in the search view
+     * @return the taxon name as a {@link String}
+     * @see eu.etaxonomy.taxeditor.view.search.specimen.SpecimenSearchComposite#getTextTaxonName()
+     */
+    public String getTaxonName() {
+        return specimenSearchComposite.getTextTaxonName().getText();
+    }
+
+    /**
+     * Returns the collector entered in the search view
+     * @return the collector as a {@link String}
+     * @see eu.etaxonomy.taxeditor.view.search.specimen.SpecimenSearchComposite#getTextCollector()
+     */
+    public String getCollector() {
+        return specimenSearchComposite.getTextCollector().getText();
+    }
+
+    /**
+     * Returns the collecting number entered in the search view
+     * @return the collecting as a {@link String}
+     * @see eu.etaxonomy.taxeditor.view.search.specimen.SpecimenSearchComposite#getTextCollectorNumber()
+     */
+    public String getCollectorNumber() {
+        return specimenSearchComposite.getTextCollectorNumber().getText();
+    }
+
+    /**
+     * Returns the accession number entered in the search view
+     * @return the accession number as a {@link String}
+     * @see eu.etaxonomy.taxeditor.view.search.specimen.SpecimenSearchComposite#getTextAccessionNumber()
+     */
+    public String getAccessionNumber() {
+        return specimenSearchComposite.getTextAccessionNumber().getText();
+    }
+
+    /**
+     * Returns the herbarium entered in the search view
+     * @return the herbarium as a {@link String}
+     * @see eu.etaxonomy.taxeditor.view.search.specimen.SpecimenSearchComposite#getComboHerbarium()
+     */
+    public String getHerbarium() {
+        return specimenSearchComposite.getTextHerbarium().getText();
+    }
+
+    /**
+     * Returns the country entered in the search view
+     * @return the country as a {@link String}
+     * @see eu.etaxonomy.taxeditor.view.search.specimen.SpecimenSearchComposite#getComboCountry()
+     */
+    public String getCountry(boolean biocase) {
+
+        String result = specimenSearchComposite.getTextCountry().getText();
+        if (result.contains("-") && biocase){
+            result = result.substring(4).trim();
+        }else if (result.contains("-")){
+            result = result.substring(0,2).trim();
+        }
+        return result;
+
+//        return specimenSearchComposite.getComboCountry().getItem(specimenSearchComposite.getComboCountry().getSelectionIndex());
+    }
+
+    /**
+     * Returns the locality entered in the search view
+     * @return the locality as a {@link String}
+     * @see eu.etaxonomy.taxeditor.view.search.specimen.SpecimenSearchComposite#getTextLocality()
+     */
+    public String getLocality() {
+        return specimenSearchComposite.getTextLocality().getText();
+    }
+
+    /**
+     * Returns the start date entered in the search view.
+     * @return the date as an instance of {@link Calendar}
+     * @see eu.etaxonomy.taxeditor.view.search.specimen.SpecimenSearchComposite#getDateFrom()
+     */
+    public Calendar getDateFrom() {
+        if(specimenSearchComposite.getBtnShowDate().getSelection()){
+            Calendar dateFrom = new GregorianCalendar();
+            dateFrom.clear();
+            dateFrom.set(specimenSearchComposite.getDateFrom().getYear(), specimenSearchComposite.getDateFrom().getMonth(), specimenSearchComposite.getDateFrom().getDay());
+            return dateFrom;
+        }
+        return null;
+    }
+
+    /**
+     * Returns the end date entered in the search view.
+     * @return the date as an instance of {@link Calendar}
+     * @see eu.etaxonomy.taxeditor.view.search.specimen.SpecimenSearchComposite#getDateTo()
+     */
+    public Calendar getDateTo() {
+        if(specimenSearchComposite.getBtnShowDate().getSelection()){
+            Calendar dateTo = new GregorianCalendar();
+            dateTo.clear();
+            dateTo.set(specimenSearchComposite.getDateTo().getYear(), specimenSearchComposite.getDateTo().getMonth(), specimenSearchComposite.getDateTo().getDay());
+            return dateTo;
+        }
+        return null;
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/specimenSearch/SpecimenProviderSelectionComposite.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/specimenSearch/SpecimenProviderSelectionComposite.java
deleted file mode 100644
index b324ca0d4..000000000
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/specimenSearch/SpecimenProviderSelectionComposite.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/**
-* 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.view.specimenSearch;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.TableWrapData;
-import org.eclipse.ui.forms.widgets.TableWrapLayout;
-
-import eu.etaxonomy.cdm.model.metadata.CdmPreference;
-import eu.etaxonomy.taxeditor.preference.EditorPreferencePredicate;
-import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
-
-/**
- * @author pplitzner
- * @date 22.05.2014
- *
- */
-public class SpecimenProviderSelectionComposite extends Composite {
-
-    private final FormToolkit toolkit = new FormToolkit(Display.getCurrent());
-    private final Combo txtAccessPoint;
-    private final Button btnGbif;
-    private final Button btnBioCaseProvider;
-    private final Label lblAccessPointUrl;
-
-    /**
-     * Create the composite.
-     * @param parent
-     * @param style
-     */
-    public SpecimenProviderSelectionComposite(Composite parent, int style) {
-        super(parent, style);
-        addDisposeListener(new DisposeListener() {
-            @Override
-            public void widgetDisposed(DisposeEvent e) {
-                toolkit.dispose();
-            }
-        });
-        toolkit.adapt(this);
-        toolkit.paintBordersFor(this);
-        {
-            TableWrapLayout tableWrapLayout = new TableWrapLayout();
-            tableWrapLayout.numColumns = 2;
-            setLayout(tableWrapLayout);
-        }
-
-        btnGbif = new Button(this, SWT.RADIO);
-        toolkit.adapt(btnGbif, true, true);
-        btnGbif.setText("GBIF");
-        new Label(this, SWT.NONE);
-
-        btnBioCaseProvider = new Button(this, SWT.RADIO);
-        toolkit.adapt(btnBioCaseProvider, true, true);
-        btnBioCaseProvider.setText("BioCASE Provider");
-        txtAccessPoint = new Combo(this, SWT.BORDER);
-        CdmPreference biocaseProvider = PreferencesUtil.getPreferenceFromDB(EditorPreferencePredicate.BioCaseProvider);
-        if (biocaseProvider != null){
-            String items[] = biocaseProvider.getValue().split(";");
-            txtAccessPoint.setItems(items);
-        }
-
-
-        txtAccessPoint.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
-        toolkit.adapt(txtAccessPoint, true, true);
-
-        lblAccessPointUrl = new Label(this, SWT.NONE);
-        lblAccessPointUrl.setLayoutData(new TableWrapData(TableWrapData.LEFT, TableWrapData.MIDDLE, 1, 1));
-        toolkit.adapt(lblAccessPointUrl, true, true);
-        lblAccessPointUrl.setText("Access Point URL");
-
-    }
-
-    public Button getBtnGbif() {
-        return btnGbif;
-    }
-    public Button getBtnBioCaseProvider() {
-        return btnBioCaseProvider;
-    }
-    public Combo getTxtAccessPoint() {
-        return txtAccessPoint;
-    }
-    public Label getLblAccessPointUrl() {
-        return lblAccessPointUrl;
-    }
-}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/specimenSearch/SpecimenProviderSelectionController.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/specimenSearch/SpecimenProviderSelectionController.java
deleted file mode 100644
index 916402d84..000000000
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/specimenSearch/SpecimenProviderSelectionController.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/**
-* 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.view.specimenSearch;
-
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-
-/**
- * Controller class for handling {@link SpecimenProviderSelectionComposite}
- * @author pplitzner
- * @date 22.05.2014
- *
- */
-public class SpecimenProviderSelectionController implements Listener{
-
-    private SpecimenProviderSelectionComposite composite;
-    private IWizard wizard;
-    private String lastAccessPoint;
-
-    private static SpecimenProviderSelectionController instance;
-
-    public static SpecimenProviderSelectionController getInstance(Composite parent, IWizard wizard){
-        if(instance==null){
-            instance = new SpecimenProviderSelectionController(parent, wizard);
-            return instance;
-        }
-        instance.init(parent, wizard);
-        return instance;
-    }
-
-
-    /**
-     * Constructs a new controller which will itself construct the composite
-     * @param parent the parent {@link Composite} for the one handles by this controller
-     */
-    private SpecimenProviderSelectionController(Composite parent, IWizard wizard) {
-        init(parent, wizard);
-    }
-
-    /**
-     * @param parent
-     * @param wizard
-     */
-    private void init(Composite parent, IWizard wizard) {
-        this.wizard = wizard;
-        composite = new SpecimenProviderSelectionComposite(parent, SWT.NONE);
-        composite.getBtnBioCaseProvider().addListener(SWT.Selection, this);
-        composite.getBtnGbif().addListener(SWT.Selection, this);
-        composite.getTxtAccessPoint().addListener(SWT.Modify, this);
-        composite.getBtnGbif().setSelection(true);
-        composite.getTxtAccessPoint().setEnabled(false);
-        composite.getLblAccessPointUrl().setEnabled(false);
-
-        loadLastState();
-    }
-
-    private void loadLastState() {
-        if(lastAccessPoint!=null){
-            Combo text = composite.getTxtAccessPoint();
-            Listener[] listeners = text.getListeners(SWT.Modify);
-            for (int i = 0; i < listeners.length; i++) {
-                text.removeListener(SWT.Modify, listeners[i]);
-            }
-            text.setText(lastAccessPoint);
-            for (int i = 0; i < listeners.length; i++) {
-                text.addListener(SWT.Modify, listeners[i]);
-            }
-
-        }
-    }
-
-
-    /* (non-Javadoc)
-     * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
-     */
-    @Override
-    public void handleEvent(Event event) {
-        if(event.widget==composite.getBtnBioCaseProvider()){
-            composite.getTxtAccessPoint().setEnabled(true);
-            composite.getLblAccessPointUrl().setEnabled(true);
-        }
-        else if(event.widget==composite.getBtnGbif()){
-            composite.getLblAccessPointUrl().setEnabled(false);
-            composite.getTxtAccessPoint().setEnabled(false);
-        }
-        wizard.getContainer().updateButtons();
-    }
-
-    /**
-     * @return the composite
-     */
-    public SpecimenProviderSelectionComposite getComposite() {
-        return composite;
-    }
-
-
-    public void saveLastState() {
-        lastAccessPoint = composite.getTxtAccessPoint().getText();
-    }
-
-}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/specimenSearch/SpecimenSearchComposite.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/specimenSearch/SpecimenSearchComposite.java
deleted file mode 100644
index 76b11620c..000000000
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/specimenSearch/SpecimenSearchComposite.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/**
-* 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.view.specimenSearch;
-
-import java.util.List;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.DateTime;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.TableWrapData;
-import org.eclipse.ui.forms.widgets.TableWrapLayout;
-
-import eu.etaxonomy.cdm.model.location.Country;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-
-/**
- * @author pplitzner
- * @date 03.09.2013
- *
- */
-public class SpecimenSearchComposite extends Composite {
-    private final FormToolkit formToolkit = new FormToolkit(Display.getDefault());
-    private final Text textTaxonName;
-    private final Text textCollector;
-    private final Text textCollectorNumber;
-    private final Text textAccessionNumber;
-    private final Text textLocality;
-    private final Text textHerbarium;
-    private final Combo textCountry;
-    private final DateTime dateFrom;
-    private final DateTime dateTo;
-    private final Button btnShowDate;
-
-    /**
-     * Create the composite.
-     * @param parent
-     * @setBackgroundMode(SWT.INHERIT_DEFAULT);
-        param style
-     */
-    public SpecimenSearchComposite(Composite parent, int style) {
-        super(parent, style);
-        {
-            TableWrapLayout tableWrapLayout = new TableWrapLayout();
-            tableWrapLayout.numColumns = 2;
-            setLayout(tableWrapLayout);
-        }
-        CdmFormFactory formFactory = new CdmFormFactory(parent.getDisplay());
-        Label lblTaxonName = new Label(this, SWT.NONE);
-        lblTaxonName.setText("Taxon Name");
-
-        textTaxonName = new Text(this, SWT.NONE);
-        textTaxonName.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
-
-        Label lblCollectors = new Label(this, SWT.NONE);
-        lblCollectors.setText("Collector(s)");
-
-        textCollector = new Text(this, SWT.NONE);
-        textCollector.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
-        formToolkit.adapt(textCollector, true, true);
-
-        Label lblCollectorsNumber = new Label(this, SWT.NONE);
-        lblCollectorsNumber.setText("Collector(s) Number");
-
-        textCollectorNumber = new Text(this, SWT.NONE);
-        textCollectorNumber.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
-        formToolkit.adapt(textCollectorNumber, true, true);
-
-        Label lblAccessionNumber = new Label(this, SWT.NONE);
-        lblAccessionNumber.setText("Accession Number");
-
-        textAccessionNumber = new Text(this, SWT.NONE);
-        textAccessionNumber.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
-        formToolkit.adapt(textAccessionNumber, true, true);
-
-        Label lblHerbarium = new Label(this, SWT.NONE);
-        lblHerbarium.setText("Collection");
-
-        textHerbarium = new Text(this, SWT.NONE);
-        textHerbarium.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
-
-        Label lblCountry = new Label(this, SWT.NONE);
-        lblCountry.setText("Country");
-
-        textCountry = new Combo(this, SWT.NONE);
-        textCountry.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
-        List<Country> items = CdmStore.getTermManager().getPreferredTerms(Country.class);
-        String[] itemsArray = new String[items.size()];
-        int i = 0;
-        for (Country country: items){
-            itemsArray[i]= country.getIso3166_A2() + " - " + country.getLabel();
-            i++;
-        }
-
-        textCountry.setItems(itemsArray);
-
-
-
-        Label lblLocality = new Label(this, SWT.NONE);
-        lblLocality.setText("Locality");
-
-        textLocality = new Text(this, SWT.NONE);
-        textLocality.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP, 1, 1));
-        formToolkit.adapt(textLocality, true, true);
-
-        Label lblCollectionDate = new Label(this, SWT.NONE);
-        lblCollectionDate.setText("Collection Date");
-
-        btnShowDate = new Button(this, SWT.CHECK);
-
-        Label lblFrom = new Label(this, SWT.NONE);
-        lblFrom.setLayoutData(new TableWrapData(TableWrapData.RIGHT, TableWrapData.TOP, 1, 1));
-        lblFrom.setText("from");
-
-        dateFrom = new DateTime(this, SWT.SHORT);
-        dateFrom.setLayoutData(new TableWrapData(TableWrapData.FILL, TableWrapData.TOP, 1, 1));
-        formToolkit.paintBordersFor(dateFrom);
-
-        Label lblTo = new Label(this, SWT.NONE);
-        lblTo.setLayoutData(new TableWrapData(TableWrapData.RIGHT, TableWrapData.TOP, 1, 1));
-        lblTo.setText("to");
-
-        dateTo = new DateTime(this, SWT.SHORT);
-        dateTo.setLayoutData(new TableWrapData(TableWrapData.FILL, TableWrapData.TOP, 1, 1));
-        formToolkit.paintBordersFor(dateTo);
-
-    }
-
-    @Override
-    protected void checkSubclass() {
-        // Disable the check that prevents subclassing of SWT components
-    }
-
-    public Text getTextTaxonName() {
-        return textTaxonName;
-    }
-    public Text getTextCollector() {
-        return textCollector;
-    }
-    public Text getTextCollectorNumber() {
-        return textCollectorNumber;
-    }
-    public Text getTextAccessionNumber() {
-        return textAccessionNumber;
-    }
-    public Text getTextHerbarium() {
-        return textHerbarium;
-    }
-    public Combo getTextCountry() {
-        return textCountry;
-    }
-    public Text getTextLocality() {
-        return textLocality;
-    }
-    public DateTime getDateFrom() {
-        return dateFrom;
-    }
-    public DateTime getDateTo() {
-        return dateTo;
-    }
-    public Button getBtnShowDate() {
-        return btnShowDate;
-    }
-}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/specimenSearch/SpecimenSearchController.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/specimenSearch/SpecimenSearchController.java
deleted file mode 100644
index 6fa355905..000000000
--- a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/specimenSearch/SpecimenSearchController.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/**
-* 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.view.specimenSearch;
-
-import java.util.Calendar;
-import java.util.GregorianCalendar;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-
-import eu.etaxonomy.cdm.ext.occurrence.OccurenceQuery;
-
-/**
- * Controller class for handling a {@link SpecimenSearchComposite}.
- * @author pplitzner
- * @date 03.09.2013
- *
- */
-public class SpecimenSearchController implements Listener{
-
-    private SpecimenSearchComposite specimenSearchComposite;
-    private OccurenceQuery lastQuery = null;
-
-    private static SpecimenSearchController instance = null;
-
-    public static SpecimenSearchController getInstance(Composite parent){
-        if(instance==null){
-            instance = new SpecimenSearchController(parent);
-            return instance;
-        }
-        instance.init(parent);
-        return instance;
-    }
-
-    /**
-     * Constructs a new controller which will itself construct the composite
-     * @param parent the parent {@link Composite} for the one handles by this controller
-     */
-    private SpecimenSearchController(Composite parent) {
-        init(parent);
-    }
-
-    private void init(Composite parent){
-        this.specimenSearchComposite = new SpecimenSearchComposite(parent, SWT.NONE);
-        this.specimenSearchComposite.addListener(SWT.Selection, this);
-        specimenSearchComposite.getBtnShowDate().addListener(SWT.Selection, this);
-        specimenSearchComposite.getBtnShowDate().setSelection(false);
-        specimenSearchComposite.getDateFrom().setEnabled(false);
-        specimenSearchComposite.getDateTo().setEnabled(false);
-
-        loadLastState();
-    }
-
-    /* (non-Javadoc)
-     * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
-     */
-    @Override
-    public void handleEvent(Event event) {
-        Button btnShowDate = specimenSearchComposite.getBtnShowDate();
-        if(event.widget==btnShowDate){
-            specimenSearchComposite.getDateFrom().setEnabled(btnShowDate.getSelection());
-            specimenSearchComposite.getDateTo().setEnabled(btnShowDate.getSelection());
-        }
-    }
-
-
-    private void loadLastState(){
-        if(lastQuery!=null){
-            specimenSearchComposite.getTextAccessionNumber().setText(lastQuery.accessionNumber);
-            specimenSearchComposite.getTextCollector().setText(lastQuery.collector);
-            specimenSearchComposite.getTextCollectorNumber().setText(lastQuery.collectorsNumber);
-            specimenSearchComposite.getTextCountry().setText(lastQuery.country);
-            specimenSearchComposite.getTextHerbarium().setText(lastQuery.herbarium);
-            specimenSearchComposite.getTextLocality().setText(lastQuery.locality);
-            specimenSearchComposite.getTextTaxonName().setText(lastQuery.taxonName);
-            if(lastQuery.dateFrom!=null){
-                specimenSearchComposite.getDateFrom().setDate(lastQuery.dateFrom.get(Calendar.YEAR), lastQuery.dateFrom.get(Calendar.MONTH), lastQuery.dateFrom.get(Calendar.DAY_OF_MONTH));
-            }
-            if(lastQuery.dateTo!=null){
-                specimenSearchComposite.getDateTo().setDate(lastQuery.dateTo.get(Calendar.YEAR), lastQuery.dateTo.get(Calendar.MONTH), lastQuery.dateTo.get(Calendar.DAY_OF_MONTH));
-            }
-        }
-    }
-
-    public void saveLastSate() {
-        lastQuery = new OccurenceQuery(getTaxonName(), getCollector(), getCollectorNumber(), getAccessionNumber(), getHerbarium(), getCountry(false), getLocality(), getDateFrom(), getDateTo(), false);
-    }
-
-    /**
-     * Returns the {@link Composite} handled by this controller
-     * @return
-     */
-    public Composite getComposite() {
-        return specimenSearchComposite;
-    }
-
-    /**
-     * Returns the taxon name entered in the search view
-     * @return the taxon name as a {@link String}
-     * @see eu.etaxonomy.taxeditor.view.specimenSearch.SpecimenSearchComposite#getTextTaxonName()
-     */
-    public String getTaxonName() {
-        return specimenSearchComposite.getTextTaxonName().getText();
-    }
-
-    /**
-     * Returns the collector entered in the search view
-     * @return the collector as a {@link String}
-     * @see eu.etaxonomy.taxeditor.view.specimenSearch.SpecimenSearchComposite#getTextCollector()
-     */
-    public String getCollector() {
-        return specimenSearchComposite.getTextCollector().getText();
-    }
-
-    /**
-     * Returns the collecting number entered in the search view
-     * @return the collecting as a {@link String}
-     * @see eu.etaxonomy.taxeditor.view.specimenSearch.SpecimenSearchComposite#getTextCollectorNumber()
-     */
-    public String getCollectorNumber() {
-        return specimenSearchComposite.getTextCollectorNumber().getText();
-    }
-
-    /**
-     * Returns the accession number entered in the search view
-     * @return the accession number as a {@link String}
-     * @see eu.etaxonomy.taxeditor.view.specimenSearch.SpecimenSearchComposite#getTextAccessionNumber()
-     */
-    public String getAccessionNumber() {
-        return specimenSearchComposite.getTextAccessionNumber().getText();
-    }
-
-    /**
-     * Returns the herbarium entered in the search view
-     * @return the herbarium as a {@link String}
-     * @see eu.etaxonomy.taxeditor.view.specimenSearch.SpecimenSearchComposite#getComboHerbarium()
-     */
-    public String getHerbarium() {
-        return specimenSearchComposite.getTextHerbarium().getText();
-    }
-
-    /**
-     * Returns the country entered in the search view
-     * @return the country as a {@link String}
-     * @see eu.etaxonomy.taxeditor.view.specimenSearch.SpecimenSearchComposite#getComboCountry()
-     */
-    public String getCountry(boolean biocase) {
-
-        String result = specimenSearchComposite.getTextCountry().getText();
-        if (result.contains("-") && biocase){
-            result = result.substring(4).trim();
-        }else if (result.contains("-")){
-            result = result.substring(0,2).trim();
-        }
-        return result;
-
-//        return specimenSearchComposite.getComboCountry().getItem(specimenSearchComposite.getComboCountry().getSelectionIndex());
-    }
-
-    /**
-     * Returns the locality entered in the search view
-     * @return the locality as a {@link String}
-     * @see eu.etaxonomy.taxeditor.view.specimenSearch.SpecimenSearchComposite#getTextLocality()
-     */
-    public String getLocality() {
-        return specimenSearchComposite.getTextLocality().getText();
-    }
-
-    /**
-     * Returns the start date entered in the search view.
-     * @return the date as an instance of {@link Calendar}
-     * @see eu.etaxonomy.taxeditor.view.specimenSearch.SpecimenSearchComposite#getDateFrom()
-     */
-    public Calendar getDateFrom() {
-        if(specimenSearchComposite.getBtnShowDate().getSelection()){
-            Calendar dateFrom = new GregorianCalendar();
-            dateFrom.clear();
-            dateFrom.set(specimenSearchComposite.getDateFrom().getYear(), specimenSearchComposite.getDateFrom().getMonth(), specimenSearchComposite.getDateFrom().getDay());
-            return dateFrom;
-        }
-        return null;
-    }
-
-    /**
-     * Returns the end date entered in the search view.
-     * @return the date as an instance of {@link Calendar}
-     * @see eu.etaxonomy.taxeditor.view.specimenSearch.SpecimenSearchComposite#getDateTo()
-     */
-    public Calendar getDateTo() {
-        if(specimenSearchComposite.getBtnShowDate().getSelection()){
-            Calendar dateTo = new GregorianCalendar();
-            dateTo.clear();
-            dateTo.set(specimenSearchComposite.getDateTo().getYear(), specimenSearchComposite.getDateTo().getMonth(), specimenSearchComposite.getDateTo().getDay());
-            return dateTo;
-        }
-        return null;
-    }
-
-}
