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;
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>
* <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.
*/
@Override
public void setEntity(ENTITY entity) {
- if(entity != null && hasCollectionChanged(entity)){
+ if(entity != null){
super.setEntity(entity);
internalUpdateSection(false);
}
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
*/
* @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)