Replace the All Diff buttons on the ChangeScreen with links

The action buttons to open the diff for all files in own tabs consumed
a lot of space due to the long label texts. Both actions are used by
only a few user and don't need to be so prominent on the ChangeScreen.
The action buttons were removed and instead there are now links in the
bottom line of the patch table which provide the same functionality.

Change-Id: I499012a9c80f76a79a0c1b33906932b3ba0a9d07
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
Edwin Kempin
2012-11-14 03:13:21 +01:00
parent b581c998a2
commit 2bdde8a3be
3 changed files with 48 additions and 35 deletions

View File

@@ -138,5 +138,5 @@ reviewed = Reviewed
submitFailed = Submit Failed
buttonClose = Close
buttonDiffAllSideBySide = Diff All Side-by-Side
buttonDiffAllUnified = Diff All Unified
buttonDiffAllSideBySide = All Side-by-Side
buttonDiffAllUnified = All Unified

View File

@@ -32,7 +32,6 @@ import com.google.gerrit.reviewdb.client.AccountGeneralPreferences;
import com.google.gerrit.reviewdb.client.AuthType;
import com.google.gerrit.reviewdb.client.Change;
import com.google.gerrit.reviewdb.client.ChangeMessage;
import com.google.gerrit.reviewdb.client.Patch;
import com.google.gerrit.reviewdb.client.PatchSet;
import com.google.gerrit.reviewdb.client.PatchSetInfo;
import com.google.gerrit.reviewdb.client.Project;
@@ -183,7 +182,6 @@ class PatchSetComplexDisclosurePanel extends ComplexDisclosurePanel
}
}
}
populateDiffAllActions(detail);
body.add(actionsPanel);
}
}
@@ -597,35 +595,6 @@ class PatchSetComplexDisclosurePanel extends ComplexDisclosurePanel
}
}
private void populateDiffAllActions(final PatchSetDetail detail) {
final Button diffAllSideBySide = new Button(Util.C.buttonDiffAllSideBySide());
diffAllSideBySide.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
for (Patch p : detail.getPatches()) {
openWindow(Dispatcher.toPatchSideBySide(diffBaseId, p.getKey()));
}
}
});
actionsPanel.add(diffAllSideBySide);
final Button diffAllUnified = new Button(Util.C.buttonDiffAllUnified());
diffAllUnified.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
for (Patch p : detail.getPatches()) {
openWindow(Dispatcher.toPatchUnified(diffBaseId, p.getKey()));
}
}
});
actionsPanel.add(diffAllUnified);
}
private void openWindow(String token) {
String url = Window.Location.getPath() + "#" + token;
Window.open(url, "_blank", null);
}
private void populateReviewAction() {
final Button b = new Button(Util.C.buttonReview());
b.addClickHandler(new ClickHandler() {

View File

@@ -14,6 +14,7 @@
package com.google.gerrit.client.changes;
import com.google.gerrit.client.Dispatcher;
import com.google.gerrit.client.Gerrit;
import com.google.gerrit.client.patches.PatchScreen;
import com.google.gerrit.client.ui.InlineHyperlink;
@@ -34,6 +35,8 @@ import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.KeyCodes;
import com.google.gwt.event.dom.client.KeyPressEvent;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.FlowPanel;
import com.google.gwt.user.client.ui.HTMLTable.Cell;
@@ -432,6 +435,40 @@ public class PatchTable extends Composite {
detail, PatchTable.this));
}
void initializeLastRow(int row) {
table.setWidget(
row,
C_SIDEBYSIDE - 2,
new InlineHyperlink(Util.C.buttonDiffAllSideBySide(), History
.getToken()) {
@Override
public void go() {
for (Patch p : detail.getPatches()) {
openWindow(Dispatcher.toPatchSideBySide(base, p.getKey()));
}
}
});
int C_UNIFIED = C_SIDEBYSIDE - 2 + 1;
table.setWidget(
row,
C_UNIFIED,
new InlineHyperlink(Util.C.buttonDiffAllUnified(), History
.getToken()) {
@Override
public void go() {
for (Patch p : detail.getPatches()) {
openWindow(Dispatcher.toPatchUnified(base, p.getKey()));
}
}
});
}
private void openWindow(String token) {
String url = Window.Location.getPath() + "#" + token;
Window.open(url, "_blank", null);
}
void appendHeader(final SafeHtmlBuilder m) {
m.openTr();
@@ -591,7 +628,7 @@ public class PatchTable extends Composite {
m.closeTr();
}
void appendTotals(final SafeHtmlBuilder m, int ins, int dels,
void appendLastRow(final SafeHtmlBuilder m, int ins, int dels,
final boolean isReverseDiff) {
m.openTr();
@@ -617,6 +654,12 @@ public class PatchTable extends Composite {
m.append(Util.M.patchTableSize_Modify(ins, dels));
m.closeTd();
openlink(m, 2);
m.closeTd();
openlink(m, 1);
m.closeTd();
m.closeTr();
}
@@ -787,8 +830,9 @@ public class PatchTable extends Composite {
return true;
}
}
table.appendTotals(nc, insertions, deletions, isReverseDiff);
table.appendLastRow(nc, insertions, deletions, isReverseDiff);
table.resetHtml(nc);
table.initializeLastRow(row + 1);
nc = null;
stage = 1;
row = 0;