Project

General

Profile

« Previous | Next » 

Revision 2b73afd3

Added by Katja Luther over 3 years ago

ref #7854: minor changes

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/DistributionEditor.java
266 266
        //add default configuration because autoconfigure is set to false in constructor
267 267
        natTable.addConfiguration(new DefaultNatTableStyleConfiguration());
268 268

  
269

  
270

  
269 271
        // override the default sort configuration and change the mouse bindings
270 272
        // to sort on a single click
271 273

  
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/FilterStatusDisplayConverter.java
1
/**
2
* Copyright (C) 2018 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.taxeditor.editor.view.checklist.e4;
10

  
11
import org.eclipse.nebula.widgets.nattable.data.convert.DisplayConverter;
12

  
13
import eu.etaxonomy.cdm.model.common.Representation;
14
import eu.etaxonomy.cdm.model.description.Distribution;
15
import eu.etaxonomy.cdm.model.description.PresenceAbsenceTerm;
16
import eu.etaxonomy.taxeditor.store.CdmStore;
17

  
18
/**
19
 * @author k.luther
20
 * @since 05.12.2018
21
 *
22
 */
23
public class FilterStatusDisplayConverter extends DisplayConverter{
24
    public static final String DEFAULT_ENTRY = "";
25
    /**
26
     * {@inheritDoc}
27
     */
28
    @Override
29
    public Object canonicalToDisplayValue(Object canonicalValue) {
30
        if(canonicalValue instanceof Distribution){
31
            Distribution distribution = (Distribution)canonicalValue;
32
            if (distribution.getStatus() != null){
33

  
34
                Representation rep = distribution.getStatus().getPreferredRepresentation(CdmStore.getDefaultLanguage());
35
                String label = rep.getLabel();
36
                return (label != null)?label:DEFAULT_ENTRY;
37

  
38
            }
39

  
40
            return "";
41
        }else if(canonicalValue instanceof PresenceAbsenceTerm){
42
            return ((PresenceAbsenceTerm)canonicalValue).getLabel();
43
        } else if(canonicalValue!=null){
44
            return canonicalValue.toString();
45
        }
46
        return null;
47
    }
48

  
49
    /**
50
     * {@inheritDoc}
51
     */
52
    @Override
53
    public Object displayToCanonicalValue(Object displayValue) {
54
        return null;
55
    }
56

  
57
}
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/checklist/e4/StatusDisplayConverter.java
33 33
        if(canonicalValue instanceof Distribution){
34 34
            Distribution distribution = (Distribution)canonicalValue;
35 35
            if (distribution.getStatus() != null){
36
                PresenceAbsenceTerm term = distribution.getStatus();
36

  
37 37
                Representation rep = distribution.getStatus().getPreferredRepresentation(CdmStore.getDefaultLanguage());
38 38
                String label = rep.getLabel();
39 39

  
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/e4/OpenDistributionEditorWizardHandlerE4.java
18 18
import eu.etaxonomy.cdm.model.metadata.CdmPreference;
19 19
import eu.etaxonomy.cdm.model.metadata.PreferencePredicate;
20 20
import eu.etaxonomy.taxeditor.l10n.Messages;
21
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
21 22
import eu.etaxonomy.taxeditor.preference.wizard.AvailableVocabularyWizard;
22 23

  
23 24
/**
......
33 34
        @Execute
34 35
        public void execute(@Named(IServiceConstants.ACTIVE_SHELL)Shell shell) {
35 36
            CdmPreference pref = CdmPreference.NewTaxEditorInstance(PreferencePredicate.AvailableDistributionAreaVocabularies, null);
37
            pref.setAllowOverride(PreferencesUtil.getBooleanValue(PreferencesUtil.prefOverrideKey(PreferencePredicate.AvailableDistributionAreaVocabularies.getKey())));
36 38
            AvailableVocabularyWizard wizard = new AvailableVocabularyWizard(true, pref, Messages.OpenDistributionEditorWizardHandlerE4_DISTRIBUTION);
37 39

  
38 40
            WizardDialog dialog = new WizardDialog(shell,

Also available in: Unified diff