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.
10 package eu
.etaxonomy
.taxeditor
.view
.e4
.supplementaldata
;
12 import org
.eclipse
.jface
.viewers
.ISelection
;
13 import org
.eclipse
.swt
.SWT
;
14 import org
.eclipse
.ui
.forms
.widgets
.ExpandableComposite
;
16 import eu
.etaxonomy
.cdm
.model
.common
.AnnotatableEntity
;
17 import eu
.etaxonomy
.cdm
.model
.common
.IdentifiableEntity
;
18 import eu
.etaxonomy
.cdm
.model
.common
.VersionableEntity
;
19 import eu
.etaxonomy
.cdm
.model
.media
.IdentifiableMediaEntity
;
20 import eu
.etaxonomy
.cdm
.persistence
.hibernate
.CdmDataChangeMap
;
21 import eu
.etaxonomy
.taxeditor
.model
.IElementHasDetails
;
22 import eu
.etaxonomy
.taxeditor
.preference
.IPreferenceKeys
;
23 import eu
.etaxonomy
.taxeditor
.preference
.PreferencesUtil
;
24 import eu
.etaxonomy
.taxeditor
.ui
.element
.RootElement
;
25 import eu
.etaxonomy
.taxeditor
.ui
.section
.media
.MediaSection
;
26 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.AnnotationSection
;
27 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.CdmBaseSection
;
28 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.CreditSection
;
29 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.ExtensionSection
;
30 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.HeadlineSection
;
31 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.MarkerSection
;
32 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.RightsSection
;
33 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.SourceSection
;
34 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.VersionSection
;
35 import eu
.etaxonomy
.taxeditor
.ui
.section
.supplemental
.identifier
.IdentifierSection
;
36 import eu
.etaxonomy
.taxeditor
.view
.e4
.AbstractCdmDataViewerE4
;
44 public class SupplementalDataViewerE4
extends AbstractCdmDataViewerE4
{
46 private boolean showDebug
;
50 public ISelection
getSelection() {
56 public void setSelection(ISelection selection
, boolean reveal
) {
62 protected void showParts() {
64 showDebug
= PreferencesUtil
.getPreferenceStore().getBoolean(IPreferenceKeys
.SHOW_DEBUG_INFORMATION
);
68 if(getInput() instanceof IElementHasDetails
){
69 input
= ((IElementHasDetails
) getInput()).getData();
76 createHeadlineSection(rootElement
);
77 //2. Annotatable entitiy
78 if(input
instanceof AnnotatableEntity
){
79 createAnnotationSections(rootElement
);
81 //3. Identifiable entity
82 if(input
instanceof IdentifiableEntity
){
83 createIdentifiableSections(rootElement
);
85 //4. Identifiable media entity
86 if(input
instanceof IdentifiableMediaEntity
){
87 createIdentifiableMediaSections(rootElement
);
90 if(input
instanceof VersionableEntity
){
91 createVersionSection(rootElement
);
95 createCdmBaseSection(rootElement
);
101 private void createHeadlineSection(RootElement parent
){
102 HeadlineSection headlineSection
= formFactory
.createHeadlineSection(parent
);
103 addPart(headlineSection
);
106 private void createAnnotationSections(RootElement parent
) {
107 AnnotationSection annotationSection
= formFactory
.createAnnotationSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
109 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
111 MarkerSection markerSection
= formFactory
.createMarkerSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
113 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
115 addPart(annotationSection
);
116 addPart(markerSection
);
119 private void createIdentifiableSections(RootElement parent
) {
121 SourceSection sourceSection
= formFactory
.createSourceSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
123 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
125 IdentifierSection identifierSection
= formFactory
.createIdentifierDetailSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
127 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
129 ExtensionSection extensionSection
= formFactory
.createExtensionSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
131 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
133 CreditSection creditSection
= formFactory
.createCreditSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
135 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
137 RightsSection rightsSection
= formFactory
.createRightsSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
139 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
141 addPart(sourceSection
);
142 addPart(identifierSection
);
143 addPart(extensionSection
);
144 addPart(creditSection
);
145 addPart(rightsSection
);
149 private void createIdentifiableMediaSections(RootElement parent
) {
150 MediaSection mediaSection
= formFactory
.createMediaSection(getConversationHolder(), parent
, ExpandableComposite
.TWISTIE
);
152 formFactory
.createHorizontalSeparator(parent
, SWT
.BORDER
);
154 addPart(mediaSection
);
157 private void createVersionSection(RootElement parent
){
158 VersionSection versionSection
= formFactory
.createVersionSection(parent
, ExpandableComposite
.NO_TITLE
| ExpandableComposite
.EXPANDED
);
159 addPart(versionSection
);
162 private void createCdmBaseSection(RootElement parent
) {
164 CdmBaseSection cdmBaseSection
= formFactory
.createCdmBaseSection(parent
, ExpandableComposite
.NO_TITLE
| ExpandableComposite
.EXPANDED
);
165 addPart(cdmBaseSection
);
169 public void update(CdmDataChangeMap arg0
) {