c8214ee0b940bc6d51090d24660c6440161928e1
[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 else{
192 super.markViewPartDirty();
193 }
194 }
195
196 // END HACK TO MAKE THE DERIVED UNIT FACADE WORK
197
198 /*
199 * (non-Javadoc)
200 *
201 * @see org.eclipse.jface.viewers.Viewer#refresh()
202 */
203 /** {@inheritDoc} */
204 @Override
205 protected void showParts() {
206 // FIXME (CM) : Need to clean out this code.
207 // Too much type checking to decide which detail view to display.
208 // Need to build in a mechanism where navigators / editors are 'aware'
209 // of the corresponding detail viewer.
210 Object input = getInput();
211 if (input instanceof TaxonBase) {
212 createTaxonSections(rootElement);
213
214 } else if (input instanceof NonViralName) {
215 createNameSections(rootElement);
216
217 } else if (input instanceof Reference) {
218 createReferenceSections(rootElement);
219
220 } else if (input instanceof Team) {
221 createTeamDetailSection(rootElement);
222
223 } else if (input instanceof Person) {
224 createPersonDetailSection(rootElement);
225
226 } else if (input instanceof TeamOrPersonBase) {
227 createTeamOrPersonBaseDetailSection(rootElement);
228
229 } else if (input instanceof DescriptionBase) {
230 if(input instanceof SpecimenDescription){
231 //TODO: add more sections to DetailsView for SpecimenDescription
232 createSpecimenDescriptionSection(rootElement);
233 }
234 else{
235 Set<Marker> descriptionMarkers = ((DescriptionBase) input).getMarkers();
236 MarkerType useMarkertype = (MarkerType) CdmStore.getService(ITermService.class).find(
237 UsageTermCollection.uuidUseMarkerType);
238 Boolean isUseDescription = false;
239 for (Marker marker : descriptionMarkers) {
240 if (marker.getMarkerType().equals(useMarkertype)) {
241 isUseDescription = true;
242 }
243 }
244 if (((DescriptionBase) input).isImageGallery()) {
245 createImageGallerySection(rootElement);
246
247 } else if (isUseDescription) {
248 createUseDescriptionSection(rootElement);
249 } else {
250 createDescriptionSection(rootElement);
251
252 }
253 }
254 } else if (input instanceof DescriptionElementBase) {
255 Set<Marker> descriptionMarkers = ((DescriptionElementBase) input).getInDescription().getMarkers();
256 MarkerType useMarkertype = (MarkerType) CdmStore.getService(ITermService.class).find(
257 UsageTermCollection.uuidUseMarkerType);
258 Boolean isUseDescription = false;
259 for (Marker marker : descriptionMarkers) {
260 if (marker.getMarkerType().equals(useMarkertype)) {
261 isUseDescription = true;
262 }
263 }
264
265 if (isUseDescription == true && input instanceof CategoricalData) {
266 createUseRecordSection(rootElement);
267 } else {
268 createDescriptionElementSection(rootElement);
269 }
270
271 } else if (input instanceof Media) {
272 createMediaElementSection(rootElement);
273
274 } else if (input instanceof DerivedUnitFacade) {
275 if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.FieldUnit){
276 createFieldUnitSection(rootElement);
277 }
278 else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.PreservedSpecimen){
279 createDerivedUnitBaseElementSection(rootElement);
280 }
281 else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.TissueSample){
282 createTissueSampleSection(rootElement);
283 }
284 // else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.DnaSample){
285 // createDnaSampleSection(rootElement);
286 // }
287 //FIXME: change to specific SpecimenOrObservationType
288 else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.StillImage){
289 createSpecimenScanSection(rootElement);
290 }
291 else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.StillImage){
292 createLivingPlantPhotoSection(rootElement);
293 }
294 else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.StillImage){
295 createArtworkSection(rootElement);
296 }
297 else{
298 createDerivedUnitBaseElementSection(rootElement);
299 }
300 } else if (input instanceof SpecimenOrObservationBase){
301 SpecimenOrObservationType recordBasis = ((SpecimenOrObservationBase<?>) input).getRecordBasis();
302 if(recordBasis==SpecimenOrObservationType.PreservedSpecimen){
303 createPreservedSpecimenSpecimenSection(rootElement);
304 }
305 else if(recordBasis==SpecimenOrObservationType.FieldUnit){
306 createFieldUnitSection(rootElement);
307 }
308 else if(recordBasis==SpecimenOrObservationType.DnaSample){
309 createDnaSampleSection(rootElement);
310 }
311 }
312 else if(input instanceof Amplification){
313 createAmplificationSection(rootElement);
314 }
315 else if(input instanceof Sequence){
316 createSequenceSection(rootElement);
317 }
318 else if(input instanceof SingleRead){
319 createSingleReadSection(rootElement);
320 }
321 else if (input instanceof FeatureNodeContainer) {
322 createFeatureDistributionSection(rootElement);
323
324 } else if (input instanceof PolytomousKey) {
325 //createPolytomousKeySection(rootElement);
326
327 } else if ((input instanceof PolytomousKeyNode) || (input instanceof PolytomousKeyRelationship)) {
328 createPolytomousKeyNodeSection(rootElement);
329 } else if (input instanceof User) {
330 createUserSection(rootElement);
331 } else if (input instanceof Group) {
332 createGroupSection(rootElement);
333 } else if (input instanceof TaxonRelationship) {
334 createTaxonRelationshipSection(rootElement);
335 } else if (input instanceof TermVocabulary) {
336 createTermVocabularySection(rootElement);
337 } else if (input instanceof DefinedTermBase) {
338 createDefinedTermSection(rootElement);
339 } else {
340 destroySections();
341 }
342 layout();
343 }
344
345
346 /**
347 * @param rootElement
348 */
349 private void createGroupSection(RootElement parent) {
350 destroySections();
351
352 GroupDetailSection groupDetailSection = formFactory.createGroupDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE| ExpandableComposite.EXPANDED);
353 MemberDetailSection memberDetailSection = formFactory.createMemberDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
354 GrantedAuthorityDetailSection grantedAuthorityDetailSection = formFactory.createGrantedAuthorityDetailSection(getConversationHolder(), parent,ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
355
356 addPart(groupDetailSection);
357 addPart(memberDetailSection);
358 addPart(grantedAuthorityDetailSection);
359 }
360
361 /*
362 * (non-Javadoc)
363 *
364 * @see org.eclipse.jface.viewers.Viewer#getSelection()
365 */
366 /** {@inheritDoc} */
367 @Override
368 public ISelection getSelection() {
369 return selection;
370 }
371
372 /*
373 * (non-Javadoc)
374 *
375 * @see
376 * org.eclipse.jface.viewers.Viewer#setSelection(org.eclipse.jface.viewers
377 * .ISelection, boolean)
378 */
379 /** {@inheritDoc} */
380 @Override
381 public void setSelection(ISelection selection, boolean reveal) {
382 this.selection = selection;
383 SelectionChangedEvent selectionChangedEvent = new SelectionChangedEvent(this, selection);
384 fireSelectionChanged(selectionChangedEvent);
385 }
386
387 /**
388 * createTaxonSections(RootElement parent)
389 *
390 * @param parent
391 */
392 private void createTaxonSections(RootElement parent) {
393 destroySections();
394
395 TaxonBaseDetailSection taxonBaseDetailSection = formFactory.createTaxonBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
396
397 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
398
399 NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
400 | ExpandableComposite.EXPANDED);
401
402 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
403
404 NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
405
406 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
407
408 NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent,ExpandableComposite.TWISTIE);
409
410 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
411
412 ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
413
414 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
415
416 TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
417
418 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
419
420 NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
421
422 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
423
424 ParsingMessagesSection parsingMessagesSection = formFactory.createParsingMessagesSection(getConversationHolder(), parent, this, ExpandableComposite.EXPANDED);
425
426 addPart(taxonBaseDetailSection);
427 addPart(nonViralNameSection);
428 addPart(nomenclaturalStatusSection);
429 addPart(protologSection);
430 addPart(referenceDetailSection);
431 addPart(typeDesignationSection);
432 addPart(nameRelationshipSection);
433 addPart(parsingMessagesSection);
434 }
435
436 /**
437 * createNameSections
438 *
439 * @param parent
440 */
441 private void createNameSections(RootElement parent) {
442 destroySections();
443 NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
444
445 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
446
447 NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
448
449 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
450
451 NomenclaturalStatusSection nomenclaturalStatusSection = formFactory.createNomenclaturalStatusSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
452
453 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
454
455 ProtologueSection protologSection = formFactory.createProtologueSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
456
457 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
458
459 TypeDesignationSection typeDesignationSection = formFactory.createTypeDesignationSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
460
461 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
462
463 NameRelationshipDetailSection nameRelationshipSection = formFactory.createNameRelationshipDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
464
465 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
466
467 addPart(nonViralNameSection);
468 addPart(nomenclaturalStatusSection);
469 addPart(protologSection);
470 addPart(referenceDetailSection);
471 addPart(typeDesignationSection);
472 addPart(nameRelationshipSection);
473 }
474
475 /**
476 * createReferenceSections
477 *
478 * @param parent
479 */
480 private void createReferenceSections(RootElement parent) {
481 destroySections();
482
483 ReferenceDetailSection referenceDetailSection = formFactory.createReferenceDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
484
485 addPart(referenceDetailSection);
486 }
487
488 /**
489 * createTeamOrPersonBaseDetailSection
490 *
491 * @param parent
492 */
493 private void createTeamOrPersonBaseDetailSection(RootElement parent) {
494 destroySections();
495 TeamOrPersonBaseDetailSection teamOrPersonBaseDetailSection = formFactory.createTeamOrPersonBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
496
497 addPart(teamOrPersonBaseDetailSection);
498 }
499
500 /**
501 * createTeamDetailSection
502 *
503 * @param parent
504 */
505 private void createTeamDetailSection(RootElement parent) {
506 destroySections();
507 TeamDetailSection teamDetailSection = formFactory.createTeamDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
508
509 addPart(teamDetailSection);
510 }
511
512 /**
513 * createPersonDetailSection
514 *
515 * @param parent
516 */
517 private void createPersonDetailSection(RootElement parent) {
518 destroySections();
519 PersonDetailSection personDetailSection = formFactory.createPersonDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
520 addPart(personDetailSection);
521 }
522
523 /**
524 * createDescriptionElementSection
525 *
526 * @param parent
527 */
528 private void createDescriptionElementSection(RootElement parent) {
529 destroySections();
530
531 DescriptionElementDetailSection descriptionElementDetailSection = formFactory.createDescriptionElementDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
532
533 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
534
535 DescriptionElementSourceSection descriptionElementSourceSection = formFactory.createDescriptionElementSourceSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
536
537 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
538
539 DescriptionElementMediaSection descriptionElementMediaSection = formFactory.createDescriptionElementMediaSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
540
541 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
542
543 addPart(descriptionElementDetailSection);
544 addPart(descriptionElementSourceSection);
545 addPart(descriptionElementMediaSection);
546 }
547
548 /**
549 * createDescriptionSection
550 *
551 * @param parent
552 */
553 private void createDescriptionSection(RootElement parent) {
554 destroySections();
555 DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
556
557 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
558
559 NaturalLanguageSection naturalLanguageSection = formFactory.createNaturalLanguageSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
560
561 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
562
563 DescribedSpecimenSection describedSpecimenSection = formFactory.createDescribedSpecimenSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
564
565 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
566
567 // DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory
568 // .createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE,
569 // getConversationHolder(), parent, Section.TWISTIE);
570 //
571 // formFactory.createHorizontalSeparator(parent, SWT.BORDER);
572
573 ScopeSection scopeSection = formFactory.createScopeSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
574
575 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
576
577 addPart(descriptionDetailSection);
578 addPart(naturalLanguageSection);
579 addPart(describedSpecimenSection);
580 // addPart(descriptionSourceSection);
581 addPart(scopeSection);
582 }
583
584 /**
585 * createDescriptionSection
586 *
587 * @param parent
588 */
589 private void createSpecimenDescriptionSection(RootElement parent) {
590 destroySections();
591 DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
592 addPart(descriptionDetailSection);
593 }
594
595 /**
596 * Creates the use Description section
597 *
598 * @param parent
599 */
600 private void createUseDescriptionSection(RootElement parent) {
601 destroySections();
602 DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
603
604 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
605
606 DescriptionSourceSection descriptionSourceSection = formFactory.createDescriptionSourceSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
607
608 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
609
610 addPart(descriptionDetailSection);
611 addPart(descriptionSourceSection);
612
613 }
614
615
616 /**
617 * @param rootElement
618 */
619 private void createImageGallerySection(RootElement parent) {
620 destroySections();
621 DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
622
623 addPart(descriptionDetailSection);
624 }
625
626 /**
627 * createMediaElementSection
628 *
629 * @param parent
630 */
631
632 private void createMediaElementSection(RootElement parent) {
633 destroySections();
634 MediaDetailsSection mediaDetailSection = formFactory.createMediaDetailsSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
635
636 addPart(mediaDetailSection);
637 }
638
639 /**
640 * createDerivedUnitBaseElementSection
641 *
642 * @param parent
643 */
644 private void createDerivedUnitBaseElementSection(RootElement parent) {
645 destroySections();
646
647 DerivedUnitGeneralDetailSection derivedUnitGeneralDetailSection = formFactory.createDerivedUnitGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
648
649 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
650
651 GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
652
653 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
654
655 FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
656
657 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
658
659 DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = formFactory.createDerivedUnitBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
660
661 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
662
663 DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
664
665 addPart(derivedUnitGeneralDetailSection);
666 addPart(gatheringEventDetailSection);
667 addPart(fieldUnitDetailSection);
668 addPart(derivedUnitBaseDetailSection);
669 addPart(determinationDetailSection);
670
671 }
672
673 private void createFieldUnitSection(RootElement parent) {
674 destroySections();
675
676 FieldUnitGeneralDetailSection fielUnitGeneralDetailSection = formFactory.createFieldUnitGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
677
678 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
679
680 GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
681
682 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
683
684 FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
685
686 addPart(fielUnitGeneralDetailSection);
687 addPart(gatheringEventDetailSection);
688 addPart(fieldUnitDetailSection);
689 }
690
691 private void createPreservedSpecimenSpecimenSection(RootElement parent) {
692 destroySections();
693
694 PreservedSpecimenGeneralDetailSection section = formFactory.createPreservedSpecimenGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
695
696 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
697
698 PreservedSpecimenDetailSection derivedUnitBaseDetailSection = formFactory.createPreservedSpecimenDetailsSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
699
700 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
701
702 PreservedSpecimenDeterminationDetailSection determinationDetailSection = formFactory.createPreservedSpecimenDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
703
704 addPart(section);
705 addPart(derivedUnitBaseDetailSection);
706 addPart(determinationDetailSection);
707 }
708
709 private void createTissueSampleSection(RootElement parent) {
710 destroySections();
711
712 TissueSampleGeneralDetailSection section = formFactory.createTissueSampleGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
713
714 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
715
716 addPart(section);
717 }
718
719 private void createDnaSampleSection(RootElement parent) {
720 destroySections();
721 DnaSampleGeneralDetailSection section = formFactory.createDnaSampleGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
722
723 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
724
725 addPart(section);
726 }
727
728 private void createAmplificationSection(RootElement parent) {
729 destroySections();
730 AmplificationGeneralDetailSection section = formFactory.createAmplificationGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
731
732 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
733
734 addPart(section);
735 }
736
737 private void createSequenceSection(RootElement parent) {
738 destroySections();
739 SequenceGeneralDetailSection section = formFactory.createSequenceGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
740
741 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
742
743 addPart(section);
744 }
745
746 private void createSingleReadSection(RootElement parent) {
747 destroySections();
748 SingleReadGeneralDetailSection section = formFactory.createSingleReadGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
749
750 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
751
752 addPart(section);
753 }
754
755 private void createSpecimenScanSection(RootElement parent) {
756 destroySections();
757 SpecimenScanGeneralDetailSection section = formFactory.createSpecimenScanGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
758
759 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
760
761 addPart(section);
762 }
763
764 private void createLivingPlantPhotoSection(RootElement parent) {
765 destroySections();
766 LivingPlantPhotoGeneralDetailSection section = formFactory.createLivingPlantPhotoGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
767
768 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
769
770 addPart(section);
771 }
772
773 private void createArtworkSection(RootElement parent) {
774 destroySections();
775 ArtworkGeneralDetailSection section = formFactory.createArtworkGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
776
777 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
778
779 addPart(section);
780 }
781
782
783
784 /**
785 * @param rootElement
786 */
787 private void createFeatureDistributionSection(RootElement parent) {
788 destroySections();
789
790 FeatureDistributionDetailSection featureDistributionSection = formFactory.createFeatureDistributionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
791
792 addPart(featureDistributionSection);
793 }
794
795 /**
796 * createPolytomousKeyNodeSection
797 *
798 * @param parent
799 */
800 private void createPolytomousKeyNodeSection(RootElement parent) {
801 destroySections();
802
803 PolytomousKeyDetailSection polytomousKeyDetailSection = formFactory.createPolytomousKeyDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.COMPACT);
804
805 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
806
807 PolytomousKeyNodeDetailSection polytomousKeyNodeDetailSection = formFactory.createPolytomousKeyNodeDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
808
809 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
810
811 TaxonomicScopeSection taxonomicScopeSection = formFactory.createTaxonomicScopeSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.COMPACT);
812
813 addPart(polytomousKeyDetailSection);
814 addPart(polytomousKeyNodeDetailSection);
815 addPart(taxonomicScopeSection);
816
817 }
818
819 /**
820 * create the UseRecordSection
821 *
822 * @param parent
823 */
824 private void createUseRecordSection(RootElement parent) {
825 destroySections();
826
827 UseRecordDetailSection descriptionUseRecordSection = formFactory.createUseRecordDetailSection(getConversationHolder(), parent, this,ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
828
829 formFactory.createHorizontalSeparator(parent, SWT.BORDER);
830
831 addPart(descriptionUseRecordSection);
832
833
834 }
835
836 /**
837 * createUserSection
838 *
839 * @param parent
840 */
841 private void createUserSection(RootElement parent) {
842 destroySections();
843
844 UserDetailSection userDetailSection = formFactory.createUserDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
845
846 GroupsByUserDetailSection groupByUserDetailSection = formFactory.createGroupsByUserDetailSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
847
848 addPart(userDetailSection);
849 addPart(groupByUserDetailSection);
850 }
851
852 /**
853 * createTaxonRelationshipSection
854 *
855 * @param parent
856 */
857 private void createTaxonRelationshipSection(RootElement parent) {
858 destroySections();
859
860 TaxonRelationshipDetailSection taxonRelationshipDetailSection = formFactory.createTaxonRelationshipDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
861
862 ReferencedEntityDetailSection referencedEntityBaseDetailSection = formFactory.createReferencedEntityDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
863 addPart(taxonRelationshipDetailSection);
864 addPart(referencedEntityBaseDetailSection);
865 }
866
867 /**
868 * @param rootElement
869 */
870 private void createTermVocabularySection(RootElement parent) {
871 destroySections();
872
873 TermVocabularyDetailSection termVocabularyDetailSection = formFactory.createTermVocabularyDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
874 addPart(termVocabularyDetailSection);
875 }
876
877 /**
878 * createDefinedTermSection
879 *
880 * @param parent
881 */
882 private void createDefinedTermSection(RootElement parent) {
883 destroySections();
884
885 AbstractFormSection definedTermDetailSection = formFactory.createDefinedTermDetailSection(getInput().getClass(), getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
886 addPart(definedTermDetailSection);
887 }
888
889 }