3 * Copyright (C) 2013 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.taxeditor
.ui
.section
.occurrence
.media
;
12 import org
.eclipse
.jface
.action
.Action
;
13 import org
.eclipse
.jface
.action
.IAction
;
14 import org
.eclipse
.jface
.action
.ToolBarManager
;
15 import org
.eclipse
.jface
.viewers
.ISelectionProvider
;
16 import org
.eclipse
.swt
.SWT
;
17 import org
.eclipse
.swt
.widgets
.Control
;
19 import eu
.etaxonomy
.cdm
.api
.conversation
.ConversationHolder
;
20 import eu
.etaxonomy
.cdm
.model
.occurrence
.MediaSpecimen
;
21 import eu
.etaxonomy
.taxeditor
.ui
.element
.CdmFormFactory
;
22 import eu
.etaxonomy
.taxeditor
.ui
.element
.ICdmFormElement
;
23 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractCdmDetailElement
;
24 import eu
.etaxonomy
.taxeditor
.ui
.section
.AbstractCdmDetailSection
;
25 import eu
.etaxonomy
.taxeditor
.view
.derivateSearch
.DerivateLabelProvider
;
32 public class MediaSpecimenGeneralDetailSection
extends AbstractCdmDetailSection
<MediaSpecimen
> {
34 private MediaSpecimenGeneralDetailElement mediaSpecimenGeneralDetailElement
;
39 * @param parentElement
40 * @param selectionProvider
43 public MediaSpecimenGeneralDetailSection(CdmFormFactory formFactory
,
44 ConversationHolder conversation
, ICdmFormElement parentElement
,
45 ISelectionProvider selectionProvider
, int style
) {
46 super(formFactory
, conversation
, parentElement
, selectionProvider
, style
);
51 * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailSection#getHeading()
54 public String
getHeading() {
55 return "General Media Specimen";
59 * @see org.eclipse.ui.forms.widgets.ExpandableComposite#setText(java.lang.String)
62 public void setText(String title
) {
64 if(getEntity()!=null && getEntity().getKindOfUnit()!=null){
65 if(getEntity().getKindOfUnit().equals(DerivateLabelProvider
.getArtworkTerm())){
68 else if(getEntity().getKindOfUnit().equals(DerivateLabelProvider
.getLivingPlantPhotoTerm())){
69 text
= "Living Plant Photo";
71 else if(getEntity().getKindOfUnit().equals(DerivateLabelProvider
.getSpecimenScanTerm())){
72 text
= "Specimen Scan";
74 else if(getEntity().getKindOfUnit().equals(DerivateLabelProvider
.getDetailImageTerm())){
75 text
= "Detail Image";
87 protected Control
createToolbar() {
88 ToolBarManager toolBarManager
= new ToolBarManager(SWT
.FLAT
);
90 String actionLabel
= "Use advanced media view";
91 Action addAction
= new Action(actionLabel
, IAction
.AS_PUSH_BUTTON
) {
93 * @see org.eclipse.jface.action.Action#run()
97 mediaSpecimenGeneralDetailElement
.toogleAdvancedMediaView();
100 addAction
.setToolTipText(actionLabel
);
102 toolBarManager
.add(addAction
);
104 return toolBarManager
.createControl(this);
108 * @see eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection#createCdmDetailElement(eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailSection, int)
111 protected AbstractCdmDetailElement
<MediaSpecimen
> createCdmDetailElement(AbstractCdmDetailSection
<MediaSpecimen
> parentElement
, int style
) {
112 mediaSpecimenGeneralDetailElement
= formFactory
.createMediaSpecimenGeneralDetailElement(parentElement
);
113 return mediaSpecimenGeneralDetailElement
;