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.swt.SWT;
19 import org.eclipse.swt.widgets.Composite;
20 import org.eclipse.ui.forms.widgets.ExpandableComposite;
21
22 import eu.etaxonomy.cdm.api.facade.DerivedUnitFacade;
23 import eu.etaxonomy.cdm.api.facade.DerivedUnitFacadeNotSupportedException;
24 import eu.etaxonomy.cdm.api.service.ITermService;
25 import eu.etaxonomy.cdm.model.agent.Person;
26 import eu.etaxonomy.cdm.model.agent.Team;
27 import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
28 import eu.etaxonomy.cdm.model.common.DefinedTermBase;
29 import eu.etaxonomy.cdm.model.common.Group;
30 import eu.etaxonomy.cdm.model.common.Marker;
31 import eu.etaxonomy.cdm.model.common.MarkerType;
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.PolytomousKey;
38 import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
39 import eu.etaxonomy.cdm.model.description.SpecimenDescription;
40 import eu.etaxonomy.cdm.model.media.Media;
41 import eu.etaxonomy.cdm.model.molecular.Amplification;
42 import eu.etaxonomy.cdm.model.molecular.Sequence;
43 import eu.etaxonomy.cdm.model.molecular.SingleRead;
44 import eu.etaxonomy.cdm.model.name.NonViralName;
45 import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
46 import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
47 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
48 import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
49 import eu.etaxonomy.cdm.model.reference.Reference;
50 import eu.etaxonomy.cdm.model.taxon.TaxonBase;
51 import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
52 import eu.etaxonomy.taxeditor.editor.UsageTermCollection;
53 import eu.etaxonomy.taxeditor.model.AbstractUtility;
54 import eu.etaxonomy.taxeditor.model.FeatureNodeContainer;
55 import eu.etaxonomy.taxeditor.model.PolytomousKeyRelationship;
56 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
57 import eu.etaxonomy.taxeditor.store.CdmStore;
58 import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
59 import eu.etaxonomy.taxeditor.ui.element.RootElement;
60 import eu.etaxonomy.taxeditor.ui.section.agent.PersonDetailSection;
61 import eu.etaxonomy.taxeditor.ui.section.agent.TeamDetailSection;
62 import eu.etaxonomy.taxeditor.ui.section.agent.TeamOrPersonBaseDetailSection;
63 import eu.etaxonomy.taxeditor.ui.section.common.ReferencedEntityDetailSection;
64 import eu.etaxonomy.taxeditor.ui.section.description.DescribedSpecimenSection;
65 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionDetailSection;
66 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementDetailSection;
67 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementMediaSection;
68 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionElementSourceSection;
69 import eu.etaxonomy.taxeditor.ui.section.description.DescriptionSourceSection;
70 import eu.etaxonomy.taxeditor.ui.section.description.MediaDetailsSection;
71 import eu.etaxonomy.taxeditor.ui.section.description.NaturalLanguageSection;
72 import eu.etaxonomy.taxeditor.ui.section.description.ScopeSection;
73 import eu.etaxonomy.taxeditor.ui.section.feature.FeatureDistributionDetailSection;
74 import eu.etaxonomy.taxeditor.ui.section.grantedAuthority.GrantedAuthorityDetailSection;
75 import eu.etaxonomy.taxeditor.ui.section.group.GroupDetailSection;
76 import eu.etaxonomy.taxeditor.ui.section.group.MemberDetailSection;
77 import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyDetailSection;
78 import eu.etaxonomy.taxeditor.ui.section.key.PolytomousKeyNodeDetailSection;
79 import eu.etaxonomy.taxeditor.ui.section.key.TaxonomicScopeSection;
80 import eu.etaxonomy.taxeditor.ui.section.name.NameRelationshipDetailSection;
81 import eu.etaxonomy.taxeditor.ui.section.name.NomenclaturalStatusSection;
82 import eu.etaxonomy.taxeditor.ui.section.name.NonViralNameDetailSection;
83 import eu.etaxonomy.taxeditor.ui.section.name.ProtologueSection;
84 import eu.etaxonomy.taxeditor.ui.section.name.TypeDesignationSection;
85 import eu.etaxonomy.taxeditor.ui.section.occurrence.AmplificationGeneralDetailSection;
86 import eu.etaxonomy.taxeditor.ui.section.occurrence.ArtworkGeneralDetailSection;
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.DnaSampleGeneralDetailSection;
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.LivingPlantPhotoGeneralDetailSection;
95 import eu.etaxonomy.taxeditor.ui.section.occurrence.PreservedSpecimenDetailSection;
96 import eu.etaxonomy.taxeditor.ui.section.occurrence.PreservedSpecimenDeterminationDetailSection;
97 import eu.etaxonomy.taxeditor.ui.section.occurrence.PreservedSpecimenGeneralDetailSection;
98 import eu.etaxonomy.taxeditor.ui.section.occurrence.SequenceGeneralDetailSection;
99 import eu.etaxonomy.taxeditor.ui.section.occurrence.SingleReadGeneralDetailSection;
100 import eu.etaxonomy.taxeditor.ui.section.occurrence.SpecimenScanGeneralDetailSection;
101 import eu.etaxonomy.taxeditor.ui.section.occurrence.TissueSampleGeneralDetailSection;
102 import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailSection;
103 import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailSection;
104 import eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessagesSection;
105 import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonBaseDetailSection;
106 import eu.etaxonomy.taxeditor.ui.section.taxon.TaxonRelationshipDetailSection;
107 import eu.etaxonomy.taxeditor.ui.section.user.GroupsByUserDetailSection;
108 import eu.etaxonomy.taxeditor.ui.section.user.UserDetailSection;
109 import eu.etaxonomy.taxeditor.ui.section.userecords.UseRecordDetailSection;
110 import eu.etaxonomy.taxeditor.ui.section.vocabulary.TermVocabularyDetailSection;
111 import eu.etaxonomy.taxeditor.view.AbstractCdmDataViewer;
112 import eu.etaxonomy.taxeditor.view.AbstractCdmViewPart;
113
114 /**
115 *
116 * The DetailsViewer handles the content of the details view (
117 * {@link DetailsViewPart}).<br>
118 * Depending on the type of the selected element the section of the details view
119 * are created.
120 *
121 * @author n.hoffmann
122 * @created Feb 12, 2010
123 * @version 1.0
124 */
125 public class DetailsViewer extends AbstractCdmDataViewer {
126
127 private ISelection selection;
128
129 /**
130 * <p>
131 * Constructor for DetailsViewer.
132 * </p>
133 *
134 * @param parent
135 * a {@link org.eclipse.swt.widgets.Composite} object.
136 * @param viewPart
137 * a {@link eu.etaxonomy.taxeditor.view.AbstractCdmViewPart}
138 * object.
139 */
140 public DetailsViewer(Composite parent, AbstractCdmViewPart viewPart) {
141 super(parent, viewPart);
142 }
143
144 // START HACK TO MAKE THE DERIVED UNIT FACADE WORK
145 // since we are getting implementations of DerivedUnitBase from the bulk
146 // editor
147 // and not derived unit facade objects,
148
149 /*
150 * (non-Javadoc)
151 *
152 * @see
153 * eu.etaxonomy.taxeditor.editor.view.AbstractCdmDataViewer#setInput(java
154 * .lang.Object)
155 */
156 @Override
157 public void setInput(Object input) {
158 if (input instanceof DerivedUnit) {
159 DerivedUnit derivedUnit = (DerivedUnit)input;
160 if(derivedUnit.getRecordBasis()==SpecimenOrObservationType.PreservedSpecimen
161 ||derivedUnit.getRecordBasis()==SpecimenOrObservationType.DnaSample){
162 // Do nothing! This is the case if the new DetailsViews are used that are based on
163 // the DerivedUnits themselves instead of the DerivedUnitFacade
164 }
165 else {
166 try {
167 input = DerivedUnitFacade.NewInstance(derivedUnit,
168 PreferencesUtil.getDerivedUnitConfigurator());
169 } catch (DerivedUnitFacadeNotSupportedException e) {
170 AbstractUtility.error(getClass(), e);
171 }
172 }
173 }
174 else if(input instanceof FieldUnit){
175 input = DerivedUnitFacade.NewInstance(SpecimenOrObservationType.FieldUnit, (FieldUnit) input);
176 }
177 super.setInput(input);
178 }
179
180 @Override
181 protected void markViewPartDirty() {
182 if (getInput() instanceof DerivedUnitFacade) {
183 DerivedUnitFacade facade = (DerivedUnitFacade) getInput();
184 if(facade.innerDerivedUnit()!=null){
185 getViewPart().changed(facade.innerDerivedUnit());
186 }
187 else if(facade.innerFieldUnit()!=null){
188 getViewPart().changed(facade.innerFieldUnit());
189 }
190 }
191
192 super.markViewPartDirty();
193 }
194
195 // END HACK TO MAKE THE DERIVED UNIT FACADE WORK
196
197 /*
198 * (non-Javadoc)
199 *
200 * @see org.eclipse.jface.viewers.Viewer#refresh()
201 */
202 /** {@inheritDoc} */
203 @Override
204 protected void showParts() {
205 // FIXME (CM) : Need to clean out this code.
206 // Too much type checking to decide which detail view to display.
207 // Need to build in a mechanism where navigators / editors are 'aware'
208 // of the corresponding detail viewer.
209 Object input = getInput();
210 if (input instanceof TaxonBase) {
211 createTaxonSections(rootElement);
212
213 } else if (input instanceof NonViralName) {
214 createNameSections(rootElement);
215
216 } else if (input instanceof Reference) {
217 createReferenceSections(rootElement);
218
219 } else if (input instanceof Team) {
220 createTeamDetailSection(rootElement);
221
222 } else if (input instanceof Person) {
223 createPersonDetailSection(rootElement);
224
225 } else if (input instanceof TeamOrPersonBase) {
226 createTeamOrPersonBaseDetailSection(rootElement);
227
228 } else if (input instanceof DescriptionBase) {
229 if(input instanceof SpecimenDescription){
230 //TODO: add more sections to DetailsView for SpecimenDescription
231 createSpecimenDescriptionSection(rootElement);
232 }
233 else{
234 Set<Marker> descriptionMarkers = ((DescriptionBase) input).getMarkers();
235 MarkerType useMarkertype = (MarkerType) CdmStore.getService(ITermService.class).find(
236 UsageTermCollection.uuidUseMarkerType);
237 Boolean isUseDescription = false;
238 for (Marker marker : descriptionMarkers) {
239 if (marker.getMarkerType().equals(useMarkertype)) {
240 isUseDescription = true;
241 }
242 }
243 if (((DescriptionBase) input).isImageGallery()) {
244 createImageGallerySection(rootElement);
245
246 } else if (isUseDescription) {
247 createUseDescriptionSection(rootElement);
248 } else {
249 createDescriptionSection(rootElement);
250
251 }
252 }
253 } else if (input instanceof DescriptionElementBase) {
254 Set<Marker> descriptionMarkers = ((DescriptionElementBase) input).getInDescription().getMarkers();
255 MarkerType useMarkertype = (MarkerType) CdmStore.getService(ITermService.class).find(
256 UsageTermCollection.uuidUseMarkerType);
257 Boolean isUseDescription = false;
258 for (Marker marker : descriptionMarkers) {
259 if (marker.getMarkerType().equals(useMarkertype)) {
260 isUseDescription = true;
261 }
262 }
263
264 if (isUseDescription == true && input instanceof CategoricalData) {
265 createUseRecordSection(rootElement);
266 } else {
267 createDescriptionElementSection(rootElement);
268 }
269
270 } else if (input instanceof Media) {
271 createMediaElementSection(rootElement);
272
273 } else if (input instanceof DerivedUnitFacade) {
274 if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.FieldUnit){
275 createFieldUnitSection(rootElement);
276 }
277 else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.PreservedSpecimen){
278 createDerivedUnitBaseElementSection(rootElement);
279 }
280 else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.TissueSample){
281 createTissueSampleSection(rootElement);
282 }
283 // else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.DnaSample){
284 // createDnaSampleSection(rootElement);
285 // }
286 //FIXME: change to specific SpecimenOrObservationType
287 else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.StillImage){
288 createSpecimenScanSection(rootElement);
289 }
290 else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.StillImage){
291 createLivingPlantPhotoSection(rootElement);
292 }
293 else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.StillImage){
294 createArtworkSection(rootElement);
295 }
296 else{
297 createDerivedUnitBaseElementSection(rootElement);
298 }
299 } else if (input instanceof SpecimenOrObservationBase){
300 SpecimenOrObservationType recordBasis = ((SpecimenOrObservationBase<?>) input).getRecordBasis();
301 if(recordBasis==SpecimenOrObservationType.PreservedSpecimen){
302 createPreservedSpecimenSpecimenSection(rootElement);
303 }
304 else if(recordBasis==SpecimenOrObservationType.FieldUnit){
305 createFieldUnitSection(rootElement);
306 }
307 else if(recordBasis==SpecimenOrObservationType.DnaSample){
308 createDnaSampleSection(rootElement);
309 }
310 }
311 else if(input instanceof Amplification){
312 createAmplificationSection(rootElement);
313 }
314 else if(input instanceof Sequence){
315 createSequenceSection(rootElement);
316 }
317 else if(input instanceof SingleRead){
318 createSingleReadSection(rootElement);
319 }
320 else if (input instanceof FeatureNodeContainer) {
321 createFeatureDistributionSection(rootElement);
322
323 } else if (input instanceof PolytomousKey) {
324 //createPolytomousKeySection(rootElement);
325
326 } else if ((input instanceof PolytomousKeyNode) || (input instanceof PolytomousKeyRelationship)) {
327 createPolytomousKeyNodeSection(rootElement);
328 } else if (input instanceof User) {
329 createUserSection(rootElement);
330 } else if (input instanceof Group) {
331 createGroupSection(rootElement);
332 } else if (input instanceof TaxonRelationship) {
333 createTaxonRelationshipSection(rootElement);
334 } else if (input instanceof TermVocabulary) {
335 createTermVocabularySection(rootElement);
336 } else if (input instanceof DefinedTermBase) {
337 createDefinedTermSection(rootElement);
338 } else {
339 destroySections();
340 }
341 layout();
342 }
343
344
345 /**
346 * @param rootElement
347 */
348 private void createGroupSection(RootElement parent) {
349 destroySections();
350
351 GroupDetailSection groupDetailSection = formFactory.createGroupDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE| ExpandableComposite.EXPANDED);
352 MemberDetailSection memberDetailSection = formFactory.createMemberDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
353 GrantedAuthorityDetailSection grantedAuthorityDetailSection = formFactory.createGrantedAuthorityDetailSection(getConversationHolder(), parent,ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
354
355 addPart(groupDetailSection);
356 addPart(memberDetailSection);
357 addPart(grantedAuthorityDetailSection);
358 }
359
360 /*
361 * (non-Javadoc)
362 *
363 * @see org.eclipse.jface.viewers.Viewer#getSelection()
364 */
365 /** {@inheritDoc} */
366 @Override
367 public ISelection getSelection() {
368 return selection;
369 }
370
371 /*
372 * (non-Javadoc)
373 *
374 * @see
375 * org.eclipse.jface.viewers.Viewer#setSelection(org.eclipse.jface.viewers
376 * .ISelection, boolean)
377 */
378 /** {@inheritDoc} */
379 @Override
380 public void setSelection(ISelection selection, boolean reveal) {
381 this.selection = selection;
382 SelectionChangedEvent selectionChangedEvent = new SelectionChangedEvent(this, selection);
383 fireSelectionChanged(selectionChangedEvent);
384 }
385
386 /**
387 * createTaxonSections(RootElement parent)
388 *
389 * @param parent
390 */
391 private void createTaxonSections(RootElement parent) {
392 destroySections();
393
394 TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
395
396 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
397
398 NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
399 | ExpandableComposite.EXPANDED);
400
401 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
402
403 NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
404
405 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
406
407 NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,ExpandableComposite.TWISTIE);
408
409 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
410
411 ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
412
413 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
414
415 TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
416
417 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
418
419 NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
420
421 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
422
423 ParsingMessagesSection parsingMessagesSection = formFactory.createParsingMessagesSection(getConversationHolder(), parent, this, ExpandableComposite.EXPANDED);
424
425 addPart(taxonBaseDetailSection);
426 addPart(nonViralNameSection);
427 addPart(nomenclaturalStatusSection);
428 addPart(protologSection);
429 addPart(referenceDetailSection);
430 addPart(typeDesignationSection);
431 addPart(nameRelationshipSection);
432 addPart(parsingMessagesSection);
433 }
434
435 /**
436 * createNameSections
437 *
438 * @param parent
439 */
440 private void createNameSections(RootElement parent) {
441 destroySections();
442 NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
443
444 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
445
446 NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
447
448 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
449
450 NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
451
452 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
453
454 ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
455
456 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
457
458 TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
459
460 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
461
462 NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
463
464 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
465
466 addPart(nonViralNameSection);
467 addPart(nomenclaturalStatusSection);
468 addPart(protologSection);
469 addPart(referenceDetailSection);
470 addPart(typeDesignationSection);
471 addPart(nameRelationshipSection);
472 }
473
474 /**
475 * createReferenceSections
476 *
477 * @param parent
478 */
479 private void createReferenceSections(RootElement parent) {
480 destroySections();
481
482 ReferenceDetailSection referenceDetailSection = formFactory.createReferenceDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
483
484 addPart(referenceDetailSection);
485 }
486
487 /**
488 * createTeamOrPersonBaseDetailSection
489 *
490 * @param parent
491 */
492 private void createTeamOrPersonBaseDetailSection(RootElement parent) {
493 destroySections();
494 TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection = formFactory.createTeamOrPersonBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
495
496 addPart(teamOrPersonBaseDetailSection);
497 }
498
499 /**
500 * createTeamDetailSection
501 *
502 * @param parent
503 */
504 private void createTeamDetailSection(RootElement parent) {
505 destroySections();
506 TeamDetailSection teamDetailSection = formFactory.createTeamDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
507
508 addPart(teamDetailSection);
509 }
510
511 /**
512 * createPersonDetailSection
513 *
514 * @param parent
515 */
516 private void createPersonDetailSection(RootElement parent) {
517 destroySections();
518 PersonDetailSection personDetailSection = formFactory.createPersonDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
519 addPart(personDetailSection);
520 }
521
522 /**
523 * createDescriptionElementSection
524 *
525 * @param parent
526 */
527 private void createDescriptionElementSection(RootElement parent) {
528 destroySections();
529
530 DescriptionElementDetailSection descriptionElementDetailSection = formFactory.createDescriptionElementDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
531
532 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
533
534 DescriptionElementSourceSection descriptionElementSourceSection = formFactory.createDescriptionElementSourceSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
535
536 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
537
538 DescriptionElementMediaSection descriptionElementMediaSection = formFactory.createDescriptionElementMediaSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
539
540 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
541
542 addPart(descriptionElementDetailSection);
543 addPart(descriptionElementSourceSection);
544 addPart(descriptionElementMediaSection);
545 }
546
547 /**
548 * createDescriptionSection
549 *
550 * @param parent
551 */
552 private void createDescriptionSection(RootElement parent) {
553 destroySections();
554 DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
555
556 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
557
558 NaturalLanguageSection naturalLanguageSection = formFactory.createNaturalLanguageSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
559
560 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
561
562 DescribedSpecimenSection describedSpecimenSection = formFactory.createDescribedSpecimenSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
563
564 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
565
566 // DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory
567 // .createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE,
568 // getConversationHolder(), parent, Section.TWISTIE);
569 //
570 // formFactory.createHorizontalSeparator(parent, SWT.BORDER);
571
572 ScopeSection scopeSection = formFactory.createScopeSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
573
574 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
575
576 addPart(descriptionDetailSection);
577 addPart(naturalLanguageSection);
578 addPart(describedSpecimenSection);
579 // addPart(descriptionSourceSection);
580 addPart(scopeSection);
581 }
582
583 /**
584 * createDescriptionSection
585 *
586 * @param parent
587 */
588 private void createSpecimenDescriptionSection(RootElement parent) {
589 destroySections();
590 DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
591 addPart(descriptionDetailSection);
592 }
593
594 /**
595 * Creates the use Description section
596 *
597 * @param parent
598 */
599 private void createUseDescriptionSection(RootElement parent) {
600 destroySections();
601 DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
602
603 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
604
605 DescriptionSourceSection descriptionSourceSection = formFactory.createDescriptionSourceSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
606
607 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
608
609 addPart(descriptionDetailSection);
610 addPart(descriptionSourceSection);
611
612 }
613
614
615 /**
616 * @param rootElement
617 */
618 private void createImageGallerySection(RootElement parent) {
619 destroySections();
620 DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
621
622 addPart(descriptionDetailSection);
623 }
624
625 /**
626 * createMediaElementSection
627 *
628 * @param parent
629 */
630
631 private void createMediaElementSection(RootElement parent) {
632 destroySections();
633 MediaDetailsSection mediaDetailSection = formFactory.createMediaDetailsSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
634
635 addPart(mediaDetailSection);
636 }
637
638 /**
639 * createDerivedUnitBaseElementSection
640 *
641 * @param parent
642 */
643 private void createDerivedUnitBaseElementSection(RootElement parent) {
644 destroySections();
645
646 DerivedUnitGeneralDetailSection derivedUnitGeneralDetailSection = formFactory.createDerivedUnitGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
647
648 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
649
650 GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
651
652 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
653
654 FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
655
656 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
657
658 DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = formFactory.createDerivedUnitBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
659
660 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
661
662 DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
663
664 addPart(derivedUnitGeneralDetailSection);
665 addPart(gatheringEventDetailSection);
666 addPart(fieldUnitDetailSection);
667 addPart(derivedUnitBaseDetailSection);
668 addPart(determinationDetailSection);
669
670 }
671
672 private void createFieldUnitSection(RootElement parent) {
673 destroySections();
674
675 FieldUnitGeneralDetailSection fielUnitGeneralDetailSection = formFactory.createFieldUnitGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
676
677 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
678
679 GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
680
681 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
682
683 FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
684
685 addPart(fielUnitGeneralDetailSection);
686 addPart(gatheringEventDetailSection);
687 addPart(fieldUnitDetailSection);
688 }
689
690 private void createPreservedSpecimenSpecimenSection(RootElement parent) {
691 destroySections();
692
693 PreservedSpecimenGeneralDetailSection section = formFactory.createPreservedSpecimenGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
694
695 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
696
697 PreservedSpecimenDetailSection derivedUnitBaseDetailSection = formFactory.createPreservedSpecimenDetailsSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
698
699 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
700
701 PreservedSpecimenDeterminationDetailSection determinationDetailSection = formFactory.createPreservedSpecimenDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
702
703 addPart(section);
704 addPart(derivedUnitBaseDetailSection);
705 addPart(determinationDetailSection);
706 }
707
708 private void createTissueSampleSection(RootElement parent) {
709 destroySections();
710
711 TissueSampleGeneralDetailSection section = formFactory.createTissueSampleGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
712
713 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
714
715 addPart(section);
716 }
717
718 private void createDnaSampleSection(RootElement parent) {
719 destroySections();
720 DnaSampleGeneralDetailSection section = formFactory.createDnaSampleGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
721
722 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
723
724 addPart(section);
725 }
726
727 private void createAmplificationSection(RootElement parent) {
728 destroySections();
729 AmplificationGeneralDetailSection section = formFactory.createAmplificationGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
730
731 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
732
733 addPart(section);
734 }
735
736 private void createSequenceSection(RootElement parent) {
737 destroySections();
738 SequenceGeneralDetailSection section = formFactory.createSequenceGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
739
740 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
741
742 addPart(section);
743 }
744
745 private void createSingleReadSection(RootElement parent) {
746 destroySections();
747 SingleReadGeneralDetailSection section = formFactory.createSingleReadGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
748
749 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
750
751 addPart(section);
752 }
753
754 private void createSpecimenScanSection(RootElement parent) {
755 destroySections();
756 SpecimenScanGeneralDetailSection section = formFactory.createSpecimenScanGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
757
758 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
759
760 addPart(section);
761 }
762
763 private void createLivingPlantPhotoSection(RootElement parent) {
764 destroySections();
765 LivingPlantPhotoGeneralDetailSection section = formFactory.createLivingPlantPhotoGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
766
767 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
768
769 addPart(section);
770 }
771
772 private void createArtworkSection(RootElement parent) {
773 destroySections();
774 ArtworkGeneralDetailSection section = formFactory.createArtworkGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
775
776 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
777
778 addPart(section);
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 }