Project

General

Profile

Revision 909326e9

ID909326e9b74be422e80071325ae93e53102404a5
Parent 41baf435
Child 5bb1eb99

Added by Patrick Plitzner over 1 year ago

fix #8283 Add media section to term details view

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/CdmFormFactory.java
354 354
import eu.etaxonomy.taxeditor.ui.section.vocabulary.StateVocabularyCollectionSection;
355 355
import eu.etaxonomy.taxeditor.ui.section.vocabulary.StatisticalMeasureCollectionElement;
356 356
import eu.etaxonomy.taxeditor.ui.section.vocabulary.StatisticalMeasureCollectionSection;
357
import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermMediaSection;
357 358
import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermVocabularyDetailElement;
358 359
import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermVocabularyDetailSection;
359 360
import eu.etaxonomy.taxeditor.ui.selection.CommonNameReferenceSelectionElement;
......
1675 1676

  
1676 1677
    }
1677 1678

  
1679
    public TermMediaSection createTermMediaSection(ConversationHolder conversation,
1680
            ICdmFormElement parentElement, int style) {
1681
        TermMediaSection section = new TermMediaSection(this, conversation, parentElement, style);
1682
        parentElement.addElement(section);
1683
        adapt(section);
1684
        return section;
1685

  
1686
    }
1687

  
1678 1688
    /**
1679 1689
     * @param definedTermClass
1680 1690
     * @param formElement
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/vocabulary/TermMediaSection.java
1
/**
2
 *
3
 */
4
package eu.etaxonomy.taxeditor.ui.section.vocabulary;
5

  
6
import java.util.Collection;
7
import java.util.Comparator;
8

  
9
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
10
import eu.etaxonomy.cdm.model.media.Media;
11
import eu.etaxonomy.cdm.model.term.DefinedTermBase;
12
import eu.etaxonomy.taxeditor.ui.dialog.selection.MediaSelectionDialog;
13
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
14
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
15
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
16
import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator;
17

  
18
/**
19
 *
20
 * @author pplitzner
21
 * @since May 17, 2019
22
 *
23
 */
24
public class TermMediaSection extends AbstractEntityCollectionSection<DefinedTermBase, Media>{
25

  
26
	public TermMediaSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation, ICdmFormElement parentElement, int style) {
27
		super(cdmFormFactory, conversation, parentElement, "Media", style);
28
	}
29

  
30
	@Override
31
	public Media createNewElement() {
32
		return Media.NewInstance();
33
	}
34

  
35
	@Override
36
	public Collection<Media> getCollection(DefinedTermBase entity) {
37
		return entity.getMedia();
38
	}
39

  
40
	@Override
41
	public Comparator<Media> getComparator() {
42
        return new DefaultCdmBaseComparator<>();
43
	}
44

  
45
	@Override
46
	public String getEmptyString() {
47
		return "No media yet.";
48
	}
49

  
50
	@Override
51
	protected String getTooltipString() {
52
		return "Create new media";
53
	}
54

  
55
	@Override
56
	public void addElement(Media element) {
57
		getEntity().addMedia(element);
58
	}
59

  
60
	@Override
61
	public void removeElement(Media element) {
62
		getEntity().removeMedia(element);
63
	}
64

  
65
    @Override
66
    public Media addExisting() {
67
        return MediaSelectionDialog.select(getShell(), null);
68
    }
69

  
70
    @Override
71
    public boolean allowAddExisting() {
72
        return true;
73
    }
74

  
75
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/details/DetailsViewerE4.java
29 29
import eu.etaxonomy.cdm.model.agent.Person;
30 30
import eu.etaxonomy.cdm.model.agent.Team;
31 31
import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
32
import eu.etaxonomy.cdm.model.term.DefinedTermBase;
33 32
import eu.etaxonomy.cdm.model.common.Group;
34 33
import eu.etaxonomy.cdm.model.common.Marker;
35
import eu.etaxonomy.cdm.model.term.TermVocabulary;
36 34
import eu.etaxonomy.cdm.model.common.User;
37 35
import eu.etaxonomy.cdm.model.description.CategoricalData;
38 36
import eu.etaxonomy.cdm.model.description.Character;
39 37
import eu.etaxonomy.cdm.model.description.DescriptionBase;
40 38
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
41 39
import eu.etaxonomy.cdm.model.description.Distribution;
42
import eu.etaxonomy.cdm.model.term.FeatureNode;
43
import eu.etaxonomy.cdm.model.term.FeatureTree;
44 40
import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
45 41
import eu.etaxonomy.cdm.model.description.SpecimenDescription;
46 42
import eu.etaxonomy.cdm.model.description.TaxonDescription;
......
56 52
import eu.etaxonomy.cdm.model.reference.Reference;
57 53
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
58 54
import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
55
import eu.etaxonomy.cdm.model.term.DefinedTermBase;
56
import eu.etaxonomy.cdm.model.term.FeatureNode;
57
import eu.etaxonomy.cdm.model.term.FeatureTree;
58
import eu.etaxonomy.cdm.model.term.TermVocabulary;
59 59
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
60 60
import eu.etaxonomy.taxeditor.editor.IDistributionEditor;
61 61
import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
......
125 125
import eu.etaxonomy.taxeditor.ui.section.user.UserDetailSection;
126 126
import eu.etaxonomy.taxeditor.ui.section.userecords.UseRecordDetailSection;
127 127
import eu.etaxonomy.taxeditor.ui.section.vocabulary.DefinedTermDetailSection;
128
import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermMediaSection;
128 129
import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermVocabularyDetailSection;
129 130
import eu.etaxonomy.taxeditor.view.e4.AbstractCdmDataViewerE4;
130 131

  
......
869 870
    private void createDefinedTermSection(RootElement parent) {
870 871
        DefinedTermDetailSection definedTermDetailSection = formFactory.createDefinedTermDetailSection(getInput().getClass(), getConversationHolder(), parent, this, getSectionStyle(DefinedTermDetailSection.class, true));
871 872
        addPart(definedTermDetailSection);
873
        TermMediaSection termMediaSection = formFactory.createTermMediaSection(getConversationHolder(), parent, getSectionStyle(DefinedTermDetailSection.class, true));
874
        addPart(termMediaSection);
872 875
    }
873 876

  
874 877
    @Override

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)