+
// $Id$
/**
* Copyright (C) 2011 EDIT
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
import eu.etaxonomy.cdm.model.description.PolytomousKey;
import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
+import eu.etaxonomy.cdm.model.description.SpecimenDescription;
import eu.etaxonomy.cdm.model.media.Media;
+import eu.etaxonomy.cdm.model.molecular.Amplification;
+import eu.etaxonomy.cdm.model.molecular.Sequence;
+import eu.etaxonomy.cdm.model.molecular.SingleRead;
import eu.etaxonomy.cdm.model.name.NonViralName;
import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
+import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
import eu.etaxonomy.cdm.model.reference.Reference;
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
import eu.etaxonomy.taxeditor.model.PolytomousKeyRelationship;
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
import eu.etaxonomy.taxeditor.store.CdmStore;
-import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.FieldObservationDetailsSection;
-import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.FieldObservationGeneralSection;
-import eu.etaxonomy.taxeditor.ui.campanula.detailViews.fieldObservation.GatheringEventSection;
-import eu.etaxonomy.taxeditor.ui.campanula.detailViews.specimen.DerivedUnitDetailsSection;
-import eu.etaxonomy.taxeditor.ui.campanula.detailViews.specimen.SpecimenDetailsSection;
-import eu.etaxonomy.taxeditor.ui.campanula.detailViews.specimen.SpecimenGeneralSection;
import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
import eu.etaxonomy.taxeditor.ui.element.RootElement;
import eu.etaxonomy.taxeditor.ui.section.agent.PersonDetailSection;
import eu.etaxonomy.taxeditor.ui.section.name.NonViralNameDetailSection;
import eu.etaxonomy.taxeditor.ui.section.name.ProtologueSection;
import eu.etaxonomy.taxeditor.ui.section.name.TypeDesignationSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.AmplificationCloningDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.AmplificationGeneralDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.AmplificationPrimerDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.ArtworkGeneralDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitBaseDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.DerivedUnitGeneralDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.DeterminationDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.DnaSampleGeneralDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.FieldUnitGeneralDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.GatheringEventDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.LivingPlantPhotoGeneralDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.PreservedSpecimenDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.PreservedSpecimenDeterminationDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.PreservedSpecimenGeneralDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.SequenceGeneralDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.SingleReadGeneralDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.SpecimenScanGeneralDetailSection;
+import eu.etaxonomy.taxeditor.ui.section.occurrence.TissueSampleGeneralDetailSection;
import eu.etaxonomy.taxeditor.ui.section.reference.NomenclaturalReferenceDetailSection;
import eu.etaxonomy.taxeditor.ui.section.reference.ReferenceDetailSection;
import eu.etaxonomy.taxeditor.ui.section.taxon.ParsingMessagesSection;
*/
@Override
public void setInput(Object input) {
- if (input instanceof DerivedUnit) {
- try {
- input = DerivedUnitFacade.NewInstance((DerivedUnit) input,PreferencesUtil.getDerivedUnitConfigurator());
- } catch (DerivedUnitFacadeNotSupportedException e) {
- AbstractUtility.error(getClass(), e);
+ if (input instanceof DerivedUnit) {
+ DerivedUnit derivedUnit = (DerivedUnit)input;
+ if(derivedUnit.getRecordBasis()==SpecimenOrObservationType.PreservedSpecimen
+ ||derivedUnit.getRecordBasis()==SpecimenOrObservationType.DnaSample){
+ // Do nothing! This is the case if the new DetailsViews are used that are based on
+ // the DerivedUnits themselves instead of the DerivedUnitFacade
+ }
+ else {
+ try {
+ input = DerivedUnitFacade.NewInstance(derivedUnit,
+ PreferencesUtil.getDerivedUnitConfigurator());
+ } catch (DerivedUnitFacadeNotSupportedException e) {
+ AbstractUtility.error(getClass(), e);
+ }
}
}
- else if(input instanceof FieldUnit){
- input = DerivedUnitFacade.NewInstance(SpecimenOrObservationType.FieldUnit, (FieldUnit) input,PreferencesUtil.getDerivedUnitConfigurator());
- }
+ else if(input instanceof FieldUnit){
+ input = DerivedUnitFacade.NewInstance(SpecimenOrObservationType.FieldUnit, (FieldUnit) input);
+ }
super.setInput(input);
}
@Override
protected void markViewPartDirty() {
if (getInput() instanceof DerivedUnitFacade) {
- DerivedUnitFacade derivedUnitFacade = (DerivedUnitFacade) getInput();
- DerivedUnit innerDerivedUnit = derivedUnitFacade.innerDerivedUnit();
- FieldUnit innerFieldUnit = derivedUnitFacade.innerFieldUnit();
- if(innerDerivedUnit!=null){
- getViewPart().changed(innerDerivedUnit);
+ DerivedUnitFacade facade = (DerivedUnitFacade) getInput();
+ if(facade.innerDerivedUnit()!=null){
+ getViewPart().changed(facade.innerDerivedUnit());
}
- else if(innerFieldUnit!=null){
- getViewPart().changed(innerFieldUnit);
+ else if(facade.innerFieldUnit()!=null){
+ getViewPart().changed(facade.innerFieldUnit());
}
}
-
- super.markViewPartDirty();
+ else{
+ super.markViewPartDirty();
+ }
}
// END HACK TO MAKE THE DERIVED UNIT FACADE WORK
createTeamOrPersonBaseDetailSection(rootElement);
} else if (input instanceof DescriptionBase) {
- Set<Marker> descriptionMarkers = ((DescriptionBase) input).getMarkers();
- MarkerType useMarkertype = (MarkerType) CdmStore.getService(ITermService.class).find(
- UsageTermCollection.uuidUseMarkerType);
- Boolean isUseDescription = false;
- for (Marker marker : descriptionMarkers) {
- if (marker.getMarkerType().equals(useMarkertype)) {
- isUseDescription = true;
- }
+ if(input instanceof SpecimenDescription){
+ //TODO: add more sections to DetailsView for SpecimenDescription
+ createSpecimenDescriptionSection(rootElement);
}
- if (((DescriptionBase) input).isImageGallery()) {
- createImageGallerySection(rootElement);
+ else{
+ Set<Marker> descriptionMarkers = ((DescriptionBase) input).getMarkers();
+ MarkerType useMarkertype = (MarkerType) CdmStore.getService(ITermService.class).find(
+ UsageTermCollection.uuidUseMarkerType);
+ Boolean isUseDescription = false;
+ for (Marker marker : descriptionMarkers) {
+ if (marker.getMarkerType().equals(useMarkertype)) {
+ isUseDescription = true;
+ }
+ }
+ if (((DescriptionBase) input).isImageGallery()) {
+ createImageGallerySection(rootElement);
- } else if (isUseDescription) {
- createUseDescriptionSection(rootElement);
- } else {
- createDescriptionSection(rootElement);
+ } else if (isUseDescription) {
+ createUseDescriptionSection(rootElement);
+ } else {
+ createDescriptionSection(rootElement);
+ }
}
} else if (input instanceof DescriptionElementBase) {
Set<Marker> descriptionMarkers = ((DescriptionElementBase) input).getInDescription().getMarkers();
createMediaElementSection(rootElement);
} else if (input instanceof DerivedUnitFacade) {
- DerivedUnitFacade derivedUnitFacade = (DerivedUnitFacade)input;
-
- if(derivedUnitFacade.getType()==SpecimenOrObservationType.FieldUnit){
- createFieldObservationDetailsView(rootElement);
- } else{
- createSpecimenDetailsView(rootElement);
+ if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.FieldUnit){
+ createFieldUnitSection(rootElement);
+ }
+ else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.PreservedSpecimen){
+ createDerivedUnitBaseElementSection(rootElement);
+ }
+ else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.TissueSample){
+ createTissueSampleSection(rootElement);
+ }
+ // else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.DnaSample){
+ // createDnaSampleSection(rootElement);
+ // }
+ //FIXME: change to specific SpecimenOrObservationType
+ else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.StillImage){
+ createSpecimenScanSection(rootElement);
+ }
+ else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.StillImage){
+ createLivingPlantPhotoSection(rootElement);
}
- } else if (input instanceof FeatureNodeContainer) {
+ else if(((DerivedUnitFacade) input).getType()==SpecimenOrObservationType.StillImage){
+ createArtworkSection(rootElement);
+ }
+ else{
+ createDerivedUnitBaseElementSection(rootElement);
+ }
+ } else if (input instanceof SpecimenOrObservationBase){
+ SpecimenOrObservationType recordBasis = ((SpecimenOrObservationBase<?>) input).getRecordBasis();
+ if(recordBasis==SpecimenOrObservationType.PreservedSpecimen){
+ createPreservedSpecimenSpecimenSection(rootElement);
+ }
+ else if(recordBasis==SpecimenOrObservationType.FieldUnit){
+ createFieldUnitSection(rootElement);
+ }
+ else if(recordBasis==SpecimenOrObservationType.DnaSample){
+ createDnaSampleSection(rootElement);
+ }
+ }
+ else if(input instanceof Amplification){
+ createAmplificationSection(rootElement);
+ }
+ else if(input instanceof Sequence){
+ createSequenceSection(rootElement);
+ }
+ else if(input instanceof SingleRead){
+ createSingleReadSection(rootElement);
+ }
+ else if (input instanceof FeatureNodeContainer) {
createFeatureDistributionSection(rootElement);
} else if (input instanceof PolytomousKey) {
- // createPolytomousKeySection(rootElement);
+ //createPolytomousKeySection(rootElement);
} else if ((input instanceof PolytomousKeyNode) || (input instanceof PolytomousKeyRelationship)) {
createPolytomousKeyNodeSection(rootElement);
layout();
}
+
/**
* @param rootElement
*/
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE
- | ExpandableComposite.EXPANDED);
+ | ExpandableComposite.EXPANDED);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-// DescriptionSourceSection descriptionSourceSection = formFactory.createDescriptionSourceSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
-//
-// formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+ // DescriptionSourceSection descriptionSourceSection = (DescriptionSourceSection) formFactory
+ // .createEntityDetailSection(EntityDetailType.DESCRIPTIONSOURCE,
+ // getConversationHolder(), parent, Section.TWISTIE);
+ //
+ // formFactory.createHorizontalSeparator(parent, SWT.BORDER);
ScopeSection scopeSection = formFactory.createScopeSection(getConversationHolder(), parent, ExpandableComposite.TWISTIE);
addPart(descriptionDetailSection);
addPart(naturalLanguageSection);
addPart(describedSpecimenSection);
-// addPart(descriptionSourceSection);
+ // addPart(descriptionSourceSection);
addPart(scopeSection);
}
+ /**
+ * createDescriptionSection
+ *
+ * @param parent
+ */
+ private void createSpecimenDescriptionSection(RootElement parent) {
+ destroySections();
+ DescriptionDetailSection descriptionDetailSection = formFactory.createDescriptionDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+ addPart(descriptionDetailSection);
+ }
+
/**
* Creates the use Description section
*
}
+
/**
* @param rootElement
*/
*
* @param parent
*/
- private void createFieldObservationDetailsView(RootElement parent) {
+ private void createDerivedUnitBaseElementSection(RootElement parent) {
destroySections();
- FieldObservationGeneralSection fieldObservationSection = formFactory.createFieldObservationGeneralSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+ DerivedUnitGeneralDetailSection derivedUnitGeneralDetailSection = formFactory.createDerivedUnitGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+
+ GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- GatheringEventSection gatheringEventDetailSection = formFactory.createGatheringEventSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
+ FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- FieldObservationDetailsSection fieldObservationDetailSection = formFactory.createFieldObservationDetailsSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
+ DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = formFactory.createDerivedUnitBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-// DerivedUnitBaseDetailSection derivedUnitBaseDetailSection = formFactory.createDerivedUnitBaseDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
-//
-// formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-//
-// DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
+ DeterminationDetailSection determinationDetailSection = formFactory.createDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
- addPart(fieldObservationSection);
+ addPart(derivedUnitGeneralDetailSection);
addPart(gatheringEventDetailSection);
- addPart(fieldObservationDetailSection);
-// addPart(derivedUnitBaseDetailSection);
-// addPart(determinationDetailSection);
+ addPart(fieldUnitDetailSection);
+ addPart(derivedUnitBaseDetailSection);
+ addPart(determinationDetailSection);
+
}
- /**
- * createDerivedUnitBaseElementSection
- *
- * @param parent
- */
- private void createSpecimenDetailsView(RootElement parent) {
+ private void createFieldUnitSection(RootElement parent) {
destroySections();
- SpecimenGeneralSection specimenSection = formFactory.createSpecimenSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+ FieldUnitGeneralDetailSection fielUnitGeneralDetailSection = formFactory.createFieldUnitGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- SpecimenDetailsSection specimenDetailsSection = formFactory.createSpecimenDetailsSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
+ GatheringEventDetailSection gatheringEventDetailSection = formFactory.createGatheringEventDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- DerivedUnitDetailsSection derivedUnitDetailsSection = formFactory.createDerivedUnitDetailsSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
+ FieldUnitDetailSection fieldUnitDetailSection = formFactory.createFieldUnitDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
- addPart(specimenSection);
- addPart(specimenDetailsSection);
- addPart(derivedUnitDetailsSection);
+ addPart(fielUnitGeneralDetailSection);
+ addPart(gatheringEventDetailSection);
+ addPart(fieldUnitDetailSection);
}
+ private void createPreservedSpecimenSpecimenSection(RootElement parent) {
+ destroySections();
+
+ PreservedSpecimenGeneralDetailSection section = formFactory.createPreservedSpecimenGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+
+ PreservedSpecimenDetailSection derivedUnitBaseDetailSection = formFactory.createPreservedSpecimenDetailsSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
+
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+
+ PreservedSpecimenDeterminationDetailSection determinationDetailSection = formFactory.createPreservedSpecimenDeterminationDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
+
+ addPart(section);
+ addPart(derivedUnitBaseDetailSection);
+ addPart(determinationDetailSection);
+ }
+
+ private void createTissueSampleSection(RootElement parent) {
+ destroySections();
+
+ TissueSampleGeneralDetailSection section = formFactory.createTissueSampleGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+
+ addPart(section);
+ }
+
+ private void createDnaSampleSection(RootElement parent) {
+ destroySections();
+ DnaSampleGeneralDetailSection section = formFactory.createDnaSampleGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+
+ addPart(section);
+ }
+
+ private void createAmplificationSection(RootElement parent) {
+ destroySections();
+ AmplificationGeneralDetailSection generalSection = formFactory.createAmplificationGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+
+ AmplificationPrimerDetailSection primerSection = formFactory.createAmplificationPrimerDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
+
+ formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+
+ AmplificationCloningDetailSection cloningSection = formFactory.createAmplificationCloningDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE);
+
+
+ addPart(generalSection);
+ addPart(primerSection);
+ addPart(cloningSection);
+ }
+
+ private void createSequenceSection(RootElement parent) {
+ destroySections();
+ SequenceGeneralDetailSection section = formFactory.createSequenceGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+
+ addPart(section);
+ }
+
+ private void createSingleReadSection(RootElement parent) {
+ destroySections();
+ SingleReadGeneralDetailSection section = formFactory.createSingleReadGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+
+ addPart(section);
+ }
+
+ private void createSpecimenScanSection(RootElement parent) {
+ destroySections();
+ SpecimenScanGeneralDetailSection section = formFactory.createSpecimenScanGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+
+ addPart(section);
+ }
+
+ private void createLivingPlantPhotoSection(RootElement parent) {
+ destroySections();
+ LivingPlantPhotoGeneralDetailSection section = formFactory.createLivingPlantPhotoGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+
+ addPart(section);
+ }
+
+ private void createArtworkSection(RootElement parent) {
+ destroySections();
+ ArtworkGeneralDetailSection section = formFactory.createArtworkGeneralDetailSection(getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+
+ addPart(section);
+ }
+
+
+
/**
* @param rootElement
*/
addPart(descriptionUseRecordSection);
+
}
/**
AbstractFormSection definedTermDetailSection = formFactory.createDefinedTermDetailSection(getInput().getClass(), getConversationHolder(), parent, this, ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
addPart(definedTermDetailSection);
}
+
}