summaryrefslogtreecommitdiffstats
path: root/webapp
diff options
context:
space:
mode:
authorShawn O. Pearce <sop@google.com>2008-12-04 18:38:09 -0800
committerShawn O. Pearce <sop@google.com>2008-12-04 18:38:09 -0800
commitf1fe3367a0e2a43107aaf60ad14e395689acc842 (patch)
tree5343066c10aa0e43b54772169ced2ac11a15296b /webapp
parent64a9acab79af07ee65b7ce3086fa4208094fdebf (diff)
Define a basic display of the patches in a patch set
Signed-off-by: Shawn O. Pearce <sop@google.com>
Diffstat (limited to 'webapp')
-rw-r--r--webapp/src/com/google/gerrit/client/Link.java36
-rw-r--r--webapp/src/com/google/gerrit/client/changes/AccountDashboardScreen.java2
-rw-r--r--webapp/src/com/google/gerrit/client/changes/ChangeConstants.java7
-rw-r--r--webapp/src/com/google/gerrit/client/changes/ChangeConstants.properties7
-rw-r--r--webapp/src/com/google/gerrit/client/changes/ChangeDetailService.java5
-rw-r--r--webapp/src/com/google/gerrit/client/changes/ChangeDetailServiceImpl.java18
-rw-r--r--webapp/src/com/google/gerrit/client/changes/ChangeInfoBlock.java3
-rw-r--r--webapp/src/com/google/gerrit/client/changes/ChangeMessages.java2
-rw-r--r--webapp/src/com/google/gerrit/client/changes/ChangeMessages.properties3
-rw-r--r--webapp/src/com/google/gerrit/client/changes/ChangeScreen.java2
-rw-r--r--webapp/src/com/google/gerrit/client/changes/MineStarredScreen.java2
-rw-r--r--webapp/src/com/google/gerrit/client/changes/PatchSetPanel.java25
-rw-r--r--webapp/src/com/google/gerrit/client/changes/PatchTable.java116
-rw-r--r--webapp/src/com/google/gerrit/client/data/ChangeDetail.java12
-rw-r--r--webapp/src/com/google/gerrit/client/data/PatchSetDetail.java50
-rw-r--r--webapp/src/com/google/gerrit/client/patches/PatchScreen.java27
-rw-r--r--webapp/src/com/google/gerrit/client/patches/PatchSideBySideScreen.java23
-rw-r--r--webapp/src/com/google/gerrit/client/patches/PatchUnifiedScreen.java23
-rw-r--r--webapp/src/com/google/gerrit/client/reviewdb/Patch.java4
-rw-r--r--webapp/src/com/google/gerrit/client/ui/FancyFlexTable.java11
-rw-r--r--webapp/src/com/google/gerrit/client/ui/PatchLink.java51
-rw-r--r--webapp/src/com/google/gerrit/public/Gerrit.css39
22 files changed, 441 insertions, 27 deletions
diff --git a/webapp/src/com/google/gerrit/client/Link.java b/webapp/src/com/google/gerrit/client/Link.java
index 2a87088ea4..d31c4dc188 100644
--- a/webapp/src/com/google/gerrit/client/Link.java
+++ b/webapp/src/com/google/gerrit/client/Link.java
@@ -20,10 +20,15 @@ import com.google.gerrit.client.changes.ChangeScreen;
import com.google.gerrit.client.changes.MineStarredScreen;
import com.google.gerrit.client.data.AccountInfo;
import com.google.gerrit.client.data.ChangeInfo;
+import com.google.gerrit.client.patches.PatchSideBySideScreen;
+import com.google.gerrit.client.patches.PatchUnifiedScreen;
import com.google.gerrit.client.reviewdb.Account;
import com.google.gerrit.client.reviewdb.Change;
+import com.google.gerrit.client.reviewdb.Patch;
+import com.google.gerrit.client.reviewdb.PatchSet;
import com.google.gerrit.client.rpc.RpcUtil;
import com.google.gerrit.client.ui.Screen;
+import com.google.gwt.http.client.URL;
import com.google.gwt.user.client.HistoryListener;
public class Link implements HistoryListener {
@@ -57,6 +62,21 @@ public class Link implements HistoryListener {
return "dashboard," + acct.get();
}
+ public static String toPatchSideBySide(final Patch.Id id) {
+ return toPatch("sidebyside", id);
+ }
+
+ public static String toPatchUnified(final Patch.Id id) {
+ return toPatch("unified", id);
+ }
+
+ public static String toPatch(final String type, final Patch.Id id) {
+ final PatchSet.Id psId = id.getParentKey();
+ final Change.Id chId = psId.getParentKey();
+ final String encp = encodePath(id.get());
+ return "patch," + type + "," + chId.get() + "," + psId.get() + "," + encp;
+ }
+
public void onHistoryChanged(final String token) {
final Screen s = select(token);
if (s != null) {
@@ -79,6 +99,12 @@ public class Link implements HistoryListener {
else if (MINE_STARRED.equals(token))
return new MineStarredScreen();
+ else if (token.startsWith("patch,sidebyside,"))
+ return new PatchSideBySideScreen(patchId(token));
+
+ else if (token.startsWith("patch,unified,"))
+ return new PatchUnifiedScreen(patchId(token));
+
else if (token.matches("^change,\\d+$")) {
final String id = token.substring("change,".length());
return new ChangeScreen(Change.Id.fromString(id));
@@ -87,8 +113,18 @@ public class Link implements HistoryListener {
else if (token.matches("^dashboard,\\d+$")) {
final String id = token.substring("dashboard,".length());
return new AccountDashboardScreen(new Account.Id(Integer.parseInt(id)));
+
}
return null;
}
+
+ private static Patch.Id patchId(final String token) {
+ final String[] p = token.split(",");
+ final Change.Id cId = Change.Id.fromString(p[2]);
+ final PatchSet.Id psId = new PatchSet.Id(cId, Integer.parseInt(p[3]));
+ return new Patch.Id(psId, URL.decodeComponent(p[4]));
+ }
+
+ private static native String encodePath(String path) /*-{ return encodeURIComponent(path).replace(/%20/g, "+").replace(/%2F/g, "/"); }-*/;
}
diff --git a/webapp/src/com/google/gerrit/client/changes/AccountDashboardScreen.java b/webapp/src/com/google/gerrit/client/changes/AccountDashboardScreen.java
index f1936844a7..481afa1f7d 100644
--- a/webapp/src/com/google/gerrit/client/changes/AccountDashboardScreen.java
+++ b/webapp/src/com/google/gerrit/client/changes/AccountDashboardScreen.java
@@ -80,6 +80,6 @@ public class AccountDashboardScreen extends Screen {
byOwner.display(r.getByOwner());
forReview.display(r.getForReview());
closed.display(r.getClosed());
- table.finishDisplay();
+ table.finishDisplay(true);
}
}
diff --git a/webapp/src/com/google/gerrit/client/changes/ChangeConstants.java b/webapp/src/com/google/gerrit/client/changes/ChangeConstants.java
index 676ef8e7fd..a65f566bb6 100644
--- a/webapp/src/com/google/gerrit/client/changes/ChangeConstants.java
+++ b/webapp/src/com/google/gerrit/client/changes/ChangeConstants.java
@@ -33,6 +33,13 @@ public interface ChangeConstants extends Constants {
String changeTableColumnLastUpdate();
String changeTableNone();
+ String patchTableColumnName();
+ String patchTableColumnDelta();
+ String patchTableColumnComments();
+ String patchTableColumnDiff();
+ String patchTableDiffSideBySide();
+ String patchTableDiffUnified();
+
String changeScreenDescription();
String changeScreenDependencies();
String changeScreenDependsOn();
diff --git a/webapp/src/com/google/gerrit/client/changes/ChangeConstants.properties b/webapp/src/com/google/gerrit/client/changes/ChangeConstants.properties
index 9f0bc3956a..54a9d61353 100644
--- a/webapp/src/com/google/gerrit/client/changes/ChangeConstants.properties
+++ b/webapp/src/com/google/gerrit/client/changes/ChangeConstants.properties
@@ -13,6 +13,13 @@ changeTableColumnProject = Project
changeTableColumnLastUpdate = LastUpdate
changeTableNone = (None)
+patchTableColumnName = File Path
+patchTableColumnDelta = Delta From
+patchTableColumnComments = Comments
+patchTableColumnDiff = Diff
+patchTableDiffSideBySide = Side-by-Side
+patchTableDiffUnified = Unified
+
changeScreenDescription = Description
changeScreenDependencies = Dependencies
changeScreenDependsOn = Depends On
diff --git a/webapp/src/com/google/gerrit/client/changes/ChangeDetailService.java b/webapp/src/com/google/gerrit/client/changes/ChangeDetailService.java
index 21cdb2fbe8..5045a8276a 100644
--- a/webapp/src/com/google/gerrit/client/changes/ChangeDetailService.java
+++ b/webapp/src/com/google/gerrit/client/changes/ChangeDetailService.java
@@ -15,7 +15,9 @@
package com.google.gerrit.client.changes;
import com.google.gerrit.client.data.ChangeDetail;
+import com.google.gerrit.client.data.PatchSetDetail;
import com.google.gerrit.client.reviewdb.Change;
+import com.google.gerrit.client.reviewdb.PatchSet;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwtjsonrpc.client.AllowCrossSiteRequest;
import com.google.gwtjsonrpc.client.RemoteJsonService;
@@ -23,4 +25,7 @@ import com.google.gwtjsonrpc.client.RemoteJsonService;
public interface ChangeDetailService extends RemoteJsonService {
@AllowCrossSiteRequest
void changeDetail(Change.Id id, AsyncCallback<ChangeDetail> callback);
+
+ @AllowCrossSiteRequest
+ void patchSetDetail(PatchSet.Id key, AsyncCallback<PatchSetDetail> callback);
}
diff --git a/webapp/src/com/google/gerrit/client/changes/ChangeDetailServiceImpl.java b/webapp/src/com/google/gerrit/client/changes/ChangeDetailServiceImpl.java
index d8dbbe8608..b2b6d06d82 100644
--- a/webapp/src/com/google/gerrit/client/changes/ChangeDetailServiceImpl.java
+++ b/webapp/src/com/google/gerrit/client/changes/ChangeDetailServiceImpl.java
@@ -16,7 +16,9 @@ package com.google.gerrit.client.changes;
import com.google.gerrit.client.data.AccountCache;
import com.google.gerrit.client.data.ChangeDetail;
+import com.google.gerrit.client.data.PatchSetDetail;
import com.google.gerrit.client.reviewdb.Change;
+import com.google.gerrit.client.reviewdb.PatchSet;
import com.google.gerrit.client.reviewdb.ReviewDb;
import com.google.gerrit.client.rpc.BaseServiceImplementation;
import com.google.gerrit.client.rpc.NoSuchEntityException;
@@ -45,4 +47,20 @@ public class ChangeDetailServiceImpl extends BaseServiceImplementation
}
});
}
+
+ public void patchSetDetail(final PatchSet.Id id,
+ final AsyncCallback<PatchSetDetail> callback) {
+ run(callback, new Action<PatchSetDetail>() {
+ public PatchSetDetail run(final ReviewDb db) throws OrmException, Failure {
+ final PatchSet ps = db.patchSets().get(id);
+ if (ps == null) {
+ throw new Failure(new NoSuchEntityException());
+ }
+
+ final PatchSetDetail d = new PatchSetDetail();
+ d.load(db, ps);
+ return d;
+ }
+ });
+ }
}
diff --git a/webapp/src/com/google/gerrit/client/changes/ChangeInfoBlock.java b/webapp/src/com/google/gerrit/client/changes/ChangeInfoBlock.java
index 89ab2b2768..66b1c63391 100644
--- a/webapp/src/com/google/gerrit/client/changes/ChangeInfoBlock.java
+++ b/webapp/src/com/google/gerrit/client/changes/ChangeInfoBlock.java
@@ -39,7 +39,8 @@ public class ChangeInfoBlock extends Composite {
public ChangeInfoBlock() {
table = new Grid(R_CNT, 2);
- table.setStyleName("gerrit-ChangeInfoBlock");
+ table.setStyleName("gerrit-InfoBlock");
+ table.addStyleName("gerrit-ChangeInfoBlock");
initRow(R_OWNER, Util.C.changeInfoBlockOwner());
initRow(R_PROJECT, Util.C.changeInfoBlockProject());
diff --git a/webapp/src/com/google/gerrit/client/changes/ChangeMessages.java b/webapp/src/com/google/gerrit/client/changes/ChangeMessages.java
index cdb619cb3d..1eed1f4bd5 100644
--- a/webapp/src/com/google/gerrit/client/changes/ChangeMessages.java
+++ b/webapp/src/com/google/gerrit/client/changes/ChangeMessages.java
@@ -24,4 +24,6 @@ public interface ChangeMessages extends Messages {
String changeScreenTitleId(int id);
String patchSetHeader(int id);
String repoDownload(String project, int change, int ps);
+
+ String patchTableComments(@PluralCount int count);
}
diff --git a/webapp/src/com/google/gerrit/client/changes/ChangeMessages.properties b/webapp/src/com/google/gerrit/client/changes/ChangeMessages.properties
index c5eb04c1e1..08a51abb03 100644
--- a/webapp/src/com/google/gerrit/client/changes/ChangeMessages.properties
+++ b/webapp/src/com/google/gerrit/client/changes/ChangeMessages.properties
@@ -5,3 +5,6 @@ changesReviewableBy = Changes reviewable by {0}
changeScreenTitleId = Change {0}
patchSetHeader = Patch Set {0}
repoDownload = repo download {0} {1}/{2}
+
+patchTableComments[one] = 1 comment
+patchTableComments = {0} comments
diff --git a/webapp/src/com/google/gerrit/client/changes/ChangeScreen.java b/webapp/src/com/google/gerrit/client/changes/ChangeScreen.java
index 40aaf4804b..e80f96682c 100644
--- a/webapp/src/com/google/gerrit/client/changes/ChangeScreen.java
+++ b/webapp/src/com/google/gerrit/client/changes/ChangeScreen.java
@@ -179,7 +179,7 @@ public class ChangeScreen extends Screen {
}
if (ps == currps) {
- psp.ensureLoaded();
+ psp.ensureLoaded(detail.getCurrentPatchSetDetail());
} else {
panel.addEventHandler(psp);
}
diff --git a/webapp/src/com/google/gerrit/client/changes/MineStarredScreen.java b/webapp/src/com/google/gerrit/client/changes/MineStarredScreen.java
index 5b9eba881a..1800ea98c9 100644
--- a/webapp/src/com/google/gerrit/client/changes/MineStarredScreen.java
+++ b/webapp/src/com/google/gerrit/client/changes/MineStarredScreen.java
@@ -49,7 +49,7 @@ public class MineStarredScreen extends AccountScreen {
Util.LIST_SVC.myStarredChanges(new GerritCallback<List<ChangeInfo>>() {
public void onSuccess(final List<ChangeInfo> result) {
starred.display(result);
- table.finishDisplay();
+ table.finishDisplay(true);
}
});
}
diff --git a/webapp/src/com/google/gerrit/client/changes/PatchSetPanel.java b/webapp/src/com/google/gerrit/client/changes/PatchSetPanel.java
index ce72876d49..1d8732ccbf 100644
--- a/webapp/src/com/google/gerrit/client/changes/PatchSetPanel.java
+++ b/webapp/src/com/google/gerrit/client/changes/PatchSetPanel.java
@@ -15,7 +15,9 @@
package com.google.gerrit.client.changes;
import com.google.gerrit.client.data.ChangeDetail;
+import com.google.gerrit.client.data.PatchSetDetail;
import com.google.gerrit.client.reviewdb.PatchSet;
+import com.google.gerrit.client.rpc.GerritCallback;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.DisclosureEvent;
import com.google.gwt.user.client.ui.DisclosureHandler;
@@ -32,6 +34,7 @@ class PatchSetPanel extends Composite implements DisclosureHandler {
private final FlowPanel body;
private Grid infoTable;
+ private PatchTable patchTable;
PatchSetPanel(final ChangeDetail detail, final PatchSet ps) {
changeDetail = detail;
@@ -40,9 +43,10 @@ class PatchSetPanel extends Composite implements DisclosureHandler {
initWidget(body);
}
- public void ensureLoaded() {
+ public void ensureLoaded(final PatchSetDetail detail) {
infoTable = new Grid(R_CNT, 2);
- infoTable.setStyleName("gerrit-ChangeInfoBlock");
+ infoTable.setStyleName("gerrit-InfoBlock");
+ infoTable.addStyleName("gerrit-PatchSetInfoBlock");
initRow(R_DOWNLOAD, Util.C.patchSetInfoDownload());
@@ -51,16 +55,29 @@ class PatchSetPanel extends Composite implements DisclosureHandler {
itfmt.addStyleName(0, 1, "topmost");
itfmt.addStyleName(R_CNT - 1, 0, "bottomheader");
itfmt.addStyleName(R_DOWNLOAD, 1, "command");
- body.add(infoTable);
infoTable.setText(R_DOWNLOAD, 1, Util.M.repoDownload(changeDetail
.getChange().getDest().getParentKey().get(), changeDetail.getChange()
.getId(), patchSet.getId()));
+
+ patchTable = new PatchTable();
+ patchTable.setSavePointerId("patchTable "
+ + changeDetail.getChange().getId() + " " + patchSet.getId());
+ patchTable.display(detail.getPatches());
+ patchTable.finishDisplay(false);
+
+ body.add(infoTable);
+ body.add(patchTable);
}
public void onOpen(final DisclosureEvent event) {
if (infoTable == null) {
- ensureLoaded();
+ Util.DETAIL_SVC.patchSetDetail(patchSet.getKey(),
+ new GerritCallback<PatchSetDetail>() {
+ public void onSuccess(final PatchSetDetail result) {
+ ensureLoaded(result);
+ }
+ });
}
}
diff --git a/webapp/src/com/google/gerrit/client/changes/PatchTable.java b/webapp/src/com/google/gerrit/client/changes/PatchTable.java
new file mode 100644
index 0000000000..1baacc7a35
--- /dev/null
+++ b/webapp/src/com/google/gerrit/client/changes/PatchTable.java
@@ -0,0 +1,116 @@
+// Copyright 2008 Google Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.google.gerrit.client.changes;
+
+import com.google.gerrit.client.Link;
+import com.google.gerrit.client.reviewdb.Patch;
+import com.google.gerrit.client.ui.FancyFlexTable;
+import com.google.gerrit.client.ui.PatchLink;
+import com.google.gwt.user.client.History;
+import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
+import com.google.gwt.user.client.ui.HTMLTable.CellFormatter;
+
+import java.util.List;
+
+public class PatchTable extends FancyFlexTable<Patch> {
+ private static final int C_TYPE = 1;
+ private static final int C_NAME = 2;
+ private static final int C_DELTA = 3;
+ private static final int C_COMMENTS = 4;
+ private static final int C_DIFF = 5;
+ private static final int N_DIFF = 2;
+
+ public PatchTable() {
+ table.setText(0, C_TYPE, "");
+ table.setText(0, C_NAME, Util.C.patchTableColumnName());
+ table.setText(0, C_DELTA, Util.C.patchTableColumnDelta());
+ table.setText(0, C_COMMENTS, Util.C.patchTableColumnComments());
+ table.setText(0, C_DIFF, Util.C.patchTableColumnDiff());
+
+ final FlexCellFormatter fmt = table.getFlexCellFormatter();
+ fmt.addStyleName(0, C_TYPE, S_ICON_HEADER);
+ fmt.addStyleName(0, C_NAME, S_DATA_HEADER);
+ fmt.addStyleName(0, C_DELTA, S_DATA_HEADER);
+ fmt.addStyleName(0, C_COMMENTS, S_DATA_HEADER);
+ fmt.addStyleName(0, C_DIFF, S_DATA_HEADER);
+ fmt.setColSpan(0, C_DIFF, N_DIFF);
+ }
+
+ @Override
+ protected Object getRowItemKey(final Patch item) {
+ return item.getKey();
+ }
+
+ @Override
+ protected void onOpenItem(final Patch item) {
+ History.newItem(Link.toPatchSideBySide(item.getKey()));
+ }
+
+ @Override
+ protected void applyDataRowStyle(final int row) {
+ super.applyDataRowStyle(row);
+ final CellFormatter fmt = table.getCellFormatter();
+ fmt.addStyleName(row, C_TYPE, "ChangeTypeCell");
+ fmt.addStyleName(row, C_NAME, S_DATA_CELL);
+ fmt.addStyleName(row, C_NAME, "NoWrap");
+ fmt.addStyleName(row, C_DELTA, S_DATA_CELL);
+ fmt.addStyleName(row, C_COMMENTS, S_DATA_CELL);
+ fmt.addStyleName(row, C_COMMENTS, "CommentCell");
+ fmt.addStyleName(row, C_DIFF + 0, S_DATA_CELL);
+ fmt.addStyleName(row, C_DIFF + 1, S_DATA_CELL);
+ }
+
+ public void display(final List<Patch> list) {
+ final int sz = list != null ? list.size() : 0;
+ int dataRows = table.getRowCount() - 1;
+ while (sz < dataRows) {
+ table.removeRow(dataRows);
+ dataRows--;
+ }
+
+ for (int i = 0; i < sz; i++) {
+ if (dataRows <= i) {
+ table.insertRow(++dataRows);
+ applyDataRowStyle(i + 1);
+ }
+ populate(i + 1, list.get(i));
+ }
+ }
+
+ private void populate(final int row, final Patch patch) {
+ table.setWidget(row, C_ARROW, null);
+ table.setText(row, C_TYPE, "" + patch.getChangeType().getCode());
+
+ final PatchLink nameLink;
+ nameLink = new PatchLink.SideBySide(patch.getKey().get(), patch.getKey());
+ table.setWidget(row, C_NAME, nameLink);
+
+ table.clearCell(row, C_DELTA);
+
+ final int cnt = patch.getCommentCount();
+ if (cnt == 0) {
+ table.clearCell(row, C_COMMENTS);
+ } else {
+ table.setText(row, C_COMMENTS, Util.M.patchTableComments(cnt));
+ }
+
+ table.setWidget(row, C_DIFF + 0, new PatchLink.SideBySide(Util.C
+ .patchTableDiffSideBySide(), patch.getKey()));
+ table.setWidget(row, C_DIFF + 1, new PatchLink.Unified(Util.C
+ .patchTableDiffUnified(), patch.getKey()));
+
+ setRowItem(row, patch);
+ }
+}
diff --git a/webapp/src/com/google/gerrit/client/data/ChangeDetail.java b/webapp/src/com/google/gerrit/client/data/ChangeDetail.java
index 6b7b70712c..f68c4e9c58 100644
--- a/webapp/src/com/google/gerrit/client/data/ChangeDetail.java
+++ b/webapp/src/com/google/gerrit/client/data/ChangeDetail.java
@@ -19,7 +19,6 @@ import com.google.gerrit.client.reviewdb.Account;
import com.google.gerrit.client.reviewdb.Change;
import com.google.gerrit.client.reviewdb.ChangeApproval;
import com.google.gerrit.client.reviewdb.PatchSet;
-import com.google.gerrit.client.reviewdb.PatchSetInfo;
import com.google.gerrit.client.reviewdb.ReviewDb;
import com.google.gwtorm.client.OrmException;
@@ -38,7 +37,7 @@ public class ChangeDetail {
protected List<PatchSet> patchSets;
protected List<ApprovalDetail> approvals;
protected PatchSet.Id currentPatchSetId;
- protected PatchSetInfo currentPatchSetInfo;
+ protected PatchSetDetail currentDetail;
public ChangeDetail() {
}
@@ -73,7 +72,8 @@ public class ChangeDetail {
currentPatchSetId = change.currentPatchSetId();
if (currentPatchSetId != null) {
- currentPatchSetInfo = db.patchSetInfo().get(currentPatchSetId);
+ currentDetail = new PatchSetDetail();
+ currentDetail.load(db, getCurrentPatchSet());
}
}
@@ -116,11 +116,11 @@ public class ChangeDetail {
return null;
}
- public PatchSetInfo getCurrentPatchSetInfo() {
- return currentPatchSetInfo;
+ public PatchSetDetail getCurrentPatchSetDetail() {
+ return currentDetail;
}
public String getDescription() {
- return currentPatchSetInfo != null ? currentPatchSetInfo.getMessage() : "";
+ return currentDetail != null ? currentDetail.getInfo().getMessage() : "";
}
}
diff --git a/webapp/src/com/google/gerrit/client/data/PatchSetDetail.java b/webapp/src/com/google/gerrit/client/data/PatchSetDetail.java
new file mode 100644
index 0000000000..4eca6e4019
--- /dev/null
+++ b/webapp/src/com/google/gerrit/client/data/PatchSetDetail.java
@@ -0,0 +1,50 @@
+// Copyright 2008 Google Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.google.gerrit.client.data;
+
+import com.google.gerrit.client.reviewdb.Patch;
+import com.google.gerrit.client.reviewdb.PatchSet;
+import com.google.gerrit.client.reviewdb.PatchSetInfo;
+import com.google.gerrit.client.reviewdb.ReviewDb;
+import com.google.gwtorm.client.OrmException;
+
+import java.util.List;
+
+public class PatchSetDetail {
+ protected PatchSet patchSet;
+ protected PatchSetInfo info;
+ protected List<Patch> patches;
+
+ public PatchSetDetail() {
+ }
+
+ public void load(final ReviewDb db, final PatchSet ps) throws OrmException {
+ patchSet = ps;
+ info = db.patchSetInfo().get(patchSet.getKey());
+ patches = db.patches().byPatchSet(patchSet.getKey()).toList();
+ }
+
+ public PatchSet getPatchSet() {
+ return patchSet;
+ }
+
+ public PatchSetInfo getInfo() {
+ return info;
+ }
+
+ public List<Patch> getPatches() {
+ return patches;
+ }
+}
diff --git a/webapp/src/com/google/gerrit/client/patches/PatchScreen.java b/webapp/src/com/google/gerrit/client/patches/PatchScreen.java
new file mode 100644
index 0000000000..ffae7d0862
--- /dev/null
+++ b/webapp/src/com/google/gerrit/client/patches/PatchScreen.java
@@ -0,0 +1,27 @@
+// Copyright 2008 Google Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.google.gerrit.client.patches;
+
+import com.google.gerrit.client.reviewdb.Patch;
+import com.google.gerrit.client.ui.Screen;
+
+public class PatchScreen extends Screen {
+ protected final Patch.Id patchId;
+
+ public PatchScreen(final Patch.Id id) {
+ patchId = id;
+ setTitleText(id.get());
+ }
+}
diff --git a/webapp/src/com/google/gerrit/client/patches/PatchSideBySideScreen.java b/webapp/src/com/google/gerrit/client/patches/PatchSideBySideScreen.java
new file mode 100644
index 0000000000..6aea677e5a
--- /dev/null
+++ b/webapp/src/com/google/gerrit/client/patches/PatchSideBySideScreen.java
@@ -0,0 +1,23 @@
+// Copyright 2008 Google Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.google.gerrit.client.patches;
+
+import com.google.gerrit.client.reviewdb.Patch;
+
+public class PatchSideBySideScreen extends PatchScreen {
+ public PatchSideBySideScreen(final Patch.Id id) {
+ super(id);
+ }
+}
diff --git a/webapp/src/com/google/gerrit/client/patches/PatchUnifiedScreen.java b/webapp/src/com/google/gerrit/client/patches/PatchUnifiedScreen.java
new file mode 100644
index 0000000000..f664a53b81
--- /dev/null
+++ b/webapp/src/com/google/gerrit/client/patches/PatchUnifiedScreen.java
@@ -0,0 +1,23 @@
+// Copyright 2008 Google Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.google.gerrit.client.patches;
+
+import com.google.gerrit.client.reviewdb.Patch;
+
+public class PatchUnifiedScreen extends PatchScreen {
+ public PatchUnifiedScreen(final Patch.Id id) {
+ super(id);
+ }
+}
diff --git a/webapp/src/com/google/gerrit/client/reviewdb/Patch.java b/webapp/src/com/google/gerrit/client/reviewdb/Patch.java
index eb87198c3a..731376b877 100644
--- a/webapp/src/com/google/gerrit/client/reviewdb/Patch.java
+++ b/webapp/src/com/google/gerrit/client/reviewdb/Patch.java
@@ -92,6 +92,10 @@ public final class Patch {
setChangeType(type);
}
+ public Patch.Id getKey() {
+ return key;
+ }
+
public int getCommentCount() {
return nbrComments;
}
diff --git a/webapp/src/com/google/gerrit/client/ui/FancyFlexTable.java b/webapp/src/com/google/gerrit/client/ui/FancyFlexTable.java
index 55c25fceca..51ada1ea1d 100644
--- a/webapp/src/com/google/gerrit/client/ui/FancyFlexTable.java
+++ b/webapp/src/com/google/gerrit/client/ui/FancyFlexTable.java
@@ -29,7 +29,6 @@ import com.google.gwt.user.client.ui.Image;
import com.google.gwt.user.client.ui.KeyboardListener;
import com.google.gwt.user.client.ui.KeyboardListenerAdapter;
import com.google.gwt.user.client.ui.Widget;
-import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
import java.util.LinkedHashMap;
import java.util.Map.Entry;
@@ -85,13 +84,13 @@ public abstract class FancyFlexTable<RowItem> extends Composite implements
});
initWidget(focusy);
- final FlexCellFormatter fmt = table.getFlexCellFormatter();
table.setText(0, C_ARROW, "");
- fmt.addStyleName(0, C_ARROW, S_ICON_HEADER);
+ table.getCellFormatter().addStyleName(0, C_ARROW, S_ICON_HEADER);
}
protected RowItem getRowItem(final int row) {
- return getRowItem(table.getCellFormatter().getElement(row, 0));
+ return FancyFlexTable.<RowItem> getRowItem(table.getCellFormatter()
+ .getElement(row, 0));
}
protected void setRowItem(final int row, final RowItem item) {
@@ -171,7 +170,7 @@ public abstract class FancyFlexTable<RowItem> extends Composite implements
table.getCellFormatter().addStyleName(newRow, C_ARROW, S_ICON_CELL);
}
- public void finishDisplay() {
+ public void finishDisplay(final boolean requestFocus) {
if (saveId != null) {
final Object oldId = savedPositions.get(saveId);
if (oldId != null) {
@@ -190,7 +189,7 @@ public abstract class FancyFlexTable<RowItem> extends Composite implements
onDown();
}
- if (currentRow >= 0) {
+ if (requestFocus && currentRow >= 0) {
DeferredCommand.addCommand(new Command() {
public void execute() {
setFocus(true);
diff --git a/webapp/src/com/google/gerrit/client/ui/PatchLink.java b/webapp/src/com/google/gerrit/client/ui/PatchLink.java
new file mode 100644
index 0000000000..3f2a0ff7da
--- /dev/null
+++ b/webapp/src/com/google/gerrit/client/ui/PatchLink.java
@@ -0,0 +1,51 @@
+// Copyright 2008 Google Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.google.gerrit.client.ui;
+
+import com.google.gerrit.client.Link;
+import com.google.gerrit.client.patches.PatchSideBySideScreen;
+import com.google.gerrit.client.patches.PatchUnifiedScreen;
+import com.google.gerrit.client.reviewdb.Patch;
+
+public abstract class PatchLink extends DirectScreenLink {
+ protected Patch.Id id;
+
+ public PatchLink(final String text, final Patch.Id p, final String token) {
+ super(text, token);
+ id = p;
+ }
+
+ public static class SideBySide extends PatchLink {
+ public SideBySide(final String text, final Patch.Id p) {
+ super(text, p, Link.toPatchSideBySide(p));
+ }
+
+ @Override
+ protected Screen createScreen() {
+ return new PatchSideBySideScreen(id);
+ }
+ }
+
+ public static class Unified extends PatchLink {
+ public Unified(final String text, final Patch.Id p) {
+ super(text, p, Link.toPatchUnified(p));
+ }
+
+ @Override
+ protected Screen createScreen() {
+ return new PatchUnifiedScreen(id);
+ }
+ }
+}
diff --git a/webapp/src/com/google/gerrit/public/Gerrit.css b/webapp/src/com/google/gerrit/public/Gerrit.css
index f4520af794..fc616d3178 100644
--- a/webapp/src/com/google/gerrit/public/Gerrit.css
+++ b/webapp/src/com/google/gerrit/public/Gerrit.css
@@ -123,6 +123,24 @@
border-bottom: 1px solid #d4e9a9;
}
+.gerrit-ChangeTable .ChangeTypeCell {
+ width: 1px;
+ padding-left: 5px;
+ padding-right: 5px;
+ border-right: 1px solid #d4e9a9;
+ border-bottom: 1px solid #d4e9a9;
+}
+
+.gerrit-ChangeTable .CommentCell {
+ text-align: right;
+ font-weight: bold;
+ white-space: nowrap;
+}
+
+.gerrit-ChangeTable .NoWrap {
+ white-space: nowrap;
+}
+
.gerrit-ChangeTable .DataCell {
padding-left: 5px;
padding-right: 5px;
@@ -232,11 +250,14 @@
.gerrit-ChangeInfoBlock {
float: right;
clear: right;
+}
+
+.gerrit-InfoBlock {
border-collapse: collapse;
border-spacing: 0;
}
-.gerrit-ChangeInfoBlock td {
+.gerrit-InfoBlock td {
padding: 2px 4px 2px 6px;
border-right: 1px solid #d4e9a9;
border-bottom: 1px solid #d4e9a9;
@@ -244,36 +265,40 @@
white-space: nowrap;
}
-.gerrit-ChangeInfoBlock td.topmost {
+.gerrit-InfoBlock td.topmost {
border-top: 1px solid #d4e9a9;
}
-.gerrit-ChangeInfoBlock td.header {
+.gerrit-InfoBlock td.header {
border-bottom: 1px solid white;
background-color: #d4e9a9;
font-style: italic;
text-align: right;
}
-.gerrit-ChangeInfoBlock td.bottomheader {
+.gerrit-InfoBlock td.bottomheader {
border-bottom: 1px solid #d4e9a9;
}
-.gerrit-ChangeInfoBlock td.closedstate {
+.gerrit-InfoBlock td.closedstate {
font-weight: bold;
}
-.gerrit-ChangeInfoBlock td.permalink {
+.gerrit-InfoBlock td.permalink {
border-right: 1px none;
border-bottom: 1px none;
text-align: right;
}
-.gerrit-ChangeInfoBlock td.command {
+.gerrit-InfoBlock td.command {
white-space: pre;
font-family: Courier New, Courier, monospace;
}
+.gerrit-PatchSetInfoBlock {
+ margin-bottom: 10px;
+}
+
.gerrit-PatchSetLink {
padding-left: 20px;
font-size: 8pt;