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 org.eclipse.jface.action.ToolBarManager;
|
13
|
import org.eclipse.jface.viewers.ISelectionProvider;
|
14
|
import org.eclipse.swt.SWT;
|
15
|
import org.eclipse.swt.widgets.Control;
|
16
|
import org.eclipse.ui.forms.widgets.ExpandableComposite;
|
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.section.AbstractCdmDetailElement;
|
23
|
import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection;
|
24
|
import eu.etaxonomy.taxeditor.ui.section.media.MediaMetaElement;
|
25
|
import eu.etaxonomy.taxeditor.ui.section.media.MediaViewSwitch;
|
26
|
|
27
|
/**
|
28
|
* <p>MediaDetailsSection class.</p>
|
29
|
*
|
30
|
* @author n.hoffmann
|
31
|
* @created Jun 15, 2010
|
32
|
* @version 1.0
|
33
|
*/
|
34
|
public class MediaDetailsSection extends AbstractCdmDetailSection<Media> {
|
35
|
|
36
|
private MediaMetaElement mediaMetaElement;
|
37
|
|
38
|
public MediaDetailsSection(CdmFormFactory formFactory, ConversationHolder conversation,
|
39
|
ICdmFormElement parentElement,
|
40
|
ISelectionProvider selectionProvider, int style) {
|
41
|
super(formFactory, conversation, parentElement, selectionProvider, style);
|
42
|
}
|
43
|
|
44
|
@Override
|
45
|
public void setEntity(Media entity) {
|
46
|
if(mediaMetaElement != null){
|
47
|
this.removeElements();
|
48
|
}
|
49
|
mediaMetaElement = (MediaMetaElement) formFactory.createEntityCollectionElement(this, entity, null, null, ExpandableComposite.EXPANDED);
|
50
|
super.setEntity(entity);
|
51
|
setSectionTitle();
|
52
|
setTextClient(createToolbar());
|
53
|
layout();
|
54
|
}
|
55
|
|
56
|
|
57
|
public void setMediaSectionTitle() {
|
58
|
this.setSectionTitle();
|
59
|
}
|
60
|
|
61
|
/** {@inheritDoc} */
|
62
|
@Override
|
63
|
public String getHeading() {
|
64
|
return "Image";
|
65
|
}
|
66
|
|
67
|
@Override
|
68
|
protected AbstractCdmDetailElement<Media> createCdmDetailElement(AbstractCdmDetailSection<Media> parentElement, int style) {
|
69
|
return null;
|
70
|
}
|
71
|
|
72
|
|
73
|
|
74
|
@Override
|
75
|
protected Control createToolbar() {
|
76
|
ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
|
77
|
toolBarManager.add(MediaViewSwitch.createSwitch(mediaMetaElement));
|
78
|
return toolBarManager.createControl(this);
|
79
|
}
|
80
|
|
81
|
}
|