Fixes a problem with DateDetail elements where the parse text was always overwritten...
authorn.hoffmann <n.hoffmann@localhost>
Tue, 10 May 2011 09:07:47 +0000 (09:07 +0000)
committern.hoffmann <n.hoffmann@localhost>
Tue, 10 May 2011 09:07:47 +0000 (09:07 +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/section/reference/ReferenceDetailElement.java

index b3ef32b96b611ef0a5cb14c0316c28739d7eca8a..0b95563705ee7b7d5405b9050cdc3317739e6f54 100644 (file)
@@ -80,18 +80,25 @@ public class DateDetailSection extends AbstractFormSection<TimePeriod> {
         */
        @Override
        public void setEntity(TimePeriod timePeriod) {
+               setEntityInternally(timePeriod);
+               text_parseText.setText(timePeriod.toString());
+               super.setEntity(timePeriod);
+       }
+       
+       /**
+        * When setting the entity through parsing we do not want to alter the parse field
+        * @param timePeriod
+        */
+       private void setEntityInternally(TimePeriod timePeriod){
                Partial start = timePeriod.getStart();
                partialElement_start.setPartial(start);
                Partial end = timePeriod.getEnd();
                partialElement_end.setPartial(end);
 
-               text_parseText.setText(timePeriod.toString());
                ((Text) text_parseText.getMainControl()).setSelection(cursorPosition);
                text_freeText.setText(timePeriod.getFreeText());
 
                this.setText(CdmUtils.Nz(timePeriod.toString()));
-
-               super.setEntity(timePeriod);
        }
 
        /** {@inheritDoc} */
@@ -131,7 +138,7 @@ public class DateDetailSection extends AbstractFormSection<TimePeriod> {
                } else if (eventSource == text_parseText) {
                        cursorPosition = ((Text) text_parseText.getMainControl())
                                        .getCaretPosition();
-                       setEntity(TimePeriod.parseString(text_parseText.getText()));
+                       setEntityInternally(TimePeriod.parseString(text_parseText.getText()));
                } else if (eventSource == text_freeText) {
                        getEntity().setFreeText(text_freeText.getText());
                }
index 80f99ebccf3a533314ead6f60b47fd629a592686..d66086f08fb70821c449aea8f04ec930ee15e970 100644 (file)
@@ -516,7 +516,7 @@ public class ReferenceDetailElement extends AbstractCdmDetailElement<Reference>
        public void exceptionOccurred(CdmPropertyChangeEvent event) {
                for (IExceptionHandler handler : exceptionHandlers) {
                        if (event == null) {
-                               clearException();
+                               handler.clearException();
                        } else {
                                handler.handleException(event);
                        }