Show mini avatar images for summary comments and inline comments

Change-Id: I0caa2d30273bb1f60e93746e1533de418ca59280
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
Edwin Kempin
2013-04-23 12:43:43 +02:00
parent 3a19881a29
commit 902f67939d
3 changed files with 21 additions and 16 deletions

View File

@@ -360,9 +360,11 @@ public class PublishCommentScreen extends AccountScreen implements
final CommentEditorPanel editor =
new CommentEditorPanel(c, commentLinkProcessor);
if (c.getLine() == AbstractPatchContentTable.R_HEAD) {
editor.setAuthorNameText(Util.C.fileCommentHeader());
editor.setAuthorNameText(Gerrit.getUserAccount().getPreferredEmail(),
Util.C.fileCommentHeader());
} else {
editor.setAuthorNameText(Util.M.lineHeader(c.getLine()));
editor.setAuthorNameText(Gerrit.getUserAccount().getPreferredEmail(),
Util.M.lineHeader(c.getLine()));
}
editor.setOpen(true);
commentEditors.add(editor);

View File

@@ -65,7 +65,8 @@ public class CommentEditorPanel extends CommentPanel implements ClickHandler,
comment = plc;
addStyleName(Gerrit.RESOURCES.css().commentEditorPanel());
setAuthorNameText(PatchUtil.C.draft());
setAuthorNameText(Gerrit.getUserAccount().getPreferredEmail(),
PatchUtil.C.draft());
setMessageText(plc.getMessage());
addDoubleClickHandler(this);

View File

@@ -14,6 +14,7 @@
package com.google.gerrit.client.ui;
import com.google.gerrit.client.AvatarImage;
import com.google.gerrit.client.FormatUtil;
import com.google.gerrit.client.Gerrit;
import com.google.gerrit.client.account.AccountInfo;
@@ -62,12 +63,12 @@ public class CommentPanel extends Composite implements HasDoubleClickHandlers,
this(commentLinkProcessor);
setMessageText(message);
setAuthorNameText(FormatUtil.name(author));
setAuthorNameText(author.email(), FormatUtil.name(author));
setDateText(FormatUtil.shortFormatDayTime(when));
final CellFormatter fmt = header.getCellFormatter();
fmt.getElement(0, 0).setTitle(FormatUtil.nameEmail(author));
fmt.getElement(0, 2).setTitle(FormatUtil.mediumFormat(when));
fmt.getElement(0, 1).setTitle(FormatUtil.nameEmail(author));
fmt.getElement(0, 3).setTitle(FormatUtil.mediumFormat(when));
}
protected CommentPanel(CommentLinkProcessor commentLinkProcessor) {
@@ -87,14 +88,14 @@ public class CommentPanel extends Composite implements HasDoubleClickHandlers,
setOpen(!isOpen());
}
});
header.setText(0, 0, "");
header.setWidget(0, 1, messageSummary);
header.setText(0, 2, "");
header.setText(0, 1, "");
header.setWidget(0, 2, messageSummary);
header.setText(0, 3, "");
final CellFormatter fmt = header.getCellFormatter();
fmt.setStyleName(0, 0, Gerrit.RESOURCES.css().commentPanelAuthorCell());
fmt.setStyleName(0, 1, Gerrit.RESOURCES.css().commentPanelSummaryCell());
fmt.setStyleName(0, 2, Gerrit.RESOURCES.css().commentPanelDateCell());
fmt.setHorizontalAlignment(0, 2, HasHorizontalAlignment.ALIGN_RIGHT);
fmt.setStyleName(0, 1, Gerrit.RESOURCES.css().commentPanelAuthorCell());
fmt.setStyleName(0, 2, Gerrit.RESOURCES.css().commentPanelSummaryCell());
fmt.setStyleName(0, 3, Gerrit.RESOURCES.css().commentPanelDateCell());
fmt.setHorizontalAlignment(0, 3, HasHorizontalAlignment.ALIGN_RIGHT);
body.add(header);
content = new FlowPanel();
@@ -125,12 +126,13 @@ public class CommentPanel extends Composite implements HasDoubleClickHandlers,
SafeHtml.set(messageText, buf);
}
public void setAuthorNameText(final String nameText) {
header.setText(0, 0, nameText);
public void setAuthorNameText(final String authorEmail, final String nameText) {
header.setWidget(0, 0, new AvatarImage(authorEmail, 26));
header.setText(0, 1, nameText);
}
protected void setDateText(final String dateText) {
header.setText(0, 2, dateText);
header.setText(0, 3, dateText);
}
protected void setMessageTextVisible(final boolean show) {