2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
9 package eu
.etaxonomy
.taxeditor
.ui
.section
.description
;
11 import org
.eclipse
.jface
.action
.ToolBarManager
;
12 import org
.eclipse
.jface
.viewers
.ISelectionProvider
;
13 import org
.eclipse
.swt
.SWT
;
14 import org
.eclipse
.swt
.widgets
.Control
;
15 import org
.eclipse
.ui
.forms
.widgets
.ExpandableComposite
;
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
.MediaMetaElement
;
24 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaViewSwitch
;
27 * MediaDetailsSection class.
30 * @created Jun 15, 2010
32 public class MediaDetailsSection
extends AbstractCdmDetailSection
<Media
> {
34 private MediaMetaElement mediaMetaElement
;
36 public MediaDetailsSection(CdmFormFactory formFactory
, ConversationHolder conversation
,
37 ICdmFormElement parentElement
,
38 ISelectionProvider selectionProvider
, int style
) {
39 super(formFactory
, conversation
, parentElement
, selectionProvider
, style
);
43 public void setEntity(Media entity
) {
44 if(mediaMetaElement
!= null){
45 this.removeElements();
47 mediaMetaElement
= (MediaMetaElement
) formFactory
.createEntityCollectionElement(this, entity
, null, null, ExpandableComposite
.EXPANDED
);
48 super.setEntity(entity
);
50 setTextClient(createToolbar());
55 public void setMediaSectionTitle() {
56 this.setSectionTitle();
60 public String
getHeading() {
65 protected AbstractCdmDetailElement
<Media
> createCdmDetailElement(AbstractCdmDetailSection
<Media
> parentElement
, int style
) {
70 protected Control
createToolbar() {
71 ToolBarManager toolBarManager
= new ToolBarManager(SWT
.FLAT
);
72 toolBarManager
.add(MediaViewSwitch
.createSwitch(mediaMetaElement
));
73 return toolBarManager
.createControl(this);