ChangeScreen2: Show file change type in file list

For each changed file in the patch set file list, show the
change type (modified, added, deleted or renamed).

Bug: Issue 2111
Change-Id: I97834f6b2e440076123533a27795e7a8a33eb7e8
This commit is contained in:
David Ostrovsky 2013-10-02 20:46:15 +02:00 committed by David Pursehouse
parent f5a4639757
commit e6e28e0f11
4 changed files with 25 additions and 2 deletions

View File

@ -74,6 +74,7 @@ class FileTable extends FlowPanel {
String commonPrefix();
String inserted();
String deleted();
String statusTypeCell();
}
private static final String REVIEWED;
@ -411,6 +412,7 @@ class FileTable extends FlowPanel {
sb.openTr();
sb.openTh().setStyleName(R.css().pointer()).closeTh();
sb.openTh().setStyleName(R.css().reviewed()).closeTh();
sb.openTh().setStyleName(R.css().statusTypeCell()).closeTh();
sb.openTh().append(Util.C.patchTableColumnName()).closeTh();
sb.openTh()
.setAttribute("colspan", 3)
@ -427,6 +429,7 @@ class FileTable extends FlowPanel {
sb.openTr();
sb.openTd().setStyleName(R.css().pointer()).closeTd();
columnReviewed(sb, info);
columnStatus(sb, info);
columnPath(sb, info);
columnComments(sb, info);
columnDelta1(sb, info);
@ -446,6 +449,16 @@ class FileTable extends FlowPanel {
sb.closeTd();
}
private void columnStatus(SafeHtmlBuilder sb, FileInfo info) {
sb.openTd().setStyleName(R.css().statusTypeCell());
if (Patch.COMMIT_MSG.equals(info.path())) {
sb.nbsp();
} else {
sb.append(info.status());
}
sb.closeTd();
}
private void columnPath(SafeHtmlBuilder sb, FileInfo info) {
sb.openTd()
.setStyleName(R.css().pathColumn())
@ -573,6 +586,7 @@ class FileTable extends FlowPanel {
sb.openTr();
sb.openTh().setStyleName(R.css().pointer()).closeTh();
sb.openTh().setStyleName(R.css().reviewed()).closeTh();
sb.openTh().setStyleName(R.css().statusTypeCell()).closeTh();
sb.openTd().closeTd(); // path
sb.openTd().setAttribute("colspan", 3).closeTd(); // comments

View File

@ -65,3 +65,12 @@
display: inline-block;
background-color: #d44;
}
.statusTypeCell {
width: 1px;
padding-left: 5px;
padding-right: 5px;
border-right: 1px solid trimColor;
border-bottom: 1px solid trimColor;
vertical-align: top;
}

View File

@ -29,6 +29,7 @@ public class FileInfo extends JavaScriptObject {
public final native int lines_inserted() /*-{ return this.lines_inserted || 0; }-*/;
public final native int lines_deleted() /*-{ return this.lines_deleted || 0; }-*/;
public final native boolean binary() /*-{ return this.binary || false; }-*/;
public final native String status() /*-{ return this.status; }-*/;
public final native int _row() /*-{ return this._row }-*/;
public final native void _row(int r) /*-{ this._row = r }-*/;

View File

@ -56,8 +56,7 @@ public class FileInfoJson {
Map<String, FileInfo> files = Maps.newTreeMap();
for (PatchListEntry e : list.getPatches()) {
FileInfoJson.FileInfo d = new FileInfoJson.FileInfo();
d.status = e.getChangeType() != Patch.ChangeType.MODIFIED
? e.getChangeType().getCode() : null;
d.status = e.getChangeType().getCode();
d.oldPath = e.getOldName();
if (e.getPatchType() == Patch.PatchType.BINARY) {
d.binary = true;