Improving polytomous key handling
[taxeditor.git] / eu.etaxonomy.taxeditor.editor / src / main / java / eu / etaxonomy / taxeditor / editor / key / AbstractKeyEditor.java
index f3061b6681ecaa8974f030c7f2adb93749dfa597..b860e06a0d53762e5baa8d005ce8886fc9900c2c 100644 (file)
@@ -30,6 +30,8 @@ import org.eclipse.zest.core.viewers.ZoomContributionViewItem;
 import org.eclipse.zest.core.widgets.ZestStyles;
 import org.eclipse.zest.layouts.LayoutAlgorithm;
 import org.eclipse.zest.layouts.LayoutStyles;
+import org.eclipse.zest.layouts.algorithms.CompositeLayoutAlgorithm;
+import org.eclipse.zest.layouts.algorithms.HorizontalShift;
 import org.eclipse.zest.layouts.algorithms.TreeLayoutAlgorithm;
 
 import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
@@ -151,7 +153,7 @@ public abstract class AbstractKeyEditor<T extends IIdentificationKey> extends
 
                        @Override
                        public void controlResized(ControlEvent e) {
-                               applyLayout();
+                               // applyLayout();
                        }
 
                        @Override
@@ -203,7 +205,7 @@ public abstract class AbstractKeyEditor<T extends IIdentificationKey> extends
 
        public void refresh() {
                graphViewer.refresh();
-               graphViewer.applyLayout();
+               // graphViewer.applyLayout();
        }
 
        @Override
@@ -218,9 +220,17 @@ public abstract class AbstractKeyEditor<T extends IIdentificationKey> extends
 
        private LayoutAlgorithm getLayoutAlgoritm() {
                if (layoutAlgoritm == null) {
-                       layoutAlgoritm = new TreeLayoutAlgorithm(
-                                       LayoutStyles.NO_LAYOUT_NODE_RESIZING);
-                       layoutAlgoritm.setEntityAspectRatio(2.5);
+                       layoutAlgoritm = new CompositeLayoutAlgorithm(
+                                       LayoutStyles.NO_LAYOUT_NODE_RESIZING,
+                                       new LayoutAlgorithm[] {
+                                                       new TreeLayoutAlgorithm(
+                                                                       LayoutStyles.NO_LAYOUT_NODE_RESIZING),
+                                                       new HorizontalShift(
+                                                                       LayoutStyles.NO_LAYOUT_NODE_RESIZING) });
+
+                       // layoutAlgoritm = new TreeLayoutAlgorithm(
+                       // LayoutStyles.NO_LAYOUT_NODE_RESIZING);
+                       // layoutAlgoritm.setEntityAspectRatio(2.5);
                }
                return layoutAlgoritm;
        }