AT: commiting recent merge from trunk
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / reference / ReferenceDetailElement.java
index a84304e39d8f1b3f9a747715eae9b6a5ee8fa46f..cf7035e835fe603451779d3f07815447b5e30f9a 100644 (file)
@@ -1,12 +1,12 @@
 // $Id$
 /**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
-* http://www.e-taxonomy.eu
-* 
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
+ * Copyright (C) 2007 EDIT
+ * European Distributed Institute of Taxonomy 
+ * http://www.e-taxonomy.eu
+ 
+ * The contents of this file are subject to the Mozilla Public License Version 1.1
+ * See LICENSE.TXT at the top of this package for the full license terms.
+ */
 
 package eu.etaxonomy.taxeditor.ui.section.reference;
 
@@ -17,6 +17,7 @@ import java.util.List;
 
 import org.eclipse.swt.SWT;
 
+import eu.etaxonomy.cdm.model.agent.AgentBase;
 import eu.etaxonomy.cdm.model.agent.Institution;
 import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase;
 import eu.etaxonomy.cdm.model.reference.Reference;
@@ -24,36 +25,30 @@ import eu.etaxonomy.cdm.model.reference.ReferenceFactory;
 import eu.etaxonomy.cdm.model.reference.ReferenceType;
 import eu.etaxonomy.taxeditor.model.AuthorHelper;
 import eu.etaxonomy.taxeditor.store.StoreUtil;
-import eu.etaxonomy.taxeditor.ui.dialogs.filteredSelection.ReferenceSelectionDialog;
-import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.EnumComboType;
-import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory.SelectionType;
-import eu.etaxonomy.taxeditor.ui.forms.CdmPropertyChangeEvent;
-import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
-import eu.etaxonomy.taxeditor.ui.forms.IErrorIntolerableElement;
-import eu.etaxonomy.taxeditor.ui.forms.IExceptionHandler;
-import eu.etaxonomy.taxeditor.ui.forms.TextWithLabelElement;
-import eu.etaxonomy.taxeditor.ui.forms.TimePeriodElement;
-import eu.etaxonomy.taxeditor.ui.forms.ToggleableTextElement;
-import eu.etaxonomy.taxeditor.ui.forms.UriWithLabelElement;
-import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
-import eu.etaxonomy.taxeditor.ui.selection.AbstractSelectionElement;
-import eu.etaxonomy.taxeditor.ui.selection.AgentSelectionElement;
-import eu.etaxonomy.taxeditor.ui.selection.InstitutionSelectionElement;
-import eu.etaxonomy.taxeditor.ui.selection.ReferenceSelectionElement;
-import eu.etaxonomy.taxeditor.ui.term.ReferenceTypeComboElement;
+import eu.etaxonomy.taxeditor.ui.combo.EnumComboElement;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.CdmPropertyChangeEvent;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.IErrorIntolerableElement;
+import eu.etaxonomy.taxeditor.ui.element.IExceptionHandler;
+import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
+import eu.etaxonomy.taxeditor.ui.element.TimePeriodElement;
+import eu.etaxonomy.taxeditor.ui.element.UriWithLabelElement;
+import eu.etaxonomy.taxeditor.ui.section.AbstractIdentifiableEntityDetailElement;
+import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
 
 /**
- * <p>ReferenceBaseDetailElement class.</p>
- *
+ * <p>
+ * ReferenceBaseDetailElement class.
+ * </p>
+ * 
  * @author n.hoffmann
  * @created Mar 2, 2010
  * @version 1.0
  */
-public class ReferenceDetailElement extends AbstractCdmDetailElement<Reference> implements IErrorIntolerableElement, IExceptionHandler {
+public class ReferenceDetailElement extends AbstractIdentifiableEntityDetailElement<Reference>
+               implements IErrorIntolerableElement, IExceptionHandler {
        
-       // property holder
-       private ToggleableTextElement toggleable_cache;
        private TextWithLabelElement text_edition;
        private TextWithLabelElement text_editor;
        private TextWithLabelElement text_isbn;
@@ -68,96 +63,122 @@ public class ReferenceDetailElement extends AbstractCdmDetailElement<Reference>
        private TextWithLabelElement text_title;
        private TextWithLabelElement text_volume;
        private UriWithLabelElement text_uri;
-       private AgentSelectionElement selection_authorTeam;
+       private EntitySelectionElement<AgentBase> selection_authorTeam;
        private TimePeriodElement element_timePeriod;
-       private ReferenceSelectionElement selection_inReference;
-       private InstitutionSelectionElement selection_institution;
-       private ReferenceTypeComboElement combo_referenceType;
-       
-       private ReferenceSelectionElement selection_inSeries;
+       private EntitySelectionElement<Reference> selection_inReference;
+       private EntitySelectionElement<Institution> selection_institution;
+       private EnumComboElement<ReferenceType> combo_referenceType;
+
+       private EntitySelectionElement<Reference> selection_inSeries;
 
-       
        /**
-        * <p>Constructor for ReferenceBaseDetailElement.</p>
-        *
-        * @param cdmFormFactory a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory} object.
-        * @param formElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
-        * @param style a int.
+        * <p>
+        * Constructor for ReferenceBaseDetailElement.
+        * </p>
+        * 
+        * @param cdmFormFactory
+        *            a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory}
+        *            object.
+        * @param formElement
+        *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
+        *            object.
+        * @param style
+        *            a int.
         */
        public ReferenceDetailElement(CdmFormFactory cdmFormFactory,
                        ICdmFormElement formElement, int style) {
                super(cdmFormFactory, formElement);
        }
-       
+
        /*
         * (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.forms.section.cdmdetail.AbstractCdmDetailComposite#createControl(org.eclipse.swt.widgets.Composite, int)
+        * 
+        * @see
+        * eu.etaxonomy.taxeditor.forms.section.cdmdetail.AbstractCdmDetailComposite
+        * #createControl(org.eclipse.swt.widgets.Composite, int)
         */
        /** {@inheritDoc} */
        @Override
-       protected void createControls(ICdmFormElement formElement, Reference entity, int style) {
-               toggleable_cache = formFactory.createToggleableTextField(formElement, "Reference Cache", entity.getTitleCache(), entity.isProtectedTitleCache(), style);
-               
-               combo_referenceType = (ReferenceTypeComboElement) formFactory.createEnumComboElement(EnumComboType.REFERENCETYPE, formElement, style);
+       protected void createControls(ICdmFormElement formElement,
+                       Reference entity, int style) {
+               toggleable_cache = formFactory.createToggleableTextField(formElement,
+                               "Reference Cache", entity.getTitleCache(),
+                               entity.isProtectedTitleCache(), style);
+
+               combo_referenceType = formFactory.createEnumComboElement(ReferenceType.class,
+                                               formElement, style);
 
                combo_referenceType.setSelection(entity.getType());
-               
+
                // title
-               text_title = formFactory.createTextWithLabelElement(formElement, "Title", entity.getTitle(), style);
-               
+               text_title = formFactory.createTextWithLabelElement(formElement,
+                               "Title", entity.getTitle(), style);
+
                // author team
-               selection_authorTeam = (AgentSelectionElement) formFactory.createSelectionElement(SelectionType.AGENT, getConversationHolder(), formElement, "Author", AuthorHelper.getAuthor(entity.getAuthorTeam()), style);
-               
+               selection_authorTeam = formFactory
+                               .createSelectionElement(AgentBase.class,
+                                               getConversationHolder(), formElement, "Author",
+                                               AuthorHelper.getAuthor(entity.getAuthorTeam()),
+                                               EntitySelectionElement.ALL, style);
+
                ReferenceType referenceType = entity.getType();
-               
-               if(referenceType != null){
-                       
+
+               if (referenceType != null) {
+
                        createInReferenceByType(this, referenceType, entity, SWT.NULL);
-                       
-                       if(referenceType.equals(ReferenceType.Generic)){
+
+                       if (referenceType.equals(ReferenceType.Generic)) {
                                createGenericControls(this, entity, SWT.NULL);
                                createPublicationControls(this, referenceType, entity, SWT.NULL);
-                       }else{
-                               if(referenceType.isPrintedUnit()){
-                                       createPrintedUnitControls(this, referenceType, entity, SWT.NULL);               
-                               }       
-                               if(referenceType.isPublication()){
-                                       createPublicationControls(this, referenceType, entity, SWT.NULL);
+                       } else {
+                               if (referenceType.isPrintedUnit()) {
+                                       createPrintedUnitControls(this, referenceType, entity,
+                                                       SWT.NULL);
                                }
-                               if(referenceType.isVolumeReference()){
+                               if (referenceType.isPublication()) {
+                                       createPublicationControls(this, referenceType, entity,
+                                                       SWT.NULL);
+                               }
+                               if (referenceType.isVolumeReference()) {
                                        createVolumeControls(this, entity, SWT.NULL);
-                               }       
-                               if(referenceType.isSection()){
+                               }
+                               if (referenceType.isSection()) {
                                        createSectionControls(this, entity, SWT.NULL);
-                               }               
+                               }
                        }
-               }               
-               
+               }
+
                // date published
-               element_timePeriod = formFactory.createTimePeriodElement(formElement, "Date Published", entity.getDatePublished(), style);
+               element_timePeriod = formFactory.createTimePeriodElement(formElement,
+                               "Date Published", entity.getDatePublished(), style);
 
                createUriAndAbstract(this, entity, SWT.NULL);
        }
 
        /*
         * (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.forms.section.cdmdetail.AbstractCdmDetailComposite#updateContent()
+        * 
+        * @see
+        * eu.etaxonomy.taxeditor.forms.section.cdmdetail.AbstractCdmDetailComposite
+        * #updateContent()
         */
        /** {@inheritDoc} */
        @Override
        protected void updateContent() {
-               if(getEntity() == null){
+               if (getEntity() == null) {
                        setEntity(ReferenceFactory.newGeneric());
                }
-               
+
                super.updateContent();
-               
+
                // enable elements according to state of cache protection
-//             setEnabled(getEntity().isProtectedTitleCache(), Arrays.asList(new Object[]{text_cache}));
+               // setEnabled(getEntity().isProtectedTitleCache(), Arrays.asList(new
+               // Object[]{text_cache}));
                toggleable_cache.setEnabled(getEntity().isProtectedTitleCache());
-               setIrrelevant(toggleable_cache.getState(), Arrays.asList(new Object[]{toggleable_cache}));
+               setIrrelevant(toggleable_cache.getState(),
+                               Arrays.asList(new Object[] { toggleable_cache }));
        }
-       
+
        /**
         * Creates an in reference for reference types that do hav this.
         * 
@@ -166,255 +187,276 @@ public class ReferenceDetailElement extends AbstractCdmDetailElement<Reference>
         * @param reference
         * @param style
         */
-       private void createInReferenceByType(
-                       ICdmFormElement element,
+       private void createInReferenceByType(ICdmFormElement element,
                        ReferenceType referenceType, Reference reference, int style) {
                boolean createInReferenceWidget = true;
                String label = "In Reference";
-               
-               switch(referenceType){
-                       case Generic:
-                               break;
-                       case BookSection:
-                               label = "Book";
-                               break;
-                       case InProceedings:
-                               label = "Print Series";
-                               break;
-                       case Article:
-                               label = "Journal";
-                               break;
-                       case WebPage:
-                               break;
-                       default:
-                               createInReferenceWidget = false;
+
+               switch (referenceType) {
+               case Generic:
+                       break;
+               case BookSection:
+                       label = "Book";
+                       break;
+               case InProceedings:
+                       label = "Print Series";
+                       break;
+               case Article:
+                       label = "Journal";
+                       break;
+               case WebPage:
+                       break;
+               default:
+                       createInReferenceWidget = false;
                }
-               
-               if(createInReferenceWidget){
-                       selection_inReference = (ReferenceSelectionElement) formFactory.createSelectionElement(SelectionType.REFERENCE, getConversationHolder(), 
-                                       element, label, reference.getInReference(), style);
+
+               if (createInReferenceWidget) {
+                       selection_inReference = formFactory
+                                       .createSelectionElement(Reference.class,
+                                                       getConversationHolder(), element, label,
+                                                       reference.getInReference(),
+                                                       EntitySelectionElement.ALL, style);
                }
        }
-       
+
        /**
-        * Creates additional controls to edit a generic reference 
+        * Creates additional controls to edit a generic reference
         * 
         * @param element
-        * @param reference 
+        * @param reference
         * @param listener
         * @param style
         */
-       private void createGenericControls(ICdmFormElement element, Reference reference, int style){
-               
-               //editor
-               text_editor = formFactory.createTextWithLabelElement(element, "Editor", reference.getEditor(), style);
-               
+       private void createGenericControls(ICdmFormElement element,
+                       Reference reference, int style) {
+
+               // editor
+               text_editor = formFactory.createTextWithLabelElement(element, "Editor",
+                               reference.getEditor(), style);
+
                // series
-               text_series = formFactory.createTextWithLabelElement(element, "Series", reference.getSeries(), style);
-               
-               // volume 
-               text_volume = formFactory.createTextWithLabelElement(element, "Volume", reference.getVolume(), style);
-               
+               text_series = formFactory.createTextWithLabelElement(element, "Series",
+                               reference.getSeries(), style);
+
+               // volume
+               text_volume = formFactory.createTextWithLabelElement(element, "Volume",
+                               reference.getVolume(), style);
+
                // pages
-               text_pages = formFactory.createTextWithLabelElement(element, "Pages", reference.getPages(), style);
+               text_pages = formFactory.createTextWithLabelElement(element, "Pages",
+                               reference.getPages(), style);
        }
-       
-       
+
        /**
         * Creates additional controls to edit a publication
         * 
         * @param element
-        * @param reference 
+        * @param reference
         * @param listener
         * @param style
         */
-       private void createPublicationControls(ICdmFormElement element, ReferenceType referenceType, Reference reference, int style){
+       private void createPublicationControls(ICdmFormElement element,
+                       ReferenceType referenceType, Reference reference, int style) {
 
                // placePublished
-               text_placePublished = formFactory.createTextWithLabelElement(element, "Place Published", reference.getPlacePublished(), style);
-               
+               text_placePublished = formFactory.createTextWithLabelElement(element,
+                               "Place Published", reference.getPlacePublished(), style);
+
                // publisher
-               text_publisher = formFactory.createTextWithLabelElement(element, "Publisher", reference.getPublisher(), style);
-               
-               if(referenceType.equals(ReferenceType.Journal)){
-                       //issn
-                       text_issn = formFactory.createTextWithLabelElement(element, "ISSN", reference.getIssn(), style);
+               text_publisher = formFactory.createTextWithLabelElement(element,
+                               "Publisher", reference.getPublisher(), style);
+
+               if (referenceType.equals(ReferenceType.Journal)) {
+                       // issn
+                       text_issn = formFactory.createTextWithLabelElement(element, "ISSN",
+                                       reference.getIssn(), style);
                }
-               
-               if(referenceType.equals(ReferenceType.Report)){
+
+               if (referenceType.equals(ReferenceType.Report)) {
                        // institution
-                       selection_institution = (InstitutionSelectionElement) formFactory.createSelectionElement(SelectionType.INSTITUTION, getConversationHolder(), element, "Institution", reference.getInstitution(), style);
+                       selection_institution = formFactory
+                                       .createSelectionElement(Institution.class,
+                                                       getConversationHolder(), element, "Institution",
+                                                       reference.getInstitution(),
+                                                       EntitySelectionElement.ALL, style);
                }
-               
-               if(referenceType.equals(ReferenceType.Thesis)){
+
+               if (referenceType.equals(ReferenceType.Thesis)) {
                        // school
-                       selection_institution = (InstitutionSelectionElement) formFactory.createSelectionElement(SelectionType.INSTITUTION, getConversationHolder(), element, "School", reference.getSchool(), style);
+                       selection_institution = formFactory
+                                       .createSelectionElement(Institution.class,
+                                                       getConversationHolder(), element, "School",
+                                                       reference.getSchool(),
+                                                       EntitySelectionElement.ALL, style);
                }
-               
-               if(referenceType.equals(ReferenceType.Proceedings)){
-                       //organization
-                       text_organisation = formFactory.createTextWithLabelElement(element, "Organisation", reference.getOrganization(), style);
+
+               if (referenceType.equals(ReferenceType.Proceedings)) {
+                       // organization
+                       text_organisation = formFactory.createTextWithLabelElement(element,
+                                       "Organisation", reference.getOrganization(), style);
                }
        }
-       
-       
+
        /**
         * Creates additional controls to edit a section
         * 
         * @param element
-        * @param reference 
+        * @param reference
         * @param style
         */
-       private void createSectionControls(ICdmFormElement element, Reference reference, int style){            
+       private void createSectionControls(ICdmFormElement element,
+                       Reference reference, int style) {
                // pages
-               text_pages = formFactory.createTextWithLabelElement(element, "Pages", reference.getPages(), style);
+               text_pages = formFactory.createTextWithLabelElement(element, "Pages",
+                               reference.getPages(), style);
        }
-       
+
        /**
         * Creates additional controls to edit a volume
         * 
         * @param element
-        * @param reference 
+        * @param reference
         * @param style
         */
-       private void createVolumeControls(ICdmFormElement element, Reference reference, int style){
-               
-               text_volume = formFactory.createTextWithLabelElement(element, "Volume", reference.getVolume(), style);
-               
-               text_series = formFactory.createTextWithLabelElement(element, "Series", reference.getSeries(), style);
+       private void createVolumeControls(ICdmFormElement element,
+                       Reference reference, int style) {
+
+               text_volume = formFactory.createTextWithLabelElement(element, "Volume",
+                               reference.getVolume(), style);
+
+               text_series = formFactory.createTextWithLabelElement(element, "Series",
+                               reference.getSeries(), style);
        }
-       
-       
+
        /**
         * 
         * @param element
         * @param referenceType
-        * @param reference 
+        * @param reference
         * @param style
         */
-       private void createPrintedUnitControls(ICdmFormElement element, ReferenceType referenceType, Reference reference, int style){
+       private void createPrintedUnitControls(ICdmFormElement element,
+                       ReferenceType referenceType, Reference reference, int style) {
                // in series
-               selection_inSeries = (ReferenceSelectionElement) formFactory.createSelectionElement(SelectionType.REFERENCE, getConversationHolder(), element, "In Series", (Reference) reference.getInSeries(), style);
-               
-               //editor
-               text_editor = formFactory.createTextWithLabelElement(element, "Editor", reference.getEditor(), style);
-                               
+               selection_inSeries = formFactory
+                               .createSelectionElement(Reference.class,
+                                               getConversationHolder(), element, "In Series",
+                                               (Reference) reference.getInSeries(),
+                                               EntitySelectionElement.ALL, style);
+
+               // editor
+               text_editor = formFactory.createTextWithLabelElement(element, "Editor",
+                               reference.getEditor(), style);
+
                // series part
-               text_seriesPart = formFactory.createTextWithLabelElement(element, "Series Part", reference.getSeriesPart(), style);
-               
-               if(referenceType.equals(ReferenceType.Book)){
+               text_seriesPart = formFactory.createTextWithLabelElement(element,
+                               "Series Part", reference.getSeriesPart(), style);
+
+               if (referenceType.equals(ReferenceType.Book)) {
                        // edition
-                       text_edition = formFactory.createTextWithLabelElement(element, "Edition", reference.getEdition(), style);
-                       
-                       //isbn
-                       text_isbn = formFactory.createTextWithLabelElement(element, "ISBN", reference.getIsbn(), style);
+                       text_edition = formFactory.createTextWithLabelElement(element,
+                                       "Edition", reference.getEdition(), style);
+
+                       // isbn
+                       text_isbn = formFactory.createTextWithLabelElement(element, "ISBN",
+                                       reference.getIsbn(), style);
                }
        }
-       
+
        private void createUriAndAbstract(ICdmFormElement element,
                        Reference reference, int style) {
                // uri
-               text_uri = formFactory.createUriWithLabelElement(element, "URI", reference.getUri(), style);
+               text_uri = formFactory.createUriWithLabelElement(element, "URI",
+                               reference.getUri(), style);
                // abstract
-               text_referenceAbstract = formFactory.createMultilineTextWithLabel(element, "Reference Abstract", 100, style);
+               text_referenceAbstract = formFactory.createMultilineTextWithLabel(
+                               element, "Reference Abstract", 100, style);
                text_referenceAbstract.setText(reference.getReferenceAbstract());
        }
-               
-       
+
        /** {@inheritDoc} */
        @Override
        public void handleEvent(Object eventSource) {
-               if(eventSource == combo_referenceType){
+               if (eventSource == combo_referenceType) {
                        getEntity().setType(combo_referenceType.getSelection());
-                       getParentElement().refresh();
-               }
-               else if(eventSource == element_timePeriod){
+                       updateContent();
+               } else if (eventSource == element_timePeriod) {
                        getEntity().setDatePublished(element_timePeriod.getTimePeriod());
                        clearException();
                }
                // selections
-               else if(eventSource == selection_authorTeam){
-                       getEntity().setAuthorTeam((TeamOrPersonBase)selection_authorTeam.getSelection());
-               }
-               else if(eventSource == selection_inReference){
+               else if (eventSource == selection_authorTeam) {
+                       getEntity().setAuthorTeam(
+                                       (TeamOrPersonBase) selection_authorTeam.getSelection());
+               } else if (eventSource == selection_inReference) {
                        getEntity().setInReference(selection_inReference.getSelection());
-               }
-               else if(eventSource == selection_inSeries){
+               } else if (eventSource == selection_inSeries) {
                        getEntity().setInReference(selection_inSeries.getSelection());
-               }
-               else if(eventSource == selection_institution){
+               } else if (eventSource == selection_institution) {
                        getEntity().setInstitution(selection_institution.getSelection());
                }
-               
+
                // textfields
-               else if(eventSource == toggleable_cache){
-                       getEntity().setTitleCache(toggleable_cache.getText(), toggleable_cache.getState());
-//                     setEnabled(! text_cache.getState(), Arrays.asList(new Object[]{text_cache}));
-                       setIrrelevant(toggleable_cache.getState(), Arrays.asList(new Object[]{toggleable_cache}));
-               }
-               else if(eventSource == text_edition){
+               else if (eventSource == toggleable_cache) {
+                       handleToggleableCacheField();
+               } else if (eventSource == text_edition) {
                        getEntity().setEdition(text_edition.getText());
-               }
-               else if(eventSource == text_editor){
+               } else if (eventSource == text_editor) {
                        getEntity().setEditor(text_editor.getText());
-               }
-               else if(eventSource == text_isbn){
+               } else if (eventSource == text_isbn) {
                        getEntity().setIsbn(text_isbn.getText());
-               }
-               else if(eventSource == text_issn){
+               } else if (eventSource == text_issn) {
                        getEntity().setIssn(text_issn.getText());
-               }
-               else if(eventSource == text_organisation){
+               } else if (eventSource == text_organisation) {
                        getEntity().setOrganization(text_organisation.getText());
-               }
-               else if(eventSource == text_pages){
+               } else if (eventSource == text_pages) {
                        getEntity().setPages(text_pages.getText());
-               }
-               else if(eventSource == text_placePublished){
+               } else if (eventSource == text_placePublished) {
                        getEntity().setPlacePublished(text_placePublished.getText());
-               }
-               else if(eventSource == text_publisher){
+               } else if (eventSource == text_publisher) {
                        getEntity().setPublisher(text_publisher.getText());
-               }
-               else if(eventSource == text_referenceAbstract){
+               } else if (eventSource == text_referenceAbstract) {
                        getEntity().setReferenceAbstract(text_referenceAbstract.getText());
-               }
-               else if(eventSource == text_series){
+               } else if (eventSource == text_series) {
                        getEntity().setSeries(text_series.getText());
-               }
-               else if(eventSource == text_seriesPart){
+               } else if (eventSource == text_seriesPart) {
                        getEntity().setSeriesPart(text_seriesPart.getText());
-               }
-               else if(eventSource == text_title){
+               } else if (eventSource == text_title) {
                        getEntity().setTitle(text_title.getText());
-               }
-               else if(eventSource == text_uri){
+               } else if (eventSource == text_uri) {
                        try {
                                getEntity().setUri(text_uri.getUri());
                        } catch (URISyntaxException e) {
-                               StoreUtil.warningDialog("Invlid URI", getClass(), e.getLocalizedMessage());
+                               StoreUtil.warningDialog("Invlid URI", getClass(),
+                                               e.getLocalizedMessage());
                        }
-               }
-               else if(eventSource == text_volume){
+               } else if (eventSource == text_volume) {
                        getEntity().setVolume(text_volume.getText());
                }
-               
-               else if(eventSource != toggleable_cache){
+
+               else if (eventSource != toggleable_cache) {
                        toggleable_cache.setText(getEntity().getTitleCache());
                }
+
+               firePropertyChangeEvent(new CdmPropertyChangeEvent(this, null));
        }
-       
+
        /*
         * (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleException(eu.etaxonomy.taxeditor.forms.CdmPropertyChangeEvent)
+        * 
+        * @see
+        * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleException
+        * (eu.etaxonomy.taxeditor.forms.CdmPropertyChangeEvent)
         */
        /** {@inheritDoc} */
        @Override
        public void handleException(CdmPropertyChangeEvent event) {
                exceptionOccurred(event);
        }
-       
-       /* (non-Javadoc)
+
+       /*
+        * (non-Javadoc)
+        * 
         * @see eu.etaxonomy.taxeditor.forms.IExceptionHandler#clearException()
         */
        /** {@inheritDoc} */
@@ -423,10 +465,14 @@ public class ReferenceDetailElement extends AbstractCdmDetailElement<Reference>
                exceptionOccurred(null);
        }
 
-       private List<IExceptionHandler> exceptionHandlers = new ArrayList<IExceptionHandler>();
-       
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.forms.IErrorIntolerableElement#addExceptionHandler(eu.etaxonomy.taxeditor.forms.IExceptionHandler)
+       private final List<IExceptionHandler> exceptionHandlers = new ArrayList<IExceptionHandler>();
+
+       /*
+        * (non-Javadoc)
+        * 
+        * @see
+        * eu.etaxonomy.taxeditor.forms.IErrorIntolerableElement#addExceptionHandler
+        * (eu.etaxonomy.taxeditor.forms.IExceptionHandler)
         */
        /** {@inheritDoc} */
        @Override
@@ -434,8 +480,12 @@ public class ReferenceDetailElement extends AbstractCdmDetailElement<Reference>
                exceptionHandlers.add(handler);
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.forms.IErrorIntolerableElement#removeExceptionHandler(eu.etaxonomy.taxeditor.forms.IExceptionHandler)
+       /*
+        * (non-Javadoc)
+        * 
+        * @see
+        * eu.etaxonomy.taxeditor.forms.IErrorIntolerableElement#removeExceptionHandler
+        * (eu.etaxonomy.taxeditor.forms.IExceptionHandler)
         */
        /** {@inheritDoc} */
        @Override
@@ -443,16 +493,20 @@ public class ReferenceDetailElement extends AbstractCdmDetailElement<Reference>
                exceptionHandlers.remove(handler);
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.forms.IErrorIntolerableElement#exceptionOccurred(eu.etaxonomy.taxeditor.forms.CdmPropertyChangeEvent)
+       /*
+        * (non-Javadoc)
+        * 
+        * @see
+        * eu.etaxonomy.taxeditor.forms.IErrorIntolerableElement#exceptionOccurred
+        * (eu.etaxonomy.taxeditor.forms.CdmPropertyChangeEvent)
         */
        /** {@inheritDoc} */
        @Override
        public void exceptionOccurred(CdmPropertyChangeEvent event) {
-               for(IExceptionHandler handler : exceptionHandlers){
-                       if(event == null) {
-                               clearException();
-                       }else{
+               for (IExceptionHandler handler : exceptionHandlers) {
+                       if (event == null) {
+                               handler.clearException();
+                       } else {
                                handler.handleException(event);
                        }
                }