Editor now uses IIdentifiableEntityServiceConfigurator consistently. Working on ...
authorn.hoffmann <n.hoffmann@localhost>
Thu, 12 May 2011 09:44:09 +0000 (09:44 +0000)
committern.hoffmann <n.hoffmann@localhost>
Thu, 12 May 2011 09:44:09 +0000 (09:44 +0000)
17 files changed:
.gitattributes
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/BulkEditorQuery.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/input/NameRelationshipEditorInput.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchBar.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchResultView.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/SearchManager.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/CdmFormFactory.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractCdmDetailSection.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractEntityCollectionSection.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/AbstractDeterminationEventDetailSection.java [moved from eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DeterminationEventDetailSection.java with 72% similarity]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/CurrentDeterminationDetailSection.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitBaseDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DeterminationDetailElement.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DeterminationDetailSection.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DeterminationEventDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DeterminationHistoryDetailSection.java [new file with mode: 0644]

index f7082c5d5f2aabefcfba7936eee26b0c8357058e..d995aa4e5f09e15d86071f1605a09de8c09b3cd6 100644 (file)
@@ -1036,17 +1036,21 @@ eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/nam
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/ProtologueSection.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/SpecimenTypeDesignationElement.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/TypeDesignationSection.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/AbstractDeterminationEventDetailSection.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/AbstractEventDetailElement.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/CollectingAreasDetailSection.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/CollectionDetailElement.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/CollectionWizardPage.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/CurrentDeterminationDetailSection.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitBaseDetailElement.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitBaseDetailSection.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitBaseWizardPage.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitFacadeDetailElement.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DerivedUnitFacadeDetailSection.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DeterminationDetailElement.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DeterminationDetailSection.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DeterminationEventDetailElement.java -text
-eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DeterminationEventDetailSection.java -text
+eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DeterminationHistoryDetailSection.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/FieldObservationDetailElement.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/FieldObservationDetailSection.java -text
 eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/FieldObservationWizardPage.java -text
index 1ddb8090f86dd10d353e81342f394316f228e87f..00519c8e4510fd871ab1588745e92814b6697309 100644 (file)
@@ -13,7 +13,8 @@ package eu.etaxonomy.taxeditor.bulkeditor;
 import java.util.Comparator;
 
 import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
-import eu.etaxonomy.cdm.api.service.config.impl.IdentifiableServiceConfiguratorImpl;
+import eu.etaxonomy.cdm.api.service.config.IdentifiableServiceConfiguratorFactory;
+import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
 
 /**
  * @author n.hoffmann
@@ -30,8 +31,9 @@ public class BulkEditorQuery {
                this.searchString = searchString;
                this.comparator = comparator;
                
-               searchConfigurator = IdentifiableServiceConfiguratorImpl.NewInstance();
+               searchConfigurator = IdentifiableServiceConfiguratorFactory.getConfigurator(IdentifiableEntity.class);
                searchConfigurator.setTitleSearchString(searchString);
+               searchConfigurator.setMatchMode(null);
                
                if(searchString != null && searchString.trim().equals("*")){
                        searchConfigurator.setPageSize(1000);
index fe1ba6d673842db4954df3c6729bfdb8f495639d..3d2ccd4322bb76e65e743aec0731cdaf545af943 100644 (file)
@@ -100,17 +100,7 @@ public class NameRelationshipEditorInput extends AbstractBulkEditorInput<NameRel
        @Override
        protected List<NameRelationship> listEntities(
                        IIdentifiableEntityServiceConfigurator configurator) {
-               List<NameRelationship> relationships = new ArrayList<NameRelationship>(); 
-               List<RelationshipBase> all = CdmStore.getService(INameService.class).getAllRelationships(0, 0);
-               
-               for (RelationshipBase relationship : all){
-                       if(relationship instanceof NameRelationship){
-                               relationships.add((NameRelationship) relationship);
-                       }
-               }
-               
-               
-               return relationships;
+               return CdmStore.getSearchManager().findNameRelationships(configurator);
        }
 
        /* (non-Javadoc)
index 8a6a476ad30a4aaab2001e74804f075e39aedc88..5c50e052a694c78e63903293ed8391cad728d0a7 100644 (file)
@@ -182,7 +182,7 @@ public class SearchBar extends WorkbenchWindowControlContribution{
                
                
                ITaxonServiceConfigurator configurator = configurationListener.getConfigurator();
-               configurator.setSearchString(searchString);
+               configurator.setTitleSearchString(searchString);
                openSearchResultsView(configurator);
                
        }
index 8e496369e982fe51acb3cbda5f5d29a67587433d..fb4ea0dec587f93d4926e79d3e8b5d47d3a20976 100644 (file)
@@ -165,9 +165,9 @@ public class SearchResultView extends ViewPart implements IConversationEnabled{
         * @param configurator a {@link eu.etaxonomy.cdm.api.service.config.ITaxonServiceConfigurator} object.
         */
        public void performSearch(ITaxonServiceConfigurator configurator){
-               setPartName("Search: '" + configurator.getSearchString() + "'");
+               setPartName("Search: '" + configurator.getTitleSearchString() + "'");
                
-               searchString.setText(configurator.getSearchString());
+               searchString.setText(configurator.getTitleSearchString());
                
                List<String> includedEntities = new ArrayList<String>();
                if(configurator.isDoTaxa())
index aaa47ef9da6e0baca54180ca6008490406ece5e5..4035427827ecf26aa797c1996c42799a29307631 100644 (file)
@@ -25,7 +25,7 @@ import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeConfigurator;
 import eu.etaxonomy.cdm.api.service.IFeatureTreeService;
 import eu.etaxonomy.cdm.api.service.ITermService;
 import eu.etaxonomy.cdm.api.service.config.ITaxonServiceConfigurator;
-import eu.etaxonomy.cdm.api.service.config.impl.TaxonServiceConfiguratorImpl;
+import eu.etaxonomy.cdm.api.service.config.TaxonServiceConfiguratorImpl;
 import eu.etaxonomy.cdm.common.CdmUtils;
 import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
 import eu.etaxonomy.cdm.model.common.ICdmBase;
@@ -275,8 +275,7 @@ public class PreferencesUtil implements IPreferenceKeys {
         *         object.
         */
        public static ITaxonServiceConfigurator initializeSearchConfigurator() {
-               ITaxonServiceConfigurator configurator = TaxonServiceConfiguratorImpl
-                               .NewInstance();
+               ITaxonServiceConfigurator configurator = new TaxonServiceConfiguratorImpl();
 
                configurator.setDoTaxa(true);
                configurator.setDoSynonyms(true);
index 8f55da5513c72708059ff865d1f76f4eb926f322..035f7d5a5eec8e4fb74c02d2034a0cd11ba8532b 100644 (file)
@@ -27,9 +27,13 @@ import eu.etaxonomy.cdm.api.service.IUserService;
 import eu.etaxonomy.cdm.api.service.config.IIdentifiableEntityServiceConfigurator;
 import eu.etaxonomy.cdm.api.service.config.ITaxonServiceConfigurator;
 import eu.etaxonomy.cdm.model.agent.AgentBase;
+import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
 import eu.etaxonomy.cdm.model.common.Group;
+import eu.etaxonomy.cdm.model.common.IIdentifiableEntity;
+import eu.etaxonomy.cdm.model.common.RelationshipBase;
 import eu.etaxonomy.cdm.model.common.User;
 import eu.etaxonomy.cdm.model.common.UuidAndTitleCache;
+import eu.etaxonomy.cdm.model.name.NameRelationship;
 import eu.etaxonomy.cdm.model.name.TaxonNameBase;
 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
 import eu.etaxonomy.cdm.model.reference.Reference;
@@ -58,18 +62,30 @@ public class SearchManager {
         * @return a {@link java.util.List} object.
         */
        public List<TaxonNameBase> findNames(IIdentifiableEntityServiceConfigurator configurator){
-               // TODO we want to use IIdentifiableEntityServiceConfigurator for all find methods
-               // unfortunately this is not consistently implemented in the library.
-               // FIXME use proper method once it is implemented in the library
-               String titleSearchString = getTitleSearchString(configurator);
-               
-               return checkLargeResult(configurator, countNames(configurator)) ? CdmStore.getService(INameService.class).getNamesByName(titleSearchString) : NO_RESULTS;
+               if(checkLargeResult(CdmStore.getService(INameService.class).countByTitle(configurator))){
+                       return CdmStore.getService(INameService.class).findByTitle(configurator).getRecords();
+               }
+               return NO_RESULTS;
        }
        
-
-
-       private int countNames(IIdentifiableEntityServiceConfigurator configurator){
-               return NO_COUNT;
+       public List<NameRelationship> findNameRelationships(
+                       IIdentifiableEntityServiceConfigurator configurator) {
+               if(true){
+                       return NO_RESULTS;
+               }
+               
+               List<NameRelationship> relationships = new ArrayList<NameRelationship>(); 
+               List<RelationshipBase> all = CdmStore.getService(INameService.class).getAllRelationships(0, 0);
+               
+               for (RelationshipBase relationship : all){
+                       if(relationship instanceof NameRelationship){
+                               relationships.add((NameRelationship) relationship);
+                       }
+               }
+               
+               
+               return relationships;
+               
        }
 
        /**
@@ -79,13 +95,9 @@ public class SearchManager {
         * @return a {@link java.util.List} object.
         */
        public List<UuidAndTitleCache<TaxonBase>> findTaxaAndNames(ITaxonServiceConfigurator configurator){
-               
-               return checkLargeResult(configurator, countTaxaAndNames(configurator)) ? CdmStore.getService(ITaxonService.class).findTaxaAndNamesForEditor(configurator) : NO_RESULTS;
+               return CdmStore.getService(ITaxonService.class).findTaxaAndNamesForEditor(configurator);
        }
        
-       private int countTaxaAndNames(ITaxonServiceConfigurator configurator){
-               return NO_COUNT;
-       }
        
        /**
         * <p>findReferences</p>
@@ -94,17 +106,12 @@ public class SearchManager {
         * @return a {@link java.util.List} object.
         */
        public List<Reference> findReferences(IIdentifiableEntityServiceConfigurator configurator){
-               // TODO we want to use IIdentifiableEntityServiceConfigurator for all find methods
-               // unfortunately this is not consistently implemented in the library.
-               // FIXME use proper method once it is implemented in the library
-               String titleSearchString = getTitleSearchString(configurator);
-               
-               return checkLargeResult(configurator, countReferences(configurator)) ? CdmStore.getService(IReferenceService.class).findByTitle(null, titleSearchString, null, null, null, null, null, null).getRecords() : NO_RESULTS;
+               if(checkLargeResult(CdmStore.getService(IReferenceService.class).countByTitle(configurator))){
+                       return  CdmStore.getService(IReferenceService.class).findByTitle(configurator).getRecords();
+               }
+               return NO_RESULTS;
        }
        
-       private int countReferences(IIdentifiableEntityServiceConfigurator configurator){
-               return NO_COUNT;
-       }
        
        /**
         * <p>findAgents</p>
@@ -113,16 +120,10 @@ public class SearchManager {
         * @return a {@link java.util.List} object.
         */
        public List<AgentBase> findAgents(IIdentifiableEntityServiceConfigurator configurator){
-               // TODO we want to use IIdentifiableEntityServiceConfigurator for all find methods
-               // unfortunately this is not consistently implemented in the library.
-               // FIXME use proper method once it is implemented in the library
-               String titleSearchString = getTitleSearchString(configurator);
-               
-               return checkLargeResult(configurator, countAgents(configurator)) ? CdmStore.getService(IAgentService.class).findByTitle(null, titleSearchString, null, null, null, null, null, null).getRecords() : NO_RESULTS;
-       }
-       
-       private int countAgents(IIdentifiableEntityServiceConfigurator configurator){
-               return NO_COUNT;
+               if(checkLargeResult(CdmStore.getService(IAgentService.class).countByTitle(configurator))){
+                       return CdmStore.getService(IAgentService.class).findByTitle(configurator).getRecords();
+               }
+               return NO_RESULTS;
        }
 
        /**
@@ -132,21 +133,10 @@ public class SearchManager {
         * @return a {@link java.util.List} object.
         */
        public List<AgentBase> findTeamOrPersons(IIdentifiableEntityServiceConfigurator configurator){
-               // TODO move this to cdmlib
-               List<AgentBase> result = new ArrayList<AgentBase>();
-               for (AgentBase agent : findAgents(configurator)) {
-                       result.add(agent);
-               }
-               return result;
+               configurator.setClazz(TeamOrPersonBase.class);
+               return findAgents(configurator);
        }
        
-       /**
-        * @param configurator
-        * @return
-        */
-       private int countTeamOrPersons(IIdentifiableEntityServiceConfigurator configurator) {
-               return NO_COUNT;
-       }
        
        /**
         * <p>findOccurrences</p>
@@ -155,61 +145,49 @@ public class SearchManager {
         * @return a {@link java.util.List} object.
         */
        public List<SpecimenOrObservationBase> findOccurrences(IIdentifiableEntityServiceConfigurator configurator){
-               // TODO we want to use IIdentifiableEntityServiceConfigurator for all find methods
-               // unfortunately this is not consistently implemented in the library.
-               // FIXME use proper method once it is implemented in the library
-               String titleSearchString = getTitleSearchString(configurator);
-               
-               return checkLargeResult(configurator, countOccurrences(configurator)) ? CdmStore.getService(IOccurrenceService.class).findByTitle(SpecimenOrObservationBase.class, titleSearchString, null, null, null, null, null, null).getRecords() : NO_RESULTS;
+               if(checkLargeResult(CdmStore.getService(IOccurrenceService.class).countByTitle(configurator))){
+                       return CdmStore.getService(IOccurrenceService.class).findByTitle(configurator).getRecords();
+               }
+               return NO_RESULTS;
        }
        
-       private int countOccurrences(IIdentifiableEntityServiceConfigurator configurator){
-               return NO_COUNT;
-       }
        
        public List<User> findUsers(IIdentifiableEntityServiceConfigurator configurator){
-               String userNameSearchString = getTitleSearchString(configurator);
-               
-               return checkLargeResult(configurator, countUsers(configurator)) ? CdmStore.getService(IUserService.class).listByUsername(userNameSearchString, null, null, null, null, null, null) : NO_RESULTS;
+               String userNameSearchString = sqlizeTitleSearchString(configurator);
+               // TODO why are users not identifiable entities?
+               return CdmStore.getService(IUserService.class).listByUsername(userNameSearchString, null, null, null, null, null, null);
        }
        
-       private int countUsers(IIdentifiableEntityServiceConfigurator configurator){
-               return NO_COUNT;
-       }
        
        public List<Group> findGroups(IIdentifiableEntityServiceConfigurator configurator){
-               String groupNameSearchString = getTitleSearchString(configurator);
-               
-               return checkLargeResult(configurator, countGroups(configurator)) ? CdmStore.getService(IGroupService.class).listByName(groupNameSearchString, null, null, null, null, null, null) : NO_RESULTS;
+               String groupNameSearchString = sqlizeTitleSearchString(configurator);
+               // TODO why are groups not identifiable entities?
+               return CdmStore.getService(IGroupService.class).listByName(groupNameSearchString, null, null, null, null, null, null);
        }
        
-       private int countGroups(IIdentifiableEntityServiceConfigurator configurator){
-               return NO_COUNT;
-       }
        
        /**
-        * @param countNames
+        * @param count
         * @return
         */
-       private boolean checkLargeResult(IIdentifiableEntityServiceConfigurator configurator, int countNames) {
-               if(isWildCardOnly(configurator) || countNames > MAX_RESULTS_BEFORE_WARNING){
-                       return MessageDialog.openConfirm(Display.getDefault().getActiveShell(), "Large result exptected", "The current search could lead to a very large result. Retrieving this result set might take a long time and/or render the editor unusable.");
+       private boolean checkLargeResult(int count) {
+               if(count > MAX_RESULTS_BEFORE_WARNING){
+                       return MessageDialog.openConfirm(Display.getDefault().getActiveShell(), "Large result expected", 
+                                       String.format("The current search will return %s objects. This will " +
+                                                       "take a long time and/or might render the editor unusable. Please consider refining your search.", count));
                }else{
                        return true;
                }               
        }
        
-       private boolean isWildCardOnly(IIdentifiableEntityServiceConfigurator configurator){
-               return WILDCARD.equals(configurator.getTitleSearchString());
-       }
-       
        /**
-        * TODO this will be obsolete once IIdentifiableEntityServiceConfigurator is implemented in find* methods
         * 
         * @param configurator
         * @return
         */
-       private String getTitleSearchString(IIdentifiableEntityServiceConfigurator configurator){
+       private String sqlizeTitleSearchString(IIdentifiableEntityServiceConfigurator configurator){
                return configurator.getTitleSearchString().replace(WILDCARD, "%");
        }
+
+
 }
index 246db7c57c9e47fd24db5082c7c47a43d8d643e8..0913abb03643d2a441d8ebce36790e23b335b6ed 100644 (file)
@@ -205,12 +205,15 @@ import eu.etaxonomy.taxeditor.ui.section.name.SpecimenTypeDesignationElement;
 import eu.etaxonomy.taxeditor.ui.section.name.TypeDesignationSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.CollectingAreasDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.CollectionDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.CurrentDeterminationDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitBaseDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitBaseDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitFacadeDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitFacadeDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationDetailElement;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationEventDetailElement;
-import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationEventDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationHistoryDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldObservationDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldObservationDetailSection;
 import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailElement;
@@ -1633,7 +1636,37 @@ public class CdmFormFactory extends FormToolkit {
         * 
         */
        public static enum DetailType {
-               NONVIRALNAME, SCIENTIFICNAME, REFERENCEBASE, NOMENCLATURALREFERENCE, TAXONBASE, AUTHORSHIP, TEAM, PERSON, DESCRIPTION, DESCRIPTIONELEMENT, PARSINGMESSAGE, NAMERELATIONSHIP, TEAMORPERSONBASE, MEDIA, FIELD_OBSERVATION, DERIVED_UNIT_FACADE, GATHERING_EVENT, DERIVED_UNIT, NATURAL_LANGUAGE, FEATURE_DISTRIBUTION, CLASSIFICATION, TAXON_NODE, COLLECTION, POLYTOMOUS_KEY, POLYTOMOUS_KEY_NODE, INSTITUTION, DERIVED_UNIT_GENERAL, HYBRID, USER, GROUP
+               NONVIRALNAME, 
+               SCIENTIFICNAME, 
+               REFERENCEBASE, 
+               NOMENCLATURALREFERENCE, 
+               TAXONBASE, 
+               AUTHORSHIP, 
+               TEAM, 
+               PERSON, 
+               DESCRIPTION, 
+               DESCRIPTIONELEMENT, 
+               PARSINGMESSAGE, 
+               NAMERELATIONSHIP, 
+               TEAMORPERSONBASE, 
+               MEDIA, 
+               FIELD_OBSERVATION, 
+               DERIVED_UNIT_FACADE, 
+               GATHERING_EVENT, 
+               DERIVED_UNIT, 
+               NATURAL_LANGUAGE, 
+               FEATURE_DISTRIBUTION, 
+               CLASSIFICATION, 
+               TAXON_NODE, 
+               COLLECTION, 
+               POLYTOMOUS_KEY, 
+               POLYTOMOUS_KEY_NODE, 
+               INSTITUTION, 
+               DERIVED_UNIT_GENERAL, 
+               HYBRID, 
+               USER, 
+               GROUP, 
+               DETERMINATION
        }
 
        /**
@@ -1776,6 +1809,9 @@ public class CdmFormFactory extends FormToolkit {
                        section = new GroupDetailSection(this, conversation, parentElement,
                                        selectionProvider, style);
                        break;
+               case DETERMINATION:
+                       section = new DeterminationDetailSection(this, conversation, parentElement,
+                                       selectionProvider, style);
                }
 
                if (section == null) {
@@ -1891,6 +1927,9 @@ public class CdmFormFactory extends FormToolkit {
                case GROUP:
                        element = new GroupDetailElement(this, parentElement);
                        break;
+               case DETERMINATION:
+                       element = new DeterminationDetailElement(this, parentElement);
+                       break;
                }
 
                if (element == null) {
@@ -1912,7 +1951,7 @@ public class CdmFormFactory extends FormToolkit {
         * @version 1.0
         */
        public static enum EntityDetailType {
-               TEAM, TEAMMEMBER, ANNOTATION, CREDIT, DESCRIPTIONELEMENTSOURCE, EXTENSION, MARKER, MEDIA, DESCRIPTIONELEMENTMEDIA, MEDIAREPRESENTATION, MEDIAREPRESENTATIONPART, MODIFIER, NOMENCLATURALSTATUS, NAME_RELATIONSHIP, PROTOLOG, RIGHTS, SOURCE, SCOPE, DESCRIPTIONSOURCE, TYPEDESIGNATION, STATE_DATA, STATISTICAL_MEASUREMENT_VALUE, DESCRIBED_SPECIMEN, COLLECTING_AREA, DETERMINATION_EVENT, SPECIMEN_COLLECTION, IDENTIFIABLE_SOURCE_COLLECTION, GEOGRAPHICAL_SCOPE, SCOPE_RESTRICTION, MEMBER, GRANTED_AUTHORITY, GROUPS_BY_USER, TAXONOMIC_SCOPE
+               TEAM, TEAMMEMBER, ANNOTATION, CREDIT, DESCRIPTIONELEMENTSOURCE, EXTENSION, MARKER, MEDIA, DESCRIPTIONELEMENTMEDIA, MEDIAREPRESENTATION, MEDIAREPRESENTATIONPART, MODIFIER, NOMENCLATURALSTATUS, NAME_RELATIONSHIP, PROTOLOG, RIGHTS, SOURCE, SCOPE, DESCRIPTIONSOURCE, TYPEDESIGNATION, STATE_DATA, STATISTICAL_MEASUREMENT_VALUE, DESCRIBED_SPECIMEN, COLLECTING_AREA, DETERMINATION_EVENT, SPECIMEN_COLLECTION, IDENTIFIABLE_SOURCE_COLLECTION, GEOGRAPHICAL_SCOPE, SCOPE_RESTRICTION, MEMBER, GRANTED_AUTHORITY, GROUPS_BY_USER, TAXONOMIC_SCOPE, DETERMINATION_CURRENT, DETERMINATION_HISTORY
        }
 
        /**
@@ -2035,8 +2074,12 @@ public class CdmFormFactory extends FormToolkit {
                        section = new CollectingAreasDetailSection(this, conversation,
                                        parentElement, style);
                        break;
-               case DETERMINATION_EVENT:
-                       section = new DeterminationEventDetailSection(this, conversation,
+               case DETERMINATION_CURRENT:
+                       section = new CurrentDeterminationDetailSection(this, conversation,
+                                       parentElement, style);
+                       break;
+               case DETERMINATION_HISTORY:
+                       section = new DeterminationHistoryDetailSection(this, conversation,
                                        parentElement, style);
                        break;
                case SPECIMEN_COLLECTION:
index 15fcf7e6b654bc738c70efc155a7184cfe31af65..859c892c213fb27bc752a51cf7316da57e6882a5 100644 (file)
@@ -24,10 +24,10 @@ import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
 import eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection;
 import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.DetailType;
 import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
 import eu.etaxonomy.taxeditor.ui.forms.IEnableableFormElement;
 import eu.etaxonomy.taxeditor.ui.forms.ISelectableElement;
-import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.DetailType;
 
 /**
  * <p>Abstract AbstractCdmDetailSection class.</p>
@@ -120,6 +120,7 @@ public abstract class AbstractCdmDetailSection<ENTITY> extends AbstractFormSecti
         *
         * @param entity a ENTITY object.
         */
+       @Override
        public void setEntity(ENTITY entity) {
                if(detailElement != null){
                        detailElement.setEntity(entity);
index e2e18117f5c850b9261491b36381e799ee05fd66..8b426fcfa6928476e376eb0bc6f2930253c96c08 100644 (file)
@@ -24,7 +24,6 @@ import org.eclipse.ui.forms.widgets.Section;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.common.CdmUtils;
-import eu.etaxonomy.cdm.model.common.IVersionableEntity;
 import eu.etaxonomy.taxeditor.model.ImageResources;
 import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
@@ -64,7 +63,7 @@ public abstract class AbstractEntityCollectionSection<ENTITY, ELEMENT> extends A
                super(formFactory, conversation, parentElement, Section.CLIENT_INDENT | style);
                this.title = title;
                this.setText(getTitleString());
-               setTextClient(createToolbar());
+               showToolbar();
                
                addExpansionListener(this);
        }
@@ -101,11 +100,20 @@ public abstract class AbstractEntityCollectionSection<ENTITY, ELEMENT> extends A
                return toolBarManager.createControl(this);
        }
        
+       public void showToolbar(){
+               setTextClient(createToolbar());
+       }
+       
+       public void removeToolbar(){
+               setTextClient(null);
+       }
+       
        /**
         * <p>setEntity</p>
         *
         * @param entity a ENTITY object.
         */
+       @Override
        public void setEntity(ENTITY entity) {
                if(entity != null && hasCollectionChanged(entity)){
                        super.setEntity(entity);
@@ -190,7 +198,7 @@ public abstract class AbstractEntityCollectionSection<ENTITY, ELEMENT> extends A
        {
                Collection<ELEMENT> elements = getCollection(getEntity());
                
-               if(elements == null || elements.size() == 0){
+               if(elements == null || elements.isEmpty()){
                        createEmptyContent();
                }else{
                        createDynamicContents(elements);
@@ -270,6 +278,8 @@ public abstract class AbstractEntityCollectionSection<ENTITY, ELEMENT> extends A
         */
        public void setTitleString(String title){
                this.title = title;
+               setSectionTitle();
+               layout();
        }
        
        /** {@inheritDoc} */
@@ -331,5 +341,5 @@ public abstract class AbstractEntityCollectionSection<ENTITY, ELEMENT> extends A
         *
         * @return String to display when hovering the add button
         */
-       protected abstract String getTooltipString();
+       protected abstract String getTooltipString();   
 }
@@ -10,8 +10,6 @@
 
 package eu.etaxonomy.taxeditor.ui.section.occurrence;
 
-import java.util.Collection;
-
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
 import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent;
@@ -26,30 +24,20 @@ import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
  * @created Oct 13, 2010
  * @version 1.0
  */
-public class DeterminationEventDetailSection extends
+public abstract class AbstractDeterminationEventDetailSection extends
                AbstractEntityCollectionSection<DerivedUnitFacade, DeterminationEvent> {
 
        /**
-        * <p>Constructor for DeterminationEventDetailSection.</p>
-        *
-        * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory} object.
-        * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
-        * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
-        * @param style a int.
+        * @param formFactory
+        * @param conversation
+        * @param parentElement
+        * @param title
+        * @param style
         */
-       public DeterminationEventDetailSection(CdmFormFactory formFactory,
+       public AbstractDeterminationEventDetailSection(CdmFormFactory formFactory,
                        ConversationHolder conversation, ICdmFormElement parentElement,
-                       int style) {
-               super(formFactory, conversation, parentElement, "Determination Events", style);
-       }
-
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
-        */
-       /** {@inheritDoc} */
-       @Override
-       public Collection<DeterminationEvent> getCollection(DerivedUnitFacade entity) {
-               return entity.getDeterminations();
+                       String title, int style) {
+               super(formFactory, conversation, parentElement, title, style);
        }
 
        /* (non-Javadoc)
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/CurrentDeterminationDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/CurrentDeterminationDetailSection.java
new file mode 100644 (file)
index 0000000..b4850fd
--- /dev/null
@@ -0,0 +1,61 @@
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy 
+* http://www.e-taxonomy.eu
+* 
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.ui.section.occurrence;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
+
+/**
+ * @author n.hoffmann
+ * @created May 11, 2011
+ * @version 1.0
+ */
+public class CurrentDeterminationDetailSection extends
+               AbstractDeterminationEventDetailSection {
+
+       /**
+        * @param formFactory
+        * @param conversation
+        * @param parentElement
+        * @param style
+        */
+       public CurrentDeterminationDetailSection(CdmFormFactory formFactory,
+                       ConversationHolder conversation, ICdmFormElement parentElement,
+                       int style) {
+               super(formFactory, conversation, parentElement, "Current Determination", style);
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
+        */
+       @Override
+       public Collection<DeterminationEvent> getCollection(DerivedUnitFacade entity) {
+               DeterminationEvent preferredDetermination = entity.getPreferredDetermination();
+               return preferredDetermination != null ? Arrays.asList(new DeterminationEvent[]{preferredDetermination}) : null;
+       }
+       
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.occurrence.AbstractDeterminationEventDetailSection#createNewElement()
+        */
+       @Override
+       public DeterminationEvent createNewElement() {
+               DeterminationEvent newElement = super.createNewElement();
+               newElement.setPreferredFlag(true);
+               return newElement;
+       }
+
+}
index 61b6a6756527d236eb1e72100f4d4d9bac9ff5ef..2ee211722c6d9a365ef98a88a5654b30dbb0969e 100644 (file)
@@ -50,8 +50,6 @@ public class DerivedUnitBaseDetailElement extends
 
        private PreservationMethodComboElement combo_preservationMethod;
 
-       private DeterminationEventDetailSection section_determinations;
-
        private SpecimenCollectionDetailSection section_duplicates;
 
        private SourceCollectionDetailSection section_source;
@@ -114,15 +112,6 @@ public class DerivedUnitBaseDetailElement extends
                        // we ignore this
                        StoreUtil.info(e.getMessage());
                }
-               // source
-
-               section_determinations = (DeterminationEventDetailSection) formFactory
-                               .createEntityDetailSection(
-                                               EntityDetailType.DETERMINATION_EVENT,
-                                               getConversationHolder(), formElement, Section.TWISTIE);
-               section_determinations.setLayoutData(CdmFormFactory.FILL_HORIZONTALLY(
-                               2, 1));
-               section_determinations.setEntity(entity);
 
                section_duplicates = (SpecimenCollectionDetailSection) formFactory
                                .createEntityDetailSection(
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DeterminationDetailElement.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DeterminationDetailElement.java
new file mode 100644 (file)
index 0000000..a3afd59
--- /dev/null
@@ -0,0 +1,72 @@
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy 
+* http://www.e-taxonomy.eu
+* 
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.ui.section.occurrence;
+
+import org.eclipse.ui.forms.widgets.Section;
+
+import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.EntityDetailType;
+import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
+
+/**
+ * @author n.hoffmann
+ * @created May 11, 2011
+ * @version 1.0
+ */
+public class DeterminationDetailElement extends AbstractCdmDetailElement<DerivedUnitFacade> {
+
+       private CurrentDeterminationDetailSection section_currentDetermination;
+       
+       private DeterminationHistoryDetailSection section_determinationHistory;
+       
+       /**
+        * @param formFactory
+        * @param formElement
+        */
+       public DeterminationDetailElement(CdmFormFactory formFactory,
+                       ICdmFormElement formElement) {
+               super(formFactory, formElement);
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement#createControls(eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement, java.lang.Object, int)
+        */
+       @Override
+       protected void createControls(ICdmFormElement formElement,
+                       DerivedUnitFacade entity, int style) {
+               
+               section_currentDetermination = (CurrentDeterminationDetailSection) formFactory
+                               .createEntityDetailSection(
+                                               EntityDetailType.DETERMINATION_CURRENT,
+                                               getConversationHolder(), formElement, Section.EXPANDED);
+               section_currentDetermination.setLayoutData(CdmFormFactory.FILL_HORIZONTALLY(2, 1));
+               section_currentDetermination.setEntity(entity);
+               
+               section_determinationHistory = (DeterminationHistoryDetailSection) formFactory
+                                                                                       .createEntityDetailSection(
+                                                                                                       EntityDetailType.DETERMINATION_HISTORY,
+                                                                                                       getConversationHolder(), formElement, Section.TWISTIE);
+               section_determinationHistory.setLayoutData(CdmFormFactory.FILL_HORIZONTALLY(2, 1));
+               section_determinationHistory.setEntity(entity);
+               
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement#handleEvent(java.lang.Object)
+        */
+       @Override
+       public void handleEvent(Object eventSource) {
+               
+       }
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DeterminationDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DeterminationDetailSection.java
new file mode 100644 (file)
index 0000000..1fdfa60
--- /dev/null
@@ -0,0 +1,58 @@
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy 
+* http://www.e-taxonomy.eu
+* 
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.ui.section.occurrence;
+
+import org.eclipse.jface.viewers.ISelectionProvider;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.DetailType;
+import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
+
+/**
+ * @author n.hoffmann
+ * @created May 11, 2011
+ * @version 1.0
+ */
+public class DeterminationDetailSection extends AbstractCdmDetailSection<DerivedUnitFacade> implements IDerivedUnitFacadeDetailSection {
+
+       /**
+        * @param formFactory
+        * @param conversation
+        * @param parentElement
+        * @param selectionProvider
+        * @param style
+        */
+       public DeterminationDetailSection(CdmFormFactory formFactory,
+                       ConversationHolder conversation, ICdmFormElement parentElement,
+                       ISelectionProvider selectionProvider, int style) {
+               super(formFactory, conversation, parentElement, selectionProvider, style);
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#getDetailType()
+        */
+       @Override
+       protected DetailType getDetailType() {
+               return DetailType.DETERMINATION;
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#getHeading()
+        */
+       @Override
+       public String getHeading() {
+               return "Determinations"; 
+       }
+
+}
index 526c37c2f26eb99e6b2cf9e26b0b09549a334d89..28fa0bb8ddca42f91bb012c1d9b6d161c7e105ec 100644 (file)
@@ -93,8 +93,8 @@ public class DeterminationEventDetailElement extends
                combo_determinationModifier = (DeterminationModifierComboElement) formFactory
                                .createTermComboElement(TermComboType.DETERMINATION_MODIFIER,
                                                element, "Determination Modifier", null, style);
-               checkbox_preferredFlag = formFactory.createCheckbox(element,
-                               "Current", false, style);
+//             checkbox_preferredFlag = formFactory.createCheckbox(element,
+//                             "Current", false, style);
                selection_taxon = (TaxonSelectionElement) formFactory
                                .createSelectionElement(SelectionType.TAXON,
                                                getConversationHolder(), element, "Taxon", null,
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DeterminationHistoryDetailSection.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DeterminationHistoryDetailSection.java
new file mode 100644 (file)
index 0000000..f59eb43
--- /dev/null
@@ -0,0 +1,49 @@
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy 
+* http://www.e-taxonomy.eu
+* 
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.ui.section.occurrence;
+
+import java.util.Collection;
+
+import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
+import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
+import eu.etaxonomy.cdm.model.occurrence.DeterminationEvent;
+import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
+
+/**
+ * @author n.hoffmann
+ * @created May 11, 2011
+ * @version 1.0
+ */
+public class DeterminationHistoryDetailSection extends
+               AbstractDeterminationEventDetailSection {
+
+       /**
+        * @param formFactory
+        * @param conversation
+        * @param parentElement
+        * @param style
+        */
+       public DeterminationHistoryDetailSection(CdmFormFactory formFactory,
+                       ConversationHolder conversation, ICdmFormElement parentElement,
+                       int style) {
+               super(formFactory, conversation, parentElement, "Determination History", style);
+       }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection#getCollection(java.lang.Object)
+        */
+       @Override
+       public Collection<DeterminationEvent> getCollection(DerivedUnitFacade entity) {
+               return entity != null ? entity.getOtherDeterminations() : null;
+       }
+
+}