SideBySide2: Remove unnecessary "reviewed and next" at bottom
The old side by side view scrolled with the browser window. Placing the link/checkbox at the bottom of the screen was done because the widgets at the top may have scrolled out of file while the user read through the file. This does not apply with CodeMirror managed scrolling. The widgets on the top are still visible. Save vertical screen space (and simplify code) by using only widgets on the top. Change-Id: I202ecb3e5ab15abfa35ad6e8d186adef01b16203
This commit is contained in:

committed by
Michael Zhou

parent
40d4ffaa99
commit
3e08c7391a
@@ -32,7 +32,6 @@ import com.google.gwt.user.client.ui.Anchor;
|
||||
import com.google.gwt.user.client.ui.CheckBox;
|
||||
import com.google.gwt.user.client.ui.Composite;
|
||||
import com.google.gwt.user.client.ui.HTMLPanel;
|
||||
import com.google.gwt.user.client.ui.UIObject;
|
||||
|
||||
class ReviewedPanel extends Composite {
|
||||
interface Binder extends UiBinder<HTMLPanel, ReviewedPanel> {}
|
||||
@@ -50,44 +49,17 @@ class ReviewedPanel extends Composite {
|
||||
|
||||
private PatchSet.Id patchId;
|
||||
private String fileId;
|
||||
private ReviewedPanel other;
|
||||
|
||||
ReviewedPanel(PatchSet.Id id, String path, boolean bottom) {
|
||||
ReviewedPanel(PatchSet.Id id, String path) {
|
||||
initWidget(uiBinder.createAndBindUi(this));
|
||||
patchId = id;
|
||||
fileId = path;
|
||||
if (bottom) {
|
||||
UIObject.setVisible(fileName, false);
|
||||
} else {
|
||||
fileName.setInnerText(path);
|
||||
}
|
||||
fileName.setInnerText(path);
|
||||
nextLink.setHTML(PatchUtil.C.next() + Util.C.nextPatchLinkIcon());
|
||||
}
|
||||
|
||||
static void link(ReviewedPanel top, ReviewedPanel bottom) {
|
||||
top.other = bottom;
|
||||
bottom.other = top;
|
||||
}
|
||||
|
||||
void setReviewed(boolean reviewed) {
|
||||
RestApi api = ChangeApi.revision(patchId)
|
||||
.view("files")
|
||||
.id(fileId)
|
||||
.view("reviewed");
|
||||
if (reviewed) {
|
||||
api.put(CallbackGroup.<ReviewInfo>emptyCallback());
|
||||
} else {
|
||||
api.delete(CallbackGroup.<ReviewInfo>emptyCallback());
|
||||
}
|
||||
toggleReviewedBox(reviewed);
|
||||
}
|
||||
|
||||
private void toggleReviewedBox(boolean reviewed) {
|
||||
checkBox.setValue(reviewed);
|
||||
CheckBox otherBox = other.checkBox;
|
||||
if (otherBox.getValue() != reviewed) {
|
||||
otherBox.setValue(reviewed);
|
||||
}
|
||||
checkBox.setValue(true, true);
|
||||
}
|
||||
|
||||
boolean isReviewed() {
|
||||
@@ -96,7 +68,15 @@ class ReviewedPanel extends Composite {
|
||||
|
||||
@UiHandler("checkBox")
|
||||
void onValueChange(ValueChangeEvent<Boolean> event) {
|
||||
setReviewed(event.getValue());
|
||||
RestApi api = ChangeApi.revision(patchId)
|
||||
.view("files")
|
||||
.id(fileId)
|
||||
.view("reviewed");
|
||||
if (event.getValue()) {
|
||||
api.put(CallbackGroup.<ReviewInfo>emptyCallback());
|
||||
} else {
|
||||
api.delete(CallbackGroup.<ReviewInfo>emptyCallback());
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Implement this to go to the next file in the patchset.
|
||||
|
@@ -78,17 +78,14 @@ public class SideBySide2 extends Screen {
|
||||
interface Binder extends UiBinder<HTMLPanel, SideBySide2> {}
|
||||
private static Binder uiBinder = GWT.create(Binder.class);
|
||||
|
||||
private static final int HEADER_FOOTER = 60 + 15 * 2 + 16 + 26 * 2;
|
||||
private static final int HEADER_FOOTER = 60 + 15 * 2 + 16 + 26;
|
||||
private static final JsArrayString EMPTY =
|
||||
JavaScriptObject.createArray().cast();
|
||||
|
||||
@UiField(provided=true)
|
||||
@UiField(provided = true)
|
||||
ReviewedPanel reviewedTop;
|
||||
|
||||
@UiField(provided=true)
|
||||
ReviewedPanel reviewedBottom;
|
||||
|
||||
@UiField(provided=true)
|
||||
@UiField(provided = true)
|
||||
DiffTable diffTable;
|
||||
|
||||
private final PatchSet.Id base;
|
||||
@@ -127,9 +124,7 @@ public class SideBySide2 extends Screen {
|
||||
this.keyHandlers = new ArrayList<HandlerRegistration>(4);
|
||||
// TODO: Re-implement necessary GlobalKey bindings.
|
||||
addDomHandler(GlobalKey.STOP_PROPAGATION, KeyPressEvent.getType());
|
||||
reviewedTop = new ReviewedPanel(revision, path, false);
|
||||
reviewedBottom = new ReviewedPanel(revision, path, true);
|
||||
ReviewedPanel.link(reviewedTop, reviewedBottom);
|
||||
reviewedTop = new ReviewedPanel(revision, path);
|
||||
add(diffTable = new DiffTable());
|
||||
add(uiBinder.createAndBindUi(this));
|
||||
}
|
||||
|
@@ -20,6 +20,5 @@ limitations under the License.
|
||||
<g:HTMLPanel>
|
||||
<d:ReviewedPanel ui:field='reviewedTop'/>
|
||||
<d:DiffTable ui:field='diffTable' />
|
||||
<d:ReviewedPanel ui:field='reviewedBottom' />
|
||||
</g:HTMLPanel>
|
||||
</ui:UiBinder>
|
||||
|
Reference in New Issue
Block a user