Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.emf.cdo.ui.branch/src/org/eclipse/emf/cdo/ui/internal/branch/layout/RightHandSubBranches.java')
-rw-r--r--org.eclipse.emf.cdo.ui.branch/src/org/eclipse/emf/cdo/ui/internal/branch/layout/RightHandSubBranches.java42
1 files changed, 42 insertions, 0 deletions
diff --git a/org.eclipse.emf.cdo.ui.branch/src/org/eclipse/emf/cdo/ui/internal/branch/layout/RightHandSubBranches.java b/org.eclipse.emf.cdo.ui.branch/src/org/eclipse/emf/cdo/ui/internal/branch/layout/RightHandSubBranches.java
new file mode 100644
index 0000000..4c6f5ed
--- /dev/null
+++ b/org.eclipse.emf.cdo.ui.branch/src/org/eclipse/emf/cdo/ui/internal/branch/layout/RightHandSubBranches.java
@@ -0,0 +1,42 @@
+/**
+ * Copyright (c) 2004 - 2010 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Andre Dietisheim - initial API and implementation
+ */
+package org.eclipse.emf.cdo.ui.internal.branch.layout;
+
+import org.eclipse.emf.cdo.ui.internal.branch.geometry.GeometryUtils;
+
+/**
+ * A strategy that layouts a branch. A branch centers its (sibling) nodes below each other while using their time stamp
+ * to set the y coordinate. Sub-Branches are displaced to the right or to the left (left and right sub branches are
+ * distributed equally).
+ *
+ * @author Andre Dietisheim
+ */
+public class RightHandSubBranches extends AbstractVerticalLayoutStrategy
+{
+ @Override
+ protected SubBranchViewTranslation getSubBranchTranslationStrategy(BranchView branchView,
+ SubBranchViewTranslation currentTranslationStrategy)
+ {
+ return RIGHT;
+ }
+
+ @Override
+ public BranchView getLaterOverlapingBranch(BranchView branchView, BranchView subBranchView)
+ {
+ BranchView overlapingBranch = branchView.getLastSubBranchView();
+ if (overlapingBranch != null
+ && GeometryUtils.bottomEndsBefore(subBranchView.getBounds(), overlapingBranch.getBounds()))
+ {
+ return null;
+ }
+ return overlapingBranch;
+ }
+}

Back to the top