presenceAbsence terms in distribution editor are sorted, labels instead of abbrevLabe...
authorKatja Luther <k.luther@bgbm.org>
Fri, 19 Oct 2018 09:59:23 +0000 (11:59 +0200)
committerKatja Luther <k.luther@bgbm.org>
Fri, 19 Oct 2018 09:59:23 +0000 (11:59 +0200)
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/ChecklistLabelProvider.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/ChecklistEditorE4.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/DistributionEditingSupportE4.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/PreferencesUtil.java

index 42fee9652994ad6c756789246b3f57edfadc7554..e9d1caaa6159bb2308d28da4621af4a53b74568b 100644 (file)
@@ -122,10 +122,8 @@ public class ChecklistLabelProvider extends LabelProvider implements ITableLabel
                                 }
                                 PresenceAbsenceTerm term = distribution.getStatus();
                                 Representation rep = distribution.getStatus().getPreferredRepresentation(CdmStore.getDefaultLanguage());
-                                String label = rep.getAbbreviatedLabel();
-                                if (label == null){
-                                    label = rep.getLabel();
-                                }
+                                String label = rep.getLabel();
+
                                 if (label == null){
                                     distribution.getStatus().getTitleCache();
                                 }
index f89ce33d04500eb494faa4fbfa12afe836260048..c35f07e031d511f90b3dea074de28d16298928db 100644 (file)
@@ -142,6 +142,7 @@ public class ChecklistEditorE4 implements  IConversationEnabled,
     private ChecklistEditorFilter filter;
 
     private Label statusLabel;
+    private Label statusLabelSourceReference;
 
     private ChecklistLabelProvider labelProvider;
 
@@ -252,9 +253,7 @@ public class ChecklistEditorE4 implements  IConversationEnabled,
         parent.setLayout(gridLayout);
 
        searchText = createSearchBar(parent);
-      // createSetDefaultReferenceButton(parent);
 
-       // getSite().setSelectionProvider(viewer);
 
     }
 
@@ -316,6 +315,7 @@ public class ChecklistEditorE4 implements  IConversationEnabled,
         Button button1 = new Button(parent, SWT.PUSH );
         GridData gridData2 = new GridData();
         gridData2.horizontalSpan = 1;
+        gridData2.horizontalAlignment = SWT.RIGHT;
         button1.setLayoutData(gridData2);
 
 
@@ -348,7 +348,8 @@ public class ChecklistEditorE4 implements  IConversationEnabled,
             @Override
             public void widgetSelected(SelectionEvent event) {
                 defaultSource = ReferenceSelectionDialog.select(AbstractUtility.getShell(), null);
-
+                statusLabelSourceReference.setText("Default Source Reference: " + defaultSource.getAbbrevTitleCache());
+                button2.setBackground(EditorUtil.getColor(Resources.COLOR_CONTROL_SELECTED));
             }
 
         });
@@ -395,6 +396,8 @@ public class ChecklistEditorE4 implements  IConversationEnabled,
             @Override
             public void widgetSelected(SelectionEvent event) {
                 defaultSource = ReferenceSelectionDialog.select(AbstractUtility.getShell(), null);
+                statusLabelSourceReference.setText("Default Source Reference: " + defaultSource.getAbbrevTitle() != null? defaultSource.getAbbrevTitle() : defaultSource.getAbbrevTitleCache());
+
             }
         });
 
@@ -405,13 +408,20 @@ public class ChecklistEditorE4 implements  IConversationEnabled,
 
     private void createStatusBar(Composite composite) {
         GridData gridData = new GridData();
-        gridData.horizontalSpan = 3;
+        gridData.horizontalSpan = 1;
         gridData.grabExcessHorizontalSpace = true;
         gridData.horizontalAlignment = GridData.FILL;
 
         statusLabel = new Label(composite, SWT.LEFT);
         statusLabel.setText(ELEMENT_COUNT + (countNodes != null ? countNodes : UNKNOWN));
         statusLabel.setLayoutData(gridData);
+
+        statusLabelSourceReference = new Label(composite, SWT.RIGHT);
+        statusLabelSourceReference.setLayoutData(gridData);
+        if (defaultSource != null){
+            statusLabelSourceReference.setText("Default Source Reference: " + defaultSource.getAbbrevTitle() != null? defaultSource.getAbbrevTitle() : defaultSource.getAbbrevTitleCache());
+
+        }
     }
 
     private void createTable() {
index cb9ba1b0b63895651e62f78dae85d43a7edc6f1a..0aeee7eb707cbddc3ec640c044c1663818838243 100644 (file)
@@ -3,6 +3,7 @@ package eu.etaxonomy.taxeditor.editor.view.checklist.e4;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
+import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
 import java.util.Map;
@@ -104,7 +105,9 @@ public final class DistributionEditingSupportE4 extends EditingSupport {
         Collection<DefinedTermBase> input = CdmStore.getTermManager().getPreferredTerms(TermType.PresenceAbsenceTerm);
         List<DefinedTermBase> inputList = new ArrayList(input);
         Comparator<DefinedTermBase> comp = new OrderedTermComparator<>();
-       // Collections.sort(inputList, comp);
+        Collections.sort(inputList, comp);
+        Collections.sort(inputList, Collections.reverseOrder());
+
         inputAll.addAll(1,inputList);
 
 
@@ -138,7 +141,7 @@ public final class DistributionEditingSupportE4 extends EditingSupport {
 
             }
 
-           //fireStateChanged(distributionForColumn);
+           //fireStateChanged();
             return null;
         }
         return null;
index 13f7e12a783161c0aeb1cbe9760f11e58f6f7d2b..b55d6d8b133dd17b1559feec26a06722554d85a2 100644 (file)
@@ -140,10 +140,6 @@ public class PreferencesUtil implements IPreferenceKeys {
                        if (preference == null){
                                return null;
                        } else{
-//                             int index = StringUtils.lastIndexOf(preference.getValue(), ".");
-//                             UUID uuid = UUID.fromString(preference.getValue().substring(index +1, preference.getValue().length()));
-//                             preferredCode = NomenclaturalCode.getByUuid(uuid);
-
                                getPreferenceStore().setValue(PREFERRED_NOMENCLATURAL_CODE_KEY,
                                        preferenceKey);
                                getPreferenceStore().setValue(ALLOW_OVERRIDE_NOMENCLATURAL_CODE_KEY,preference.isAllowOverride());
@@ -1639,6 +1635,8 @@ public static void updateDBPreferences() {
         if(!prefStore.getBoolean(SHOW_IO_MENU) ||  !preference.isAllowOverride()){
             prefStore.setValue(SHOW_IO_MENU, preference.getValue());
         }
+    }else{
+        prefStore.setValue(SHOW_IO_MENU, true);
     }
 
     preference = getPreferenceFromDB(PreferencePredicate.ShowMediaView);
@@ -1646,6 +1644,8 @@ public static void updateDBPreferences() {
         if(!prefStore.getBoolean(SHOW_MEDIA) ||  !preference.isAllowOverride()){
             prefStore.setValue(SHOW_MEDIA, preference.getValue());
         }
+    }else{
+        prefStore.setValue(SHOW_MEDIA, true);
     }
 
     preference = getPreferenceFromDB(PreferencePredicate.ShowChecklistPerspective);