1
|
/**
|
2
|
* Copyright (C) 2007 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
|
|
10
|
package eu.etaxonomy.taxeditor.ui.section.description;
|
11
|
|
12
|
import java.util.Collection;
|
13
|
|
14
|
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
|
15
|
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
|
16
|
import eu.etaxonomy.cdm.model.description.Feature;
|
17
|
import eu.etaxonomy.cdm.model.media.Media;
|
18
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
19
|
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
|
20
|
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
|
21
|
|
22
|
/**
|
23
|
* <p>DescriptionElementMediaSection class.</p>
|
24
|
*
|
25
|
* @author n.hoffmann
|
26
|
* @created Mar 18, 2010
|
27
|
* @version 1.0
|
28
|
*/
|
29
|
public class DescriptionElementMediaSection extends
|
30
|
AbstractEntityCollectionSection<DescriptionElementBase, Media> {
|
31
|
|
32
|
public DescriptionElementMediaSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation,
|
33
|
ICdmFormElement parentElement, int style) {
|
34
|
super(cdmFormFactory, conversation, parentElement, "Media", style);
|
35
|
}
|
36
|
|
37
|
/** {@inheritDoc} */
|
38
|
@Override
|
39
|
public void setEntity(DescriptionElementBase entity) {
|
40
|
if(entity.getFeature().equals(Feature.IMAGE())){
|
41
|
this.setVisible(false);
|
42
|
}
|
43
|
super.setEntity(entity);
|
44
|
}
|
45
|
|
46
|
/** {@inheritDoc} */
|
47
|
@Override
|
48
|
public void addElement(Media element) {
|
49
|
getEntity().addMedia(element);
|
50
|
}
|
51
|
|
52
|
/** {@inheritDoc} */
|
53
|
@Override
|
54
|
public Media createNewElement() {
|
55
|
return Media.NewInstance();
|
56
|
}
|
57
|
|
58
|
/** {@inheritDoc} */
|
59
|
@Override
|
60
|
public Collection<Media> getCollection(DescriptionElementBase entity) {
|
61
|
return entity.getMedia();
|
62
|
}
|
63
|
|
64
|
/** {@inheritDoc} */
|
65
|
@Override
|
66
|
public String getEmptyString() {
|
67
|
return "No media yet.";
|
68
|
}
|
69
|
|
70
|
/** {@inheritDoc} */
|
71
|
@Override
|
72
|
protected String getTooltipString() {
|
73
|
return "Create new media";
|
74
|
}
|
75
|
|
76
|
/** {@inheritDoc} */
|
77
|
@Override
|
78
|
public void removeElement(Media element) {
|
79
|
getEntity().removeMedia(element);
|
80
|
}
|
81
|
|
82
|
|
83
|
}
|