From 36934dc6effc4d4c72bd5b5f7bbf70de009689c6 Mon Sep 17 00:00:00 2001 From: David Ostrovsky Date: Sun, 8 Sep 2013 19:14:58 +0200 Subject: [PATCH] Remove old change screen The following code was removed: UI: * ChangeScreen (1) * SideBySide (1) * NewChangeScreenBar Database columns in the accounts table: * change_screen * reverse_patch_set_order * comment_visibility_strategy Change-Id: I7ec4a0beb51dd6cb2f7c364df40e7cb5bea786d2 --- Documentation/config-gerrit.txt | 5 - .../user-review-ui-change-view-preference.png | Bin 33595 -> 0 bytes Documentation/rest-api-accounts.txt | 19 - Documentation/user-review-ui.txt | 23 - .../gerrit/common/data/ApprovalDetail.java | 127 --- .../gerrit/common/data/ChangeDetail.java | 286 ------- .../gerrit/common/data/GerritConfig.java | 10 - .../gerrit/common/data/ReviewerResult.java | 117 --- .../com/google/gerrit/client/Dispatcher.java | 206 +---- .../java/com/google/gerrit/client/Gerrit.java | 40 +- .../com/google/gerrit/client/GerritCss.java | 2 - .../client/account/AccountConstants.java | 6 - .../account/AccountConstants.properties | 6 +- .../client/account/MyPreferencesScreen.java | 83 +- .../gerrit/client/account/Preferences.java | 37 - .../client/admin/CreateChangeAction.java | 2 +- .../gerrit/client/change/ChangeScreen2.java | 3 - .../client/change/CherryPickAction.java | 2 +- .../client/change/NewChangeScreenBar.java | 105 --- .../client/change/NewChangeScreenBar.ui.xml | 78 -- .../gerrit/client/change/RevertAction.java | 4 +- .../gerrit/client/changes/ApprovalTable.java | 395 --------- .../gerrit/client/changes/ChangeCache.java | 62 -- .../changes/ChangeDescriptionBlock.java | 48 -- .../client/changes/ChangeDetailCache.java | 261 ------ .../client/changes/ChangeInfoBlock.java | 222 ----- .../gerrit/client/changes/ChangeScreen.java | 774 ------------------ .../gerrit/client/changes/ChangeTable.java | 350 -------- .../client/changes/CommitMessageBlock.java | 77 +- .../client/changes/IncludedInTable.java | 103 --- .../PatchSetComplexDisclosurePanel.java | 736 ----------------- .../gerrit/client/changes/PatchSetsBlock.java | 272 ------ .../gerrit/client/changes/PatchTable.java | 53 +- .../client/changes/PublishCommentScreen.java | 526 ------------ .../google/gerrit/client/changes/Util.java | 10 - .../client/changes/removeReviewerNormal.png | Bin 313 -> 0 bytes .../client/changes/removeReviewerPressed.png | Bin 430 -> 0 bytes .../java/com/google/gerrit/client/gerrit.css | 18 - .../patches/AbstractPatchContentTable.java | 25 +- .../gerrit/client/patches/HistoryTable.java | 13 +- .../gerrit/client/patches/NavLinks.java | 6 +- .../client/patches/PatchSetSelectBox.java | 35 +- .../gerrit/client/patches/PatchUtil.java | 11 +- .../gerrit/client/patches/ReviewedPanels.java | 11 +- .../client/patches/SideBySideTable.java | 684 ---------------- .../client/patches/UnifiedDiffTable.java | 5 - ...tchScreen.java => UnifiedPatchScreen.java} | 146 +--- .../google/gerrit/client/ui/ActionDialog.java | 42 - .../gerrit/client/ui/CherryPickDialog.java | 7 +- .../client/ui/CommentedActionDialog.java | 35 +- .../gerrit/client/ui/CreateChangeDialog.java | 7 +- .../google/gerrit/client/ui/PatchLink.java | 77 +- .../gerrit/httpd/GerritConfigProvider.java | 4 - .../client/AccountGeneralPreferences.java | 57 +- .../gerrit/server/account/GetPreferences.java | 8 - .../gerrit/server/account/SetPreferences.java | 14 - .../gerrit/server/config/SetPreferences.java | 5 +- .../gerrit/server/schema/SchemaVersion.java | 2 +- .../gerrit/server/schema/Schema_104.java | 19 +- 59 files changed, 161 insertions(+), 6120 deletions(-) delete mode 100644 Documentation/images/user-review-ui-change-view-preference.png delete mode 100644 gerrit-common/src/main/java/com/google/gerrit/common/data/ApprovalDetail.java delete mode 100644 gerrit-common/src/main/java/com/google/gerrit/common/data/ChangeDetail.java delete mode 100644 gerrit-common/src/main/java/com/google/gerrit/common/data/ReviewerResult.java delete mode 100644 gerrit-gwtui/src/main/java/com/google/gerrit/client/change/NewChangeScreenBar.java delete mode 100644 gerrit-gwtui/src/main/java/com/google/gerrit/client/change/NewChangeScreenBar.ui.xml delete mode 100644 gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ApprovalTable.java delete mode 100644 gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeCache.java delete mode 100644 gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeDescriptionBlock.java delete mode 100644 gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeDetailCache.java delete mode 100644 gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeInfoBlock.java delete mode 100644 gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeScreen.java delete mode 100644 gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeTable.java delete mode 100644 gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/IncludedInTable.java delete mode 100644 gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/PatchSetComplexDisclosurePanel.java delete mode 100644 gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/PatchSetsBlock.java delete mode 100644 gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/PublishCommentScreen.java delete mode 100644 gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/removeReviewerNormal.png delete mode 100644 gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/removeReviewerPressed.png delete mode 100644 gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/SideBySideTable.java rename gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/{PatchScreen.java => UnifiedPatchScreen.java} (77%) delete mode 100644 gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ActionDialog.java rename gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeResources.java => gerrit-server/src/main/java/com/google/gerrit/server/schema/Schema_104.java (56%) diff --git a/Documentation/config-gerrit.txt b/Documentation/config-gerrit.txt index 5a08698b8e..773818af9b 100644 --- a/Documentation/config-gerrit.txt +++ b/Documentation/config-gerrit.txt @@ -1550,11 +1550,6 @@ Only used when `gerrit.reportBugUrl` is set. + Defaults to "Report Bug". -[[gerrit.changeScreen]]gerrit.changeScreen:: -+ -Default change screen UI to direct users to. Valid values are -`OLD_UI` and `CHANGE_SCREEN2`. Default is `CHANGE_SCREEN2`. - [[gerrit.disableReverseDnsLookup]]gerrit.disableReverseDnsLookup:: + Disables reverse DNS lookup during computing ref log entry for identified user. diff --git a/Documentation/images/user-review-ui-change-view-preference.png b/Documentation/images/user-review-ui-change-view-preference.png deleted file mode 100644 index 825b7f66c8f286d4d33ca23983d5852f69704626..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 33595 zcmZ5{WmH^C7bWh}xVyV+aCdiicXyWt0tELEoZ#*fpwZwC2@u?!5S;0}_r6(c=0~s9 zeXF{vZpp55_Sq*+O+^+Ji4X|_0s>WDPD%p;0vZSb0Y!uW4Sw?ZRICjA<5f*bOBwi zOiw1w0;fdBqe!DA%Zew+L4(8_6HX1m&CA8bBSyjJ%EqrL%frdaZ^F!Pt;NH^AR0m{ zo?;@v>CDd~A}t#z0>zgK(B- zg)ph7(2sOb6eiaH0%6{xs->MO%Z+K7moLo`r@{@esTDA-&elR^v?)_E4=mSU{-~=` ztPcU<{r!tJSFDL3o>#59O*XT8zOSX8zLTqsO|-gwRjDz1n60v;XS|D5RgN`Vtd*;i zi!(&b7?;ngiANmJss=B9u+fQ^F?vSNe@!~{XRV8AKu~~Sd`GE|tV!e-?dYanAJ%7c z#V&uET<-?DtoiVewdk0ryhwB3=#I>Y=-M#LC}3`NxSLbLVqUCQZ-hi*Y^`TX(W{%O zRQ_~AQoL67q)OfpMftu%Mt6IhzFTH6_Fqk1N$vUM$2BfGryH954jykzi8VpHML(igjt(ulUQuJ)?TpXJsrU59Tu ziTzczL0y|kZA;aS&55lCY3(D+)xlK_3*kMhbCoR>tz)e%)h%t!#cjv0<#|biM_EHV zp<|DEpqtaqh{&1SU%lB21G%-M^P_$HA7{>TCJ%c+3pHbVZ*8?JgSAIPA4kT9e+_`j zXHI?&F61n|49|_u&MYj>_x7w@Rc!pZoUJ^bYnfPCZTazgW@&e5?cnYE@aoe1{d|7M z*742U_{q}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n}{qb>6JLP8gp+`HiO22gvY%PV7jp`deF zpTGigcWu_E6^1ypeQGlZ)!eV`}l zU$F5-q$MD^PjCofeZ;@Y!oCal>hK06$<#t z138#3R~P(f)$#j^4&ruU|3DB65ied-lQ)lYtRzij_}BoOnk^j8GCEUdVnS{kg$jK7 zn!RJrMPV?jixmwZxN*@1H^0wn#$tFAXvl%z@tM6d!&}+?t$%ofT7l~H;4V&Wuu*y< zFBzxffn$btaUiQ(A_gn?PR(Ng6-bAWzrx>H_u^H<4hCjM@;*6Rn}5bYbc#?}00=?z zRe_6}j-hb4231%Kx}#t+Er#~=YZb7#F2r;Q9gUSc;nlefTx$W{;< z3OtmB>J*l95A!?)0a-3Li)z|REs7PLOc(Hh3NkYv=PGgqj(1uP36KFs7+Yu3ye8BP zOMi|52@F4(Z#-|KG5#aRTI>lPI|ln0_&>+(%?bg%;v@eJ+}@IzBPGRX{C(f|D@z-9pfOqhX-7t_k;eJloNjN@fvk}QR4A(O`X*bO9bG{& zAx4o<6*7>Ef-oj*p4jva)2Z{$AK;T{vmHIsFZWO=s7^9bN)%}Wub^dm<=gmIAtS1N z+OucxNRq`NtK&t*<#&Wcl;ftyo8`HjBG0OPtbmbcql8UIPm%dY%LSs`tWgXu!J+Ch z4Uqk8tJpHn|18A)*Q{Dn7O&MBH5&-%%{0xJD+asF?A1|x=N`4%8EJjEJBl?_UTTW(99U1Auh8Fcb za~cKnbLlq`6 `Preferences` > `Change View`: - -image::images/user-review-ui-change-view-preference.png[width=800, link="images/user-review-ui-change-view-preference.png"] - -[WARNING] -The old change screen will be removed in a later version of Gerrit. - [[side-by-side]] == Side-by-Side Diff Screen @@ -1156,15 +1142,6 @@ Limitations of the new review UI: - The new side-by-side diff screen isn't able to highlight line endings. -- Unified diff view is missing: -+ -By setting `Diff View (New Change Screen)` in the user preferences to -`Unified Diff` the new change screen can be configured to open the file -diffs in the old unified diff view. - -Users preferring the old review UI can link:#old-change-screen[ -configure the change view] in their preferences. - GERRIT ------ Part of link:index.html[Gerrit Code Review] diff --git a/gerrit-common/src/main/java/com/google/gerrit/common/data/ApprovalDetail.java b/gerrit-common/src/main/java/com/google/gerrit/common/data/ApprovalDetail.java deleted file mode 100644 index 6ec5d0951c..0000000000 --- a/gerrit-common/src/main/java/com/google/gerrit/common/data/ApprovalDetail.java +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright (C) 2008 The Android Open Source Project -// -// 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.common.data; - -import com.google.gerrit.reviewdb.client.Account; -import com.google.gerrit.reviewdb.client.PatchSetApproval; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - -public class ApprovalDetail { - public static List sort(Collection ads, - final int owner) { - List sorted = new ArrayList<>(ads); - Collections.sort(sorted, new Comparator() { - @Override - public int compare(ApprovalDetail o1, ApprovalDetail o2) { - int byOwner = (o2.account.get() == owner ? 1 : 0) - - (o1.account.get() == owner ? 1 : 0); - return byOwner != 0 ? byOwner : (o1.hasNonZero - o2.hasNonZero); - } - }); - return sorted; - } - - protected Account.Id account; - protected List approvals; - protected boolean canRemove; - private Set votable; - - private transient Set approved; - private transient Set rejected; - private transient Map values; - private transient int hasNonZero; - - protected ApprovalDetail() { - } - - public ApprovalDetail(final Account.Id id) { - account = id; - approvals = new ArrayList<>(); - } - - public Account.Id getAccount() { - return account; - } - - public boolean canRemove() { - return canRemove; - } - - public void setCanRemove(boolean removeable) { - canRemove = removeable; - } - - public void approved(String label) { - if (approved == null) { - approved = new HashSet<>(); - } - approved.add(label); - hasNonZero = 1; - } - - public void rejected(String label) { - if (rejected == null) { - rejected = new HashSet<>(); - } - rejected.add(label); - hasNonZero = 1; - } - - public void votable(String label) { - if (votable == null) { - votable = new HashSet<>(); - } - votable.add(label); - } - - public void value(String label, int value) { - if (values == null) { - values = new HashMap<>(); - } - values.put(label, value); - if (value != 0) { - hasNonZero = 1; - } - } - - public boolean isApproved(String label) { - return approved != null && approved.contains(label); - } - - public boolean isRejected(String label) { - return rejected != null && rejected.contains(label); - } - - public boolean canVote(String label) { - return votable != null && votable.contains(label); - } - - public int getValue(String label) { - if (values == null) { - return 0; - } - Integer v = values.get(label); - return v != null ? v : 0; - } -} diff --git a/gerrit-common/src/main/java/com/google/gerrit/common/data/ChangeDetail.java b/gerrit-common/src/main/java/com/google/gerrit/common/data/ChangeDetail.java deleted file mode 100644 index 1b50a473eb..0000000000 --- a/gerrit-common/src/main/java/com/google/gerrit/common/data/ChangeDetail.java +++ /dev/null @@ -1,286 +0,0 @@ -// Copyright (C) 2008 The Android Open Source Project -// -// 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.common.data; - -import com.google.gerrit.extensions.common.SubmitType; -import com.google.gerrit.reviewdb.client.Change; -import com.google.gerrit.reviewdb.client.ChangeMessage; -import com.google.gerrit.reviewdb.client.PatchSet; - -import java.util.List; -import java.util.Set; - -/** Detail necessary to display a change. */ -public class ChangeDetail { - protected AccountInfoCache accounts; - protected boolean allowsAnonymous; - protected boolean canAbandon; - protected boolean canEditCommitMessage; - protected boolean canCherryPick; - protected boolean canEditHashtags; - protected boolean canPublish; - protected boolean canRebase; - protected boolean canRestore; - protected boolean canRevert; - protected boolean canDeleteDraft; - protected Change change; - protected boolean starred; - protected List dependsOn; - protected List neededBy; - protected List patchSets; - protected Set patchSetsWithDraftComments; - protected List submitRecords; - protected SubmitType submitType; - protected SubmitTypeRecord submitTypeRecord; - protected boolean canSubmit; - protected boolean mergeable; - protected List messages; - protected PatchSet.Id currentPatchSetId; - protected PatchSetDetail currentDetail; - protected boolean canEdit; - protected boolean canEditTopicName; - - public ChangeDetail() { - } - - public AccountInfoCache getAccounts() { - return accounts; - } - - public void setAccounts(AccountInfoCache aic) { - accounts = aic; - } - - public boolean isAllowsAnonymous() { - return allowsAnonymous; - } - - public void setAllowsAnonymous(final boolean anon) { - allowsAnonymous = anon; - } - - public boolean canAbandon() { - return canAbandon; - } - - public void setCanAbandon(final boolean a) { - canAbandon = a; - } - - public boolean canEditCommitMessage() { - return canEditCommitMessage; - } - - public void setCanEditCommitMessage(final boolean a) { - canEditCommitMessage = a; - } - - public boolean canCherryPick() { - return canCherryPick; - } - - public void setCanCherryPick(final boolean a) { - canCherryPick = a; - } - - public boolean getCanEditHashtags() { - return canEditHashtags; - } - - public void setCanEditHashtags(final boolean a) { - canEditHashtags = a; - } - - public boolean canPublish() { - return canPublish; - } - - public void setCanPublish(final boolean a) { - canPublish = a; - } - - public boolean canRebase() { - return canRebase; - } - - public void setCanRebase(final boolean a) { - canRebase = a; - } - - public boolean canRestore() { - return canRestore; - } - - public void setCanRestore(final boolean a) { - canRestore = a; - } - - public boolean canRevert() { - return canRevert; - } - - public void setCanRevert(boolean a) { - canRevert = a; - } - - public boolean canSubmit() { - return canSubmit; - } - - public void setCanSubmit(boolean a) { - canSubmit = a; - } - - public boolean canDeleteDraft() { - return canDeleteDraft; - } - - public void setCanDeleteDraft(boolean a) { - canDeleteDraft = a; - } - - public boolean canEditTopicName() { - return canEditTopicName; - } - - public void setCanEditTopicName(boolean a) { - canEditTopicName = a; - } - - public Change getChange() { - return change; - } - - public void setChange(final Change change) { - this.change = change; - this.currentPatchSetId = change.currentPatchSetId(); - } - - public boolean isStarred() { - return starred; - } - - public void setStarred(final boolean s) { - starred = s; - } - - public List getDependsOn() { - return dependsOn; - } - - public void setDependsOn(List d) { - dependsOn = d; - } - - public List getNeededBy() { - return neededBy; - } - - public void setNeededBy(List d) { - neededBy = d; - } - - public List getMessages() { - return messages; - } - - public void setMessages(List m) { - messages = m; - } - - public List getPatchSets() { - return patchSets; - } - - public void setPatchSets(List s) { - patchSets = s; - } - - public void setPatchSetsWithDraftComments(Set pwdc) { - this.patchSetsWithDraftComments = pwdc; - } - - public boolean hasDraftComments(PatchSet.Id id) { - return patchSetsWithDraftComments.contains(id); - } - - public void setSubmitRecords(List all) { - submitRecords = all; - } - - public List getSubmitRecords() { - return submitRecords; - } - - public void setSubmitTypeRecord(SubmitTypeRecord submitTypeRecord) { - this.submitTypeRecord = submitTypeRecord; - } - - public SubmitTypeRecord getSubmitTypeRecord() { - return submitTypeRecord; - } - - public boolean isCurrentPatchSet(final PatchSetDetail detail) { - return currentPatchSetId != null - && detail.getPatchSet().getId().equals(currentPatchSetId); - } - - public PatchSet getCurrentPatchSet() { - if (currentPatchSetId != null) { - // We search through the list backwards because its *very* likely - // that the current patch set is also the last patch set. - // - for (int i = patchSets.size() - 1; i >= 0; i--) { - final PatchSet ps = patchSets.get(i); - if (ps.getId().equals(currentPatchSetId)) { - return ps; - } - } - } - return null; - } - - public PatchSetDetail getCurrentPatchSetDetail() { - return currentDetail; - } - - public void setCurrentPatchSetDetail(PatchSetDetail d) { - currentDetail = d; - } - - public void setCurrentPatchSetId(final PatchSet.Id id) { - currentPatchSetId = id; - } - - public String getDescription() { - return currentDetail != null ? currentDetail.getInfo().getMessage() : ""; - } - - public void setCanEdit(boolean a) { - canEdit = a; - } - - public boolean canEdit() { - return canEdit; - } - - public void setMergeable(boolean m) { - mergeable = m; - } - - public boolean isMergeable() { - return mergeable; - } -} diff --git a/gerrit-common/src/main/java/com/google/gerrit/common/data/GerritConfig.java b/gerrit-common/src/main/java/com/google/gerrit/common/data/GerritConfig.java index f76252fcaf..b93ad3eeb2 100644 --- a/gerrit-common/src/main/java/com/google/gerrit/common/data/GerritConfig.java +++ b/gerrit-common/src/main/java/com/google/gerrit/common/data/GerritConfig.java @@ -16,7 +16,6 @@ package com.google.gerrit.common.data; import com.google.gerrit.reviewdb.client.Account; import com.google.gerrit.reviewdb.client.Account.FieldName; -import com.google.gerrit.reviewdb.client.AccountGeneralPreferences; import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadCommand; import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadScheme; import com.google.gerrit.reviewdb.client.AuthType; @@ -53,7 +52,6 @@ public class GerritConfig implements Cloneable { protected String anonymousCowardName; protected int suggestFrom; protected int changeUpdateDelay; - protected AccountGeneralPreferences.ChangeScreen changeScreen; protected List archiveFormats; protected int largeChangeSize; protected String replyLabel; @@ -278,14 +276,6 @@ public class GerritConfig implements Cloneable { changeUpdateDelay = seconds; } - public AccountGeneralPreferences.ChangeScreen getChangeScreen() { - return changeScreen; - } - - public void setChangeScreen(AccountGeneralPreferences.ChangeScreen ui) { - this.changeScreen = ui; - } - public int getLargeChangeSize() { return largeChangeSize; } diff --git a/gerrit-common/src/main/java/com/google/gerrit/common/data/ReviewerResult.java b/gerrit-common/src/main/java/com/google/gerrit/common/data/ReviewerResult.java deleted file mode 100644 index d696137982..0000000000 --- a/gerrit-common/src/main/java/com/google/gerrit/common/data/ReviewerResult.java +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright (C) 2009 The Android Open Source Project -// -// 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.common.data; - - -import java.util.ArrayList; -import java.util.List; - -/** - * Result from adding or removing a reviewer from a change. - */ -public class ReviewerResult { - protected List errors; - protected ChangeDetail change; - protected int memberCount; - protected boolean askForConfirmation; - - public ReviewerResult() { - errors = new ArrayList<>(); - } - - public void addError(final Error e) { - errors.add(e); - } - - public List getErrors() { - return errors; - } - - public ChangeDetail getChange() { - return change; - } - - public void setChange(final ChangeDetail d) { - change = d; - } - - public int getMemberCount() { - return memberCount; - } - - public void setMemberCount(final int memberCount) { - this.memberCount = memberCount; - } - - public boolean askForConfirmation() { - return askForConfirmation; - } - - public void setAskForConfirmation(final boolean askForConfirmation) { - this.askForConfirmation = askForConfirmation; - } - - public static class Error { - public static enum Type { - /** Name supplied does not match to a registered account or account group. */ - REVIEWER_NOT_FOUND, - - /** The account is inactive. */ - ACCOUNT_INACTIVE, - - /** The account is not permitted to see the change. */ - CHANGE_NOT_VISIBLE, - - /** The groups has no members. */ - GROUP_EMPTY, - - /** The groups has too many members. */ - GROUP_HAS_TOO_MANY_MEMBERS, - - /** The group is not allowed to be added as reviewer. */ - GROUP_NOT_ALLOWED, - - /** Could not remove this reviewer from the change due to ORMException. */ - COULD_NOT_REMOVE, - - /** Not permitted to remove this reviewer from the change. */ - REMOVE_NOT_PERMITTED - } - - protected Type type; - protected String name; - - protected Error() { - } - - public Error(final Type type, final String who) { - this.type = type; - this.name = who; - } - - public Type getType() { - return type; - } - - public String getName() { - return name; - } - - @Override - public String toString() { - return type + " " + name; - } - } -} diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/Dispatcher.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/Dispatcher.java index 8af7e74a0f..da9e7130cd 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/Dispatcher.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/Dispatcher.java @@ -68,11 +68,8 @@ import com.google.gerrit.client.api.ExtensionScreen; import com.google.gerrit.client.change.ChangeScreen2; import com.google.gerrit.client.change.FileTable; import com.google.gerrit.client.changes.AccountDashboardScreen; -import com.google.gerrit.client.changes.ChangeScreen; import com.google.gerrit.client.changes.CustomDashboardScreen; -import com.google.gerrit.client.changes.PatchTable; import com.google.gerrit.client.changes.ProjectDashboardScreen; -import com.google.gerrit.client.changes.PublishCommentScreen; import com.google.gerrit.client.changes.QueryScreen; import com.google.gerrit.client.dashboards.DashboardInfo; import com.google.gerrit.client.dashboards.DashboardList; @@ -82,14 +79,12 @@ import com.google.gerrit.client.documentation.DocScreen; import com.google.gerrit.client.editor.EditScreen; import com.google.gerrit.client.groups.GroupApi; import com.google.gerrit.client.groups.GroupInfo; -import com.google.gerrit.client.patches.PatchScreen; +import com.google.gerrit.client.patches.UnifiedPatchScreen; import com.google.gerrit.client.rpc.GerritCallback; import com.google.gerrit.client.rpc.RestApi; import com.google.gerrit.client.ui.Screen; import com.google.gerrit.common.PageLinks; -import com.google.gerrit.common.data.PatchSetDetail; import com.google.gerrit.reviewdb.client.Account; -import com.google.gerrit.reviewdb.client.AccountGeneralPreferences; import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DiffView; import com.google.gerrit.reviewdb.client.AccountGroup; import com.google.gerrit.reviewdb.client.Change; @@ -99,19 +94,11 @@ import com.google.gerrit.reviewdb.client.Project; import com.google.gwt.core.client.GWT; import com.google.gwt.core.client.RunAsyncCallback; import com.google.gwt.http.client.URL; -import com.google.gwt.user.client.Cookies; import com.google.gwt.user.client.Window; import com.google.gwtorm.client.KeyUtil; public class Dispatcher { - public static final String COOKIE_CS2 = "gerrit_cs2"; - public static boolean changeScreen2; - - public static String toPatchSideBySide(final Patch.Key id) { - return toPatch("", null, id); - } - - public static String toPatchSideBySide(PatchSet.Id diffBase, Patch.Key id) { + public static String toSideBySide(PatchSet.Id diffBase, Patch.Key id) { return toPatch("", diffBase, id); } @@ -130,18 +117,18 @@ public class Dispatcher { return toPatch("unified", diffBase, revision, fileName, null, 0); } - public static String toPatchUnified(final Patch.Key id) { - return toPatch("unified", null, id); - } - - public static String toPatchUnified(PatchSet.Id diffBase, Patch.Key id) { + public static String toUnified(PatchSet.Id diffBase, Patch.Key id) { return toPatch("unified", diffBase, id); } - private static String toPatch(String type, PatchSet.Id diffBase, Patch.Key id) { + public static String toPatch(String type, PatchSet.Id diffBase, Patch.Key id) { return toPatch(type, diffBase, id.getParentKey(), id.get(), null, 0); } + public static String toEditScreen(PatchSet.Id revision, String fileName) { + return toPatch("edit", null, revision, fileName, null, 0); + } + private static String toPatch(String type, PatchSet.Id diffBase, PatchSet.Id revision, String fileName, DisplaySide side, int line) { Change.Id c = revision.getParentKey(); @@ -151,7 +138,8 @@ public class Dispatcher { p.append(diffBase.get()).append(".."); } p.append(revision.getId()).append("/").append(KeyUtil.encode(fileName)); - if (type != null && !type.isEmpty()) { + if (type != null && !type.isEmpty() + && (!"sidebyside".equals(type) || preferUnified())) { p.append(",").append(type); } if (side == DisplaySide.A && line > 0) { @@ -162,28 +150,6 @@ public class Dispatcher { return p.toString(); } - public static String toPatch(final PatchScreen.Type type, final Patch.Key id) { - if (type == PatchScreen.Type.SIDE_BY_SIDE) { - return toPatchSideBySide(id); - } else { - return toPatchUnified(id); - } - } - - public static String toEditScreen(PatchSet.Id revision, String fileName) { - Change.Id c = revision.getParentKey(); - StringBuilder p = new StringBuilder(); - p.append("/c/").append(c).append("/"); - p.append(revision.getId()).append("/").append(KeyUtil.encode(fileName)); - p.append(",edit"); - return p.toString(); - } - - public static String toPublish(PatchSet.Id ps) { - Change.Id c = ps.getParentKey(); - return "/c/" + c + "/" + ps.get() + ",publish"; - } - public static String toGroup(final AccountGroup.Id id) { return ADMIN_GROUPS + id.toString(); } @@ -275,7 +241,6 @@ public class Dispatcher { Gerrit.display(token, new MyGroupsListScreen()); } else if (/* DEPRECATED URL */matchPrefix("/c2/", token)) { - changeScreen2 = true; change(token); } else if (/* LEGACY URL */matchPrefix("all,", token)) { redirectFromLegacyToken(token, legacyAll(token)); @@ -384,11 +349,11 @@ public class Dispatcher { private static String legacyPatch(String token) { if (/* LEGACY URL */matchPrefix("patch,sidebyside,", token)) { - return toPatchSideBySide(Patch.Key.parse(skip(token))); + return toPatch("", null, Patch.Key.parse(skip(token))); } if (/* LEGACY URL */matchPrefix("patch,unified,", token)) { - return toPatchUnified(Patch.Key.parse(skip(token))); + return toPatch("unified", null, Patch.Key.parse(skip(token))); } return null; @@ -553,9 +518,7 @@ public class Dispatcher { panel = null; } Gerrit.display(token, panel == null - ? (isChangeScreen2() - ? new ChangeScreen2(id, null, null, false, mode) - : new ChangeScreen(id)) + ? new ChangeScreen2(id, null, null, false, mode) : new NotFoundScreen()); return; } @@ -593,19 +556,15 @@ public class Dispatcher { rest = rest.substring(0, at); } Patch.Key p = new Patch.Key(ps, KeyUtil.decode(rest)); - patch(token, base, p, side, line, 0, - null, null, null, panel); + patch(token, base, p, side, line, panel); } else { if (panel == null) { - Gerrit.display(token, isChangeScreen2() - ? new ChangeScreen2(id, + Gerrit.display(token, + new ChangeScreen2(id, base != null ? String.valueOf(base.get()) : null, - String.valueOf(ps.get()), false, FileTable.Mode.REVIEW) - : new ChangeScreen(id)); - } else if ("publish".equals(panel)) { - publish(ps); + String.valueOf(ps.get()), false, FileTable.Mode.REVIEW)); } else { Gerrit.display(token, new NotFoundScreen()); } @@ -627,125 +586,50 @@ public class Dispatcher { } } - public static boolean isChangeScreen2() { - if (changeScreen2) { - return true; - } - - AccountGeneralPreferences.ChangeScreen ui = null; - if (Gerrit.isSignedIn()) { - ui = Gerrit.getUserAccount() - .getGeneralPreferences() - .getChangeScreen(); - } - String v = Cookies.getCookie(Dispatcher.COOKIE_CS2); - if (v != null) { - changeScreen2 = "1".equals(v); - return changeScreen2; - } - if (ui == null) { - ui = Gerrit.getConfig().getChangeScreen(); - } - return ui == AccountGeneralPreferences.ChangeScreen.CHANGE_SCREEN2; - } - - private static void publish(final PatchSet.Id ps) { - String token = toPublish(ps); - new AsyncSplit(token) { - @Override - public void onSuccess() { - Gerrit.display(token, select()); - } - - private Screen select() { - return new PublishCommentScreen(ps); - } - }.onSuccess(); - } - - public static void patch(String token, PatchSet.Id base, Patch.Key id, - int patchIndex, PatchSetDetail patchSetDetail, - PatchTable patchTable, PatchScreen.TopView topView) { - patch(token, base, id, null, 0, patchIndex, - patchSetDetail, patchTable, topView, null); - } - - public static void patch(String token, PatchSet.Id baseId, - Patch.Key id, DisplaySide side, int line, - int patchIndex, PatchSetDetail patchSetDetail, - PatchTable patchTable, PatchScreen.TopView topView, + private static void patch(String token, + PatchSet.Id baseId, + Patch.Key id, + DisplaySide side, + int line, String panelType) { - if (id == null) { - Gerrit.display(token, new NotFoundScreen()); - return; - } - String panel = panelType; if (panel == null) { int c = token.lastIndexOf(','); panel = 0 <= c ? token.substring(c + 1) : ""; } - if ("".equals(panel)) { - if (isChangeScreen2()) { - if (Gerrit.isSignedIn() - && DiffView.UNIFIED_DIFF.equals(Gerrit.getUserAccount() - .getGeneralPreferences().getDiffView())) { - sbs1(token, baseId, id, patchIndex, patchSetDetail, patchTable, - topView, PatchScreen.Type.UNIFIED); - return; - } + if ("".equals(panel) || /* DEPRECATED URL */"cm".equals(panel)) { + if (preferUnified()) { + unified1(token, baseId, id); + } else { sbs2(token, baseId, id, side, line, false); - return; } - sbs1(token, baseId, id, patchIndex, patchSetDetail, patchTable, topView, - PatchScreen.Type.SIDE_BY_SIDE); - return; + } else if ("sidebyside".equals(panel)) { + sbs2(token, null, id, side, line, false); } else if ("unified".equals(panel)) { - sbs1(token, baseId, id, patchIndex, patchSetDetail, patchTable, topView, - PatchScreen.Type.UNIFIED); - return; - } else if ("cm".equals(panel)) { - if (Gerrit.isSignedIn() - && DiffView.UNIFIED_DIFF.equals(Gerrit.getUserAccount() - .getGeneralPreferences().getDiffView())) { - sbs1(token, baseId, id, patchIndex, patchSetDetail, patchTable, - topView, PatchScreen.Type.UNIFIED); - return; - } - sbs2(token, baseId, id, side, line, false); - return; - } else if ("".equals(panel) || "sidebyside".equals(panel)) { - sbs1(token, baseId, id, patchIndex, patchSetDetail, patchTable, topView, - PatchScreen.Type.SIDE_BY_SIDE); - return; - } else if (panel.equals("edit")) { - sbs2(token, null, id, null, 0, true); - return; + unified1(token, baseId, id); + } else if ("edit".equals(panel)) { + sbs2(token, null, id, side, line, true); + } else { + Gerrit.display(token, new NotFoundScreen()); } - Gerrit.display(token, new NotFoundScreen()); } - private static void sbs1(final String token, final PatchSet.Id baseId, - final Patch.Key id, final int patchIndex, - final PatchSetDetail patchSetDetail, final PatchTable patchTable, - final PatchScreen.TopView topView, final PatchScreen.Type type) { + private static boolean preferUnified() { + return Gerrit.isSignedIn() + && DiffView.UNIFIED_DIFF.equals(Gerrit.getUserAccount() + .getGeneralPreferences() + .getDiffView()); + } + + private static void unified1(final String token, + final PatchSet.Id baseId, + final Patch.Key id) { GWT.runAsync(new AsyncSplit(token) { @Override public void onSuccess() { - PatchScreen.TopView top = topView == null - ? Gerrit.getPatchScreenTopView() - : topView; - switch (type) { - case SIDE_BY_SIDE: - Gerrit.display(token, new PatchScreen.SideBySide(id, patchIndex, - patchSetDetail, patchTable, top, baseId)); - break; - case UNIFIED: - Gerrit.display(token, new PatchScreen.Unified(id, patchIndex, - patchSetDetail, patchTable, top, baseId)); - break; - } + UnifiedPatchScreen.TopView top = Gerrit.getPatchScreenTopView(); + Gerrit.display(token, new UnifiedPatchScreen(id, top, baseId)); } }); } diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/Gerrit.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/Gerrit.java index 1f33551533..0df5d113f8 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/Gerrit.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/Gerrit.java @@ -31,14 +31,13 @@ import com.google.gerrit.client.config.ConfigServerApi; import com.google.gerrit.client.extensions.TopMenu; import com.google.gerrit.client.extensions.TopMenuItem; import com.google.gerrit.client.extensions.TopMenuList; -import com.google.gerrit.client.patches.PatchScreen; +import com.google.gerrit.client.patches.UnifiedPatchScreen; import com.google.gerrit.client.rpc.CallbackGroup; import com.google.gerrit.client.rpc.GerritCallback; import com.google.gerrit.client.rpc.Natives; import com.google.gerrit.client.ui.LinkMenuBar; import com.google.gerrit.client.ui.LinkMenuItem; import com.google.gerrit.client.ui.MorphingTabPanel; -import com.google.gerrit.client.ui.PatchLink; import com.google.gerrit.client.ui.ProjectLinkMenuItem; import com.google.gerrit.client.ui.Screen; import com.google.gerrit.common.PageLinks; @@ -125,7 +124,7 @@ public class Gerrit implements EntryPoint { private static SearchPanel searchPanel; private static final Dispatcher dispatcher = new Dispatcher(); private static ViewSite body; - private static PatchScreen patchScreen; + private static UnifiedPatchScreen patchScreen; private static String lastChangeListToken; private static String lastViewToken; @@ -139,7 +138,7 @@ public class Gerrit implements EntryPoint { Window.Location.reload(); } - public static PatchScreen.TopView getPatchScreenTopView() { + public static UnifiedPatchScreen.TopView getPatchScreenTopView() { if (patchScreen == null) { return null; } @@ -205,8 +204,8 @@ public class Gerrit implements EntryPoint { */ public static void updateMenus(Screen view) { LinkMenuBar diffBar = menuBars.get(GerritTopMenu.DIFFERENCES.menuName); - if (view instanceof PatchScreen) { - patchScreen = (PatchScreen) view; + if (view instanceof UnifiedPatchScreen) { + patchScreen = (UnifiedPatchScreen) view; menuLeft.setVisible(diffBar, true); menuLeft.selectTab(menuLeft.getWidgetIndex(diffBar)); } else { @@ -637,12 +636,10 @@ public class Gerrit implements EntryPoint { LinkMenuBar diffBar = new LinkMenuBar(); menuBars.put(GerritTopMenu.DIFFERENCES.menuName, diffBar); menuLeft.addInvisible(diffBar, C.menuDiff()); - addDiffLink(diffBar, CC.patchTableDiffSideBySide(), PatchScreen.Type.SIDE_BY_SIDE); - addDiffLink(diffBar, CC.patchTableDiffUnified(), PatchScreen.Type.UNIFIED); - addDiffLink(diffBar, C.menuDiffCommit(), PatchScreen.TopView.COMMIT); - addDiffLink(diffBar, C.menuDiffPreferences(), PatchScreen.TopView.PREFERENCES); - addDiffLink(diffBar, C.menuDiffPatchSets(), PatchScreen.TopView.PATCH_SETS); - addDiffLink(diffBar, C.menuDiffFiles(), PatchScreen.TopView.FILES); + addDiffLink(diffBar, C.menuDiffCommit(), UnifiedPatchScreen.TopView.COMMIT); + addDiffLink(diffBar, C.menuDiffPreferences(), UnifiedPatchScreen.TopView.PREFERENCES); + addDiffLink(diffBar, C.menuDiffPatchSets(), UnifiedPatchScreen.TopView.PATCH_SETS); + addDiffLink(diffBar, C.menuDiffFiles(), UnifiedPatchScreen.TopView.FILES); final LinkMenuBar projectsBar = new LinkMenuBar(); menuBars.put(GerritTopMenu.PROJECTS.menuName, projectsBar); @@ -890,7 +887,7 @@ public class Gerrit implements EntryPoint { } private static void addDiffLink(final LinkMenuBar m, final String text, - final PatchScreen.TopView tv) { + final UnifiedPatchScreen.TopView tv) { m.addItem(new LinkMenuItem(text, "") { @Override public void go() { @@ -943,23 +940,6 @@ public class Gerrit implements EntryPoint { return i; } - private static void addDiffLink(final LinkMenuBar m, final String text, - final PatchScreen.Type type) { - m.addItem(new LinkMenuItem(text, "") { - @Override - public void go() { - if (patchScreen != null) { - patchScreen.setTopView(PatchScreen.TopView.MAIN); - if (type == patchScreen.getPatchScreenType()) { - AnchorElement.as(getElement()).blur(); - } else { - new PatchLink("", type, patchScreen).go(); - } - } - } - }); - } - private static void addDocLink(final LinkMenuBar m, final String text, final String href) { final Anchor atag = anchor(text, selfRedirect("/Documentation/" + href)); diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/GerritCss.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/GerritCss.java index 6891b680c0..1e62573452 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/GerritCss.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/GerritCss.java @@ -221,8 +221,6 @@ public interface GerritCss extends CssResource { String sectionHeader(); String selectPatchSetOldVersion(); String sideBySideScreenLinkTable(); - String sideBySideScreenSideBySideTable(); - String sideBySideTableBinaryHeader(); String singleLine(); String skipLine(); String smallHeading(); diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/AccountConstants.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/AccountConstants.java index f52eb31de3..abcfa0cace 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/AccountConstants.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/AccountConstants.java @@ -25,8 +25,6 @@ public interface AccountConstants extends Constants { String registeredOn(); String accountId(); - String commentVisibilityLabel(); - String changeScreenLabel(); String diffViewLabel(); String maximumPageSizeFieldLabel(); String dateFormatLabel(); @@ -34,7 +32,6 @@ public interface AccountConstants extends Constants { String showSiteHeader(); String useFlashClipboard(); String copySelfOnEmails(); - String reversePatchSetOrder(); String reviewCategoryLabel(); String messageShowInReviewCategoryNone(); String messageShowInReviewCategoryName(); @@ -51,9 +48,6 @@ public interface AccountConstants extends Constants { String myMenuUrl(); String myMenuReset(); - String changeScreenOldUi(); - String changeScreenNewUi(); - String tabAccountSummary(); String tabPreferences(); String tabWatchedProjects(); diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/AccountConstants.properties b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/AccountConstants.properties index 5d48bb8d55..8f151a97cd 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/AccountConstants.properties +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/AccountConstants.properties @@ -8,8 +8,6 @@ accountId = Account ID showSiteHeader = Show Site Header useFlashClipboard = Use Flash Clipboard Widget copySelfOnEmails = CC Me On Comments I Write -reversePatchSetOrder = Display Patch Sets In Reverse Order (deprecated: Old Change Screen) - reviewCategoryLabel = Display In Review Category messageShowInReviewCategoryNone = None (default) messageShowInReviewCategoryName = Show Name @@ -18,9 +16,7 @@ messageShowInReviewCategoryUsername = Show Username messageShowInReviewCategoryAbbrev = Show Abbreviated Name maximumPageSizeFieldLabel = Maximum Page Size: -commentVisibilityLabel = Comment Visibility (deprecated: Old Change Screen): -changeScreenLabel = Change View: -diffViewLabel = Diff View (New Change Screen): +diffViewLabel = Diff View: dateFormatLabel = Date/Time Format: contextWholeFile = Whole File buttonSaveChanges = Save Changes diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyPreferencesScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyPreferencesScreen.java index 9e78866721..23369ac16d 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyPreferencesScreen.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyPreferencesScreen.java @@ -17,7 +17,6 @@ package com.google.gerrit.client.account; import static com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DEFAULT_PAGESIZE; import static com.google.gerrit.reviewdb.client.AccountGeneralPreferences.PAGESIZE_CHOICES; -import com.google.gerrit.client.Dispatcher; import com.google.gerrit.client.Gerrit; import com.google.gerrit.client.StringListPanel; import com.google.gerrit.client.config.ConfigServerApi; @@ -27,7 +26,6 @@ import com.google.gerrit.client.rpc.Natives; import com.google.gerrit.client.rpc.ScreenLoadCallback; import com.google.gerrit.client.ui.OnEditEnabler; import com.google.gerrit.reviewdb.client.AccountGeneralPreferences; -import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.CommentVisibilityStrategy; import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.ReviewCategoryStrategy; import com.google.gwt.core.client.JsArray; import com.google.gwt.event.dom.client.ClickEvent; @@ -49,7 +47,6 @@ public class MyPreferencesScreen extends SettingsScreen { private CheckBox showSiteHeader; private CheckBox useFlashClipboard; private CheckBox copySelfOnEmails; - private CheckBox reversePatchSetOrder; private CheckBox relativeDateInChangeTable; private CheckBox sizeBarInChangeTable; private CheckBox legacycidInChangeTable; @@ -57,8 +54,6 @@ public class MyPreferencesScreen extends SettingsScreen { private ListBox dateFormat; private ListBox timeFormat; private ListBox reviewCategoryStrategy; - private ListBox commentVisibilityStrategy; - private ListBox changeScreen; private ListBox diffView; private StringListPanel myMenus; private Button save; @@ -70,7 +65,6 @@ public class MyPreferencesScreen extends SettingsScreen { showSiteHeader = new CheckBox(Util.C.showSiteHeader()); useFlashClipboard = new CheckBox(Util.C.useFlashClipboard()); copySelfOnEmails = new CheckBox(Util.C.copySelfOnEmails()); - reversePatchSetOrder = new CheckBox(Util.C.reversePatchSetOrder()); maximumPageSize = new ListBox(); for (final short v : PAGESIZE_CHOICES) { maximumPageSize.addItem(Util.M.rowsPerPage(v), String.valueOf(v)); @@ -93,32 +87,6 @@ public class MyPreferencesScreen extends SettingsScreen { Util.C.messageShowInReviewCategoryAbbrev(), AccountGeneralPreferences.ReviewCategoryStrategy.ABBREV.name()); - commentVisibilityStrategy = new ListBox(); - commentVisibilityStrategy.addItem( - com.google.gerrit.client.changes.Util.C.messageCollapseAll(), - AccountGeneralPreferences.CommentVisibilityStrategy.COLLAPSE_ALL.name()); - commentVisibilityStrategy.addItem( - com.google.gerrit.client.changes.Util.C.messageExpandMostRecent(), - AccountGeneralPreferences.CommentVisibilityStrategy.EXPAND_MOST_RECENT.name()); - commentVisibilityStrategy.addItem( - com.google.gerrit.client.changes.Util.C.messageExpandRecent(), - AccountGeneralPreferences.CommentVisibilityStrategy.EXPAND_RECENT.name()); - commentVisibilityStrategy.addItem( - com.google.gerrit.client.changes.Util.C.messageExpandAll(), - AccountGeneralPreferences.CommentVisibilityStrategy.EXPAND_ALL.name()); - - changeScreen = new ListBox(); - changeScreen.addItem( - Util.M.changeScreenServerDefault( - getLabel(Gerrit.getConfig().getChangeScreen())), - ""); - changeScreen.addItem( - Util.C.changeScreenOldUi(), - AccountGeneralPreferences.ChangeScreen.OLD_UI.name()); - changeScreen.addItem( - Util.C.changeScreenNewUi(), - AccountGeneralPreferences.ChangeScreen.CHANGE_SCREEN2.name()); - diffView = new ListBox(); diffView.addItem( com.google.gerrit.client.changes.Util.C.sideBySide(), @@ -165,7 +133,7 @@ public class MyPreferencesScreen extends SettingsScreen { sizeBarInChangeTable = new CheckBox(Util.C.showSizeBarInChangeTable()); legacycidInChangeTable = new CheckBox(Util.C.showLegacycidInChangeTable()); - final Grid formGrid = new Grid(13, 2); + final Grid formGrid = new Grid(11, 2); int row = 0; formGrid.setText(row, labelIdx, ""); @@ -181,11 +149,6 @@ public class MyPreferencesScreen extends SettingsScreen { row++; formGrid.setText(row, labelIdx, ""); - formGrid.setWidget(row, fieldIdx, reversePatchSetOrder); - row++; - - formGrid.setText(row, labelIdx, Util.C.reviewCategoryLabel()); - formGrid.setWidget(row, fieldIdx, reviewCategoryStrategy); row++; formGrid.setText(row, labelIdx, Util.C.maximumPageSizeFieldLabel()); @@ -208,12 +171,8 @@ public class MyPreferencesScreen extends SettingsScreen { formGrid.setWidget(row, fieldIdx, legacycidInChangeTable); row++; - formGrid.setText(row, labelIdx, Util.C.commentVisibilityLabel()); - formGrid.setWidget(row, fieldIdx, commentVisibilityStrategy); - row++; - - formGrid.setText(row, labelIdx, Util.C.changeScreenLabel()); - formGrid.setWidget(row, fieldIdx, changeScreen); + formGrid.setText(row, labelIdx, ""); + formGrid.setWidget(row, fieldIdx, legacycidInChangeTable); row++; formGrid.setText(row, labelIdx, Util.C.diffViewLabel()); @@ -239,16 +198,12 @@ public class MyPreferencesScreen extends SettingsScreen { e.listenTo(showSiteHeader); e.listenTo(useFlashClipboard); e.listenTo(copySelfOnEmails); - e.listenTo(reversePatchSetOrder); e.listenTo(maximumPageSize); e.listenTo(dateFormat); e.listenTo(timeFormat); e.listenTo(relativeDateInChangeTable); e.listenTo(sizeBarInChangeTable); e.listenTo(legacycidInChangeTable); - e.listenTo(reviewCategoryStrategy); - e.listenTo(commentVisibilityStrategy); - e.listenTo(changeScreen); e.listenTo(diffView); } @@ -268,7 +223,6 @@ public class MyPreferencesScreen extends SettingsScreen { showSiteHeader.setEnabled(on); useFlashClipboard.setEnabled(on); copySelfOnEmails.setEnabled(on); - reversePatchSetOrder.setEnabled(on); maximumPageSize.setEnabled(on); dateFormat.setEnabled(on); timeFormat.setEnabled(on); @@ -276,8 +230,6 @@ public class MyPreferencesScreen extends SettingsScreen { sizeBarInChangeTable.setEnabled(on); legacycidInChangeTable.setEnabled(on); reviewCategoryStrategy.setEnabled(on); - commentVisibilityStrategy.setEnabled(on); - changeScreen.setEnabled(on); diffView.setEnabled(on); } @@ -285,7 +237,6 @@ public class MyPreferencesScreen extends SettingsScreen { showSiteHeader.setValue(p.showSiteHeader()); useFlashClipboard.setValue(p.useFlashClipboard()); copySelfOnEmails.setValue(p.copySelfOnEmail()); - reversePatchSetOrder.setValue(p.reversePatchSetOrder()); setListBox(maximumPageSize, DEFAULT_PAGESIZE, p.changesPerPage()); setListBox(dateFormat, AccountGeneralPreferences.DateFormat.STD, // p.dateFormat()); @@ -297,12 +248,6 @@ public class MyPreferencesScreen extends SettingsScreen { setListBox(reviewCategoryStrategy, AccountGeneralPreferences.ReviewCategoryStrategy.NONE, p.reviewCategoryStrategy()); - setListBox(commentVisibilityStrategy, - AccountGeneralPreferences.CommentVisibilityStrategy.EXPAND_RECENT, - p.commentVisibilityStrategy()); - setListBox(changeScreen, - null, - p.changeScreen()); setListBox(diffView, AccountGeneralPreferences.DiffView.SIDE_BY_SIDE, p.diffView()); @@ -373,7 +318,6 @@ public class MyPreferencesScreen extends SettingsScreen { p.setShowSiteHeader(showSiteHeader.getValue()); p.setUseFlashClipboard(useFlashClipboard.getValue()); p.setCopySelfOnEmails(copySelfOnEmails.getValue()); - p.setReversePatchSetOrder(reversePatchSetOrder.getValue()); p.setMaximumPageSize(getListBox(maximumPageSize, DEFAULT_PAGESIZE)); p.setDateFormat(getListBox(dateFormat, AccountGeneralPreferences.DateFormat.STD, @@ -387,15 +331,9 @@ public class MyPreferencesScreen extends SettingsScreen { p.setReviewCategoryStrategy(getListBox(reviewCategoryStrategy, ReviewCategoryStrategy.NONE, ReviewCategoryStrategy.values())); - p.setCommentVisibilityStrategy(getListBox(commentVisibilityStrategy, - CommentVisibilityStrategy.EXPAND_RECENT, - CommentVisibilityStrategy.values())); p.setDiffView(getListBox(diffView, AccountGeneralPreferences.DiffView.SIDE_BY_SIDE, AccountGeneralPreferences.DiffView.values())); - p.setChangeScreen(getListBox(changeScreen, - null, - AccountGeneralPreferences.ChangeScreen.values())); enable(false); save.setEnabled(false); @@ -411,7 +349,6 @@ public class MyPreferencesScreen extends SettingsScreen { public void onSuccess(Preferences prefs) { Gerrit.getUserAccount().setGeneralPreferences(p); Gerrit.applyUserPreferences(); - Dispatcher.changeScreen2 = false; enable(true); display(prefs); Gerrit.refreshMenuBar(); @@ -426,20 +363,6 @@ public class MyPreferencesScreen extends SettingsScreen { }); } - private static String getLabel(AccountGeneralPreferences.ChangeScreen ui) { - if (ui == null) { - return ""; - } - switch (ui) { - case OLD_UI: - return Util.C.changeScreenOldUi(); - case CHANGE_SCREEN2: - return Util.C.changeScreenNewUi(); - default: - return ui.name(); - } - } - private class MyMenuPanel extends StringListPanel { MyMenuPanel(Button save) { super(Util.C.myMenu(), Arrays.asList(Util.C.myMenuName(), diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/Preferences.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/Preferences.java index 9adcaf7fd7..aec679c8cc 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/Preferences.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/Preferences.java @@ -16,8 +16,6 @@ package com.google.gerrit.client.account; import com.google.gerrit.client.extensions.TopMenuItem; import com.google.gerrit.reviewdb.client.AccountGeneralPreferences; -import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.ChangeScreen; -import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.CommentVisibilityStrategy; import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DateFormat; import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DiffView; import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadCommand; @@ -43,14 +41,11 @@ public class Preferences extends JavaScriptObject { p.copySelfOnEmail(in.isCopySelfOnEmails()); p.dateFormat(in.getDateFormat()); p.timeFormat(in.getTimeFormat()); - p.reversePatchSetOrder(in.isReversePatchSetOrder()); p.relativeDateInChangeTable(in.isRelativeDateInChangeTable()); p.sizeBarInChangeTable(in.isSizeBarInChangeTable()); p.legacycidInChangeTable(in.isLegacycidInChangeTable()); - p.commentVisibilityStrategy(in.getCommentVisibilityStrategy()); p.reviewCategoryStrategy(in.getReviewCategoryStrategy()); p.diffView(in.getDiffView()); - p.changeScreen(in.getChangeScreen()); p.setMyMenus(myMenus); return p; } @@ -98,9 +93,6 @@ public class Preferences extends JavaScriptObject { private final native String timeFormatRaw() /*-{ return this.time_format }-*/; - public final native boolean reversePatchSetOrder() - /*-{ return this.reverse_patch_set_order || false }-*/; - public final native boolean relativeDateInChangeTable() /*-{ return this.relative_date_in_change_table || false }-*/; @@ -117,13 +109,6 @@ public class Preferences extends JavaScriptObject { private final native String reviewCategeoryStrategyRaw() /*-{ return this.review_category_strategy }-*/; - public final CommentVisibilityStrategy commentVisibilityStrategy() { - String s = commentVisibilityStrategyRaw(); - return s != null ? CommentVisibilityStrategy.valueOf(s) : null; - } - private final native String commentVisibilityStrategyRaw() - /*-{ return this.comment_visibility_strategy }-*/; - public final DiffView diffView() { String s = diffViewRaw(); return s != null ? DiffView.valueOf(s) : null; @@ -131,13 +116,6 @@ public class Preferences extends JavaScriptObject { private final native String diffViewRaw() /*-{ return this.diff_view }-*/; - public final ChangeScreen changeScreen() { - String s = changeScreenRaw(); - return s != null ? ChangeScreen.valueOf(s) : null; - } - private final native String changeScreenRaw() - /*-{ return this.change_screen }-*/; - public final native JsArray my() /*-{ return this.my; }-*/; @@ -177,9 +155,6 @@ public class Preferences extends JavaScriptObject { private final native void timeFormatRaw(String f) /*-{ this.time_format = f }-*/; - public final native void reversePatchSetOrder(boolean r) - /*-{ this.reverse_patch_set_order = r }-*/; - public final native void relativeDateInChangeTable(boolean d) /*-{ this.relative_date_in_change_table = d }-*/; @@ -195,24 +170,12 @@ public class Preferences extends JavaScriptObject { private final native void reviewCategoryStrategyRaw(String s) /*-{ this.review_category_strategy = s }-*/; - public final void commentVisibilityStrategy(CommentVisibilityStrategy s) { - commentVisibilityStrategyRaw(s != null ? s.toString() : null); - } - private final native void commentVisibilityStrategyRaw(String s) - /*-{ this.comment_visibility_strategy = s }-*/; - public final void diffView(DiffView d) { diffViewRaw(d != null ? d.toString() : null); } private final native void diffViewRaw(String d) /*-{ this.diff_view = d }-*/; - public final void changeScreen(ChangeScreen s) { - changeScreenRaw(s != null ? s.toString() : null); - } - private final native void changeScreenRaw(String s) - /*-{ this.change_screen = s }-*/; - final void setMyMenus(List myMenus) { initMy(); for (TopMenuItem n : myMenus) { diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/CreateChangeAction.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/CreateChangeAction.java index c0689cb630..652e5eb51d 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/CreateChangeAction.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/CreateChangeAction.java @@ -27,7 +27,7 @@ class CreateChangeAction { static void call(Button b, final String project) { // TODO Replace CreateChangeDialog with a nicer looking display. b.setEnabled(false); - new CreateChangeDialog(b, new Project.NameKey(project)) { + new CreateChangeDialog(new Project.NameKey(project)) { { sendButton.setText(Util.C.buttonCreate()); message.setText(Util.C.buttonCreateDescription()); diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ChangeScreen2.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ChangeScreen2.java index f1a57a5d82..2a1f8c2beb 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ChangeScreen2.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ChangeScreen2.java @@ -579,9 +579,6 @@ public class ChangeScreen2 extends Screen { ChangeGlue.fireShowChange(changeInfo, changeInfo.revision(revision)); CodeMirror.preload(); startPoller(); - if (NewChangeScreenBar.show()) { - add(new NewChangeScreenBar(changeId)); - } } private void scrollToPath(String token) { diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/CherryPickAction.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/CherryPickAction.java index 10d72979ad..b27530e782 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/CherryPickAction.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/CherryPickAction.java @@ -30,7 +30,7 @@ class CherryPickAction { String project, final String commitMessage) { // TODO Replace CherryPickDialog with a nicer looking display. b.setEnabled(false); - new CherryPickDialog(b, new Project.NameKey(project)) { + new CherryPickDialog(new Project.NameKey(project)) { { sendButton.setText(Util.C.buttonCherryPickChangeSend()); if (info.status() == Change.Status.MERGED) { diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/NewChangeScreenBar.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/NewChangeScreenBar.java deleted file mode 100644 index de6eefec51..0000000000 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/NewChangeScreenBar.java +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (C) 2013 The Android Open Source Project -// -// 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.change; - -import com.google.gerrit.client.Dispatcher; -import com.google.gerrit.client.Gerrit; -import com.google.gerrit.client.account.AccountApi; -import com.google.gerrit.common.PageLinks; -import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.ChangeScreen; -import com.google.gerrit.reviewdb.client.Change; -import com.google.gwt.core.client.GWT; -import com.google.gwt.core.client.JavaScriptObject; -import com.google.gwt.dom.client.Element; -import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.uibinder.client.UiBinder; -import com.google.gwt.uibinder.client.UiField; -import com.google.gwt.uibinder.client.UiHandler; -import com.google.gwt.user.client.Cookies; -import com.google.gwt.user.client.rpc.AsyncCallback; -import com.google.gwt.user.client.ui.Anchor; -import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.HTMLPanel; -import com.google.gwt.user.client.ui.UIObject; - -import java.util.Date; - -/** Displays a welcome to the new change screen bar. */ -class NewChangeScreenBar extends Composite { - interface Binder extends UiBinder {} - private static final Binder uiBinder = GWT.create(Binder.class); - - static boolean show() { - if (Gerrit.isSignedIn()) { - return Gerrit.getUserAccount() - .getGeneralPreferences() - .getChangeScreen() == null; - } - return Cookies.getCookie(Dispatcher.COOKIE_CS2) == null; - } - - private final Change.Id id; - - @UiField Element docs; - @UiField Element settings; - @UiField Anchor keepNew; - @UiField Anchor keepOld; - - NewChangeScreenBar(Change.Id id) { - this.id = id; - initWidget(uiBinder.createAndBindUi(this)); - UIObject.setVisible(docs, Gerrit.getConfig().isDocumentationAvailable()); - UIObject.setVisible(settings, Gerrit.isSignedIn()); - } - - @UiHandler("keepOld") - void onKeepOld(@SuppressWarnings("unused") ClickEvent e) { - save(ChangeScreen.OLD_UI); - Gerrit.display(PageLinks.toChange(id)); - } - - @UiHandler("keepNew") - void onKeepNew(@SuppressWarnings("unused") ClickEvent e) { - save(ChangeScreen.CHANGE_SCREEN2); - } - - private void save(ChangeScreen sel) { - removeFromParent(); - Dispatcher.changeScreen2 = sel == ChangeScreen.CHANGE_SCREEN2; - - if (Gerrit.isSignedIn()) { - Gerrit.getUserAccount().getGeneralPreferences().setChangeScreen(sel); - - Prefs in = Prefs.createObject().cast(); - in.change_screen(sel.name()); - AccountApi.self().view("preferences").background().put(in, - new AsyncCallback() { - @Override public void onFailure(Throwable caught) {} - @Override public void onSuccess(JavaScriptObject result) {} - }); - } else { - Cookies.setCookie( - Dispatcher.COOKIE_CS2, - Dispatcher.changeScreen2 ? "1" : "0", - new Date(System.currentTimeMillis() + 7 * 24 * 3600 * 1000)); - } - } - - private static class Prefs extends JavaScriptObject { - final native void change_screen(String n) /*-{ this.change_screen=n }-*/; - protected Prefs() { - } - } -} diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/NewChangeScreenBar.ui.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/NewChangeScreenBar.ui.xml deleted file mode 100644 index 92eff8dbe2..0000000000 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/NewChangeScreenBar.ui.xml +++ /dev/null @@ -1,78 +0,0 @@ - - - - - .popup { - position: fixed; - top: 5px; - left: 50%; - margin-left: -200px; - z-index: 201; - padding-top: 5px; - padding-bottom: 5px; - padding-left: 12px; - padding-right: 12px; - text-align: center; - background: #FFF1A8; - border-radius: 10px; - } - - @if user.agent safari { - .popup { - \-webkit-border-radius: 10px; - } - } - @if user.agent gecko1_8 { - .popup { - \-moz-border-radius: 10px; - } - } - - a.action { - color: #222; - text-decoration: underline; - display: inline-block; - margin-left: 0.5em; - } - .welcome { font-weight: bold; } - - -
Welcome to the new change screen! - Learn more -
-
- You canrevert - to the old screen in Settings > Preferences. - - - Got it! - -
-
-
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RevertAction.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RevertAction.java index dd97d1c4d0..f9c18cdafa 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RevertAction.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RevertAction.java @@ -19,7 +19,7 @@ import com.google.gerrit.client.changes.ChangeApi; import com.google.gerrit.client.changes.ChangeInfo; import com.google.gerrit.client.changes.Util; import com.google.gerrit.client.rpc.GerritCallback; -import com.google.gerrit.client.ui.ActionDialog; +import com.google.gerrit.client.ui.CommentedActionDialog; import com.google.gerrit.common.PageLinks; import com.google.gerrit.reviewdb.client.Change; import com.google.gwt.user.client.ui.Button; @@ -29,7 +29,7 @@ class RevertAction { final String commitSubject) { // TODO Replace ActionDialog with a nicer looking display. b.setEnabled(false); - new ActionDialog(b, false, + new CommentedActionDialog( Util.C.revertChangeTitle(), Util.C.headingRevertMessage()) { { diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ApprovalTable.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ApprovalTable.java deleted file mode 100644 index fc2af89545..0000000000 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ApprovalTable.java +++ /dev/null @@ -1,395 +0,0 @@ -// Copyright (C) 2008 The Android Open Source Project -// -// 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 static com.google.gerrit.common.data.LabelValue.formatValue; - -import com.google.gerrit.client.ConfirmationCallback; -import com.google.gerrit.client.ConfirmationDialog; -import com.google.gerrit.client.ErrorDialog; -import com.google.gerrit.client.Gerrit; -import com.google.gerrit.client.account.AccountInfo; -import com.google.gerrit.client.change.ReviewerSuggestOracle; -import com.google.gerrit.client.change.Reviewers.PostInput; -import com.google.gerrit.client.change.Reviewers.PostResult; -import com.google.gerrit.client.changes.ChangeInfo.ApprovalInfo; -import com.google.gerrit.client.changes.ChangeInfo.LabelInfo; -import com.google.gerrit.client.rpc.GerritCallback; -import com.google.gerrit.client.rpc.Natives; -import com.google.gerrit.client.ui.AccountLinkPanel; -import com.google.gerrit.client.ui.AddMemberBox; -import com.google.gerrit.common.data.ApprovalDetail; -import com.google.gerrit.common.data.SubmitRecord; -import com.google.gerrit.reviewdb.client.Account; -import com.google.gerrit.reviewdb.client.Change; -import com.google.gwt.core.client.JavaScriptObject; -import com.google.gwt.dom.client.Element; -import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.event.dom.client.ClickHandler; -import com.google.gwt.user.client.DOM; -import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.FlowPanel; -import com.google.gwt.user.client.ui.Grid; -import com.google.gwt.user.client.ui.HTMLTable.CellFormatter; -import com.google.gwt.user.client.ui.Image; -import com.google.gwt.user.client.ui.Panel; -import com.google.gwt.user.client.ui.PushButton; -import com.google.gwt.user.client.ui.Widget; -import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** Displays a table of {@link ApprovalDetail} objects for a change record. */ -public class ApprovalTable extends Composite { - private final Grid table; - private final Widget missing; - private final Panel addReviewer; - private final ReviewerSuggestOracle reviewerSuggestOracle; - private final AddMemberBox addMemberBox; - private ChangeInfo lastChange; - private Map rows; - - public ApprovalTable() { - rows = new HashMap<>(); - table = new Grid(1, 3); - table.addStyleName(Gerrit.RESOURCES.css().infoTable()); - - missing = new Widget() { - { - setElement((Element)(DOM.createElement("ul"))); - } - }; - missing.setStyleName(Gerrit.RESOURCES.css().missingApprovalList()); - - addReviewer = new FlowPanel(); - addReviewer.setStyleName(Gerrit.RESOURCES.css().addReviewer()); - reviewerSuggestOracle = new ReviewerSuggestOracle(); - addMemberBox = - new AddMemberBox(Util.C.approvalTableAddReviewer(), - Util.C.approvalTableAddReviewerHint(), reviewerSuggestOracle); - addMemberBox.addClickHandler(new ClickHandler() { - @Override - public void onClick(final ClickEvent event) { - doAddReviewer(); - } - }); - addReviewer.add(addMemberBox); - addReviewer.setVisible(false); - - final FlowPanel fp = new FlowPanel(); - fp.add(table); - fp.add(missing); - fp.add(addReviewer); - initWidget(fp); - - setStyleName(Gerrit.RESOURCES.css().approvalTable()); - } - - /** - * Sets the header row - * - * @param labels The list of labels to display in the header. This list does - * not get resorted, so be sure that the list's elements are in the same - * order as the list of labels passed to the {@code displayRow} method. - */ - private void displayHeader(Collection labels) { - table.resizeColumns(2 + labels.size()); - - final CellFormatter fmt = table.getCellFormatter(); - int col = 0; - - table.setText(0, col, Util.C.approvalTableReviewer()); - fmt.setStyleName(0, col, Gerrit.RESOURCES.css().header()); - col++; - - table.clearCell(0, col); - fmt.setStyleName(0, col, Gerrit.RESOURCES.css().header()); - col++; - - for (String name : labels) { - table.setText(0, col, name); - fmt.setStyleName(0, col, Gerrit.RESOURCES.css().header()); - col++; - } - fmt.addStyleName(0, col - 1, Gerrit.RESOURCES.css().rightmost()); - } - - void display(ChangeInfo change) { - lastChange = change; - reviewerSuggestOracle.setChange(change.legacy_id()); - Map byUser = new LinkedHashMap<>(); - Map accounts = new LinkedHashMap<>(); - List missingLabels = initLabels(change, accounts, byUser); - - removeAllChildren(missing.getElement()); - for (String label : missingLabels) { - addMissingLabel(Util.M.needApproval(label)); - } - - if (byUser.isEmpty()) { - table.setVisible(false); - } else { - List labels = new ArrayList<>(change.labels()); - Collections.sort(labels); - displayHeader(labels); - table.resizeRows(1 + byUser.size()); - int i = 1; - for (ApprovalDetail ad : ApprovalDetail.sort( - byUser.values(), change.owner()._account_id())) { - displayRow(i++, ad, labels, accounts.get(ad.getAccount().get())); - } - table.setVisible(true); - } - - if (change.status() != Change.Status.MERGED - && !change.mergeable()) { - addMissingLabel(Util.C.messageNeedsRebaseOrHasDependency()); - } - missing.setVisible(missing.getElement().getChildCount() > 0); - addReviewer.setVisible(Gerrit.isSignedIn()); - } - - private void removeAllChildren(Element el) { - for (int i = DOM.getChildCount(el) - 1; i >= 0; i--) { - el.removeChild(DOM.getChild(el, i)); - } - } - - private void addMissingLabel(String text) { - Element li = DOM.createElement("li"); - li.setClassName(Gerrit.RESOURCES.css().missingApproval()); - li.setInnerText(text); - DOM.appendChild(missing.getElement(), li); - } - - private Set removableReviewers(ChangeInfo change) { - Set result = - new HashSet<>(change.removable_reviewers().length()); - for (int i = 0; i < change.removable_reviewers().length(); i++) { - result.add(change.removable_reviewers().get(i)._account_id()); - } - return result; - } - - private List initLabels(ChangeInfo change, - Map accounts, - Map byUser) { - Set removableReviewers = removableReviewers(change); - List missing = new ArrayList<>(); - for (String name : change.labels()) { - LabelInfo label = change.label(name); - - String min = null; - String max = null; - for (String v : label.values()) { - if (min == null) { - min = v; - } - if (v.startsWith("+")) { - max = v; - } - } - - if (label.status() == SubmitRecord.Label.Status.NEED) { - missing.add(name); - } - - if (label.all() != null) { - for (ApprovalInfo ai : Natives.asList(label.all())) { - if (!accounts.containsKey(ai._account_id())) { - accounts.put(ai._account_id(), ai); - } - int id = ai._account_id(); - ApprovalDetail ad = byUser.get(id); - if (ad == null) { - ad = new ApprovalDetail(new Account.Id(id)); - ad.setCanRemove(removableReviewers.contains(id)); - byUser.put(id, ad); - } - if (ai.has_value()) { - ad.votable(name); - ad.value(name, ai.value()); - String fv = formatValue(ai.value()); - if (fv.equals(max)) { - ad.approved(name); - } else if (ai.value() < 0 && fv.equals(min)) { - ad.rejected(name); - } - } - } - } - } - return missing; - } - - private void doAddReviewer() { - String reviewer = addMemberBox.getText(); - if (!reviewer.isEmpty()) { - addMemberBox.setEnabled(false); - addReviewer(reviewer, false); - } - } - - private void addReviewer(final String reviewer, boolean confirmed) { - ChangeApi.reviewers(lastChange.legacy_id().get()).post( - PostInput.create(reviewer, confirmed), - new GerritCallback() { - @Override - public void onSuccess(PostResult result) { - addMemberBox.setEnabled(true); - addMemberBox.setText(""); - if (result.error() == null) { - reload(); - } else if (result.confirm()) { - askForConfirmation(result.error()); - } else { - new ErrorDialog(new SafeHtmlBuilder().append(result.error())); - } - } - - private void askForConfirmation(String text) { - String title = Util.C - .approvalTableAddManyReviewersConfirmationDialogTitle(); - ConfirmationDialog confirmationDialog = new ConfirmationDialog( - title, new SafeHtmlBuilder().append(text), - new ConfirmationCallback() { - @Override - public void onOk() { - addReviewer(reviewer, true); - } - }); - confirmationDialog.center(); - } - - @Override - public void onFailure(final Throwable caught) { - addMemberBox.setEnabled(true); - if (isNoSuchEntity(caught)) { - new ErrorDialog(Util.M.reviewerNotFound(reviewer)).center(); - } else { - super.onFailure(caught); - } - } - }); - } - - /** - * Sets the reviewer data for a row. - * - * @param row The number of the row on which to set the reviewer. - * @param ad The details for this reviewer's approval. - * @param labels The list of labels to show. This list does not get resorted, - * so be sure that the list's elements are in the same order as the list - * of labels passed to the {@code displayHeader} method. - * @param account The account information for the approval. - */ - private void displayRow(int row, final ApprovalDetail ad, - List labels, AccountInfo account) { - final CellFormatter fmt = table.getCellFormatter(); - int col = 0; - - table.setWidget(row, col++, new AccountLinkPanel(account)); - rows.put(account._account_id(), row); - - if (ad.canRemove()) { - final PushButton remove = new PushButton( // - new Image(Util.R.removeReviewerNormal()), // - new Image(Util.R.removeReviewerPressed())); - remove.setTitle(Util.M.removeReviewer(account.name())); - remove.setStyleName(Gerrit.RESOURCES.css().removeReviewer()); - remove.addStyleName(Gerrit.RESOURCES.css().link()); - remove.addClickHandler(new ClickHandler() { - @Override - public void onClick(ClickEvent event) { - doRemove(ad, remove); - } - }); - table.setWidget(row, col, remove); - } else { - table.clearCell(row, col); - } - fmt.setStyleName(row, col++, Gerrit.RESOURCES.css().removeReviewerCell()); - - for (String labelName : labels) { - fmt.setStyleName(row, col, Gerrit.RESOURCES.css().approvalscore()); - if (!ad.canVote(labelName)) { - fmt.addStyleName(row, col, Gerrit.RESOURCES.css().notVotable()); - fmt.getElement(row, col).setTitle(Gerrit.C.userCannotVoteToolTip()); - } - - if (ad.isRejected(labelName)) { - table.setWidget(row, col, new Image(Gerrit.RESOURCES.redNot())); - - } else if (ad.isApproved(labelName)) { - table.setWidget(row, col, new Image(Gerrit.RESOURCES.greenCheck())); - - } else { - int v = ad.getValue(labelName); - if (v == 0) { - table.clearCell(row, col); - col++; - continue; - } - String vstr = String.valueOf(ad.getValue(labelName)); - if (v > 0) { - vstr = "+" + vstr; - fmt.addStyleName(row, col, Gerrit.RESOURCES.css().posscore()); - } else { - fmt.addStyleName(row, col, Gerrit.RESOURCES.css().negscore()); - } - table.setText(row, col, vstr); - } - - col++; - } - - fmt.addStyleName(row, col - 1, Gerrit.RESOURCES.css().rightmost()); - } - - private void reload() { - ChangeApi.detail(lastChange.legacy_id().get(), - new GerritCallback() { - @Override - public void onSuccess(ChangeInfo result) { - display(result); - } - }); - } - - private void doRemove(ApprovalDetail ad, final PushButton remove) { - remove.setEnabled(false); - ChangeApi.reviewer(lastChange.legacy_id().get(), ad.getAccount().get()) - .delete(new GerritCallback() { - @Override - public void onSuccess(JavaScriptObject result) { - reload(); - } - - @Override - public void onFailure(final Throwable caught) { - remove.setEnabled(true); - super.onFailure(caught); - } - }); - } -} diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeCache.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeCache.java deleted file mode 100644 index 7fd5290c6b..0000000000 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeCache.java +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (C) 2012 The Android Open Source Project -// -// 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.ui.ListenableValue; -import com.google.gerrit.common.data.ChangeInfo; -import com.google.gerrit.reviewdb.client.Change; - -import java.util.HashMap; -import java.util.Map; - -/** A Cache to store common client side data by change */ -public class ChangeCache { - private static Map caches = new HashMap<>(); - - public static ChangeCache get(Change.Id chg) { - ChangeCache cache = caches.get(chg); - if (cache == null) { - cache = new ChangeCache(chg); - caches.put(chg, cache); - } - return cache; - } - - private Change.Id changeId; - private ChangeDetailCache detail; - private ListenableValue info; - - protected ChangeCache(Change.Id chg) { - changeId = chg; - } - - public Change.Id getChangeId() { - return changeId; - } - - public ChangeDetailCache getChangeDetailCache() { - if (detail == null) { - detail = new ChangeDetailCache(changeId); - } - return detail; - } - - public ListenableValue getChangeInfoCache() { - if (info == null) { - info = new ListenableValue<>(); - } - return info; - } -} diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeDescriptionBlock.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeDescriptionBlock.java deleted file mode 100644 index 8f2642c385..0000000000 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeDescriptionBlock.java +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (C) 2008 The Android Open Source Project -// -// 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.ui.CommentLinkProcessor; -import com.google.gerrit.common.data.AccountInfoCache; -import com.google.gerrit.common.data.ChangeDetail; -import com.google.gerrit.common.data.SubmitTypeRecord; -import com.google.gerrit.reviewdb.client.PatchSetInfo; -import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.HorizontalPanel; -import com.google.gwtexpui.globalkey.client.KeyCommandSet; - -public class ChangeDescriptionBlock extends Composite { - private final ChangeInfoBlock infoBlock; - private final CommitMessageBlock messageBlock; - - public ChangeDescriptionBlock(KeyCommandSet keysAction) { - infoBlock = new ChangeInfoBlock(); - messageBlock = new CommitMessageBlock(keysAction); - - final HorizontalPanel hp = new HorizontalPanel(); - hp.add(infoBlock); - hp.add(messageBlock); - initWidget(hp); - } - - public void display(ChangeDetail changeDetail, Boolean starred, Boolean canEditCommitMessage, - PatchSetInfo info, AccountInfoCache acc, - SubmitTypeRecord submitTypeRecord, - CommentLinkProcessor commentLinkProcessor) { - infoBlock.display(changeDetail, acc, submitTypeRecord); - messageBlock.display(changeDetail.getChange().currentPatchSetId(), info.getRevId(), starred, - canEditCommitMessage, info.getMessage(), commentLinkProcessor); - } -} diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeDetailCache.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeDetailCache.java deleted file mode 100644 index 3ad90d91ee..0000000000 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeDetailCache.java +++ /dev/null @@ -1,261 +0,0 @@ -// Copyright (C) 2012 The Android Open Source Project -// -// 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.actions.ActionInfo; -import com.google.gerrit.client.changes.ChangeInfo.CommitInfo; -import com.google.gerrit.client.changes.ChangeInfo.GitPerson; -import com.google.gerrit.client.changes.ChangeInfo.MessageInfo; -import com.google.gerrit.client.changes.ChangeInfo.RevisionInfo; -import com.google.gerrit.client.rpc.NativeMap; -import com.google.gerrit.client.rpc.Natives; -import com.google.gerrit.client.rpc.RestApi; -import com.google.gerrit.client.ui.ListenableValue; -import com.google.gerrit.common.data.AccountInfo; -import com.google.gerrit.common.data.AccountInfoCache; -import com.google.gerrit.common.data.ChangeDetail; -import com.google.gerrit.common.data.PatchSetDetail; -import com.google.gerrit.common.data.SubmitRecord; -import com.google.gerrit.common.data.SubmitTypeRecord; -import com.google.gerrit.common.data.UiCommandDetail; -import com.google.gerrit.extensions.common.ListChangesOption; -import com.google.gerrit.reviewdb.client.Account; -import com.google.gerrit.reviewdb.client.Branch; -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.PatchSetInfo.ParentInfo; -import com.google.gerrit.reviewdb.client.RevId; -import com.google.gerrit.reviewdb.client.UserIdentity; -import com.google.gwt.core.client.JsArray; -import com.google.gwtjsonrpc.common.AsyncCallback; - -import java.util.ArrayList; -import java.util.EnumSet; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; - -public class ChangeDetailCache extends ListenableValue { - public static class NewGerritCallback extends - com.google.gerrit.client.rpc.GerritCallback { - @Override - public void onSuccess(ChangeInfo detail) { - setChangeDetail(reverse(detail)); - } - } - - public static class IgnoreErrorCallback implements AsyncCallback { - @Override - public void onSuccess(ChangeDetail info) { - setChangeDetail(info); - } - - @Override - public void onFailure(Throwable caught) { - } - } - - public static ChangeDetail reverse(ChangeInfo info) { - info.revisions().copyKeysIntoChildren("name"); - RevisionInfo rev = current(info); - - ChangeDetail r = new ChangeDetail(); - r.setAllowsAnonymous(rev.has_fetch() && rev.fetch().containsKey("http")); - r.setCanAbandon(can(info.actions(), "abandon")); - r.setCanEditCommitMessage(can(rev.actions(), "message")); - r.setCanCherryPick(can(rev.actions(), "cherrypick")); - r.setCanPublish(can(rev.actions(), "publish")); - r.setCanRebase(can(rev.actions(), "rebase")); - r.setCanRestore(can(info.actions(), "restore")); - r.setCanRevert(can(info.actions(), "revert")); - r.setCanDeleteDraft(can(info.actions(), "/")); - r.setCanEditTopicName(can(info.actions(), "topic")); - r.setCanSubmit(can(rev.actions(), "submit")); - r.setCanEdit(true); - r.setChange(toChange(info)); - r.setStarred(info.starred()); - r.setPatchSets(toPatchSets(info)); - r.setMergeable(info.mergeable()); - r.setMessages(toMessages(info)); - r.setAccounts(users(info)); - r.setCurrentPatchSetId(new PatchSet.Id(info.legacy_id(), rev._number())); - r.setCurrentPatchSetDetail(toPatchSetDetail(info)); - r.setSubmitRecords(new ArrayList()); - - // Obtained later in ChangeScreen. - r.setSubmitTypeRecord(new SubmitTypeRecord()); - r.getSubmitTypeRecord().status = SubmitTypeRecord.Status.RULE_ERROR; - r.setPatchSetsWithDraftComments(new HashSet()); - r.setDependsOn(new ArrayList()); - r.setNeededBy(new ArrayList()); - return r; - } - - private static PatchSetDetail toPatchSetDetail(ChangeInfo info) { - RevisionInfo rev = current(info); - PatchSetDetail p = new PatchSetDetail(); - p.setPatchSet(toPatchSet(info, rev)); - p.setProject(info.project_name_key()); - p.setInfo(new PatchSetInfo(p.getPatchSet().getId())); - p.getInfo().setRevId(rev.name()); - p.getInfo().setParents(new ArrayList()); - p.getInfo().setAuthor(toUser(rev.commit().author())); - p.getInfo().setCommitter(toUser(rev.commit().committer())); - p.getInfo().setSubject(rev.commit().subject()); - p.getInfo().setMessage(rev.commit().message()); - if (rev.commit().parents() != null) { - for (CommitInfo c : Natives.asList(rev.commit().parents())) { - p.getInfo().getParents().add(new ParentInfo( - new RevId(c.commit()), - c.subject())); - } - } - p.setPatches(new ArrayList()); - p.setCommands(new ArrayList()); - - rev.files(); - return p; - } - - private static UserIdentity toUser(GitPerson p) { - UserIdentity u = new UserIdentity(); - u.setName(p.name()); - u.setEmail(p.email()); - u.setDate(p.date()); - return u; - } - - public static AccountInfoCache users(ChangeInfo info) { - Map r = new HashMap<>(); - add(r, info.owner()); - if (info.messages() != null) { - for (MessageInfo m : Natives.asList(info.messages())) { - add(r, m.author()); - } - } - return new AccountInfoCache(r.values()); - } - - private static void add(Map r, - com.google.gerrit.client.account.AccountInfo user) { - if (user != null && !r.containsKey(user._account_id())) { - AccountInfo a = new AccountInfo(new Account.Id(user._account_id())); - a.setPreferredEmail(user.email()); - a.setFullName(user.name()); - r.put(user._account_id(), a); - } - } - - private static boolean can(NativeMap m, String n) { - return m != null && m.containsKey(n) && m.get(n).enabled(); - } - - private static List toMessages(ChangeInfo info) { - List msgs = new ArrayList<>(); - for (MessageInfo m : Natives.asList(info.messages())) { - ChangeMessage o = new ChangeMessage( - new ChangeMessage.Key( - info.legacy_id(), - m.date().toString()), - m.author() != null - ? new Account.Id(m.author()._account_id()) - : null, - m.date(), - m._revisionNumber() > 0 - ? new PatchSet.Id(info.legacy_id(), m._revisionNumber()) - : null); - o.setMessage(m.message()); - msgs.add(o); - } - return msgs; - } - - private static List toPatchSets(ChangeInfo info) { - JsArray all = info.revisions().values(); - RevisionInfo.sortRevisionInfoByNumber(all); - - List r = new ArrayList<>(all.length()); - for (RevisionInfo rev : Natives.asList(all)) { - r.add(toPatchSet(info, rev)); - } - return r; - } - - private static PatchSet toPatchSet(ChangeInfo info, RevisionInfo rev) { - PatchSet p = new PatchSet( - new PatchSet.Id(info.legacy_id(), rev._number())); - p.setCreatedOn(rev.commit().committer().date()); - p.setDraft(rev.draft()); - p.setRevision(new RevId(rev.name())); - return p; - } - - public static Change toChange(ChangeInfo info) { - RevisionInfo rev = current(info); - PatchSetInfo p = new PatchSetInfo( - new PatchSet.Id( - info.legacy_id(), - rev._number())); - p.setSubject(info.subject()); - Change c = new Change( - new Change.Key(info.change_id()), - info.legacy_id(), - new Account.Id(info.owner()._account_id()), - new Branch.NameKey( - info.project_name_key(), - info.branch()), - info.created()); - c.setTopic(info.topic()); - c.setStatus(info.status()); - c.setCurrentPatchSet(p); - c.setLastUpdatedOn(info.updated()); - return c; - } - - private static RevisionInfo current(ChangeInfo info) { - RevisionInfo rev = info.revision(info.current_revision()); - if (rev == null) { - JsArray all = info.revisions().values(); - RevisionInfo.sortRevisionInfoByNumber(all); - rev = all.get(all.length() - 1); - } - return rev; - } - - public static void setChangeDetail(ChangeDetail detail) { - Change.Id chgId = detail.getChange().getId(); - ChangeCache.get(chgId).getChangeDetailCache().set(detail); - StarredChanges.fireChangeStarEvent(chgId, detail.isStarred()); - } - - private final Change.Id changeId; - - public ChangeDetailCache(final Change.Id chg) { - changeId = chg; - } - - public void refresh() { - RestApi call = ChangeApi.detail(changeId.get()); - ChangeList.addOptions(call, EnumSet.of( - ListChangesOption.CURRENT_ACTIONS, - ListChangesOption.ALL_REVISIONS, - ListChangesOption.ALL_COMMITS)); - call.get(new NewGerritCallback()); - } -} diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeInfoBlock.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeInfoBlock.java deleted file mode 100644 index a4f3145d3d..0000000000 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeInfoBlock.java +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright (C) 2008 The Android Open Source Project -// -// 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 static com.google.gerrit.client.FormatUtil.mediumFormat; - -import com.google.gerrit.client.Gerrit; -import com.google.gerrit.client.rpc.GerritCallback; -import com.google.gerrit.client.ui.AccountLinkPanel; -import com.google.gerrit.client.ui.BranchLink; -import com.google.gerrit.client.ui.CommentedActionDialog; -import com.google.gerrit.client.ui.InlineHyperlink; -import com.google.gerrit.client.ui.ProjectSearchLink; -import com.google.gerrit.common.PageLinks; -import com.google.gerrit.common.data.AccountInfoCache; -import com.google.gerrit.common.data.ChangeDetail; -import com.google.gerrit.common.data.SubmitTypeRecord; -import com.google.gerrit.reviewdb.client.Branch; -import com.google.gerrit.reviewdb.client.Change; -import com.google.gwt.event.dom.client.ClickEvent; -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.event.dom.client.KeyPressHandler; -import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.FlowPanel; -import com.google.gwt.user.client.ui.Grid; -import com.google.gwt.user.client.ui.HTMLTable.CellFormatter; -import com.google.gwt.user.client.ui.Image; -import com.google.gwt.user.client.ui.InlineLabel; -import com.google.gwt.user.client.ui.TextBox; -import com.google.gwt.user.client.ui.Widget; -import com.google.gwtexpui.clippy.client.CopyableLabel; - -public class ChangeInfoBlock extends Composite { - private static final int R_CHANGE_ID = 0; - private static final int R_OWNER = 1; - private static final int R_PROJECT = 2; - private static final int R_BRANCH = 3; - private static final int R_TOPIC = 4; - private static final int R_UPLOADED = 5; - private static final int R_UPDATED = 6; - private static final int R_SUBMIT_TYPE = 7; - private static final int R_STATUS = 8; - private static final int R_MERGE_TEST = 9; - private static final int R_CNT = 10; - - private final Grid table; - - public ChangeInfoBlock() { - table = new Grid(R_CNT, 2); - table.setStyleName(Gerrit.RESOURCES.css().infoBlock()); - table.addStyleName(Gerrit.RESOURCES.css().changeInfoBlock()); - - initRow(R_CHANGE_ID, "Change-Id: "); - initRow(R_OWNER, Util.C.changeInfoBlockOwner()); - initRow(R_PROJECT, Util.C.changeInfoBlockProject()); - initRow(R_BRANCH, Util.C.changeInfoBlockBranch()); - initRow(R_TOPIC, Util.C.changeInfoBlockTopic()); - initRow(R_UPLOADED, Util.C.changeInfoBlockUploaded()); - initRow(R_UPDATED, Util.C.changeInfoBlockUpdated()); - initRow(R_STATUS, Util.C.changeInfoBlockStatus()); - initRow(R_SUBMIT_TYPE, Util.C.changeInfoBlockSubmitType()); - initRow(R_MERGE_TEST, Util.C.changeInfoBlockCanMerge()); - - final CellFormatter fmt = table.getCellFormatter(); - fmt.addStyleName(0, 0, Gerrit.RESOURCES.css().topmost()); - fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().topmost()); - fmt.addStyleName(R_CHANGE_ID, 1, Gerrit.RESOURCES.css().changeid()); - fmt.addStyleName(R_CNT - 2, 0, Gerrit.RESOURCES.css().bottomheader()); - - initWidget(table); - } - - private void initRow(final int row, final String name) { - table.setText(row, 0, name); - table.getCellFormatter().addStyleName(row, 0, Gerrit.RESOURCES.css().header()); - } - - public void display(final ChangeDetail changeDetail, - final AccountInfoCache acc, SubmitTypeRecord submitTypeRecord) { - final Change chg = changeDetail.getChange(); - final Branch.NameKey dst = chg.getDest(); - - CopyableLabel changeIdLabel = - new CopyableLabel("Change-Id: " + chg.getKey().get()); - changeIdLabel.setPreviewText(chg.getKey().get()); - table.setWidget(R_CHANGE_ID, 1, changeIdLabel); - - table.setWidget(R_OWNER, 1, AccountLinkPanel.link(acc, chg.getOwner())); - - final FlowPanel p = new FlowPanel(); - p.add(new ProjectSearchLink(chg.getProject())); - p.add(new InlineHyperlink(chg.getProject().get(), - PageLinks.toProject(chg.getProject()))); - table.setWidget(R_PROJECT, 1, p); - - table.setWidget(R_BRANCH, 1, new BranchLink(dst.getShortName(), chg - .getProject(), chg.getStatus(), dst.get(), null)); - table.setWidget(R_TOPIC, 1, topic(changeDetail)); - table.setText(R_UPLOADED, 1, mediumFormat(chg.getCreatedOn())); - table.setText(R_UPDATED, 1, mediumFormat(chg.getLastUpdatedOn())); - table.setText(R_STATUS, 1, Util.toLongString(chg.getStatus())); - String submitType; - if (submitTypeRecord.status == SubmitTypeRecord.Status.OK) { - submitType = com.google.gerrit.client.admin.Util - .toLongString(submitTypeRecord.type); - } else { - submitType = submitTypeRecord.status.name(); - } - table.setText(R_SUBMIT_TYPE, 1, submitType); - final Change.Status status = chg.getStatus(); - if (status.equals(Change.Status.NEW) || status.equals(Change.Status.DRAFT)) { - table.getRowFormatter().setVisible(R_MERGE_TEST, true); - table.setText(R_MERGE_TEST, 1, changeDetail.isMergeable() ? Util.C - .changeInfoBlockCanMergeYes() : Util.C.changeInfoBlockCanMergeNo()); - } else { - table.getRowFormatter().setVisible(R_MERGE_TEST, false); - } - - if (status.isClosed()) { - table.getCellFormatter().addStyleName(R_STATUS, 1, Gerrit.RESOURCES.css().closedstate()); - table.getRowFormatter().setVisible(R_SUBMIT_TYPE, false); - } else { - table.getCellFormatter().removeStyleName(R_STATUS, 1, Gerrit.RESOURCES.css().closedstate()); - table.getRowFormatter().setVisible(R_SUBMIT_TYPE, true); - } - } - - public Widget topic(final ChangeDetail changeDetail) { - final Change chg = changeDetail.getChange(); - final Branch.NameKey dst = chg.getDest(); - - FlowPanel fp = new FlowPanel(); - fp.addStyleName(Gerrit.RESOURCES.css().changeInfoTopicPanel()); - fp.add(new BranchLink(chg.getTopic(), chg.getProject(), chg.getStatus(), - dst.get(), chg.getTopic())); - - if (changeDetail.canEditTopicName()) { - final Image edit = new Image(Gerrit.RESOURCES.edit()); - edit.addStyleName(Gerrit.RESOURCES.css().link()); - edit.setTitle(Util.C.changeInfoBlockTopicAlterTopicToolTip()); - edit.addClickHandler(new ClickHandler() { - @Override - public void onClick(final ClickEvent event) { - new AlterTopicDialog(chg).center(); - } - }); - fp.add(edit); - } - - return fp; - } - - private class AlterTopicDialog extends CommentedActionDialog - implements KeyPressHandler { - TextBox newTopic; - Change change; - - AlterTopicDialog(Change chg) { - super(Util.C.alterTopicTitle(), Util.C.headingAlterTopicMessage(), - new ChangeDetailCache.IgnoreErrorCallback()); - change = chg; - message.setVisible(false); - - newTopic = new TextBox(); - newTopic.addKeyPressHandler(this); - setFocusOn(newTopic); - panel.insert(newTopic, 0); - panel.insert(new InlineLabel(Util.C.alterTopicLabel()), 0); - } - - @Override - protected void onLoad() { - super.onLoad(); - newTopic.setText(change.getTopic()); - } - - private void doTopicEdit() { - String topic = newTopic.getText(); - ChangeApi.topic(change.getId().get(), topic, - new GerritCallback() { - @Override - public void onSuccess(String result) { - sent = true; - Gerrit.display(PageLinks.toChange(change.getId())); - hide(); - } - - @Override - public void onFailure(final Throwable caught) { - enableButtons(true); - super.onFailure(caught); - }}); - } - - @Override - public void onSend() { - doTopicEdit(); - } - - @Override - public void onKeyPress(KeyPressEvent event) { - if (event.getSource() == newTopic - && event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) { - doTopicEdit(); - } - } - } -} diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeScreen.java deleted file mode 100644 index e950ad4eef..0000000000 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeScreen.java +++ /dev/null @@ -1,774 +0,0 @@ -// Copyright (C) 2008 The Android Open Source Project -// -// 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.Dispatcher; -import com.google.gerrit.client.FormatUtil; -import com.google.gerrit.client.Gerrit; -import com.google.gerrit.client.account.AccountInfo; -import com.google.gerrit.client.change.RelatedChanges; -import com.google.gerrit.client.change.RelatedChanges.ChangeAndCommit; -import com.google.gerrit.client.changes.ChangeInfo.CommitInfo; -import com.google.gerrit.client.diff.DiffApi; -import com.google.gerrit.client.diff.FileInfo; -import com.google.gerrit.client.projects.ConfigInfoCache; -import com.google.gerrit.client.rpc.CallbackGroup; -import com.google.gerrit.client.rpc.GerritCallback; -import com.google.gerrit.client.rpc.NativeMap; -import com.google.gerrit.client.rpc.NativeString; -import com.google.gerrit.client.rpc.Natives; -import com.google.gerrit.client.rpc.RestApi; -import com.google.gerrit.client.ui.CommentLinkProcessor; -import com.google.gerrit.client.ui.CommentPanel; -import com.google.gerrit.client.ui.ComplexDisclosurePanel; -import com.google.gerrit.client.ui.ExpandAllCommand; -import com.google.gerrit.client.ui.LinkMenuBar; -import com.google.gerrit.client.ui.NeedsSignInKeyCommand; -import com.google.gerrit.client.ui.Screen; -import com.google.gerrit.common.data.AccountInfoCache; -import com.google.gerrit.common.data.ChangeDetail; -import com.google.gerrit.common.data.ChangeInfo; -import com.google.gerrit.common.data.SubmitTypeRecord; -import com.google.gerrit.extensions.common.ListChangesOption; -import com.google.gerrit.extensions.common.SubmitType; -import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.CommentVisibilityStrategy; -import com.google.gerrit.reviewdb.client.Change; -import com.google.gerrit.reviewdb.client.Change.Status; -import com.google.gerrit.reviewdb.client.ChangeMessage; -import com.google.gerrit.reviewdb.client.Patch; -import com.google.gerrit.reviewdb.client.Patch.ChangeType; -import com.google.gerrit.reviewdb.client.Patch.PatchType; -import com.google.gerrit.reviewdb.client.PatchSet; -import com.google.gwt.core.client.JsArray; -import com.google.gwt.core.client.JsArrayString; -import com.google.gwt.event.dom.client.ChangeEvent; -import com.google.gwt.event.dom.client.ChangeHandler; -import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.event.dom.client.ClickHandler; -import com.google.gwt.event.dom.client.KeyPressEvent; -import com.google.gwt.event.logical.shared.ValueChangeEvent; -import com.google.gwt.event.logical.shared.ValueChangeHandler; -import com.google.gwt.event.shared.HandlerRegistration; -import com.google.gwt.i18n.client.LocaleInfo; -import com.google.gwt.user.client.rpc.AsyncCallback; -import com.google.gwt.user.client.ui.Button; -import com.google.gwt.user.client.ui.DisclosurePanel; -import com.google.gwt.user.client.ui.FlowPanel; -import com.google.gwt.user.client.ui.Grid; -import com.google.gwt.user.client.ui.HorizontalPanel; -import com.google.gwt.user.client.ui.InlineLabel; -import com.google.gwt.user.client.ui.Label; -import com.google.gwt.user.client.ui.ListBox; -import com.google.gwt.user.client.ui.Panel; -import com.google.gwtexpui.globalkey.client.GlobalKey; -import com.google.gwtexpui.globalkey.client.KeyCommand; -import com.google.gwtexpui.globalkey.client.KeyCommandSet; - -import java.sql.Timestamp; -import java.util.ArrayList; -import java.util.EnumSet; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; - - -public class ChangeScreen extends Screen - implements ValueChangeHandler { - private final Change.Id changeId; - private final PatchSet.Id openPatchSetId; - private ChangeDetailCache detailCache; - private com.google.gerrit.client.changes.ChangeInfo changeInfo; - - private ChangeDescriptionBlock descriptionBlock; - private ApprovalTable approvals; - - private IncludedInTable includedInTable; - private DisclosurePanel includedInPanel; - private ComplexDisclosurePanel dependenciesPanel; - private ChangeTable dependencies; - private ChangeTable.Section dependsOn; - private ChangeTable.Section neededBy; - - private PatchSetsBlock patchSetsBlock; - - private Panel comments; - private CommentLinkProcessor commentLinkProcessor; - - private KeyCommandSet keysNavigation; - private KeyCommandSet keysAction; - private HandlerRegistration regNavigation; - private HandlerRegistration regAction; - private HandlerRegistration regDetailCache; - - private Grid patchesGrid; - private ListBox patchesList; - - /** - * The change id for which the old version history is valid. - */ - private static Change.Id currentChangeId; - - /** - * Which patch set id is the diff base. - */ - private static PatchSet.Id diffBaseId; - - public ChangeScreen(final Change.Id toShow) { - changeId = toShow; - openPatchSetId = null; - } - - public ChangeScreen(final PatchSet.Id toShow) { - changeId = toShow.getParentKey(); - openPatchSetId = toShow; - } - - public ChangeScreen(final ChangeInfo c) { - this(c.getId()); - } - - @Override - protected void onLoad() { - super.onLoad(); - detailCache.refresh(); - } - - @Override - protected void onUnload() { - if (regNavigation != null) { - regNavigation.removeHandler(); - regNavigation = null; - } - if (regAction != null) { - regAction.removeHandler(); - regAction = null; - } - if (regDetailCache != null) { - regDetailCache.removeHandler(); - regDetailCache = null; - } - super.onUnload(); - } - - @Override - public void registerKeys() { - super.registerKeys(); - regNavigation = GlobalKey.add(this, keysNavigation); - regAction = GlobalKey.add(this, keysAction); - if (openPatchSetId != null) { - patchSetsBlock.activate(openPatchSetId); - } - } - - @Override - protected void onInitUI() { - super.onInitUI(); - - ChangeCache cache = ChangeCache.get(changeId); - - detailCache = cache.getChangeDetailCache(); - regDetailCache = detailCache.addValueChangeHandler(this); - - addStyleName(Gerrit.RESOURCES.css().changeScreen()); - addStyleName(Gerrit.RESOURCES.css().screenNoHeader()); - - keysNavigation = new KeyCommandSet(Gerrit.C.sectionNavigation()); - keysAction = new KeyCommandSet(Gerrit.C.sectionActions()); - keysNavigation.add(new UpToListKeyCommand(0, 'u', Util.C.upToChangeList())); - keysNavigation.add(new ExpandCollapseDependencySectionKeyCommand(0, 'd', Util.C.expandCollapseDependencies())); - - if (Gerrit.isSignedIn()) { - keysAction.add(new PublishCommentsKeyCommand(0, 'r', Util.C - .keyPublishComments())); - } - - descriptionBlock = new ChangeDescriptionBlock(keysAction); - add(descriptionBlock); - - approvals = new ApprovalTable(); - add(approvals); - - includedInPanel = new DisclosurePanel(Util.C.changeScreenIncludedIn()); - includedInTable = new IncludedInTable(changeId); - - includedInPanel.setContent(includedInTable); - add(includedInPanel); - - dependencies = new ChangeTable() { - { - table.setWidth("auto"); - } - }; - dependsOn = new ChangeTable.Section(Util.C.changeScreenDependsOn()); - dependsOn.setChangeRowFormatter(new ChangeTable.ChangeRowFormatter() { - @Override - public String getRowStyle(ChangeInfo c) { - if (! c.isLatest() || Change.Status.ABANDONED.equals(c.getStatus())) { - return Gerrit.RESOURCES.css().outdated(); - } - return null; - } - - @Override - public String getDisplayText(final ChangeInfo c, final String displayText) { - if (! c.isLatest()) { - return displayText + " [OUTDATED]"; - } - return displayText; - } - }); - neededBy = new ChangeTable.Section(Util.C.changeScreenNeededBy()); - dependencies.addSection(dependsOn); - dependencies.addSection(neededBy); - - dependenciesPanel = new ComplexDisclosurePanel( - Util.C.changeScreenDependencies(), false); - dependenciesPanel.setContent(dependencies); - add(dependenciesPanel); - - patchesList = new ListBox(); - patchesList.addChangeHandler(new ChangeHandler() { - @Override - public void onChange(ChangeEvent event) { - final int index = patchesList.getSelectedIndex(); - final String selectedPatchSet = patchesList.getValue(index); - if (index == 0) { - diffBaseId = null; - } else { - diffBaseId = PatchSet.Id.parse(selectedPatchSet); - } - if (patchSetsBlock != null) { - patchSetsBlock.refresh(diffBaseId); - } - } - }); - - patchesGrid = new Grid(1, 2); - patchesGrid.setStyleName(Gerrit.RESOURCES.css().selectPatchSetOldVersion()); - patchesGrid.setText(0, 0, Util.C.referenceVersion()); - patchesGrid.setWidget(0, 1, patchesList); - add(patchesGrid); - - patchSetsBlock = new PatchSetsBlock(); - add(patchSetsBlock); - - comments = new FlowPanel(); - comments.setStyleName(Gerrit.RESOURCES.css().changeComments()); - add(comments); - } - - private void displayTitle(final Change.Key changeId, final String subject) { - final StringBuilder titleBuf = new StringBuilder(); - if (LocaleInfo.getCurrentLocale().isRTL()) { - if (subject != null) { - titleBuf.append(subject); - titleBuf.append(" :"); - } - titleBuf.append(Util.M.changeScreenTitleId(changeId.abbreviate())); - } else { - titleBuf.append(Util.M.changeScreenTitleId(changeId.abbreviate())); - if (subject != null) { - titleBuf.append(": "); - titleBuf.append(subject); - } - } - setPageTitle(titleBuf.toString()); - setHeaderVisible(false); - } - - @Override - public void onValueChange(final ValueChangeEvent event) { - if (isAttached() && isLastValueChangeHandler()) { - // Until this screen is fully migrated to the new API, these calls must - // happen sequentially after the ChangeDetail lookup, because we can't - // start an async get at the source of every call that might trigger a - // value change. - CallbackGroup cbs1 = new CallbackGroup(); - final CallbackGroup cbs2 = new CallbackGroup(); - final PatchSet.Id psId = event.getValue().getCurrentPatchSet().getId(); - final Map patches = new HashMap<>(); - String revId = - event.getValue().getCurrentPatchSetDetail().getInfo().getRevId(); - - if (event.getValue().getChange().getStatus().isOpen()) { - ChangeApi.revision(changeId.get(), "current") - .view("submit_type") - .get(cbs1.add(new GerritCallback() { - @Override - public void onSuccess(NativeString result) { - event.getValue().setSubmitTypeRecord(SubmitTypeRecord.OK( - SubmitType.valueOf(result.asString()))); - } - @Override - public void onFailure(Throwable caught) {} - })); - } - if (Gerrit.isSignedIn()) { - ChangeApi.revision(changeId.get(), "" + psId.get()) - .view("related") - .get(cbs1.add(new AsyncCallback() { - @Override - public void onSuccess(RelatedChanges.RelatedInfo info) { - if (info.changes() != null) { - dependsOn(info); - neededBy(info); - } - } - - private void dependsOn(RelatedChanges.RelatedInfo info) { - ChangeAndCommit self = null; - Map m = new HashMap<>(); - for (int i = 0; i < info.changes().length(); i++) { - ChangeAndCommit c = info.changes().get(i); - if (changeId.equals(c.legacy_id())) { - self = c; - } - if (c.commit() != null && c.commit().commit() != null) { - m.put(c.commit().commit(), c); - } - } - if (self != null && self.commit() != null - && self.commit().parents() != null) { - List d = new ArrayList<>(); - for (CommitInfo p : Natives.asList(self.commit().parents())) { - ChangeAndCommit pc = m.get(p.commit()); - if (pc != null && pc.has_change_number()) { - ChangeInfo i = new ChangeInfo(); - load(pc, i); - d.add(i); - } - } - event.getValue().setDependsOn(d); - } - } - - private void neededBy(RelatedChanges.RelatedInfo info) { - Set mine = new HashSet<>(); - for (PatchSet ps : event.getValue().getPatchSets()) { - mine.add(ps.getRevision().get()); - } - - List n = new ArrayList<>(); - for (int i = 0; i < info.changes().length(); i++) { - ChangeAndCommit c = info.changes().get(i); - if (c.has_change_number() - && c.commit() != null - && c.commit().parents() != null) { - for (int j = 0; j < c.commit().parents().length(); j++) { - CommitInfo p = c.commit().parents().get(j); - if (mine.contains(p.commit())) { - ChangeInfo u = new ChangeInfo(); - load(c, u); - n.add(u); - break; - } - } - } - } - event.getValue().setNeededBy(n); - } - - private void load(final ChangeAndCommit pc, final ChangeInfo i) { - RestApi call = ChangeApi.change(pc.legacy_id().get()); - ChangeList.addOptions(call, EnumSet.of( - ListChangesOption.DETAILED_ACCOUNTS, - ListChangesOption.CURRENT_REVISION)); - call.get(cbs2.add(new AsyncCallback< - com.google.gerrit.client.changes.ChangeInfo>() { - @Override - public void onFailure(Throwable caught) {} - @Override - public void onSuccess( - com.google.gerrit.client.changes.ChangeInfo result) { - i.set(ChangeDetailCache.toChange(result), - pc.patch_set_id()); - i.setStarred(result.starred()); - event.getValue().getAccounts() - .merge(ChangeDetailCache.users(result)); - }})); - } - @Override - public void onFailure(Throwable caught) {} - })); - ChangeApi.revision(changeId.get(), revId) - .view("files") - .addParameterTrue("reviewed") - .get(cbs1.add(new AsyncCallback() { - @Override - public void onSuccess(JsArrayString result) { - for(int i = 0; i < result.length(); i++) { - String path = result.get(i); - Patch p = patches.get(path); - if (p == null) { - p = new Patch(new Patch.Key(psId, path)); - patches.put(path, p); - } - p.setReviewedByCurrentUser(true); - } - } - @Override - public void onFailure(Throwable caught) {} - })); - final Set withDrafts = new HashSet<>(); - event.getValue().setPatchSetsWithDraftComments(withDrafts); - for (PatchSet ps : event.getValue().getPatchSets()) { - if (!ps.getId().equals(psId)) { - final PatchSet.Id id = ps.getId(); - ChangeApi.revision(changeId.get(), "" + id.get()) - .view("drafts") - .get(cbs1.add(new AsyncCallback>>() { - @Override - public void onSuccess(NativeMap> result) { - if (!result.isEmpty()) { - withDrafts.add(id); - } - } - @Override - public void onFailure(Throwable caught) {} - })); - } - } - ChangeApi.revision(changeId.get(), "" + psId.get()) - .view("drafts") - .get(cbs1.add(new AsyncCallback>>() { - @Override - public void onSuccess(NativeMap> result) { - for (String path : result.keySet()) { - Patch p = patches.get(path); - if (p == null) { - p = new Patch(new Patch.Key(psId, path)); - patches.put(path, p); - } - p.setDraftCount(result.get(path).length()); - } - if (!result.isEmpty()) { - withDrafts.add(psId); - } - } - @Override - public void onFailure(Throwable caught) {} - })); - } - ChangeApi.revision(changeId.get(), revId) - .view("comments") - .get(cbs1.add(new AsyncCallback>>() { - @Override - public void onSuccess(NativeMap> result) { - for (String path : result.keySet()) { - Patch p = patches.get(path); - if (p == null) { - p = new Patch(new Patch.Key(psId, path)); - patches.put(path, p); - } - p.setCommentCount(result.get(path).length()); - } - } - @Override - public void onFailure(Throwable caught) {} - })); - DiffApi.list(changeId.get(), null, revId, - new AsyncCallback>() { - @Override - public void onSuccess(NativeMap result) { - JsArray fileInfos = result.values(); - FileInfo.sortFileInfoByPath(fileInfos); - List list = new ArrayList<>(fileInfos.length()); - for (FileInfo f : Natives.asList(fileInfos)) { - Patch p = patches.get(f.path()); - if (p == null) { - p = new Patch(new Patch.Key(psId, f.path())); - patches.put(f.path(), p); - } - p.setInsertions(f.lines_inserted()); - p.setDeletions(f.lines_deleted()); - p.setPatchType(f.binary() ? PatchType.BINARY : PatchType.UNIFIED); - if (f.status() == null) { - p.setChangeType(ChangeType.MODIFIED); - } else { - p.setChangeType(ChangeType.forCode(f.status().charAt(0))); - } - list.add(p); - } - event.getValue().getCurrentPatchSetDetail().setPatches(list); - } - @Override - public void onFailure(Throwable caught) {} - }); - ConfigInfoCache.get( - event.getValue().getChange().getProject(), - cbs1.add(new GerritCallback() { - @Override - public void onSuccess(ConfigInfoCache.Entry result) { - commentLinkProcessor = result.getCommentLinkProcessor(); - setTheme(result.getTheme()); - } - - @Override - public void onFailure(Throwable caught) { - // Handled by last callback's onFailure. - } - })); - ChangeApi.detail(changeId.get(), cbs1.addFinal( - new GerritCallback() { - @Override - public void onSuccess( - com.google.gerrit.client.changes.ChangeInfo result) { - changeInfo = result; - cbs2.addFinal(new AsyncCallback() { - @Override - public void onSuccess(Void result) { - display(event.getValue()); - } - @Override - public void onFailure(Throwable caught) {} - }).onSuccess(null); - } - })); - } - } - - // Find the last attached screen. - // When DialogBox is used (i. e. CommentedActionDialog) then the original - // ChangeScreen is still in attached state. - // Use here the fact, that the handlers (ChangeScreen) are sorted. - private boolean isLastValueChangeHandler() { - int count = detailCache.getHandlerCount(); - return count > 0 && detailCache.getHandler(count - 1) == this; - } - - private void display(final ChangeDetail detail) { - displayTitle(detail.getChange().getKey(), detail.getChange().getSubject()); - discardDiffBaseIfNotApplicable(detail.getChange().getId()); - - if (Status.MERGED == detail.getChange().getStatus()) { - includedInPanel.setVisible(true); - includedInPanel.addOpenHandler(includedInTable); - } else { - includedInPanel.setVisible(false); - } - - dependencies.setAccountInfoCache(detail.getAccounts()); - - descriptionBlock.display(detail, - detail.isStarred(), - detail.canEditCommitMessage(), - detail.getCurrentPatchSetDetail().getInfo(), - detail.getAccounts(), detail.getSubmitTypeRecord(), - commentLinkProcessor); - dependsOn.display(detail.getDependsOn()); - neededBy.display(detail.getNeededBy()); - approvals.display(changeInfo); - - patchesList.clear(); - if (detail.getCurrentPatchSetDetail().getInfo().getParents().size() > 1) { - patchesList.addItem(Util.C.autoMerge()); - } else { - patchesList.addItem(Util.C.baseDiffItem()); - } - for (PatchSet pId : detail.getPatchSets()) { - patchesList.addItem(Util.M.patchSetHeader(pId.getPatchSetId()), pId - .getId().toString()); - } - - if (diffBaseId != null) { - patchesList.setSelectedIndex(diffBaseId.get()); - } - - patchSetsBlock.display(detail, diffBaseId); - addComments(detail); - - // If any dependency change is still open, or is outdated, - // or the change is needed by a change that is new or submitted, - // show our dependency list. - // - boolean depsOpen = false; - int outdated = 0; - if (!detail.getChange().getStatus().isClosed()) { - final List dependsOn = detail.getDependsOn(); - if (dependsOn != null) { - for (final ChangeInfo ci : dependsOn) { - if (!ci.isLatest()) { - depsOpen = true; - outdated++; - } else if (ci.getStatus() != Change.Status.MERGED) { - depsOpen = true; - } - } - } - } - final List neededBy = detail.getNeededBy(); - if (neededBy != null) { - for (final ChangeInfo ci : neededBy) { - if ((ci.getStatus() == Change.Status.NEW) || - (ci.getStatus() == Change.Status.SUBMITTED) || - (ci.getStatus() == Change.Status.DRAFT)) { - depsOpen = true; - } - } - } - - dependenciesPanel.setOpen(depsOpen); - - dependenciesPanel.getHeader().clear(); - if (outdated > 0) { - dependenciesPanel.getHeader().add(new InlineLabel( - Util.M.outdatedHeader(outdated))); - } - - if (!isCurrentView()) { - display(); - } - patchSetsBlock.setRegisterKeys(true); - } - - private static void discardDiffBaseIfNotApplicable(final Change.Id toShow) { - if (currentChangeId != null && !currentChangeId.equals(toShow)) { - diffBaseId = null; - } - currentChangeId = toShow; - } - - private void addComments(final ChangeDetail detail) { - comments.clear(); - - final AccountInfoCache accts = detail.getAccounts(); - final List msgList = detail.getMessages(); - - HorizontalPanel title = new HorizontalPanel(); - title.setWidth("100%"); - title.add(new Label(Util.C.changeScreenComments())); - if (msgList.size() > 1) { - title.add(messagesMenuBar()); - } - title.setStyleName(Gerrit.RESOURCES.css().blockHeader()); - comments.add(title); - - final long AGE = 7 * 24 * 60 * 60 * 1000L; - final Timestamp aged = new Timestamp(System.currentTimeMillis() - AGE); - - CommentVisibilityStrategy commentVisibilityStrategy = - CommentVisibilityStrategy.EXPAND_RECENT; - if (Gerrit.isSignedIn()) { - commentVisibilityStrategy = Gerrit.getUserAccount() - .getGeneralPreferences().getCommentVisibilityStrategy(); - } - - for (int i = 0; i < msgList.size(); i++) { - final ChangeMessage msg = msgList.get(i); - - AccountInfo author; - if (msg.getAuthor() != null) { - author = FormatUtil.asInfo(accts.get(msg.getAuthor())); - } else { - author = AccountInfo.create(0, Util.C.messageNoAuthor(), null, null); - } - - boolean isRecent; - if (i == msgList.size() - 1) { - isRecent = true; - } else { - // TODO Instead of opening messages by strict age, do it by "unread"? - isRecent = msg.getWrittenOn().after(aged); - } - - final CommentPanel cp = new CommentPanel(author, msg.getWrittenOn(), - msg.getMessage(), commentLinkProcessor); - cp.setRecent(isRecent); - cp.addStyleName(Gerrit.RESOURCES.css().commentPanelBorder()); - if (i == msgList.size() - 1) { - cp.addStyleName(Gerrit.RESOURCES.css().commentPanelLast()); - } - boolean isOpen = false; - switch (commentVisibilityStrategy) { - case COLLAPSE_ALL: - break; - case EXPAND_ALL: - isOpen = true; - break; - case EXPAND_MOST_RECENT: - isOpen = i == msgList.size() - 1; - break; - case EXPAND_RECENT: - default: - isOpen = isRecent; - break; - } - cp.setOpen(isOpen); - comments.add(cp); - } - - final Button b = new Button(Util.C.changeScreenAddComment()); - b.addClickHandler(new ClickHandler() { - @Override - public void onClick(final ClickEvent event) { - PatchSet.Id currentPatchSetId = patchSetsBlock.getCurrentPatchSet().getId(); - Gerrit.display(Dispatcher.toPublish(currentPatchSetId)); - } - }); - comments.add(b); - comments.setVisible(msgList.size() > 0); - } - - private LinkMenuBar messagesMenuBar() { - final Panel c = comments; - final LinkMenuBar menuBar = new LinkMenuBar(); - menuBar.addItem(Util.C.messageExpandRecent(), new ExpandAllCommand(c, true) { - @Override - protected void expand(final CommentPanel w) { - w.setOpen(w.isRecent()); - } - }); - menuBar.addItem(Util.C.messageExpandAll(), new ExpandAllCommand(c, true)); - menuBar.addItem(Util.C.messageCollapseAll(), new ExpandAllCommand(c, false)); - menuBar.addStyleName(Gerrit.RESOURCES.css().commentPanelMenuBar()); - return menuBar; - } - - public class UpToListKeyCommand extends KeyCommand { - public UpToListKeyCommand(int mask, char key, String help) { - super(mask, key, help); - } - - @Override - public void onKeyPress(final KeyPressEvent event) { - Gerrit.displayLastChangeList(); - } - } - - public class ExpandCollapseDependencySectionKeyCommand extends KeyCommand { - public ExpandCollapseDependencySectionKeyCommand(int mask, char key, String help) { - super(mask, key, help); - } - - @Override - public void onKeyPress(KeyPressEvent event) { - dependenciesPanel.setOpen(!dependenciesPanel.isOpen()); - } - } - - public class PublishCommentsKeyCommand extends NeedsSignInKeyCommand { - public PublishCommentsKeyCommand(int mask, char key, String help) { - super(mask, key, help); - } - - @Override - public void onKeyPress(final KeyPressEvent event) { - PatchSet.Id currentPatchSetId = patchSetsBlock.getCurrentPatchSet().getId(); - Gerrit.display(Dispatcher.toPublish(currentPatchSetId)); - } - } -} diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeTable.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeTable.java deleted file mode 100644 index 499979573c..0000000000 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeTable.java +++ /dev/null @@ -1,350 +0,0 @@ -// Copyright (C) 2008 The Android Open Source Project -// -// 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 static com.google.gerrit.client.FormatUtil.shortFormat; - -import com.google.gerrit.client.Gerrit; -import com.google.gerrit.client.ui.AccountLinkPanel; -import com.google.gerrit.client.ui.BranchLink; -import com.google.gerrit.client.ui.ChangeLink; -import com.google.gerrit.client.ui.NavigationTable; -import com.google.gerrit.client.ui.NeedsSignInKeyCommand; -import com.google.gerrit.client.ui.ProjectLink; -import com.google.gerrit.common.PageLinks; -import com.google.gerrit.common.data.AccountInfoCache; -import com.google.gerrit.common.data.ChangeInfo; -import com.google.gerrit.reviewdb.client.Account; -import com.google.gerrit.reviewdb.client.Change; -import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.event.dom.client.ClickHandler; -import com.google.gwt.event.dom.client.KeyPressEvent; -import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter; -import com.google.gwt.user.client.ui.HTMLTable.Cell; -import com.google.gwt.user.client.ui.HTMLTable.CellFormatter; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -public class ChangeTable extends NavigationTable { - private static final int C_STAR = 1; - private static final int C_SUBJECT = 2; - private static final int C_OWNER = 3; - private static final int C_PROJECT = 4; - private static final int C_BRANCH = 5; - private static final int C_LAST_UPDATE = 6; - private static final int COLUMNS = 7; - - private final List
sections; - private AccountInfoCache accountCache = AccountInfoCache.empty(); - - public ChangeTable() { - super(Util.C.changeItemHelp()); - - if (Gerrit.isSignedIn()) { - keysAction.add(new StarKeyCommand(0, 's', Util.C.changeTableStar())); - } - - sections = new ArrayList<>(); - table.setText(0, C_STAR, ""); - table.setText(0, C_SUBJECT, Util.C.changeTableColumnSubject()); - table.setText(0, C_OWNER, Util.C.changeTableColumnOwner()); - table.setText(0, C_PROJECT, Util.C.changeTableColumnProject()); - table.setText(0, C_BRANCH, Util.C.changeTableColumnBranch()); - table.setText(0, C_LAST_UPDATE, Util.C.changeTableColumnLastUpdate()); - - final FlexCellFormatter fmt = table.getFlexCellFormatter(); - fmt.addStyleName(0, C_STAR, Gerrit.RESOURCES.css().iconHeader()); - for (int i = C_SUBJECT; i < COLUMNS; i++) { - fmt.addStyleName(0, i, Gerrit.RESOURCES.css().dataHeader()); - } - - table.addClickHandler(new ClickHandler() { - @Override - public void onClick(final ClickEvent event) { - final Cell cell = table.getCellForEvent(event); - if (cell == null) { - return; - } - if (cell.getCellIndex() == C_STAR) { - // Don't do anything (handled by star itself). - } else if (cell.getCellIndex() == C_OWNER) { - // Don't do anything. - } else if (getRowItem(cell.getRowIndex()) != null) { - movePointerTo(cell.getRowIndex()); - } - } - }); - } - - protected void onStarClick(final int row) { - final ChangeInfo c = getRowItem(row); - if (c != null && Gerrit.isSignedIn()) { - ((StarredChanges.Icon) table.getWidget(row, C_STAR)).toggleStar(); - } - } - - @Override - protected Object getRowItemKey(final ChangeInfo item) { - return item.getId(); - } - - @Override - protected void onOpenRow(final int row) { - final ChangeInfo c = getRowItem(row); - Gerrit.display(PageLinks.toChange(c), new ChangeScreen(c)); - } - - private void insertNoneRow(final int row) { - insertRow(row); - table.setText(row, 0, Util.C.changeTableNone()); - final FlexCellFormatter fmt = table.getFlexCellFormatter(); - fmt.setColSpan(row, 0, COLUMNS); - fmt.setStyleName(row, 0, Gerrit.RESOURCES.css().emptySection()); - } - - private void insertChangeRow(final int row) { - insertRow(row); - applyDataRowStyle(row); - } - - @Override - protected void applyDataRowStyle(final int row) { - super.applyDataRowStyle(row); - final CellFormatter fmt = table.getCellFormatter(); - fmt.addStyleName(row, C_STAR, Gerrit.RESOURCES.css().iconCell()); - for (int i = C_SUBJECT; i < COLUMNS; i++) { - fmt.addStyleName(row, i, Gerrit.RESOURCES.css().dataCell()); - } - fmt.addStyleName(row, C_SUBJECT, Gerrit.RESOURCES.css().cSUBJECT()); - fmt.addStyleName(row, C_OWNER, Gerrit.RESOURCES.css().cOWNER()); - fmt.addStyleName(row, C_LAST_UPDATE, Gerrit.RESOURCES.css().cLastUpdate()); - } - - private void populateChangeRow(final int row, final ChangeInfo c, - final ChangeRowFormatter changeRowFormatter) { - ChangeCache cache = ChangeCache.get(c.getId()); - cache.getChangeInfoCache().set(c); - - table.setWidget(row, C_ARROW, null); - if (Gerrit.isSignedIn()) { - table.setWidget(row, C_STAR, StarredChanges.createIcon(c.getId(), c.isStarred())); - } - - String s = Util.cropSubject(c.getSubject()); - if (c.getStatus() != null && c.getStatus() != Change.Status.NEW) { - s += " (" + c.getStatus().name() + ")"; - } - if (changeRowFormatter != null) { - removeChangeStyle(row, changeRowFormatter); - final String rowStyle = changeRowFormatter.getRowStyle(c); - if (rowStyle != null) { - table.getRowFormatter().addStyleName(row, rowStyle); - } - s = changeRowFormatter.getDisplayText(c, s); - } - - table.setWidget(row, C_SUBJECT, new TableChangeLink(s, c)); - table.setWidget(row, C_OWNER, link(c.getOwner())); - table.setWidget(row, C_PROJECT, new ProjectLink(c.getProject().getKey())); - table.setWidget(row, C_BRANCH, new BranchLink(c.getProject().getKey(), c - .getStatus(), c.getBranch(), c.getTopic())); - table.setText(row, C_LAST_UPDATE, shortFormat(c.getLastUpdatedOn())); - - setRowItem(row, c); - } - - private void removeChangeStyle(int row, - final ChangeRowFormatter changeRowFormatter) { - final ChangeInfo oldChange = getRowItem(row); - if (oldChange == null) { - return; - } - - final String oldRowStyle = changeRowFormatter.getRowStyle(oldChange); - if (oldRowStyle != null) { - table.getRowFormatter().removeStyleName(row, oldRowStyle); - } - } - - private AccountLinkPanel link(final Account.Id id) { - return AccountLinkPanel.link(accountCache, id); - } - - public void addSection(final Section s) { - assert s.parent == null; - - if (s.titleText != null) { - s.titleRow = table.getRowCount(); - table.setText(s.titleRow, 0, s.titleText); - final FlexCellFormatter fmt = table.getFlexCellFormatter(); - fmt.setColSpan(s.titleRow, 0, COLUMNS); - fmt.addStyleName(s.titleRow, 0, Gerrit.RESOURCES.css().sectionHeader()); - } else { - s.titleRow = -1; - } - - s.parent = this; - s.dataBegin = table.getRowCount(); - insertNoneRow(s.dataBegin); - sections.add(s); - } - - public void setAccountInfoCache(final AccountInfoCache aic) { - assert aic != null; - accountCache = aic; - } - - private int insertRow(final int beforeRow) { - for (final Section s : sections) { - if (beforeRow <= s.titleRow) { - s.titleRow++; - } - if (beforeRow < s.dataBegin) { - s.dataBegin++; - } - } - return table.insertRow(beforeRow); - } - - private void removeRow(final int row) { - for (final Section s : sections) { - if (row < s.titleRow) { - s.titleRow--; - } - if (row < s.dataBegin) { - s.dataBegin--; - } - } - table.removeRow(row); - } - - public class StarKeyCommand extends NeedsSignInKeyCommand { - public StarKeyCommand(int mask, char key, String help) { - super(mask, key, help); - } - - @Override - public void onKeyPress(final KeyPressEvent event) { - onStarClick(getCurrentRow()); - } - } - - private final class TableChangeLink extends ChangeLink { - private TableChangeLink(final String text, final ChangeInfo c) { - super(text, c); - } - - @Override - public void go() { - movePointerTo(cid); - super.go(); - } - } - - public static class Section { - String titleText; - - ChangeTable parent; - final Account.Id ownerId; - int titleRow = -1; - int dataBegin; - int rows; - - private ChangeRowFormatter changeRowFormatter; - - public Section() { - this(null, null); - } - - public Section(final String titleText) { - this(titleText, null); - } - - public Section(final String titleText, final Account.Id owner) { - setTitleText(titleText); - ownerId = owner; - } - - public void setTitleText(final String text) { - titleText = text; - if (titleRow >= 0) { - parent.table.setText(titleRow, 0, titleText); - } - } - - public void setChangeRowFormatter(final ChangeRowFormatter changeRowFormatter) { - this.changeRowFormatter = changeRowFormatter; - } - - public void display(final List changeList) { - final int sz = changeList != null ? changeList.size() : 0; - final boolean hadData = rows > 0; - - if (hadData) { - while (sz < rows) { - parent.removeRow(dataBegin); - rows--; - } - } - - if (sz == 0) { - if (hadData) { - parent.insertNoneRow(dataBegin); - } - } else { - Set cids = new HashSet<>(); - - if (!hadData) { - parent.removeRow(dataBegin); - } - - while (rows < sz) { - parent.insertChangeRow(dataBegin + rows); - rows++; - } - - for (int i = 0; i < sz; i++) { - ChangeInfo c = changeList.get(i); - parent.populateChangeRow(dataBegin + i, c, changeRowFormatter); - cids.add(c.getId()); - } - } - } - } - - public static interface ChangeRowFormatter { - /** - * Returns the name of the CSS style that should be applied to the change - * row. - * - * @param c the change for which the styling should be returned - * @return the name of the CSS style that should be applied to the change - * row - */ - String getRowStyle(ChangeInfo c); - - /** - * Returns the text that should be displayed for the change. - * - * @param c the change for which the display text should be returned - * @param displayText the current display text - * @return the new display text - */ - String getDisplayText(ChangeInfo c, String displayText); - } -} diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/CommitMessageBlock.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/CommitMessageBlock.java index f8febb728b..391e2f77b2 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/CommitMessageBlock.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/CommitMessageBlock.java @@ -15,32 +15,23 @@ package com.google.gerrit.client.changes; import com.google.gerrit.client.Gerrit; -import com.google.gerrit.client.rpc.GerritCallback; import com.google.gerrit.client.ui.ChangeLink; import com.google.gerrit.client.ui.CommentLinkProcessor; -import com.google.gerrit.client.ui.CommentedActionDialog; -import com.google.gerrit.client.ui.TextBoxChangeListener; -import com.google.gerrit.common.PageLinks; import com.google.gerrit.reviewdb.client.Change; import com.google.gerrit.reviewdb.client.PatchSet; import com.google.gwt.core.client.GWT; -import com.google.gwt.core.client.JavaScriptObject; import com.google.gwt.dom.client.PreElement; import com.google.gwt.dom.client.Style.Display; -import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.HTMLPanel; -import com.google.gwt.user.client.ui.Image; import com.google.gwt.user.client.ui.SimplePanel; import com.google.gwtexpui.clippy.client.CopyableLabel; import com.google.gwtexpui.globalkey.client.KeyCommandSet; import com.google.gwtexpui.safehtml.client.SafeHtml; import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder; -import com.google.gwtjsonrpc.common.AsyncCallback; public class CommitMessageBlock extends Composite { interface Binder extends UiBinder { @@ -70,44 +61,11 @@ public class CommitMessageBlock extends Composite { public void display(String commitMessage, CommentLinkProcessor commentLinkProcessor) { - display(null, null, null, false, commitMessage, commentLinkProcessor); - } - - private abstract class CommitMessageEditDialog - extends CommentedActionDialog { - private final String originalMessage; - public CommitMessageEditDialog(final String title, final String heading, - final String commitMessage, AsyncCallback callback) { - super(title, heading, callback); - originalMessage = commitMessage.trim(); - message.setCharacterWidth(72); - message.setVisibleLines(20); - message.setText(originalMessage); - message.addStyleName(Gerrit.RESOURCES.css().changeScreenDescription()); - sendButton.setEnabled(false); - - new TextBoxChangeListener(message) { - @Override - public void onTextChanged(String newText) { - // Trim the new text so we don't consider trailing - // newlines as changes - sendButton.setEnabled(!newText.trim().equals(originalMessage)); - } - }; - } - - @Override - public String getMessageText() { - // As we rely on commit message lines ending in LF, we convert CRLF to - // LF. Additionally, the commit message should be trimmed to remove any - // excess newlines at the end, but we need to make sure it still has at - // least one trailing newline. - return message.getText().replaceAll("\r\n", "\n").trim() + '\n'; - } + display(null, null, null, commitMessage, commentLinkProcessor); } public void display(final PatchSet.Id patchSetId, final String revision, - Boolean starred, Boolean canEditCommitMessage, final String commitMessage, + Boolean starred, final String commitMessage, CommentLinkProcessor commentLinkProcessor) { starPanel.clear(); if (patchSetId != null && starred != null && Gerrit.isSignedIn()) { @@ -127,37 +85,6 @@ public class CommitMessageBlock extends Composite { permalinkPanel.add(new ChangeLink(Util.C.changePermalink(), changeId)); permalinkPanel.add(new CopyableLabel(ChangeLink.permalink(changeId), false)); - if (canEditCommitMessage) { - final Image edit = new Image(Gerrit.RESOURCES.edit()); - edit.setTitle(Util.C.editCommitMessageToolTip()); - edit.addStyleName(Gerrit.RESOURCES.css().link()); - edit.addClickHandler(new ClickHandler() { - @Override - public void onClick(final ClickEvent event) { - new CommitMessageEditDialog(Util.C.titleEditCommitMessage(), - Util.C.headingEditCommitMessage(), - commitMessage, - new GerritCallback() { - @Override - public void onSuccess(JavaScriptObject result) {} - }) { - @Override - public void onSend() { - ChangeApi.message(changeId.get(), revision, getMessageText(), - new GerritCallback() { - @Override - public void onSuccess(JavaScriptObject msg) { - Gerrit.display(PageLinks.toChange(changeId)); - hide(); - } - }); - } - }.center(); - } - }); - - permalinkPanel.add(edit); - } } String[] splitCommitMessage = commitMessage.split("\n", 2); diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/IncludedInTable.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/IncludedInTable.java deleted file mode 100644 index 62fbfb4f2e..0000000000 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/IncludedInTable.java +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (C) 2010 The Android Open Source Project -// -// 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.Gerrit; -import com.google.gerrit.client.changes.ChangeInfo.IncludedInInfo; -import com.google.gerrit.client.rpc.GerritCallback; -import com.google.gerrit.common.data.IncludedInDetail; -import com.google.gerrit.reviewdb.client.Change; -import com.google.gwt.core.client.JsArrayString; -import com.google.gwt.event.logical.shared.OpenEvent; -import com.google.gwt.event.logical.shared.OpenHandler; -import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.DisclosurePanel; -import com.google.gwt.user.client.ui.Grid; -import com.google.gwt.user.client.ui.HTMLTable.CellFormatter; - -import java.util.ArrayList; -import java.util.List; - - -/** Displays a table of Branches and Tags containing the change record. */ -public class IncludedInTable extends Composite implements - OpenHandler { - private final Grid table; - private final Change.Id changeId; - private boolean loaded = false; - - public IncludedInTable(final Change.Id chId) { - changeId = chId; - table = new Grid(1, 1); - initWidget(table); - } - - public void loadTable(final IncludedInDetail detail) { - int row = 0; - table.resizeRows(detail.getBranches().size() + 1); - table.addStyleName(Gerrit.RESOURCES.css().changeTable()); - final CellFormatter fmt = table.getCellFormatter(); - fmt.addStyleName(row, 0, Gerrit.RESOURCES.css().dataHeader()); - table.setText(row, 0, Util.C.includedInTableBranch()); - - for (final String branch : detail.getBranches()) { - fmt.addStyleName(++row, 0, Gerrit.RESOURCES.css().dataCell()); - fmt.addStyleName(row, 0, Gerrit.RESOURCES.css().leftMostCell()); - table.setText(row, 0, branch); - } - - if (!detail.getTags().isEmpty()) { - table.resizeRows(table.getRowCount() + 2 + detail.getTags().size()); - row++; - fmt.addStyleName(++row, 0, Gerrit.RESOURCES.css().dataHeader()); - table.setText(row, 0, Util.C.includedInTableTag()); - - for (final String tag : detail.getTags()) { - fmt.addStyleName(++row, 0, Gerrit.RESOURCES.css().dataCell()); - fmt.addStyleName(row, 0, Gerrit.RESOURCES.css().leftMostCell()); - table.setText(row, 0, tag); - } - } - - table.setVisible(true); - loaded = true; - } - - @Override - public void onOpen(OpenEvent event) { - if (!loaded) { - ChangeApi.includedIn(changeId.get(), - new GerritCallback() { - @Override - public void onSuccess(IncludedInInfo r) { - IncludedInDetail result = new IncludedInDetail(); - result.setBranches(toList(r.branches())); - result.setTags(toList(r.tags())); - loadTable(result); - } - - private List toList(JsArrayString in) { - List r = new ArrayList<>(); - if (in != null) { - for (int i = 0; i < in.length(); i++) { - r.add(in.get(i)); - } - } - return r; - } - }); - } - } -} diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/PatchSetComplexDisclosurePanel.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/PatchSetComplexDisclosurePanel.java deleted file mode 100644 index 3cddab79be..0000000000 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/PatchSetComplexDisclosurePanel.java +++ /dev/null @@ -1,736 +0,0 @@ -// Copyright (C) 2008 The Android Open Source Project -// -// 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.Dispatcher; -import com.google.gerrit.client.ErrorDialog; -import com.google.gerrit.client.FormatUtil; -import com.google.gerrit.client.Gerrit; -import com.google.gerrit.client.GitwebLink; -import com.google.gerrit.client.change.DraftActions; -import com.google.gerrit.client.download.DownloadPanel; -import com.google.gerrit.client.rpc.GerritCallback; -import com.google.gerrit.client.rpc.NativeString; -import com.google.gerrit.client.rpc.RestApi; -import com.google.gerrit.client.ui.AccountLinkPanel; -import com.google.gerrit.client.ui.ActionDialog; -import com.google.gerrit.client.ui.CherryPickDialog; -import com.google.gerrit.client.ui.ComplexDisclosurePanel; -import com.google.gerrit.client.ui.ListenableAccountDiffPreference; -import com.google.gerrit.common.PageLinks; -import com.google.gerrit.common.data.ChangeDetail; -import com.google.gerrit.common.data.PatchSetDetail; -import com.google.gerrit.common.data.UiCommandDetail; -import com.google.gerrit.reviewdb.client.AccountDiffPreference; -import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadCommand; -import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadScheme; -import com.google.gerrit.reviewdb.client.Change; -import com.google.gerrit.reviewdb.client.PatchSet; -import com.google.gerrit.reviewdb.client.PatchSetInfo; -import com.google.gerrit.reviewdb.client.UserIdentity; -import com.google.gwt.core.client.JavaScriptObject; -import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.event.dom.client.ClickHandler; -import com.google.gwt.event.logical.shared.OpenEvent; -import com.google.gwt.event.logical.shared.OpenHandler; -import com.google.gwt.user.client.Window; -import com.google.gwt.user.client.rpc.AsyncCallback; -import com.google.gwt.user.client.ui.Anchor; -import com.google.gwt.user.client.ui.Button; -import com.google.gwt.user.client.ui.DisclosurePanel; -import com.google.gwt.user.client.ui.FlowPanel; -import com.google.gwt.user.client.ui.Grid; -import com.google.gwt.user.client.ui.HTMLTable.CellFormatter; -import com.google.gwt.user.client.ui.Image; -import com.google.gwt.user.client.ui.InlineLabel; -import com.google.gwt.user.client.ui.Panel; - -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -class PatchSetComplexDisclosurePanel extends ComplexDisclosurePanel - implements OpenHandler { - private static final int R_AUTHOR = 0; - private static final int R_COMMITTER = 1; - private static final int R_PARENTS = 2; - private static final int R_DOWNLOAD = 3; - private static final int R_CNT = 4; - - private final ChangeDetailCache detailCache; - private final ChangeDetail changeDetail; - private final PatchSet patchSet; - private final FlowPanel body; - - private Grid infoTable; - private Panel actionsPanel; - private PatchTable patchTable; - private final Set registeredClickHandler = new HashSet<>(); - - private PatchSet.Id diffBaseId; - - /** - * Creates a closed complex disclosure panel for a patch set. - * The patch set details are loaded when the complex disclosure panel is opened. - */ - public PatchSetComplexDisclosurePanel(final PatchSet ps, boolean isOpen, - boolean hasDraftComments) { - super(Util.M.patchSetHeader(ps.getPatchSetId()), isOpen); - detailCache = ChangeCache.get(ps.getId().getParentKey()).getChangeDetailCache(); - changeDetail = detailCache.get(); - patchSet = ps; - - body = new FlowPanel(); - setContent(body); - - if (hasDraftComments) { - final Image draftComments = new Image(Gerrit.RESOURCES.draftComments()); - draftComments.setTitle(Util.C.patchSetWithDraftCommentsToolTip()); - getHeader().add(draftComments); - } - - final GitwebLink gw = Gerrit.getGitwebLink(); - final InlineLabel revtxt = new InlineLabel(ps.getRevision().get() + " "); - revtxt.addStyleName(Gerrit.RESOURCES.css().patchSetRevision()); - getHeader().add(revtxt); - if (gw != null && gw.canLink(ps)) { - final Anchor revlink = - new Anchor(gw.getLinkName(), false, gw.toRevision(changeDetail.getChange() - .getProject(), ps)); - revlink.addStyleName(Gerrit.RESOURCES.css().patchSetLink()); - getHeader().add(revlink); - } - - if (ps.isDraft()) { - final InlineLabel draftLabel = new InlineLabel(Util.C.draftPatchSetLabel()); - draftLabel.addStyleName(Gerrit.RESOURCES.css().patchSetRevision()); - getHeader().add(draftLabel); - } - - if (isOpen) { - ensureLoaded(changeDetail.getCurrentPatchSetDetail()); - } else { - addOpenHandler(this); - } - - } - - public void setDiffBaseId(PatchSet.Id diffBaseId) { - this.diffBaseId = diffBaseId; - } - - /** - * Display the table showing the Author, Committer and Download links, - * followed by the action buttons. - */ - public void ensureLoaded(final PatchSetDetail detail) { - loadInfoTable(detail); - loadActionPanel(detail); - loadPatchTable(detail); - } - - public void loadInfoTable(final PatchSetDetail detail) { - infoTable = new Grid(R_CNT, 2); - infoTable.setStyleName(Gerrit.RESOURCES.css().infoBlock()); - infoTable.addStyleName(Gerrit.RESOURCES.css().patchSetInfoBlock()); - - initRow(R_AUTHOR, Util.C.patchSetInfoAuthor()); - initRow(R_COMMITTER, Util.C.patchSetInfoCommitter()); - initRow(R_PARENTS, Util.C.patchSetInfoParents()); - initRow(R_DOWNLOAD, Util.C.patchSetInfoDownload()); - - final CellFormatter itfmt = infoTable.getCellFormatter(); - itfmt.addStyleName(0, 0, Gerrit.RESOURCES.css().topmost()); - itfmt.addStyleName(0, 1, Gerrit.RESOURCES.css().topmost()); - itfmt.addStyleName(R_CNT - 1, 0, Gerrit.RESOURCES.css().bottomheader()); - itfmt.addStyleName(R_AUTHOR, 1, Gerrit.RESOURCES.css().useridentity()); - itfmt.addStyleName(R_COMMITTER, 1, Gerrit.RESOURCES.css().useridentity()); - itfmt.addStyleName(R_DOWNLOAD, 1, Gerrit.RESOURCES.css() - .downloadLinkListCell()); - - final PatchSetInfo info = detail.getInfo(); - displayUserIdentity(R_AUTHOR, info.getAuthor()); - displayUserIdentity(R_COMMITTER, info.getCommitter()); - displayParents(info.getParents()); - displayDownload(); - - body.add(infoTable); - } - - public void loadActionPanel(final PatchSetDetail detail) { - if (!patchSet.getId().equals(diffBaseId)) { - actionsPanel = new FlowPanel(); - actionsPanel.setStyleName(Gerrit.RESOURCES.css().patchSetActions()); - actionsPanel.setVisible(true); - if (Gerrit.isSignedIn()) { - if (changeDetail.canEdit()) { - populateReviewAction(); - if (changeDetail.isCurrentPatchSet(detail)) { - populateActions(detail); - } - populateCommands(detail); - } - if (detail.getPatchSet().isDraft()) { - if (changeDetail.canPublish()) { - populatePublishAction(); - } - if (changeDetail.canDeleteDraft() - && changeDetail.getPatchSets().size() > 1) { - populateDeleteDraftPatchSetAction(); - } - } - } - body.add(actionsPanel); - } - } - - public void loadPatchTable(final PatchSetDetail detail) { - if (!patchSet.getId().equals(diffBaseId)) { - patchTable = new PatchTable(); - patchTable.setSavePointerId("PatchTable " + patchSet.getId()); - patchTable.display(diffBaseId, detail); - for (ClickHandler clickHandler : registeredClickHandler) { - patchTable.addClickHandler(clickHandler); - } - patchTable.setRegisterKeys(true); - setActive(true); - body.add(patchTable); - } - } - - public class ChangeDownloadPanel extends DownloadPanel { - public ChangeDownloadPanel(String project, String ref, boolean allowAnonymous) { - super(project, ref, allowAnonymous); - } - - @Override - public void populateDownloadCommandLinks() { - // This site prefers usage of the 'repo' tool, so suggest - // that for easy fetch. - // - if (allowedSchemes.contains(DownloadScheme.REPO_DOWNLOAD)) { - commands.add(cmdLinkfactory.new RepoCommandLink(projectName, - changeDetail.getChange().getChangeId() + "/" - + patchSet.getPatchSetId())); - } - - if (!urls.isEmpty()) { - if (allowedCommands.contains(DownloadCommand.CHECKOUT) - || allowedCommands.contains(DownloadCommand.DEFAULT_DOWNLOADS)) { - commands.add(cmdLinkfactory.new CheckoutCommandLink()); - } - if (allowedCommands.contains(DownloadCommand.PULL) - || allowedCommands.contains(DownloadCommand.DEFAULT_DOWNLOADS)) { - commands.add(cmdLinkfactory.new PullCommandLink()); - } - if (allowedCommands.contains(DownloadCommand.CHERRY_PICK) - || allowedCommands.contains(DownloadCommand.DEFAULT_DOWNLOADS)) { - commands.add(cmdLinkfactory.new CherryPickCommandLink()); - } - if (allowedCommands.contains(DownloadCommand.FORMAT_PATCH) - || allowedCommands.contains(DownloadCommand.DEFAULT_DOWNLOADS)) { - commands.add(cmdLinkfactory.new FormatPatchCommandLink()); - } - } - } - } - - private void displayDownload() { - ChangeDownloadPanel dp = new ChangeDownloadPanel( - changeDetail.getChange().getProject().get(), - patchSet.getRefName(), - changeDetail.isAllowsAnonymous()); - - infoTable.setWidget(R_DOWNLOAD, 1, dp); - } - - private void displayUserIdentity(final int row, final UserIdentity who) { - if (who == null) { - infoTable.clearCell(row, 1); - return; - } - - final FlowPanel fp = new FlowPanel(); - fp.setStyleName(Gerrit.RESOURCES.css().patchSetUserIdentity()); - if (who.getName() != null) { - if (who.getAccount() != null) { - fp.add(new AccountLinkPanel(who)); - } else { - final InlineLabel lbl = new InlineLabel(who.getName()); - lbl.setStyleName(Gerrit.RESOURCES.css().accountName()); - fp.add(lbl); - } - } - if (who.getEmail() != null) { - fp.add(new InlineLabel("<" + who.getEmail() + ">")); - } - if (who.getDate() != null) { - fp.add(new InlineLabel(FormatUtil.mediumFormat(who.getDate()))); - } - infoTable.setWidget(row, 1, fp); - } - - private void displayParents(final List parents) { - if (parents.size() == 0) { - infoTable.setWidget(R_PARENTS, 1, new InlineLabel(Util.C.initialCommit())); - return; - } - final Grid parentsTable = new Grid(parents.size(), 2); - - parentsTable.setStyleName(Gerrit.RESOURCES.css().parentsTable()); - parentsTable.addStyleName(Gerrit.RESOURCES.css().noborder()); - final CellFormatter ptfmt = parentsTable.getCellFormatter(); - int row = 0; - for (PatchSetInfo.ParentInfo parent : parents) { - parentsTable.setWidget(row, 0, new InlineLabel(parent.id.get())); - ptfmt.addStyleName(row, 0, Gerrit.RESOURCES.css().noborder()); - ptfmt.addStyleName(row, 0, Gerrit.RESOURCES.css().monospace()); - parentsTable.setWidget(row, 1, - new InlineLabel(Util.cropSubject(parent.shortMessage))); - ptfmt.addStyleName(row, 1, Gerrit.RESOURCES.css().noborder()); - row++; - } - infoTable.setWidget(R_PARENTS, 1, parentsTable); - } - - private void populateActions(final PatchSetDetail detail) { - final boolean isOpen = changeDetail.getChange().getStatus().isOpen(); - - if (isOpen && changeDetail.canSubmit()) { - final Button b = - new Button(Util.M - .submitPatchSet(detail.getPatchSet().getPatchSetId())); - b.addClickHandler(new ClickHandler() { - @Override - public void onClick(final ClickEvent event) { - b.setEnabled(false); - ChangeApi.submit( - patchSet.getId().getParentKey().get(), - patchSet.getRevision().get(), - new GerritCallback() { - @Override - public void onSuccess(SubmitInfo result) { - redisplay(); - } - - @Override - public void onFailure(Throwable err) { - if (SubmitFailureDialog.isConflict(err)) { - new SubmitFailureDialog(err.getMessage()).center(); - redisplay(); - } else { - b.setEnabled(true); - super.onFailure(err); - } - } - - private void redisplay() { - Gerrit.display( - PageLinks.toChange(patchSet.getId().getParentKey()), - new ChangeScreen(patchSet.getId().getParentKey())); - } - }); - } - }); - actionsPanel.add(b); - } - - if (changeDetail.canRevert()) { - final Button b = new Button(Util.C.buttonRevertChangeBegin()); - b.addClickHandler(new ClickHandler() { - @Override - public void onClick(final ClickEvent event) { - b.setEnabled(false); - new ActionDialog(b, true, Util.C.revertChangeTitle(), - Util.C.headingRevertMessage()) { - { - sendButton.setText(Util.C.buttonRevertChangeSend()); - message.setText(Util.M.revertChangeDefaultMessage( - detail.getInfo().getSubject(), - detail.getPatchSet().getRevision().get()) - ); - } - - @Override - public void onSend() { - ChangeApi.revert(changeDetail.getChange().getChangeId(), - getMessageText(), new GerritCallback() { - @Override - public void onSuccess(ChangeInfo result) { - sent = true; - Gerrit.display(PageLinks.toChange(new Change.Id(result - ._number()))); - hide(); - } - - @Override - public void onFailure(Throwable caught) { - enableButtons(true); - super.onFailure(caught); - } - }); - } - }.center(); - } - }); - actionsPanel.add(b); - } - - if (changeDetail.canCherryPick()) { - final Button b = new Button(Util.C.buttonCherryPickChangeBegin()); - b.addClickHandler(new ClickHandler() { - @Override - public void onClick(final ClickEvent event) { - b.setEnabled(false); - new CherryPickDialog(b, changeDetail.getChange().getProject()) { - { - sendButton.setText(Util.C.buttonCherryPickChangeSend()); - if (changeDetail.getChange().getStatus().isClosed()) { - message.setText(Util.M.cherryPickedChangeDefaultMessage( - detail.getInfo().getMessage().trim(), - detail.getPatchSet().getRevision().get())); - } else { - message.setText(detail.getInfo().getMessage().trim()); - } - } - - @Override - public void onSend() { - ChangeApi.cherrypick(changeDetail.getChange().getChangeId(), - patchSet.getRevision().get(), - getDestinationBranch(), - getMessageText(), - new GerritCallback() { - @Override - public void onSuccess(ChangeInfo result) { - sent = true; - Gerrit.display(PageLinks.toChange(new Change.Id(result - ._number()))); - hide(); - } - - @Override - public void onFailure(Throwable caught) { - enableButtons(true); - super.onFailure(caught); - } - }); - } - }.center(); - } - }); - actionsPanel.add(b); - } - - if (changeDetail.canAbandon()) { - final Button b = new Button(Util.C.buttonAbandonChangeBegin()); - b.addClickHandler(new ClickHandler() { - @Override - public void onClick(final ClickEvent event) { - b.setEnabled(false); - new ActionDialog(b, false, Util.C.abandonChangeTitle(), - Util.C.headingAbandonMessage()) { - { - sendButton.setText(Util.C.buttonAbandonChangeSend()); - } - - @Override - public void onSend() { - // TODO: once the other users of ActionDialog have converted to - // REST APIs, we can use createCallback() rather than providing - // them directly. - ChangeApi.abandon(changeDetail.getChange().getChangeId(), - getMessageText(), new GerritCallback() { - @Override - public void onSuccess(ChangeInfo result) { - sent = true; - Gerrit.display(PageLinks.toChange(new Change.Id(result - ._number()))); - hide(); - } - - @Override - public void onFailure(Throwable caught) { - enableButtons(true); - super.onFailure(caught); - } - }); - } - }.center(); - } - }); - actionsPanel.add(b); - } - - if (changeDetail.getChange().getStatus() == Change.Status.DRAFT - && changeDetail.canDeleteDraft()) { - final Button b = new Button(Util.C.buttonDeleteDraftChange()); - b.addClickHandler(new ClickHandler() { - @Override - public void onClick(final ClickEvent event) { - b.setEnabled(false); - ChangeApi.deleteChange(patchSet.getId().getParentKey().get(), - new GerritCallback() { - @Override - public void onSuccess(JavaScriptObject result) { - Gerrit.display(PageLinks.MINE); - } - - @Override - public void onFailure(Throwable err) { - if (SubmitFailureDialog.isConflict(err)) { - new SubmitFailureDialog(err.getMessage()).center(); - Gerrit.display(PageLinks.MINE); - } else { - b.setEnabled(true); - super.onFailure(err); - } - } - }); - } - }); - actionsPanel.add(b); - } - - if (changeDetail.canRestore()) { - final Button b = new Button(Util.C.buttonRestoreChangeBegin()); - b.addClickHandler(new ClickHandler() { - @Override - public void onClick(final ClickEvent event) { - b.setEnabled(false); - new ActionDialog(b, false, Util.C.restoreChangeTitle(), - Util.C.headingRestoreMessage()) { - { - sendButton.setText(Util.C.buttonRestoreChangeSend()); - } - - @Override - public void onSend() { - ChangeApi.restore(changeDetail.getChange().getChangeId(), - getMessageText(), new GerritCallback() { - @Override - public void onSuccess(ChangeInfo result) { - sent = true; - Gerrit.display(PageLinks.toChange(new Change.Id(result - ._number()))); - hide(); - } - - @Override - public void onFailure(Throwable caught) { - enableButtons(true); - super.onFailure(caught); - } - }); - } - }.center(); - } - }); - actionsPanel.add(b); - } - - if (changeDetail.canRebase()) { - final Button b = new Button(Util.C.buttonRebaseChange()); - b.addClickHandler(new ClickHandler() { - @Override - public void onClick(final ClickEvent event) { - b.setEnabled(false); - final Change.Id id = patchSet.getId().getParentKey(); - ChangeApi.rebase(id.get(), patchSet.getRevision().get(), - new GerritCallback() { - @Override - public void onSuccess(ChangeInfo result) { - Gerrit.display(PageLinks.toChange(id)); - } - }); - } - }); - actionsPanel.add(b); - } - } - - private void populateCommands(final PatchSetDetail detail) { - for (final UiCommandDetail cmd : detail.getCommands()) { - final Button b = new Button(); - b.setText(cmd.label); - b.setEnabled(cmd.enabled); - b.setTitle(cmd.title); - b.addClickHandler(new ClickHandler() { - @Override - public void onClick(final ClickEvent event) { - b.setEnabled(false); - AsyncCallback cb = - new AsyncCallback() { - @Override - public void onFailure(Throwable caught) { - b.setEnabled(true); - new ErrorDialog(caught).center(); - } - - @Override - public void onSuccess(NativeString msg) { - b.setEnabled(true); - if (msg != null && !msg.asString().isEmpty()) { - Window.alert(msg.asString()); - } - Gerrit.display(PageLinks.toChange(patchSet.getId())); - } - }; - RestApi api = ChangeApi.revision(patchSet.getId()).view(cmd.id); - if ("PUT".equalsIgnoreCase(cmd.method)) { - api.put(JavaScriptObject.createObject(), cb); - } else if ("DELETE".equalsIgnoreCase(cmd.method)) { - api.delete(cb); - } else { - api.post(JavaScriptObject.createObject(), cb); - } - } - }); - actionsPanel.add(b); - } - } - - private void populateReviewAction() { - final Button b = new Button(Util.C.buttonReview()); - b.addClickHandler(new ClickHandler() { - @Override - public void onClick(final ClickEvent event) { - Gerrit.display(Dispatcher.toPublish(patchSet.getId())); - } - }); - actionsPanel.add(b); - } - - private void populatePublishAction() { - final Button b = new Button(Util.C.buttonPublishPatchSet()); - b.addClickHandler(new ClickHandler() { - @Override - public void onClick(final ClickEvent event) { - b.setEnabled(false); - final Change.Id id = patchSet.getId().getParentKey(); - ChangeApi.publish(id.get(), - patchSet.getRevision().get(), - DraftActions.cs(id)); - } - }); - actionsPanel.add(b); - } - - private void populateDeleteDraftPatchSetAction() { - final Button b = new Button(Util.C.buttonDeleteDraftPatchSet()); - b.addClickHandler(new ClickHandler() { - @Override - public void onClick(final ClickEvent event) { - b.setEnabled(false); - final Change.Id id = patchSet.getId().getParentKey(); - ChangeApi.deleteRevision(id.get(), - patchSet.getRevision().get(), - DraftActions.cs(id)); - } - }); - actionsPanel.add(b); - } - - public void refresh() { - if (patchSet.getId().equals(diffBaseId)) { - if (patchTable != null) { - patchTable.setVisible(false); - } - if (actionsPanel != null) { - actionsPanel.setVisible(false); - } - } else { - if (patchTable != null) { - if (patchTable.getBase() == null && diffBaseId == null - || patchTable.getBase() != null - && patchTable.getBase().equals(diffBaseId)) { - actionsPanel.setVisible(true); - patchTable.setVisible(true); - return; - } - } - - AccountDiffPreference diffPrefs; - if (patchTable == null) { - diffPrefs = new ListenableAccountDiffPreference().get(); - } else { - diffPrefs = patchTable.getPreferences().get(); - patchTable.setVisible(false); - } - - Util.DETAIL_SVC.patchSetDetail2(diffBaseId, patchSet.getId(), diffPrefs, - new GerritCallback() { - @Override - public void onSuccess(PatchSetDetail result) { - if (actionsPanel != null) { - actionsPanel.setVisible(true); - } else { - loadActionPanel(result); - } - loadPatchTable(result); - } - }); - } - } - - @Override - public void onOpen(final OpenEvent event) { - if (infoTable == null) { - AccountDiffPreference diffPrefs; - if (diffBaseId == null) { - diffPrefs = null; - } else { - diffPrefs = new ListenableAccountDiffPreference().get(); - } - - Util.DETAIL_SVC.patchSetDetail2(diffBaseId, patchSet.getId(), diffPrefs, - new GerritCallback() { - @Override - public void onSuccess(final PatchSetDetail result) { - loadInfoTable(result); - loadActionPanel(result); - } - }); - } - } - - private void initRow(final int row, final String name) { - infoTable.setText(row, 0, name); - infoTable.getCellFormatter().addStyleName(row, 0, - Gerrit.RESOURCES.css().header()); - } - - public PatchSet getPatchSet() { - return patchSet; - } - - /** - * Adds a click handler to the patch table. - * If the patch table is not yet initialized it is guaranteed that the click handler - * is added to the patch table after initialization. - */ - public void addClickHandler(final ClickHandler clickHandler) { - registeredClickHandler.add(clickHandler); - if (patchTable != null) { - patchTable.addClickHandler(clickHandler); - } - } - - /** Activates / Deactivates the key navigation and the highlighting of the current row for the patch table */ - public void setActive(boolean active) { - if (patchTable != null) { - patchTable.setActive(active); - } - } -} diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/PatchSetsBlock.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/PatchSetsBlock.java deleted file mode 100644 index 01c8fdb661..0000000000 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/PatchSetsBlock.java +++ /dev/null @@ -1,272 +0,0 @@ -// Copyright (C) 2010 The Android Open Source Project -// -// 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.Gerrit; -import com.google.gerrit.common.PageLinks; -import com.google.gerrit.common.data.ChangeDetail; -import com.google.gerrit.reviewdb.client.AccountGeneralPreferences; -import com.google.gerrit.reviewdb.client.PatchSet; -import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.event.dom.client.ClickHandler; -import com.google.gwt.event.dom.client.KeyPressEvent; -import com.google.gwt.event.logical.shared.OpenEvent; -import com.google.gwt.event.logical.shared.OpenHandler; -import com.google.gwt.event.shared.HandlerRegistration; -import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.DisclosurePanel; -import com.google.gwt.user.client.ui.FlowPanel; -import com.google.gwtexpui.globalkey.client.GlobalKey; -import com.google.gwtexpui.globalkey.client.KeyCommand; -import com.google.gwtexpui.globalkey.client.KeyCommandSet; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Composite that displays the patch sets of a change. This composite ensures - * that keyboard navigation to each changed file in all patch sets is possible. - */ -public class PatchSetsBlock extends Composite { - private final Map patchSetPanels = - new HashMap<>(); - - private final FlowPanel body; - private HandlerRegistration regNavigation; - - private List patchSetPanelsList; - - /** - * the patch set id of the patch set for which is the keyboard navigation is - * currently enabled - */ - private PatchSet.Id activePatchSetId; - - /** the patch set id of the current (latest) patch set */ - private PatchSet.Id currentPatchSetId; - - /** Patch sets on this change, in order. */ - private List patchSets; - - PatchSetsBlock() { - body = new FlowPanel(); - initWidget(body); - } - - /** Adds UI elements for each patch set of the given change to this composite. */ - public void display(final ChangeDetail detail, final PatchSet.Id diffBaseId) { - clear(); - - final PatchSet currps = detail.getCurrentPatchSet(); - currentPatchSetId = currps.getId(); - patchSets = detail.getPatchSets(); - - if (Gerrit.isSignedIn()) { - final AccountGeneralPreferences p = - Gerrit.getUserAccount().getGeneralPreferences(); - if (p.isReversePatchSetOrder()) { - Collections.reverse(patchSets); - } - } - - patchSetPanelsList = new ArrayList<>(); - - for (final PatchSet ps : patchSets) { - final PatchSetComplexDisclosurePanel p = - new PatchSetComplexDisclosurePanel(ps, ps == currps, - detail.hasDraftComments(ps.getId())); - if (diffBaseId != null) { - p.setDiffBaseId(diffBaseId); - if (ps == currps) { - p.refresh(); - } - } - add(p); - patchSetPanelsList.add(p); - } - } - - private void clear() { - setRegisterKeys(false); - body.clear(); - patchSetPanels.clear(); - } - - public void refresh(final PatchSet.Id diffBaseId) { - if (patchSetPanelsList != null) { - for (final PatchSetComplexDisclosurePanel p : patchSetPanelsList) { - p.setDiffBaseId(diffBaseId); - if (p.isOpen()) { - p.refresh(); - } - } - } - } - - /** - * Adds the given patch set panel to this composite and ensures that handler - * to activate / deactivate keyboard navigation for the patch set panel are - * registered. - */ - private void add(final PatchSetComplexDisclosurePanel patchSetPanel) { - body.add(patchSetPanel); - - final PatchSet.Id id = patchSetPanel.getPatchSet().getId(); - ActivationHandler activationHandler = new ActivationHandler(id); - patchSetPanel.addOpenHandler(activationHandler); - patchSetPanel.addClickHandler(activationHandler); - patchSetPanels.put(id, patchSetPanel); - } - - public void setRegisterKeys(final boolean on) { - if (on) { - KeyCommandSet keysNavigation = - new KeyCommandSet(Gerrit.C.sectionNavigation()); - keysNavigation.add(new PreviousPatchSetKeyCommand(0, 'p', Util.C - .previousPatchSet())); - keysNavigation.add(new NextPatchSetKeyCommand(0, 'n', Util.C - .nextPatchSet())); - regNavigation = GlobalKey.add(this, keysNavigation); - if (activePatchSetId != null) { - activate(activePatchSetId); - } else { - activate(currentPatchSetId); - } - } else { - if (regNavigation != null) { - regNavigation.removeHandler(); - regNavigation = null; - } - deactivate(); - } - } - - @Override - protected void onUnload() { - setRegisterKeys(false); - super.onUnload(); - } - - /** - * Activates keyboard navigation for the patch set panel that displays the - * patch set with the given patch set id. - * The keyboard navigation for the previously active patch set panel is - * automatically deactivated. - * This method also ensures that the current row is only highlighted in the - * table of the active patch set panel. - */ - public void activate(final PatchSet.Id patchSetId) { - if (indexOf(patchSetId) != -1) { - if (!patchSetId.equals(activePatchSetId)) { - deactivate(); - PatchSetComplexDisclosurePanel patchSetPanel = - patchSetPanels.get(patchSetId); - patchSetPanel.setActive(true); - patchSetPanel.setOpen(true); - activePatchSetId = patchSetId; - } - } else { - Gerrit.display(PageLinks.toChange(patchSetId.getParentKey())); - } - } - - /** Deactivates the keyboard navigation for the currently active patch set panel. */ - private void deactivate() { - if (activePatchSetId != null) { - PatchSetComplexDisclosurePanel patchSetPanel = - patchSetPanels.get(activePatchSetId); - patchSetPanel.setActive(false); - activePatchSetId = null; - } - } - - public PatchSet getCurrentPatchSet() { - PatchSetComplexDisclosurePanel patchSetPanel = - patchSetPanels.get(currentPatchSetId); - if (patchSetPanel != null) { - return patchSetPanel.getPatchSet(); - } else { - return null; - } - } - - private int indexOf(PatchSet.Id id) { - for (int i = 0; i < patchSets.size(); i++) { - if (patchSets.get(i).getId().equals(id)) { - return i; - } - } - return -1; - } - - private class ActivationHandler implements OpenHandler, - ClickHandler { - - private final PatchSet.Id patchSetId; - - ActivationHandler(PatchSet.Id patchSetId) { - this.patchSetId = patchSetId; - } - - @Override - public void onOpen(OpenEvent event) { - // when a patch set panel is opened by the user - // it should automatically become active - PatchSetComplexDisclosurePanel patchSetPanel = - patchSetPanels.get(patchSetId); - patchSetPanel.refresh(); - activate(patchSetId); - } - - @Override - public void onClick(ClickEvent event) { - // when a user clicks on a patch table the corresponding - // patch set panel should automatically become active - activate(patchSetId); - } - - } - - public class PreviousPatchSetKeyCommand extends KeyCommand { - public PreviousPatchSetKeyCommand(int mask, char key, String help) { - super(mask, key, help); - } - - @Override - public void onKeyPress(final KeyPressEvent event) { - int index = indexOf(activePatchSetId) - 1; - if (0 <= index) { - activate(patchSets.get(index).getId()); - } - } - } - - public class NextPatchSetKeyCommand extends KeyCommand { - public NextPatchSetKeyCommand(int mask, char key, String help) { - super(mask, key, help); - } - - @Override - public void onKeyPress(final KeyPressEvent event) { - int index = indexOf(activePatchSetId) + 1; - if (index < patchSets.size()) { - activate(patchSets.get(index).getId()); - } - } - } -} diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/PatchTable.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/PatchTable.java index 96c567d9ca..940b044926 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/PatchTable.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/PatchTable.java @@ -16,7 +16,6 @@ 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; import com.google.gerrit.client.ui.ListenableAccountDiffPreference; import com.google.gerrit.client.ui.NavigationTable; @@ -213,46 +212,42 @@ public class PatchTable extends Composite { /** * @return a link to the previous file in this patch set, or null. */ - public InlineHyperlink getPreviousPatchLink(int index, - PatchScreen.Type patchType) { + public InlineHyperlink getPreviousPatchLink(int index) { int previousPatchIndex = getPreviousPatch(index, PREFERENCE_VALIDATOR); if (previousPatchIndex < 0) { return null; } - return createLink(previousPatchIndex, patchType, + return createLink(previousPatchIndex, SafeHtml.asis(Util.C.prevPatchLinkIcon()), null); } /** * @return a link to the next file in this patch set, or null. */ - public InlineHyperlink getNextPatchLink(int index, PatchScreen.Type patchType) { + public InlineHyperlink getNextPatchLink(int index) { int nextPatchIndex = getNextPatch(index, false, PREFERENCE_VALIDATOR); if (nextPatchIndex < 0) { return null; } - return createLink(nextPatchIndex, patchType, null, + return createLink(nextPatchIndex, null, SafeHtml.asis(Util.C.nextPatchLinkIcon())); } /** * @return a link to the the given patch. * @param index The patch to link to - * @param screenType The screen type of patch display * @param before A string to display at the beginning of the href text * @param after A string to display at the end of the href text */ - public PatchLink createLink(int index, PatchScreen.Type screenType, - SafeHtml before, SafeHtml after) { + public PatchLink createLink(int index, SafeHtml before, SafeHtml after) { Patch patch = patchList.get(index); - Patch.Key thisKey = patch.getKey(); PatchLink link; - if (isUnifiedPatchLink(patch, screenType)) { - link = new PatchLink.Unified("", base, thisKey, index, detail, this); + if (isUnifiedPatchLink(patch)) { + link = new PatchLink.Unified("", base, thisKey); } else { - link = new PatchLink.SideBySide("", base, thisKey, index, detail, this); + link = new PatchLink.SideBySide("", base, thisKey); } SafeHtmlBuilder text = new SafeHtmlBuilder(); @@ -263,15 +258,10 @@ public class PatchTable extends Composite { return link; } - private static boolean isUnifiedPatchLink(final Patch patch, - final PatchScreen.Type screenType) { - if (Dispatcher.isChangeScreen2()) { - return (patch.getPatchType().equals(PatchType.BINARY) - || (Gerrit.isSignedIn() - && Gerrit.getUserAccount().getGeneralPreferences().getDiffView() - .equals(DiffView.UNIFIED_DIFF))); - } - return screenType == PatchScreen.Type.UNIFIED; + private static boolean isUnifiedPatchLink(final Patch patch) { + return (patch.getPatchType().equals(PatchType.BINARY) + || Gerrit.getUserAccount().getGeneralPreferences().getDiffView() + .equals(DiffView.UNIFIED_DIFF)); } private static String getFileNameOnly(Patch patch) { @@ -403,9 +393,8 @@ public class PatchTable extends Composite { Patch patch = PatchTable.this.patchList.get(row - 1); setRowItem(row, patch); - Widget nameCol; - nameCol = new PatchLink.SideBySide(getDisplayFileName(patch), base, - patch.getKey(), row - 1, detail, PatchTable.this); + Widget nameCol = new PatchLink.SideBySide(getDisplayFileName(patch), base, + patch.getKey()); if (patch.getSourceFileName() != null) { final String text; @@ -427,14 +416,12 @@ public class PatchTable extends Composite { int C_UNIFIED = C_SIDEBYSIDE + 1; - PatchLink sideBySide = - new PatchLink.SideBySide(Util.C.patchTableDiffSideBySide(), base, - patch.getKey(), row - 1, detail, PatchTable.this); + PatchLink sideBySide = new PatchLink.SideBySide( + Util.C.patchTableDiffSideBySide(), base, patch.getKey()); sideBySide.setStyleName("gwt-Anchor"); - PatchLink unified = - new PatchLink.Unified(Util.C.patchTableDiffUnified(), base, - patch.getKey(), row - 1, detail, PatchTable.this); + PatchLink unified = new PatchLink.Unified(Util.C.patchTableDiffUnified(), + base, patch.getKey()); unified.setStyleName("gwt-Anchor"); table.setWidget(row, C_SIDEBYSIDE, sideBySide); @@ -447,7 +434,7 @@ public class PatchTable extends Composite { @Override public void onClick(ClickEvent event) { for (Patch p : detail.getPatches()) { - openWindow(Dispatcher.toPatchSideBySide(base, p.getKey())); + openWindow(Dispatcher.toSideBySide(base, p.getKey())); } } }); @@ -459,7 +446,7 @@ public class PatchTable extends Composite { @Override public void onClick(ClickEvent event) { for (Patch p : detail.getPatches()) { - openWindow(Dispatcher.toPatchUnified(base, p.getKey())); + openWindow(Dispatcher.toUnified(base, p.getKey())); } } }); diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/PublishCommentScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/PublishCommentScreen.java deleted file mode 100644 index e839717107..0000000000 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/PublishCommentScreen.java +++ /dev/null @@ -1,526 +0,0 @@ -// Copyright (C) 2009 The Android Open Source Project -// -// 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.Gerrit; -import com.google.gerrit.client.changes.ChangeInfo.ApprovalInfo; -import com.google.gerrit.client.changes.ChangeInfo.LabelInfo; -import com.google.gerrit.client.patches.AbstractPatchContentTable; -import com.google.gerrit.client.patches.CommentEditorContainer; -import com.google.gerrit.client.patches.CommentEditorPanel; -import com.google.gerrit.client.projects.ConfigInfoCache; -import com.google.gerrit.client.rpc.CallbackGroup; -import com.google.gerrit.client.rpc.GerritCallback; -import com.google.gerrit.client.rpc.NativeMap; -import com.google.gerrit.client.rpc.NativeString; -import com.google.gerrit.client.rpc.Natives; -import com.google.gerrit.client.rpc.RestApi; -import com.google.gerrit.client.rpc.ScreenLoadCallback; -import com.google.gerrit.client.ui.AccountScreen; -import com.google.gerrit.client.ui.CommentLinkProcessor; -import com.google.gerrit.client.ui.PatchLink; -import com.google.gerrit.client.ui.SmallHeading; -import com.google.gerrit.common.PageLinks; -import com.google.gerrit.common.data.ChangeDetail; -import com.google.gerrit.common.data.SubmitTypeRecord; -import com.google.gerrit.extensions.common.ListChangesOption; -import com.google.gerrit.extensions.common.SubmitType; -import com.google.gerrit.reviewdb.client.Change; -import com.google.gerrit.reviewdb.client.Patch; -import com.google.gerrit.reviewdb.client.PatchLineComment; -import com.google.gerrit.reviewdb.client.PatchSet; -import com.google.gwt.core.client.JsArray; -import com.google.gwt.core.client.JsArrayString; -import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.event.dom.client.ClickHandler; -import com.google.gwt.user.client.rpc.AsyncCallback; -import com.google.gwt.user.client.ui.Button; -import com.google.gwt.user.client.ui.FlowPanel; -import com.google.gwt.user.client.ui.FormPanel; -import com.google.gwt.user.client.ui.FormPanel.SubmitEvent; -import com.google.gwt.user.client.ui.Panel; -import com.google.gwt.user.client.ui.RadioButton; -import com.google.gwt.user.client.ui.VerticalPanel; -import com.google.gwt.user.client.ui.Widget; -import com.google.gwtexpui.globalkey.client.NpTextArea; -import com.google.gwtexpui.safehtml.client.SafeHtml; -import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder; -import com.google.gwtjsonrpc.common.VoidResult; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.EnumSet; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class PublishCommentScreen extends AccountScreen implements - ClickHandler, CommentEditorContainer { - private static SavedState lastState; - - private final PatchSet.Id patchSetId; - private Collection approvalButtons; - private ChangeDescriptionBlock descBlock; - private ApprovalTable approvals; - private Panel approvalPanel; - private NpTextArea message; - private FlowPanel draftsPanel; - private Button send; - private Button cancel; - private boolean saveStateOnUnload = true; - private List commentEditors; - private ChangeInfo change; - private ChangeInfo detail; - private NativeMap> drafts; - private SubmitTypeRecord submitTypeRecord; - private CommentLinkProcessor commentLinkProcessor; - - public PublishCommentScreen(final PatchSet.Id psi) { - patchSetId = psi; - } - - @Override - protected void onInitUI() { - super.onInitUI(); - addStyleName(Gerrit.RESOURCES.css().publishCommentsScreen()); - - approvalButtons = new ArrayList<>(); - descBlock = new ChangeDescriptionBlock(null); - add(descBlock); - - approvals = new ApprovalTable(); - add(approvals); - - final FormPanel form = new FormPanel(); - final FlowPanel body = new FlowPanel(); - form.setWidget(body); - form.addSubmitHandler(new FormPanel.SubmitHandler() { - @Override - public void onSubmit(final SubmitEvent event) { - event.cancel(); - } - }); - add(form); - - approvalPanel = new FlowPanel(); - body.add(approvalPanel); - initMessage(body); - - draftsPanel = new FlowPanel(); - body.add(draftsPanel); - - final FlowPanel buttonRow = new FlowPanel(); - buttonRow.setStyleName(Gerrit.RESOURCES.css().patchSetActions()); - body.add(buttonRow); - - send = new Button(Util.C.buttonPublishCommentsSend()); - send.addClickHandler(this); - buttonRow.add(send); - - cancel = new Button(Util.C.buttonPublishCommentsCancel()); - cancel.addClickHandler(this); - buttonRow.add(cancel); - } - - private void enableForm(final boolean enabled) { - for (final ValueRadioButton approvalButton : approvalButtons) { - approvalButton.setEnabled(enabled); - } - message.setEnabled(enabled); - for (final CommentEditorPanel commentEditor : commentEditors) { - commentEditor.enableButtons(enabled); - } - send.setEnabled(enabled); - cancel.setEnabled(enabled); - } - - @Override - protected void onLoad() { - super.onLoad(); - - CallbackGroup group = new CallbackGroup(); - RestApi call = ChangeApi.detail(patchSetId.getParentKey().get()); - ChangeList.addOptions(call, EnumSet.of( - ListChangesOption.CURRENT_ACTIONS, - ListChangesOption.ALL_REVISIONS, - ListChangesOption.ALL_COMMITS)); - call.get(group.add(new GerritCallback() { - @Override - public void onSuccess(ChangeInfo result) { - detail = result; - } - })); - ChangeApi.revision(patchSetId) - .view("submit_type") - .get(group.add(new GerritCallback() { - @Override - public void onSuccess(NativeString result) { - submitTypeRecord = SubmitTypeRecord.OK( - SubmitType.valueOf(result.asString())); - } - @Override - public void onFailure(Throwable caught) {} - })); - ChangeApi.revision(patchSetId.getParentKey().get(), "" + patchSetId.get()) - .view("drafts") - .get(group.add(new AsyncCallback>>() { - @Override - public void onSuccess(NativeMap> result) { - drafts = result; - } - @Override - public void onFailure(Throwable caught) {} - })); - ChangeApi.revision(patchSetId).view("review") - .get(group.addFinal(new GerritCallback() { - @Override - public void onSuccess(ChangeInfo result) { - result.init(); - change = result; - preDisplay(result); - } - })); - } - - private void preDisplay(final ChangeInfo info) { - ConfigInfoCache.get(info.project_name_key(), - new ScreenLoadCallback(this) { - @Override - protected void preDisplay(ConfigInfoCache.Entry result) { - send.setEnabled(true); - commentLinkProcessor = result.getCommentLinkProcessor(); - setTheme(result.getTheme()); - displayScreen(); - } - - @Override - protected void postDisplay() { - message.setFocus(true); - } - }); - } - - @Override - protected void onUnload() { - super.onUnload(); - lastState = saveStateOnUnload ? new SavedState(this) : null; - } - - @Override - public void onClick(final ClickEvent event) { - final Widget sender = (Widget) event.getSource(); - if (send == sender) { - onSend(false); - } else if (cancel == sender) { - saveStateOnUnload = false; - goChange(); - } - } - - @Override - public void notifyDraftDelta(int delta) { - } - - @Override - public void remove(CommentEditorPanel editor) { - commentEditors.remove(editor); - - // The editor should be embedded into a panel holding all - // editors for the same file. - // - FlowPanel parent = (FlowPanel) editor.getParent(); - parent.remove(editor); - - // If the panel now holds no editors, remove it. - // - int editorCount = 0; - for (Widget w : parent) { - if (w instanceof CommentEditorPanel) { - editorCount++; - } - } - if (editorCount == 0) { - parent.removeFromParent(); - } - - // If that was the last file with a draft, remove the heading. - // - if (draftsPanel.getWidgetCount() == 1) { - draftsPanel.clear(); - } - } - - private void initMessage(final Panel body) { - body.add(new SmallHeading(Util.C.headingCoverMessage())); - - final VerticalPanel mwrap = new VerticalPanel(); - mwrap.setStyleName(Gerrit.RESOURCES.css().coverMessage()); - body.add(mwrap); - - message = new NpTextArea(); - message.setCharacterWidth(60); - message.setVisibleLines(10); - message.setSpellCheck(true); - mwrap.add(message); - } - - private void initApprovals(Panel body) { - for (String labelName : change.labels()) { - initLabel(labelName, body); - } - } - - private void initLabel(String labelName, Panel body) { - if (!change.has_permitted_labels()) { - return; - } - JsArrayString nativeValues = change.permitted_values(labelName); - if (nativeValues == null || nativeValues.length() == 0) { - return; - } - List values = new ArrayList<>(nativeValues.length()); - for (int i = 0; i < nativeValues.length(); i++) { - values.add(nativeValues.get(i)); - } - Collections.reverse(values); - LabelInfo label = change.label(labelName); - - body.add(new SmallHeading(label.name() + ":")); - - VerticalPanel vp = new VerticalPanel(); - vp.setStyleName(Gerrit.RESOURCES.css().labelList()); - - Short prior = null; - if (label.all() != null) { - for (ApprovalInfo app : Natives.asList(label.all())) { - if (app._account_id() == Gerrit.getUserAccount().getId().get()) { - prior = app.value(); - break; - } - } - } - - for (String value : values) { - ValueRadioButton b = new ValueRadioButton(label, value); - SafeHtml buf = new SafeHtmlBuilder().append(b.format()); - buf = commentLinkProcessor.apply(buf); - SafeHtml.set(b, buf); - - if (lastState != null && patchSetId.equals(lastState.patchSetId) - && lastState.approvals.containsKey(label.name())) { - b.setValue(lastState.approvals.get(label.name()).equals(value)); - } else { - b.setValue(b.parseValue() == (prior != null ? prior : 0)); - } - - approvalButtons.add(b); - vp.add(b); - } - body.add(vp); - } - - private void displayScreen() { - ChangeDetail r = ChangeDetailCache.reverse(detail); - - setPageTitle(Util.M.publishComments(r.getChange().getKey().abbreviate(), - patchSetId.get())); - descBlock.display(r, null, false, r.getCurrentPatchSetDetail().getInfo(), - r.getAccounts(), submitTypeRecord, commentLinkProcessor); - - if (r.getChange().getStatus().isOpen()) { - initApprovals(approvalPanel); - approvals.display(change); - } else { - approvals.setVisible(false); - } - - if (lastState != null && patchSetId.equals(lastState.patchSetId)) { - message.setText(lastState.message); - } - - draftsPanel.clear(); - commentEditors = new ArrayList<>(); - - if (!drafts.isEmpty()) { - draftsPanel.add(new SmallHeading(Util.C.headingPatchComments())); - - Panel panel = null; - String priorFile = ""; - for (final PatchLineComment c : draftList()) { - final Patch.Key patchKey = c.getKey().getParentKey(); - final String fn = patchKey.get(); - if (!fn.equals(priorFile)) { - panel = new FlowPanel(); - panel.addStyleName(Gerrit.RESOURCES.css().patchComments()); - draftsPanel.add(panel); - // Parent table can be null here since we are not showing any - // next/previous links - panel.add(new PatchLink.SideBySide( - PatchTable.getDisplayFileName(patchKey), null, patchKey, 0, null, null)); - priorFile = fn; - } - - final CommentEditorPanel editor = - new CommentEditorPanel(c, commentLinkProcessor); - if (c.getLine() == AbstractPatchContentTable.R_HEAD) { - editor.setAuthorNameText(Gerrit.getUserAccountInfo(), - Util.C.fileCommentHeader()); - } else { - editor.setAuthorNameText(Gerrit.getUserAccountInfo(), - Util.M.lineHeader(c.getLine())); - } - editor.setOpen(true); - commentEditors.add(editor); - panel.add(editor); - } - } - } - - private void onSend(final boolean submit) { - if (commentEditors.isEmpty()) { - onSend2(submit); - } else { - final GerritCallback afterSaveDraft = - new GerritCallback() { - private int done; - - @Override - public void onSuccess(final VoidResult result) { - if (++done == commentEditors.size()) { - onSend2(submit); - } - } - }; - for (final CommentEditorPanel p : commentEditors) { - p.saveDraft(afterSaveDraft); - } - } - } - - private void onSend2(final boolean submit) { - ReviewInput data = ReviewInput.create(); - data.message(ChangeApi.emptyToNull(message.getText().trim())); - for (final ValueRadioButton b : approvalButtons) { - if (b.getValue()) { - data.label(b.label.name(), b.parseValue()); - } - } - - enableForm(false); - new RestApi("/changes/") - .id(String.valueOf(patchSetId.getParentKey().get())) - .view("revisions").id(patchSetId.get()).view("review") - .post(data, new GerritCallback() { - @Override - public void onSuccess(ReviewInput result) { - if (submit) { - submit(); - } else { - saveStateOnUnload = false; - goChange(); - } - } - - @Override - public void onFailure(Throwable caught) { - super.onFailure(caught); - enableForm(true); - } - }); - } - - private void submit() { - ChangeApi.submit( - patchSetId.getParentKey().get(), - "" + patchSetId.get(), - new GerritCallback() { - @Override - public void onSuccess(SubmitInfo result) { - saveStateOnUnload = false; - goChange(); - } - - @Override - public void onFailure(Throwable err) { - if (SubmitFailureDialog.isConflict(err)) { - new SubmitFailureDialog(err.getMessage()).center(); - } else { - super.onFailure(err); - } - goChange(); - } - }); - } - - private void goChange() { - final Change.Id ck = patchSetId.getParentKey(); - Gerrit.display(PageLinks.toChange(ck), new ChangeScreen(ck)); - } - - private List draftList() { - List d = new ArrayList<>(); - List paths = new ArrayList<>(drafts.keySet()); - Collections.sort(paths); - for (String path : paths) { - JsArray comments = drafts.get(path); - for (int i = 0; i < comments.length(); i++) { - d.add(CommentEditorPanel.toComment(patchSetId, path, comments.get(i))); - } - } - return d; - } - - private static class ValueRadioButton extends RadioButton { - final LabelInfo label; - final String value; - - ValueRadioButton(LabelInfo label, String value) { - super(label.name()); - this.label = label; - this.value = value; - } - - String format() { - return new StringBuilder().append(value).append(' ') - .append(label.value_text(value)).toString(); - } - - short parseValue() { - String value = this.value; - if (value.startsWith(" ") || value.startsWith("+")) { - value = value.substring(1); - } - return Short.parseShort(value); - } - } - - private static class SavedState { - final PatchSet.Id patchSetId; - final String message; - final Map approvals; - - SavedState(final PublishCommentScreen p) { - patchSetId = p.patchSetId; - message = p.message.getText(); - approvals = new HashMap<>(); - for (final ValueRadioButton b : p.approvalButtons) { - if (b.getValue()) { - approvals.put(b.label.name(), b.value); - } - } - } - } -} diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/Util.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/Util.java index 9c16330c0e..d34492c77c 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/Util.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/Util.java @@ -14,27 +14,17 @@ package com.google.gerrit.client.changes; -import com.google.gerrit.common.data.ChangeDetailService; import com.google.gerrit.reviewdb.client.Change; import com.google.gwt.core.client.GWT; -import com.google.gwtjsonrpc.client.JsonUtil; public class Util { public static final ChangeConstants C = GWT.create(ChangeConstants.class); public static final ChangeMessages M = GWT.create(ChangeMessages.class); - public static final ChangeResources R = GWT.create(ChangeResources.class); - - public static final ChangeDetailService DETAIL_SVC; private static final int SUBJECT_MAX_LENGTH = 80; private static final String SUBJECT_CROP_APPENDIX = "..."; private static final int SUBJECT_CROP_RANGE = 10; - static { - DETAIL_SVC = GWT.create(ChangeDetailService.class); - JsonUtil.bind(DETAIL_SVC, "rpc/ChangeDetailService"); - } - public static String toLongString(final Change.Status status) { if (status == null) { return ""; diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/removeReviewerNormal.png b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/removeReviewerNormal.png deleted file mode 100644 index 9fde3fa5210d1ec4c6a8e72cd306767e264c35b3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 313 zcmV-90mlA`P)Dt=bkdTn@@bLNh`QF~%fPPl@9*#O^77>5!0007XQchF2KrBCFLTI1Vi4>#7iWs*)=<$)*xYN(cTEPFil^g?9VaGDaHm3FUEq-F diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/removeReviewerPressed.png b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/removeReviewerPressed.png deleted file mode 100644 index e46f0aa63dcb79277f2e8f6ec45947724c5a948c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 430 zcmV;f0a5;mP)C^qLP@su&}U#h^f!d&%VCC)z#ISnwr1AzpJaOuCA`i%F4I5 zw{v-xiIB2MRi2oi#Ya?|hmEg5ONw}YoKIb>sHmuxox)34qubltsi~>W&CQ~sqD@<; zo12^7-rhw~l|oLCgoK2lp`pFKy|%Wtqobpyrlz^Mxp;k>pP!$kq@;Fyn!LQcfq{Xl zs;afMwUL;-#Kgp>r>C;AvaheNz`($|y1LNN(8tHexVX5%!NHc6mRqthX#fBK0(4SN zQ-C;S67B5(005FnL_t(|UR}>c&I3UVgi)uvhnYFd%>3j150%nrltn&SCB3DoMdBSm zM{C$*O^L*;47zo}YAZv3UtD zuAGNa6mtGNfoo5f+7eD@4tUU&fnu5%&jpQ3QFTyNNDt69<56AwtqP+4Pp|3kpFUoA Y0d2ky!c|0`F8}}l07*qoM6N<$f@zJ|tpET3 diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/gerrit.css b/gerrit-gwtui/src/main/java/com/google/gerrit/client/gerrit.css index 1c4829ce77..a9082e2aec 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/gerrit.css +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/gerrit.css @@ -979,13 +979,6 @@ a:hover { border-right: 1px solid trimColor; } -.sideBySideTableBinaryHeader { - border-left: thin solid #b0bdcc; - width: 100%; - color: grey; - font-weight: bold; -} - .infoTable td.approvalrole { width: 5em; border-left: none; @@ -1243,17 +1236,6 @@ a:hover.downloadLink { display: table; } -/** SideBySideScreen **/ -.sideBySideScreenSideBySideTable { - width: 100%; - border: 1px solid #B0BDCC; - display: table; -} - -.sideBySideScreenSideBySideTable .fileLine { - width: 50%; -} - .sideBySideScreenLinkTable { width: 100%; } diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/AbstractPatchContentTable.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/AbstractPatchContentTable.java index cc370758bf..c03d4c3442 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/AbstractPatchContentTable.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/AbstractPatchContentTable.java @@ -14,14 +14,12 @@ package com.google.gerrit.client.patches; -import com.google.gerrit.client.Dispatcher; import com.google.gerrit.client.FormatUtil; import com.google.gerrit.client.Gerrit; import com.google.gerrit.client.account.AccountInfo; import com.google.gerrit.client.changes.CommentApi; import com.google.gerrit.client.changes.CommentInfo; import com.google.gerrit.client.changes.PatchTable; -import com.google.gerrit.client.changes.Util; import com.google.gerrit.client.rpc.GerritCallback; import com.google.gerrit.client.ui.CommentLinkProcessor; import com.google.gerrit.client.ui.CommentPanel; @@ -72,7 +70,7 @@ import java.sql.Timestamp; import java.util.ArrayList; import java.util.List; -public abstract class AbstractPatchContentTable extends NavigationTable +abstract class AbstractPatchContentTable extends NavigationTable implements CommentEditorContainer, FocusHandler, BlurHandler { public static final int R_HEAD = 0; static final short FILE_SIDE_A = (short) 0; @@ -110,8 +108,6 @@ public abstract class AbstractPatchContentTable extends NavigationTable if (Gerrit.isSignedIn()) { keysAction.add(new InsertCommentCommand(0, 'c', PatchUtil.C .commentInsert())); - keysAction.add(new PublishCommentsKeyCommand(0, 'r', Util.C - .keyPublishComments())); // See CommentEditorPanel // @@ -131,11 +127,8 @@ public abstract class AbstractPatchContentTable extends NavigationTable abstract void createFileCommentEditorOnSideB(); - abstract PatchScreen.Type getPatchScreenType(); - protected void initHeaders(PatchScript script, PatchSetDetail detail) { - PatchScreen.Type type = getPatchScreenType(); - headerSideA = new PatchSetSelectBox(PatchSetSelectBox.Side.A, type); + headerSideA = new PatchSetSelectBox(PatchSetSelectBox.Side.A); headerSideA.display(detail, script, patchKey, idSideA, idSideB); headerSideA.addDoubleClickHandler(new DoubleClickHandler() { @Override @@ -145,7 +138,7 @@ public abstract class AbstractPatchContentTable extends NavigationTable } } }); - headerSideB = new PatchSetSelectBox(PatchSetSelectBox.Side.B, type); + headerSideB = new PatchSetSelectBox(PatchSetSelectBox.Side.B); headerSideB.display(detail, script, patchKey, idSideA, idSideB); headerSideB.addDoubleClickHandler(new DoubleClickHandler() { @Override @@ -838,18 +831,6 @@ public abstract class AbstractPatchContentTable extends NavigationTable } } - public class PublishCommentsKeyCommand extends NeedsSignInKeyCommand { - public PublishCommentsKeyCommand(int mask, char key, String help) { - super(mask, key, help); - } - - @Override - public void onKeyPress(final KeyPressEvent event) { - final PatchSet.Id id = patchKey.getParentKey(); - Gerrit.display(Dispatcher.toPublish(id)); - } - } - public class PrevChunkKeyCmd extends KeyCommand { public PrevChunkKeyCmd(int mask, int key, String help) { super(mask, key, help); diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/HistoryTable.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/HistoryTable.java index 6875a96a0b..c4fc1b056b 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/HistoryTable.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/HistoryTable.java @@ -33,10 +33,10 @@ import java.util.List; * A table used to specify which two patch sets should be diff'ed. */ class HistoryTable extends FancyFlexTable { - private final PatchScreen screen; + private final UnifiedPatchScreen screen; final List all = new ArrayList<>(); - HistoryTable(final PatchScreen parent) { + HistoryTable(final UnifiedPatchScreen parent) { setStyleName(Gerrit.RESOURCES.css().patchHistoryTable()); screen = parent; table.setWidth("auto"); @@ -58,14 +58,7 @@ class HistoryTable extends FancyFlexTable { } enableAll(false); Patch.Key k = new Patch.Key(sideB, screen.getPatchKey().get()); - switch (screen.getPatchScreenType()) { - case SIDE_BY_SIDE: - Gerrit.display(Dispatcher.toPatchSideBySide(sideA, k)); - break; - case UNIFIED: - Gerrit.display(Dispatcher.toPatchUnified(sideA, k)); - break; - } + Gerrit.display(Dispatcher.toUnified(sideA, k)); } void enableAll(final boolean on) { diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/NavLinks.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/NavLinks.java index f908c79234..74b714ffa7 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/NavLinks.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/NavLinks.java @@ -75,11 +75,11 @@ class NavLinks extends Composite { table.setWidget(0, 1, up); } - void display(int patchIndex, PatchScreen.Type type, PatchTable fileList, + void display(int patchIndex, PatchTable fileList, List links, List webLinks) { if (fileList != null) { - setupNav(Nav.PREV, fileList.getPreviousPatchLink(patchIndex, type)); - setupNav(Nav.NEXT, fileList.getNextPatchLink(patchIndex, type)); + setupNav(Nav.PREV, fileList.getPreviousPatchLink(patchIndex)); + setupNav(Nav.NEXT, fileList.getNextPatchLink(patchIndex)); } else { setupNav(Nav.PREV, null); setupNav(Nav.NEXT, null); diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchSetSelectBox.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchSetSelectBox.java index 083820b330..7b3a20e3af 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchSetSelectBox.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchSetSelectBox.java @@ -41,18 +41,13 @@ import java.util.HashMap; import java.util.Map; public class PatchSetSelectBox extends Composite { - interface Binder extends UiBinder { - } - + interface Binder extends UiBinder {} private static final Binder uiBinder = GWT.create(Binder.class); interface BoxStyle extends CssResource { String selected(); - String hidden(); - String sideMarker(); - String patchSetLabel(); } @@ -66,7 +61,6 @@ public class PatchSetSelectBox extends Composite { PatchSet.Id idSideB; PatchSet.Id idActive; Side side; - PatchScreen.Type screenType; Map links; private Label patchSet; @@ -76,9 +70,8 @@ public class PatchSetSelectBox extends Composite { @UiField BoxStyle style; - public PatchSetSelectBox(Side side, final PatchScreen.Type type) { + public PatchSetSelectBox(Side side) { this.side = side; - this.screenType = type; initWidget(uiBinder.createAndBindUi(this)); } @@ -102,11 +95,9 @@ public class PatchSetSelectBox extends Composite { patchSet.addStyleName(style.patchSetLabel()); linkPanel.add(patchSet); - if (screenType == PatchScreen.Type.UNIFIED) { - Label sideMarker = new Label((side == Side.A) ? "(-)" : "(+)"); - sideMarker.addStyleName(style.sideMarker()); - linkPanel.add(sideMarker); - } + Label sideMarker = new Label((side == Side.A) ? "(-)" : "(+)"); + sideMarker.addStyleName(style.sideMarker()); + linkPanel.add(sideMarker); Anchor baseLink; if (detail.getInfo().getParents().size() > 1) { @@ -116,9 +107,7 @@ public class PatchSetSelectBox extends Composite { } links.put(0, baseLink); - if (screenType == PatchScreen.Type.UNIFIED || side == Side.A) { - linkPanel.add(baseLink); - } + linkPanel.add(baseLink); if (side == Side.B) { links.get(0).setStyleName(style.hidden()); @@ -161,19 +150,9 @@ public class PatchSetSelectBox extends Composite { } Patch.Key keySideB = new Patch.Key(idSideB, patchKey.get()); - - switch (screenType) { - case SIDE_BY_SIDE: - Gerrit.display(Dispatcher.toPatchSideBySide(idSideA, keySideB)); - break; - case UNIFIED: - Gerrit.display(Dispatcher.toPatchUnified(idSideA, keySideB)); - break; - } + Gerrit.display(Dispatcher.toUnified(idSideA, keySideB)); } - }); - return anchor; } diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchUtil.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchUtil.java index 709685f795..e9491948e8 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchUtil.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchUtil.java @@ -14,6 +14,7 @@ package com.google.gerrit.client.patches; +import com.google.gerrit.common.data.ChangeDetailService; import com.google.gerrit.common.data.PatchDetailService; import com.google.gwt.core.client.GWT; import com.google.gwtjsonrpc.client.JsonUtil; @@ -21,10 +22,14 @@ import com.google.gwtjsonrpc.client.JsonUtil; public class PatchUtil { public static final PatchConstants C = GWT.create(PatchConstants.class); public static final PatchMessages M = GWT.create(PatchMessages.class); - public static final PatchDetailService DETAIL_SVC; + public static final ChangeDetailService CHANGE_SVC; + public static final PatchDetailService PATCH_SVC; static { - DETAIL_SVC = GWT.create(PatchDetailService.class); - JsonUtil.bind(DETAIL_SVC, "rpc/PatchDetailService"); + CHANGE_SVC = GWT.create(ChangeDetailService.class); + JsonUtil.bind(CHANGE_SVC, "rpc/ChangeDetailService"); + + PATCH_SVC = GWT.create(PatchDetailService.class); + JsonUtil.bind(PATCH_SVC, "rpc/PatchDetailService"); } } diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/ReviewedPanels.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/ReviewedPanels.java index b445fca144..7665b73a06 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/ReviewedPanels.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/ReviewedPanels.java @@ -52,11 +52,10 @@ public class ReviewedPanels { this.bottom.setStyleName(Gerrit.RESOURCES.css().reviewedPanelBottom()); } - public void populate(Patch.Key pk, PatchTable pt, int patchIndex, - PatchScreen.Type patchScreenType) { + public void populate(Patch.Key pk, PatchTable pt, int patchIndex) { patchKey = pk; fileList = pt; - reviewedLink = createReviewedLink(patchIndex, patchScreenType); + reviewedLink = createReviewedLink(patchIndex); top.clear(); checkBoxTop = createReviewedCheckbox(); @@ -132,8 +131,7 @@ public class ReviewedPanels { } } - private InlineHyperlink createReviewedLink(final int patchIndex, - final PatchScreen.Type patchScreenType) { + private InlineHyperlink createReviewedLink(final int patchIndex) { final PatchValidator unreviewedValidator = new PatchValidator() { @Override public boolean isValid(Patch patch) { @@ -150,8 +148,7 @@ public class ReviewedPanels { if (nextUnreviewedPatchIndex > -1) { // Create invisible patch link to change page reviewedLink = - fileList.createLink(nextUnreviewedPatchIndex, patchScreenType, - null, null); + fileList.createLink(nextUnreviewedPatchIndex, null, null); reviewedLink.setText(""); } } diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/SideBySideTable.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/SideBySideTable.java deleted file mode 100644 index 8835904220..0000000000 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/SideBySideTable.java +++ /dev/null @@ -1,684 +0,0 @@ -// Copyright (C) 2008 The Android Open Source Project -// -// 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 static com.google.gerrit.client.patches.PatchLine.Type.CONTEXT; -import static com.google.gerrit.client.patches.PatchLine.Type.DELETE; -import static com.google.gerrit.client.patches.PatchLine.Type.INSERT; -import static com.google.gerrit.client.patches.PatchLine.Type.REPLACE; - -import com.google.gerrit.client.Gerrit; -import com.google.gerrit.common.data.CommentDetail; -import com.google.gerrit.common.data.PatchScript; -import com.google.gerrit.common.data.PatchScript.DisplayMethod; -import com.google.gerrit.common.data.PatchScript.FileMode; -import com.google.gerrit.common.data.PatchSetDetail; -import com.google.gerrit.prettify.client.SparseHtmlFile; -import com.google.gerrit.prettify.common.EditList; -import com.google.gerrit.reviewdb.client.PatchLineComment; -import com.google.gwt.dom.client.Element; -import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.event.dom.client.ClickHandler; -import com.google.gwt.user.client.DOM; -import com.google.gwt.user.client.Event; -import com.google.gwt.user.client.ui.Anchor; -import com.google.gwt.user.client.ui.FlowPanel; -import com.google.gwt.user.client.ui.HTMLTable.CellFormatter; -import com.google.gwt.user.client.ui.HasVerticalAlignment; -import com.google.gwt.user.client.ui.InlineLabel; -import com.google.gwt.user.client.ui.UIObject; -import com.google.gwtexpui.safehtml.client.SafeHtml; -import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder; - -import org.eclipse.jgit.diff.Edit; - -import java.util.ArrayList; -import java.util.Iterator; - -public class SideBySideTable extends AbstractPatchContentTable { - private static final int A = 2; - private static final int B = 3; - private static final int NUM_ROWS_TO_EXPAND = 10; - - private SparseHtmlFile a; - private SparseHtmlFile b; - private boolean isHugeFile; - protected boolean isFileCommentBorderRowExist; - - @Override - protected void createFileCommentEditorOnSideA() { - createCommentEditor(R_HEAD + 1, A, R_HEAD, FILE_SIDE_A); - } - - @Override - protected void createFileCommentEditorOnSideB() { - createCommentEditor(R_HEAD + 1, B, R_HEAD, FILE_SIDE_B); - } - - @Override - protected void onCellDoubleClick(final int row, int column) { - if (column > C_ARROW && getRowItem(row) instanceof PatchLine) { - final PatchLine line = (PatchLine) getRowItem(row); - if (column == 1 || column == A) { - createCommentEditor(row + 1, A, line.getLineA(), (short) 0); - } else if (column == B || column == 4) { - createCommentEditor(row + 1, B, line.getLineB(), (short) 1); - } - } - } - - @Override - protected void onCellSingleClick(Event event, int row, int column) { - super.onCellSingleClick(event, row, column); - if (column == 1 || column == 4) { - onCellDoubleClick(row, column); - } - } - - @Override - protected void onInsertComment(final PatchLine line) { - final int row = getCurrentRow(); - createCommentEditor(row + 1, B, line.getLineB(), (short) 1); - } - - @Override - protected void render(final PatchScript script, final PatchSetDetail detail) { - final ArrayList lines = new ArrayList<>(); - final SafeHtmlBuilder nc = new SafeHtmlBuilder(); - isHugeFile = script.isHugeFile(); - allocateTableHeader(nc); - lines.add(null); - if (!isDisplayBinary) { - if (script.getFileModeA() != FileMode.FILE - || script.getFileModeB() != FileMode.FILE) { - openLine(nc); - appendModeLine(nc, script.getFileModeA()); - appendModeLine(nc, script.getFileModeB()); - closeLine(nc); - lines.add(null); - } - - if (hasDifferences(script)) { - int lastA = 0; - int lastB = 0; - final boolean ignoreWS = script.isIgnoreWhitespace(); - a = getSparseHtmlFileA(script); - b = getSparseHtmlFileB(script); - final boolean intraline = - script.getDiffPrefs().isIntralineDifference() - && script.hasIntralineDifference(); - for (final EditList.Hunk hunk : script.getHunks()) { - if (!hunk.isStartOfFile()) { - appendSkipLine(nc); - lines.add(new SkippedLine(lastA, lastB, hunk.getCurB() - lastB)); - } - - while (hunk.next()) { - if (hunk.isContextLine()) { - openLine(nc); - final SafeHtml ctx = a.getSafeHtmlLine(hunk.getCurA()); - appendLineNumber(nc, hunk.getCurA(), false); - appendLineText(nc, CONTEXT, ctx, false, false); - if (ignoreWS && b.contains(hunk.getCurB())) { - appendLineText(nc, CONTEXT, b, hunk.getCurB(), false); - } else { - appendLineText(nc, CONTEXT, ctx, false, false); - } - appendLineNumber(nc, hunk.getCurB(), true); - closeLine(nc); - hunk.incBoth(); - lines.add(new PatchLine(CONTEXT, hunk.getCurA(), hunk.getCurB())); - - } else if (hunk.isModifiedLine()) { - final boolean del = hunk.isDeletedA(); - final boolean ins = hunk.isInsertedB(); - final boolean full = - intraline && hunk.getCurEdit().getType() != Edit.Type.REPLACE; - openLine(nc); - - if (del) { - appendLineNumber(nc, hunk.getCurA(), false); - appendLineText(nc, DELETE, a, hunk.getCurA(), full); - hunk.incA(); - } else if (hunk.getCurEdit().getType() == Edit.Type.REPLACE) { - appendLineNumber(nc, false); - appendLineNone(nc, DELETE); - } else { - appendLineNumber(nc, false); - appendLineNone(nc, CONTEXT); - } - - if (ins) { - appendLineText(nc, INSERT, b, hunk.getCurB(), full); - appendLineNumber(nc, hunk.getCurB(), true); - hunk.incB(); - } else if (hunk.getCurEdit().getType() == Edit.Type.REPLACE) { - appendLineNone(nc, INSERT); - appendLineNumber(nc, true); - } else { - appendLineNone(nc, CONTEXT); - appendLineNumber(nc, true); - } - - closeLine(nc); - - if (del && ins) { - lines.add(new PatchLine(REPLACE, hunk.getCurA(), hunk.getCurB())); - } else if (del) { - lines.add(new PatchLine(DELETE, hunk.getCurA(), -1)); - } else if (ins) { - lines.add(new PatchLine(INSERT, -1, hunk.getCurB())); - } - } - } - lastA = hunk.getCurA(); - lastB = hunk.getCurB(); - } - if (lastB != b.size()) { - appendSkipLine(nc); - lines.add(new SkippedLine(lastA, lastB, b.size() - lastB)); - } - } - } else { - // Display the patch header for binary - for (final String line : script.getPatchHeader()) { - appendFileHeader(nc, line); - } - // If there is a safe picture involved, we show it - if (script.getDisplayMethodA() == DisplayMethod.IMG - || script.getDisplayMethodB() == DisplayMethod.IMG) { - appendImageLine(script, nc); - } - } - if (!hasDifferences(script)) { - appendNoDifferences(nc); - } - resetHtml(nc); - populateTableHeader(script, detail); - if (hasDifferences(script)) { - initScript(script); - if (!isDisplayBinary) { - for (int row = 0; row < lines.size(); row++) { - setRowItem(row, lines.get(row)); - if (lines.get(row) instanceof SkippedLine) { - createSkipLine(row, (SkippedLine) lines.get(row), isHugeFile); - } - } - } - } - } - - private SafeHtml createImage(String url) { - SafeHtmlBuilder m = new SafeHtmlBuilder(); - m.openElement("img"); - m.setAttribute("src", url); - m.closeElement("img"); - return m.toSafeHtml(); - } - - private void appendImageLine(final PatchScript script, - final SafeHtmlBuilder m) { - m.openTr(); - m.setAttribute("valign", "center"); - m.setAttribute("align", "center"); - - m.openTd(); - m.setStyleName(Gerrit.RESOURCES.css().iconCell()); - m.closeTd(); - - appendLineNumber(m, false); - if (script.getDisplayMethodA() == DisplayMethod.IMG) { - final String url = getUrlA(); - appendLineText(m, DELETE, createImage(url), false, true); - } else { - appendLineNone(m, DELETE); - } - if (script.getDisplayMethodB() == DisplayMethod.IMG) { - final String url = getUrlB(); - appendLineText(m, INSERT, createImage(url), false, true); - } else { - appendLineNone(m, INSERT); - } - - appendLineNumber(m, true); - m.closeTr(); - } - - private void populateTableHeader(final PatchScript script, - final PatchSetDetail detail) { - initHeaders(script, detail); - table.setWidget(R_HEAD, A, headerSideA); - table.setWidget(R_HEAD, B, headerSideB); - - // Populate icons to lineNumber column header. - if (headerSideA.isFileOrCommitMessage()) { - table.setWidget(R_HEAD, A - 1, iconA); - } - if (headerSideB.isFileOrCommitMessage()) { - table.setWidget(R_HEAD, B + 1, iconB); - } - } - - private void appendModeLine(final SafeHtmlBuilder nc, final FileMode mode) { - nc.openTd(); - nc.setStyleName(Gerrit.RESOURCES.css().lineNumber()); - nc.nbsp(); - nc.closeTd(); - - nc.openTd(); - nc.addStyleName(Gerrit.RESOURCES.css().fileLine()); - nc.addStyleName(Gerrit.RESOURCES.css().fileLineMode()); - switch(mode){ - case FILE: - nc.nbsp(); - break; - case SYMLINK: - nc.append(PatchUtil.C.fileTypeSymlink()); - break; - case GITLINK: - nc.append(PatchUtil.C.fileTypeGitlink()); - break; - } - nc.closeTd(); - } - - @Override - protected PatchScreen.Type getPatchScreenType() { - return PatchScreen.Type.SIDE_BY_SIDE; - } - - @Override - public void display(final CommentDetail cd, boolean expandComments) { - if (cd.isEmpty()) { - return; - } - setAccountInfoCache(cd.getAccounts()); - - for (int row = 0; row < table.getRowCount();) { - final Iterator ai; - final Iterator bi; - - if (row == R_HEAD) { - ai = cd.getForA(R_HEAD).iterator(); - bi = cd.getForB(R_HEAD).iterator(); - } else if (getRowItem(row) instanceof PatchLine) { - final PatchLine pLine = (PatchLine) getRowItem(row); - ai = cd.getForA(pLine.getLineA()).iterator(); - bi = cd.getForB(pLine.getLineB()).iterator(); - } else { - row++; - continue; - } - - row++; - while (ai.hasNext() && bi.hasNext()) { - final PatchLineComment ac = ai.next(); - final PatchLineComment bc = bi.next(); - if (ac.getLine() == R_HEAD) { - insertFileCommentRow(row); - } else { - insertRow(row); - } - bindComment(row, A, ac, !ai.hasNext()); - bindComment(row, B, bc, !bi.hasNext()); - row++; - } - - row = finish(ai, row, A); - row = finish(bi, row, B); - } - } - - private void defaultStyle(final int row, final CellFormatter fmt) { - fmt.addStyleName(row, A - 1, Gerrit.RESOURCES.css().lineNumber()); - fmt.addStyleName(row, A, Gerrit.RESOURCES.css().diffText()); - if (isDisplayBinary) { - fmt.addStyleName(row, A, Gerrit.RESOURCES.css().diffTextForBinaryInSideBySide()); - } - fmt.addStyleName(row, B, Gerrit.RESOURCES.css().diffText()); - fmt.addStyleName(row, B + 1, Gerrit.RESOURCES.css().lineNumber()); - fmt.addStyleName(row, B + 1, Gerrit.RESOURCES.css().rightmost()); - } - - @Override - protected void insertRow(final int row) { - super.insertRow(row); - final CellFormatter fmt = table.getCellFormatter(); - defaultStyle(row, fmt); - } - - @Override - protected void insertFileCommentRow(final int row) { - table.insertRow(row); - final CellFormatter fmt = table.getCellFormatter(); - fmt.addStyleName(row, C_ARROW, Gerrit.RESOURCES.css().iconCellOfFileCommentRow()); - defaultStyle(row, fmt); - - fmt.addStyleName(row, C_ARROW, // - Gerrit.RESOURCES.css().cellsNextToFileComment()); - fmt.addStyleName(row, A - 1, // - Gerrit.RESOURCES.css().cellsNextToFileComment()); - fmt.addStyleName(row, B + 1, // - Gerrit.RESOURCES.css().cellsNextToFileComment()); - createFileCommentBorderRow(row); - } - - private void createFileCommentBorderRow(final int row) { - if (row == 1 && !isFileCommentBorderRowExist) { - isFileCommentBorderRowExist = true; - table.insertRow(R_HEAD + 2); - - final CellFormatter fmt = table.getCellFormatter(); - - fmt.addStyleName(R_HEAD + 2, C_ARROW, // - Gerrit.RESOURCES.css().iconCellOfFileCommentRow()); - defaultStyle(R_HEAD + 2, fmt); - - final Element iconCell = fmt.getElement(R_HEAD + 2, C_ARROW); - UIObject.setStyleName(DOM.getParent(iconCell), Gerrit.RESOURCES.css() - .fileCommentBorder(), true); - } - } - - private int finish(final Iterator i, int row, final int col) { - while (i.hasNext()) { - final PatchLineComment c = i.next(); - if (c.getLine() == R_HEAD) { - insertFileCommentRow(row); - } else { - insertRow(row); - } - bindComment(row, col, c, !i.hasNext()); - row++; - } - return row; - } - - private void allocateTableHeader(final SafeHtmlBuilder m) { - m.openTr(); - - m.openTd(); - m.addStyleName(Gerrit.RESOURCES.css().iconCell()); - m.addStyleName(Gerrit.RESOURCES.css().fileColumnHeader()); - m.closeTd(); - - m.openTd(); - m.setStyleName(Gerrit.RESOURCES.css().lineNumber()); - m.addStyleName(Gerrit.RESOURCES.css().fileColumnHeader()); - m.nbsp(); - m.closeTd(); - - m.openTd(); - m.setStyleName(Gerrit.RESOURCES.css().fileColumnHeader()); - m.addStyleName(Gerrit.RESOURCES.css().fileLine()); - m.closeTd(); - - m.openTd(); - m.setStyleName(Gerrit.RESOURCES.css().fileColumnHeader()); - m.addStyleName(Gerrit.RESOURCES.css().fileLine()); - m.closeTd(); - - m.openTd(); - m.setStyleName(Gerrit.RESOURCES.css().lineNumber()); - m.addStyleName(Gerrit.RESOURCES.css().fileColumnHeader()); - m.addStyleName(Gerrit.RESOURCES.css().rightmost()); - m.closeTd(); - - m.closeTr(); - } - - private void appendFileHeader(final SafeHtmlBuilder m, final String line) { - m.openTr(); - - m.openTd(); - m.addStyleName(Gerrit.RESOURCES.css().iconCell()); - m.closeTd(); - - appendLineNumber(m, false); - - m.openTd(); - m.setStyleName(Gerrit.RESOURCES.css().sideBySideTableBinaryHeader()); - m.setAttribute("colspan", 2); - m.append(line); - m.closeTd(); - - appendLineNumber(m, true); - - m.closeTr(); - } - - private void appendSkipLine(final SafeHtmlBuilder m) { - m.openTr(); - - m.openTd(); - m.setStyleName(Gerrit.RESOURCES.css().iconCell()); - m.addStyleName(Gerrit.RESOURCES.css().skipLine()); - m.closeTd(); - - m.openTd(); - m.setStyleName(Gerrit.RESOURCES.css().skipLine()); - m.setAttribute("colspan", 4); - m.closeTd(); - m.closeTr(); - } - - private ClickHandler expandAllListener = new ClickHandler() { - @Override - public void onClick(ClickEvent event) { - expand(event, 0); - } - }; - - private ClickHandler expandBeforeListener = new ClickHandler() { - @Override - public void onClick(ClickEvent event) { - expand(event, NUM_ROWS_TO_EXPAND); - } - }; - - private ClickHandler expandAfterListener = new ClickHandler() { - @Override - public void onClick(ClickEvent event) { - expand(event, -NUM_ROWS_TO_EXPAND); - } - }; - - private void expand(ClickEvent event, final int numRows) { - int row = table.getCellForEvent(event).getRowIndex(); - if (!(getRowItem(row) instanceof SkippedLine)) { - return; - } - - SkippedLine line = (SkippedLine) getRowItem(row); - int loopTo = numRows; - if (numRows == 0) { - loopTo = line.getSize(); - } else if (numRows < 0) { - loopTo = -numRows; - } - int offset = 0; - if (numRows < 0) { - offset = 1; - } - - CellFormatter fmt = table.getCellFormatter(); - for (int i = 0 + offset; i < loopTo + offset; i++) { - insertRow(row + i); - table.getRowFormatter().setVerticalAlign(row + i, - HasVerticalAlignment.ALIGN_TOP); - int lineA = line.getStartA() + i; - int lineB = line.getStartB() + i; - if (numRows < 0) { - lineA = line.getStartA() + line.getSize() + numRows + i - offset; - lineB = line.getStartB() + line.getSize() + numRows + i - offset; - } - - table.setHTML(row + i, A - 1, "" + (lineA + 1) + ""); - fmt.addStyleName(row + i, A - 1, Gerrit.RESOURCES.css().lineNumber()); - - table.setHTML(row + i, A, a.getSafeHtmlLine(lineA).asString()); - fmt.addStyleName(row + i, A, Gerrit.RESOURCES.css().fileLine()); - fmt.addStyleName(row + i, A, Gerrit.RESOURCES.css().fileLineCONTEXT()); - - table.setHTML(row + i, B, b.getSafeHtmlLine(lineB).asString()); - fmt.addStyleName(row + i, B, Gerrit.RESOURCES.css().fileLine()); - fmt.addStyleName(row + i, B, Gerrit.RESOURCES.css().fileLineCONTEXT()); - - table.setHTML(row + i, B + 1, "" + (lineB + 1) + ""); - fmt.addStyleName(row + i, B + 1, Gerrit.RESOURCES.css().lineNumber()); - - setRowItem(row + i, new PatchLine(CONTEXT, lineA, lineB)); - } - - if (numRows > 0) { - line.incrementStart(numRows); - createSkipLine(row + loopTo, line, isHugeFile); - } else if (numRows < 0) { - line.reduceSize(-numRows); - createSkipLine(row, line, isHugeFile); - } else { - table.removeRow(row + loopTo); - } - } - - private void createSkipLine(int row, SkippedLine line, boolean isHugeFile) { - FlowPanel p = new FlowPanel(); - InlineLabel l1 = new InlineLabel(" " + PatchUtil.C.patchSkipRegionStart() + " "); - InlineLabel l2 = new InlineLabel(" " + PatchUtil.C.patchSkipRegionEnd() + " "); - - Anchor all = new Anchor(String.valueOf(line.getSize())); - all.addClickHandler(expandAllListener); - all.setStyleName(Gerrit.RESOURCES.css().skipLine()); - - if (line.getSize() > 30) { - // Only show the expand before/after if skipped more than 30 lines. - Anchor b = new Anchor(PatchUtil.M.expandBefore(NUM_ROWS_TO_EXPAND), true); - Anchor a = new Anchor(PatchUtil.M.expandAfter(NUM_ROWS_TO_EXPAND), true); - - b.addClickHandler(expandBeforeListener); - a.addClickHandler(expandAfterListener); - - b.setStyleName(Gerrit.RESOURCES.css().skipLine()); - a.setStyleName(Gerrit.RESOURCES.css().skipLine()); - - p.add(b); - p.add(l1); - if (isHugeFile) { - p.add(new InlineLabel(" " + line.getSize() + " ")); - } else { - p.add(all); - } - p.add(l2); - p.add(a); - } else { - p.add(l1); - p.add(all); - p.add(l2); - } - table.setWidget(row, 1, p); - } - - private void openLine(final SafeHtmlBuilder m) { - m.openTr(); - m.setAttribute("valign", "top"); - - m.openTd(); - m.setStyleName(Gerrit.RESOURCES.css().iconCell()); - m.closeTd(); - } - - private void appendLineNumber(SafeHtmlBuilder m, boolean right) { - m.openTd(); - m.setStyleName(Gerrit.RESOURCES.css().lineNumber()); - if (right) { - m.addStyleName(Gerrit.RESOURCES.css().rightmost()); - } - m.closeTd(); - } - - private void appendLineNumber(SafeHtmlBuilder m, int lineNumberMinusOne, boolean right) { - m.openTd(); - m.setStyleName(Gerrit.RESOURCES.css().lineNumber()); - if (right) { - m.addStyleName(Gerrit.RESOURCES.css().rightmost()); - } - m.append(SafeHtml.asis(""+ (lineNumberMinusOne + 1) + "")); - m.closeTd(); - } - - private void appendLineText(final SafeHtmlBuilder m, - final PatchLine.Type type, final SparseHtmlFile src, final int i, - final boolean fullBlock) { - appendLineText(m, type, src.getSafeHtmlLine(i), src.hasTrailingEdit(i), fullBlock); - } - - private void appendLineText(final SafeHtmlBuilder m, - final PatchLine.Type type, final SafeHtml lineHtml, - final boolean trailingEdit, final boolean fullBlock) { - m.openTd(); - m.addStyleName(Gerrit.RESOURCES.css().fileLine()); - switch (type) { - case CONTEXT: - m.addStyleName(Gerrit.RESOURCES.css().fileLineCONTEXT()); - break; - case DELETE: - m.addStyleName(Gerrit.RESOURCES.css().fileLineDELETE()); - if (trailingEdit || fullBlock) { - m.addStyleName("wdd"); - } - break; - case INSERT: - m.addStyleName(Gerrit.RESOURCES.css().fileLineINSERT()); - if (trailingEdit || fullBlock) { - m.addStyleName("wdi"); - } - break; - case REPLACE: - break; - } - m.append(lineHtml); - m.closeTd(); - } - - private void appendLineNone(final SafeHtmlBuilder m, final PatchLine.Type type) { - m.openTd(); - m.addStyleName(Gerrit.RESOURCES.css().fileLine()); - switch (type != null ? type : PatchLine.Type.CONTEXT) { - case DELETE: - m.addStyleName(Gerrit.RESOURCES.css().fileLineDELETE()); - break; - case INSERT: - m.addStyleName(Gerrit.RESOURCES.css().fileLineINSERT()); - break; - default: - m.addStyleName(Gerrit.RESOURCES.css().fileLineNone()); - break; - } - m.closeTd(); - } - - private void closeLine(final SafeHtmlBuilder m) { - m.closeTr(); - } - - @Override - protected void destroyCommentRow(final int row) { - super.destroyCommentRow(row); - if (row == R_HEAD + 1) { - table.removeRow(row); - isFileCommentBorderRowExist = false; - } - } -} diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/UnifiedDiffTable.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/UnifiedDiffTable.java index 2562ce1a25..ebcdf05ede 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/UnifiedDiffTable.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/UnifiedDiffTable.java @@ -420,11 +420,6 @@ public class UnifiedDiffTable extends AbstractPatchContentTable { defaultStyle(row, fmt); } - @Override - protected PatchScreen.Type getPatchScreenType() { - return PatchScreen.Type.UNIFIED; - } - private int insert(final List in, int row) { for (Iterator ci = in.iterator(); ci.hasNext();) { final PatchLineComment c = ci.next(); diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/UnifiedPatchScreen.java similarity index 77% rename from gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchScreen.java rename to gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/UnifiedPatchScreen.java index e333c26e0c..57d8953c96 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchScreen.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/UnifiedPatchScreen.java @@ -21,7 +21,6 @@ import com.google.gerrit.client.RpcStatus; import com.google.gerrit.client.WebLinkInfo; import com.google.gerrit.client.changes.CommitMessageBlock; import com.google.gerrit.client.changes.PatchTable; -import com.google.gerrit.client.changes.Util; import com.google.gerrit.client.diff.DiffApi; import com.google.gerrit.client.diff.DiffInfo; import com.google.gerrit.client.projects.ConfigInfoCache; @@ -55,47 +54,11 @@ import com.google.gwtexpui.globalkey.client.KeyCommandSet; import java.util.Collections; import java.util.List; -public abstract class PatchScreen extends Screen implements +public class UnifiedPatchScreen extends Screen implements CommentEditorContainer { static final PrettyFactory PRETTY = ClientSideFormatter.FACTORY; static final short LARGE_FILE_CONTEXT = 100; - public static class SideBySide extends PatchScreen { - public SideBySide(final Patch.Key id, final int patchIndex, - final PatchSetDetail patchSetDetail, final PatchTable patchTable, - final TopView topView, final PatchSet.Id baseId) { - super(id, patchIndex, patchSetDetail, patchTable, topView, baseId); - } - - @Override - protected SideBySideTable createContentTable() { - return new SideBySideTable(); - } - - @Override - public PatchScreen.Type getPatchScreenType() { - return PatchScreen.Type.SIDE_BY_SIDE; - } - } - - public static class Unified extends PatchScreen { - public Unified(final Patch.Key id, final int patchIndex, - final PatchSetDetail patchSetDetail, final PatchTable patchTable, - final TopView topView, final PatchSet.Id baseId) { - super(id, patchIndex, patchSetDetail, patchTable, topView, baseId); - } - - @Override - protected UnifiedDiffTable createContentTable() { - return new UnifiedDiffTable(); - } - - @Override - public PatchScreen.Type getPatchScreenType() { - return PatchScreen.Type.UNIFIED; - } - } - /** * What should be displayed in the top of the screen */ @@ -116,7 +79,7 @@ public abstract class PatchScreen extends Screen implements private HistoryTable historyTable; private FlowPanel topPanel; private FlowPanel contentPanel; - private AbstractPatchContentTable contentTable; + private UnifiedDiffTable contentTable; private CommitMessageBlock commitMessageBlock; private NavLinks topNav; private NavLinks bottomNav; @@ -137,24 +100,12 @@ public abstract class PatchScreen extends Screen implements private boolean intralineFailure; private boolean intralineTimeout; - /** - * How this patch should be displayed in the patch screen. - */ - public static enum Type { - UNIFIED, SIDE_BY_SIDE - } - - protected PatchScreen(final Patch.Key id, final int patchIndex, - final PatchSetDetail detail, final PatchTable patchTable, - final TopView top, final PatchSet.Id baseId) { + public UnifiedPatchScreen(Patch.Key id, TopView top, PatchSet.Id baseId) { patchKey = id; - patchSetDetail = detail; - fileList = patchTable; topView = top; idSideA = baseId; // null here means we're diff'ing from the Base idSideB = id.getParentKey(); - this.patchIndex = patchIndex; prefs = fileList != null ? fileList.getPreferences() @@ -256,7 +207,7 @@ public abstract class PatchScreen extends Screen implements topPanel = new FlowPanel(); add(topPanel); - contentTable = createContentTable(); + contentTable = new UnifiedDiffTable(); contentTable.fileList = fileList; topNav = new NavLinks(keysNavigation, patchKey.getParentKey()); @@ -264,12 +215,7 @@ public abstract class PatchScreen extends Screen implements add(topNav); contentPanel = new FlowPanel(); - if (getPatchScreenType() == PatchScreen.Type.SIDE_BY_SIDE) { - contentPanel.setStyleName(// - Gerrit.RESOURCES.css().sideBySideScreenSideBySideTable()); - } else { - contentPanel.setStyleName(Gerrit.RESOURCES.css().unifiedTable()); - } + contentPanel.setStyleName(Gerrit.RESOURCES.css().unifiedTable()); contentPanel.add(contentTable); add(contentPanel); @@ -290,61 +236,29 @@ public abstract class PatchScreen extends Screen implements .get(new GerritCallback() { @Override public void onSuccess(DiffInfo diffInfo) { - topNav.display(patchIndex, getPatchScreenType(), fileList, + topNav.display(patchIndex, fileList, getLinks(), getWebLinks(diffInfo)); - bottomNav.display(patchIndex, getPatchScreenType(), fileList, + bottomNav.display(patchIndex, fileList, getLinks(), getWebLinks(diffInfo)); } }); } private List getLinks() { - if (contentTable instanceof SideBySideTable) { - InlineHyperlink toUnifiedDiffLink = new InlineHyperlink(); - toUnifiedDiffLink.setHTML(new ImageResourceRenderer().render(Gerrit.RESOURCES.unifiedDiff())); - toUnifiedDiffLink.setTargetHistoryToken(getUnifiedDiffUrl()); - toUnifiedDiffLink.setTitle(PatchUtil.C.unifiedDiff()); - return Collections.singletonList(toUnifiedDiffLink); - } else if (contentTable instanceof UnifiedDiffTable) { - InlineHyperlink toSideBySideDiffLink = new InlineHyperlink(); - toSideBySideDiffLink.setHTML(new ImageResourceRenderer().render(Gerrit.RESOURCES.sideBySideDiff())); - toSideBySideDiffLink.setTargetHistoryToken(getSideBySideDiffUrl()); - toSideBySideDiffLink.setTitle(PatchUtil.C.sideBySideDiff()); - return Collections.singletonList(toSideBySideDiffLink); - } else { - throw new IllegalStateException("unknown table type: " - + contentTable.getClass().getSimpleName()); - } + InlineHyperlink toSideBySideDiffLink = new InlineHyperlink(); + toSideBySideDiffLink.setHTML(new ImageResourceRenderer().render(Gerrit.RESOURCES.sideBySideDiff())); + toSideBySideDiffLink.setTargetHistoryToken(getSideBySideDiffUrl()); + toSideBySideDiffLink.setTitle(PatchUtil.C.sideBySideDiff()); + return Collections.singletonList(toSideBySideDiffLink); } private List getWebLinks(DiffInfo diffInfo) { - if (contentTable instanceof SideBySideTable) { - return diffInfo.side_by_side_web_links(); - } else if (contentTable instanceof UnifiedDiffTable) { - return diffInfo.unified_web_links(); - } else { - throw new IllegalStateException("unknown table type: " - + contentTable.getClass().getSimpleName()); - } + return diffInfo.unified_web_links(); } private String getSideBySideDiffUrl() { - StringBuilder url = new StringBuilder(); - url.append("/c/"); - url.append(patchKey.getParentKey().getParentKey().get()); - url.append("/"); - if (idSideA != null) { - url.append(idSideA.get()); - url.append(".."); - } - url.append(idSideB.get()); - url.append("/"); - url.append(patchKey.getFileName()); - return url.toString(); - } - - private String getUnifiedDiffUrl() { - return getSideBySideDiffUrl() + ",unified"; + return Dispatcher.toPatch("sidebyside", idSideA, + new Patch.Key(idSideB, patchKey.getFileName())); } @Override @@ -352,7 +266,7 @@ public abstract class PatchScreen extends Screen implements super.onLoad(); if (patchSetDetail == null) { - Util.DETAIL_SVC.patchSetDetail(idSideB, + PatchUtil.CHANGE_SVC.patchSetDetail(idSideB, new GerritCallback() { @Override public void onSuccess(PatchSetDetail result) { @@ -405,10 +319,6 @@ public abstract class PatchScreen extends Screen implements } } - protected abstract AbstractPatchContentTable createContentTable(); - - public abstract PatchScreen.Type getPatchScreenType(); - public PatchSet.Id getSideA() { return idSideA; } @@ -437,7 +347,7 @@ public abstract class PatchScreen extends Screen implements final int rpcseq = ++rpcSequence; lastScript = null; settingsPanel.setEnabled(false); - reviewedPanels.populate(patchKey, fileList, patchIndex, getPatchScreenType()); + reviewedPanels.populate(patchKey, fileList, patchIndex); if (isFirst && fileList != null && fileList.isLoaded()) { fileList.movePointerTo(patchKey); } @@ -457,7 +367,7 @@ public abstract class PatchScreen extends Screen implements // Handled by ScreenLoadCallback.onFailure. } })); - PatchUtil.DETAIL_SVC.patchScript(patchKey, idSideA, idSideB, + PatchUtil.PATCH_SVC.patchScript(patchKey, idSideA, idSideB, settingsPanel.getValue(), cb.addFinal( new ScreenLoadCallback(this) { @Override @@ -494,7 +404,7 @@ public abstract class PatchScreen extends Screen implements commentLinkProcessor); } else { commitMessageBlock.setVisible(false); - Util.DETAIL_SVC.patchSetDetail(idSideB, + PatchUtil.CHANGE_SVC.patchSetDetail(idSideB, new GerritCallback() { @Override public void onSuccess(PatchSetDetail result) { @@ -516,22 +426,6 @@ public abstract class PatchScreen extends Screen implements } } - if (contentTable instanceof SideBySideTable - && contentTable.isPureMetaChange(script) - && !contentTable.isDisplayBinary) { - // User asked for SideBySide (or a link guessed, wrong) and we can't - // show a pure-rename change there accurately. Switch to - // the unified view instead. User can set file comments on binary file - // in SideBySide view. - // - contentTable.removeFromParent(); - contentTable = new UnifiedDiffTable(); - contentTable.fileList = fileList; - contentTable.setCommentLinkProcessor(commentLinkProcessor); - contentPanel.add(contentTable); - setToken(Dispatcher.toPatchUnified(idSideA, patchKey)); - } - if (script.isHugeFile()) { AccountDiffPreference dp = script.getDiffPrefs(); int context = dp.getContext(); @@ -632,7 +526,7 @@ public abstract class PatchScreen extends Screen implements final PatchSet.Id psid = patchKey.getParentKey(); fileList = new PatchTable(prefs); fileList.setSavePointerId("PatchTable " + psid); - Util.DETAIL_SVC.patchSetDetail(psid, + PatchUtil.CHANGE_SVC.patchSetDetail(psid, new GerritCallback() { @Override public void onSuccess(final PatchSetDetail result) { diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ActionDialog.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ActionDialog.java deleted file mode 100644 index 295842cc0d..0000000000 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ActionDialog.java +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (C) 2013 The Android Open Source Project -// -// 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.Gerrit; -import com.google.gerrit.client.changes.ChangeDetailCache; -import com.google.gerrit.common.PageLinks; -import com.google.gerrit.common.data.ChangeDetail; -import com.google.gwt.user.client.ui.FocusWidget; - -public abstract class ActionDialog extends CommentedActionDialog { - public ActionDialog(final FocusWidget enableOnFailure, final boolean redirect, - String dialogTitle, String dialogHeading) { - super(dialogTitle, dialogHeading, new ChangeDetailCache.IgnoreErrorCallback() { - @Override - public void onSuccess(ChangeDetail result) { - if (redirect) { - Gerrit.display(PageLinks.toChange(result.getChange().getId())); - } else { - super.onSuccess(result); - } - } - - @Override - public void onFailure(Throwable caught) { - enableOnFailure.setEnabled(true); - } - }); - } -} \ No newline at end of file diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/CherryPickDialog.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/CherryPickDialog.java index 54c4c53466..3813af2401 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/CherryPickDialog.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/CherryPickDialog.java @@ -23,7 +23,6 @@ import com.google.gerrit.client.rpc.Natives; import com.google.gerrit.reviewdb.client.Project; import com.google.gwt.core.client.JsArray; import com.google.gwt.user.client.ui.FlowPanel; -import com.google.gwt.user.client.ui.FocusWidget; import com.google.gwt.user.client.ui.SuggestBox; import com.google.gwt.user.client.ui.SuggestOracle.Suggestion; import com.google.gwtexpui.globalkey.client.GlobalKey; @@ -32,12 +31,12 @@ import com.google.gwtexpui.safehtml.client.HighlightSuggestOracle; import java.util.LinkedList; import java.util.List; -public abstract class CherryPickDialog extends ActionDialog { +public abstract class CherryPickDialog extends CommentedActionDialog { private SuggestBox newBranch; private List branches; - public CherryPickDialog(final FocusWidget enableOnFailure, Project.NameKey project) { - super(enableOnFailure, true, Util.C.cherryPickTitle(), Util.C + public CherryPickDialog(Project.NameKey project) { + super(Util.C.cherryPickTitle(), Util.C .cherryPickCommitMessage()); ProjectApi.getBranches(project, new GerritCallback>() { diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/CommentedActionDialog.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/CommentedActionDialog.java index 23e110966a..aa32394d29 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/CommentedActionDialog.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/CommentedActionDialog.java @@ -15,7 +15,6 @@ package com.google.gerrit.client.ui; import com.google.gerrit.client.Gerrit; -import com.google.gerrit.client.rpc.GerritCallback; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.logical.shared.CloseEvent; @@ -27,24 +26,20 @@ import com.google.gwt.user.client.ui.PopupPanel; import com.google.gwtexpui.globalkey.client.GlobalKey; import com.google.gwtexpui.globalkey.client.NpTextArea; import com.google.gwtexpui.user.client.AutoCenterDialogBox; -import com.google.gwtjsonrpc.common.AsyncCallback; -public abstract class CommentedActionDialog extends AutoCenterDialogBox +public abstract class CommentedActionDialog extends AutoCenterDialogBox implements CloseHandler { protected final FlowPanel panel; protected final NpTextArea message; protected final Button sendButton; protected final Button cancelButton; protected final FlowPanel buttonPanel; - protected AsyncCallback callback; protected FocusWidget focusOn; protected boolean sent = false; - public CommentedActionDialog(final String title, final String heading, - AsyncCallback callback) { + public CommentedActionDialog(final String title, final String heading) { super(/* auto hide */false, /* modal */true); - this.callback = callback; setGlassEnabled(true); setText(title); @@ -111,13 +106,6 @@ public abstract class CommentedActionDialog extends AutoCenterDialogBox @Override public void onClose(CloseEvent event) { - if (!sent) { - // the dialog was closed without the send button being pressed - // e.g. the user pressed Cancel or ESC to close the dialog - if (callback != null) { - callback.onFailure(null); - } - } sent = false; } @@ -126,23 +114,4 @@ public abstract class CommentedActionDialog extends AutoCenterDialogBox public String getMessageText() { return message.getText().trim(); } - - public AsyncCallback createCallback() { - return new GerritCallback(){ - @Override - public void onSuccess(T result) { - sent = true; - if (callback != null) { - callback.onSuccess(result); - } - hide(); - } - - @Override - public void onFailure(Throwable caught) { - enableButtons(true); - super.onFailure(caught); - } - }; - } } diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/CreateChangeDialog.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/CreateChangeDialog.java index a5155689f4..2b6a866bc2 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/CreateChangeDialog.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/CreateChangeDialog.java @@ -23,7 +23,6 @@ import com.google.gerrit.reviewdb.client.Branch; import com.google.gerrit.reviewdb.client.Project; import com.google.gwt.core.client.JsArray; import com.google.gwt.user.client.ui.FlowPanel; -import com.google.gwt.user.client.ui.FocusWidget; import com.google.gwt.user.client.ui.SuggestBox; import com.google.gwt.user.client.ui.SuggestOracle.Suggestion; import com.google.gwtexpui.globalkey.client.GlobalKey; @@ -32,12 +31,12 @@ import com.google.gwtexpui.safehtml.client.HighlightSuggestOracle; import java.util.ArrayList; import java.util.List; -public abstract class CreateChangeDialog extends ActionDialog { +public abstract class CreateChangeDialog extends CommentedActionDialog { private SuggestBox newChange; private List branches; - public CreateChangeDialog(final FocusWidget enableOnFailure, Project.NameKey project) { - super(enableOnFailure, true, Util.C.dialogCreateChangeTitle(), + public CreateChangeDialog(Project.NameKey project) { + super(Util.C.dialogCreateChangeTitle(), Util.C.dialogCreateChangeHeading()); ProjectApi.getBranches(project, new GerritCallback>() { diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/PatchLink.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/PatchLink.java index f79dc510db..09244c9158 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/PatchLink.java +++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/PatchLink.java @@ -15,90 +15,23 @@ package com.google.gerrit.client.ui; import com.google.gerrit.client.Dispatcher; -import com.google.gerrit.client.changes.PatchTable; -import com.google.gerrit.client.patches.PatchScreen; -import com.google.gerrit.common.data.PatchSetDetail; import com.google.gerrit.reviewdb.client.Patch; import com.google.gerrit.reviewdb.client.PatchSet; public class PatchLink extends InlineHyperlink { - protected PatchSet.Id base; - protected Patch.Key patchKey; - protected int patchIndex; - protected PatchSetDetail patchSetDetail; - protected PatchTable parentPatchTable; - protected PatchScreen.TopView topView; - - /** - * @param text The text of this link - * @param base optional base to compare against. - * @param patchKey The key for this patch - * @param patchIndex The index of the current patch in the patch set - * @param historyToken The history token - * @param patchSetDetail Detailed information about the patch set. - * @param parentPatchTable The table used to display this link - */ - protected PatchLink(String text, PatchSet.Id base, Patch.Key patchKey, - int patchIndex, String historyToken, - PatchSetDetail patchSetDetail, PatchTable parentPatchTable, - PatchScreen.TopView topView) { + private PatchLink(String text, String historyToken) { super(text, historyToken); - this.base = base; - this.patchKey = patchKey; - this.patchIndex = patchIndex; - this.patchSetDetail = patchSetDetail; - this.parentPatchTable = parentPatchTable; - this.parentPatchTable = parentPatchTable; - this.topView = topView; - } - - /** - * @param text The text of this link - * @param type The type of the link to create (unified/side-by-side) - * @param patchScreen The patchScreen to grab contents to link to from - */ - public PatchLink(String text, PatchScreen.Type type, PatchScreen patchScreen) { - this(text, // - patchScreen.getSideA(), // - patchScreen.getPatchKey(), // - patchScreen.getPatchIndex(), // - Dispatcher.toPatch(type, patchScreen.getPatchKey()), // - patchScreen.getPatchSetDetail(), // - patchScreen.getFileList(), // - patchScreen.getTopView() // - ); - } - - @Override - public void go() { - Dispatcher.patch( // - getTargetHistoryToken(), // - base, // - patchKey, // - patchIndex, // - patchSetDetail, // - parentPatchTable, - topView // - ); } public static class SideBySide extends PatchLink { - public SideBySide(String text, PatchSet.Id base, Patch.Key patchKey, - int patchIndex, PatchSetDetail patchSetDetail, - PatchTable parentPatchTable) { - super(text, base, patchKey, patchIndex, - Dispatcher.toPatchSideBySide(base, patchKey), - patchSetDetail, parentPatchTable, null); + public SideBySide(String text, PatchSet.Id base, Patch.Key id) { + super(text, Dispatcher.toSideBySide(base, id)); } } public static class Unified extends PatchLink { - public Unified(String text, PatchSet.Id base, final Patch.Key patchKey, - int patchIndex, PatchSetDetail patchSetDetail, - PatchTable parentPatchTable) { - super(text, base, patchKey, patchIndex, - Dispatcher.toPatchUnified(base, patchKey), - patchSetDetail, parentPatchTable, null); + public Unified(String text, PatchSet.Id base, Patch.Key id) { + super(text, Dispatcher.toUnified(base, id)); } } } diff --git a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/GerritConfigProvider.java b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/GerritConfigProvider.java index b727bc6cdb..eca6e223fe 100644 --- a/gerrit-httpd/src/main/java/com/google/gerrit/httpd/GerritConfigProvider.java +++ b/gerrit-httpd/src/main/java/com/google/gerrit/httpd/GerritConfigProvider.java @@ -21,7 +21,6 @@ import com.google.common.collect.Lists; import com.google.gerrit.common.data.GerritConfig; import com.google.gerrit.common.data.GitwebConfig; import com.google.gerrit.reviewdb.client.Account; -import com.google.gerrit.reviewdb.client.AccountGeneralPreferences; import com.google.gerrit.server.account.Realm; import com.google.gerrit.server.change.ArchiveFormat; import com.google.gerrit.server.change.GetArchive; @@ -133,9 +132,6 @@ class GerritConfigProvider implements Provider { config.setSuggestFrom(cfg.getInt("suggest", "from", 0)); config.setChangeUpdateDelay((int) ConfigUtil.getTimeUnit( cfg, "change", null, "updateDelay", 30, TimeUnit.SECONDS)); - config.setChangeScreen(cfg.getEnum( - "gerrit", null, "changeScreen", - AccountGeneralPreferences.ChangeScreen.CHANGE_SCREEN2)); config.setLargeChangeSize(cfg.getInt("change", "largeChange", 500)); config.setArchiveFormats(Lists.newArrayList(Iterables.transform( archiveFormats.getAllowed(), diff --git a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/client/AccountGeneralPreferences.java b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/client/AccountGeneralPreferences.java index 8947083bae..a0cc2bfb99 100644 --- a/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/client/AccountGeneralPreferences.java +++ b/gerrit-reviewdb/src/main/java/com/google/gerrit/reviewdb/client/AccountGeneralPreferences.java @@ -68,13 +68,6 @@ public final class AccountGeneralPreferences { } } - public static enum CommentVisibilityStrategy { - COLLAPSE_ALL, - EXPAND_MOST_RECENT, - EXPAND_RECENT, - EXPAND_ALL - } - public static enum ReviewCategoryStrategy { NONE, NAME, @@ -88,11 +81,6 @@ public final class AccountGeneralPreferences { UNIFIED_DIFF } - public static enum ChangeScreen { - OLD_UI, - CHANGE_SCREEN2 - } - public static enum TimeFormat { /** 12-hour clock: 1:15 am, 2:13 pm */ HHMM_12("h:mm a"), @@ -147,26 +135,18 @@ public final class AccountGeneralPreferences { @Column(id = 9, length = 10, notNull = false) protected String timeFormat; - /** - * If true display the patch sets in the ChangeScreen in reverse order - * (show latest patch set on top). - */ - @Column(id = 10) - protected boolean reversePatchSetOrder; - + // DELETED: id = 10 (reversePatchSetOrder) // DELETED: id = 11 (showUserInReview) @Column(id = 12) protected boolean relativeDateInChangeTable; - @Column(id = 13, length = 20, notNull = false) - protected String commentVisibilityStrategy; + // DELETED: id = 13 (commentVisibilityStrategy) @Column(id = 14, length = 20, notNull = false) protected String diffView; - @Column(id = 15, length = 20, notNull = false) - protected String changeScreen; + // DELETED: id = 15 (changeScreen) @Column(id = 16) protected boolean sizeBarInChangeTable; @@ -242,14 +222,6 @@ public final class AccountGeneralPreferences { copySelfOnEmail = includeSelfOnEmail; } - public boolean isReversePatchSetOrder() { - return reversePatchSetOrder; - } - - public void setReversePatchSetOrder(final boolean reversePatchSetOrder) { - this.reversePatchSetOrder = reversePatchSetOrder; - } - public boolean isShowInfoInReviewCategory() { return getReviewCategoryStrategy() != ReviewCategoryStrategy.NONE; } @@ -296,18 +268,6 @@ public final class AccountGeneralPreferences { reviewCategoryStrategy = strategy.name(); } - public CommentVisibilityStrategy getCommentVisibilityStrategy() { - if (commentVisibilityStrategy == null) { - return CommentVisibilityStrategy.EXPAND_RECENT; - } - return CommentVisibilityStrategy.valueOf(commentVisibilityStrategy); - } - - public void setCommentVisibilityStrategy( - CommentVisibilityStrategy strategy) { - commentVisibilityStrategy = strategy.name(); - } - public DiffView getDiffView() { if (diffView == null) { return DiffView.SIDE_BY_SIDE; @@ -319,14 +279,6 @@ public final class AccountGeneralPreferences { this.diffView = diffView.name(); } - public ChangeScreen getChangeScreen() { - return changeScreen != null ? ChangeScreen.valueOf(changeScreen) : null; - } - - public void setChangeScreen(ChangeScreen ui) { - changeScreen = ui != null ? ui.name() : null; - } - public boolean isSizeBarInChangeTable() { return sizeBarInChangeTable; } @@ -348,16 +300,13 @@ public final class AccountGeneralPreferences { showSiteHeader = true; useFlashClipboard = true; copySelfOnEmail = false; - reversePatchSetOrder = false; reviewCategoryStrategy = null; downloadUrl = null; downloadCommand = null; dateFormat = null; timeFormat = null; relativeDateInChangeTable = false; - commentVisibilityStrategy = null; diffView = null; - changeScreen = null; sizeBarInChangeTable = true; legacycidInChangeTable = false; } diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/account/GetPreferences.java b/gerrit-server/src/main/java/com/google/gerrit/server/account/GetPreferences.java index 914f1590ac..adb2085891 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/account/GetPreferences.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/account/GetPreferences.java @@ -21,8 +21,6 @@ import com.google.gerrit.extensions.restapi.RestReadView; import com.google.gerrit.extensions.webui.TopMenu; import com.google.gerrit.reviewdb.client.Account; import com.google.gerrit.reviewdb.client.AccountGeneralPreferences; -import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.ChangeScreen; -import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.CommentVisibilityStrategy; import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DateFormat; import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DiffView; import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadCommand; @@ -108,14 +106,11 @@ public class GetPreferences implements RestReadView { Boolean copySelfOnEmail; DateFormat dateFormat; TimeFormat timeFormat; - Boolean reversePatchSetOrder; Boolean relativeDateInChangeTable; Boolean sizeBarInChangeTable; Boolean legacycidInChangeTable; ReviewCategoryStrategy reviewCategoryStrategy; - CommentVisibilityStrategy commentVisibilityStrategy; DiffView diffView; - ChangeScreen changeScreen; List my; public PreferenceInfo(AccountGeneralPreferences p, @@ -129,14 +124,11 @@ public class GetPreferences implements RestReadView { copySelfOnEmail = p.isCopySelfOnEmails() ? true : null; dateFormat = p.getDateFormat(); timeFormat = p.getTimeFormat(); - reversePatchSetOrder = p.isReversePatchSetOrder() ? true : null; relativeDateInChangeTable = p.isRelativeDateInChangeTable() ? true : null; sizeBarInChangeTable = p.isSizeBarInChangeTable() ? true : null; legacycidInChangeTable = p.isLegacycidInChangeTable() ? true : null; reviewCategoryStrategy = p.getReviewCategoryStrategy(); - commentVisibilityStrategy = p.getCommentVisibilityStrategy(); diffView = p.getDiffView(); - changeScreen = p.getChangeScreen(); } my = my(v, allUsers); } diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/account/SetPreferences.java b/gerrit-server/src/main/java/com/google/gerrit/server/account/SetPreferences.java index a5e02d2d2f..08450f37e5 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/account/SetPreferences.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/account/SetPreferences.java @@ -26,8 +26,6 @@ import com.google.gerrit.extensions.restapi.RestModifyView; import com.google.gerrit.extensions.webui.TopMenu; import com.google.gerrit.reviewdb.client.Account; import com.google.gerrit.reviewdb.client.AccountGeneralPreferences; -import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.ChangeScreen; -import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.CommentVisibilityStrategy; import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DateFormat; import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DiffView; import com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadCommand; @@ -62,14 +60,11 @@ public class SetPreferences implements RestModifyView { public Boolean copySelfOnEmail; public DateFormat dateFormat; public TimeFormat timeFormat; - public Boolean reversePatchSetOrder; public Boolean relativeDateInChangeTable; public Boolean sizeBarInChangeTable; public Boolean legacycidInChangeTable; - public CommentVisibilityStrategy commentVisibilityStrategy; public ReviewCategoryStrategy reviewCategoryStrategy; public DiffView diffView; - public ChangeScreen changeScreen; public List my; } @@ -146,9 +141,6 @@ public class SetPreferences implements RestModifyView { if (i.timeFormat != null) { p.setTimeFormat(i.timeFormat); } - if (i.reversePatchSetOrder != null) { - p.setReversePatchSetOrder(i.reversePatchSetOrder); - } if (i.relativeDateInChangeTable != null) { p.setRelativeDateInChangeTable(i.relativeDateInChangeTable); } @@ -161,15 +153,9 @@ public class SetPreferences implements RestModifyView { if (i.reviewCategoryStrategy != null) { p.setReviewCategoryStrategy(i.reviewCategoryStrategy); } - if (i.commentVisibilityStrategy != null) { - p.setCommentVisibilityStrategy(i.commentVisibilityStrategy); - } if (i.diffView != null) { p.setDiffView(i.diffView); } - if (i.changeScreen != null) { - p.setChangeScreen(i.changeScreen); - } db.get().accounts().update(Collections.singleton(a)); db.get().commit(); diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/config/SetPreferences.java b/gerrit-server/src/main/java/com/google/gerrit/server/config/SetPreferences.java index e8b2dc5092..0044ebd98b 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/config/SetPreferences.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/config/SetPreferences.java @@ -49,13 +49,10 @@ public class SetPreferences implements RestModifyView { || i.useFlashClipboard != null || i.downloadScheme != null || i.downloadCommand != null || i.copySelfOnEmail != null || i.dateFormat != null || i.timeFormat != null - || i.reversePatchSetOrder != null || i.relativeDateInChangeTable != null || i.sizeBarInChangeTable != null || i.legacycidInChangeTable != null - || i.reviewCategoryStrategy != null - || i.commentVisibilityStrategy != null || i.diffView != null - || i.changeScreen != null) { + || i.reviewCategoryStrategy != null) { throw new BadRequestException("unsupported option"); } diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/schema/SchemaVersion.java b/gerrit-server/src/main/java/com/google/gerrit/server/schema/SchemaVersion.java index ed0523609e..c33adf8926 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/schema/SchemaVersion.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/schema/SchemaVersion.java @@ -32,7 +32,7 @@ import java.util.List; /** A version of the database schema. */ public abstract class SchemaVersion { /** The current schema version. */ - public static final Class C = Schema_103.class; + public static final Class C = Schema_104.class; public static int getBinaryVersion() { return guessVersion(C); diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeResources.java b/gerrit-server/src/main/java/com/google/gerrit/server/schema/Schema_104.java similarity index 56% rename from gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeResources.java rename to gerrit-server/src/main/java/com/google/gerrit/server/schema/Schema_104.java index 892143c157..bebdacaa65 100644 --- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeResources.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/schema/Schema_104.java @@ -1,4 +1,4 @@ -// Copyright (C) 2010 The Android Open Source Project +// Copyright (C) 2015 The Android Open Source Project // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -12,15 +12,16 @@ // See the License for the specific language governing permissions and // limitations under the License. -package com.google.gerrit.client.changes; +package com.google.gerrit.server.schema; -import com.google.gwt.resources.client.ClientBundle; -import com.google.gwt.resources.client.ImageResource; +import com.google.inject.Inject; +import com.google.inject.Provider; -public interface ChangeResources extends ClientBundle { - @Source("removeReviewerNormal.png") - public ImageResource removeReviewerNormal(); +public class Schema_104 extends SchemaVersion { + @Inject + Schema_104(Provider prior) { + super(prior); + } - @Source("removeReviewerPressed.png") - public ImageResource removeReviewerPressed(); + // Remove old change screen }