Fixes a problem with TimePeriodElement
authorn.hoffmann <n.hoffmann@localhost>
Thu, 12 May 2011 12:08:45 +0000 (12:08 +0000)
committern.hoffmann <n.hoffmann@localhost>
Thu, 12 May 2011 12:08:45 +0000 (12:08 +0000)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/DateDetailSection.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/forms/TimePeriodElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/section/occurrence/DeterminationEventDetailElement.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/detail/DetailsViewer.java

index 0b95563705ee7b7d5405b9050cdc3317739e6f54..792219c217b1e751fbb9e585c033808423a9dae6 100644 (file)
@@ -70,6 +70,14 @@ public class DateDetailSection extends AbstractFormSection<TimePeriod> {
                formFactory.addPropertyChangeListener(this);
        }
 
+       @Override
+       public TimePeriod getEntity() {
+               if(super.getEntity() == null){
+                       setEntity(TimePeriod.NewInstance());
+               }
+               return super.getEntity();
+       }
+       
        /**
         * <p>
         * Setter for the field <code>timePeriod</code>.
@@ -82,7 +90,6 @@ public class DateDetailSection extends AbstractFormSection<TimePeriod> {
        public void setEntity(TimePeriod timePeriod) {
                setEntityInternally(timePeriod);
                text_parseText.setText(timePeriod.toString());
-               super.setEntity(timePeriod);
        }
        
        /**
@@ -99,6 +106,8 @@ public class DateDetailSection extends AbstractFormSection<TimePeriod> {
                text_freeText.setText(timePeriod.getFreeText());
 
                this.setText(CdmUtils.Nz(timePeriod.toString()));
+               super.setEntity(timePeriod);
+               layout();
        }
 
        /** {@inheritDoc} */
index 14efd25b2ea5a95472245089d5fd22e7809de159..cb618f23b552bc185e7729f7fbd5b2899473daef 100644 (file)
@@ -106,6 +106,7 @@ public class TimePeriodElement extends AbstractCdmFormElement {
                // section_dateDetails.setEntity(timePeriod);
                //
                if (eventSource == section_dateDetails) {
+                       timePeriod = section_dateDetails.getEntity();
                        firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
                }
 
index 4324ca89176e84e1e3d232b3f36e4785d4b0de36..d879b874b0d2579bfcccbb708781bb589abf87c9 100644 (file)
@@ -19,6 +19,7 @@ import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.SelectionType;
 import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.TermComboType;
 import eu.etaxonomy.taxeditor.ui.forms.CheckboxElement;
 import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.selection.TaxonBaseSelectionElement;
 import eu.etaxonomy.taxeditor.ui.selection.TaxonSelectionElement;
 import eu.etaxonomy.taxeditor.ui.term.DeterminationModifierComboElement;
 
@@ -36,7 +37,7 @@ public class DeterminationEventDetailElement extends
 
        private DeterminationModifierComboElement combo_determinationModifier;
        private CheckboxElement checkbox_preferredFlag;
-       private TaxonSelectionElement selection_taxon;
+       private TaxonBaseSelectionElement selection_taxonBase;
 
        // private TODO a set of references
 
@@ -76,6 +77,8 @@ public class DeterminationEventDetailElement extends
        @Override
        public void setEntity(DeterminationEvent entity) {
                this.entity = entity;
+               combo_determinationModifier.setSelection(entity.getModifier());
+               selection_taxonBase.setEntity(entity.getTaxon());
                super.setEntity(entity);
        }
 
@@ -93,10 +96,11 @@ public class DeterminationEventDetailElement extends
                combo_determinationModifier = (DeterminationModifierComboElement) formFactory
                                .createTermComboElement(TermComboType.DETERMINATION_MODIFIER,
                                                element, "Determination Modifier", null, style);
+               // TODO remove this
 //             checkbox_preferredFlag = formFactory.createCheckbox(element,
 //                                     "Current", false, style);
-               selection_taxon = (TaxonSelectionElement) formFactory
-                               .createSelectionElement(SelectionType.TAXON,
+               selection_taxonBase = (TaxonBaseSelectionElement) formFactory
+                               .createSelectionElement(SelectionType.TAXON_BASE,
                                                getConversationHolder(), element, "Taxon", null,
                                                TaxonSelectionElement.DEFAULT, style);
 
@@ -120,8 +124,8 @@ public class DeterminationEventDetailElement extends
                        getEntity().setModifier(combo_determinationModifier.getSelection());
                } else if (eventSource == checkbox_preferredFlag) {
                        getEntity().setPreferredFlag(checkbox_preferredFlag.getSelection());
-               } else if (eventSource == selection_taxon) {
-                       getEntity().setTaxon(selection_taxon.getSelection());
+               } else if (eventSource == selection_taxonBase) {
+                       getEntity().setTaxon(selection_taxonBase.getSelection());
                }
                // else if(eventSource == TODO set of references){
                //
index 48ad93b9e3e633dee34c6bf0ed1e2dfcb5fc17f7..941e099f317aa236e5aa933549a8c74c80be93da 100644 (file)
@@ -599,25 +599,20 @@ public class DetailsViewer extends AbstractCdmDataViewer {
                                .createCdmDetailSection(DetailType.DERIVED_UNIT,
                                                getConversationHolder(), parent, this, Section.TWISTIE);
                
-               boolean showExperimentalFeatures = PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.SHOW_EXPERIMENTAL_FEATURES);
+               Object getBoolean;
+               formFactory.createHorizontalSeparator(parent, SWT.BORDER);
+               
+               DeterminationDetailSection determinationDetailSection = (DeterminationDetailSection) formFactory
+                               .createCdmDetailSection(DetailType.DETERMINATION, 
+                                               getConversationHolder(), parent, this, Section.TWISTIE);
                
-               // TODO remove experimental check once this is fully implemented. see #2376
-               DeterminationDetailSection determinationDetailSection = null;
-               if(showExperimentalFeatures){
-                       formFactory.createHorizontalSeparator(parent, SWT.BORDER);
-                       
-                       determinationDetailSection = (DeterminationDetailSection) formFactory
-                                       .createCdmDetailSection(DetailType.DETERMINATION, 
-                                                       getConversationHolder(), parent, this, Section.TWISTIE);
-               }
 
                addPart(generalDetailSection);
                addPart(gatheringEventDetailSection);
                addPart(fieldObservationDetailSection);
                addPart(derivedUnitBaseDetailSection);
-               if(showExperimentalFeatures){
-                       addPart(determinationDetailSection);
-               }
+               addPart(determinationDetailSection);
+
        }
 
        /**