Merge branch 'hotfix/5.45.1'
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / agent / InstitutionDetailElement.java
index 433c53ee74ba6f2eee032732a1b17ccb2f3cd289..e61023bba9431dabdacd694bda145ef69bd8191d 100644 (file)
@@ -1,18 +1,16 @@
-// $Id$
 /**
  * Copyright (C) 2007 EDIT
- * European Distributed Institute of Taxonomy 
+ * 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.agent;
 
 import eu.etaxonomy.cdm.model.agent.Institution;
-import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
 import eu.etaxonomy.taxeditor.ui.element.TextWithLabelElement;
 import eu.etaxonomy.taxeditor.ui.section.AbstractCdmDetailElement;
 import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
@@ -20,7 +18,6 @@ import eu.etaxonomy.taxeditor.ui.selection.EntitySelectionElement;
 /**
  * @author n.hoffmann
  * @created Dec 15, 2010
- * @version 1.0
  */
 public class InstitutionDetailElement extends
                AbstractCdmDetailElement<Institution> {
@@ -33,25 +30,16 @@ public class InstitutionDetailElement extends
 
        private EntitySelectionElement<Institution> selection_partOfInstitution;
 
-       /**
-        * @param formFactory
-        * @param formElement
-        */
        public InstitutionDetailElement(CdmFormFactory formFactory,
                        ICdmFormElement formElement) {
                super(formFactory, formElement);
        }
 
-       /*
-        * (non-Javadoc)
-        * 
-        * @see
-        * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#createControls
-        * (eu.etaxonomy.taxeditor.forms.ICdmFormElement, java.lang.Object, int)
-        */
        @Override
        protected void createControls(ICdmFormElement formElement,
                        Institution entity, int style) {
+               this.setWarnForReferencingObjects(formElement);
+
                text_name = formFactory.createTextWithLabelElement(formElement, "Name",
                                entity.getName(), style);
                text_code = formFactory.createTextWithLabelElement(formElement, "Code",
@@ -59,19 +47,12 @@ public class InstitutionDetailElement extends
                // section_institutionTypes
                selection_partOfInstitution = formFactory
                                .createSelectionElement(Institution.class,
-                                               getConversationHolder(), formElement, "Is Part Of",
+                                       formElement, "Is Part Of",
                                                entity.getIsPartOf(),
-                                               EntitySelectionElement.EDITABLE | EntitySelectionElement.SELECTABLE | EntitySelectionElement.DELETABLE, 
+                                               EntitySelectionElement.EDITABLE | EntitySelectionElement.SELECTABLE | EntitySelectionElement.DELETABLE,
                                                style);
        }
 
-       /*
-        * (non-Javadoc)
-        * 
-        * @see
-        * eu.etaxonomy.taxeditor.section.AbstractCdmDetailElement#handleEvent(java
-        * .lang.Object)
-        */
        @Override
        public void handleEvent(Object eventSource) {
                if (eventSource == text_name) {
@@ -83,4 +64,13 @@ public class InstitutionDetailElement extends
                }
        }
 
-}
+       @Override
+       public void fillFields() {
+               if (getEntity() != null) {
+                       text_name.setText(getEntity().getName());
+                       text_code.setText(getEntity().getCode());
+                       selection_partOfInstitution.setEntity(getEntity().getIsPartOf());
+               }
+               
+       }
+}
\ No newline at end of file