Fixes a problem where the section title was not updated when editing a time period...
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / forms / DateDetailSection.java
index 792219c217b1e751fbb9e585c033808423a9dae6..9633b0031f537bbac3e0df3a6212a87b0aa2b637 100644 (file)
@@ -105,9 +105,7 @@ public class DateDetailSection extends AbstractFormSection<TimePeriod> {
                ((Text) text_parseText.getMainControl()).setSelection(cursorPosition);
                text_freeText.setText(timePeriod.getFreeText());
 
-               this.setText(CdmUtils.Nz(timePeriod.toString()));
                super.setEntity(timePeriod);
-               layout();
        }
 
        /** {@inheritDoc} */
@@ -151,9 +149,16 @@ public class DateDetailSection extends AbstractFormSection<TimePeriod> {
                } else if (eventSource == text_freeText) {
                        getEntity().setFreeText(text_freeText.getText());
                }
+               updateTitle();
                firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
        }
 
+       private void updateTitle(){
+               String title = CdmUtils.Nz(getEntity().toString());
+               this.setText(title);
+               layout();
+       }
+       
        /*
         * (non-Javadoc)
         *