Merge branch 'develop' into LibrAlign
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / media / MediaRepresentationSection.java
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.media;
11
12 import java.util.Collection;
13
14 import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
15 import eu.etaxonomy.cdm.model.media.Media;
16 import eu.etaxonomy.cdm.model.media.MediaRepresentation;
17 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
18 import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
19 import eu.etaxonomy.taxeditor.ui.section.AbstractEntityCollectionSection;
20
21 /**
22 * <p>MediaRepresentationSection class.</p>
23 *
24 * @author n.hoffmann
25 * @created Mar 24, 2010
26 * @version 1.0
27 */
28 public class MediaRepresentationSection extends AbstractEntityCollectionSection<Media, MediaRepresentation> {
29
30 /**
31 * <p>Constructor for MediaRepresentationSection.</p>
32 *
33 * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
34 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
35 * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
36 * @param style a int.
37 */
38 public MediaRepresentationSection(CdmFormFactory cdmFormFactory, ConversationHolder conversation,
39 ICdmFormElement parentElement, int style) {
40 super(cdmFormFactory, conversation, parentElement, "Media Representation", style);
41 }
42
43 /** {@inheritDoc} */
44 @Override
45 public void addElement(MediaRepresentation element) {
46 getEntity().addRepresentation(element);
47 }
48
49 /** {@inheritDoc} */
50 @Override
51 public MediaRepresentation createNewElement() {
52 return MediaRepresentation.NewInstance();
53 }
54
55 /** {@inheritDoc} */
56 @Override
57 public Collection<MediaRepresentation> getCollection(
58 Media entity) {
59 return getEntity().getRepresentations();
60 }
61
62 /** {@inheritDoc} */
63 @Override
64 public String getEmptyString() {
65 return "No media representations yet.";
66 }
67
68 /** {@inheritDoc} */
69 @Override
70 protected String getTooltipString() {
71 return "Create a new media representation";
72 }
73
74 /** {@inheritDoc} */
75 @Override
76 public void removeElement(MediaRepresentation element) {
77 getEntity().removeRepresentation(element);
78 }
79
80 /**
81 * {@inheritDoc}
82 */
83 @Override
84 public MediaRepresentation addExisting() {
85 return null;
86 }
87
88 /**
89 * {@inheritDoc}
90 */
91 @Override
92 public boolean allowAddExisting() {
93 return false;
94 }
95
96
97 }