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.view.e4.supplementaldata;
|
11
|
|
12
|
import org.eclipse.jface.viewers.ISelection;
|
13
|
import org.eclipse.swt.SWT;
|
14
|
import org.eclipse.ui.forms.widgets.ExpandableComposite;
|
15
|
|
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;
|
37
|
|
38
|
/**
|
39
|
*
|
40
|
* @author pplitzner
|
41
|
* @since Aug 10, 2017
|
42
|
*
|
43
|
*/
|
44
|
public class SupplementalDataViewerE4 extends AbstractCdmDataViewerE4 {
|
45
|
|
46
|
private boolean showDebug;
|
47
|
|
48
|
/** {@inheritDoc} */
|
49
|
@Override
|
50
|
public ISelection getSelection() {
|
51
|
return null;
|
52
|
}
|
53
|
|
54
|
/** {@inheritDoc} */
|
55
|
@Override
|
56
|
public void setSelection(ISelection selection, boolean reveal) {
|
57
|
|
58
|
}
|
59
|
|
60
|
/** {@inheritDoc} */
|
61
|
@Override
|
62
|
protected void showParts() {
|
63
|
|
64
|
showDebug = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_DEBUG_INFORMATION);
|
65
|
|
66
|
Object input;
|
67
|
|
68
|
if(getInput() instanceof IElementHasDetails){
|
69
|
input = ((IElementHasDetails) getInput()).getData();
|
70
|
}else{
|
71
|
input = getInput();
|
72
|
}
|
73
|
|
74
|
destroySections();
|
75
|
//1. Headline
|
76
|
createHeadlineSection(rootElement);
|
77
|
//2. Annotatable entitiy
|
78
|
if(input instanceof AnnotatableEntity){
|
79
|
createAnnotationSections(rootElement);
|
80
|
}
|
81
|
//3. Identifiable entity
|
82
|
if(input instanceof IdentifiableEntity){
|
83
|
createIdentifiableSections(rootElement);
|
84
|
}
|
85
|
//4. Identifiable media entity
|
86
|
if(input instanceof IdentifiableMediaEntity){
|
87
|
createIdentifiableMediaSections(rootElement);
|
88
|
}
|
89
|
//5. Versionable
|
90
|
if(input instanceof VersionableEntity){
|
91
|
createVersionSection(rootElement);
|
92
|
}
|
93
|
//6. CdmBase
|
94
|
if(showDebug){
|
95
|
createCdmBaseSection(rootElement);
|
96
|
}
|
97
|
|
98
|
layout();
|
99
|
}
|
100
|
|
101
|
private void createHeadlineSection(RootElement parent){
|
102
|
HeadlineSection headlineSection = formFactory.createHeadlineSection(parent);
|
103
|
addPart(headlineSection);
|
104
|
}
|
105
|
|
106
|
private void createAnnotationSections(RootElement parent) {
|
107
|
AnnotationSection annotationSection = formFactory.createAnnotationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
|
108
|
|
109
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
110
|
|
111
|
MarkerSection markerSection = formFactory.createMarkerSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
|
112
|
|
113
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
114
|
|
115
|
addPart(annotationSection);
|
116
|
addPart(markerSection);
|
117
|
}
|
118
|
|
119
|
private void createIdentifiableSections(RootElement parent) {
|
120
|
|
121
|
SourceSection sourceSection = formFactory.createSourceSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
|
122
|
|
123
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
124
|
|
125
|
IdentifierSection identifierSection = formFactory.createIdentifierDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
|
126
|
|
127
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
128
|
|
129
|
ExtensionSection extensionSection = formFactory.createExtensionSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
|
130
|
|
131
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
132
|
|
133
|
CreditSection creditSection = formFactory.createCreditSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
|
134
|
|
135
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
136
|
|
137
|
RightsSection rightsSection = formFactory.createRightsSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
|
138
|
|
139
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
140
|
|
141
|
addPart(sourceSection);
|
142
|
addPart(identifierSection);
|
143
|
addPart(extensionSection);
|
144
|
addPart(creditSection);
|
145
|
addPart(rightsSection);
|
146
|
|
147
|
}
|
148
|
|
149
|
private void createIdentifiableMediaSections(RootElement parent) {
|
150
|
MediaSection mediaSection = formFactory.createMediaSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
|
151
|
|
152
|
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
|
153
|
|
154
|
addPart(mediaSection);
|
155
|
}
|
156
|
|
157
|
private void createVersionSection(RootElement parent){
|
158
|
VersionSection versionSection = formFactory.createVersionSection(parent, ExpandableComposite.NO_TITLE | ExpandableComposite.EXPANDED);
|
159
|
addPart(versionSection);
|
160
|
}
|
161
|
|
162
|
private void createCdmBaseSection(RootElement parent) {
|
163
|
|
164
|
CdmBaseSection cdmBaseSection = formFactory.createCdmBaseSection(parent, ExpandableComposite.NO_TITLE | ExpandableComposite.EXPANDED);
|
165
|
addPart(cdmBaseSection);
|
166
|
}
|
167
|
|
168
|
@Override
|
169
|
public void update(CdmDataChangeMap arg0) {
|
170
|
}
|
171
|
}
|