ChangeScreen: introduce renderRevisionInfo
This moves code from renderChangeInfo into a new method renderRevisionInfo. No functional changes intended. This allows us later in a later chagne to refresh the revision actions only separately. Change-Id: I3f451d85fb709f2869b714f0b672a38474a9ef0b
This commit is contained in:
@@ -403,7 +403,8 @@ public class ChangeScreen extends Screen {
|
||||
}
|
||||
}
|
||||
|
||||
private void initRevisionsAction(ChangeInfo info, String revision) {
|
||||
private void initRevisionsAction(ChangeInfo info, String revision,
|
||||
NativeMap<ActionInfo> actions) {
|
||||
int currentPatchSet;
|
||||
if (info.current_revision() != null
|
||||
&& info.revisions().containsKey(info.current_revision())) {
|
||||
@@ -431,11 +432,6 @@ public class ChangeScreen extends Screen {
|
||||
|
||||
RevisionInfo revInfo = info.revision(revision);
|
||||
if (revInfo.draft()) {
|
||||
NativeMap<ActionInfo> actions = revInfo.has_actions()
|
||||
? revInfo.actions()
|
||||
: NativeMap.<ActionInfo> create();
|
||||
actions.copyKeysIntoChildren("id");
|
||||
|
||||
if (actions.containsKey("publish")) {
|
||||
publish.setVisible(true);
|
||||
publish.setTitle(actions.get("publish").title());
|
||||
@@ -1043,19 +1039,7 @@ public class ChangeScreen extends Screen {
|
||||
private void renderChangeInfo(ChangeInfo info) {
|
||||
changeInfo = info;
|
||||
lastDisplayedUpdate = info.updated();
|
||||
RevisionInfo revisionInfo = info.revision(revision);
|
||||
boolean current = info.status().isOpen()
|
||||
&& revision.equals(info.current_revision())
|
||||
&& !revisionInfo.is_edit();
|
||||
|
||||
if (revisionInfo.is_edit()) {
|
||||
statusText.setInnerText(Util.C.changeEdit());
|
||||
} else if (!current && info.status() == Change.Status.NEW) {
|
||||
statusText.setInnerText(Util.C.notCurrent());
|
||||
labels.setVisible(false);
|
||||
} else {
|
||||
statusText.setInnerText(Util.toLongString(info.status()));
|
||||
}
|
||||
labels.set(info);
|
||||
|
||||
renderOwner(info);
|
||||
@@ -1064,7 +1048,6 @@ public class ChangeScreen extends Screen {
|
||||
initReplyButton(info, revision);
|
||||
initIncludedInAction(info);
|
||||
initChangeAction(info);
|
||||
initRevisionsAction(info, revision);
|
||||
initDownloadAction(info, revision);
|
||||
initProjectLinks(info);
|
||||
initBranchLink(info);
|
||||
@@ -1084,6 +1067,40 @@ public class ChangeScreen extends Screen {
|
||||
setVisible(hashtagTableRow, false);
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(Util.M.changeScreenTitleId(info.id_abbreviated()));
|
||||
if (info.subject() != null) {
|
||||
sb.append(": ");
|
||||
sb.append(info.subject());
|
||||
}
|
||||
setWindowTitle(sb.toString());
|
||||
|
||||
RevisionInfo revInfo = info.revision(revision);
|
||||
NativeMap<ActionInfo> actionMap = revInfo.has_actions()
|
||||
? info.actions()
|
||||
: NativeMap.<ActionInfo> create();
|
||||
actionMap.copyKeysIntoChildren("id");
|
||||
renderRevisionInfo(info, actionMap);
|
||||
}
|
||||
|
||||
private void renderRevisionInfo(ChangeInfo info,
|
||||
NativeMap<ActionInfo> actionMap) {
|
||||
RevisionInfo revisionInfo = info.revision(revision);
|
||||
boolean current = info.status().isOpen()
|
||||
&& revision.equals(info.current_revision())
|
||||
&& !revisionInfo.is_edit();
|
||||
|
||||
if (revisionInfo.is_edit()) {
|
||||
statusText.setInnerText(Util.C.changeEdit());
|
||||
} else if (!current && info.status() == Change.Status.NEW) {
|
||||
statusText.setInnerText(Util.C.notCurrent());
|
||||
labels.setVisible(false);
|
||||
} else {
|
||||
statusText.setInnerText(Util.toLongString(info.status()));
|
||||
}
|
||||
|
||||
initRevisionsAction(info, revision, actionMap);
|
||||
|
||||
if (Gerrit.isSignedIn()) {
|
||||
replyAction = new ReplyAction(info, revision,
|
||||
style, commentLinkProcessor, reply, quickApprove);
|
||||
@@ -1105,14 +1122,6 @@ public class ChangeScreen extends Screen {
|
||||
quickApprove.setVisible(false);
|
||||
setVisible(strategy, false);
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(Util.M.changeScreenTitleId(info.id_abbreviated()));
|
||||
if (info.subject() != null) {
|
||||
sb.append(": ");
|
||||
sb.append(info.subject());
|
||||
}
|
||||
setWindowTitle(sb.toString());
|
||||
}
|
||||
|
||||
private void renderOwner(ChangeInfo info) {
|
||||
|
||||
Reference in New Issue
Block a user