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.description;
|
12
|
|
13
|
import org.apache.log4j.Logger;
|
14
|
import org.eclipse.jface.viewers.ISelectionProvider;
|
15
|
import org.eclipse.ui.forms.widgets.Section;
|
16
|
import org.eclipse.ui.forms.widgets.TableWrapLayout;
|
17
|
|
18
|
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
|
19
|
import eu.etaxonomy.cdm.model.media.Media;
|
20
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
|
21
|
import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
|
22
|
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory.DetailType;
|
23
|
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
|
24
|
import eu.etaxonomy.taxeditor.ui.section.media.MediaElement;
|
25
|
|
26
|
/**
|
27
|
* <p>MediaDetailsSection class.</p>
|
28
|
*
|
29
|
* @author n.hoffmann
|
30
|
* @created Jun 15, 2010
|
31
|
* @version 1.0
|
32
|
*/
|
33
|
public class MediaDetailsSection extends AbstractCdmDetailSection<Media> {
|
34
|
|
35
|
|
36
|
private static final Logger logger = Logger
|
37
|
.getLogger(MediaDetailsSection.class);
|
38
|
private MediaElement element_media;
|
39
|
|
40
|
/**
|
41
|
* <p>Constructor for MediaDetailsSection.</p>
|
42
|
*
|
43
|
* @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
|
44
|
* @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
|
45
|
* @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
|
46
|
* @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
|
47
|
* @param style a int.
|
48
|
*/
|
49
|
public MediaDetailsSection(CdmFormFactory formFactory, ConversationHolder conversation,
|
50
|
ICdmFormElement parentElement,
|
51
|
ISelectionProvider selectionProvider, int style) {
|
52
|
super(formFactory, conversation, parentElement, selectionProvider, style);
|
53
|
}
|
54
|
|
55
|
/* (non-Javadoc)
|
56
|
* @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#getDetailType()
|
57
|
*/
|
58
|
/** {@inheritDoc} */
|
59
|
@Override
|
60
|
protected DetailType getDetailType() {
|
61
|
return null;
|
62
|
}
|
63
|
|
64
|
/** {@inheritDoc} */
|
65
|
@Override
|
66
|
protected void createControls(AbstractCdmDetailSection formElement,
|
67
|
int style) {
|
68
|
TableWrapLayout layout = (TableWrapLayout) getLayoutComposite().getLayout();
|
69
|
layout.topMargin = 10;
|
70
|
layout.numColumns = 2;
|
71
|
|
72
|
getLayoutComposite().setLayout(layout);
|
73
|
|
74
|
|
75
|
}
|
76
|
|
77
|
/**
|
78
|
* <p>setEntity</p>
|
79
|
*
|
80
|
* @param entity a {@link eu.etaxonomy.cdm.model.media.Media} object.
|
81
|
*/
|
82
|
public void setEntity(Media entity) {
|
83
|
if(element_media != null){
|
84
|
this.removeElements();
|
85
|
}
|
86
|
element_media = (MediaElement) formFactory.createEntityCollectionElement(this, entity, null, null, Section.EXPANDED);
|
87
|
formFactory.addPropertyChangeListener(element_media);
|
88
|
super.setEntity(entity);
|
89
|
setSectionTitle();
|
90
|
layout();
|
91
|
}
|
92
|
|
93
|
/* (non-Javadoc)
|
94
|
* @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#getHeading()
|
95
|
*/
|
96
|
/** {@inheritDoc} */
|
97
|
@Override
|
98
|
public String getHeading() {
|
99
|
return "Image";
|
100
|
}
|
101
|
}
|