Merge branch 'hotfix/3.12.4' into develop
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / element / AbstractFormSection.java
index 80392ad976b1cdc22358a670a02cec33aaaf2aaf..1ef071eac9e2459747c492f0427ad7c43b04acee 100644 (file)
@@ -34,7 +34,7 @@ import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
 import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
 import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
 import eu.etaxonomy.taxeditor.model.AbstractUtility;
-import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
 
 /**
  * <p>
@@ -52,6 +52,11 @@ import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
 //TODO shouldn't ENTITY be bound with super class ICdmBase for example (AbstractFormSection<ENTITY extends ICdmBase>)?
 public abstract class AbstractFormSection<ENTITY> extends Section implements ISelectionChangedListener, IEntityElement<ENTITY>, IConversationEnabled {
 
+    /**
+     * The default number of columns in detail sections
+     */
+    public static final int DEFAULT_NUM_COLUMNS = 2;
+
        private ISelectionProvider selectionProvider;
 
        private ENTITY entity;
@@ -99,10 +104,12 @@ public abstract class AbstractFormSection<ENTITY> extends Section implements ISe
                TableWrapLayout layout = LayoutConstants.LAYOUT();
                layout.bottomMargin = 10;
                layout.rightMargin = 5;
+               layout.horizontalSpacing = 5;
 
                client.setLayout(layout);
 
                this.setClient(client);
+
        }
 
            /**
@@ -216,7 +223,7 @@ public abstract class AbstractFormSection<ENTITY> extends Section implements ISe
                 ((IPropertyChangeListener) listener).propertyChange(event);
             }
         } catch (ConcurrentModificationException e) {
-            AbstractUtility.warn(getClass(), "ConcurrentModificationException while handling PropertyChangeEvents."
+            MessagingUtils.warn(getClass(), "ConcurrentModificationException while handling PropertyChangeEvents."
                     + " It seems like this is not critical");
         }
        }
@@ -532,7 +539,8 @@ public abstract class AbstractFormSection<ENTITY> extends Section implements ISe
         *
         * @return a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
         */
-       public CdmFormFactory getFormFactory() {
+       @Override
+    public CdmFormFactory getFormFactory() {
                return formFactory;
        }
 
@@ -562,17 +570,20 @@ public abstract class AbstractFormSection<ENTITY> extends Section implements ISe
         */
        @Override
     public ConversationHolder getConversationHolder() {
-               if(getParentElement() instanceof RootElement || getParentElement() == null){
-
-                       IEditorPart activeEditor = AbstractUtility.getActiveEditor();
-                       if(activeEditor instanceof IConversationEnabled){
-                               ConversationHolder conversation = ((IConversationEnabled) AbstractUtility.getActiveEditor()).getConversationHolder();
-                               return conversation;
-                       }
-               }else if(getParentElement() instanceof IConversationEnabled){
-                       return ((IConversationEnabled) getParentElement()).getConversationHolder();
-               }
-               AbstractUtility.errorDialog("Could not get conversation for AbstractFormSection",
+           if(AbstractUtility.getActivePart() instanceof IConversationEnabled){
+            return ((IConversationEnabled) AbstractUtility.getActivePart()).getConversationHolder();
+        }
+           if(getParentElement() instanceof RootElement || getParentElement() == null){
+
+               IEditorPart activeEditor = AbstractUtility.getActiveEditor();
+               if(activeEditor instanceof IConversationEnabled){
+                   ConversationHolder conversation = ((IConversationEnabled) AbstractUtility.getActiveEditor()).getConversationHolder();
+                   return conversation;
+               }
+           }else if(getParentElement() instanceof IConversationEnabled){
+               return ((IConversationEnabled) getParentElement()).getConversationHolder();
+           }
+               MessagingUtils.messageDialog("Could not get conversation for AbstractFormSection",
                                getClass(), "There is an error in the implementation. There should have been an active editor but it wasn't",
                                new IllegalArgumentException());
                return null;
@@ -580,8 +591,10 @@ public abstract class AbstractFormSection<ENTITY> extends Section implements ISe
        }
 
        /** {@inheritDoc} */
+
        @Override
     public void update(CdmDataChangeMap changeEvents) {
+
        }