- extracted super class from AbstractPostOperation (same name)
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / ui / section / AbstractEntityCollectionElement.java
index 9788296a805153ae6d367c632764ecf5012b3472..b6e1a416bfc039c687e6b8b9b193bdddf87efd71 100644 (file)
@@ -1,9 +1,9 @@
 // $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.
  */
@@ -17,7 +17,6 @@ import org.eclipse.swt.events.SelectionListener;
 import org.eclipse.swt.graphics.Color;
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Layout;
 import org.eclipse.ui.forms.widgets.TableWrapLayout;
 
@@ -25,18 +24,19 @@ 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.ImageResources;
+import eu.etaxonomy.taxeditor.ui.campanula.compatibility.ICdmFormElement;
 import eu.etaxonomy.taxeditor.ui.element.AbstractCdmFormElement;
 import eu.etaxonomy.taxeditor.ui.element.AbstractFormSection;
 import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
-import eu.etaxonomy.taxeditor.ui.element.ICdmFormElement;
 import eu.etaxonomy.taxeditor.ui.element.IEntityElement;
 import eu.etaxonomy.taxeditor.ui.element.ISelectable;
+import eu.etaxonomy.taxeditor.ui.element.LayoutConstants;
 
 /**
  * <p>
  * Abstract AbstractEntityCollectionElement class.
  * </p>
- * 
+ *
  * @author n.hoffmann
  * @created Nov 16, 2009
  * @version 1.0
@@ -47,9 +47,9 @@ public abstract class AbstractEntityCollectionElement<ENTITY> extends
 
        protected ENTITY entity;
 
-       private Composite container;
+       private final Composite container;
 
-       private Composite box;
+       private final Composite box;
 
        private Button button_remove;
 
@@ -59,7 +59,7 @@ public abstract class AbstractEntityCollectionElement<ENTITY> extends
         * <p>
         * Constructor for AbstractEntityCollectionElement.
         * </p>
-        * 
+        *
         * @param style
         *            a int.
         * @param formFactory
@@ -90,12 +90,12 @@ public abstract class AbstractEntityCollectionElement<ENTITY> extends
                box.setBackgroundMode(SWT.INHERIT_DEFAULT);
                addControl(box);
 
-               TableWrapLayout boxLayout = CdmFormFactory.LAYOUT(2, false);
+               TableWrapLayout boxLayout = LayoutConstants.LAYOUT(2, false);
                boxLayout.topMargin = 4;
                boxLayout.bottomMargin = 4;
                box.setLayout(boxLayout);
 
-               box.setLayoutData(CdmFormFactory.FILL_HORIZONTALLY());
+               box.setLayoutData(LayoutConstants.FILL_HORIZONTALLY());
 
                // box.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE));
 
@@ -106,15 +106,15 @@ public abstract class AbstractEntityCollectionElement<ENTITY> extends
                setLayoutComposite(container);
 
                addControl(container);
-               Layout containerLayout = CdmFormFactory.LAYOUT(2, false);
+               Layout containerLayout = LayoutConstants.LAYOUT(2, false);
 
                container.setLayout(containerLayout);
-               container.setLayoutData(CdmFormFactory.FILL_HORIZONTALLY());
+               container.setLayoutData(LayoutConstants.FILL_HORIZONTALLY());
 
                if (removeListener != null) {
                        button_remove = formFactory.createButton(box, null, SWT.PUSH);
                        addControl(button_remove);
-                       button_remove.setLayoutData(CdmFormFactory.RIGHT());
+                       button_remove.setLayoutData(LayoutConstants.RIGHT());
                        button_remove.setImage(ImageResources
                                        .getImage(ImageResources.TRASH_ICON));
                        button_remove.setToolTipText("Remove");
@@ -129,7 +129,7 @@ public abstract class AbstractEntityCollectionElement<ENTITY> extends
 
        /**
         * Init gets executed before any other setup of the section takes place
-        * 
+        *
         * Implement this if you want to configure the section
         */
        public void init() {
@@ -140,7 +140,7 @@ public abstract class AbstractEntityCollectionElement<ENTITY> extends
         * <p>
         * Setter for the field <code>entity</code>.
         * </p>
-        * 
+        *
         * @param entity
         *            a ENTITY object.
         */
@@ -150,10 +150,11 @@ public abstract class AbstractEntityCollectionElement<ENTITY> extends
         * <p>
         * Getter for the field <code>entity</code>.
         * </p>
-        * 
+        *
         * @return a ENTITY object.
         */
-       public ENTITY getEntity() {
+       @Override
+    public ENTITY getEntity() {
                return entity;
        }
 
@@ -161,7 +162,7 @@ public abstract class AbstractEntityCollectionElement<ENTITY> extends
         * <p>
         * createControls
         * </p>
-        * 
+        *
         * @param element
         *            a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement}
         *            object.
@@ -173,7 +174,8 @@ public abstract class AbstractEntityCollectionElement<ENTITY> extends
        /**
         * Mark <code>this</code> element as selected.
         */
-       public void setSelected(boolean selected) {
+       @Override
+    public void setSelected(boolean selected) {
 
                for (ICdmFormElement element : getElements()) {
                        if (element instanceof ISelectable) {
@@ -185,7 +187,7 @@ public abstract class AbstractEntityCollectionElement<ENTITY> extends
 
        /*
         * (non-Javadoc)
-        * 
+        *
         * @see
         * eu.etaxonomy.taxeditor.forms.AbstractCdmFormElement#propertyChange(org
         * .eclipse.jface.util.PropertyChangeEvent)
@@ -206,14 +208,15 @@ public abstract class AbstractEntityCollectionElement<ENTITY> extends
         * <p>
         * handleEvent
         * </p>
-        * 
+        *
         * @param eventSource
         *            a {@link java.lang.Object} object.
         */
        public abstract void handleEvent(Object eventSource);
 
        /** {@inheritDoc} */
-       public void setBackground(Color color) {
+       @Override
+    public void setBackground(Color color) {
                backgroundColor = color;
                super.setBackground(color);
                box.setBackground(color);
@@ -222,15 +225,17 @@ public abstract class AbstractEntityCollectionElement<ENTITY> extends
 
        /**
         * {@inheritDoc}
-        * 
+        *
         * React when selection occurs
         */
-       public void widgetSelected(SelectionEvent e) {
+       @Override
+    public void widgetSelected(SelectionEvent e) {
 
        }
 
        /** {@inheritDoc} */
-       public void widgetDefaultSelected(SelectionEvent e) {
+       @Override
+    public void widgetDefaultSelected(SelectionEvent e) {
        }
 
        /** {@inheritDoc} */
@@ -243,7 +248,7 @@ public abstract class AbstractEntityCollectionElement<ENTITY> extends
         * <p>
         * Getter for the field <code>backgroundColor</code>.
         * </p>
-        * 
+        *
         * @return the backgroundColor
         */
        public Color getBackgroundColor() {
@@ -254,11 +259,12 @@ public abstract class AbstractEntityCollectionElement<ENTITY> extends
         * <p>
         * getConversationHolder
         * </p>
-        * 
+        *
         * @return a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder}
         *         object.
         */
-       public ConversationHolder getConversationHolder() {
+       @Override
+    public ConversationHolder getConversationHolder() {
                if (getParentElement() instanceof IConversationEnabled) {
                        return ((IConversationEnabled) getParentElement())
                                        .getConversationHolder();
@@ -268,6 +274,7 @@ public abstract class AbstractEntityCollectionElement<ENTITY> extends
        }
 
        /** {@inheritDoc} */
-       public void update(CdmDataChangeMap changeEvents) {
+       @Override
+    public void update(CdmDataChangeMap changeEvents) {
        }
 }