]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - runtime/org.argeo.slc.core/src/main/java/org/argeo/slc/core/execution/DefaultExecutionFlowDescriptorConverter.java
Fix flow tree display
[gpl/argeo-slc.git] / runtime / org.argeo.slc.core / src / main / java / org / argeo / slc / core / execution / DefaultExecutionFlowDescriptorConverter.java
index 1ff50e0db9c0f1c7caf8d54f0993ba7458197798..2d2d28babbddb5cd8f84ad1d8b361299a275504f 100644 (file)
@@ -218,9 +218,17 @@ public class DefaultExecutionFlowDescriptorConverter implements
                        Comparator<ExecutionFlowDescriptor> {
                public int compare(ExecutionFlowDescriptor o1,
                                ExecutionFlowDescriptor o2) {
+                       // TODO: write unit tests for this
                        if (StringUtils.hasText(o1.getPath())
                                        && StringUtils.hasText(o2.getPath())) {
-                               return o1.getPath().compareTo(o2.getPath());
+                               if (o1.getPath().equals(o2.getPath()))
+                                       return o1.getName().compareTo(o2.getName());
+                               else if (o1.getPath().startsWith(o2.getPath()))
+                                       return -1;
+                               else if (o2.getPath().startsWith(o1.getPath()))
+                                       return 1;
+                               else
+                                       return o1.getPath().compareTo(o2.getPath());
                        } else if (!StringUtils.hasText(o1.getPath())
                                        && StringUtils.hasText(o2.getPath())) {
                                return 1;