Project

General

Profile

« Previous | Next » 

Revision fc0d671e

Added by Katja Luther about 3 years ago

ref #6229: fix problems with multilanguage support and title generation for media

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/MediaDetailElement.java
172 172
                MediaMetaElement metaElement = (MediaMetaElement)this.getParentElement();
173 173
                if (metaElement.getParentElement() != null && metaElement.getParentElement() instanceof MediaDetailsSection){
174 174
                    MediaDetailsSection sec = (MediaDetailsSection)metaElement.getParentElement();
175
                    sec.setMediaSectionTitle();
175
//                    sec.setMediaSectionTitle();
176 176
                    metaElement.createTitle();
177
                    sec.setMediaSectionTitle();
177 178
                }
178 179
            }
179 180
        }
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/media/MediaMetaElement.java
8 8
 */
9 9
package eu.etaxonomy.taxeditor.ui.section.media;
10 10

  
11
import java.util.Map;
12

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

  
14 16
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
15 17
import eu.etaxonomy.cdm.model.agent.AgentBase;
18
import eu.etaxonomy.cdm.model.common.Language;
19
import eu.etaxonomy.cdm.model.common.LanguageString;
16 20
import eu.etaxonomy.cdm.model.common.TimePeriod;
17 21
import eu.etaxonomy.cdm.model.media.Media;
18 22
import eu.etaxonomy.taxeditor.model.AbstractUtility;
23
import eu.etaxonomy.taxeditor.store.CdmStore;
19 24
import eu.etaxonomy.taxeditor.ui.dialog.selection.MediaSelectionDialog;
20 25
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
21 26
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
......
98 103
                .deproxy(element.getArtist()));
99 104

  
100 105
        text_description.setMultilanguageText(element.getAllDescriptions());
106

  
101 107
//        if (CdmUtils.isBlank(text_description.getText())){
102 108
//        	Map<Language, LanguageString> allDescriptions = element.getAllDescriptions();
103 109
//        	if (!allDescriptions.isEmpty()){
......
109 115
    }
110 116

  
111 117
    public void createTitle() {
112
//        LanguageString title = this.entity.getTitle(CdmStore.getDefaultLanguage());
113
//
114
//        if (title == null) {
115
//            title = LanguageString.NewInstance(entity.getTitleCache(), CdmStore.getDefaultLanguage());
116
//        }
117

  
118
        text_title.setMultilanguageText(entity.getAllTitles());
118
       LanguageString title = this.entity.getTitle(CdmStore.getDefaultLanguage());
119
       Map<Language, LanguageString> languageStrings = entity.getAllTitles();
120
       if (title == null || title.getText().contains("empty media")) {
121
           entity.getAllTitles().remove(title);
122
           title = LanguageString.NewInstance(entity.getTitleCache(), CdmStore.getDefaultLanguage());
123
           if (!title.getText().contains("empty media")){
124
               languageStrings.put(CdmStore.getDefaultLanguage(), title);
125
           }
126
       }
127
       text_title.setMultilanguageText(languageStrings);
119 128
    }
120 129

  
121 130
    @Override

Also available in: Unified diff