use same saving strategie for local name details pref as for db name details pref
authorKatja Luther <k.luther@bgbm.org>
Thu, 31 Jan 2019 22:29:44 +0000 (23:29 +0100)
committerKatja Luther <k.luther@bgbm.org>
Thu, 31 Jan 2019 22:29:44 +0000 (23:29 +0100)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/NameDetailsViewAdminConfiguration.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/IPreferenceKeys.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/NameDetailsViewConfiguration.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/AbstractIdentifiableEntityDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/name/AuthorshipDetailElement.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/ui/section/taxon/TaxonBaseDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/details/DetailsViewerE4.java

index 7b5c8b6683dc4ea35c9bf2aa67202c0770425f51..48867525a76a6b1b5647c38003e2fa873e40c52f 100755 (executable)
@@ -60,7 +60,7 @@ public class NameDetailsViewAdminConfiguration extends NameDetailsViewConfigurat
         CdmPreference pref = CdmPreference.NewTaxEditorInstance(EditorPreferencePredicate.NameDetailsView, value);
         pref.setAllowOverride(isAllowOverride);
         service.set(pref);
-        PreferencesUtil.saveConfigToPrefernceStore(config);
+
 
         return true;
     }
index 97973abe5b46430dcd8f6f811923f90ad9b2c228..8a623564e921fccb75df6ed43c267ed29ca8faa3 100644 (file)
@@ -130,27 +130,27 @@ public interface IPreferenceKeys {
     public static final String COMMON_NAME_AREA_VOCABULARIES = "eu.etaxonomy.taxeditor.commonNames.areaVocabularies";
 
 //Taxon Details View
-    public static final String SHOW_SEC_DETAILS = "eu.etaxonomy.taxeditor.taxon.showSecDetails";
-    public static final String DISABLE_SEC = "eu.etaxonomy.taxeditor.taxon.disableSec";
+//    public static final String SHOW_SEC_DETAILS = "eu.etaxonomy.taxeditor.taxon.showSecDetails";
+//    public static final String DISABLE_SEC = "eu.etaxonomy.taxeditor.taxon.disableSec";
     //Name details view
-    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_NAME_APPROBATION = "eu.etaxonomy.taxeditor.name.showNameNameApprobiation";
-    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";
-    public static final String SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE = "eu.etaxonomy.taxeditor.name.showNameNomenclaturalReference";
-    public static final String SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS = "eu.etaxonomy.taxeditor.name.showNameNomenclaturalStatus";
-    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 SHOW_NAME_DETAILS_SECTION_AUTHORSHIP_CACHE = "eu.etaxonomy.taxeditor.name.showAuthorCache";
+//    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_NAME_APPROBATION = "eu.etaxonomy.taxeditor.name.showNameNameApprobiation";
+//    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";
+//    public static final String SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE = "eu.etaxonomy.taxeditor.name.showNameNomenclaturalReference";
+//    public static final String SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS = "eu.etaxonomy.taxeditor.name.showNameNomenclaturalStatus";
+//    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 SHOW_NAME_DETAILS_SECTION_AUTHORSHIP_CACHE = "eu.etaxonomy.taxeditor.name.showAuthorCache";
     public static final String ALLOW_OVERRIDE_NAME_DETAILS = "eu.etaxonomy.taxeditor.name.allowOverride";
     public static final String OVERRIDE_NAME_DETAILS = "eu.etaxonomy.taxeditor.name.override";
 
index 28acbcc444cb3c5984572846ee928fef96e3ff27..58131c299cfaed500eab00dccfd53cedac39e722 100644 (file)
@@ -46,6 +46,8 @@ public class NameDetailsViewConfiguration extends CdmPreferencePage {
 
     protected boolean isAllowOverride;
     private boolean isOverride;
+    private Button showSecDetail;
+    private Button secEnabled;
 
     @Override
     protected Control createContents(Composite parent) {
@@ -74,9 +76,11 @@ public class NameDetailsViewConfiguration extends CdmPreferencePage {
                 public void widgetSelected(SelectionEvent e) {
                     setApply(true);
                     isSimpleDetailsViewActivated = activateCheckButton.getSelection();
-
+                    nameDetailsConfig.setSimpleDetailsViewActivated(isSimpleDetailsViewActivated);
                     dbSettings.setEnabled(isSimpleDetailsViewActivated);
                     PreferencesUtil.recursiveSetEnabled(dbSettings, isSimpleDetailsViewActivated);
+                    showSecDetail.setEnabled(isShowTaxon);
+                    secEnabled.setEnabled(isShowTaxon);
                  }
              });
 
@@ -113,12 +117,15 @@ public class NameDetailsViewConfiguration extends CdmPreferencePage {
                  public void widgetSelected(SelectionEvent e) {
                      setApply(true);
                      isShowTaxon = showTaxon.getSelection();
-
+                     nameDetailsConfig.setTaxonSectionActivated(isShowTaxon);
+                     showSecDetail.setEnabled(isShowTaxon);
+                     secEnabled.setEnabled(isShowTaxon);
                   }
              });
 
-            final Button showSecDetail = new Button(dbSettings, SWT.CHECK);
+            showSecDetail = new Button(dbSettings, SWT.CHECK);
             showSecDetail.setText(Messages.NameDetailsViewComposite_Show_SecDetail);
+
             isSecDetailsActivated = nameDetailsConfig.isSecDetailsActivated();
             showSecDetail.setSelection(isSecDetailsActivated);
             showSecDetail.addSelectionListener(new SelectionAdapter(){
@@ -126,12 +133,13 @@ public class NameDetailsViewConfiguration extends CdmPreferencePage {
                  public void widgetSelected(SelectionEvent e) {
                      setApply(true);
                      isSecDetailsActivated = showSecDetail.getSelection();
-
+                     nameDetailsConfig.setSecDetailsActivated(isSecDetailsActivated);
                   }
              });
 
-            final Button secEnabled = new Button(dbSettings, SWT.CHECK);
+            secEnabled = new Button(dbSettings, SWT.CHECK);
             secEnabled.setText(Messages.NameDetailsViewComposite_SecEnabled);
+
             isSecEnabled = nameDetailsConfig.isSecEnabled();
             secEnabled.setSelection(isSecEnabled);
             secEnabled.addSelectionListener(new SelectionAdapter(){
@@ -139,7 +147,7 @@ public class NameDetailsViewConfiguration extends CdmPreferencePage {
                  public void widgetSelected(SelectionEvent e) {
                      setApply(true);
                      isSecEnabled = secEnabled.getSelection();
-
+                     nameDetailsConfig.setSecEnabled(isSecEnabled);
                   }
              });
 
@@ -153,7 +161,7 @@ public class NameDetailsViewConfiguration extends CdmPreferencePage {
                  public void widgetSelected(SelectionEvent e) {
                      setApply(true);
                      isShowLSID = showLsid.getSelection();
-
+                     nameDetailsConfig.setLSIDActivated(isShowLSID);
                   }
              });
 
@@ -166,7 +174,7 @@ public class NameDetailsViewConfiguration extends CdmPreferencePage {
                  public void widgetSelected(SelectionEvent e) {
                      setApply(true);
                      isShowNomenclaturalCode = showNomenclaturalCode.getSelection();
-
+                     nameDetailsConfig.setNomenclaturalCodeActived(isShowNomenclaturalCode);
                   }
              });
 
@@ -179,6 +187,7 @@ public class NameDetailsViewConfiguration extends CdmPreferencePage {
                  public void widgetSelected(SelectionEvent e) {
                      setApply(true);
                      isShowNameCache = showNameCache.getSelection();
+                     nameDetailsConfig.setNameCacheActivated(isShowNameCache);
                   }
              });
             final Button showAppendedPhrase = new Button(dbSettings, SWT.CHECK);
@@ -190,6 +199,7 @@ public class NameDetailsViewConfiguration extends CdmPreferencePage {
                  public void widgetSelected(SelectionEvent e) {
                      setApply(true);
                      isShowAppendedPhrase = showAppendedPhrase.getSelection();
+                     nameDetailsConfig.setAppendedPhraseActivated(isShowAppendedPhrase);
                   }
              });
 
@@ -202,6 +212,7 @@ public class NameDetailsViewConfiguration extends CdmPreferencePage {
                  public void widgetSelected(SelectionEvent e) {
                      setApply(true);
                      isShowRank = showRank.getSelection();
+                     nameDetailsConfig.setRankActivated(isShowRank);
                   }
              });
             final Button showEpithets = new Button(dbSettings, SWT.CHECK);
@@ -213,6 +224,7 @@ public class NameDetailsViewConfiguration extends CdmPreferencePage {
                  public void widgetSelected(SelectionEvent e) {
                      setApply(true);
                      isShowEpithets = showEpithets.getSelection();
+                     nameDetailsConfig.setAtomisedEpithetsActivated(isShowEpithets);
                   }
              });
 
@@ -225,6 +237,7 @@ public class NameDetailsViewConfiguration extends CdmPreferencePage {
                  public void widgetSelected(SelectionEvent e) {
                      setApply(true);
                      isShowAuthorCache = showAuthorCache.getSelection();
+                     nameDetailsConfig.setAuthorCacheActivated(isShowAuthorCache);
                   }
              });
 
@@ -237,6 +250,7 @@ public class NameDetailsViewConfiguration extends CdmPreferencePage {
                  public void widgetSelected(SelectionEvent e) {
                      setApply(true);
                      isShowAuthorship = showAuthorship.getSelection();
+                     nameDetailsConfig.setAuthorshipSectionActivated(isShowAuthorship);
                   }
              });
 
@@ -249,6 +263,7 @@ public class NameDetailsViewConfiguration extends CdmPreferencePage {
                  public void widgetSelected(SelectionEvent e) {
                      setApply(true);
                      isShowNomenclaturalRef = showNomenclaturalRef.getSelection();
+                     nameDetailsConfig.setNomenclaturalReferenceSectionActivated(isShowNomenclaturalRef);
                   }
              });
 
@@ -261,6 +276,7 @@ public class NameDetailsViewConfiguration extends CdmPreferencePage {
                  public void widgetSelected(SelectionEvent e) {
                      setApply(true);
                      isShowNomenclaturalStatus = showNomenclaturalStatus.getSelection();
+                     nameDetailsConfig.setNomenclaturalStatusSectionActivated(isShowNomenclaturalStatus);
                   }
              });
 
@@ -273,6 +289,7 @@ public class NameDetailsViewConfiguration extends CdmPreferencePage {
                  public void widgetSelected(SelectionEvent e) {
                      setApply(true);
                      isShowProtologue = showProtologue.getSelection();
+                     nameDetailsConfig.setProtologueActivated(isShowProtologue);
                   }
              });
 
@@ -285,6 +302,7 @@ public class NameDetailsViewConfiguration extends CdmPreferencePage {
                  public void widgetSelected(SelectionEvent e) {
                      setApply(true);
                      isShowTypeDesignation = showTypeDesignation.getSelection();
+                     nameDetailsConfig.setTypeDesignationSectionActivated(isShowTypeDesignation);
                   }
              });
 
@@ -298,6 +316,7 @@ public class NameDetailsViewConfiguration extends CdmPreferencePage {
                  public void widgetSelected(SelectionEvent e) {
                      setApply(true);
                      isShowNameRelationship = showNameRelationship.getSelection();
+                     nameDetailsConfig.setNameRelationsSectionActivated(isShowNameRelationship);
                   }
              });
 
@@ -310,6 +329,7 @@ public class NameDetailsViewConfiguration extends CdmPreferencePage {
                  public void widgetSelected(SelectionEvent e) {
                      setApply(true);
                      isShowHybrid = showHybrid.getSelection();
+                     nameDetailsConfig.setHybridActivated(isShowHybrid);
                   }
              });
             final Button showNameApprobiation = new Button(dbSettings, SWT.CHECK);
@@ -321,9 +341,12 @@ public class NameDetailsViewConfiguration extends CdmPreferencePage {
                  public void widgetSelected(SelectionEvent e) {
                      setApply(true);
                      isShowNameApprobiation = showNameApprobiation.getSelection();
+                     nameDetailsConfig.setNameApprobiationActivated(isShowNameApprobiation);
                   }
              });
             PreferencesUtil.recursiveSetEnabled(dbSettings, isSimpleDetailsViewActivated);
+            showSecDetail.setEnabled(isShowTaxon);
+            secEnabled.setEnabled(isShowTaxon);
         }else{
             final CLabel description = new CLabel(parent, SWT.NULL);
             description.setText(Messages.NameDetailsViewConfiguration_description_not_available);
@@ -337,25 +360,10 @@ public class NameDetailsViewConfiguration extends CdmPreferencePage {
 
     @Override
     public boolean performOk() {
-        PreferencesUtil.setBooleanValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON, isShowTaxon);
-        PreferencesUtil.setBooleanValue(IPreferenceKeys.SHOW_SEC_DETAILS, isSecDetailsActivated);
-        PreferencesUtil.setBooleanValue(IPreferenceKeys.DISABLE_SEC, isSecEnabled);
-        PreferencesUtil.setBooleanValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION, isSimpleDetailsViewActivated);
-        PreferencesUtil.setBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_APPROBATION, isShowNameApprobiation);
-        PreferencesUtil.setBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_HYBRID, isShowHybrid);
-        PreferencesUtil.setBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP, isShowNameRelationship);
-        PreferencesUtil.setBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION, isShowTypeDesignation);
-        PreferencesUtil.setBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE, isShowProtologue);
-        PreferencesUtil.setBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS, isShowNomenclaturalStatus);
-        PreferencesUtil.setBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE, isShowNomenclaturalRef);
-        PreferencesUtil.setBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP, isShowAuthorship);
-        PreferencesUtil.setBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP_CACHE, isShowAuthorCache);
-        PreferencesUtil.setBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS, isShowEpithets);
-        PreferencesUtil.setBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK, isShowRank);
-        PreferencesUtil.setBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE, isShowAppendedPhrase);
-        PreferencesUtil.setBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAMECACHE, isShowNameCache);
-        PreferencesUtil.setBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE, isShowNomenclaturalCode);
-        PreferencesUtil.setBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID, isShowLSID);
+        if (nameDetailsConfig != null){
+            PreferencesUtil.setStringValue(EditorPreferencePredicate.NameDetailsView.getKey(), nameDetailsConfig.toString());
+        }
+
 
         PreferencesUtil.setBooleanValue(IPreferenceKeys.OVERRIDE_NAME_DETAILS, isOverride);
         return true;
index 0776adee442c3dc64c26ed39f317b830b80f237c..b8665d963247fac02ab0b96d66c2da57dbce770b 100644 (file)
@@ -840,19 +840,8 @@ public class PreferencesUtil implements IPreferenceKeys {
 
 
                //Name Details
-               getPreferenceStore().setDefault(createPreferenceString(SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS), true);
-               getPreferenceStore().setDefault(createPreferenceString(SHOW_NAME_DETAILS_SECTION_AUTHORSHIP_CACHE), true);
-               getPreferenceStore().setDefault(createPreferenceString(SHOW_NAME_DETAILS_SECTION_AUTHORSHIP), true);
-               getPreferenceStore().setDefault(createPreferenceString(SHOW_NAME_DETAILS_SECTION_HYBRID), true);
-               getPreferenceStore().setDefault(createPreferenceString(SHOW_NAME_DETAILS_SECTION_LSID), true);
-               getPreferenceStore().setDefault(createPreferenceString(SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP), true);
-               getPreferenceStore().setDefault(createPreferenceString(SHOW_NAME_DETAILS_SECTION_NAMECACHE), true);
-               getPreferenceStore().setDefault(createPreferenceString(SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE), true);
-               getPreferenceStore().setDefault(createPreferenceString(SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE), true);
-               getPreferenceStore().setDefault(createPreferenceString(SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS), true);
-               getPreferenceStore().setDefault(createPreferenceString(SHOW_NAME_DETAILS_SECTION_PROTOLOGUE), true);
-               getPreferenceStore().setDefault(createPreferenceString(SHOW_NAME_DETAILS_SECTION_RANK), true);
-               getPreferenceStore().setDefault(createPreferenceString(SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION), true);
+               getPreferenceStore().setDefault(createPreferenceString(EditorPreferencePredicate.NameDetailsView.getKey()), new NameDetailsConfigurator(false).toString());
+
                //Navigator preferences
                getPreferenceStore().setDefault(createPreferenceString(SORT_NODES), NavigatorOrderEnum.RankAndNameOrder.getKey());
 
@@ -868,8 +857,7 @@ public class PreferencesUtil implements IPreferenceKeys {
                getPreferenceStore().setDefault(createPreferenceString(EditorPreferencePredicate.ShowNamespaceInSource.getKey()), Boolean.valueOf(EditorPreferencePredicate.ShowNamespaceInSource.getDefaultValue().toString()));
                getPreferenceStore().setDefault(createPreferenceString(EditorPreferencePredicate.ShowIdInSource.getKey()), Boolean.valueOf(EditorPreferencePredicate.ShowIdInSource.getDefaultValue().toString()));
                getPreferenceStore().setDefault(createPreferenceString(EditorPreferencePredicate.DisableMultiClassification.getKey()), Boolean.valueOf(EditorPreferencePredicate.DisableMultiClassification.getDefaultValue().toString()));
-               getPreferenceStore().setDefault(createPreferenceString(DISABLE_SEC), false);
-               getPreferenceStore().setDefault(createPreferenceString(SHOW_SEC_DETAILS), true);
+
        }
 
        /**
@@ -1399,7 +1387,7 @@ public class PreferencesUtil implements IPreferenceKeys {
         NameDetailsConfigurator config = new NameDetailsConfigurator(true);
         CdmPreferenceCache cache = CdmPreferenceCache.instance();
         CdmPreference preference = null;
-
+        String value;
         if (!local) {
             preference = cache.get(EditorPreferencePredicate.NameDetailsView.getKey());
             if (preference == null){
@@ -1407,95 +1395,52 @@ public class PreferencesUtil implements IPreferenceKeys {
             }
 
             setBooleanValue(ALLOW_OVERRIDE_NAME_DETAILS, preference.isAllowOverride());
-
+            value = preference.getValue();
+            config.setAllowOverride(preference.isAllowOverride());
             //the preference value is build like this:
             //<section1>:true;<section2>:false....
+        }else{
+            value = getStringValue(EditorPreferencePredicate.NameDetailsView.getKey(), local);
+        }
+        String [] sections = value.split(";");
+        Map<String, Boolean> sectionMap = new HashMap<String, Boolean>();
+        String[] sectionValues;
+        for (String sectionValue: sections){
+            sectionValues = sectionValue.split(":");
+            sectionMap.put(sectionValues[0], Boolean.valueOf(sectionValues[1]));
+        }
 
-            String value = preference.getValue();
-            String [] sections = value.split(";");
-            Map<String, Boolean> sectionMap = new HashMap<String, Boolean>();
-            String[] sectionValues;
-            for (String sectionValue: sections){
-                sectionValues = sectionValue.split(":");
-                sectionMap.put(sectionValues[0], Boolean.valueOf(sectionValues[1]));
-            }
-            config.setAllowOverride(preference.isAllowOverride());
-            config.setSimpleDetailsViewActivated(getValue(sectionMap, "simpleViewActivated"));
+        config.setSimpleDetailsViewActivated(getValue(sectionMap, "simpleViewActivated"));
 
-    //        getPreferenceStore().setValue(SHOW_SIMPLE_NAME_DETAILS_TAXON,
-    //                (getValue(sectionMap, "taxon")));
             config.setTaxonSectionActivated(getValue(sectionMap, "taxon"));
 
-            config.setSecDetailsActivated(getValue(sectionMap, "taxon.SecEnabled"));
-            config.setSecEnabled(getValue(sectionMap, "taxon.SecDetails"));
-
-    //        getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_LSID,
-    //                (getValue(sectionMap, "lsid")));
-            config.setLSIDActivated(getValue(sectionMap, "lsid"));
+        config.setSecDetailsActivated(getValue(sectionMap, "taxon.SecEnabled"));
+        config.setSecEnabled(getValue(sectionMap, "taxon.SecDetails"));
 
-    //        getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE,
-    //                (getValue(sectionMap, "nc")));
-            config.setNomenclaturalCodeActived(getValue(sectionMap, "nc"));
+        config.setLSIDActivated(getValue(sectionMap, "lsid"));
 
-    //        getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE,
-    //                (getValue(sectionMap, "ap")));
-            config.setAppendedPhraseActivated(getValue(sectionMap, "ap"));
+        config.setNomenclaturalCodeActived(getValue(sectionMap, "nc"));
 
-    //        getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_RANK,
-    //                (getValue(sectionMap, "rank")));
-            config.setRankActivated(getValue(sectionMap, "rank"));
+        config.setAppendedPhraseActivated(getValue(sectionMap, "ap"));
 
+        config.setRankActivated(getValue(sectionMap, "rank"));
 
-    //        getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS,
-    //                (getValue(sectionMap, "atomisedEpithets")));
-            config.setAtomisedEpithetsActivated(getValue(sectionMap, "atomisedEpithets"));
+        config.setAtomisedEpithetsActivated(getValue(sectionMap, "atomisedEpithets"));
 
-    //        getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_AUTHORSHIP,
-    //                (getValue(sectionMap,"author")));
-            config.setAuthorshipSectionActivated(getValue(sectionMap,"author"));
+        config.setAuthorshipSectionActivated(getValue(sectionMap,"author"));
 
-    //        getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE,
-    //                (getValue(sectionMap, "nomRef")));
-            config.setNomenclaturalReferenceSectionActivated(sectionMap.get("nomRef"));
+        config.setNomenclaturalReferenceSectionActivated(sectionMap.get("nomRef"));
 
-    //        getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS,
-    //                (getValue(sectionMap, "nomStat")));
-            config.setNomenclaturalStatusSectionActivated(getValue(sectionMap, "nomStat"));
+        config.setNomenclaturalStatusSectionActivated(getValue(sectionMap, "nomStat"));
 
+        config.setProtologueActivated(getValue(sectionMap,"protologue"));
 
-    //        getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_PROTOLOGUE,
-    //                (getValue(sectionMap,"protologue")));
-            config.setProtologueActivated(getValue(sectionMap,"protologue"));
+        config.setTypeDesignationSectionActivated(getValue(sectionMap,"typeDes"));
 
-    //        getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION,
-    //                (getValue(sectionMap,"typeDes")));
-            config.setTypeDesignationSectionActivated(getValue(sectionMap,"typeDes"));
+        config.setNameRelationsSectionActivated(getValue(sectionMap,"nameRelation"));
 
-    //        getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP,
-    //                (getValue(sectionMap,"nameRelation")));
-            config.setNameRelationsSectionActivated(getValue(sectionMap,"nameRelation"));
-
-    //        getPreferenceStore().setValue(SHOW_NAME_DETAILS_SECTION_HYBRID,
-    //                (getValue(sectionMap, "hybrid")));
             config.setHybridActivated(getValue(sectionMap,"hybrid"));
-        }else{
-            config.setSimpleDetailsViewActivated(getBooleanValue(SHOW_SIMPLE_NAME_DETAILS_SECTION));
-            config.setTaxonSectionActivated(getBooleanValue(SHOW_SIMPLE_NAME_DETAILS_TAXON));
-            config.setSecDetailsActivated(getBooleanValue(SHOW_SEC_DETAILS));
-            config.setSecEnabled(getBooleanValue(DISABLE_SEC));
-            config.setLSIDActivated(getBooleanValue(SHOW_NAME_DETAILS_SECTION_LSID));
-            config.setNomenclaturalCodeActived(getBooleanValue(SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE));
-            config.setAppendedPhraseActivated(getBooleanValue(SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE));
-            config.setRankActivated(getBooleanValue(SHOW_NAME_DETAILS_SECTION_RANK));
-            config.setAtomisedEpithetsActivated(getBooleanValue(SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS));
-            config.setAuthorshipSectionActivated(getBooleanValue(SHOW_NAME_DETAILS_SECTION_AUTHORSHIP));
-            config.setNomenclaturalReferenceSectionActivated(getBooleanValue(SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE));
-            config.setNomenclaturalStatusSectionActivated(getBooleanValue(SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS));
-            config.setProtologueActivated(getBooleanValue(SHOW_NAME_DETAILS_SECTION_PROTOLOGUE));
-            config.setTypeDesignationSectionActivated(getBooleanValue(SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION));
-            config.setNameRelationsSectionActivated(getBooleanValue(SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP));
-            config.setHybridActivated(getBooleanValue(SHOW_NAME_DETAILS_SECTION_HYBRID));
-        }
+
         return config;
     }
 
@@ -1508,27 +1453,14 @@ public class PreferencesUtil implements IPreferenceKeys {
         CdmPreference preference = null;
 
         if (!local) {
-            preference = CdmPreference.NewInstance(PreferenceSubject.NewDatabaseInstance(), EditorPreferencePredicate.NameDetailsView, config.toString());
+            preference = CdmPreference.NewInstance(PreferenceSubject.NewTaxEditorInstance(), EditorPreferencePredicate.NameDetailsView, config.toString());
 
             setPreferenceToDB(preference);
         }
-        //also add to local preferences
-        setBooleanValue(SHOW_SIMPLE_NAME_DETAILS_SECTION, config.isSimpleDetailsViewActivated());
-        setBooleanValue(SHOW_SIMPLE_NAME_DETAILS_TAXON, config.isTaxonSectionActivated());
-        setBooleanValue(SHOW_SEC_DETAILS, config.isSecDetailsActivated());
-        setBooleanValue(DISABLE_SEC, config.isSecEnabled());
-        setBooleanValue(SHOW_NAME_DETAILS_SECTION_LSID, config.isLSIDActivated());
-        setBooleanValue(SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE, config.isNomenclaturalCodeActived());
-        setBooleanValue(SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE, config.isAppendedPhraseActivated());
-        setBooleanValue(SHOW_NAME_DETAILS_SECTION_RANK, config.isRankActivated());
-        setBooleanValue(SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS, config.isAtomisedEpithetsActivated());
-        setBooleanValue(SHOW_NAME_DETAILS_SECTION_AUTHORSHIP, config.isAuthorshipSectionActivated());
-        setBooleanValue(SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE, config.isNomenclaturalReferenceSectionActivated());
-        setBooleanValue(SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS, config.isNomenclaturalStatusSectionActivated());
-        setBooleanValue(SHOW_NAME_DETAILS_SECTION_PROTOLOGUE, config.isProtologueActivated());
-        setBooleanValue(SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION, config.isTypeDesignationSectionActivated());
-        setBooleanValue(SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP, config.isNameRelationsSectionActivated());
-        setBooleanValue(SHOW_NAME_DETAILS_SECTION_HYBRID, config.isHybridActivated());
+        else{
+            setStringValue(EditorPreferencePredicate.NameDetailsView.getKey(), config.toString());
+        }
+
 
     }
 
@@ -1682,68 +1614,10 @@ public class PreferencesUtil implements IPreferenceKeys {
     }
 
 
-    /**
-    *
-    */
-   public NameDetailsConfigurator createLocalNameDetailsViewConfig(boolean local) {
-       NameDetailsConfigurator config = new NameDetailsConfigurator(true);
-       if (local){
-          config.setSimpleDetailsViewActivated(getBooleanValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION));
-          config.setAppendedPhraseActivated(getBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE));
-          config.setAtomisedEpithetsActivated(getBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS));
-          config.setAuthorshipSectionActivated(getBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP));
-          config.setLSIDActivated(getBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID));
-          config.setNameApprobiationActivated(getBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_APPROBATION));
-          config.setNameCacheActivated(getBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_CACHE));
-          config.setNameRelationsSectionActivated(getBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP));
-          config.setNomenclaturalCodeActived(getBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE));
-          config.setNomenclaturalStatusSectionActivated(getBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS));
-          config.setNomenclaturalReferenceSectionActivated(getBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE));
-          config.setProtologueActivated(getBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE));
-          config.setRankActivated(getBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK));
-          config.setTaxonSectionActivated(getBooleanValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON));
-          config.setTypeDesignationSectionActivated(getBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION));
-          config.setHybridActivated(getBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_HYBRID));
-       }else{
-
-       }
-
-      return config;
-   }
-
-
-   public static void saveConfigToPrefernceStore(NameDetailsConfigurator config) {
-       setBooleanValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION,
-               config.isSimpleDetailsViewActivated());
-       setBooleanValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON, config.isTaxonSectionActivated());
-       setBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID, config.isLSIDActivated());
-       setBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE,
-               config.isNomenclaturalCodeActived());
-       setBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAMECACHE,
-               config.isNameCacheActivated());
-       setBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE,
-               config.isAppendedPhraseActivated());
-       setBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK, config.isRankActivated());
-       setBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS,
-               config.isAtomisedEpithetsActivated());
-       setBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP_CACHE,
-               config.isAuthorCacheActivated());
-       setBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP,
-               config.isAuthorshipSectionActivated());
-       setBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE,
-               config.isNomenclaturalReferenceSectionActivated());
-       setBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS,
-               config.isNomenclaturalStatusSectionActivated());
-       setBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE,
-               config.isProtologueActivated());
-       setBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION,
-               config.isTypeDesignationSectionActivated());
-       setBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP,
-               config.isNameRelationsSectionActivated());
-       setBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_HYBRID,
-               config.isHybridActivated());
-
-   }
+
+
+
+
 
 /**
  * @return
index 03d3474ae79b2cd9c0902e17a754e7726ac8d0a0..1652de60932433b778535a4b29a57bd186e32b76 100644 (file)
@@ -9,8 +9,6 @@ import java.util.EnumSet;
 import eu.etaxonomy.cdm.model.common.CdmBase;
 import eu.etaxonomy.cdm.model.common.IIdentifiableEntity;
 import eu.etaxonomy.cdm.persistence.hibernate.permission.CRUD;
-import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
-import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
@@ -28,12 +26,12 @@ public abstract class AbstractIdentifiableEntityDetailElement<T extends IIdentif
      */
     private static final EnumSet<CRUD> UPDATE = EnumSet.of(CRUD.UPDATE);
     protected ToggleableTextElement toggleable_cache;
-    protected boolean isAdvancedView ;
+
 
     public AbstractIdentifiableEntityDetailElement(CdmFormFactory formFactory, ICdmFormElement formElement) {
         super(formFactory, formElement);
         updateToggleableCacheState();
-        initIsAdvancedDetailsView();
+
 
     }
 
@@ -67,13 +65,7 @@ public abstract class AbstractIdentifiableEntityDetailElement<T extends IIdentif
             toggleable_cache.setEnabled(getEntity() != null && CdmStore.currentAuthentiationHasPermission((CdmBase) getEntity(), UPDATE));
         }
     }
-    protected void initIsAdvancedDetailsView(){
-        if(PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION)){
-            isAdvancedView = false;
-        } else{
-            isAdvancedView = true;
-        }
-    }
+
 
 
 }
index c6c6d76244ab4138e8f626ce4e3bcc56685333e6..c931b69809317f7485dfc4ced6f7cc46d2bda9da 100644 (file)
@@ -18,7 +18,7 @@ import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
 import eu.etaxonomy.cdm.model.name.TaxonNameFactory;
 import eu.etaxonomy.taxeditor.event.EventUtility;
 import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
-import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
+import eu.etaxonomy.taxeditor.preference.NameDetailsConfigurator;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
 import eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent;
@@ -69,7 +69,8 @@ public class AuthorshipDetailElement extends
        @Override
        protected void createControls(ICdmFormElement formElement,
                        INonViralName entity, int style) {
-           if (isAdvancedView || PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP_CACHE)){
+           NameDetailsConfigurator config = PreferencesUtil.getPreferredNameDetailsConfiguration(true);
+           if (!config.isSimpleDetailsViewActivated() || config.isAuthorCacheActivated()){
                toggleable_cache = formFactory.createToggleableTextField(this,
                                "Authorship Cache", entity.getAuthorshipCache(),
                                entity.isProtectedAuthorshipCache(), style);
@@ -77,7 +78,7 @@ public class AuthorshipDetailElement extends
           }
            NomenclaturalCode code = entity.getNomenclaturalCode();
 
-           if (isAdvancedView || PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP)){
+           if (!config.isSimpleDetailsViewActivated() || config.isAuthorshipSectionActivated()){
             selectionCombinationAuthor = formFactory.createSelectionElementWithAbbreviatedTitle(TeamOrPersonBase.class,
                                getConversationHolder(),
                                formElement, "Author",
index 6f0b13134b1954deb293cc5aca5333dabe4d8a6e..2381d7c0b22e9c31c928668ed1a3a0cfdcb46cd9 100644 (file)
@@ -98,7 +98,7 @@ public class NameDetailElement extends AbstractIdentifiableEntityDetailElement<I
 
                };
                }
-           if (isAdvancedView){
+           if (!config.isSimpleDetailsViewActivated()){
                toggleable_cache = formFactory.createToggleableTextField(this, "Name Cache", nonViralName.getNameCache(), nonViralName.isProtectedNameCache(), style);
 
                combo_rank = formFactory.createDefinedTermComboElement(TermType.Rank, this, "Rank", nonViralName.getRank(), style, comparator);
@@ -158,7 +158,7 @@ public class NameDetailElement extends AbstractIdentifiableEntityDetailElement<I
                if (toggleable_cache != null){
                    toggleable_cache.setEnabled(getEntity().isProtectedNameCache());
 
-               if (isAdvancedView){
+               if (!config.isSimpleDetailsViewActivated()){
                        if(isIrrelevant()){
                                setIrrelevant(isIrrelevant());
                        }else{
@@ -179,7 +179,7 @@ public class NameDetailElement extends AbstractIdentifiableEntityDetailElement<I
                                createBotanicalNameParts(formElement, nonViralName, style);
                                break;
                        case Fungi :
-                               if (isAdvancedView){
+                               if (!config.isSimpleDetailsViewActivated()){
                                        createFungusNameParts(formElement, nonViralName, style);
                                }
                                break;
@@ -230,7 +230,7 @@ public class NameDetailElement extends AbstractIdentifiableEntityDetailElement<I
        private void createZoologicalNameParts(ICdmFormElement formElement, INonViralName nonViralName, int style){
                IZoologicalName zoologicalName = (IZoologicalName) nonViralName;
 
-               if (isAdvancedView){
+               if (!config.isSimpleDetailsViewActivated()){
                    text_breed = formFactory.createTextWithLabelElement(formElement, "Breed", zoologicalName.getBreed(), style);
                }
        }
index 5bc5b30809898c46fec864e9d369b0792686dcd6..c4c11b5ffba1e55908e3332142b6ae93dbc4b668 100644 (file)
@@ -18,7 +18,7 @@ import eu.etaxonomy.cdm.model.name.NomenclaturalCode;
 import eu.etaxonomy.cdm.model.name.TaxonName;
 import eu.etaxonomy.taxeditor.l10n.Messages;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
+import eu.etaxonomy.taxeditor.preference.NameDetailsConfigurator;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.store.StoreUtil;
 import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement;
@@ -43,21 +43,20 @@ public class NonViralNameDetailElement
        private HybridDetailSection section_hybrid;
        private LsidWithExceptionLabelElement textLsid;
        private TextWithLabelElement text_nameApprobation;
-
+       //protected boolean isAdvancedView ;
 
        public NonViralNameDetailElement(CdmFormFactory formFactory,
                        ICdmFormElement formElement) {
                super(formFactory, formElement);
-               initIsAdvancedDetailsView();
 
        }
 
        /** {@inheritDoc} */
        @Override
     protected void createControls(ICdmFormElement formElement, final TaxonName entity, int style) {
+           NameDetailsConfigurator config = PreferencesUtil.getPreferredNameDetailsConfiguration(true);
 
-
-        if (isAdvancedView){
+        if (!config.isSimpleDetailsViewActivated() ){
             toggleable_cache = formFactory.createToggleableTextField(formElement, "Cache", entity.getTitleCache(), entity.isProtectedTitleCache() || entity.isProtectedFullTitleCache(), style);
 
             combo_nomenclaturalCode = formFactory.createEnumComboElement(NomenclaturalCode.class, formElement, style);
@@ -69,21 +68,21 @@ public class NonViralNameDetailElement
 
 
         }else{
-               if (PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_CACHE)){
+               if (config.isNameCacheActivated()){
                        toggleable_cache = formFactory.createToggleableTextField(formElement, "Cache", entity.getTitleCache(), entity.isProtectedTitleCache() || entity.isProtectedFullTitleCache(), style);
 
                }
-               if (PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE)){
+               if (config.isNomenclaturalCodeActived()){
                        combo_nomenclaturalCode = formFactory.createEnumComboElement(NomenclaturalCode.class, formElement, style);
                        combo_nomenclaturalCode.setSelection(entity.getNomenclaturalCode());
                }
                if (entity.getNameType().equals(NomenclaturalCode.ICNB)){
-                       if (PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_APPROBATION)){
+                       if (config.isNameApprobiationActivated()){
                         text_nameApprobation = formFactory.createTextWithLabelElement(formElement, "Name Approbation", entity.getNameApprobation(),style);
                        }
                }
 
-               if (PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID)){
+               if (config.isLSIDActivated()){
                        textLsid = formFactory.createLsidWithExceptionLabelElement(formElement, "Lsid", entity.getLsid(), style);
 
                }
@@ -103,7 +102,7 @@ public class NonViralNameDetailElement
            addElement(section_author);
 //         }
            //TODO RL
-           if (isAdvancedView || PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_HYBRID)){
+           if (config.isHybridActivated()){
           section_hybrid = formFactory.createHybridDetailSection(getConversationHolder(), formElement, null, ExpandableComposite.TWISTIE);
           section_hybrid.setLayoutData(LayoutConstants.FILL_HORIZONTALLY(2, 1));
           addControl(section_hybrid);
index 1dd95a0525e10060fbcb270f620aeb9d9955f15b..7e48e914b62c92e152d2ffc58d9f3ee80c678a97 100644 (file)
@@ -20,7 +20,7 @@ import eu.etaxonomy.cdm.model.taxon.SynonymType;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.cdm.model.taxon.TaxonBase;
 import eu.etaxonomy.cdm.persistence.hibernate.permission.Role;
-import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
+import eu.etaxonomy.taxeditor.preference.NameDetailsConfigurator;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.taxeditor.ui.combo.TermComboElement;
@@ -63,6 +63,7 @@ public class TaxonBaseDetailElement extends AbstractIdentifiableEntityDetailElem
        @Override
        protected void createControls(ICdmFormElement formElement, TaxonBase entity, int style) {
 
+           NameDetailsConfigurator config = PreferencesUtil.getPreferredNameDetailsConfiguration(true);
                toggleable_cache = formFactory.createToggleableTextField(formElement,
                                        "Title Cache", entity.getTitleCache(),
                                        entity.isProtectedTitleCache(), style);
@@ -78,10 +79,10 @@ public class TaxonBaseDetailElement extends AbstractIdentifiableEntityDetailElem
                                 formElement, "Secundum",
                                entity.getSec(), EntitySelectionElement.ALL,
                                style);
-               if (!PreferencesUtil.getBooleanValue(IPreferenceKeys.DISABLE_SEC)){
+               if (!config.isSecEnabled() && config.isSimpleDetailsViewActivated()){
                    selection_secundum.setEnabled(false);
                }
-               if (PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_SEC_DETAILS)){
+               if (config.isSecDetailsActivated() || !config.isSimpleDetailsViewActivated()){
                text_secundum_microreference = formFactory.createTextWithLabelElement(
                     formElement, "Detail",
                    entity.getSecMicroReference(),null,
index f000684b0fe79e57c80ebe8caf70c6a3c37be507..dc1e83d34d3fa56b56fdb6055dea6b781c1da5bf 100755 (executable)
@@ -64,7 +64,7 @@ import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
 import eu.etaxonomy.taxeditor.model.IDerivedUnitFacadePart;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.model.PolytomousKeyRelationship;
-import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
+import eu.etaxonomy.taxeditor.preference.NameDetailsConfigurator;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.store.UsageTermCollection;
 import eu.etaxonomy.taxeditor.ui.element.RootElement;
@@ -423,15 +423,16 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 {
     }
 
     private void createTaxonSections(RootElement parent) {
+        NameDetailsConfigurator config = PreferencesUtil.getPreferredNameDetailsConfiguration(true);
         ParsingMessagesSection parsingMessagesSection = formFactory.createParsingMessagesSection(getConversationHolder(), parent, this,
                 getSectionStyle(ParsingMessagesSection.class, true));
-        if (!PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION)){
+        if (!config.isSimpleDetailsViewActivated()){
             TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this,
                     getSectionStyle(TaxonBaseDetailSection.class, true));
             formFactory.createHorizontalSeparator(parent, SWT.BORDER);
             addPart(taxonBaseDetailSection);
         }else{
-            if (PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON)){
+            if (config.isTaxonSectionActivated()){
                 TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this,
                         getSectionStyle(TaxonBaseDetailSection.class, true));
                 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
@@ -442,33 +443,33 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 {
                 .createNonViralNameDetailSection(getConversationHolder(), parent, this, true,
                         getSectionStyle(NonViralNameDetailSection.class, true));
         formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-        if (!PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) || (PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) && PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE))){
+        if (!config.isSimpleDetailsViewActivated() || (config.isSimpleDetailsViewActivated() && config.isNomenclaturalReferenceSectionActivated())){
             NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
                     getSectionStyle(NomenclaturalReferenceDetailSection.class, true));
             formFactory.createHorizontalSeparator(parent, SWT.BORDER);
             addPart(referenceDetailSection);
 
         }
-        if ( !PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) || (PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) && PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS))){
+        if ( !config.isSimpleDetailsViewActivated() || (config.isSimpleDetailsViewActivated() && config.isNomenclaturalStatusSectionActivated())){
             NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
                     getSectionStyle(NomenclaturalStatusSection.class, true));
             formFactory.createHorizontalSeparator(parent, SWT.BORDER);
             addPart(nomenclaturalStatusSection);
         }
 
-        if (!PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) || (PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) && PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE))){
+        if ( !config.isSimpleDetailsViewActivated() || (config.isSimpleDetailsViewActivated() && config.isProtologueActivated())){
             ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, getSectionStyle(ProtologueSection.class));
             formFactory.createHorizontalSeparator(parent, SWT.BORDER);
             addPart(protologSection);
         }
 
-        if (!PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) || (PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) &&  PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION))){
+        if (!config.isSimpleDetailsViewActivated() || (config.isSimpleDetailsViewActivated() && config.isTypeDesignationSectionActivated())){
             TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, getSectionStyle(TypeDesignationSection.class));
             formFactory.createHorizontalSeparator(parent, SWT.BORDER);
             addPart(typeDesignationSection);
         }
 
-        if (!PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) || (PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION) && PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP))){
+        if (!config.isSimpleDetailsViewActivated() || (config.isSimpleDetailsViewActivated() &&config.isNameRelationsSectionActivated())){
             NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, getSectionStyle(NameRelationshipDetailSection.class));
             formFactory.createHorizontalSeparator(parent, SWT.BORDER);
             addPart(nameRelationshipSection);
@@ -877,7 +878,6 @@ public class DetailsViewerE4 extends AbstractCdmDataViewerE4 {
         if(refresh){
             refresh();
 
-//            setSelection(getSelection(), true);
         }
     }