ref #7854: correct handling when first entry is none-term and add rank display in...
authorKatja Luther <k.luther@bgbm.org>
Mon, 4 Feb 2019 12:16:37 +0000 (13:16 +0100)
committerKatja Luther <k.luther@bgbm.org>
Mon, 4 Feb 2019 12:16:37 +0000 (13:16 +0100)
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/DistributionColumnAccessor.java
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/FilterRowConfiguration.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/StatusComboBoxDataProvider.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/StatusDataCellEditor.java

index cb29cf49a9000cc6003de6cee2ec1dc351d3792d..373cf790bab1a254ec3841227924ef4bc9e1df20 100755 (executable)
@@ -137,6 +137,9 @@ public class DistributionColumnAccessor implements IColumnPropertyAccessor<Taxon
                         }
                     }
                 }else{
+                    if (((PresenceAbsenceTerm)newValue).getId() == 0){
+                        return;
+                    }
                     if (distributions == null){
                         distributions = new HashSet();
                         distributionMap.put(area, distributions);
index 8a73d43197b466acbeaa92af93827ccca29a65b9..e2990e2d237b97551d334b249d78ff088268874e 100755 (executable)
@@ -162,6 +162,7 @@ public class DistributionEditor extends Composite {
      */
     public DistributionEditor(Composite parent, DistributionEditorPart part) {
         super(parent, SWT.NULL);
+        isShowRank = PreferencesUtil.getBooleanValue(EditorPreferencePredicate.ShowRankInDistributionEditor.getKey());
         this.part = part;
         this.setLayout(new GridLayout());
         GridLayoutFactory.fillDefaults().applyTo(parent);
@@ -174,9 +175,6 @@ public class DistributionEditor extends Composite {
         natTable = new NatTable(parent, false);
         parent.pack();
 
-
-//       // natTable = new NatTable(parent, viewportLayer);
-//        natTable = new NatTable(parent, false);
         Composite bottomComposite = new Composite(parent, SWT.NONE);
         GridLayoutFactory.fillDefaults().applyTo(bottomComposite);
         createStatusBar(bottomComposite);
index 4a851981b6b3587382709455703862c01c0453ab..9caba5529bd8bd5c4e6f579c4cba63519ad48e2f 100755 (executable)
@@ -20,6 +20,7 @@ import org.eclipse.nebula.widgets.nattable.filterrow.config.FilterRowConfigAttri
 import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
 
 import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.supplementalInfo.SupplementalInfoDisplayConverter;
+import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 
 /**
  * @author k.luther
@@ -60,12 +61,36 @@ public class FilterRowConfiguration extends AbstractRegistryConfiguration {
                     DisplayMode.NORMAL,
                     FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 1);
 
+            if (PreferencesUtil.isShowRankInChecklistEditor()){
+                configRegistry.registerConfigAttribute(
+                        EditConfigAttributes.CELL_EDITOR,
+                        new FilterRowTextCellEditor(),
+                        DisplayMode.NORMAL,
+                        FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 2);
+
+                configRegistry.registerConfigAttribute(
+                        FilterRowConfigAttributes.TEXT_MATCHING_MODE,
+                        TextMatchingMode.CONTAINS,
+                        DisplayMode.NORMAL,
+                        FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 2);
+
+                configRegistry.registerConfigAttribute(
+                        CellConfigAttributes.DISPLAY_CONVERTER,
+                        new SupplementalInfoDisplayConverter(),
+                        DisplayMode.NORMAL,
+                        FilterRowDataLayer.FILTER_ROW_COLUMN_LABEL_PREFIX + 2);
+            }
 
             // Register a combo box editor to be displayed in the filter row
             // cell when a value is selected from the combo, the object is
             // converted to a string using the converter (registered below)
             StatusComboBoxDataProvider dataProvider;
-            for (int i = 1; i <= editor.areas.size(); ++i) {
+            int start = 1;
+            if (PreferencesUtil.isShowRankInChecklistEditor()){
+                start = 2;
+            }
+
+            for (int i = start; i < editor.areas.size()+start; ++i) {
                 dataProvider = new StatusComboBoxDataProvider(editor);
                 ComboBoxCellEditor cellEditor = new ComboBoxCellEditor(dataProvider, dataProvider.getMaxVisibleItems());
                 cellEditor.setFreeEdit(true);
index 57685bb7ac48e7681b92ea350381f562af73dd3c..a8ba183c969e7be103effc1b01a4ebefca82d464 100755 (executable)
@@ -49,7 +49,7 @@ public class StatusComboBoxDataProvider implements IComboBoxDataProvider {
         List<DefinedTermBase> inputAll = new ArrayList<>();
         PresenceAbsenceTerm noneTerm = PresenceAbsenceTerm.NewInstance();
         noneTerm.setTitleCache(" - ", true);
-        noneTerm.addRepresentation(Representation.NewInstance(" - ", "", "", CdmStore.getDefaultLanguage()));
+        noneTerm.addRepresentation(Representation.NewInstance(" - ", " ", " ", CdmStore.getDefaultLanguage()));
         inputAll.add(noneTerm);
         String statusString = PreferencesUtil.getStringValue(PreferencePredicate.AvailableDistributionStatus.getKey());
         String [] statusArray = statusString.split(";");
index 687a06da866eb32702c6bacbf3947abc0cd7ef07..b8b3c11fd814f8f065ba2357c4648662a473adae 100755 (executable)
@@ -63,7 +63,7 @@ public class StatusDataCellEditor extends ComboBoxCellEditor {
                     //editor.descriptionsToSave.add( (TaxonDistributionDTO) rowWrapper);
                     //TODO set value corresponding to preference
                     if (distr.getStatus() != null){
-                        if (distr.getStatus().getLabel() == ""){
+                        if (distr.getStatus().getLabel() == " - "){
                             distr.setStatus(null);
                             super.setCanonicalValue("");