Search in sources :

Example 11 with AccountInfo

use of com.google.gerrit.client.info.AccountInfo in project gerrit by GerritCodeReview.

the class Reviewers method display.

private void display(ChangeInfo info) {
    Map<ReviewerState, List<AccountInfo>> reviewers = info.reviewers();
    Map<Integer, AccountInfo> r = byAccount(reviewers, ReviewerState.REVIEWER);
    Map<Integer, AccountInfo> cc = byAccount(reviewers, ReviewerState.CC);
    for (Integer i : r.keySet()) {
        cc.remove(i);
    }
    cc.remove(info.owner()._accountId());
    Set<Integer> removable = info.removableReviewerIds();
    Map<Integer, VotableInfo> votable = votable(info);
    SafeHtml rHtml = Labels.formatUserList(style, r.values(), removable, null, votable);
    SafeHtml ccHtml = Labels.formatUserList(style, cc.values(), removable, null, votable);
    reviewersText.setInnerSafeHtml(rHtml);
    ccText.setInnerSafeHtml(ccHtml);
    if (Gerrit.isSignedIn()) {
        int currentUser = Gerrit.getUserAccount()._accountId();
        boolean showAddMeButton = info.owner()._accountId() != currentUser && !cc.containsKey(currentUser) && !r.containsKey(currentUser);
        addMe.setVisible(showAddMeButton);
    }
}
Also used : ReviewerState(com.google.gerrit.extensions.client.ReviewerState) SafeHtml(com.google.gwtexpui.safehtml.client.SafeHtml) List(java.util.List) AccountInfo(com.google.gerrit.client.info.AccountInfo)

Aggregations

AccountInfo (com.google.gerrit.client.info.AccountInfo)11 GerritCallback (com.google.gerrit.client.rpc.GerritCallback)3 NativeString (com.google.gerrit.client.rpc.NativeString)3 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)3 CallbackGroup (com.google.gerrit.client.rpc.CallbackGroup)2 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)2 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)2 FormPanel (com.google.gwt.user.client.ui.FormPanel)2 HTML (com.google.gwt.user.client.ui.HTML)2 AvatarImage (com.google.gerrit.client.AvatarImage)1 ErrorDialog (com.google.gerrit.client.ErrorDialog)1 EditPreferences (com.google.gerrit.client.account.EditPreferences)1 DocInfo (com.google.gerrit.client.documentation.DocInfo)1 AvatarInfo (com.google.gerrit.client.info.AccountInfo.AvatarInfo)1 GeneralPreferences (com.google.gerrit.client.info.GeneralPreferences)1 ServerInfo (com.google.gerrit.client.info.ServerInfo)1 InlineHyperlink (com.google.gerrit.client.ui.InlineHyperlink)1 SmallHeading (com.google.gerrit.client.ui.SmallHeading)1 HostPageData (com.google.gerrit.common.data.HostPageData)1 EditPreferencesInfo (com.google.gerrit.extensions.client.EditPreferencesInfo)1