merge-update from trunk
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / view / detail / DetailsViewer.java
1
2 // $Id$
3 /**
4 * Copyright (C) 2011 EDIT
5 * European Distributed Institute of Taxonomy
6 * http://www.e-taxonomy.eu
7 *
8 * The contents of this file are subject to the Mozilla Public License Version 1.1
9 * See LICENSE.TXT at the top of this package for the full license terms.
10 */
11
12 package eu.etaxonomy.taxeditor.view.detail;
13
14 import java.util.Set;
15
16 import org.eclipse.jface.viewers.ISelection;
17 import org.eclipse.jface.viewers.SelectionChangedEvent;
18 import org.eclipse.jface.viewers.TreeNode;
19 import org.eclipse.swt.SWT;
20 import org.eclipse.swt.widgets.Composite;
21 import org.eclipse.ui.forms.widgets.ExpandableComposite;
22
23 import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
24 import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException;
25 import eu.etaxonomy.cdm.ext.occurrence.gbif.GbifResponse;
26 import eu.etaxonomy.cdm.model.agent.Person;
27 import eu.etaxonomy.cdm.model.agent.Team;
28 import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
29 import eu.etaxonomy.cdm.model.common.DefinedTermBase;
30 import eu.etaxonomy.cdm.model.common.Group;
31 import eu.etaxonomy.cdm.model.common.Marker;
32 import eu.etaxonomy.cdm.model.common.TermVocabulary;
33 import eu.etaxonomy.cdm.model.common.User;
34 import eu.etaxonomy.cdm.model.description.CategoricalData;
35 import eu.etaxonomy.cdm.model.description.DescriptionBase;
36 import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
37 import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
38 import eu.etaxonomy.cdm.model.description.SpecimenDescription;
39 import eu.etaxonomy.cdm.model.media.Media;
40 import eu.etaxonomy.cdm.model.molecular.DnaSample;
41 import eu.etaxonomy.cdm.model.molecular.Sequence;
42 import eu.etaxonomy.cdm.model.molecular.SingleRead;
43 import eu.etaxonomy.cdm.model.name.NonViralName;
44 import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
45 import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
46 import eu.etaxonomy.cdm.model.occurrence.MediaSpecimen;
47 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
48 import eu.etaxonomy.cdm.model.reference.Reference;
49 import eu.etaxonomy.cdm.model.taxon.TaxonBase;
50 import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
51 import eu.etaxonomy.taxeditor.model.AbstractUtility;
52 import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
53 import eu.etaxonomy.taxeditor.model.IDerivedUnitFacadePart;
54 import eu.etaxonomy.taxeditor.model.MessagingUtils;
55 import eu.etaxonomy.taxeditor.model.PolytomousKeyRelationship;
56 import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
57 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
58 import eu.etaxonomy.taxeditor.store.UsageTermCollection;
59 import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
60 import eu.etaxonomy.taxeditor.ui.element.RootElement;
61 import eu.etaxonomy.taxeditor.ui.section.agent.PersonDetailSection;
62 import eu.etaxonomy.taxeditor.ui.section.agent.TeamDetailSection;
63 import eu.etaxonomy.taxeditor.ui.section.agent.TeamOrPersonBaseDetailSection;
64 import eu.etaxonomy.taxeditor.ui.section.common.ReferencedEntityDetailSection;
65 import eu.etaxonomy.taxeditor.ui.section.description.DescribedSpecimenSection;
66 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionDetailSection;
67 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementDetailSection;
68 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementMediaSection;
69 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementSourceSection;
70 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionSourceSection;
71 import eu.etaxonomy.taxeditor.ui.section.description.MediaDetailsSection;
72 import eu.etaxonomy.taxeditor.ui.section.description.NaturalLanguageSection;
73 import eu.etaxonomy.taxeditor.ui.section.description.ScopeSection;
74 import eu.etaxonomy.taxeditor.ui.section.feature.FeatureDistributionDetailSection;
75 import eu.etaxonomy.taxeditor.ui.section.grantedAuthority.GrantedAuthorityDetailSection;
76 import eu.etaxonomy.taxeditor.ui.section.group.GroupDetailSection;
77 import eu.etaxonomy.taxeditor.ui.section.group.MemberDetailSection;
78 import eu.etaxonomy.taxeditor.ui.section.identifier.IdentifierDetailSection;
79 import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyDetailSection;
80 import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyNodeDetailSection;
81 import eu.etaxonomy.taxeditor.ui.section.key.TaxonomicScopeSection;
82 import eu.etaxonomy.taxeditor.ui.section.name.NameRelationshipDetailSection;
83 import eu.etaxonomy.taxeditor.ui.section.name.NomenclaturalStatusSection;
84 import eu.etaxonomy.taxeditor.ui.section.name.NonViralNameDetailSection;
85 import eu.etaxonomy.taxeditor.ui.section.name.ProtologueSection;
86 import eu.etaxonomy.taxeditor.ui.section.name.TypeDesignationSection;
87 import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitBaseDetailSection;
88 import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitGeneralDetailSection;
89 import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationDetailSection;
90 import eu.etaxonomy.taxeditor.ui.section.occurrence.EmptySection;
91 import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitDetailSection;
92 import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitGeneralDetailSection;
93 import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailSection;
94 import eu.etaxonomy.taxeditor.ui.section.occurrence.association.TaxonAssociationDetailSection;
95 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaQualityDetailSection;
96 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.DnaSampleGeneralDetailSection;
97 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SampleDesignationDetailSection;
98 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceContigFileCollectionDetailSection;
99 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceGeneralDetailSection;
100 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SequenceReferenceCollectionDetailSection;
101 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadGeneralDetailSection;
102 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.SingleReadPherogramCollectionDetailSection;
103 import eu.etaxonomy.taxeditor.ui.section.occurrence.dna.TissueSampleGeneralDetailSection;
104 import eu.etaxonomy.taxeditor.ui.section.occurrence.media.MediaSpecimenGeneralDetailSection;
105 import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailSection;
106 import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailSection;
107 import eu.etaxonomy.taxeditor.ui.section.supplemental.RightsSection;
108 import eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessagesSection;
109 import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonBaseDetailSection;
110 import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonRelationshipDetailSection;
111 import eu.etaxonomy.taxeditor.ui.section.user.GroupsByUserDetailSection;
112 import eu.etaxonomy.taxeditor.ui.section.user.UserDetailSection;
113 import eu.etaxonomy.taxeditor.ui.section.userecords.UseRecordDetailSection;
114 import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermVocabularyDetailSection;
115 import eu.etaxonomy.taxeditor.view.AbstractCdmDataViewer;
116 import eu.etaxonomy.taxeditor.view.AbstractCdmViewPart;
117
118 /**
119 *
120 * The DetailsViewer handles the content of the details view (
121 * {@link DetailsViewPart}).<br>
122 * Depending on the type of the selected element the section of the details view
123 * are created.
124 *
125 * @author n.hoffmann
126 * @created Feb 12, 2010
127 * @version 1.0
128 */
129 public class DetailsViewer extends AbstractCdmDataViewer {
130
131 private ISelection selection;
132
133 /**
134 * <p>
135 * Constructor for DetailsViewer.
136 * </p>
137 *
138 * @param parent
139 * a {@link org.eclipse.swt.widgets.Composite} object.
140 * @param viewPart
141 * a {@link eu.etaxonomy.taxeditor.view.AbstractCdmViewPart}
142 * object.
143 */
144 public DetailsViewer(Composite parent, AbstractCdmViewPart viewPart) {
145 super(parent, viewPart);
146 }
147
148 // START HACK TO MAKE THE DERIVED UNIT FACADE WORK
149 // since we are getting implementations of DerivedUnitBase from the bulk
150 // editor
151 // and not derived unit facade objects,
152
153 @Override
154 public void setInput(Object input) {
155 if(input instanceof TreeNode){
156 input = ((TreeNode) input).getValue();
157 }
158 if(input instanceof GbifResponse){
159 input = ((GbifResponse) input).getDerivedUnitFacade();
160 }
161 if (input.getClass().equals(DerivedUnit.class)) {
162 DerivedUnit derivedUnit = (DerivedUnit)input;
163 try {
164 input = DerivedUnitFacade.NewInstance(derivedUnit,
165 PreferencesUtil.getDerivedUnitConfigurator());
166 } catch (DerivedUnitFacadeNotSupportedException e) {
167 // MessagingUtils.error(getClass(), e); //nothing should happen, later on the Details View will show an according information that it is not possible to open this data
168 }
169 }
170 else if(input instanceof FieldUnit){
171 input = DerivedUnitFacade.NewInstance(SpecimenOrObservationType.FieldUnit, (FieldUnit) input);
172 }
173 super.setInput(input);
174 }
175
176 @Override
177 protected void markViewPartDirty() {
178 if (getInput() instanceof DerivedUnitFacade) {
179 DerivedUnitFacade facade = (DerivedUnitFacade) getInput();
180 if(facade.innerDerivedUnit()!=null){
181 getViewPart().changed(facade.innerDerivedUnit());
182 }
183 else if(facade.innerFieldUnit()!=null){
184 getViewPart().changed(facade.innerFieldUnit());
185 }
186 }
187 else{
188 super.markViewPartDirty();
189 }
190 }
191
192 // END HACK TO MAKE THE DERIVED UNIT FACADE WORK
193
194
195 /** {@inheritDoc} */
196 @Override
197 protected void showParts() {
198 // FIXME (CM) : Need to clean out this code.
199 // Too much type checking to decide which detail view to display.
200 // Need to build in a mechanism where navigators / editors are 'aware'
201 // of the corresponding detail viewer.
202 Object input = getInput();
203
204 destroySections();
205 if (input instanceof TaxonBase) {
206 createTaxonSections(rootElement);
207
208 } else if (input instanceof NonViralName) {
209 createNameSections(rootElement);
210
211 } else if (input instanceof Reference) {
212 createReferenceSections(rootElement);
213
214 } else if (input instanceof Team) {
215 createTeamDetailSection(rootElement);
216
217 } else if (input instanceof Person) {
218 createPersonDetailSection(rootElement);
219
220 } else if (input instanceof TeamOrPersonBase) {
221 createTeamOrPersonBaseDetailSection(rootElement);
222
223 } else if (input instanceof DescriptionBase) {
224 if(input instanceof SpecimenDescription){
225 //TODO: add more sections to DetailsView for SpecimenDescription
226 createSpecimenDescriptionSection(rootElement);
227 }
228 else{
229 Set<Marker> descriptionMarkers = ((DescriptionBase<?>) input).getMarkers();
230
231 Boolean isUseDescription = false;
232 for (Marker marker : descriptionMarkers) {
233 if (marker.getMarkerType()!= null && marker.getMarkerType().getUuid().equals(UsageTermCollection.uuidUseMarkerType)) {
234 isUseDescription = true;
235 }
236 }
237 if (((DescriptionBase<?>) input).isImageGallery()) {
238 createImageGallerySection(rootElement);
239
240 } else if (isUseDescription) {
241 createUseDescriptionSection(rootElement);
242 } else {
243 createDescriptionSection(rootElement);
244
245 }
246 }
247 } else if (input instanceof DescriptionElementBase) {
248 Set<Marker> descriptionMarkers = ((DescriptionElementBase) input).getInDescription().getMarkers();
249
250 Boolean isUseDescription = false;
251 for (Marker marker : descriptionMarkers) {
252 if (marker.getMarkerType()!= null && marker.getMarkerType().getUuid().equals(UsageTermCollection.uuidUseMarkerType)) {
253 isUseDescription = true;
254 }
255 }
256
257 if (isUseDescription == true && input instanceof CategoricalData) {
258 createUseRecordSection(rootElement);
259 } else {
260 createDescriptionElementSection(rootElement);
261 }
262
263 } else if (input instanceof Media) {
264 createMediaElementSection(rootElement);
265
266 } else if (input instanceof DerivedUnitFacade) {
267 if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.FieldUnit){
268 if(((DerivedUnitFacade) input).innerFieldUnit()==null){
269 MessagingUtils.error(DetailsViewer.class, "FieldUnit of facade is null", null);
270 }
271 else{
272 createFieldUnitSection(rootElement);
273 }
274 }
275 else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.PreservedSpecimen){
276 if(((DerivedUnitFacade) input).innerDerivedUnit()==null){
277 MessagingUtils.error(DetailsViewer.class, "DerivedUnit of facade is null", null);
278 }
279 else{
280 createDerivedUnitBaseElementSection(rootElement);
281 }
282 }
283 else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.TissueSample){
284 //TissueSample should only be created by using it's own class
285 //in future using only one class with different SpecimenOrObservationTypes is desired
286 // createTissueSampleSection(rootElement);
287 }
288 else{
289 createDerivedUnitBaseElementSection(rootElement);
290 }
291 } else if (input instanceof DnaSample){
292 DnaSample dnaSample = (DnaSample)input;
293 if(dnaSample.getRecordBasis()==SpecimenOrObservationType.TissueSample){
294 createTissueSampleSection(rootElement);
295 }
296 else if(dnaSample.getRecordBasis()==SpecimenOrObservationType.DnaSample){
297 createDnaSampleSection(rootElement);
298 }
299 } else if (input instanceof MediaSpecimen){
300 createMediaSpecimenSection(rootElement);
301 }
302 else if(input instanceof Sequence){
303 createSequenceSection(rootElement);
304 }
305 else if(input instanceof SingleRead){
306 createSingleReadSection(rootElement);
307 }
308 else if (input instanceof FeatureNodeContainer) {
309 createFeatureDistributionSection(rootElement);
310
311 }else if ((input instanceof PolytomousKeyNode) || (input instanceof PolytomousKeyRelationship)) {
312 createPolytomousKeyNodeSection(rootElement);
313 } else if (input instanceof User) {
314 createUserSection(rootElement);
315 } else if (input instanceof Group) {
316 createGroupSection(rootElement);
317 } else if (input instanceof TaxonRelationship) {
318 createTaxonRelationshipSection(rootElement);
319 } else if (input instanceof TermVocabulary) {
320 createTermVocabularySection(rootElement);
321 } else if (input instanceof DefinedTermBase) {
322 createDefinedTermSection(rootElement);
323 }
324 else {
325 createEmptySection(rootElement);
326 }
327 layout();
328 }
329
330
331 /**
332 * @param rootElement
333 */
334 private void createEmptySection(RootElement parent) {
335 destroySections();
336
337 EmptySection emptySection = formFactory.createEmptySection(formFactory, parent, SWT.NONE);
338
339 addPart(emptySection);
340 }
341
342 /**
343 * @param rootElement
344 */
345 private void createGroupSection(RootElement parent) {
346 destroySections();
347
348 GroupDetailSection groupDetailSection = formFactory.createGroupDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE| ExpandableComposite.EXPANDED);
349 MemberDetailSection memberDetailSection = formFactory.createMemberDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
350 GrantedAuthorityDetailSection grantedAuthorityDetailSection = formFactory.createGrantedAuthorityDetailSection(getConversationHolder(), parent,ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
351
352 addPart(groupDetailSection);
353 addPart(memberDetailSection);
354 addPart(grantedAuthorityDetailSection);
355 }
356
357 /*
358 * (non-Javadoc)
359 *
360 * @see org.eclipse.jface.viewers.Viewer#getSelection()
361 */
362 /** {@inheritDoc} */
363 @Override
364 public ISelection getSelection() {
365 return selection;
366 }
367
368 /** {@inheritDoc} */
369 @Override
370 public void setSelection(ISelection selection, boolean reveal) {
371 this.selection = selection;
372 if(this.selection!=null){
373 SelectionChangedEvent selectionChangedEvent = new SelectionChangedEvent(this, selection);
374 fireSelectionChanged(selectionChangedEvent);
375 }
376 }
377
378 /**
379 * createTaxonSections(RootElement parent)
380 *
381 * @param parent
382 */
383 private void createTaxonSections(RootElement parent) {
384 destroySections();
385
386 ParsingMessagesSection parsingMessagesSection = formFactory.createParsingMessagesSection(getConversationHolder(), parent, this,
387 ExpandableComposite.EXPANDED | ExpandableComposite.EXPANDED);
388
389 TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this,
390 ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
391 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
392
393 NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(getConversationHolder(), parent, this,
394 ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
395 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
396
397 NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
398 ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
399 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
400
401 NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
402 ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
403 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
404
405 //TODO RL
406 if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
407 ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
408 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
409
410 TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
411 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
412
413 NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
414 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
415
416 addPart(protologSection);
417 addPart(typeDesignationSection);
418 addPart(nameRelationshipSection);
419 }
420
421
422 addPart(parsingMessagesSection);
423 addPart(taxonBaseDetailSection);
424 addPart(nonViralNameSection);
425 addPart(nomenclaturalStatusSection);
426 addPart(referenceDetailSection);
427 }
428
429 /**
430 * createNameSections
431 *
432 * @param parent
433 */
434 private void createNameSections(RootElement parent) {
435 destroySections();
436 NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(getConversationHolder(), parent, this,
437 ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
438 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
439
440 NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
441 ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
442 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
443
444 NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,
445 ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
446 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
447
448 addPart(nonViralNameSection);
449 addPart(nomenclaturalStatusSection);
450 addPart(referenceDetailSection);
451 //TODO RL
452 if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.IS_RL)){
453 ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
454 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
455
456 TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
457 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
458
459 NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
460 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
461 addPart(protologSection);
462 addPart(typeDesignationSection);
463 addPart(nameRelationshipSection);
464 }
465 }
466
467 /**
468 * createReferenceSections
469 *
470 * @param parent
471 */
472 private void createReferenceSections(RootElement parent) {
473 destroySections();
474
475 ReferenceDetailSection referenceDetailSection = formFactory.createReferenceDetailSection(getConversationHolder(), parent, this,
476 ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
477
478 addPart(referenceDetailSection);
479 }
480
481 /**
482 * createTeamOrPersonBaseDetailSection
483 *
484 * @param parent
485 */
486 private void createTeamOrPersonBaseDetailSection(RootElement parent) {
487 destroySections();
488 TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection = formFactory.createTeamOrPersonBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
489
490 addPart(teamOrPersonBaseDetailSection);
491 }
492
493 /**
494 * createTeamDetailSection
495 *
496 * @param parent
497 */
498 private void createTeamDetailSection(RootElement parent) {
499 destroySections();
500 TeamDetailSection teamDetailSection = formFactory.createTeamDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
501
502 addPart(teamDetailSection);
503 }
504
505 /**
506 * createPersonDetailSection
507 *
508 * @param parent
509 */
510 private void createPersonDetailSection(RootElement parent) {
511 destroySections();
512 PersonDetailSection personDetailSection = formFactory.createPersonDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
513 addPart(personDetailSection);
514 }
515
516 /**
517 * createDescriptionElementSection
518 *
519 * @param parent
520 */
521 private void createDescriptionElementSection(RootElement parent) {
522 destroySections();
523
524 DescriptionElementDetailSection descriptionElementDetailSection = formFactory.createDescriptionElementDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
525
526 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
527
528 DescriptionElementSourceSection descriptionElementSourceSection = formFactory.createDescriptionElementSourceSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
529
530 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
531
532 DescriptionElementMediaSection descriptionElementMediaSection = formFactory.createDescriptionElementMediaSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
533
534 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
535
536 addPart(descriptionElementDetailSection);
537 addPart(descriptionElementSourceSection);
538 addPart(descriptionElementMediaSection);
539 }
540
541 /**
542 * createDescriptionSection
543 *
544 * @param parent
545 */
546 private void createDescriptionSection(RootElement parent) {
547 destroySections();
548 DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
549
550 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
551
552 NaturalLanguageSection naturalLanguageSection = formFactory.createNaturalLanguageSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
553
554 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
555
556 DescribedSpecimenSection describedSpecimenSection = formFactory.createDescribedSpecimenSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
557
558 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
559
560 // DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory
561 // .createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE,
562 // getConversationHolder(), parent, Section.TWISTIE);
563 //
564 // formFactory.createHorizontalSeparator(parent, SWT.BORDER);
565
566 ScopeSection scopeSection = formFactory.createScopeSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
567
568 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
569
570 addPart(descriptionDetailSection);
571 addPart(naturalLanguageSection);
572 addPart(describedSpecimenSection);
573 // addPart(descriptionSourceSection);
574 addPart(scopeSection);
575 }
576
577 /**
578 * createDescriptionSection
579 *
580 * @param parent
581 */
582 private void createSpecimenDescriptionSection(RootElement parent) {
583 destroySections();
584 DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
585 addPart(descriptionDetailSection);
586 }
587
588 /**
589 * Creates the use Description section
590 *
591 * @param parent
592 */
593 private void createUseDescriptionSection(RootElement parent) {
594 destroySections();
595 DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
596
597 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
598
599 DescriptionSourceSection descriptionSourceSection = formFactory.createDescriptionSourceSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
600
601 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
602
603 addPart(descriptionDetailSection);
604 addPart(descriptionSourceSection);
605
606 }
607
608
609 /**
610 * @param rootElement
611 */
612 private void createImageGallerySection(RootElement parent) {
613 destroySections();
614 DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
615
616 addPart(descriptionDetailSection);
617 }
618
619 /**
620 * createMediaElementSection
621 *
622 * @param parent
623 */
624
625 private void createMediaElementSection(RootElement parent) {
626 destroySections();
627
628 MediaDetailsSection mediaDetailSection = formFactory.createMediaDetailsSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
629
630 addPart(mediaDetailSection);
631 }
632
633 /**
634 * createDerivedUnitBaseElementSection
635 *
636 * @param parent
637 */
638 private void createDerivedUnitBaseElementSection(RootElement parent) {
639 destroySections();
640
641 DerivedUnitGeneralDetailSection derivedUnitGeneralDetailSection = formFactory.createDerivedUnitGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
642 //TODO for DerivateEditor do not use facade anymore to avoid this special case handling #4539
643 if(!(AbstractUtility.getActivePart() instanceof IDerivedUnitFacadePart)){
644 derivedUnitGeneralDetailSection.setShowOnlyDerivedUnitData(true);
645 }
646 addPart(derivedUnitGeneralDetailSection);
647
648 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
649
650 DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = formFactory.createDerivedUnitBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
651 addPart(derivedUnitBaseDetailSection);
652
653 //for editors working with facades
654 if(AbstractUtility.getActivePart() instanceof IDerivedUnitFacadePart){
655 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
656 GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
657 addPart(gatheringEventDetailSection);
658
659 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
660 FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
661 addPart(fieldUnitDetailSection);
662 }
663
664 if(!PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS)){
665 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
666 DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
667 addPart(determinationDetailSection);
668 }
669 if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_TAXON_ASSOCIATIONS)){
670 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
671 TaxonAssociationDetailSection taxonAssociationDetailSection = formFactory.createTaxonAssociationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
672 addPart(taxonAssociationDetailSection);
673 }
674
675 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
676 IdentifierDetailSection identifierDetailSection = formFactory.createIdentifierDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
677 addPart(identifierDetailSection);
678
679 }
680
681 private void createFieldUnitSection(RootElement parent) {
682 destroySections();
683
684 FieldUnitGeneralDetailSection fielUnitGeneralDetailSection = formFactory.createFieldUnitGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
685
686 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
687
688 GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
689
690 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
691
692 FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
693
694 addPart(fielUnitGeneralDetailSection);
695 addPart(gatheringEventDetailSection);
696 addPart(fieldUnitDetailSection);
697
698 if(PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DETERMINATION_ONLY_FOR_FIELD_UNITS)){
699 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
700 DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
701 addPart(determinationDetailSection);
702 }
703 }
704
705 private void createTissueSampleSection(RootElement parent) {
706 destroySections();
707
708 TissueSampleGeneralDetailSection section = formFactory.createTissueSampleGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
709
710 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
711
712 SampleDesignationDetailSection sampleDesignationDetailSection = formFactory.createSampleDesignationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
713
714 addPart(section);
715 addPart(sampleDesignationDetailSection);
716 }
717
718 private void createDnaSampleSection(RootElement parent) {
719 destroySections();
720
721 DnaSampleGeneralDetailSection section = formFactory.createDnaSampleGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
722
723 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
724
725 DnaQualityDetailSection qualitySection = formFactory.createDnaQualityDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
726
727 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
728
729 SampleDesignationDetailSection sampleDesignationDetailSection = formFactory.createSampleDesignationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
730
731 addPart(section);
732 addPart(qualitySection);
733 addPart(sampleDesignationDetailSection);
734 }
735
736 private void createSequenceSection(RootElement parent) {
737 destroySections();
738
739 SequenceGeneralDetailSection section = formFactory.createSequenceGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
740
741 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
742
743 SequenceReferenceCollectionDetailSection referenceSection = formFactory.createSequenceReferenceCollectionDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
744
745 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
746
747 SequenceContigFileCollectionDetailSection contigFileSection = formFactory.createSequenceContigFileCollectionDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
748
749
750 addPart(section);
751 addPart(referenceSection);
752 addPart(contigFileSection);
753 }
754
755 private void createSingleReadSection(RootElement parent) {
756 destroySections();
757
758 SingleReadGeneralDetailSection section = formFactory.createSingleReadGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
759 addPart(section);
760
761 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
762
763 SingleReadPherogramCollectionDetailSection pherogramSection = formFactory.createSingleReadPherogramCollectionDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
764 addPart(pherogramSection);
765
766 }
767
768 private void createMediaSpecimenSection(RootElement parent) {
769 destroySections();
770
771 MediaSpecimenGeneralDetailSection generalSection = formFactory.createMediaSpecimenGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
772 addPart(generalSection);
773
774 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
775
776 RightsSection rightsSection = formFactory.createRightsSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
777 addPart(rightsSection);
778
779 }
780
781
782
783 /**
784 * @param rootElement
785 */
786 private void createFeatureDistributionSection(RootElement parent) {
787 destroySections();
788
789 FeatureDistributionDetailSection featureDistributionSection = formFactory.createFeatureDistributionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
790
791 addPart(featureDistributionSection);
792 }
793
794 /**
795 * createPolytomousKeyNodeSection
796 *
797 * @param parent
798 */
799 private void createPolytomousKeyNodeSection(RootElement parent) {
800 destroySections();
801
802 PolytomousKeyDetailSection polytomousKeyDetailSection = formFactory.createPolytomousKeyDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.COMPACT);
803
804 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
805
806 PolytomousKeyNodeDetailSection polytomousKeyNodeDetailSection = formFactory.createPolytomousKeyNodeDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
807
808 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
809
810 TaxonomicScopeSection taxonomicScopeSection = formFactory.createTaxonomicScopeSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.COMPACT);
811
812 addPart(polytomousKeyDetailSection);
813 addPart(polytomousKeyNodeDetailSection);
814 addPart(taxonomicScopeSection);
815
816 }
817
818 /**
819 * create the UseRecordSection
820 *
821 * @param parent
822 */
823 private void createUseRecordSection(RootElement parent) {
824 destroySections();
825
826 UseRecordDetailSection descriptionUseRecordSection = formFactory.createUseRecordDetailSection(getConversationHolder(), parent, this,ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
827
828 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
829
830 addPart(descriptionUseRecordSection);
831
832
833 }
834
835 /**
836 * createUserSection
837 *
838 * @param parent
839 */
840 private void createUserSection(RootElement parent) {
841 destroySections();
842
843 UserDetailSection userDetailSection = formFactory.createUserDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
844
845 GroupsByUserDetailSection groupByUserDetailSection = formFactory.createGroupsByUserDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
846
847 addPart(userDetailSection);
848 addPart(groupByUserDetailSection);
849 }
850
851 /**
852 * createTaxonRelationshipSection
853 *
854 * @param parent
855 */
856 private void createTaxonRelationshipSection(RootElement parent) {
857 destroySections();
858
859 TaxonRelationshipDetailSection taxonRelationshipDetailSection = formFactory.createTaxonRelationshipDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
860
861 ReferencedEntityDetailSection referencedEntityBaseDetailSection = formFactory.createReferencedEntityDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
862 addPart(taxonRelationshipDetailSection);
863 addPart(referencedEntityBaseDetailSection);
864 }
865
866 /**
867 * @param rootElement
868 */
869 private void createTermVocabularySection(RootElement parent) {
870 destroySections();
871
872 TermVocabularyDetailSection termVocabularyDetailSection = formFactory.createTermVocabularyDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
873 addPart(termVocabularyDetailSection);
874 }
875
876 /**
877 * createDefinedTermSection
878 *
879 * @param parent
880 */
881 private void createDefinedTermSection(RootElement parent) {
882 destroySections();
883
884 AbstractFormSection<?> definedTermDetailSection = formFactory.createDefinedTermDetailSection(getInput().getClass(), getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
885 addPart(definedTermDetailSection);
886 }
887
888 }