SideBySide2: Refactor coloring logic to new top level class

Break out the code used to color modified regions, moving it all to a
new top level class in the package.  This class unfortunately also has
to keep track of the LineMapper and the padding widgets.

Change-Id: Id72d36cbf1d3bd3fe9df220521901ec50b4c5ddb
This commit is contained in:
Shawn Pearce
2013-12-26 11:49:56 -08:00
parent 60f71145c9
commit 19c68eb621
6 changed files with 401 additions and 328 deletions

View File

@@ -22,6 +22,7 @@ import com.google.gerrit.client.changes.ChangeInfo;
import com.google.gerrit.client.changes.ChangeInfo.RevisionInfo;
import com.google.gerrit.client.changes.ReviewInfo;
import com.google.gerrit.client.changes.Util;
import com.google.gerrit.client.diff.DiffInfo.Region;
import com.google.gerrit.client.patches.PatchUtil;
import com.google.gerrit.client.rpc.CallbackGroup;
import com.google.gerrit.client.rpc.GerritCallback;
@@ -313,7 +314,10 @@ class Header extends Composite {
return nextPath;
}
void setNoDiff(boolean visible) {
UIObject.setVisible(noDiff, visible);
void setNoDiff(DiffInfo diff) {
JsArray<Region> regions = diff.content();
boolean b = regions.length() == 0
|| (regions.length() == 1 && regions.get(0).ab() != null);
UIObject.setVisible(noDiff, b);
}
}