Project

General

Profile

Revision 411130a5

ID411130a5f878df8bf444da4cef8db1b89b5414b2
Parent b937b2de
Child 8a715e5c

Added by Katja Luther about 2 years ago

enable i18n for description of external links

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/common/ExternalLinksElement.java
8 8
*/
9 9
package eu.etaxonomy.taxeditor.ui.section.common;
10 10

  
11
import org.eclipse.swt.SWT;
12 11
import org.eclipse.swt.events.SelectionListener;
13 12

  
14
import eu.etaxonomy.cdm.model.common.Language;
15 13
import eu.etaxonomy.cdm.model.media.ExternalLink;
16 14
import eu.etaxonomy.cdm.model.media.ExternalLinkType;
17
import eu.etaxonomy.taxeditor.store.CdmStore;
18 15
import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement;
19 16
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
20 17
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
21 18
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
22 19
import eu.etaxonomy.taxeditor.ui.element.ISelectableElement;
20
import eu.etaxonomy.taxeditor.ui.element.MultilanguageTextElement;
23 21
import eu.etaxonomy.taxeditor.ui.element.SelectionArbitrator;
24
import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
25 22
import eu.etaxonomy.taxeditor.ui.element.UriWithLabelElement;
26 23
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionElement;
27 24

  
......
36 33

  
37 34
    private UriWithLabelElement externalLinkUriText;
38 35
    private EnumComboElement<ExternalLinkType> combo_linkType;
39
    private TextWithLabelElement description;
36
    private MultilanguageTextElement description;
40 37

  
41 38

  
42 39

  
......
67 64
        if (entity.getLinkType() != null){
68 65
            combo_linkType.setSelection(entity.getLinkType());
69 66
        }
70
        if (entity.getDescription() != null
71
        		&& entity.getDescription().get(CdmStore.getDefaultLanguage()) != null) {
72
            description.setText(entity.getDescription().get(
73
                        CdmStore.getDefaultLanguage()).getText());
74
        }else if (entity.getDescription() != null ){
75
            description.setText(entity.getDescription().get(Language.DEFAULT()).getText());
67
        if (entity.getDescription() != null) {
68
            description.setMultilanguageText(entity.getDescription());
69
//            description.setText(entity.getDescription().get(
70
//                        CdmStore.getDefaultLanguage()).getText());
76 71
        }
77 72
    }
78 73

  
......
82 77
        combo_linkType = formFactory.createEnumComboElement(ExternalLinkType.class, element, style);
83 78
        externalLinkUriText = formFactory.createUriWithLabelElement(element, "URI", null,  style);
84 79

  
85
        description = formFactory.createMultiLineTextWithLabel(this, "Description", 50, SWT.WRAP);
86

  
80
       // description = formFactory.createMultiLineTextWithLabel(this, "Description", 50, SWT.WRAP);
81
        description = formFactory.createMultiLanguageTextElement(element, "Description", null, 50, style);
87 82

  
88 83

  
89 84
    }
......
95 90
        }else if (eventSource.equals(combo_linkType)){
96 91
            getEntity().setLinkType(combo_linkType.getSelection());
97 92
        }else if (eventSource.equals(description)){
98
            getEntity().putDescription(CdmStore.getDefaultLanguage(), description.getText());
93
            description.getMultilanguageText().values()
94
            .forEach(languageString -> getEntity().putDescription(languageString));
95

  
99 96
        }
100 97

  
101 98
    }

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)