ref #7849: continue adapt db and local preference pages
authorKatja Luther <k.luther@bgbm.org>
Mon, 26 Nov 2018 12:22:36 +0000 (13:22 +0100)
committerKatja Luther <k.luther@bgbm.org>
Mon, 26 Nov 2018 12:22:36 +0000 (13:22 +0100)
14 files changed:
eu.etaxonomy.taxeditor.store/plugin.xml
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/ChecklistEditorGeneralAdminPreference.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/GeneralAdminPreferencePage.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/NameDetailsViewAdminConfiguration.java [new file with mode: 0755]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/NameDetailsViewConfiguration.java [deleted file]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/SpecimenAdminPreferences.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/l10n/Messages.java
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/ChecklistEditorGeneralPreference.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/GeneralPreferencePage.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/SpecimenOrObservationPreferences.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/menu/CdmPreferencePage.java

index 1ca6abdcbd7bde067e2fcb78511dacdc291f7aff..9743a5fc7bf991aaab710bf19ab2e76ef234f386 100755 (executable)
    </page>
    <page
          category="eu.etaxonomy.taxeditor.preferences.general"
-         class="eu.etaxonomy.taxeditor.databaseAdmin.preferencePage.NameDetailsViewConfiguration"
+         class="eu.etaxonomy.taxeditor.databaseAdmin.preferencePage.NameDetailsViewAdminConfiguration"
          id="eu.etaxonomy.taxeditor.store.page3"
          name="%page.name.44">
    </page>
index 1a3b0c609fb9de441f3a9e8523560ba04a605006..e4a8edcc1a5d8ca5c3957095f5ad2ebb17df70f7 100755 (executable)
@@ -14,7 +14,6 @@ import org.eclipse.swt.widgets.Control;
 import eu.etaxonomy.cdm.api.application.ICdmRepository;
 import eu.etaxonomy.cdm.api.service.IPreferenceService;
 import eu.etaxonomy.cdm.model.metadata.CdmPreference;
-import eu.etaxonomy.taxeditor.l10n.Messages;
 import eu.etaxonomy.taxeditor.preference.ChecklistEditorGeneralPreference;
 import eu.etaxonomy.taxeditor.preference.EditorPreferencePredicate;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
@@ -75,7 +74,7 @@ public class ChecklistEditorGeneralAdminPreference extends ChecklistEditorGenera
     }
 
     @Override
-    public void getValues() {
+    public void init() {
 
         distributionEditorPref = PreferencesUtil.getPreferenceFromDB(EditorPreferencePredicate.DistributionEditorActivated);
         if (distributionEditorPref == null){
@@ -132,7 +131,7 @@ public class ChecklistEditorGeneralAdminPreference extends ChecklistEditorGenera
 
         commandHandlerString = "eu.etaxonomy.taxeditor.store.open.OpenDistributionEditorWizardAdminHandler";
         commandHandlerStringStatus = "eu.etaxonomy.taxeditor.store.open.OpenDistributionStatusWizardAdminHandler";
-        overrideString = Messages.GeneralPreference_allowOverride;
+
         setValid(false);
     }
 
index 90fc618726a59711bbc53eca7060aadf42549d52..fdfa74c71f89a267a7a674967135d0edc948dc66 100755 (executable)
@@ -14,7 +14,6 @@ import eu.etaxonomy.cdm.model.metadata.CdmPreference;
 import eu.etaxonomy.cdm.model.metadata.CdmPreference.PrefKey;
 import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
 import eu.etaxonomy.cdm.model.metadata.PreferenceSubject;
-import eu.etaxonomy.taxeditor.l10n.Messages;
 import eu.etaxonomy.taxeditor.preference.EditorPreferencePredicate;
 import eu.etaxonomy.taxeditor.preference.GeneralPreferencePage;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
@@ -62,7 +61,7 @@ public class GeneralAdminPreferencePage extends GeneralPreferencePage implements
     @Override
     protected void getValues(){
         isAdminPreference = true;
-        overrideString = Messages.GeneralPreference_allowOverride;
+
         controller = CdmStore.getCurrentApplicationConfiguration();
         if (controller != null){
           IPreferenceService service = controller.getPreferenceService();
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/NameDetailsViewAdminConfiguration.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/NameDetailsViewAdminConfiguration.java
new file mode 100755 (executable)
index 0000000..faa26c5
--- /dev/null
@@ -0,0 +1,91 @@
+package eu.etaxonomy.taxeditor.databaseAdmin.preferencePage;
+
+
+import eu.etaxonomy.cdm.api.application.ICdmRepository;
+import eu.etaxonomy.cdm.api.service.IPreferenceService;
+import eu.etaxonomy.cdm.model.metadata.CdmPreference;
+import eu.etaxonomy.cdm.model.metadata.CdmPreference.PrefKey;
+import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
+import eu.etaxonomy.cdm.model.metadata.PreferenceSubject;
+import eu.etaxonomy.taxeditor.preference.CdmPreferenceCache;
+import eu.etaxonomy.taxeditor.preference.EditorPreferencePredicate;
+import eu.etaxonomy.taxeditor.preference.NameDetailsConfigurator;
+import eu.etaxonomy.taxeditor.preference.NameDetailsViewConfiguration;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+
+public class NameDetailsViewAdminConfiguration extends NameDetailsViewConfiguration implements IE4AdminPreferencePage{
+
+   protected NameDetailsConfigurator createNameDetailsViewConfig() {
+       NameDetailsConfigurator config = new NameDetailsConfigurator(isSimpleDetailsViewActivated);
+
+      config.setAppendedPhraseActivated(isShowAppendedPhrase);
+      config.setAtomisedEpithetsActivated(isShowEpithets);
+      config.setAuthorshipSectionActivated(isShowAuthorship);
+      config.setAuthorCacheActivated(isShowAuthorCache);
+      config.setLSIDActivated(isShowLSID);
+      config.setNameApprobiationActivated(isShowNameApprobiation);
+      config.setNameCacheActivated(isShowNameCache);
+      config.setNameRelationsSectionActivated(isShowNameRelationship);
+      config.setNomenclaturalCodeActived(isShowNomenclaturalCode);
+      config.setNomenclaturalStatusSectionActivated(isShowNomenclaturalStatus);
+      config.setNomenclaturalReferenceSectionActivated(isShowNomenclaturalRef);
+      config.setProtologueActivated(isShowProtologue);
+      config.setRankActivated(isShowRank);
+      config.setTaxonSectionActivated(isShowTaxon);
+      config.setSecDetailsActivated(isSecDetailsActivated);
+      config.setSecEnabled(isSecEnabled);
+      config.setTypeDesignationSectionActivated(isShowTypeDesignation);
+      config.setHybridActivated(isShowHybrid);
+
+
+      return config;
+   }
+
+
+    @Override
+    public boolean performOk() {
+        if (nameDetailsConfig == null){
+            return true;
+        }
+        ICdmRepository controller = CdmStore.getCurrentApplicationConfiguration();
+        if (controller == null){
+            return false;
+        }
+        IPreferenceService service = controller.getPreferenceService();
+        NameDetailsConfigurator config = createNameDetailsViewConfig();
+        String value = config.toString();
+
+
+        CdmPreference pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.NameDetailsView, value);
+        pref.setAllowOverride(isAllowOverride);
+        service.set(pref);
+        PreferencesUtil.saveConfigToPrefernceStore(config);
+
+        return true;
+    }
+
+
+    @Override
+    public void init(){
+        isAdminPreference = true;
+        ICdmRepository controller = CdmStore.getCurrentApplicationConfiguration();
+        if (controller != null){
+            IPreferenceService service = controller.getPreferenceService();
+            PrefKey key = CdmPreference.NewKey(PreferenceSubject.NewTaxEditorInstance(), EditorPreferencePredicate.NameDetailsView);
+            CdmPreference pref = service.find(key);
+
+            isAllowOverride = pref.isAllowOverride();
+            CdmPreferenceCache cache = CdmPreferenceCache.instance();
+            cache.put(pref);
+        }
+        nameDetailsConfig = PreferencesUtil.getPreferredNameDetailsConfiguration(false);
+        if (nameDetailsConfig == null){
+            nameDetailsConfig = new NameDetailsConfigurator(false);
+        }
+
+    }
+
+
+}
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/NameDetailsViewConfiguration.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/preferencePage/NameDetailsViewConfiguration.java
deleted file mode 100755 (executable)
index d0ea11f..0000000
+++ /dev/null
@@ -1,399 +0,0 @@
-package eu.etaxonomy.taxeditor.databaseAdmin.preferencePage;
-
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-
-import eu.etaxonomy.cdm.api.application.ICdmRepository;
-import eu.etaxonomy.cdm.api.service.IPreferenceService;
-import eu.etaxonomy.cdm.model.metadata.CdmPreference;
-import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
-import eu.etaxonomy.taxeditor.l10n.Messages;
-import eu.etaxonomy.taxeditor.preference.NameDetailsConfigurator;
-import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
-import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-
-
-public class NameDetailsViewConfiguration extends CdmPreferencePage implements IE4AdminPreferencePage{
-
-    boolean isSimpleDetailsViewActivated;
-
-    boolean isAllowOverride;
-    boolean isShowTaxon;
-    boolean isSecDetailsActivated;
-    boolean isSecEnabled;
-    boolean isShowLSID;
-    boolean isShowNomenclaturalCode;
-    boolean isShowNameCache;
-    boolean isShowAppendedPhrase;
-    boolean isShowRank;
-    boolean isShowEpithets;
-    boolean isShowAuthorCache;
-    boolean isShowAuthorship;
-    boolean isShowNomenclaturalRef;
-    boolean isShowNomenclaturalStatus;
-    boolean isShowProtologue;
-    boolean isShowTypeDesignation;
-    boolean isShowNameRelationship;
-    boolean isShowHybrid;
-    boolean isShowNameApprobiation;
-    private NameDetailsConfigurator nameDetailsConfig = null;
-
-    @Override
-    protected Control createContents(Composite parent) {
-        final CLabel description = new CLabel(parent, SWT.NULL);
-        description.setText(Messages.NameDetailsViewConfiguration_description);
-
-        Composite title  = createComposite(parent);
-        nameDetailsConfig = PreferencesUtil.getPreferredNameDetailsConfiguration(false);
-        if (nameDetailsConfig == null){
-            nameDetailsConfig = new NameDetailsConfigurator(false);
-        }
-
-        final Button activateCheckButton = new Button(title, SWT.CHECK);
-        final Button allowLocalPreference = new Button(title, SWT.CHECK);
-        Composite dbSettings  = new Composite(parent, SWT.NONE);
-
-        activateCheckButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, true, 1, 1));
-        activateCheckButton.setText(Messages.NameDetailsViewConfiguration_activateSimpleDetailsView);
-        isSimpleDetailsViewActivated = nameDetailsConfig.isSimpleDetailsViewActivated();
-        activateCheckButton.setSelection(isSimpleDetailsViewActivated);
-        activateCheckButton.addSelectionListener(new SelectionAdapter(){
-            @Override
-            public void widgetSelected(SelectionEvent e) {
-                isSimpleDetailsViewActivated = activateCheckButton.getSelection();
-               //
-                if(isSimpleDetailsViewActivated){
-                    dbSettings.setVisible(true);
-                    dbSettings.setEnabled(true);
-                }else{
-                    dbSettings.setVisible(false);
-                    dbSettings.setEnabled(false);
-                }
-             }
-         });
-
-
-//      boolean isUseLocalPreference = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NAME_DETAILS);
-        allowLocalPreference.setText(Messages.DatabasePreferencesPage_UseLocalPreferences);
-        isAllowOverride = nameDetailsConfig.isAllowOverride();
-        allowLocalPreference.setSelection(isAllowOverride);
-        allowLocalPreference.addSelectionListener(new SelectionAdapter(){
-            @Override
-            public void widgetSelected(SelectionEvent e) {
-                isAllowOverride = allowLocalPreference.getSelection();
-
-            }
-        });
-
-        dbSettings.setLayout(new GridLayout());
-        dbSettings.setVisible(isSimpleDetailsViewActivated);
-//       Table table = new Table(dbSettings,SWT.BORDER | SWT.CHECK);
-//       TableColumn tableColumnValue = new TableColumn(table, SWT.CENTER);
-//
-//       TableColumn tableColumnAllowOverride = new TableColumn(table, SWT.CENTER);
-
-
-        Label separator= new Label(dbSettings, SWT.HORIZONTAL | SWT.SEPARATOR);
-        separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-        final Button showTaxon = new Button(dbSettings, SWT.CHECK);
-        showTaxon.setText(Messages.NameDetailsViewComposite_Show_Taxon);
-        isShowTaxon = nameDetailsConfig.isTaxonSectionActivated();
-        showTaxon.setSelection(isShowTaxon);
-        showTaxon.addSelectionListener(new SelectionAdapter(){
-             @Override
-             public void widgetSelected(SelectionEvent e) {
-                 isShowTaxon = showTaxon.getSelection();
-
-              }
-         });
-
-        final Button showSecDetail = new Button(dbSettings, SWT.CHECK);
-        showSecDetail.setText(Messages.NameDetailsViewComposite_Show_SecDetail);
-        isSecDetailsActivated = nameDetailsConfig.isSecDetailsActivated();
-        showSecDetail.setSelection(isSecDetailsActivated);
-        showSecDetail.addSelectionListener(new SelectionAdapter(){
-             @Override
-             public void widgetSelected(SelectionEvent e) {
-                 isSecDetailsActivated = showSecDetail.getSelection();
-
-              }
-         });
-
-        final Button secEnabled = new Button(dbSettings, SWT.CHECK);
-        secEnabled.setText(Messages.NameDetailsViewComposite_SecEnabled);
-        isSecEnabled = nameDetailsConfig.isSecEnabled();
-        secEnabled.setSelection(isSecEnabled);
-        secEnabled.addSelectionListener(new SelectionAdapter(){
-             @Override
-             public void widgetSelected(SelectionEvent e) {
-                 isSecEnabled = secEnabled.getSelection();
-
-              }
-         });
-
-
-        final Button showLsid = new Button(dbSettings, SWT.CHECK);
-        showLsid.setText(Messages.NameDetailsViewComposite_Show_LSID);
-        isShowLSID = nameDetailsConfig.isLSIDActivated();
-        showLsid.setSelection(isShowLSID);
-        showLsid.addSelectionListener(new SelectionAdapter(){
-             @Override
-             public void widgetSelected(SelectionEvent e) {
-                 isShowLSID = showLsid.getSelection();
-
-              }
-         });
-
-        final Button showNomenclaturalCode = new Button(dbSettings, SWT.CHECK);
-        showNomenclaturalCode.setText(Messages.NameDetailsViewComposite_Show_NomenclaturalCode);
-        isShowNomenclaturalCode = nameDetailsConfig.isNomenclaturalCodeActived();
-        showNomenclaturalCode.setSelection(isShowNomenclaturalCode);
-        showNomenclaturalCode.addSelectionListener(new SelectionAdapter(){
-             @Override
-             public void widgetSelected(SelectionEvent e) {
-                 isShowNomenclaturalCode = showNomenclaturalCode.getSelection();
-
-              }
-         });
-
-        final Button showNameCache = new Button(dbSettings, SWT.CHECK);
-        showNameCache.setText(Messages.NameDetailsViewComposite_Show_NameCache);
-        isShowNameCache = nameDetailsConfig.isNameCacheActivated();
-        showNameCache.setSelection(isShowNameCache);
-        showNameCache.addSelectionListener(new SelectionAdapter(){
-             @Override
-             public void widgetSelected(SelectionEvent e) {
-                isShowNameCache = showNameCache.getSelection();
-
-              }
-         });
-        final Button showAppendedPhrase = new Button(dbSettings, SWT.CHECK);
-        isShowAppendedPhrase= nameDetailsConfig.isAppendedPhraseActivated();
-        showAppendedPhrase.setText(Messages.NameDetailsViewComposite_Show_AppendedPhrase);
-        showAppendedPhrase.setSelection(isShowAppendedPhrase);
-        showAppendedPhrase.addSelectionListener(new SelectionAdapter(){
-             @Override
-             public void widgetSelected(SelectionEvent e) {
-                isShowAppendedPhrase = showAppendedPhrase.getSelection();
-
-              }
-         });
-
-        final Button showRank = new Button(dbSettings, SWT.CHECK);
-        isShowRank = nameDetailsConfig.isRankActivated();
-        showRank.setText(Messages.NameDetailsViewComposite_Show_Rank);
-        showRank.setSelection(isShowRank);
-        showRank.addSelectionListener(new SelectionAdapter(){
-             @Override
-             public void widgetSelected(SelectionEvent e) {
-                 isShowRank = showRank.getSelection();
-
-              }
-         });
-        final Button showEpithets = new Button(dbSettings, SWT.CHECK);
-        isShowEpithets = nameDetailsConfig.isAtomisedEpithetsActivated();
-        showEpithets.setText(Messages.NameDetailsViewComposite_Show_AtomisedEpithets);
-        showEpithets.setSelection(isShowEpithets);
-        showEpithets.addSelectionListener(new SelectionAdapter(){
-             @Override
-             public void widgetSelected(SelectionEvent e) {
-                 isShowEpithets = showEpithets.getSelection();
-
-              }
-         });
-
-        final Button showAuthorCache = new Button(dbSettings, SWT.CHECK);
-        isShowAuthorCache = nameDetailsConfig.isAuthorCacheActivated();
-        showAuthorCache.setText(Messages.NameDetailsViewComposite_Show_AuthorCache);
-        showAuthorCache.setSelection(isShowAuthorCache);
-        showAuthorCache.addSelectionListener(new SelectionAdapter(){
-             @Override
-             public void widgetSelected(SelectionEvent e) {
-                 isShowAuthorCache = showAuthorCache.getSelection();
-
-              }
-         });
-
-        final Button showAuthorship = new Button(dbSettings, SWT.CHECK);
-        isShowAuthorship = nameDetailsConfig.isAuthorshipSectionActivated();
-        showAuthorship.setText(Messages.NameDetailsViewComposite_Show_Author);
-        showAuthorship.setSelection(isShowAuthorship);
-        showAuthorship.addSelectionListener(new SelectionAdapter(){
-             @Override
-             public void widgetSelected(SelectionEvent e) {
-                 isShowAuthorship = showAuthorship.getSelection();
-
-              }
-         });
-
-        final Button showNomenclaturalRef = new Button(dbSettings, SWT.CHECK);
-        isShowNomenclaturalRef = nameDetailsConfig.isNomenclaturalReferenceSectionActivated();
-        showNomenclaturalRef.setText(Messages.NameDetailsViewComposite_Show_NomenclaturalReference);
-        showNomenclaturalRef.setSelection(isShowNomenclaturalRef);
-        showNomenclaturalRef.addSelectionListener(new SelectionAdapter(){
-             @Override
-             public void widgetSelected(SelectionEvent e) {
-                 isShowNomenclaturalRef = showNomenclaturalRef.getSelection();
-
-              }
-         });
-
-        final Button showNomenclaturalStatus = new Button(dbSettings, SWT.CHECK);
-        isShowNomenclaturalStatus = nameDetailsConfig.isNomenclaturalStatusSectionActivated();
-        showNomenclaturalStatus.setText(Messages.NameDetailsViewComposite_Show_NomenclaturalStatus);
-        showNomenclaturalStatus.setSelection(isShowNomenclaturalStatus);
-        showNomenclaturalStatus.addSelectionListener(new SelectionAdapter(){
-             @Override
-             public void widgetSelected(SelectionEvent e) {
-                 isShowNomenclaturalStatus = showNomenclaturalStatus.getSelection();
-
-              }
-         });
-
-        final Button showProtologue = new Button(dbSettings, SWT.CHECK);
-        isShowProtologue = nameDetailsConfig.isProtologueActivated();
-        showProtologue.setText(Messages.NameDetailsViewComposite_Show_Protologue);
-        showProtologue.setSelection(isShowProtologue);
-        showProtologue.addSelectionListener(new SelectionAdapter(){
-             @Override
-             public void widgetSelected(SelectionEvent e) {
-                 isShowProtologue = showProtologue.getSelection();
-
-              }
-         });
-
-        final Button showTypeDesignation = new Button(dbSettings, SWT.CHECK);
-        isShowTypeDesignation = nameDetailsConfig.isTypeDesignationSectionActivated();
-        showTypeDesignation.setText(Messages.NameDetailsViewComposite_Show_TypeDesignation);
-        showTypeDesignation.setSelection(isShowTypeDesignation);
-        showTypeDesignation.addSelectionListener(new SelectionAdapter(){
-             @Override
-             public void widgetSelected(SelectionEvent e) {
-                 isShowTypeDesignation = showTypeDesignation.getSelection();
-
-              }
-         });
-
-
-        final Button showNameRelationship = new Button(dbSettings, SWT.CHECK);
-        isShowNameRelationship = nameDetailsConfig.isNameRelationsSectionActivated();
-        showNameRelationship.setText(Messages.NameDetailsViewComposite_Show_Namerelationships);
-        showNameRelationship.setSelection(isShowNameRelationship);
-        showNameRelationship.addSelectionListener(new SelectionAdapter(){
-             @Override
-             public void widgetSelected(SelectionEvent e) {
-                 isShowNameRelationship = showNameRelationship.getSelection();
-
-              }
-         });
-
-        final Button showHybrid = new Button(dbSettings, SWT.CHECK);
-        isShowHybrid = nameDetailsConfig.isHybridActivated();
-        showHybrid.setText(Messages.NameDetailsViewComposite_Show_Hybrid);
-        showHybrid.setSelection(isShowHybrid);
-        showHybrid.addSelectionListener(new SelectionAdapter(){
-             @Override
-             public void widgetSelected(SelectionEvent e) {
-                 isShowHybrid = showHybrid.getSelection();
-
-              }
-         });
-        final Button showNameApprobiation = new Button(dbSettings, SWT.CHECK);
-        isShowNameApprobiation = nameDetailsConfig.isNameApprobiationActivated();
-        showNameApprobiation.setText(Messages.NameDetailsViewComposite_Show_NameApprobiation);
-        showNameApprobiation.setSelection(isShowNameApprobiation);
-        showNameApprobiation.addSelectionListener(new SelectionAdapter(){
-             @Override
-             public void widgetSelected(SelectionEvent e) {
-                 isShowNameApprobiation = showNameApprobiation.getSelection();
-                //PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_APPROBATION, isShowNameApprobiation);
-              }
-         });
-
-
-
-
-        return dbSettings;
-       }
-
-    /**
-    *
-    */
-   protected NameDetailsConfigurator createNameDetailsViewConfig() {
-       NameDetailsConfigurator config = new NameDetailsConfigurator(isSimpleDetailsViewActivated);
-
-      config.setAppendedPhraseActivated(isShowAppendedPhrase);
-      config.setAtomisedEpithetsActivated(isShowEpithets);
-      config.setAuthorshipSectionActivated(isShowAuthorship);
-      config.setAuthorCacheActivated(isShowAuthorCache);
-      config.setLSIDActivated(isShowLSID);
-      config.setNameApprobiationActivated(isShowNameApprobiation);
-      config.setNameCacheActivated(isShowNameCache);
-      config.setNameRelationsSectionActivated(isShowNameRelationship);
-      config.setNomenclaturalCodeActived(isShowNomenclaturalCode);
-      config.setNomenclaturalStatusSectionActivated(isShowNomenclaturalStatus);
-      config.setNomenclaturalReferenceSectionActivated(isShowNomenclaturalRef);
-      config.setProtologueActivated(isShowProtologue);
-      config.setRankActivated(isShowRank);
-      config.setTaxonSectionActivated(isShowTaxon);
-      config.setSecDetailsActivated(isSecDetailsActivated);
-      config.setSecEnabled(isSecEnabled);
-      config.setTypeDesignationSectionActivated(isShowTypeDesignation);
-      config.setHybridActivated(isShowHybrid);
-
-
-      return config;
-   }
-
-
-    @Override
-    public boolean performOk() {
-        if (nameDetailsConfig == null){
-            return true;
-        }
-        ICdmRepository controller = CdmStore.getCurrentApplicationConfiguration();
-        if (controller == null){
-            return false;
-        }
-        IPreferenceService service = controller.getPreferenceService();
-        NameDetailsConfigurator config = createNameDetailsViewConfig();
-        String value = config.toString();
-//        boolean allowOverride = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NAME_DETAILS);
-
-        CdmPreference pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.NameDetailsView, value);
-        pref.setAllowOverride(isAllowOverride);
-        service.set(pref);
-        PreferencesUtil.saveConfigToPrefernceStore(config);
-//        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON, isShowTaxon);
-//        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_SEC_DETAILS, isSecDetailsActivated);
-//        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.DISABLE_SEC, isSecEnabled);
-//        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID, isShowLSID);
-//        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE, isShowNomenclaturalCode);
-//        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAMECACHE, isShowNameCache);
-//        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE, isShowAppendedPhrase);
-//        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK, isShowRank);
-//        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS, isShowEpithets);
-//        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP, isShowAuthorship);
-//        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP_CACHE, isShowAuthorCache);
-//        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE, isShowNomenclaturalRef);
-//        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS, isShowNomenclaturalStatus);
-//        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE, isShowProtologue);
-//        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION, isShowTypeDesignation);
-//        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP, isShowNameRelationship);
-//        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_HYBRID, isShowHybrid);
-//        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ALLOW_OVERRIDE_NAME_DETAILS, isAllowOverride);
-//        PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION, isSimpleDetailsViewActivated);
-        return true;
-    }
-
-}
index 38fc5c0b7da1281ceb6acf009c24518c56e25a7a..f4b07943b812ad8685ab181cc89e84b238ca5613 100755 (executable)
@@ -16,7 +16,6 @@ import eu.etaxonomy.cdm.model.metadata.CdmPreference;
 import eu.etaxonomy.cdm.model.metadata.CdmPreference.PrefKey;
 import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
 import eu.etaxonomy.cdm.model.metadata.PreferenceSubject;
-import eu.etaxonomy.taxeditor.l10n.Messages;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.preference.SpecimenOrObservationPreferences;
 import eu.etaxonomy.taxeditor.store.CdmStore;
@@ -143,7 +142,7 @@ public class SpecimenAdminPreferences extends SpecimenOrObservationPreferences i
     @Override
     protected void getValues(){
         isAdminPreference = true;
-        overrideString = Messages.GeneralPreference_allowOverride;
+
         ICdmRepository controller = CdmStore.getCurrentApplicationConfiguration();
         if (controller != null){
             IPreferenceService service = controller.getPreferenceService();
index 951ade6049a7b7718a1b41b37042fe03430519a8..3a2e6602a3de1b9e801f62417a21f54fe624fe72 100644 (file)
@@ -474,6 +474,7 @@ public class Messages extends NLS {
 
     public static String NameDetailsViewConfiguration_description;
     public static String NameDetailsViewConfiguration_useLocalSettings;
+    public static String NameDetailsViewConfiguration_description_not_available;
 
 
     public static String NameRelationshipWizardPage_description;
index a5c52f703a0780e39902419e8b2932cd43bc08f5..ec31fed3a394e7e37ba7080e607de820cb5bd25d 100644 (file)
@@ -378,6 +378,8 @@ NomenclaturalCodePreferences_available_codes=Available Codes
 NomenclaturalCodePreferences_description=Configure the default settings for the nomenclatural code, this is used for new created taxa.
 
 NameDetailsViewConfiguration_description=Configure the simple name details view. The selected parts are displayed, others are not visible in a simple name details view.
+NameDetailsViewConfiguration_description_not_available=The configuration of the name details view is not possible in local preferences. If you want to change the configuration, please contact an administrator.
+
 NameRelationshipWizardPage_description=Choose namerelationship type and related name
 
 DateDetail_parseText_tooltip=This field is for quick data entry. The content is parsed and the atomised fields will be filled, the content of this field will not be saved.
index e2ef0638e50ceb91d4a7f8cc8bd44ce4ae2d7107..a43ff3b3c75eaf4035bed97f995c31a42aa831c4 100644 (file)
@@ -378,6 +378,7 @@ NomenclaturalCodePreferences_available_codes=Verf
 NomenclaturalCodePreferences_description=Konfiguration des verwendeten Nomenklatorischen Codes beim Erstellen eines neuen Taxons
 
 NameDetailsViewConfiguration_description=Konfiguration eines vereinfachten Namensdetailsviews. \nDie ausgewählten Parts werden angezeigt, die anderen sind nicht sichtbar.
+NameDetailsViewConfiguration_description_not_available=Die Konfiguration des Details Views kann nur Ã¼ber die Admin Präferenzen geändert werden, da kein lokales Ãœberschreiben erlaubt ist. Wenn Sie dennoch Ã„nderungen vornehmen möchten, wenden Sie sich an einen Administrator.
 NameRelationshipWizardPage_description=Auswahl des Relationstyps und des in Beziehung stehenden Namens 
 
 DateDetail_parseText_tooltip=Dieses Feld ist für die schnelle Dateneingabe. Der Inhalt des Feldes wird geparsed und in die atomisierten Felder geschrieben. Der Inhalt des Feldes selber wird nicht gespeichert.
index f6c18129ea2adfe91fa4e1e5dc5f497144973530..8fa2f61088028d3381ecbd687205af278bff9b44 100644 (file)
@@ -454,7 +454,7 @@ public class ChecklistEditorGeneralPreference extends CdmPreferencePage implemen
      * {@inheritDoc}
      */
     @Override
-    protected void getValues() {
+    public void init() {
         isAdminPreference = false;
         setPreferenceStore(PreferencesUtil.getPreferenceStore());
         distributionEditorPref = PreferencesUtil.getPreferenceFromDB(EditorPreferencePredicate.DistributionEditorActivated);
@@ -550,7 +550,7 @@ public class ChecklistEditorGeneralPreference extends CdmPreferencePage implemen
 
         commandHandlerString = "eu.etaxonomy.taxeditor.store.open.OpenDistributionEditorWizardHandler";
         commandHandlerStringStatus = "eu.etaxonomy.taxeditor.store.open.OpenDistributionStatusWizardHandler";
-        overrideString = Messages.GeneralPreference_override;
+
 
     }
 }
index ec137b03036fa18c014a86d222ae7ae8cedf2f5d..3c61cbbf72eee58a4d89c738c66e0144b896f9d4 100755 (executable)
@@ -209,7 +209,7 @@ public class GeneralPreferencePage extends CdmPreferencePage {
     @Override
     protected void getValues(){
         isAdminPreference = false;
-        overrideString = Messages.GeneralPreference_override;
+
         CdmPreferenceCache cache = CdmPreferenceCache.instance();
         isShowIOMenu = PreferencesUtil.getBooleanValue(EditorPreferencePredicate.ShowImportExportMenu.getKey());
         CdmPreference pref = cache.get(EditorPreferencePredicate.ShowImportExportMenu.getKey());
index 4d823d66355ef9aecf43d1e7c1c971c601a8a0d0..4c0b10140a3c8f9e1446a36bc2c8957d797bbec2 100644 (file)
@@ -2,8 +2,10 @@ package eu.etaxonomy.taxeditor.preference;
 
 
 import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
 import org.eclipse.swt.events.SelectionAdapter;
 import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
 import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Composite;
@@ -18,97 +20,92 @@ import eu.etaxonomy.taxeditor.preference.menu.CdmPreferencePage;
 
 public class NameDetailsViewConfiguration extends CdmPreferencePage {
 
-    boolean isSimpleDetailsViewActivated;
+    protected boolean isSimpleDetailsViewActivated;
        boolean isUseLocalSettings;
-    Composite child ;
+       protected NameDetailsConfigurator nameDetailsConfig;
     Composite localSettings ;
 
 
-    boolean isShowTaxon;
-    boolean isShowNameApprobiation ;
-    boolean isShowHybrid;
-    boolean isShowNameRelationship;
-    boolean isShowTypeDesignation;
-    boolean isShowProtologue;
-    boolean isShowNomenclaturalStatus;
-    boolean isShowNomenclaturalRef;
-    boolean isShowAuthorship;
-    boolean isShowAuthorCache;
-    boolean isShowEpithets;
-    boolean isShowRank;
-    boolean isShowAppendedPhrase;
-    boolean isShowNameCache;
-    boolean isShowNomenclaturalCode;
-    boolean isShowLSID;
-    boolean isSecEnabled;
-    boolean isSecDetailsActivated;
+    protected boolean isShowTaxon;
+    protected boolean isShowNameApprobiation ;
+    protected boolean isShowHybrid;
+    protected boolean isShowNameRelationship;
+    protected boolean isShowTypeDesignation;
+    protected boolean isShowProtologue;
+    protected boolean isShowNomenclaturalStatus;
+    protected boolean isShowNomenclaturalRef;
+    protected boolean isShowAuthorship;
+    protected boolean isShowAuthorCache;
+    protected boolean isShowEpithets;
+    protected boolean isShowRank;
+    protected boolean isShowAppendedPhrase;
+    protected boolean isShowNameCache;
+    protected boolean isShowNomenclaturalCode;
+    protected boolean isShowLSID;
+    protected boolean isSecEnabled;
+    protected boolean isSecDetailsActivated;
+
+    protected boolean isAllowOverride;
+    private boolean isOverride;
 
     @Override
     protected Control createContents(Composite parent) {
 
-       Composite composite = new Composite(parent, SWT.NULL);
-        composite.setLayout(new GridLayout());
-        CdmPreference nameDetailsPref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.NameDetailsView);
-        boolean isAllowOverride = false;
-        if (nameDetailsPref != null){
-            isAllowOverride = nameDetailsPref.isAllowOverride();
-        }
-
+        if (isAllowOverride || isAdminPreference){
 
-        if (isAllowOverride){
-
-            final Button activateLocalButton = new Button(composite, SWT.CHECK);
-            activateLocalButton.setText(Messages.NameDetailsViewConfiguration_useLocalSettings);
-            isUseLocalSettings =PreferencesUtil.getBooleanValue(IPreferenceKeys.OVERRIDE_NAME_DETAILS);
-            activateLocalButton.setSelection(isUseLocalSettings);
-            activateLocalButton.addSelectionListener(new SelectionAdapter(){
-            @Override
-            public void widgetSelected(SelectionEvent e) {
-                isUseLocalSettings = activateLocalButton.getSelection();
-                PreferencesUtil.setBooleanValue(IPreferenceKeys.OVERRIDE_NAME_DETAILS, isUseLocalSettings);
-                if(isUseLocalSettings ){
-                    child.setVisible(true);
-                    child.setEnabled(true);
-                }else{
-                    child.setVisible(false);
-                    child.setEnabled(false);
-                }
-             }
-             });
-
-            child  = new Composite(composite, SWT.NONE);
-            child.setLayout(new GridLayout());
-            child.setVisible(isUseLocalSettings);
-
-            isSimpleDetailsViewActivated = PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION);
+            final CLabel description = new CLabel(parent, SWT.NULL);
+            description.setText(Messages.NameDetailsViewConfiguration_description);
 
+            Composite title  = createComposite(parent);
+            nameDetailsConfig = PreferencesUtil.getPreferredNameDetailsConfiguration(false);
+            if (nameDetailsConfig == null){
+                nameDetailsConfig = new NameDetailsConfigurator(false);
+            }
 
+            final Button activateCheckButton = new Button(title, SWT.CHECK);
+            final Button allowLocalPreference = createAllowOverrideButton(title);
+            Composite dbSettings  = new Composite(parent, SWT.NONE);
 
-            final Button activateCheckButton = new Button(child, SWT.CHECK);
+            activateCheckButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, true, 1, 1));
             activateCheckButton.setText(Messages.NameDetailsViewConfiguration_activateSimpleDetailsView);
+            isSimpleDetailsViewActivated = nameDetailsConfig.isSimpleDetailsViewActivated();
             activateCheckButton.setSelection(isSimpleDetailsViewActivated);
             activateCheckButton.addSelectionListener(new SelectionAdapter(){
-            @Override
-            public void widgetSelected(SelectionEvent e) {
-               isSimpleDetailsViewActivated = activateCheckButton.getSelection();
-
-                if(isSimpleDetailsViewActivated && isUseLocalSettings){
-                    localSettings.setVisible(true);
-                    localSettings.setEnabled(true);
-                }else{
-                    localSettings.setVisible(false);
-                    localSettings.setEnabled(false);
-                }
-             }
+                @Override
+                public void widgetSelected(SelectionEvent e) {
+                    isSimpleDetailsViewActivated = activateCheckButton.getSelection();
+
+                    dbSettings.setEnabled(isSimpleDetailsViewActivated);
+                    PreferencesUtil.recursiveSetEnabled(dbSettings, isSimpleDetailsViewActivated);
+                 }
              });
-            localSettings  = new Composite(child, SWT.NONE);
-            localSettings.setLayout(new GridLayout());
-            localSettings.setVisible(isSimpleDetailsViewActivated);
 
+            if (isAdminPreference){
+                allowLocalPreference.setSelection(isAllowOverride);
+            }else{
+                allowLocalPreference.setSelection(isOverride);
+            }
+            allowLocalPreference.addSelectionListener(new SelectionAdapter(){
+                @Override
+                public void widgetSelected(SelectionEvent e) {
+                    if (isAdminPreference){
+                        isAllowOverride = allowLocalPreference.getSelection();
+                    }else{
+                        isOverride = allowLocalPreference.getSelection();
+                    }
 
-            final Button showTaxon = new Button(localSettings, SWT.CHECK);
-            isShowTaxon = PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON);
+                }
+            });
+
+            dbSettings.setLayout(new GridLayout());
+            dbSettings.setEnabled(isSimpleDetailsViewActivated);
+
+
+            Label separator= new Label(dbSettings, SWT.HORIZONTAL | SWT.SEPARATOR);
+            separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+            final Button showTaxon = new Button(dbSettings, SWT.CHECK);
             showTaxon.setText(Messages.NameDetailsViewComposite_Show_Taxon);
+            isShowTaxon = nameDetailsConfig.isTaxonSectionActivated();
             showTaxon.setSelection(isShowTaxon);
             showTaxon.addSelectionListener(new SelectionAdapter(){
                  @Override
@@ -118,10 +115,9 @@ public class NameDetailsViewConfiguration extends CdmPreferencePage {
                   }
              });
 
-            final Button showSecDetail = new Button(localSettings, SWT.CHECK);
-            isSecDetailsActivated = PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_SEC_DETAILS);
+            final Button showSecDetail = new Button(dbSettings, SWT.CHECK);
             showSecDetail.setText(Messages.NameDetailsViewComposite_Show_SecDetail);
-
+            isSecDetailsActivated = nameDetailsConfig.isSecDetailsActivated();
             showSecDetail.setSelection(isSecDetailsActivated);
             showSecDetail.addSelectionListener(new SelectionAdapter(){
                  @Override
@@ -131,9 +127,9 @@ public class NameDetailsViewConfiguration extends CdmPreferencePage {
                   }
              });
 
-            final Button secEnabled = new Button(localSettings, SWT.CHECK);
+            final Button secEnabled = new Button(dbSettings, SWT.CHECK);
             secEnabled.setText(Messages.NameDetailsViewComposite_SecEnabled);
-            isSecEnabled = PreferencesUtil.getBooleanValue(IPreferenceKeys.DISABLE_SEC);
+            isSecEnabled = nameDetailsConfig.isSecEnabled();
             secEnabled.setSelection(isSecEnabled);
             secEnabled.addSelectionListener(new SelectionAdapter(){
                  @Override
@@ -143,9 +139,10 @@ public class NameDetailsViewConfiguration extends CdmPreferencePage {
                   }
              });
 
-            final Button showLsid = new Button(localSettings, SWT.CHECK);
-            isShowLSID = PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID);
+
+            final Button showLsid = new Button(dbSettings, SWT.CHECK);
             showLsid.setText(Messages.NameDetailsViewComposite_Show_LSID);
+            isShowLSID = nameDetailsConfig.isLSIDActivated();
             showLsid.setSelection(isShowLSID);
             showLsid.addSelectionListener(new SelectionAdapter(){
                  @Override
@@ -155,9 +152,9 @@ public class NameDetailsViewConfiguration extends CdmPreferencePage {
                   }
              });
 
-            final Button showNomenclaturalCode = new Button(localSettings, SWT.CHECK);
-            isShowNomenclaturalCode = PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE);
+            final Button showNomenclaturalCode = new Button(dbSettings, SWT.CHECK);
             showNomenclaturalCode.setText(Messages.NameDetailsViewComposite_Show_NomenclaturalCode);
+            isShowNomenclaturalCode = nameDetailsConfig.isNomenclaturalCodeActived();
             showNomenclaturalCode.setSelection(isShowNomenclaturalCode);
             showNomenclaturalCode.addSelectionListener(new SelectionAdapter(){
                  @Override
@@ -167,31 +164,31 @@ public class NameDetailsViewConfiguration extends CdmPreferencePage {
                   }
              });
 
-            final Button showNameCache = new Button(localSettings, SWT.CHECK);
-            isShowNameCache = PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAMECACHE);
+            final Button showNameCache = new Button(dbSettings, SWT.CHECK);
             showNameCache.setText(Messages.NameDetailsViewComposite_Show_NameCache);
-            showNameCache.setSelection(isShowNomenclaturalCode);
+            isShowNameCache = nameDetailsConfig.isNameCacheActivated();
+            showNameCache.setSelection(isShowNameCache);
             showNameCache.addSelectionListener(new SelectionAdapter(){
                  @Override
                  public void widgetSelected(SelectionEvent e) {
-                     isShowNameCache = showNameCache.getSelection();
+                    isShowNameCache = showNameCache.getSelection();
 
                   }
              });
-            final Button showAppendedPhrase = new Button(localSettings, SWT.CHECK);
-            isShowAppendedPhrase = PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE);
+            final Button showAppendedPhrase = new Button(dbSettings, SWT.CHECK);
+            isShowAppendedPhrase= nameDetailsConfig.isAppendedPhraseActivated();
             showAppendedPhrase.setText(Messages.NameDetailsViewComposite_Show_AppendedPhrase);
             showAppendedPhrase.setSelection(isShowAppendedPhrase);
             showAppendedPhrase.addSelectionListener(new SelectionAdapter(){
                  @Override
                  public void widgetSelected(SelectionEvent e) {
-                     isShowAppendedPhrase = showAppendedPhrase.getSelection();
+                    isShowAppendedPhrase = showAppendedPhrase.getSelection();
 
                   }
              });
 
-            final Button showRank = new Button(localSettings, SWT.CHECK);
-            isShowRank = PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK);
+            final Button showRank = new Button(dbSettings, SWT.CHECK);
+            isShowRank = nameDetailsConfig.isRankActivated();
             showRank.setText(Messages.NameDetailsViewComposite_Show_Rank);
             showRank.setSelection(isShowRank);
             showRank.addSelectionListener(new SelectionAdapter(){
@@ -201,8 +198,8 @@ public class NameDetailsViewConfiguration extends CdmPreferencePage {
 
                   }
              });
-            final Button showEpithets = new Button(localSettings, SWT.CHECK);
-            isShowEpithets = PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS);
+            final Button showEpithets = new Button(dbSettings, SWT.CHECK);
+            isShowEpithets = nameDetailsConfig.isAtomisedEpithetsActivated();
             showEpithets.setText(Messages.NameDetailsViewComposite_Show_AtomisedEpithets);
             showEpithets.setSelection(isShowEpithets);
             showEpithets.addSelectionListener(new SelectionAdapter(){
@@ -213,8 +210,8 @@ public class NameDetailsViewConfiguration extends CdmPreferencePage {
                   }
              });
 
-            final Button showAuthorCache = new Button(localSettings, SWT.CHECK);
-            isShowAuthorCache = PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP_CACHE);
+            final Button showAuthorCache = new Button(dbSettings, SWT.CHECK);
+            isShowAuthorCache = nameDetailsConfig.isAuthorCacheActivated();
             showAuthorCache.setText(Messages.NameDetailsViewComposite_Show_AuthorCache);
             showAuthorCache.setSelection(isShowAuthorCache);
             showAuthorCache.addSelectionListener(new SelectionAdapter(){
@@ -225,8 +222,8 @@ public class NameDetailsViewConfiguration extends CdmPreferencePage {
                   }
              });
 
-            final Button showAuthorship = new Button(localSettings, SWT.CHECK);
-            isShowAuthorship = PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP);
+            final Button showAuthorship = new Button(dbSettings, SWT.CHECK);
+            isShowAuthorship = nameDetailsConfig.isAuthorshipSectionActivated();
             showAuthorship.setText(Messages.NameDetailsViewComposite_Show_Author);
             showAuthorship.setSelection(isShowAuthorship);
             showAuthorship.addSelectionListener(new SelectionAdapter(){
@@ -237,8 +234,8 @@ public class NameDetailsViewConfiguration extends CdmPreferencePage {
                   }
              });
 
-            final Button showNomenclaturalRef = new Button(localSettings, SWT.CHECK);
-            isShowNomenclaturalRef = PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE);
+            final Button showNomenclaturalRef = new Button(dbSettings, SWT.CHECK);
+            isShowNomenclaturalRef = nameDetailsConfig.isNomenclaturalReferenceSectionActivated();
             showNomenclaturalRef.setText(Messages.NameDetailsViewComposite_Show_NomenclaturalReference);
             showNomenclaturalRef.setSelection(isShowNomenclaturalRef);
             showNomenclaturalRef.addSelectionListener(new SelectionAdapter(){
@@ -249,8 +246,8 @@ public class NameDetailsViewConfiguration extends CdmPreferencePage {
                   }
              });
 
-            final Button showNomenclaturalStatus = new Button(localSettings, SWT.CHECK);
-            isShowNomenclaturalStatus = PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS);
+            final Button showNomenclaturalStatus = new Button(dbSettings, SWT.CHECK);
+            isShowNomenclaturalStatus = nameDetailsConfig.isNomenclaturalStatusSectionActivated();
             showNomenclaturalStatus.setText(Messages.NameDetailsViewComposite_Show_NomenclaturalStatus);
             showNomenclaturalStatus.setSelection(isShowNomenclaturalStatus);
             showNomenclaturalStatus.addSelectionListener(new SelectionAdapter(){
@@ -261,8 +258,8 @@ public class NameDetailsViewConfiguration extends CdmPreferencePage {
                   }
              });
 
-            final Button showProtologue = new Button(localSettings, SWT.CHECK);
-            isShowProtologue = PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE);
+            final Button showProtologue = new Button(dbSettings, SWT.CHECK);
+            isShowProtologue = nameDetailsConfig.isProtologueActivated();
             showProtologue.setText(Messages.NameDetailsViewComposite_Show_Protologue);
             showProtologue.setSelection(isShowProtologue);
             showProtologue.addSelectionListener(new SelectionAdapter(){
@@ -273,8 +270,8 @@ public class NameDetailsViewConfiguration extends CdmPreferencePage {
                   }
              });
 
-            final Button showTypeDesignation = new Button(localSettings, SWT.CHECK);
-            isShowTypeDesignation = PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION);
+            final Button showTypeDesignation = new Button(dbSettings, SWT.CHECK);
+            isShowTypeDesignation = nameDetailsConfig.isTypeDesignationSectionActivated();
             showTypeDesignation.setText(Messages.NameDetailsViewComposite_Show_TypeDesignation);
             showTypeDesignation.setSelection(isShowTypeDesignation);
             showTypeDesignation.addSelectionListener(new SelectionAdapter(){
@@ -286,8 +283,8 @@ public class NameDetailsViewConfiguration extends CdmPreferencePage {
              });
 
 
-            final Button showNameRelationship = new Button(localSettings, SWT.CHECK);
-            isShowNameRelationship = PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP);
+            final Button showNameRelationship = new Button(dbSettings, SWT.CHECK);
+            isShowNameRelationship = nameDetailsConfig.isNameRelationsSectionActivated();
             showNameRelationship.setText(Messages.NameDetailsViewComposite_Show_Namerelationships);
             showNameRelationship.setSelection(isShowNameRelationship);
             showNameRelationship.addSelectionListener(new SelectionAdapter(){
@@ -298,8 +295,8 @@ public class NameDetailsViewConfiguration extends CdmPreferencePage {
                   }
              });
 
-            final Button showHybrid = new Button(localSettings, SWT.CHECK);
-            isShowHybrid = PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_HYBRID);
+            final Button showHybrid = new Button(dbSettings, SWT.CHECK);
+            isShowHybrid = nameDetailsConfig.isHybridActivated();
             showHybrid.setText(Messages.NameDetailsViewComposite_Show_Hybrid);
             showHybrid.setSelection(isShowHybrid);
             showHybrid.addSelectionListener(new SelectionAdapter(){
@@ -309,29 +306,27 @@ public class NameDetailsViewConfiguration extends CdmPreferencePage {
 
                   }
              });
-            final Button showNameApprobiation = new Button(localSettings, SWT.CHECK);
-            isShowNameApprobiation = PreferencesUtil.getBooleanValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_APPROBATION);
+            final Button showNameApprobiation = new Button(dbSettings, SWT.CHECK);
+            isShowNameApprobiation = nameDetailsConfig.isNameApprobiationActivated();
             showNameApprobiation.setText(Messages.NameDetailsViewComposite_Show_NameApprobiation);
             showNameApprobiation.setSelection(isShowNameApprobiation);
             showNameApprobiation.addSelectionListener(new SelectionAdapter(){
                  @Override
                  public void widgetSelected(SelectionEvent e) {
-                     isShowNameApprobiation= showNameApprobiation.getSelection();
-
+                     isShowNameApprobiation = showNameApprobiation.getSelection();
+                    //PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_APPROBATION, isShowNameApprobiation);
                   }
              });
-
-
-            if(isSimpleDetailsViewActivated){
-                localSettings.setEnabled(true);
-            }else{
-                localSettings.setEnabled(false);
-            }
+            PreferencesUtil.recursiveSetEnabled(dbSettings, isSimpleDetailsViewActivated);
         }else{
-            Label label = new Label(composite, SWT.NONE);
-            label.setText("The CDM settings don't allow to set the preferences for the display of name details locally. If you need to make local settings, please ask an administrator.");
+            final CLabel description = new CLabel(parent, SWT.NULL);
+            description.setText(Messages.NameDetailsViewConfiguration_description_not_available);
         }
-        return composite;
+
+
+
+
+        return parent;
        }
 
     @Override
@@ -355,8 +350,21 @@ public class NameDetailsViewConfiguration extends CdmPreferencePage {
         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);
+
+        PreferencesUtil.setBooleanValue(IPreferenceKeys.OVERRIDE_NAME_DETAILS, isOverride);
         return true;
 
     }
 
+    @Override
+    public void init(){
+        CdmPreference nameDetailsPref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.NameDetailsView);
+        isAdminPreference = false;
+        isAllowOverride = false;
+        if (nameDetailsPref != null){
+            isAllowOverride = nameDetailsPref.isAllowOverride();
+        }
+        isOverride = PreferencesUtil.getBooleanValue(IPreferenceKeys.OVERRIDE_NAME_DETAILS);
+    }
+
 }
index 323aa8153c991be48235380b77cd57f5e00558d4..6e5da1f2c2faa3ece439838e81accb4535f57bab 100644 (file)
@@ -298,7 +298,7 @@ public class SpecimenOrObservationPreferences extends CdmPreferencePage {
 
         isShowLifeForm = PreferencesUtil.getBooleanValue(EditorPreferencePredicate.ShowLifeForm.getKey());
         allowOverrideShowLifeForm = cache.get(EditorPreferencePredicate.ShowLifeForm.getKey())!= null ? cache.get(EditorPreferencePredicate.ShowLifeForm.getKey()).isAllowOverride():true;
-        overrideString = Messages.GeneralPreference_override;
+
 
     }
 
index 852138447c72d2bc693308150ea181cdd929966f..310e8c2fbc60dd998bf2e5338e0bf20c1c744f20 100644 (file)
@@ -29,8 +29,8 @@ public abstract class CdmPreferencePage extends PreferencePage implements IE4Pre
 
     private boolean isApply;
 
-    protected boolean isAdminPreference = false;
-    protected String overrideString = Messages.GeneralPreference_allowOverride;
+    protected boolean isAdminPreference;
+
 
     public CdmPreferencePage() {
         this(null, null);
@@ -95,6 +95,12 @@ public abstract class CdmPreferencePage extends PreferencePage implements IE4Pre
 
     protected Button createAllowOverrideButton(Composite activateComp) {
         final Button allowOverrideCheckButton = new Button(activateComp, SWT.CHECK);
+        String overrideString;
+        if (isAdminPreference){
+            overrideString = Messages.GeneralPreference_allowOverride;
+        }else{
+            overrideString = Messages.GeneralPreference_override;
+        }
         allowOverrideCheckButton.setText(overrideString);
         GridData grid = new GridData();
         grid.horizontalAlignment = SWT.END;