minor
authorKatja Luther <k.luther@bgbm.org>
Thu, 21 Apr 2016 11:45:58 +0000 (13:45 +0200)
committerKatja Luther <k.luther@bgbm.org>
Thu, 21 Apr 2016 11:45:58 +0000 (13:45 +0200)
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/container/AbstractGroup.java

index dbd4636..75fe684 100644 (file)
@@ -1,8 +1,8 @@
 /**
 * 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.
 */
@@ -42,13 +42,13 @@ import eu.etaxonomy.taxeditor.preference.Resources;
  * @version 1.0
  */
 public abstract class AbstractGroup implements IDropTargetable{
-       
+
        private Composite control;
-       
-       private List<AbstractGroupedContainer> groupedContainers = new ArrayList<AbstractGroupedContainer>(); 
-       
+
+       private final List<AbstractGroupedContainer> groupedContainers = new ArrayList<AbstractGroupedContainer>();
+
        protected TaxonNameEditor editor;
-       
+
        private DropTarget target;
        private DropTargetListener dropListener;
 
@@ -61,15 +61,15 @@ public abstract class AbstractGroup implements IDropTargetable{
        public AbstractGroup(TaxonNameEditor editor){
                this.editor = editor;
        }
-       
+
        protected void createContent(){
                createControl();
-               
+
                createContainers();
-               
+
                // Drop functionality
                this.setDroppable(true);
-               
+
                editor.getManagedForm().reflow(true);
        }
 
@@ -78,22 +78,22 @@ public abstract class AbstractGroup implements IDropTargetable{
         */
        protected void createControl() {
                control = editor.getToolkit().createComposite(editor.getControl());
-               
+
                control.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
                TableWrapLayout layout = new TableWrapLayout();
-               
+
                layout.topMargin = 0;
                layout.rightMargin = 0;
                layout.bottomMargin = 1;
                layout.leftMargin = 0;
-               
+
                layout.verticalSpacing = 0;
                layout.horizontalSpacing = 0;
                control.setLayout(layout);
-               
+
                control.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_GRAY));
        }
-       
+
        /**
         * <p>add</p>
         *
@@ -103,7 +103,7 @@ public abstract class AbstractGroup implements IDropTargetable{
                groupedContainers.add(groupedContainer);
                groupedContainer.setGroup(this);
        }
-       
+
        /**
         * <p>remove</p>
         *
@@ -112,12 +112,12 @@ public abstract class AbstractGroup implements IDropTargetable{
        public void remove(AbstractGroupedContainer groupedContainer){
                groupedContainer.dispose();
                groupedContainers.remove(groupedContainer);
-               
+
                if(!(this instanceof AcceptedGroup) && groupedContainers.isEmpty()){
                        getEditor().removeGroup(this);
                }
-       }       
-       
+       }
+
        /**
         * <p>Getter for the field <code>groupedContainers</code>.</p>
         *
@@ -126,8 +126,8 @@ public abstract class AbstractGroup implements IDropTargetable{
        public List<AbstractGroupedContainer> getGroupedContainers(){
                return groupedContainers;
        }
-       
-       
+
+
        /**
         * <p>setDroppable</p>
         *
@@ -135,15 +135,15 @@ public abstract class AbstractGroup implements IDropTargetable{
         */
        public void setDroppable(boolean droppable) {
                if (droppable) {
-                       Transfer[] types = new Transfer[] {CdmDataTransfer.getInstance()};      
+                       Transfer[] types = new Transfer[] {CdmDataTransfer.getInstance()};
                        int operations = DND.DROP_MOVE;
                        target = new DropTarget(control, operations);
                        target.setTransfer(types);
                        dropListener = new NameEditorDropTargetListener(this);
                        target.addDropListener(dropListener);
-                       
+
                        target.setDropTargetEffect(new NameEditorDropTargetEffect(control));
-                       
+
                } else {
                        if (dropListener != null) {
                                target.removeDropListener(dropListener);
@@ -156,33 +156,37 @@ public abstract class AbstractGroup implements IDropTargetable{
         *
         * @return a {@link eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor} object.
         */
-       public TaxonNameEditor getEditor() {
+       @Override
+    public TaxonNameEditor getEditor() {
                return editor;
        }
 
        /**
         * <p>dragEntered</p>
         */
-       public void dragEntered() {
+       @Override
+    public void dragEntered() {
                Color color = EditorUtil.getColor(Resources.COLOR_DRAG_ENTER);
-                               
+
                for(AbstractGroupedContainer container : groupedContainers){
                        container.setBackground(color);
-               }               
+               }
        }
 
        /**
         * <p>dragLeft</p>
         */
-       public void dragLeft() {
+       @Override
+    public void dragLeft() {
                for(AbstractGroupedContainer container : groupedContainers){
                        container.restoreColor();
                }
        }
-       
+
        /** {@inheritDoc} */
-       public boolean postOperation(CdmBase objectAffectedByOperation) {
-               editor.getMultiPageTaxonEditor().changed(null);
+       @Override
+    public boolean postOperation(CdmBase objectAffectedByOperation) {
+               editor.getMultiPageTaxonEditor().changed(objectAffectedByOperation);
                redraw();
                return true;
        }
@@ -194,9 +198,9 @@ public abstract class AbstractGroup implements IDropTargetable{
                emptyGroup();
                createContainers();
        }
-       
+
        protected abstract void createContainers();
-       
+
        /* (non-Javadoc)
         * @see eu.etaxonomy.taxeditor.editor.IDropTargetable#getControl()
         */
@@ -212,7 +216,7 @@ public abstract class AbstractGroup implements IDropTargetable{
        public boolean onComplete() {
                return true;
        }
-       
+
        public void dispose(){
                if(getControl() != null){
                        for(AbstractGroupedContainer container : getGroupedContainers()){
@@ -222,7 +226,7 @@ public abstract class AbstractGroup implements IDropTargetable{
                        getControl().dispose();
                }
        }
-       
+
        /**
         * @param object
         */
@@ -231,7 +235,7 @@ public abstract class AbstractGroup implements IDropTargetable{
                for(AbstractGroupedContainer container : getGroupedContainers()){
                        container.setMenu(menu);
                }
-               
+
        }
 
        protected void emptyGroup(){