ref #9116: layout issues and missing fields
authorKatja Luther <k.luther@bgbm.org>
Thu, 13 Aug 2020 11:00:54 +0000 (13:00 +0200)
committerKatja Luther <k.luther@bgbm.org>
Thu, 13 Aug 2020 11:00:54 +0000 (13:00 +0200)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/messages.properties
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/messages_de.properties
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/classification/TaxonNodeDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/AdvancedSourceElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/OriginalSourceAdvancedSection.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/reference/OriginalSourceElement.java

index be5dbdff4dedca7ebcb9ecb9b7f70548c83c26d3..801910bd3cd80788b5308919bdf635c32270025d 100644 (file)
@@ -600,4 +600,4 @@ CommonNameLanguages_Title=Common Name Languages
 CommonNameVocabularyPreferencePage_description=Select the vocabularies for common name area selection.
 CommonNameLanguagePreferencePage_description=Choose the languages available for common names.
 EnumCombo_Placement_status=Placement status
-OriginalSourceAdvancedSection_advanced=Advanced
\ No newline at end of file
+OriginalSourceAdvancedSection_advanced=Additional information
\ No newline at end of file
index 4287fb9d89754c0286348d52f7f0f44c226c5d45..de6557b1ad7e10a03d06dc3592adacfd20b6c673 100644 (file)
@@ -600,4 +600,4 @@ CommonNameVocabularyPreferencePage_description=W
 CommonNameLanguagePreferencePage_description=Wählen Sie die für Trivialnamen verfügbaren Sprachen.
 
 EnumCombo_Placement_status=Platzierungsstatus
-OriginalSourceAdvancedSection_advanced=Erweitert
\ No newline at end of file
+OriginalSourceAdvancedSection_advanced=Zusätzliche Informationen
\ No newline at end of file
index a3685f33c76135ba48a386a0405c5a22a7f577dd..a6c399e1a592c14c1c63706dcbaa103dad713402 100644 (file)
@@ -149,21 +149,18 @@ public class TaxonNodeDetailElement extends AbstractCdmDetailElement<TaxonNode>
                             formElement, SECUNDUM_REFERENCE, taxon != null? taxon.getSec(): null,
                             EntitySelectionElement.DELETABLE, style, 100);
 
+            microReference = formFactory.createTextWithLabelElement(formElement, "Secundum Details", "", style);
+
+
             checkbox_publish = formFactory.createCheckbox(formElement,
                     Messages.TaxonNodeWizardPage_TAXON_IS_PUBLISH, true, style);
 
             checkbox_publish.setEnabled(isCreateNew());
-            Label seperator = new Label(getLayoutComposite(), SWT.HORIZONTAL | SWT.SEPARATOR);
-            seperator.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 3));
+
             Label nodeTitle = new Label(getLayoutComposite(), SWT.NULL);
             nodeTitle.setText(Messages.TaxonNodeWizardPage_TAXON_NODE);
             nodeTitle.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
             nodeTitle.setFont(FONT_BOLD);
-
-
-//            microReference = formFactory.createTextWithLabelElement(formElement,
-//                    Messages.TaxonNodeWizardPage_PLACEMENT_SOURCE_DETAIL, "", style);
-//            microReference.setText(parentNode.getMicroReference());
             selection_parentTaxonNode = formFactory
                     .createTaxonNodeSelectionElement(getConversationHolder(), formElement, Messages.TaxonNodeWizardPage_PARENT, parentNode,
                             EntitySelectionElement.DELETABLE, style, 100);
@@ -178,12 +175,14 @@ public class TaxonNodeDetailElement extends AbstractCdmDetailElement<TaxonNode>
                           Messages.TaxonNodeWizardPage_TAXON, taxon,
                           EntitySelectionElement.DELETABLE, style);
 
-               textTaxonSec = formFactory.createTextWithLabelElement(formElement,SECUNDUM_REFERENCE, "", style);
 
+               textTaxonSec = formFactory.createTextWithLabelElement(formElement,SECUNDUM_REFERENCE, "", style);
+               microReference = formFactory.createTextWithLabelElement(formElement, "Secundum Details", "", style);
             if (entity.getTaxon().getSec() != null){
                 textTaxonSec.setText(taxon.getSec().getTitleCache());
             }
             textTaxonSec.setEnabled(false);
+            microReference.setEnabled(false);
 
             Label nodeTitle = new Label(getLayoutComposite(), SWT.NULL);
             nodeTitle.setText("Taxon Node");
@@ -199,9 +198,6 @@ public class TaxonNodeDetailElement extends AbstractCdmDetailElement<TaxonNode>
                         formElement, Messages.TaxonNodeWizardPage_PARENT, entity.getParent().getTaxon().getTitleCache(), style);
                 textParent.setEnabled(false);
             }
-//            sourceSection = formFactory.createOriginalSourceElement(formElement, entity);
-
-
            }
            Label spacer = new Label(getLayoutComposite(), SWT.NULL);
            spacer.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
@@ -292,14 +288,16 @@ public class TaxonNodeDetailElement extends AbstractCdmDetailElement<TaxonNode>
                    if (selection_reuseExistingTaxon.getEntity() != null){
                        setTaxon(selection_reuseExistingTaxon.getEntity());
                        if (getTaxon().getSec()!= null){
+                           microReference.setText(getTaxon().getSecMicroReference());
                            if (isCreateNew()){
                               selection_SecRef.setEntity(getTaxon().getSec());
                            }else{
                               textTaxonSec.setText((getTaxon().getSec().getTitleCache()));
                            }
                        }else{
+                           microReference.setText("");
                            if (isCreateNew()){
-                              selection_SecRef.setEntity(null);
+                                   selection_SecRef.setEntity(null);
                            }else{
                               textTaxonSec.setText("");
                            }
@@ -333,9 +331,8 @@ public class TaxonNodeDetailElement extends AbstractCdmDetailElement<TaxonNode>
                 taxon.setSec(selection_SecRef.getEntity());
             }
         }else if (eventSource == microReference) {
-            if(!isCreateNew()){
-                getEntity().setMicroReference(microReference.getText());
-            }
+            getEntity().getTaxon().setSecMicroReference(microReference.getText());
+
         }  else if (eventSource == checkbox_publish) {
             if (taxon != null){
                 taxon.setPublish(checkbox_publish.getSelection());
index 9df3fef7cde9afbaf678a67cc540c17c35396ec2..4d32a522a140ce098add41fbe56d1ac7beda65ce 100755 (executable)
@@ -15,6 +15,7 @@ import org.eclipse.swt.widgets.Display;
 import eu.etaxonomy.cdm.model.common.ReferencedEntityBase;
 import eu.etaxonomy.cdm.model.description.DescriptionElementSource;
 import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
+import eu.etaxonomy.cdm.model.name.TaxonName;
 import eu.etaxonomy.cdm.model.reference.OriginalSourceBase;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.store.StoreUtil;
@@ -24,6 +25,7 @@ import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
 import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
 import eu.etaxonomy.taxeditor.ui.section.common.ExternalLinksSection;
+import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
 
 /**
  * @author k.luther
@@ -35,6 +37,7 @@ public class AdvancedSourceElement extends AbstractCdmDetailElement<ReferencedEn
     protected TextWithLabelElement text_idNamespace;
     protected TextWithLabelElement text_originaleNameString;
     protected TextWithLabelElement text_cdmsource;
+    protected EntitySelectionElement<TaxonName> select_nameUsedInSource;
 
     protected ExternalLinksSection externalLinks;
 
@@ -50,10 +53,11 @@ public class AdvancedSourceElement extends AbstractCdmDetailElement<ReferencedEn
         Display display = Display.getCurrent();
         Color background = display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
 
-        if (PreferencesUtil.getBooleanValue(PreferencePredicate.ShowIdInSource.getKey())){
 
+        if (PreferencesUtil.getBooleanValue(PreferencePredicate.ShowIdInSource.getKey())){
             text_idInSource = formFactory.createTextWithLabelElement(formElement, "ID in Source", entity != null?((OriginalSourceBase)entity).getIdInSource():null, style);
             text_idInSource.setBackground(background);
+
         }
         if (PreferencesUtil.getBooleanValue(PreferencePredicate.ShowNamespaceInSource.getKey())){
             text_idNamespace = formFactory.createTextWithLabelElement(formElement, "ID Namespace", entity != null?((OriginalSourceBase)entity).getIdNamespace():null, style);
@@ -63,8 +67,8 @@ public class AdvancedSourceElement extends AbstractCdmDetailElement<ReferencedEn
                 formElement, "Original Information", entity != null?entity.getOriginalNameString():null, SWT.NULL);
 
         text_originaleNameString.setBackground(background);
-//        text_cdmsource = formFactory.createTextWithLabelElement(
-//                formElement, "CDM Source", entity != null?entity.getCdmSource():null, SWT.NULL);
+
+        select_nameUsedInSource = formFactory.createSelectionElement(TaxonName.class, formElement, "Name in Source", entity != null? ((DescriptionElementSource)entity).getNameUsedInSource(): null, EntitySelectionElement.DELETABLE, style);
         externalLinks = formFactory.createExternalLinksSection(getConversationHolder(), formElement, StoreUtil.getSectionStyle(ExternalLinksSection.class, DescriptionElementSource.class.getCanonicalName()));
         externalLinks.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 3));
         externalLinks.setEntity( ((OriginalSourceBase)entity));
@@ -88,6 +92,8 @@ public class AdvancedSourceElement extends AbstractCdmDetailElement<ReferencedEn
              ((OriginalSourceBase)getEntity()).setIdNamespace(text_idNamespace.getText());
          }else if (eventSource.equals(text_originaleNameString)){
              ((OriginalSourceBase)getEntity()).setOriginalNameString(text_originaleNameString.getText());
+         }else if (eventSource.equals(select_nameUsedInSource)){
+             ((DescriptionElementSource)getEntity()).setNameUsedInSource(select_nameUsedInSource.getEntity());
          }
 
     }
index 2c71f11c2804c733527760319535e1b391fb6a38..05b3037a0639e2ab4372038f1198581b048772f5 100755 (executable)
@@ -9,6 +9,7 @@
 package eu.etaxonomy.taxeditor.ui.section.reference;
 
 import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
 
 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.model.common.ReferencedEntityBase;
@@ -50,5 +51,16 @@ public class OriginalSourceAdvancedSection extends AbstractCdmDetailSection<Refe
 
         return Messages.OriginalSourceAdvancedSection_advanced;
     }
+    @Override
+    protected void createControlsByType(AbstractCdmDetailSection<ReferencedEntityBase> formElement, Class<ReferencedEntityBase> entityClass, int style) {
+        super.createControlsByType(formElement, entityClass, style);
+
+        TableWrapLayout layout = new TableWrapLayout();
+        layout.topMargin = 0;
+        layout.bottomMargin = 0;
+        layout.numColumns = DEFAULT_NUM_COLUMNS;
+        setLayout(layout);
+
+    }
 
 }
index 089dcdf6fbc3d52a53db25f13d06eb4369850574..b56d3663d47aeafc897b293678ef25f53a91b9e6 100755 (executable)
@@ -9,6 +9,7 @@
 package eu.etaxonomy.taxeditor.ui.section.reference;
 
 import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.ui.forms.widgets.TableWrapData;
 
 import eu.etaxonomy.cdm.model.common.CdmBase;
 import eu.etaxonomy.cdm.model.common.ReferencedEntityBase;
@@ -21,6 +22,7 @@ import eu.etaxonomy.taxeditor.store.StoreUtil;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
 import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
+import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
 import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
 
@@ -30,18 +32,13 @@ import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
  */
 public class OriginalSourceElement extends AbstractCdmDetailElement<ReferencedEntityBase> implements IPropertyChangeListener{
 
-//    protected EnumComboElement<OriginalSourceType> combo_origsourcetype;
-
     private EntitySelectionElement<Reference> selection_Ref;
+    private TextWithLabelElement microReference;
     private OriginalSourceAdvancedSection advancedSection;
 
     private CdmBase cdmEntity;
 
 
-//    protected EntitySelectionElement<Reference> selection_reference;
-//    protected TextWithLabelElement text_referenceDetail;
-
-
     public OriginalSourceElement(CdmFormFactory formFactory, ICdmFormElement formElement, CdmBase cdmEntity) {
         super(formFactory, formElement);
         this.cdmEntity = cdmEntity;
@@ -59,11 +56,16 @@ public class OriginalSourceElement extends AbstractCdmDetailElement<ReferencedEn
             selection_Ref.setEntity(entity.getCitation());
         }
         selection_Ref.setBackground(this.getPersistentBackground());
+        microReference = formFactory.createTextWithLabelElement(formElement, "Details", entity != null? entity.getCitationMicroReference(): "", style);
         for (ICdmFormElement element: selection_Ref.getElements()){
             element.setBackground(getPersistentBackground());
         }
+
         advancedSection = formFactory.createOriginalSourceAdvancedSection(getConversationHolder(), formElement, null, StoreUtil.getSectionStyle(OriginalSourceAdvancedSection.class, INomenclaturalReference.class.getCanonicalName()));
-        advancedSection.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+        TableWrapData layoutData = LayoutConstants.FILL_HORIZONTALLY(2, 1);
+
+
+        advancedSection.setLayoutData(layoutData);
 
         addControl(advancedSection);
         addElement(advancedSection);
@@ -88,6 +90,18 @@ public class OriginalSourceElement extends AbstractCdmDetailElement<ReferencedEn
             //TODO: why is this null????ß
             getEntity().setCitation(selection_Ref.getEntity());
 
+        }else if (eventSource.equals(microReference)){
+
+            if (getEntity() == null){
+                DescriptionElementSource source = DescriptionElementSource.NewPrimarySourceInstance(null, null);
+                setEntity(source);
+                if (cdmEntity != null && cdmEntity instanceof TaxonNode){
+                    ((TaxonNode)cdmEntity).setSource(source);
+                }
+            }
+            //TODO: why is this null????ß
+            getEntity().setCitationMicroReference(microReference.getText());
+
         }
 
     }