adresses #2257
[taxeditor.git] / taxeditor-store / src / main / java / eu / etaxonomy / taxeditor / ui / section / reference / ReferenceDetailElement.java
index 05c5c00ac485e89776034fedac860a3378ea81c5..a84304e39d8f1b3f9a747715eae9b6a5ee8fa46f 100644 (file)
@@ -17,7 +17,6 @@ import java.util.List;
 
 import org.eclipse.swt.SWT;
 
-import eu.etaxonomy.cdm.model.agent.AgentBase;
 import eu.etaxonomy.cdm.model.agent.Institution;
 import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
 import eu.etaxonomy.cdm.model.reference.Reference;
@@ -25,7 +24,10 @@ import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
 import eu.etaxonomy.cdm.model.reference.ReferenceType;
 import eu.etaxonomy.taxeditor.model.AuthorHelper;
 import eu.etaxonomy.taxeditor.store.StoreUtil;
+import eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection.ReferenceSelectionDialog;
 import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.EnumComboType;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.SelectionType;
 import eu.etaxonomy.taxeditor.ui.forms.CdmPropertyChangeEvent;
 import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
 import eu.etaxonomy.taxeditor.ui.forms.IErrorIntolerableElement;
@@ -34,10 +36,10 @@ import eu.etaxonomy.taxeditor.ui.forms.TextWithLabelElement;
 import eu.etaxonomy.taxeditor.ui.forms.TimePeriodElement;
 import eu.etaxonomy.taxeditor.ui.forms.ToggleableTextElement;
 import eu.etaxonomy.taxeditor.ui.forms.UriWithLabelElement;
-import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.EnumComboType;
-import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.SelectionType;
 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
 import eu.etaxonomy.taxeditor.ui.selection.AbstractSelectionElement;
+import eu.etaxonomy.taxeditor.ui.selection.AgentSelectionElement;
+import eu.etaxonomy.taxeditor.ui.selection.InstitutionSelectionElement;
 import eu.etaxonomy.taxeditor.ui.selection.ReferenceSelectionElement;
 import eu.etaxonomy.taxeditor.ui.term.ReferenceTypeComboElement;
 
@@ -66,10 +68,10 @@ public class ReferenceDetailElement extends AbstractCdmDetailElement<Reference>
        private TextWithLabelElement text_title;
        private TextWithLabelElement text_volume;
        private UriWithLabelElement text_uri;
-       private AbstractSelectionElement<AgentBase> selection_authorTeam;
+       private AgentSelectionElement selection_authorTeam;
        private TimePeriodElement element_timePeriod;
-       private AbstractSelectionElement<Reference> selection_inReference;
-       private AbstractSelectionElement<Institution> selection_institution;
+       private ReferenceSelectionElement selection_inReference;
+       private InstitutionSelectionElement selection_institution;
        private ReferenceTypeComboElement combo_referenceType;
        
        private ReferenceSelectionElement selection_inSeries;
@@ -104,7 +106,7 @@ public class ReferenceDetailElement extends AbstractCdmDetailElement<Reference>
                text_title = formFactory.createTextWithLabelElement(formElement, "Title", entity.getTitle(), style);
                
                // author team
-               selection_authorTeam = formFactory.createSelectionElement(SelectionType.TEAM, getConversationHolder(), formElement, "Author", AuthorHelper.getAuthor(entity.getAuthorTeam()), style);
+               selection_authorTeam = (AgentSelectionElement) formFactory.createSelectionElement(SelectionType.AGENT, getConversationHolder(), formElement, "Author", AuthorHelper.getAuthor(entity.getAuthorTeam()), style);
                
                ReferenceType referenceType = entity.getType();
                
@@ -189,7 +191,7 @@ public class ReferenceDetailElement extends AbstractCdmDetailElement<Reference>
                }
                
                if(createInReferenceWidget){
-                       selection_inReference = formFactory.createSelectionElement(SelectionType.REFERENCE, getConversationHolder(), 
+                       selection_inReference = (ReferenceSelectionElement) formFactory.createSelectionElement(SelectionType.REFERENCE, getConversationHolder(), 
                                        element, label, reference.getInReference(), style);
                }
        }
@@ -241,12 +243,12 @@ public class ReferenceDetailElement extends AbstractCdmDetailElement<Reference>
                
                if(referenceType.equals(ReferenceType.Report)){
                        // institution
-                       selection_institution = formFactory.createSelectionElement(SelectionType.INSTITUTION, getConversationHolder(), element, "Institution", reference.getInstitution(), style);
+                       selection_institution = (InstitutionSelectionElement) formFactory.createSelectionElement(SelectionType.INSTITUTION, getConversationHolder(), element, "Institution", reference.getInstitution(), style);
                }
                
                if(referenceType.equals(ReferenceType.Thesis)){
                        // school
-                       selection_institution = formFactory.createSelectionElement(SelectionType.INSTITUTION, getConversationHolder(), element, "School", reference.getSchool(), style);
+                       selection_institution = (InstitutionSelectionElement) formFactory.createSelectionElement(SelectionType.INSTITUTION, getConversationHolder(), element, "School", reference.getSchool(), style);
                }
                
                if(referenceType.equals(ReferenceType.Proceedings)){