SearchResultLabelProvider : display new orphaned-taxa image icon for orphaned taxa
authorCherian Mathew <c.mathew@bgbm.org>
Fri, 8 Mar 2013 09:25:24 +0000 (09:25 +0000)
committerCherian Mathew <c.mathew@bgbm.org>
Fri, 8 Mar 2013 09:25:24 +0000 (09:25 +0000)
AbstractGroupedContainer : updated 'isNameUsedMultipleTimes' to factor in orphaned taxa
TaxonEditorInput : added display of message in case of orphaned taxa
ImageResources : added new orphaned-taxa image icon to resources

eu.etaxonomy.taxeditor.cdmlib/.classpath
eu.etaxonomy.taxeditor.cdmlib/lib/org.eclipse.osgi-3.7.2.v20120110-1415.jar
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/TaxonEditorInput.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/AbstractGroupedContainer.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchResultLabelProvider.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/ImageResources.java

index b538d1c2ffd741c8546d65357193651b44164b3e..c2d0d4d3059b6e0cfc728f39a919c323e7f7a460 100644 (file)
        <classpathentry exported="true" kind="lib" path="lib/postgresql-9.1-901.jdbc4.jar"/>
        <classpathentry exported="true" kind="lib" path="lib/identificationKeyAPI-1.0-SNAPSHOT-sources.jar"/>
        <classpathentry exported="true" kind="lib" path="lib/identificationKeyAPI-1.0-SNAPSHOT.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-commons-3.1.2-sources.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-commons-3.1.2.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-ext-3.1.2-sources.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-ext-3.1.2.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-io-3.1.2-sources.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-io-3.1.2.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-model-3.1.2-sources.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-model-3.1.2.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-persistence-3.1.2-sources.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-persistence-3.1.2.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-print-3.1.2-sources.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-print-3.1.2.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-remote-3.1.2-sources.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-remote-3.1.2.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-services-3.1.2-sources.jar"/>
-       <classpathentry exported="true" kind="lib" path="lib/cdmlib-services-3.1.2.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-commons-3.1.4-SNAPSHOT-sources.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-commons-3.1.4-SNAPSHOT.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-ext-3.1.4-SNAPSHOT-sources.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-ext-3.1.4-SNAPSHOT.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-io-3.1.4-SNAPSHOT-sources.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-io-3.1.4-SNAPSHOT.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-model-3.1.4-SNAPSHOT-sources.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-model-3.1.4-SNAPSHOT.jar" sourcepath="lib/cdmlib-model-3.1.4-SNAPSHOT-sources.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-persistence-3.1.4-SNAPSHOT-sources.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-persistence-3.1.4-SNAPSHOT.jar" sourcepath="lib/cdmlib-persistence-3.1.4-SNAPSHOT-sources.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-print-3.1.4-SNAPSHOT-sources.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-print-3.1.4-SNAPSHOT.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-remote-3.1.4-SNAPSHOT-sources.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-remote-3.1.4-SNAPSHOT.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-services-3.1.4-SNAPSHOT-sources.jar"/>
+       <classpathentry exported="true" kind="lib" path="lib/cdmlib-services-3.1.4-SNAPSHOT.jar" sourcepath="lib/cdmlib-services-3.1.4-SNAPSHOT-sources.jar"/>
        <classpathentry kind="output" path="target/classes"/>
 </classpath>
index 25f118068392d39fda76feea6c855dfb3633db17..f131a431cbf20a8f2194c84912950bd3e0a6485b 100644 (file)
Binary files a/eu.etaxonomy.taxeditor.cdmlib/lib/org.eclipse.osgi-3.7.2.v20120110-1415.jar and b/eu.etaxonomy.taxeditor.cdmlib/lib/org.eclipse.osgi-3.7.2.v20120110-1415.jar differ
index 65403941dd6a7d7ba04c7f491a9fc887098e7607..6db78f03df6db3863012bada0fca6d41e774b62c 100644 (file)
@@ -108,8 +108,10 @@ public class TaxonEditorInput implements IEditorInput, IConversationEnabled, IPe
        TaxonEditorInput input = null;
        
        TaxonBase taxonBase = CdmStore.getService(ITaxonService.class).find(taxonBaseUuid);
-       
-       if(taxonBase.isInstanceOf(Taxon.class)){
+       if(taxonBase.isOrphaned()) {
+               EditorUtil.warningDialog("Orphaned Taxon", TaxonEditorInput.class, "This is an orphaned taxon i.e. a taxon that is not connected to a classification and not having any taxonomic relationships. Editing of orphaned taxon is currently not supported.");
+       }
+       else if(taxonBase.isInstanceOf(Taxon.class)){
                Taxon taxon = CdmBase.deproxy(taxonBase, Taxon.class);
                
                if (taxon.isMisapplication()){
index 5fbed53059c8fd4d0dacf2bd8d805cad3f200091..e67171560099bf670e115849a818eab07ecaeb84 100644 (file)
@@ -9,6 +9,7 @@
 
 package eu.etaxonomy.taxeditor.editor.name.container;
 
+import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
@@ -454,8 +455,25 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements
                return enableFreetext;
        }
 
+       /**
+        * Checks whether there are more than one, non-orphaned taxon bases   
+        * attached to the taxon name
+        * 
+        * @return
+        */
        private boolean isNameUsedMultipleTimes() {
-               if (getName().getTaxonBases().size() > 1) {
+               
+               Set<TaxonBase> taxonBases = getName().getTaxonBases();
+               Iterator<TaxonBase> tbItr = taxonBases.iterator();
+               int nonOrphanedTaxonBaseCount = taxonBases.size();
+               
+               while(tbItr.hasNext()) {
+                       TaxonBase tb = tbItr.next(); 
+                       if(tb.isOrphaned()) {
+                               nonOrphanedTaxonBaseCount--;
+                       }
+               }
+               if(nonOrphanedTaxonBaseCount > 1) {
                        return true;
                }
                return false;
index 754611f35ae73017796b04d121d15addb4a0c0de..070687e404d7760f6884886484542c884a2f366d 100644 (file)
@@ -16,6 +16,7 @@ import org.eclipse.swt.graphics.Color;
 import org.eclipse.swt.graphics.Font;
 import org.eclipse.swt.graphics.Image;
 
+import eu.etaxonomy.cdm.api.service.ITaxonService;
 import eu.etaxonomy.cdm.model.common.UuidAndTitleCache;
 import eu.etaxonomy.cdm.model.taxon.Synonym;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
@@ -23,6 +24,7 @@ import eu.etaxonomy.cdm.model.taxon.TaxonBase;
 import eu.etaxonomy.taxeditor.model.ImageResources;
 import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
 import eu.etaxonomy.taxeditor.preference.Resources;
+import eu.etaxonomy.taxeditor.store.CdmStore;
 
 /**
  * <p>SearchResultLabelProvider class.</p>
@@ -95,6 +97,9 @@ public class SearchResultLabelProvider extends ColumnLabelProvider implements IL
 //                             return ImageResources.getImage(ImageResources.MISAPPLIED_NAME_ICON);
 //                     }else{
                        if(type == Taxon.class){
+                               if(((UuidAndTitleCache) element).getIsOrphaned()) {
+                                       return ImageResources.getImage(ImageResources.ORPHANED_TAXON);
+                               }
                                return ImageResources.getImage(ImageResources.BLACK_SQUARE_ICON);
                        }else if(type == Synonym.class){
                                return ImageResources.getImage(ImageResources.HETEROTYPIC_SYN_ICON);
index 86c3c30170da90db3b9f42caa3b8472915aba7a7..f06ac99b7cfa65d205f249851831312c6a907d91 100644 (file)
@@ -122,6 +122,8 @@ public class ImageResources {
        public static final String TWO_PRONGED_EQUAL = "2_pronged_equal";
        /** Constant <code>MISAPPLIED_NAME="misapplied_name"</code> */
        public static final String MISAPPLIED_NAME = "misapplied_name";
+       /** Constant <code>ORPHANED_TAXON="orphaned_taxon"</code> */
+       public static final String ORPHANED_TAXON = "orphaned_taxon";
        /** Constant <code>EXPAND_ALL="expand_all"</code> */
        public static final String EXPAND_ALL = "expand_all";
        /** Constant <code>COLLAPSE_ALL="collapse_all"</code> */
@@ -290,7 +292,9 @@ public class ImageResources {
                registerImage(registry, TWO_PRONGED_EQUAL, 
                                "2_pronged_equal_small.GIF");           
                registerImage(registry, MISAPPLIED_NAME, 
-                               "ma_12x12.gif");                
+                               "ma_12x12.gif");        
+               registerImage(registry, ORPHANED_TAXON, 
+                               "orphaned.gif");        
                registerImage(registry, EXPAND_ALL, 
                                "expandAll.jpg");
                registerImage(registry, COLLAPSE_ALL,