ref #6390: fix display of misapplied names in name editor
authorKatja Luther <k.luther@bgbm.org>
Tue, 13 Jun 2017 13:19:10 +0000 (15:19 +0200)
committerKatja Luther <k.luther@bgbm.org>
Tue, 13 Jun 2017 13:19:10 +0000 (15:19 +0200)
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/MisapplicationContainer.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/ExcelNormalExplicitTaxaImportWizard.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/io/wizard/ImportFromFileDataSourceWizardPage.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/configurator/deleteConfigurator/DeleteMediaConfiguratorComposite.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/ReferenceDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/taxon/TaxonRelationshipDetailElement.java

index 9c0da484ea7fd5e83667300258d66a721b7813bb..3be30d737c8e73eeca33f476b24c9ad06f7e39b0 100644 (file)
@@ -11,8 +11,11 @@ package eu.etaxonomy.taxeditor.editor.name.container;
 
 import javax.persistence.GenerationType;
 
+import org.apache.commons.lang.StringUtils;
 import org.eclipse.swt.graphics.Font;
 
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
+import eu.etaxonomy.cdm.model.name.TaxonName;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
 import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
@@ -77,27 +80,32 @@ public class MisapplicationContainer extends AbstractGroupedContainer<Taxon> {
                }
                String title = "";
                String author = "";
-               if (getMisappliedName().getName().getAuthorshipCache() != null && getMisappliedName().getAppendedPhrase() == null){
-                       author = ", non " + getMisappliedName().getName().getAuthorshipCache();
+               TaxonName misappliedNameName = HibernateProxyHelper.deproxy(getMisappliedName().getName(), TaxonName.class);
+               if (misappliedNameName.getAuthorshipCache() != null && !StringUtils.isBlank(misappliedNameName.getAuthorshipCache())&& getMisappliedName().getAppendedPhrase() == null){
+                       author = ", non " + misappliedNameName.getAuthorshipCache();
                }
                if (misapplication.getCitation() == null) {
                    if (getMisappliedName().getAppendedPhrase() != null ){
                        title = getMisappliedName().getAppendedPhrase();
                    }else{
                        title = "auct."; //$NON-NLS-1$
+                       
                    }
+                 
                } else {
                        String sec = " sensu "; //$NON-NLS-1$
                        if (getMisappliedName().getAppendedPhrase() != null ){
                            sec = getMisappliedName().getAppendedPhrase() + " "+sec; //$NON-NLS-1$
                        }
                        title += sec + misapplication.getCitation().getTitleCache();
-                       title += author;
-                       title = title.replace("&", "&&"); //$NON-NLS-1$ //$NON-NLS-2$
                        
                        
-                       setNonEditableInfo(title, false);
+                       
+                       
                }
+               title += author;
+               title = title.replace("&", "&&"); //$NON-NLS-1$ //$NON-NLS-2$
+               setNonEditableInfo(title, false);
        }
 
        /**
index a0eab6142a2dd2bf08dedb6f5844d60e78f22437..46ab6ef20299348a40a61bb9cf950ca87e5bc6a9 100644 (file)
@@ -61,6 +61,7 @@ public class ExcelNormalExplicitTaxaImportWizard extends AbstractImportWizard<No
                URI source = dataSourcePage.getUri();
                configurator.setSource(source);
                configurator.setDbSchemaValidation(DbSchemaValidation.CREATE);
+               configurator.setSourceReferenceTitle(dataSourcePage.getTextReferenceString().getText());
                File file = new File(source);
                FileInputStream fis = null;
 
index 8b3f2dd80f20ef45f624613e97aabc940de6a596..bc3763d428fc7445da49e32a1b9087f1e9e42b52 100644 (file)
@@ -39,8 +39,7 @@ public class ImportFromFileDataSourceWizardPage extends AbcdSourceSelectionPage
        private String[] extensions = {"*.xml"};
 
        private FileDialog fileDialog;
-
-
+       private Text textReferenceString;
 
        protected ImportFromFileDataSourceWizardPage(String title, String description, String[] extensions) {
                super(PAGE_NAME);
@@ -95,13 +94,29 @@ public class ImportFromFileDataSourceWizardPage extends AbcdSourceSelectionPage
 
                });
 
-
+               Label labelRef = new Label(composite, SWT.NONE);
+        labelRef.setText("Default import souce reference");
+        labelRef.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 3, 1));
+        textReferenceString = new Text(composite, SWT.NONE);
+        textReferenceString.setEnabled(true);
+        GridData gd_textReferenceString = new GridData(SWT.LEFT, SWT.CENTER, true, true, 3, 1);
+        gd_textReferenceString.widthHint = 229;
+        textReferenceString.setLayoutData(gd_textReferenceString);
                setControl(composite);
        }
 
        public File getFile() {
                return new File(text_source.getText());
        }
+       
+       public Text getTextReferenceString() {
+               return textReferenceString;
+       }
+
+       public void setTextReferenceString(Text textReferenceString) {
+               this.textReferenceString = textReferenceString;
+       }
+
 
        @Override
     public URI getUri() {
index fadc0ad4c51e4851300fd48b401f95f3ea5b4097..5e9d4f6968f71bf305dfe7f564ecc2ce25c537bf 100644 (file)
@@ -84,7 +84,7 @@ public class DeleteMediaConfiguratorComposite extends Composite {
 //            });
             btnRemoveFromImageGallery = new Button(this, SWT.RADIO);
             btnRemoveFromImageGallery.setText(Messages.DeleteConfiguration_media_removeFromGallery);
-            btnDelete.setSelection(!configurator.isOnlyRemoveFromGallery());
+            btnDelete.setSelection(true);
                btnRemoveFromImageGallery.setSelection(configurator.isOnlyRemoveFromGallery());
         }
 
index bc940dd91fe59777a44d60e2a8125b2ee08aada8..35f637e54b0e5b3fabf35fa86544d2a07e9e3704 100755 (executable)
@@ -53,7 +53,7 @@ import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
 public class ReferenceDetailElement extends AbstractIdentifiableEntityDetailElement<Reference>
                implements IErrorIntolerableElement, IExceptionHandler {
 
-       private LabelElement warnForReferencedObjects;
+
 
     private ToggleableTextElement toggleableAbbrevCache;
 
@@ -621,25 +621,7 @@ public class ReferenceDetailElement extends AbstractIdentifiableEntityDetailElem
            setIrrelevant(pushedState, except);
        }
 
-       public void setWarnForReferencingObjects(ICdmFormElement formElement){
-           if (getEntity().getId() != 0){
-               Integer referencingObjectsCount = CdmStore.getCommonService().getReferencingObjectsCount(getEntity());
-
-               if (referencingObjectsCount > 1){
-                       warnForReferencedObjects = formFactory.createLabel(formElement, CdmUtils.Nz("The reference is referenced by " + referencingObjectsCount+ " objects, if you change it, it is changed for all these objects"));
-                       warnForReferencedObjects.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
-                       warnForReferencedObjects.setLayout(LayoutConstants.FILL(2, 3));
-
-                       warnForReferencedObjects.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_RED));
-               }
-           }
-       }
-
-       public void setWarnForReferencingObjectsVisible(boolean isVisible){
-               if (warnForReferencedObjects != null){
-                       warnForReferencedObjects.setVisible(isVisible);
-               }
-       }
+       
 
 
 }
index bcbe4602331edde423437fc90d3fa44f246613fd..ab380db570005af3aa0723a1bb6cd11ae0bc3a9a 100644 (file)
@@ -93,16 +93,15 @@ public class TaxonRelationshipDetailElement extends AbstractCdmDetailElement<Tax
                                getEntity().getCitationMicroReference(),null,
                                SWT.WRAP);
 
-               checkbox_doubtful = formFactory.createCheckbox(formElement,
-                                       entity.getClass().getSimpleName() + " Misappl. doubtful", entity.isDoubtful(), style);
+               
        
        
                checkbox_published = formFactory.createCheckbox(formElement,
-                                       "Taxon is published", taxon.isPublish(), style);
+                                       "Published", taxon.isPublish(), style);
                        
                        
                secReference = formFactory.createSelectionElement(Reference.class,
-                               getConversationHolder(), formElement, "err. Secundum",
+                               getConversationHolder(), formElement, "Err. Secundum",
                                taxon.getSec(), EntitySelectionElement.ALL,
                                style);
        
@@ -110,6 +109,8 @@ public class TaxonRelationshipDetailElement extends AbstractCdmDetailElement<Tax
                    formElement, "Detail",
                    taxon.getSecMicroReference(),null,
                    SWT.WRAP);
+               checkbox_doubtful = formFactory.createCheckbox(formElement,
+                               " Misappl. doubtful", entity.isDoubtful(), style);
 
                
        }