fix #6050: add the possibility to configure which fields should be displayed in name...
authorKatja Luther <k.luther@bgbm.org>
Thu, 20 Oct 2016 11:55:27 +0000 (13:55 +0200)
committerKatja Luther <k.luther@bgbm.org>
Thu, 20 Oct 2016 11:55:27 +0000 (13:55 +0200)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/TaxonomicEditorGeneralPreferences.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NameDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/NonViralNameDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java

index b5485c6df25e265fd03f076270b63f8ba816e06c..ccbc6b96e654b40120ebbd1757791bb19b69d809 100644 (file)
@@ -156,9 +156,11 @@ public interface IPreferenceKeys {
 
     public static final String SHOW_ADVANCED_MEDIA_SECTION = "eu.etaxonomy.taxeditor.media.showAdvancedMedia";
     public static final String SHOW_SIMPLE_NAME_DETAILS_SECTION = "eu.etaxonomy.taxeditor.name.showSimpleName";
+    public static final String SHOW_SIMPLE_NAME_DETAILS_TAXON = "eu.etaxonomy.taxeditor.name.showNameTaxon";
     public static final String SHOW_NAME_DETAILS_SECTION_LSID = "eu.etaxonomy.taxeditor.name.showNameLsid";
     public static final String SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE = "eu.etaxonomy.taxeditor.name.showNameNomenclaturalCode";
     public static final String SHOW_NAME_DETAILS_SECTION_RANK = "eu.etaxonomy.taxeditor.name.showNameRank";
+    public static final String SHOW_NAME_DETAILS_SECTION_NAMECACHE = "eu.etaxonomy.taxeditor.name.showNameNameCache";
     public static final String SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS = "eu.etaxonomy.taxeditor.name.showNameAtomisedEpithets";
     public static final String SHOW_NAME_DETAILS_SECTION_AUTHORSHIP = "eu.etaxonomy.taxeditor.name.showNameAuthorship";
     public static final String SHOW_NAME_DETAILS_SECTION_HYBRID = "eu.etaxonomy.taxeditor.name.showNameHybrid";
@@ -167,7 +169,9 @@ public interface IPreferenceKeys {
     public static final String SHOW_NAME_DETAILS_SECTION_PROTOLOGUE = "eu.etaxonomy.taxeditor.name.showNameProtologue";
     public static final String SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION = "eu.etaxonomy.taxeditor.name.showNameTypeDesignation";
     public static final String SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP = "eu.etaxonomy.taxeditor.name.showNameNameRelationship";
-
+       public static final String SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE = "eu.etaxonomy.taxeditor.name.showNameAppendedPhrase";
+       public static final String SHOW_NAME_DETAILS_SECTION_CACHE = "eu.etaxonomy.taxeditor.name.showNameCache";
+       
     public static final String PROMPT_FOR_OPEN_SPECIMEN_IN_EDITOR = "eu.etaxonomy.taxeditor.specimen.promptForOpenSpecimenInEditor";
 
     // TODO RL
@@ -182,6 +186,11 @@ public interface IPreferenceKeys {
      */
     public static final String P2_REPOSITORY_LIST = "eu.etaxonomy.taxeditor.p2.repositories";
 
+       
+
+
+
+
 
 
 }
index e7eb2a4d1479a76c7ed3f1ebf670931871aadc13..0dd68af2e2d410f485d2e20b4e36bff430864f8a 100644 (file)
@@ -451,6 +451,18 @@ public class PreferencesUtil implements IPreferenceKeys {
                getPreferenceStore().setDefault(OPENURL_IMAGE_MAX_HEIGHT, "1000");
                getPreferenceStore().setDefault(IPreferenceKeys.DISTRIBUTION_AREA_PREFRENCES_ACTIVE, false);
                getPreferenceStore().setDefault(CHECKLIST_ID_IN_VOCABULARY, true);
+               getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS, true);
+               getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_AUTHORSHIP, true);
+               getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_HYBRID, true);
+               getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_LSID, true);
+               getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP, true);
+               getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_NAMECACHE, true);
+               getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE, true);
+               getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE, true);
+               getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS, true);
+               getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_PROTOLOGUE, true);
+               getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_RANK, true);
+               getPreferenceStore().setDefault(SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION, true);
        }
 
        /**
index 1b68e53ad791c4edf1d57afe23fc52f1c1dea014..38f5377ab9ccfcd47974859754a44979198f0c55 100644 (file)
@@ -70,42 +70,42 @@ public class TaxonomicEditorGeneralPreferences extends
                addField(new BooleanFieldEditor(IPreferenceKeys.SEARCH_OPEN_RESULTS_IN_SEPARATE_WINDOWS,
                        "Open search results in separate windows",
                        getFieldEditorParent()));
-               addField(new BooleanFieldEditor(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION,
-                "Show only a simple name details view",
-                getFieldEditorParent()));
+//             addField(new BooleanFieldEditor(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION,
+//                "Show only a simple name details view",
+//                getFieldEditorParent()));
 
                Composite composite = new Composite(getFieldEditorParent(), SWT.NULL);
         composite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1));
         composite.setLayout(new RowLayout(1));
 
-        final Label label = new Label(composite, SWT.NONE);
-        label.setText("Choose the prefered match mode for searches.");
-
-        final Combo combo_MatchMode = new Combo(composite, SWT.NONE);
-
-        MatchMode[] matchModes = MatchMode.values();
-        int currentSelectionIndex = 0;
-        for(int i = 0; i < matchModes.length; i++){
-            MatchMode mode = matchModes[i];
-            combo_MatchMode.add(mode.name(),i);
-            //TODO:the correct preselection is needed here!!
-            if (mode.equals(PreferencesUtil.getSearchConfigurator().getMatchMode())){
-                currentSelectionIndex = i;
-            }
-        }
-
-        combo_MatchMode.select(currentSelectionIndex);
-
-        combo_MatchMode.addSelectionListener(new SelectionAdapter() {
-            /* (non-Javadoc)
-             * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
-             */
-            @Override
-            public void widgetSelected(SelectionEvent e) {
-                int selectionIndex = combo_MatchMode.getSelectionIndex();
-                PreferencesUtil.getSearchConfigurator().setMatchMode(MatchMode.valueOf(combo_MatchMode.getItem(selectionIndex)));
-            }
-        });
+//        final Label label = new Label(composite, SWT.NONE);
+//        label.setText("Choose the prefered match mode for searches.");
+//
+//        final Combo combo_MatchMode = new Combo(composite, SWT.NONE);
+//
+//        MatchMode[] matchModes = MatchMode.values();
+//        int currentSelectionIndex = 0;
+//        for(int i = 0; i < matchModes.length; i++){
+//            MatchMode mode = matchModes[i];
+//            combo_MatchMode.add(mode.name(),i);
+//            //TODO:the correct preselection is needed here!!
+//            if (mode.equals(PreferencesUtil.getSearchConfigurator().getMatchMode())){
+//                currentSelectionIndex = i;
+//            }
+//        }
+//
+//        combo_MatchMode.select(currentSelectionIndex);
+//
+//        combo_MatchMode.addSelectionListener(new SelectionAdapter() {
+//            /* (non-Javadoc)
+//             * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+//             */
+//            @Override
+//            public void widgetSelected(SelectionEvent e) {
+//                int selectionIndex = combo_MatchMode.getSelectionIndex();
+//                PreferencesUtil.getSearchConfigurator().setMatchMode(MatchMode.valueOf(combo_MatchMode.getItem(selectionIndex)));
+//            }
+//        });
 
 
 
index b4e733ed7065c0fef47b2907946944096cb19d0b..ca153c81fdc5dab9f4a56127b80cb701afb78e88 100644 (file)
@@ -79,18 +79,27 @@ public class NameDetailElement extends AbstractIdentifiableEntityDetailElement<N
        protected void createControls(ICdmFormElement formElement, NonViralName nonViralName, int style) {
 
            if (isAdvancedView){
-               toggleable_cache = formFactory.createToggleableTextField(this, "Name Cache", nonViralName.getNameCache(), nonViralName.isProtectedNameCache(), style);
+               toggleable_cache = formFactory.createToggleableTextField(this, "Name Cache", nonViralName.getNameCache(), nonViralName.isProtectedNameCache(), style);
+           }else{
+               if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAMECACHE)){
+                       toggleable_cache = formFactory.createToggleableTextField(this, "Name Cache", nonViralName.getNameCache(), nonViralName.isProtectedNameCache(), style);
+               }
            }
                combo_rank = formFactory.createDefinedTermComboElement(TermType.Rank, this, "Rank", nonViralName.getRank(), style);
-
-               createGenusOrUninomialControls(this, nonViralName, style);
-               createInfragenerericEpithetControls(this, nonViralName, style);
-               createSpecificEpithetControls(this, nonViralName, style);
-               createInfraSpecificEpithetControls(this, nonViralName, style);
-               createSpecificNameParts(this, nonViralName, style);
+               if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS)){
+                       createGenusOrUninomialControls(this, nonViralName, style);
+                       createInfragenerericEpithetControls(this, nonViralName, style);
+                       createSpecificEpithetControls(this, nonViralName, style);
+                       createInfraSpecificEpithetControls(this, nonViralName, style);
+                       createSpecificNameParts(this, nonViralName, style);
+               }
                if (isAdvancedView){
                    //createSpecificNameParts(this, nonViralName, style);
                        text_appendedPhrase = formFactory.createTextWithLabelElement(formElement, "Appended Phrase", nonViralName.getAppendedPhrase(), style);
+               }else{
+                       if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE)){
+                               text_appendedPhrase = formFactory.createTextWithLabelElement(formElement, "Appended Phrase", nonViralName.getAppendedPhrase(), style);
+               }
                }
        }
 
index e88a143db4d1b1640508c9a41a6ef9b74b1b4ba2..23fe4db93d8564c53a15e1016e5cd33ae05b022e 100644 (file)
@@ -64,6 +64,26 @@ public class NonViralNameDetailElement extends
                 toggleable_cache.setVisible(false);
                 combo_nomenclaturalCode.setVisible(false);
             }
+        }else{
+               if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_CACHE)){
+                       toggleable_cache = formFactory.createToggleableTextField(formElement, "Cache", entity.getTitleCache(), entity.isProtectedTitleCache() || entity.isProtectedFullTitleCache(), style);
+                if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
+                    toggleable_cache.setVisible(false);
+                }
+               }
+               if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE)){
+                       combo_nomenclaturalCode = formFactory.createEnumComboElement(NomenclaturalCode.class, formElement, style);
+                       combo_nomenclaturalCode.setSelection(entity.getNomenclaturalCode());
+                        if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
+                                 combo_nomenclaturalCode.setVisible(false);
+                 } 
+               }
+               if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID)){
+                       textLsid = formFactory.createLsidWithExceptionLabelElement(formElement, "Lsid", entity.getLsid(), style);
+                       
+               }
+                       
+               
         }
 
 
@@ -84,7 +104,16 @@ public class NonViralNameDetailElement extends
                addControl(section_hybrid);
                addElement(section_hybrid);
            }
-           }
+        }else{
+                if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
+                        if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_HYBRID)){
+                       section_hybrid = formFactory.createHybridDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE);
+                       section_hybrid.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
+                       addControl(section_hybrid);
+                       addElement(section_hybrid);
+                        }
+           }
+        }
 
 
     }
index 2a12e89b03908859d9eb0fb4bdd7b6d175856531..48e0899021f0a6ba30c69c8ad7b9e6e5cc139f2c 100644 (file)
@@ -365,42 +365,56 @@ public class DetailsViewer extends AbstractCdmDataViewer {
         ParsingMessagesSection parsingMessagesSection = formFactory.createParsingMessagesSection(getConversationHolder(), parent, this,
                 ExpandableComposite.EXPANDED | ExpandableComposite.EXPANDED);
         if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION)){
-            TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this,
-                       ExpandableComposite.TWISTIE     | ExpandableComposite.EXPANDED);
-            formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
-            addPart(taxonBaseDetailSection);
+               TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this,
+               ExpandableComposite.TWISTIE     | ExpandableComposite.EXPANDED);
+               formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+               addPart(taxonBaseDetailSection);
+        }else{
+               if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON)){
+                   TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this,
+                               ExpandableComposite.TWISTIE     | ExpandableComposite.EXPANDED);
+                   formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+       
+                   addPart(taxonBaseDetailSection);
+               }
         }
         NonViralNameDetailSection nonViralNameSection = formFactory
                 .createNonViralNameDetailSection(getConversationHolder(), parent, this, true,
                         ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
         formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-        if (!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION)){
+        if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE)){
             NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
                        ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
             formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
+            addPart(referenceDetailSection);
+        }
+        if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS)){
             NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
                        ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
             formFactory.createHorizontalSeparator(parent, SWT.BORDER);
 
             addPart(nomenclaturalStatusSection);
-            addPart(referenceDetailSection);
+            
         }
         //TODO RL
-        if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)  && !PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION)){
-               ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
-               formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
-               TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
-               formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
-               NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
-               formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-
-                       addPart(protologSection);
-                       addPart(typeDesignationSection);
-                       addPart(nameRelationshipSection);
+        if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)  ){
+               if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE)){
+                       ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
+                       formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+                       addPart(protologSection);
+               }
+               
+               if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION)){
+                       TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
+                       formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+                       addPart(typeDesignationSection);
+               }
+               
+               if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP)){
+                       NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
+                       formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+                       addPart(nameRelationshipSection);
+               }
         }
 
         addPart(parsingMessagesSection);