fixes #673, #2169, #2186
authorn.hoffmann <n.hoffmann@localhost>
Mon, 10 Jan 2011 17:04:02 +0000 (17:04 +0000)
committern.hoffmann <n.hoffmann@localhost>
Mon, 10 Jan 2011 17:04:02 +0000 (17:04 +0000)
.gitattributes
taxeditor-editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/AbstractGroupedContainer.java
taxeditor-editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/AcceptedNameContainer.java
taxeditor-editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/ConceptContainer.java
taxeditor-editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/MisapplicationContainer.java
taxeditor-editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/SynonymContainer.java
taxeditor-store/icons/homotypic_syn_hetero_group.gif [new file with mode: 0644]
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/model/ImageResources.java
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/store/ContextManager.java
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/store/TermManager.java

index d13fe3a3788f65cfd6996c426b62f38d5f5cd580..8931a2b7d3156ccdf09af124cf1436b328871177 100644 (file)
@@ -906,6 +906,7 @@ taxeditor-store/icons/homonym_no_bg.gif -text
 taxeditor-store/icons/homosyn.gif -text
 taxeditor-store/icons/homosyn_no_bg.gif -text
 taxeditor-store/icons/homosyn_original_no_bg.gif -text
+taxeditor-store/icons/homotypic_syn_hetero_group.gif -text
 taxeditor-store/icons/horizontal.gif -text
 taxeditor-store/icons/icon.ico -text
 taxeditor-store/icons/icon.png -text
index 0befdbae6bd109333b0d94b8b763b1ffad6be359..9ce7189ed33d5bfc2414af007f672f1b55f35f6d 100644 (file)
@@ -116,6 +116,8 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements I
        public static final int ACCEPTED_INDENT = 20;
        /** Constant <code>SYNONYM_INDENT=40</code> */
        public static final int SYNONYM_INDENT = 40;
+       /** Constant <code>HOMOTYPIC_SYNONYM_IN_HETEROTYPIC_GROUP_INDENT = 60</code> */
+       public static final int HOMOTYPIC_SYNONYM_IN_HETEROTYPIC_GROUP_INDENT = 60;
        /** Constant <code>MISAPPLIEDNAME_INDENT=40</code> */
        public static final int MISAPPLIEDNAME_INDENT = 40;
        /** Constant <code>CONCEPT_INDENT=40</code> */
@@ -133,6 +135,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements I
                        ImageResources.HOMOTYPIC_SYN_ORIGINAL_ICON);
        /** Constant <code>HETEROTYPIC_SYNONYM_ICON</code> */
        public static final Image HETEROTYPIC_SYNONYM_ICON = ImageResources.getImage(ImageResources.HETEROTYPIC_SYN_ICON);
+       public static final Image HOMOTYPIC_SYNONYM_IN_HETEROTYPIC_GROUP_ICON = ImageResources.getImage(ImageResources.HOMOTYPIC_SYNONYM_IN_HETEROTYPIC_GROUP_ICON);
        public static final Image INVALID_OR_NUDUM_NAME_ICON = ImageResources.getImage(ImageResources.NOM_INVAL_NUD_SYN_ICON);
        /** Constant <code>HETEROTYPIC_SYNONYM_ORIGINAL_COMBINATION_ICON</code> */
        public static final Image HETEROTYPIC_SYNONYM_ORIGINAL_COMBINATION_ICON = ImageResources.getImage(
@@ -328,6 +331,8 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements I
                
 //             showNameRelations();
                
+               updateIndent();
+               
                updateIcon();
                
                String text = NameHelper.getDisplayNameWithRef(getData());
@@ -384,6 +389,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements I
                
                updateIcon();
 //             placeCursor();
+               updateIndent();
                
                isFreeTextEnabled();
        }
@@ -393,6 +399,8 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements I
         */
        protected abstract void updateIcon();
 
+       
+       protected abstract void updateIndent();
 
 
        /**
@@ -624,6 +632,7 @@ abstract public class AbstractGroupedContainer<T extends TaxonBase> implements I
                        layout.leftMargin = indent;
                        layout.rightMargin = ACCEPTED_INDENT;
                        control.setLayout(layout);
+                       control.layout();
                } else {
                        new RuntimeException("Couldn't indent - composite's layout must be TableWrapLayout.");
                }
index 23b556d5157386ae5f91a9e176f74f8c62d226e2..c55072a1c8aeca362e3d4e9005867ae0f66af6de 100644 (file)
@@ -39,7 +39,6 @@ public class AcceptedNameContainer extends AbstractGroupedContainer<Taxon> {
         */
        public void initializeComposite(){
                setFont(getViewerFont());
-               setIndent(ACCEPTED_INDENT);
                
                initTextViewer();
        }
@@ -64,4 +63,13 @@ public class AcceptedNameContainer extends AbstractGroupedContainer<Taxon> {
                setIcon(ACCEPTED_ICON);         
        }
 
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.editor.name.AbstractGroupedContainer#updateIndent()
+        */
+       @Override
+       protected void updateIndent() {
+               setIndent(ACCEPTED_INDENT);
+       }
+
 }
index f817c1caf0d08f179782740b84651c6aaff5ae68..dc28c26d3fc1863a1994b587943b0cdfaabb812e 100644 (file)
@@ -50,7 +50,6 @@ public class ConceptContainer extends AbstractGroupedContainer<Taxon> {
                
                setIsDraggable(true);
                setFont(getViewerFont());
-               setIndent(CONCEPT_INDENT);
                
                showSec();
                                
@@ -132,6 +131,14 @@ public class ConceptContainer extends AbstractGroupedContainer<Taxon> {
                showSec();
                showRelationshipType();
        }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.editor.name.AbstractGroupedContainer#updateIndent()
+        */
+       @Override
+       protected void updateIndent() {
+               setIndent(CONCEPT_INDENT);
+       }
 }
 
 
index f6516ceacb58c31fcb3ccd95c14f8fd07acb024b..4a46fd7544426bc3758d7c2db5069fe1de88bced 100644 (file)
@@ -44,7 +44,6 @@ public class MisapplicationContainer extends AbstractGroupedContainer<Taxon> {
        protected void initializeComposite() {
                setIsDraggable(true);
                setFont(getViewerFont());
-               setIndent(MISAPPLIEDNAME_INDENT);
                
                showSec();              
                
@@ -100,4 +99,13 @@ public class MisapplicationContainer extends AbstractGroupedContainer<Taxon> {
                showSec();
        }
 
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.editor.name.AbstractGroupedContainer#updateIndent()
+        */
+       @Override
+       protected void updateIndent() {
+               setIndent(MISAPPLIEDNAME_INDENT);
+       }
+
 }
index 813ee4118af46fdfaeb2c2e32d7de6bbcff0b054..1b11c164d02e309df2eb737998d9f765f5d430ba 100644 (file)
@@ -29,7 +29,7 @@ import eu.etaxonomy.taxeditor.preference.Resources;
  * @version 1.0
  */
 public class SynonymContainer extends AbstractGroupedContainer<Synonym> {
-       
+
        /**
         * <p>Constructor for SynonymContainer.</p>
         *
@@ -49,7 +49,6 @@ public class SynonymContainer extends AbstractGroupedContainer<Synonym> {
        protected void initializeComposite() {
                setIsDraggable(true);
                setFont(getViewerFont());
-               setIndent(SYNONYM_INDENT);
                
                if(getName() == null){
                        EditorUtil.warn(getClass(), "Synonym with a null name detected. This should never happen.");
@@ -83,12 +82,17 @@ public class SynonymContainer extends AbstractGroupedContainer<Synonym> {
                        }
                }
                        
-               
-               if (name.isGroupsBasionym()) {
-                       setIcon(HETEROTYPIC_SYNONYM_ORIGINAL_COMBINATION_ICON);
-               } else {
+               if (name.getHomotypicalGroup().getBasionyms().isEmpty()) {
                        setIcon(HETEROTYPIC_SYNONYM_ICON);
-               }               
+               }else{
+                       if (name.isGroupsBasionym()) {
+                               setIcon(HETEROTYPIC_SYNONYM_ORIGINAL_COMBINATION_ICON);
+                       } else {
+                               setIcon(HOMOTYPIC_SYNONYM_IN_HETEROTYPIC_GROUP_ICON);
+                       }                                       
+               }
+               
+               
        }
        
        private boolean isHomotypic() {
@@ -120,4 +124,19 @@ public class SynonymContainer extends AbstractGroupedContainer<Synonym> {
        protected void updateNonEditableInfo() {
                // not needed
        }
+
+       /* (non-Javadoc)
+        * @see eu.etaxonomy.taxeditor.editor.name.AbstractGroupedContainer#updateIndent()
+        */
+       @Override
+       protected void updateIndent() {
+               TaxonNameBase name = getName();
+       
+               if (!name.getHomotypicalGroup().getBasionyms().isEmpty() && !name.isGroupsBasionym()) {
+                       setIndent(HOMOTYPIC_SYNONYM_IN_HETEROTYPIC_GROUP_INDENT);
+                       return;
+               }
+               
+               setIndent(SYNONYM_INDENT);
+       }
 }
diff --git a/taxeditor-store/icons/homotypic_syn_hetero_group.gif b/taxeditor-store/icons/homotypic_syn_hetero_group.gif
new file mode 100644 (file)
index 0000000..0fdd11d
Binary files /dev/null and b/taxeditor-store/icons/homotypic_syn_hetero_group.gif differ
index 0658c7cfe9742d2fc6cb89d9312c27f59a665973..4a091b3247fbdd6bb99a8a3af8de4c981f41876e 100644 (file)
@@ -71,6 +71,7 @@ public class ImageResources {
        /** Constant <code>HETEROTYPIC_SYN_ICON="heterotypic_syn_icon"</code> */
        public static final String HETEROTYPIC_SYN_ICON = "heterotypic_syn_icon";
        public static final String NOM_INVAL_NUD_SYN_ICON = "nom_inval_nud_syn_icon";
+       public static final String HOMOTYPIC_SYNONYM_IN_HETEROTYPIC_GROUP_ICON = "homotypic_synonym_in_heterotypic_group_icon";
        /** Constant <code>HETEROTYPIC_SYN_ORIGINAL_ICON="heterotypic_syn_original_icon"</code> */
        public static final String HETEROTYPIC_SYN_ORIGINAL_ICON = "heterotypic_syn_original_icon";
        /** Constant <code>MISAPPLIED_NAME_ICON="misapplied_icon"</code> */
@@ -241,6 +242,8 @@ public class ImageResources {
                                "nominval_nud_no_bg.gif");
                registerImage(registry, HETEROTYPIC_SYN_ORIGINAL_ICON,
                                "heterosyn_original_no_bg.gif");
+               registerImage(registry, HOMOTYPIC_SYNONYM_IN_HETEROTYPIC_GROUP_ICON, 
+                               "homotypic_syn_hetero_group.gif");
                registerImage(registry, MISAPPLIED_NAME_ICON,
                                "misapplied_no_bg.gif");
                registerImage(registry, CONCEPT_ICON,
index 651175db1f1b9e6b9229209b30bc79975f9d34e2..146f927c3b2e39517dc13ec19eccb9684cba8429 100644 (file)
@@ -91,7 +91,6 @@ public class ContextManager implements IWorkbenchListener{
                                                ((IContextListener) listener).contextStart(memento, monitor);
                                                monitor.worked(1);
                                        }
-                                               
                                        monitor.done();
                                }
                        });
index 4a4e542535023b5e388ac07d082ad1cbd7750cc2..f0b52dc890021cb1a23e3de55c2ff8610dcbeddf 100644 (file)
@@ -72,6 +72,10 @@ public class TermManager extends ContextListenerAdapter{
        @Override
        public void contextStart(IMemento memento, IProgressMonitor monitor) {
                // read preferred terms from memento into an in memory representation
+               if(memento == null){
+                       return;
+               }
+               
                IMemento terms = memento.getChild(TERMS);
 
                if(terms == null){