1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2007 EDIT
|
4
|
* European Distributed Institute of Taxonomy
|
5
|
* http://www.e-taxonomy.eu
|
6
|
*
|
7
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
8
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
9
|
*/
|
10
|
|
11
|
package eu.etaxonomy.taxeditor.ui.section.media;
|
12
|
|
13
|
import java.util.Collection;
|
14
|
|
15
|
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
|
16
|
import eu.etaxonomy.cdm.model.media.Media;
|
17
|
import eu.etaxonomy.cdm.model.media.MediaRepresentation;
|
18
|
import eu.etaxonomy.taxeditor.singlesource.ui.forms.CdmFormFactoryFacade;
|
19
|
import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
|
20
|
import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
|
21
|
|
22
|
/**
|
23
|
* <p>MediaRepresentationSection class.</p>
|
24
|
*
|
25
|
* @author n.hoffmann
|
26
|
* @created Mar 24, 2010
|
27
|
* @version 1.0
|
28
|
*/
|
29
|
public class MediaRepresentationSection extends AbstractEntityCollectionSection<Media, MediaRepresentation> {
|
30
|
|
31
|
/**
|
32
|
* <p>Constructor for MediaRepresentationSection.</p>
|
33
|
*
|
34
|
* @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.singlesource.ui.forms.CdmFormFactoryFacade} object.
|
35
|
* @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
|
36
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
|
37
|
* @param style a int.
|
38
|
*/
|
39
|
public MediaRepresentationSection(CdmFormFactoryFacade cdmFormFactory, ConversationHolder conversation,
|
40
|
ICdmFormElement parentElement, int style) {
|
41
|
super(cdmFormFactory, conversation, parentElement, "Media Representation", style);
|
42
|
}
|
43
|
|
44
|
/** {@inheritDoc} */
|
45
|
@Override
|
46
|
public void addElement(MediaRepresentation element) {
|
47
|
getEntity().addRepresentation(element);
|
48
|
}
|
49
|
|
50
|
/** {@inheritDoc} */
|
51
|
@Override
|
52
|
public MediaRepresentation createNewElement() {
|
53
|
return MediaRepresentation.NewInstance();
|
54
|
}
|
55
|
|
56
|
/** {@inheritDoc} */
|
57
|
@Override
|
58
|
public Collection<MediaRepresentation> getCollection(
|
59
|
Media entity) {
|
60
|
return getEntity().getRepresentations();
|
61
|
}
|
62
|
|
63
|
/** {@inheritDoc} */
|
64
|
@Override
|
65
|
public String getEmptyString() {
|
66
|
return "No media representations yet.";
|
67
|
}
|
68
|
|
69
|
/** {@inheritDoc} */
|
70
|
@Override
|
71
|
protected String getTooltipString() {
|
72
|
return "Create a new media representation";
|
73
|
}
|
74
|
|
75
|
/** {@inheritDoc} */
|
76
|
@Override
|
77
|
public void removeElement(MediaRepresentation element) {
|
78
|
getEntity().removeRepresentation(element);
|
79
|
}
|
80
|
|
81
|
|
82
|
}
|