diff options
author | Andre Dietisheim | 2010-03-19 19:32:12 +0000 |
---|---|---|
committer | Andre Dietisheim | 2010-03-19 19:32:12 +0000 |
commit | 5a8e9084b9543c3d93915e2ed5d6a5f223d06845 (patch) | |
tree | 340b6efb6c0dd16c5643439a846f60dc67e25571 /plugins/org.eclipse.emf.cdo.ui.branch/src/org/eclipse/emf/cdo/ui | |
parent | 21d7f8c9a395dfd785cb33562759654c137c83a0 (diff) | |
download | cdo-5a8e9084b9543c3d93915e2ed5d6a5f223d06845.tar.gz cdo-5a8e9084b9543c3d93915e2ed5d6a5f223d06845.tar.xz cdo-5a8e9084b9543c3d93915e2ed5d6a5f223d06845.zip |
[256624] [UI] Create a Commit History ViewPart
https://bugs.eclipse.org/bugs/show_bug.cgi?id=256624
sub branch layout bug fixed (strategy has no state any more so it did alternate in a wrong manner)
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.ui.branch/src/org/eclipse/emf/cdo/ui')
4 files changed, 31 insertions, 26 deletions
diff --git a/plugins/org.eclipse.emf.cdo.ui.branch/src/org/eclipse/emf/cdo/ui/internal/branch/layout/AbstractBranchViewLayoutStrategy.java b/plugins/org.eclipse.emf.cdo.ui.branch/src/org/eclipse/emf/cdo/ui/internal/branch/layout/AbstractBranchViewLayoutStrategy.java index 670653da47..0839815540 100644 --- a/plugins/org.eclipse.emf.cdo.ui.branch/src/org/eclipse/emf/cdo/ui/internal/branch/layout/AbstractBranchViewLayoutStrategy.java +++ b/plugins/org.eclipse.emf.cdo.ui.branch/src/org/eclipse/emf/cdo/ui/internal/branch/layout/AbstractBranchViewLayoutStrategy.java @@ -20,11 +20,7 @@ import org.eclipse.zest.layouts.dataStructures.DisplayIndependentRectangle; import org.eclipse.zest.layouts.dataStructures.InternalNode; /** - * 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). - * <p> - * The current implementation may only layout vertically. + * A base strategy that layouts a branch view. * * @author Andre Dietisheim */ diff --git a/plugins/org.eclipse.emf.cdo.ui.branch/src/org/eclipse/emf/cdo/ui/internal/branch/layout/AbstractVerticalLayoutStrategy.java b/plugins/org.eclipse.emf.cdo.ui.branch/src/org/eclipse/emf/cdo/ui/internal/branch/layout/AbstractVerticalLayoutStrategy.java index 56c6dd419e..b1199234f2 100644 --- a/plugins/org.eclipse.emf.cdo.ui.branch/src/org/eclipse/emf/cdo/ui/internal/branch/layout/AbstractVerticalLayoutStrategy.java +++ b/plugins/org.eclipse.emf.cdo.ui.branch/src/org/eclipse/emf/cdo/ui/internal/branch/layout/AbstractVerticalLayoutStrategy.java @@ -19,11 +19,9 @@ import org.eclipse.zest.layouts.dataStructures.DisplayIndependentRectangle; import org.eclipse.zest.layouts.dataStructures.InternalNode; /** - * 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). + * A base strategy that layouts a branch view vertically. It centers its (sibling) nodes below each other while using + * their time stamp to set the y coordinate. * <p> - * The current implementation may only layout vertically. * * @author Andre Dietisheim */ @@ -88,6 +86,8 @@ public abstract class AbstractVerticalLayoutStrategy extends AbstractBranchViewL * the branch point node * @param subBranch * the sub branch + * @param branchPadding + * the padding between branches * @return the branch point translation */ public DisplayIndependentDimension getTranslationToBranchPoint(BranchView subBranch, @@ -99,8 +99,10 @@ public abstract class AbstractVerticalLayoutStrategy extends AbstractBranchViewL * * @param subBranch * the sub branch - * @param latterBranch - * the latter branch + * @param latterBranchView + * the latter branch view + * @param branchPadding + * the padding between branches * @return the latter branch translation */ public DisplayIndependentDimension getTranslationToLatterBranch(BranchView subBranch, BranchView latterBranchView, @@ -120,12 +122,13 @@ public abstract class AbstractVerticalLayoutStrategy extends AbstractBranchViewL * @param branchView * the branch view */ + @Override public void setSubBranchViewLocation(BranchView branchView, BranchView subBranchView, BranchPointNode branchPointNode) { - currentTranslationStrategy = getSubBranchTranslationStrategy(currentTranslationStrategy); + currentTranslationStrategy = getSubBranchTranslationStrategy(branchView, currentTranslationStrategy); // translate branch off the branchPointNode (to the right or to the left) - DisplayIndependentDimension translation = currentTranslationStrategy.getTranslationToBranchPoint( - subBranchView, branchPointNode, getBranchPadding()); + DisplayIndependentDimension translation = currentTranslationStrategy.getTranslationToBranchPoint(subBranchView, + branchPointNode, getBranchPadding()); BranchView latterBranch = branchView.getSecondToLastSubBranchView(); if (latterBranch != null && !GeometryUtils.bottomEndsBefore(subBranchView.getBounds(), latterBranch.getBounds())) { @@ -140,11 +143,14 @@ public abstract class AbstractVerticalLayoutStrategy extends AbstractBranchViewL /** * Returns the strategy that translates the next branch view. It's called for each sub branch view. * - * @param subBranchViewTranslation - * the current translation strategy for sub branch views + * @param branchView + * the branch view to layout + * @param currentTranslationStrategy + * the current translation strategy * @return the current sub branch strategy * @see #LEFT * @see #RIGHT */ - protected abstract SubBranchViewTranslation getSubBranchTranslationStrategy(SubBranchViewTranslation subBranchViewTranslation); + protected abstract SubBranchViewTranslation getSubBranchTranslationStrategy(BranchView branchView, + SubBranchViewTranslation currentTranslationStrategy); } diff --git a/plugins/org.eclipse.emf.cdo.ui.branch/src/org/eclipse/emf/cdo/ui/internal/branch/layout/HorizontallyAlternatingSubBranches.java b/plugins/org.eclipse.emf.cdo.ui.branch/src/org/eclipse/emf/cdo/ui/internal/branch/layout/HorizontallyAlternatingSubBranches.java index 4782543ed8..41b045e8e1 100644 --- a/plugins/org.eclipse.emf.cdo.ui.branch/src/org/eclipse/emf/cdo/ui/internal/branch/layout/HorizontallyAlternatingSubBranches.java +++ b/plugins/org.eclipse.emf.cdo.ui.branch/src/org/eclipse/emf/cdo/ui/internal/branch/layout/HorizontallyAlternatingSubBranches.java @@ -11,11 +11,8 @@ package org.eclipse.emf.cdo.ui.internal.branch.layout; /** - * 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). - * <p> - * The current implementation may only layout vertically. + * A strategy that layouts a branch vertically and displaces sub branch view to the right or to the left. Left and right + * sub branches alternate equally, they're distributed equally. * * @author Andre Dietisheim */ @@ -24,14 +21,20 @@ public class HorizontallyAlternatingSubBranches extends AbstractVerticalLayoutSt /** * Returns the strategy that layouts the next branch view. Starts with right, second call returns left, etc. * + * @param branchView + * the branch view + * @param currentTranslationStrategy + * the current translation strategy * @return the current sub branch strategy * @see #LEFT * @see #RIGHT */ @Override - protected SubBranchViewTranslation getSubBranchTranslationStrategy(SubBranchViewTranslation currentTranslationStrategy) + protected SubBranchViewTranslation getSubBranchTranslationStrategy(BranchView branchView, + SubBranchViewTranslation currentTranslationStrategy) { - if (currentTranslationStrategy == null || currentTranslationStrategy == LEFT) + boolean isPairSubBranch = branchView.getSubBranchViews().size() % 2 == 0; + if (isPairSubBranch) { return RIGHT; } diff --git a/plugins/org.eclipse.emf.cdo.ui.branch/src/org/eclipse/emf/cdo/ui/internal/branch/layout/RightHandSubBranches.java b/plugins/org.eclipse.emf.cdo.ui.branch/src/org/eclipse/emf/cdo/ui/internal/branch/layout/RightHandSubBranches.java index c92d1f4d96..d97db74e82 100644 --- a/plugins/org.eclipse.emf.cdo.ui.branch/src/org/eclipse/emf/cdo/ui/internal/branch/layout/RightHandSubBranches.java +++ b/plugins/org.eclipse.emf.cdo.ui.branch/src/org/eclipse/emf/cdo/ui/internal/branch/layout/RightHandSubBranches.java @@ -10,7 +10,6 @@ */ package org.eclipse.emf.cdo.ui.internal.branch.layout; - /** * 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 @@ -23,7 +22,8 @@ package org.eclipse.emf.cdo.ui.internal.branch.layout; public class RightHandSubBranches extends AbstractVerticalLayoutStrategy { @Override - protected SubBranchViewTranslation getSubBranchTranslationStrategy(SubBranchViewTranslation currentTranslationStrategy) + protected SubBranchViewTranslation getSubBranchTranslationStrategy(BranchView branchView, + SubBranchViewTranslation currentTranslationStrategy) { return RIGHT; } |