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