merged current development status into trunk
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / AbstractEntityCollectionSection.java
index e3369c47b93aadb27babd52a9b655c5a98b84165..1a9f43ee577c869e74cbd59b9fb1deb56d87e0f4 100644 (file)
@@ -5,7 +5,6 @@ package eu.etaxonomy.taxeditor.ui.section;
 
 import java.util.Collection;
 
-import org.apache.commons.collections.CollectionUtils;
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.action.ToolBarManager;
 import org.eclipse.jface.resource.ImageDescriptor;
@@ -29,9 +28,9 @@ import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
 import eu.etaxonomy.taxeditor.preference.Resources;
 import eu.etaxonomy.taxeditor.store.StoreUtil;
-import eu.etaxonomy.taxeditor.ui.forms.AbstractFormSection;
-import eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement;
+import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
+import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
+import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
 
 /**
  * <p>Abstract AbstractEntityCollectionSection class.</p>
@@ -51,15 +50,15 @@ public abstract class AbstractEntityCollectionSection<ENTITY, ELEMENT> extends A
         * <p>Constructor for AbstractEntityCollectionSection.</p>
         *
         * @param conversation 
-        * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.forms.ICdmFormElement} object.
+        * @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
         * @param style a int.
-        * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.forms.CdmFormFactory} object.
+        * @param formFactory a {@link eu.etaxonomy.taxeditor.ui.element.CdmFormFactory} object.
         * @param title a {@link java.lang.String} object.
         * @param <ENTITY> a ENTITY object.
         * @param <ELEMENT> a ELEMENT object.
         */
        public AbstractEntityCollectionSection(CdmFormFactory formFactory, ConversationHolder conversation, ICdmFormElement parentElement, String title, int style) {
-               super(formFactory, conversation, parentElement, Section.CLIENT_INDENT | style);
+               super(formFactory, parentElement, Section.CLIENT_INDENT | style);
                this.title = title;
                this.setText(getTitleString());
                showToolbar();
@@ -114,7 +113,7 @@ public abstract class AbstractEntityCollectionSection<ENTITY, ELEMENT> extends A
         */
        @Override
        public void setEntity(ENTITY entity) {
-               if(entity != null && hasCollectionChanged(entity)){
+               if(entity != null){
                        super.setEntity(entity);
                        internalUpdateSection(false);
                }
@@ -160,36 +159,6 @@ public abstract class AbstractEntityCollectionSection<ENTITY, ELEMENT> extends A
                        firePropertyChangeEvent(this);
        }
 
-       /**
-        * Whether the entities specific collection changed
-        * 
-        * @param newEntity
-        * @return
-        */
-       private boolean hasCollectionChanged(ENTITY newEntity){
-
-               // return true on null
-               if(getEntity() == null || newEntity == null)    return true;    
-               
-               // if the entities differ the collection has changed
-               if(! getEntity().equals(newEntity)) return true;
-               
-               Collection<ELEMENT> oldCollection = getCollection(getEntity());
-               Collection<ELEMENT> newCollection = getCollection(newEntity);
-               
-               // return true on null
-               if(oldCollection == null || newCollection == null) return true;
-               
-               // if the collections are object equal, check if the content is equal, too
-               if(oldCollection.equals(newCollection)){
-               
-                       boolean equal = CollectionUtils.isEqualCollection(oldCollection, newCollection);
-                       // return true when collections are not equal
-                       return equal ? false : true;
-               }
-               return true;
-       }
-
        /**
         * Create the elements to be shown in this seciton client area 
         */
@@ -246,7 +215,7 @@ public abstract class AbstractEntityCollectionSection<ENTITY, ELEMENT> extends A
         * @param backgroundColor a {@link org.eclipse.swt.graphics.Color} object.
         */
        protected void createElementComposite(ELEMENT element, SelectionListener removeListener, Color backgroundColor){
-               AbstractEntityCollectionElement formElement = formFactory.createEntityCollectionElement(this, element, removeListener, backgroundColor, SWT.NULL);
+               formFactory.createEntityCollectionElement(this, element, removeListener, backgroundColor, SWT.NULL);
        }
        
        /* (non-Javadoc)