Search in sources :

Example 1 with AvatarImage

use of com.google.gerrit.client.AvatarImage in project gerrit by GerritCodeReview.

the class ChangeScreen method renderUploader.

private void renderUploader(ChangeInfo changeInfo, RevisionInfo revInfo) {
    AccountInfo uploader = revInfo.uploader();
    boolean isOwner = uploader == null || uploader._accountId() == changeInfo.owner()._accountId();
    renderPushCertificate(revInfo, isOwner ? ownerPanel : uploaderPanel);
    if (isOwner) {
        uploaderRow.getStyle().setDisplay(Display.NONE);
        return;
    }
    uploaderRow.getStyle().setDisplay(Display.TABLE_ROW);
    if (uploader.avatar(AvatarInfo.DEFAULT_SIZE) != null) {
        uploaderPanel.insert(new AvatarImage(uploader), 0);
    }
    String name = name(uploader);
    uploaderName.setText(name);
    uploaderName.setTitle(email(uploader, name));
}
Also used : JsArrayString(com.google.gwt.core.client.JsArrayString) AvatarImage(com.google.gerrit.client.AvatarImage) AccountInfo(com.google.gerrit.client.info.AccountInfo)

Example 2 with AvatarImage

use of com.google.gerrit.client.AvatarImage in project gerrit by GerritCodeReview.

the class CommitBox method formatLink.

private static void formatLink(GitPerson person, FlowPanel p, InlineHyperlink name, Element date, ChangeInfo change) {
    // no avatar plugin is installed
    if (change.owner().hasAvatarInfo()) {
        AvatarImage avatar;
        if (sameEmail(change.owner(), person)) {
            avatar = new AvatarImage(change.owner());
        } else {
            avatar = new AvatarImage(AccountInfo.create(0, person.name(), person.email(), null));
        }
        p.insert(avatar, 0);
    }
    name.setText(renderName(person));
    name.setTargetHistoryToken(PageLinks.toAccountQuery(owner(person), change.status()));
    date.setInnerText(FormatUtil.mediumFormat(person.date()));
}
Also used : AvatarImage(com.google.gerrit.client.AvatarImage)

Example 3 with AvatarImage

use of com.google.gerrit.client.AvatarImage in project gerrit by GerritCodeReview.

the class ChangeScreen method renderOwner.

private void renderOwner(ChangeInfo info) {
    // TODO info card hover
    String name = name(info.owner());
    if (info.owner().avatar(AvatarInfo.DEFAULT_SIZE) != null) {
        ownerPanel.insert(new AvatarImage(info.owner()), 0);
    }
    ownerLink.setText(name);
    ownerLink.setTitle(email(info.owner(), name));
    ownerLink.setTargetHistoryToken(PageLinks.toAccountQuery(info.owner().name() != null ? info.owner().name() : info.owner().email() != null ? info.owner().email() : String.valueOf(info.owner()._accountId()), Change.Status.NEW));
}
Also used : JsArrayString(com.google.gwt.core.client.JsArrayString) AvatarImage(com.google.gerrit.client.AvatarImage)

Example 4 with AvatarImage

use of com.google.gerrit.client.AvatarImage in project gerrit by GerritCodeReview.

the class MyProfileScreen method onInitUI.

@Override
protected void onInitUI() {
    super.onInitUI();
    HorizontalPanel h = new HorizontalPanel();
    add(h);
    if (Gerrit.info().plugin().hasAvatars()) {
        VerticalPanel v = new VerticalPanel();
        v.addStyleName(Gerrit.RESOURCES.css().avatarInfoPanel());
        h.add(v);
        avatar = new AvatarImage();
        v.add(avatar);
        changeAvatar = new Anchor(Util.C.changeAvatar(), "", "_blank");
        changeAvatar.setVisible(false);
        v.add(changeAvatar);
    }
    if (LocaleInfo.getCurrentLocale().isRTL()) {
        labelIdx = 1;
        fieldIdx = 0;
    } else {
        labelIdx = 0;
        fieldIdx = 1;
    }
    info = new Grid((Gerrit.info().auth().siteHasUsernames() ? 1 : 0) + 4, 2);
    info.setStyleName(Gerrit.RESOURCES.css().infoBlock());
    info.addStyleName(Gerrit.RESOURCES.css().accountInfoBlock());
    h.add(info);
    int row = 0;
    if (Gerrit.info().auth().siteHasUsernames()) {
        infoRow(row++, Util.C.userName());
    }
    infoRow(row++, Util.C.fullName());
    infoRow(row++, Util.C.preferredEmail());
    infoRow(row++, Util.C.registeredOn());
    infoRow(row++, Util.C.accountId());
    final CellFormatter fmt = info.getCellFormatter();
    fmt.addStyleName(0, 0, Gerrit.RESOURCES.css().topmost());
    fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().topmost());
    fmt.addStyleName(row - 1, 0, Gerrit.RESOURCES.css().bottomheader());
}
Also used : VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) Anchor(com.google.gwt.user.client.ui.Anchor) Grid(com.google.gwt.user.client.ui.Grid) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) AvatarImage(com.google.gerrit.client.AvatarImage) CellFormatter(com.google.gwt.user.client.ui.HTMLTable.CellFormatter) GerritUiExtensionPoint(com.google.gerrit.client.GerritUiExtensionPoint)

Aggregations

AvatarImage (com.google.gerrit.client.AvatarImage)4 JsArrayString (com.google.gwt.core.client.JsArrayString)2 GerritUiExtensionPoint (com.google.gerrit.client.GerritUiExtensionPoint)1 AccountInfo (com.google.gerrit.client.info.AccountInfo)1 Anchor (com.google.gwt.user.client.ui.Anchor)1 Grid (com.google.gwt.user.client.ui.Grid)1 CellFormatter (com.google.gwt.user.client.ui.HTMLTable.CellFormatter)1 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)1 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)1