ref #8385: label issues, search dialog prefs...
authorKatja Luther <k.luther@bgbm.org>
Tue, 27 Aug 2019 10:06:06 +0000 (12:06 +0200)
committerKatja Luther <k.luther@bgbm.org>
Tue, 27 Aug 2019 10:06:06 +0000 (12:06 +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/preference/SearchDialogPreferences.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/CdmPreferencePage.java

index 5048162d0f6e40042e9a7607f1765b0d4a4428fe..d93b835dc5f670754c1598dffe451d3bab500021 100644 (file)
@@ -293,16 +293,16 @@ NameDetailsViewComposite_Show_Namerelationships=Name relationship section
 NameDetailsViewComposite_Show_Hybrid=Hybrid section
 NameDetailsViewComposite_Show_NameApprobiation=Name approbiation (for bacterial names)
 NameDetailsViewComposite_Show_Taxon=Taxon of the name
-NameDetailsViewComposite_Show_SecDetail=Secundum Reference Details
+NameDetailsViewComposite_Show_SecDetail=Secundum reference details
 NameDetailsViewComposite_SecEnabled=Secundum enabled (editing in details view possible)
 NameDetailsViewComposite_Show_LSID=Lsid of the name
 NameDetailsViewComposite_Show_NomenclaturalCode=Nomenclatural code
-NameDetailsViewComposite_Show_NameCache=NameCache of the name (only the scientific name without the author and year)
+NameDetailsViewComposite_Show_NameCache=Name cache of the name (only the scientific name without the author and year)
 NameDetailsViewComposite_Show_AppendedPhrase=Appended phrase
 NameDetailsViewComposite_Show_Rank=Rank of the name
 NameDetailsViewComposite_Show_AtomisedEpithets=Atomised epithets
 NameDetailsViewComposite_Show_AuthorCache=Authorship cache
-NameDetailsViewComposite_Show_Author=Whole Authorship section
+NameDetailsViewComposite_Show_Author=Whole authorship section
 NameDetailsViewComposite_Show_NomenclaturalReference=Nomenclatural reference section
 NameDetailsViewComposite_Show_NomenclaturalStatus=Nomenclatural status section
 NameDetailsViewComposite_Show_Protologue=Protologue section
index f38b9d33274e88e9e118a63d249e6d87b22e9fc9..a3055d593b3b8f1770bf850c6c0ec86fec39d7ad 100644 (file)
@@ -237,7 +237,7 @@ DatabasePreferencesPage_show_only_simple_details_view=Nur einen einfachen (konfi
 DatabasePreferencesPage_show_taxon=Taxon
 DatabasePreferencesPage_show_lsid=LSID
 DatabasePreferencesPage_show_nomenclatural_code=Nomenklatorischen Code
-DatabasePreferencesPage_show_namecache=Namecache
+DatabasePreferencesPage_show_namecache=Name cache
 DatabasePreferencesPage_show_appended_phrase=Appended phrase
 DatabasePreferencesPage_show_rank=Rang
 DatabasePreferencesPage_show_atomised_epithets=Atomisierte Epithete
index ee4385ccba34ce26bd9b9f96e414a8c8ebb92e6d..9278b0d853d7db36230332372f62882cac13a8ff 100755 (executable)
@@ -44,11 +44,11 @@ public class SearchDialogPreferences extends CdmPreferencePage implements Select
     protected Boolean sortTaxaByRankAndName;
     protected Boolean filterCommonNameReferences;
 
-    private boolean overrideShowIdInSelectionDialog;
-    private boolean overrideSearchForIdentifierAsDefault;
-    private boolean overrideSearchForIdentifierAndTitleCache;
-    private boolean overrideSortTaxaByRankAndName;
-    private boolean overrideFilterCommonNameReferences;
+    private boolean overrideShowIdInSelectionDialog = true;
+    private boolean overrideSearchForIdentifierAsDefault = true;
+    private boolean overrideSearchForIdentifierAndTitleCache = true;
+    private boolean overrideSortTaxaByRankAndName = true;
+    private boolean overrideFilterCommonNameReferences = true;
 
     protected Combo showIdInSelectionDialogButton;
     protected Button allowOverrideIsShowIdInSelectionDialogButton;
@@ -77,12 +77,21 @@ public class SearchDialogPreferences extends CdmPreferencePage implements Select
         overrideSearchForIdentifierAndTitleCache = PreferencesUtil.getBooleanValue(PreferencesUtil.createOverridePreferenceString(PreferencePredicate.SearchForIdentifierAndTitleCache.getKey()));
         overrideSortTaxaByRankAndName = PreferencesUtil.getBooleanValue(PreferencesUtil.createOverridePreferenceString(PreferencePredicate.SortTaxaByRankAndName.getKey()));
         overrideFilterCommonNameReferences = PreferencesUtil.getBooleanValue(PreferencesUtil.createOverridePreferenceString(PreferencePredicate.CommonNameReferencesWithMarker.getKey()));
-
-        showIdInSelectionDialog = PreferencesUtil.getBooleanValue(PreferencePredicate.ShowIdInSelectionDialog.getKey());
-        searchForIdentifierAsDefault = PreferencesUtil.getBooleanValue(PreferencePredicate.SearchForIdentifierAsDefault.getKey());
-        searchForIdentifierAndTitleCache = PreferencesUtil.getBooleanValue(PreferencePredicate.SearchForIdentifierAndTitleCache.getKey());
-        sortTaxaByRankAndName = PreferencesUtil.getBooleanValue(PreferencePredicate.SortTaxaByRankAndName.getKey());
-        filterCommonNameReferences = PreferencesUtil.getBooleanValue(PreferencePredicate.CommonNameReferencesWithMarker.getKey());
+        if(overrideShowIdInSelectionDialog){
+            showIdInSelectionDialog = PreferencesUtil.getBooleanValue(PreferencePredicate.ShowIdInSelectionDialog.getKey(), true);
+        }
+        if(overrideSearchForIdentifierAsDefault){
+            searchForIdentifierAsDefault = PreferencesUtil.getBooleanValue(PreferencePredicate.SearchForIdentifierAsDefault.getKey(), true);
+        }
+        if(overrideSearchForIdentifierAndTitleCache){
+            searchForIdentifierAndTitleCache = PreferencesUtil.getBooleanValue(PreferencePredicate.SearchForIdentifierAndTitleCache.getKey(), true);
+        }
+        if(overrideSortTaxaByRankAndName){
+            sortTaxaByRankAndName = PreferencesUtil.getBooleanValue(PreferencePredicate.SortTaxaByRankAndName.getKey(), true);
+        }
+        if(overrideFilterCommonNameReferences){
+            filterCommonNameReferences = PreferencesUtil.getBooleanValue(PreferencePredicate.CommonNameReferencesWithMarker.getKey(), true);
+        }
 
 
     }
@@ -199,22 +208,7 @@ public class SearchDialogPreferences extends CdmPreferencePage implements Select
         showIdInSelectionDialogButton = createBooleanCombo(titleComp, Messages.GeneralPreference_yes, Messages.GeneralPreference_no, PreferencePredicate.ShowIdInSelectionDialog, Messages.DatabasePreferncesPage_Show_Id_In_SelectionDialog, isAdminPreference);
 
         showIdInSelectionDialogButton.addSelectionListener(this);
-        int index = 0;
-        for (String itemLabel : showIdInSelectionDialogButton.getItems()) {
-            if (itemLabel.startsWith(Messages.Preference_Use_Default) && showIdInSelectionDialog == null) {
-                showIdInSelectionDialogButton.select(index);
-                break;
-            }
-            if (itemLabel.equals(Messages.GeneralPreference_yes) && showIdInSelectionDialog){
-                showIdInSelectionDialogButton.select(index);
-                break;
-            }
-            if (itemLabel.equals(Messages.GeneralPreference_no) && !showIdInSelectionDialog){
-                showIdInSelectionDialogButton.select(index);
-                break;
-            }
-            index++;
-        }
+
         if (!isAdminPreference && showIdInSelectionDialogPref != null){
             showIdInSelectionDialogButton.setEnabled(showIdInSelectionDialogPref.isAllowOverride());
         }
@@ -244,22 +238,7 @@ public class SearchDialogPreferences extends CdmPreferencePage implements Select
         searchForIdentifierAsDefaultButton = createBooleanCombo(composite, Messages.GeneralPreference_yes, Messages.GeneralPreference_no, PreferencePredicate.SearchForIdentifierAsDefault, Messages.DatabasePreferncesPage_Search_for_identifier_as_default, isAdminPreference);
 
         searchForIdentifierAsDefaultButton.addSelectionListener(this);
-        index = 0;
-        for (String itemLabel : searchForIdentifierAsDefaultButton.getItems()) {
-            if (searchForIdentifierAsDefault == null && itemLabel.startsWith(Messages.Preference_Use_Default)) {
-                searchForIdentifierAsDefaultButton.select(index);
-                break;
-            }
-            if (searchForIdentifierAsDefault != null && itemLabel.equals(Messages.GeneralPreference_yes) && searchForIdentifierAsDefault){
-                searchForIdentifierAsDefaultButton.select(index);
-                break;
-            }
-            if (searchForIdentifierAsDefault != null && itemLabel.equals(Messages.GeneralPreference_no) && !searchForIdentifierAsDefault){
-                searchForIdentifierAsDefaultButton.select(index);
-                break;
-            }
-            index++;
-        }
+
         if (isAdminPreference){
             allowOverrideSearchForIdentifierAsDefaultButton = createAllowOverrideButton(composite);
             allowOverrideSearchForIdentifierAsDefaultButton.setSelection(searchForIdentifierAsDefaultPref != null?searchForIdentifierAsDefaultPref.isAllowOverride(): true);
@@ -280,22 +259,7 @@ public class SearchDialogPreferences extends CdmPreferencePage implements Select
 
         searchForIdentifierAndTitleCacheButton = createBooleanCombo(composite, Messages.GeneralPreference_yes, Messages.GeneralPreference_no, PreferencePredicate.SearchForIdentifierAndTitleCache, Messages.DatabasePreferncesPage_search_for_identifier_and_titleCache, isAdminPreference);
         searchForIdentifierAndTitleCacheButton.addSelectionListener(this);
-        index = 0;
-        for (String itemLabel : searchForIdentifierAndTitleCacheButton.getItems()) {
-            if (searchForIdentifierAndTitleCache == null && itemLabel.startsWith(Messages.Preference_Use_Default)) {
-                searchForIdentifierAndTitleCacheButton.select(index);
-                break;
-            }
-            if (searchForIdentifierAndTitleCache != null && itemLabel.equals(Messages.GeneralPreference_yes) && searchForIdentifierAndTitleCache){
-                searchForIdentifierAndTitleCacheButton.select(index);
-                break;
-            }
-            if (searchForIdentifierAndTitleCache != null && itemLabel.equals(Messages.GeneralPreference_no) && !searchForIdentifierAndTitleCache){
-                searchForIdentifierAndTitleCacheButton.select(index);
-                break;
-            }
-            index++;
-        }
+
         if(!isAdminPreference && searchForIdentifierAndTitleCachePref != null){
             searchForIdentifierAndTitleCacheButton.setEnabled(searchForIdentifierAndTitleCachePref.isAllowOverride());
         }
@@ -319,22 +283,7 @@ public class SearchDialogPreferences extends CdmPreferencePage implements Select
 
 
         sortTaxaByRankAndNameButton.addSelectionListener(this);
-        index = 0;
-        for (String itemLabel : sortTaxaByRankAndNameButton.getItems()) {
-            if (sortTaxaByRankAndName == null && itemLabel.startsWith(Messages.Preference_Use_Default)) {
-                sortTaxaByRankAndNameButton.select(index);
-                break;
-            }
-            if (sortTaxaByRankAndName != null && itemLabel.equals(Messages.GeneralPreference_yes) && sortTaxaByRankAndName){
-                sortTaxaByRankAndNameButton.select(index);
-                break;
-            }
-            if (sortTaxaByRankAndName != null && itemLabel.equals(Messages.GeneralPreference_no) && !sortTaxaByRankAndName){
-                sortTaxaByRankAndNameButton.select(index);
-                break;
-            }
-            index++;
-        }
+
         if ( !isAdminPreference && sortTaxaByRankAndNamePref != null){
             sortTaxaByRankAndNameButton.setEnabled(sortTaxaByRankAndNamePref.isAllowOverride());
         }
@@ -357,22 +306,7 @@ public class SearchDialogPreferences extends CdmPreferencePage implements Select
         filterCommonNameReferenceButton = createBooleanCombo(composite, Messages.GeneralPreference_yes, Messages.GeneralPreference_no, PreferencePredicate.CommonNameReferencesWithMarker, Messages.DatabasePreferncesPage_CommonNameFilter, isAdminPreference);
         filterCommonNameReferenceButton.addSelectionListener(this);
 
-        index = 0;
-        for (String itemLabel: filterCommonNameReferenceButton.getItems()) {
-            if (filterCommonNameReferences == null && itemLabel.startsWith(Messages.Preference_Use_Default)) {
-                filterCommonNameReferenceButton.select(index);
-                break;
-            }
-            if (filterCommonNameReferences != null && itemLabel.equals(Messages.GeneralPreference_yes) && filterCommonNameReferences){
-                filterCommonNameReferenceButton.select(index);
-                break;
-            }
-            if (filterCommonNameReferences != null && itemLabel.equals(Messages.GeneralPreference_no) && !filterCommonNameReferences){
-                filterCommonNameReferenceButton.select(index);
-                break;
-            }
-            index++;
-        }
+
         if (!isAdminPreference && filterCommonNameReferencesPref != null){
             filterCommonNameReferenceButton.setEnabled(filterCommonNameReferencesPref.isAllowOverride());
         }
@@ -392,7 +326,7 @@ public class SearchDialogPreferences extends CdmPreferencePage implements Select
             });
         }
 
-
+        setSelections();
 
         return composite;
     }
@@ -488,5 +422,93 @@ public class SearchDialogPreferences extends CdmPreferencePage implements Select
         return true;
     }
 
+    protected void setSelections(){
+
+        int index = 0;
+        for (String itemLabel : showIdInSelectionDialogButton.getItems()) {
+            if (itemLabel.startsWith(Messages.Preference_Use_Default) && (showIdInSelectionDialog == null || (!overrideShowIdInSelectionDialog && !isAdminPreference))) {
+                showIdInSelectionDialogButton.select(index);
+                break;
+            }
+            if (itemLabel.equals(Messages.GeneralPreference_yes) && showIdInSelectionDialog){
+                showIdInSelectionDialogButton.select(index);
+                break;
+            }
+            if (itemLabel.equals(Messages.GeneralPreference_no) && !showIdInSelectionDialog){
+                showIdInSelectionDialogButton.select(index);
+                break;
+            }
+            index++;
+        }
+
+        index = 0;
+        for (String itemLabel : searchForIdentifierAsDefaultButton.getItems()) {
+            if ((searchForIdentifierAsDefault == null || (!overrideSearchForIdentifierAsDefault && !isAdminPreference)) && itemLabel.startsWith(Messages.Preference_Use_Default)) {
+                searchForIdentifierAsDefaultButton.select(index);
+                break;
+            }
+            if (searchForIdentifierAsDefault != null && itemLabel.equals(Messages.GeneralPreference_yes) && searchForIdentifierAsDefault){
+                searchForIdentifierAsDefaultButton.select(index);
+                break;
+            }
+            if (searchForIdentifierAsDefault != null && itemLabel.equals(Messages.GeneralPreference_no) && !searchForIdentifierAsDefault){
+                searchForIdentifierAsDefaultButton.select(index);
+                break;
+            }
+            index++;
+        }
+
+        index = 0;
+        for (String itemLabel : searchForIdentifierAndTitleCacheButton.getItems()) {
+            if ((searchForIdentifierAndTitleCache == null || (!overrideSearchForIdentifierAndTitleCache && !isAdminPreference))&& itemLabel.startsWith(Messages.Preference_Use_Default)) {
+                searchForIdentifierAndTitleCacheButton.select(index);
+                break;
+            }
+            if (searchForIdentifierAndTitleCache != null && itemLabel.equals(Messages.GeneralPreference_yes) && searchForIdentifierAndTitleCache){
+                searchForIdentifierAndTitleCacheButton.select(index);
+                break;
+            }
+            if (searchForIdentifierAndTitleCache != null && itemLabel.equals(Messages.GeneralPreference_no) && !searchForIdentifierAndTitleCache){
+                searchForIdentifierAndTitleCacheButton.select(index);
+                break;
+            }
+            index++;
+        }
+
+        index = 0;
+        for (String itemLabel : sortTaxaByRankAndNameButton.getItems()) {
+            if ((sortTaxaByRankAndName == null || (!overrideSortTaxaByRankAndName && !isAdminPreference))&& itemLabel.startsWith(Messages.Preference_Use_Default)) {
+                sortTaxaByRankAndNameButton.select(index);
+                break;
+            }
+            if (sortTaxaByRankAndName != null && itemLabel.equals(Messages.GeneralPreference_yes) && sortTaxaByRankAndName){
+                sortTaxaByRankAndNameButton.select(index);
+                break;
+            }
+            if (sortTaxaByRankAndName != null && itemLabel.equals(Messages.GeneralPreference_no) && !sortTaxaByRankAndName){
+                sortTaxaByRankAndNameButton.select(index);
+                break;
+            }
+            index++;
+        }
+
+        index = 0;
+        for (String itemLabel: filterCommonNameReferenceButton.getItems()) {
+            if ((filterCommonNameReferences == null || (!overrideFilterCommonNameReferences && !isAdminPreference)) && itemLabel.startsWith(Messages.Preference_Use_Default)) {
+                filterCommonNameReferenceButton.select(index);
+                break;
+            }
+            if (filterCommonNameReferences != null && itemLabel.equals(Messages.GeneralPreference_yes) && filterCommonNameReferences){
+                filterCommonNameReferenceButton.select(index);
+                break;
+            }
+            if (filterCommonNameReferences != null && itemLabel.equals(Messages.GeneralPreference_no) && !filterCommonNameReferences){
+                filterCommonNameReferenceButton.select(index);
+                break;
+            }
+            index++;
+        }
+    }
+
 
 }
index 6797dd527dfac4bbc7fa03d166d11d60889e215f..5b74e44a59a4a2d86aa8eea1da3a1495fa7915c6 100644 (file)
@@ -204,7 +204,7 @@ public abstract class CdmPreferencePage extends PreferencePage implements IE4Pre
         Object defaultObject = predicate.getDefaultValue();
         if (defaultObject != null){
             if (defaultObject instanceof IKeyLabel){
-                defaultValue = ((IKeyLabel)defaultObject).getKey();
+                defaultValue = ((IKeyLabel)defaultObject).getLabel();
             }else{
                 defaultValue = predicate.getDefaultValue().toString();
             }