ref #7854: minor changes
authorKatja Luther <k.luther@bgbm.org>
Thu, 20 Dec 2018 14:21:51 +0000 (15:21 +0100)
committerKatja Luther <k.luther@bgbm.org>
Thu, 20 Dec 2018 14:21:51 +0000 (15:21 +0100)
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/DistributionEditor.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/FilterStatusDisplayConverter.java [new file with mode: 0755]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/StatusDisplayConverter.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/e4/OpenDistributionEditorWizardHandlerE4.java

index 22f589c1496c86f6fd075f915766a42a2ab8cde5..b762f93e9ab862f215357b13fe50693d15cdf3d8 100755 (executable)
@@ -266,6 +266,8 @@ public class DistributionEditor extends Composite {
         //add default configuration because autoconfigure is set to false in constructor
         natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
 
+
+
         // override the default sort configuration and change the mouse bindings
         // to sort on a single click
 
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/FilterStatusDisplayConverter.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/FilterStatusDisplayConverter.java
new file mode 100755 (executable)
index 0000000..1ff61a1
--- /dev/null
@@ -0,0 +1,57 @@
+/**
+* Copyright (C) 2018 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+package eu.etaxonomy.taxeditor.editor.view.checklist.e4;
+
+import org.eclipse.nebula.widgets.nattable.data.convert.DisplayConverter;
+
+import eu.etaxonomy.cdm.model.common.Representation;
+import eu.etaxonomy.cdm.model.description.Distribution;
+import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+/**
+ * @author k.luther
+ * @since 05.12.2018
+ *
+ */
+public class FilterStatusDisplayConverter extends DisplayConverter{
+    public static final String DEFAULT_ENTRY = "";
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Object canonicalToDisplayValue(Object canonicalValue) {
+        if(canonicalValue instanceof Distribution){
+            Distribution distribution = (Distribution)canonicalValue;
+            if (distribution.getStatus() != null){
+
+                Representation rep = distribution.getStatus().getPreferredRepresentation(CdmStore.getDefaultLanguage());
+                String label = rep.getLabel();
+                return (label != null)?label:DEFAULT_ENTRY;
+
+            }
+
+            return "";
+        }else if(canonicalValue instanceof PresenceAbsenceTerm){
+            return ((PresenceAbsenceTerm)canonicalValue).getLabel();
+        } else if(canonicalValue!=null){
+            return canonicalValue.toString();
+        }
+        return null;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Object displayToCanonicalValue(Object displayValue) {
+        return null;
+    }
+
+}
index 1fe6140d925c9071fdf2cd237b5dde3abdcad02b..170ba80a33c0ee570140284887a601c598556d8c 100755 (executable)
@@ -33,7 +33,7 @@ public class StatusDisplayConverter extends DisplayConverter{
         if(canonicalValue instanceof Distribution){
             Distribution distribution = (Distribution)canonicalValue;
             if (distribution.getStatus() != null){
-                PresenceAbsenceTerm term = distribution.getStatus();
+
                 Representation rep = distribution.getStatus().getPreferredRepresentation(CdmStore.getDefaultLanguage());
                 String label = rep.getLabel();
 
index df2e109da77e60528d7770098f5ddef5287bfb92..b76a34680d05876661554696e798a9dd87981869 100755 (executable)
@@ -18,6 +18,7 @@ import org.eclipse.swt.widgets.Shell;
 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.PreferencesUtil;
 import eu.etaxonomy.taxeditor.preference.wizard.AvailableVocabularyWizard;
 
 /**
@@ -33,6 +34,7 @@ public class OpenDistributionEditorWizardHandlerE4 {
         @Execute
         public void execute(@Named(IServiceConstants.ACTIVE_SHELL)Shell shell) {
             CdmPreference pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AvailableDistributionAreaVocabularies, null);
+            pref.setAllowOverride(PreferencesUtil.getBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.AvailableDistributionAreaVocabularies.getKey())));
             AvailableVocabularyWizard wizard = new AvailableVocabularyWizard(true, pref, Messages.OpenDistributionEditorWizardHandlerE4_DISTRIBUTION);
 
             WizardDialog dialog = new WizardDialog(shell,