Project

General

Profile

Download (2.48 KB) Statistics
| Branch: | Tag: | Revision:
1 729887cf n.hoffmann
/**
2
* Copyright (C) 2007 EDIT
3 da32e3d6 Patrick Plitzner
* European Distributed Institute of Taxonomy
4 729887cf n.hoffmann
* http://www.e-taxonomy.eu
5 da32e3d6 Patrick Plitzner
*
6 729887cf n.hoffmann
* 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
10 f211dd28 n.hoffmann
package eu.etaxonomy.taxeditor.ui.section.description;
11 729887cf n.hoffmann
12
import java.util.Collection;
13 1c3cb06b Patrick Plitzner
import java.util.Comparator;
14 729887cf n.hoffmann
15 2d9a13f7 n.hoffmann
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
16 729887cf n.hoffmann
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
17
import eu.etaxonomy.cdm.model.description.Feature;
18
import eu.etaxonomy.cdm.model.media.Media;
19 78222507 n.hoffmann
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
20 dacb59c9 Patric Plitzner
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
21 f211dd28 n.hoffmann
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
22 1c3cb06b Patrick Plitzner
import eu.etaxonomy.taxeditor.ui.section.DefaultCdmBaseComparator;
23 729887cf n.hoffmann
24
/**
25 3be6ef3e n.hoffmann
 * <p>DescriptionElementMediaSection class.</p>
26
 *
27 729887cf n.hoffmann
 * @author n.hoffmann
28
 * @created Mar 18, 2010
29
 * @version 1.0
30
 */
31
public class DescriptionElementMediaSection extends
32
		AbstractEntityCollectionSection<DescriptionElementBase, Media> {
33 da32e3d6 Patrick Plitzner
34 2d9a13f7 n.hoffmann
	public DescriptionElementMediaSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation,
35 729887cf n.hoffmann
			ICdmFormElement parentElement, int style) {
36 2d9a13f7 n.hoffmann
		super(cdmFormFactory, conversation, parentElement, "Media", style);
37 729887cf n.hoffmann
	}
38 da32e3d6 Patrick Plitzner
39 3be6ef3e n.hoffmann
	/** {@inheritDoc} */
40 729887cf n.hoffmann
	@Override
41
	public void setEntity(DescriptionElementBase entity) {
42
		if(entity.getFeature().equals(Feature.IMAGE())){
43
			this.setVisible(false);
44
		}
45
		super.setEntity(entity);
46
	}
47
48 3be6ef3e n.hoffmann
	/** {@inheritDoc} */
49 729887cf n.hoffmann
	@Override
50
	public void addElement(Media element) {
51
		getEntity().addMedia(element);
52
	}
53
54 3be6ef3e n.hoffmann
	/** {@inheritDoc} */
55 729887cf n.hoffmann
	@Override
56
	public Media createNewElement() {
57
		return Media.NewInstance();
58
	}
59
60 3be6ef3e n.hoffmann
	/** {@inheritDoc} */
61 729887cf n.hoffmann
	@Override
62
	public Collection<Media> getCollection(DescriptionElementBase entity) {
63
		return entity.getMedia();
64
	}
65
66 1c3cb06b Patrick Plitzner
	@Override
67
	public Comparator<Media> getComparator() {
68
        return new DefaultCdmBaseComparator<>();
69
	}
70
71 3be6ef3e n.hoffmann
	/** {@inheritDoc} */
72 729887cf n.hoffmann
	@Override
73
	public String getEmptyString() {
74
		return "No media yet.";
75
	}
76
77 3be6ef3e n.hoffmann
	/** {@inheritDoc} */
78 729887cf n.hoffmann
	@Override
79
	protected String getTooltipString() {
80
		return "Create new media";
81
	}
82
83 3be6ef3e n.hoffmann
	/** {@inheritDoc} */
84 729887cf n.hoffmann
	@Override
85
	public void removeElement(Media element) {
86
		getEntity().removeMedia(element);
87
	}
88 da32e3d6 Patrick Plitzner
89 f5b66699 Patrick Plitzner
    /**
90
     * {@inheritDoc}
91
     */
92
    @Override
93
    public Media addExisting() {
94
        return null;
95
    }
96
97
    /**
98
     * {@inheritDoc}
99
     */
100
    @Override
101
    public boolean allowAddExisting() {
102
        return false;
103
    }
104
105 da32e3d6 Patrick Plitzner
106 729887cf n.hoffmann
}