smaller changes for simple name details configuration
authorKatja Luther <k.luther@bgbm.org>
Fri, 6 Oct 2017 12:33:55 +0000 (14:33 +0200)
committerKatja Luther <k.luther@bgbm.org>
Fri, 6 Oct 2017 12:33:55 +0000 (14:33 +0200)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/DatabasePreferencesPage.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/databaseAdmin/wizard/NameDetailsViewComposite.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/NameDetailsViewConfiguration.java

index bbd2d5620b5822b1ac8c4fc49f3b33c77d1f87a3..2ccf7def95ac3287890523ee150a820b1874c963 100755 (executable)
@@ -187,17 +187,7 @@ public class DatabasePreferencesPage extends AbstractPreferenceWizard implements
         composite.setLayout(gridLayout);
         nameDetailsConfig = new NameDetailsViewComposite(composite, SWT.SCROLL_LINE, config);
 
-        final Button useLocalPreference = new Button(composite, SWT.CHECK);
-        boolean isUseLocalPreference = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NAME_DETAILS);
-        useLocalPreference.setText(Messages.DatabasePreferencesPage_UseLocalPreferences);
-        useLocalPreference.setSelection(isUseLocalPreference);
-        useLocalPreference.addSelectionListener(new SelectionAdapter(){
-             @Override
-             public void widgetSelected(SelectionEvent e) {
-                 boolean isUseLocalPreference = useLocalPreference.getSelection();
-                 PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ALLOW_OVERRIDE_NAME_DETAILS, isUseLocalPreference);
-              }
-         });
+
     }
 
 
index ce6239f80af135f0dbd3863a218f6653a7b1fd53..6e6ebbbc9d8a4518a623c4c3a8b05634d64c576a 100755 (executable)
@@ -17,6 +17,8 @@ import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Composite;
 
+import eu.etaxonomy.taxeditor.l10n.Messages;
+import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
 import eu.etaxonomy.taxeditor.preference.NameDetailsConfigurator;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 
@@ -64,6 +66,20 @@ public class NameDetailsViewComposite extends Composite {
        this.setData(data);
 //       CdmPreference pref = PreferencesUtil.getPreferenceFromDB(PreferencePredicate.NameDetailsView);
 //       NameDetailsConfigurator config = PreferencesUtil.setPreferredNameDetailsConfiguration(local)
+
+       final Button allowLocalPreference = new Button(this, SWT.CHECK);
+       boolean isUseLocalPreference = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.ALLOW_OVERRIDE_NAME_DETAILS);
+       allowLocalPreference.setText(Messages.DatabasePreferencesPage_UseLocalPreferences);
+       allowLocalPreference.setSelection(isUseLocalPreference);
+       allowLocalPreference.addSelectionListener(new SelectionAdapter(){
+            @Override
+            public void widgetSelected(SelectionEvent e) {
+                boolean isUseLocalPreference = allowLocalPreference.getSelection();
+                PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.ALLOW_OVERRIDE_NAME_DETAILS, isUseLocalPreference);
+             }
+        });
+
+
        isSimpleDetailsViewActivated= config.isSimpleDetailsViewActivated();
        final Button activateCheckButton = new Button(this, SWT.CHECK);
        activateCheckButton.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, true, 1, 1));
index db04bc132702e61c8bac5a580c01ab1254e71633..243221c22377b50b460b89fe77ef937fd9710655 100644 (file)
@@ -20,6 +20,7 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor
        boolean isSimpleDetailsViewActivated;
        boolean isUseLocalSettings;
     Composite child ;
+    Composite localSettings ;
        @Override
        public void init(IWorkbench workbench) {
 
@@ -61,8 +62,15 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor
              }
              });
 
+            child  = new Composite(composite, SWT.NONE);
+            child.setLayout(new GridLayout());
+            child.setVisible(isUseLocalSettings);
+
             isSimpleDetailsViewActivated = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION);
-            final Button activateCheckButton = new Button(composite, SWT.CHECK);
+
+
+
+            final Button activateCheckButton = new Button(child, SWT.CHECK);
             activateCheckButton.setText("Show only a simple name details view");
             activateCheckButton.setSelection(isSimpleDetailsViewActivated);
             activateCheckButton.addSelectionListener(new SelectionAdapter(){
@@ -70,21 +78,21 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor
             public void widgetSelected(SelectionEvent e) {
                isSimpleDetailsViewActivated = activateCheckButton.getSelection();
                 PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_SECTION, isSimpleDetailsViewActivated);
-                if(isSimpleDetailsViewActivated){
-                       child.setVisible(true);
-                    child.setEnabled(true);
+                if(isSimpleDetailsViewActivated && isUseLocalSettings){
+                    localSettings.setVisible(true);
+                    localSettings.setEnabled(true);
                 }else{
-                       child.setVisible(false);
-                    child.setEnabled(false);
+                    localSettings.setVisible(false);
+                    localSettings.setEnabled(false);
                 }
              }
              });
+            localSettings  = new Composite(child, SWT.NONE);
+            localSettings.setLayout(new GridLayout());
+            localSettings.setVisible(isSimpleDetailsViewActivated);
 
-            child  = new Composite(composite, SWT.H_SCROLL);
-            child.setLayout(new GridLayout());
-            child.setVisible(isSimpleDetailsViewActivated);
 
-            final Button showTaxon = new Button(child, SWT.CHECK);
+            final Button showTaxon = new Button(localSettings, SWT.CHECK);
             boolean isShowTaxon = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_SIMPLE_NAME_DETAILS_TAXON);
             showTaxon.setText("Show taxon of the name");
             showTaxon.setSelection(isShowTaxon);
@@ -96,7 +104,7 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor
                   }
              });
 
-            final Button showLsid = new Button(child, SWT.CHECK);
+            final Button showLsid = new Button(localSettings, SWT.CHECK);
             boolean isShowLSID = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_LSID);
             showLsid.setText("Show Lsid of the name");
             showLsid.setSelection(isShowLSID);
@@ -108,7 +116,7 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor
                   }
              });
 
-            final Button showNomenclaturalCode = new Button(child, SWT.CHECK);
+            final Button showNomenclaturalCode = new Button(localSettings, SWT.CHECK);
             boolean isShowNomenclaturalCode = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_CODE);
             showNomenclaturalCode.setText("Show the nomenclatural code");
             showNomenclaturalCode.setSelection(isShowNomenclaturalCode);
@@ -120,7 +128,7 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor
                   }
              });
 
-            final Button showNameCache = new Button(child, SWT.CHECK);
+            final Button showNameCache = new Button(localSettings, SWT.CHECK);
             boolean isShowNameCache = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAMECACHE);
             showNameCache.setText("Show nameCache of the name (only the scientific name without the author and year)");
             showNameCache.setSelection(isShowNomenclaturalCode);
@@ -131,7 +139,7 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor
                      PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAMECACHE, isShowNameCache);
                   }
              });
-            final Button showAppendedPhrase = new Button(child, SWT.CHECK);
+            final Button showAppendedPhrase = new Button(localSettings, SWT.CHECK);
             boolean isShowAppendedPhrase = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_APPENDED_PHRASE);
             showAppendedPhrase.setText("Show appended phrase");
             showAppendedPhrase.setSelection(isShowAppendedPhrase);
@@ -143,7 +151,7 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor
                   }
              });
 
-            final Button showRank = new Button(child, SWT.CHECK);
+            final Button showRank = new Button(localSettings, SWT.CHECK);
             boolean isShowRank = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK);
             showRank.setText("Show rank of the name");
             showRank.setSelection(isShowRank);
@@ -154,7 +162,7 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor
                      PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_RANK, isShowRank);
                   }
              });
-            final Button showEpithets = new Button(child, SWT.CHECK);
+            final Button showEpithets = new Button(localSettings, SWT.CHECK);
             boolean isShowEpithets = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS);
             showEpithets.setText("Show atomised epithets");
             showEpithets.setSelection(isShowEpithets);
@@ -165,7 +173,7 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor
                      PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_ATOMISED_EPITHETS, isShowEpithets);
                   }
              });
-            final Button showAuthorship = new Button(child, SWT.CHECK);
+            final Button showAuthorship = new Button(localSettings, SWT.CHECK);
             boolean isShowAuthorship = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_AUTHORSHIP);
             showAuthorship.setText("Show authorship section");
             showAuthorship.setSelection(isShowAuthorship);
@@ -177,7 +185,7 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor
                   }
              });
 
-            final Button showNomenclaturalRef = new Button(child, SWT.CHECK);
+            final Button showNomenclaturalRef = new Button(localSettings, SWT.CHECK);
             boolean isShowNomenclaturalRef = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_REFERENCE);
             showNomenclaturalRef.setText("Show nomenclatural reference section");
             showNomenclaturalRef.setSelection(isShowNomenclaturalRef);
@@ -189,7 +197,7 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor
                   }
              });
 
-            final Button showNomenclaturalStatus = new Button(child, SWT.CHECK);
+            final Button showNomenclaturalStatus = new Button(localSettings, SWT.CHECK);
             boolean isShowNomenclaturalStatus = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NOMENCLATURAL_STATUS);
             showNomenclaturalStatus.setText("Show nomenclatural status section");
             showNomenclaturalStatus.setSelection(isShowNomenclaturalStatus);
@@ -201,7 +209,7 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor
                   }
              });
 
-            final Button showProtologue = new Button(child, SWT.CHECK);
+            final Button showProtologue = new Button(localSettings, SWT.CHECK);
             boolean isShowProtologue = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_PROTOLOGUE);
             showProtologue.setText("Show protologue section");
             showProtologue.setSelection(isShowProtologue);
@@ -213,7 +221,7 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor
                   }
              });
 
-            final Button showTypeDesignation = new Button(child, SWT.CHECK);
+            final Button showTypeDesignation = new Button(localSettings, SWT.CHECK);
             boolean isShowTypeDesignation = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_TYPE_DESIGNATION);
             showTypeDesignation.setText("Show name type designation section");
             showTypeDesignation.setSelection(isShowTypeDesignation);
@@ -226,7 +234,7 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor
              });
 
 
-            final Button showNameRelationship = new Button(child, SWT.CHECK);
+            final Button showNameRelationship = new Button(localSettings, SWT.CHECK);
             boolean isShowNameRelationship = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_RELATIONSHIP);
             showNameRelationship.setText("Show name relationship section");
             showNameRelationship.setSelection(isShowNameRelationship);
@@ -238,7 +246,7 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor
                   }
              });
 
-            final Button showHybrid = new Button(child, SWT.CHECK);
+            final Button showHybrid = new Button(localSettings, SWT.CHECK);
             boolean isShowHybrid = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_HYBRID);
             showHybrid.setText("Show hybrid section");
             showHybrid.setSelection(isShowHybrid);
@@ -249,7 +257,7 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor
                      PreferencesUtil.getPreferenceStore().setValue(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_HYBRID, isShowHybrid);
                   }
              });
-            final Button showNameApprobiation = new Button(child, SWT.CHECK);
+            final Button showNameApprobiation = new Button(localSettings, SWT.CHECK);
             boolean isShowNameApprobiation = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_NAME_DETAILS_SECTION_NAME_APPROBATION);
             showNameApprobiation.setText("Show name approbiation (for bacterial names)");
             showNameApprobiation.setSelection(isShowNameApprobiation);
@@ -263,9 +271,9 @@ public class NameDetailsViewConfiguration extends PreferencePage implements IWor
 
 
             if(isSimpleDetailsViewActivated){
-                child.setEnabled(true);
+                localSettings.setEnabled(true);
             }else{
-                child.setEnabled(false);
+                localSettings.setEnabled(false);
             }
         }else{
             Label label = new Label(composite, SWT.NONE);