use of com.google.gerrit.client.ui.InlineHyperlink in project gerrit by GerritCodeReview.
the class EditScreen method renderLinksToDiff.
private void renderLinksToDiff() {
InlineHyperlink sbs = new InlineHyperlink();
sbs.setHTML(new ImageResourceRenderer().render(Gerrit.RESOURCES.sideBySideDiff()));
sbs.setTargetHistoryToken(Dispatcher.toPatch("sidebyside", null, new Patch.Key(revision, path)));
sbs.setTitle(PatchUtil.C.sideBySideDiff());
linkPanel.add(sbs);
InlineHyperlink unified = new InlineHyperlink();
unified.setHTML(new ImageResourceRenderer().render(Gerrit.RESOURCES.unifiedDiff()));
unified.setTargetHistoryToken(Dispatcher.toPatch("unified", null, new Patch.Key(revision, path)));
unified.setTitle(PatchUtil.C.unifiedDiff());
linkPanel.add(unified);
}
use of com.google.gerrit.client.ui.InlineHyperlink in project gerrit by GerritCodeReview.
the class PatchSetSelectBox method setUpPatchSetNav.
void setUpPatchSetNav(JsArray<RevisionInfo> list, int parents, DiffInfo.FileMeta meta, boolean editExists, boolean current, boolean open, boolean binary) {
InlineHyperlink selectedLink = null;
if (sideA) {
if (parents <= 1) {
InlineHyperlink link = createLink(PatchUtil.C.patchBase(), DiffObject.base());
linkPanel.add(link);
selectedLink = link;
} else {
for (int i = parents; i > 0; i--) {
PatchSet.Id id = new PatchSet.Id(changeId, -i);
InlineHyperlink link = createLink(Util.M.diffBaseParent(i), DiffObject.patchSet(id));
linkPanel.add(link);
if (revision != null && id.equals(revision)) {
selectedLink = link;
}
}
InlineHyperlink link = createLink(Util.C.autoMerge(), DiffObject.autoMerge());
linkPanel.add(link);
if (selectedLink == null) {
selectedLink = link;
}
}
}
for (int i = 0; i < list.length(); i++) {
RevisionInfo r = list.get(i);
InlineHyperlink link = createLink(r.id(), DiffObject.patchSet(new PatchSet.Id(changeId, r._number())));
linkPanel.add(link);
if (revision != null && r.id().equals(revision.getId())) {
selectedLink = link;
}
}
if (selectedLink != null) {
selectedLink.setStyleName(style.selected());
}
if (meta == null) {
return;
}
if (!Patch.isMagic(path)) {
linkPanel.add(createDownloadLink());
}
if (!binary && open && !idActive.isBaseOrAutoMerge() && Gerrit.isSignedIn()) {
if ((editExists && idActive.isEdit()) || (!editExists && current)) {
linkPanel.add(createEditIcon());
}
}
List<WebLinkInfo> webLinks = Natives.asList(meta.webLinks());
if (webLinks != null) {
for (WebLinkInfo webLink : webLinks) {
linkPanel.add(webLink.toAnchor());
}
}
}
use of com.google.gerrit.client.ui.InlineHyperlink in project gerrit by GerritCodeReview.
the class PatchSetSelectBox method createLink.
private InlineHyperlink createLink(String label, DiffObject id) {
assert other != null;
if (sideA) {
assert !other.idActive.isBaseOrAutoMerge();
}
DiffObject diffBase = sideA ? id : other.idActive;
DiffObject revision = sideA ? other.idActive : id;
return new InlineHyperlink(label, parent.isSideBySide() ? Dispatcher.toSideBySide(diffBase, revision.asPatchSetId(), path) : Dispatcher.toUnified(diffBase, revision.asPatchSetId(), path));
}
use of com.google.gerrit.client.ui.InlineHyperlink in project gerrit by GerritCodeReview.
the class ProjectDashboardScreen method onInitUI.
@Override
protected void onInitUI() {
table = new DashboardTable(this, params) {
@Override
public void finishDisplay() {
super.finishDisplay();
display();
}
};
super.onInitUI();
String title = table.getTitle();
if (title != null) {
FlowPanel fp = new FlowPanel();
fp.setStyleName(Gerrit.RESOURCES.css().screenHeader());
fp.add(new InlineHyperlink(title, PageLinks.toCustomDashboard(params)));
add(fp);
}
add(table);
}
use of com.google.gerrit.client.ui.InlineHyperlink in project gerrit by GerritCodeReview.
the class RegisterScreen method onInitUI.
@Override
protected void onInitUI() {
super.onInitUI();
setPageTitle(Util.C.welcomeToGerritCodeReview());
final FlowPanel formBody = new FlowPanel();
final FlowPanel contactGroup = new FlowPanel();
contactGroup.setStyleName(Gerrit.RESOURCES.css().registerScreenSection());
contactGroup.add(new SmallHeading(Util.C.welcomeReviewContact()));
final HTML whereFrom = new HTML(Util.C.welcomeContactFrom());
whereFrom.setStyleName(Gerrit.RESOURCES.css().registerScreenExplain());
contactGroup.add(whereFrom);
contactGroup.add(new ContactPanelShort() {
@Override
protected void display(AccountInfo account) {
super.display(account);
if ("".equals(nameTxt.getText())) {
// No name? Encourage the user to provide us something.
//
nameTxt.setFocus(true);
save.setEnabled(true);
}
}
});
formBody.add(contactGroup);
if (Gerrit.getUserAccount().username() == null && Gerrit.info().auth().canEdit(AccountFieldName.USER_NAME)) {
final FlowPanel fp = new FlowPanel();
fp.setStyleName(Gerrit.RESOURCES.css().registerScreenSection());
fp.add(new SmallHeading(Util.C.welcomeUsernameHeading()));
final Grid userInfo = new Grid(1, 2);
final CellFormatter fmt = userInfo.getCellFormatter();
userInfo.setStyleName(Gerrit.RESOURCES.css().infoBlock());
userInfo.addStyleName(Gerrit.RESOURCES.css().accountInfoBlock());
fp.add(userInfo);
fmt.addStyleName(0, 0, Gerrit.RESOURCES.css().topmost());
fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().topmost());
fmt.addStyleName(0, 0, Gerrit.RESOURCES.css().bottomheader());
UsernameField field = new UsernameField();
if (LocaleInfo.getCurrentLocale().isRTL()) {
userInfo.setText(0, 1, Util.C.userName());
userInfo.setWidget(0, 0, field);
fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().header());
} else {
userInfo.setText(0, 0, Util.C.userName());
userInfo.setWidget(0, 1, field);
fmt.addStyleName(0, 0, Gerrit.RESOURCES.css().header());
}
formBody.add(fp);
}
if (Gerrit.info().hasSshd()) {
final FlowPanel sshKeyGroup = new FlowPanel();
sshKeyGroup.setStyleName(Gerrit.RESOURCES.css().registerScreenSection());
sshKeyGroup.add(new SmallHeading(Util.C.welcomeSshKeyHeading()));
final HTML whySshKey = new HTML(Util.C.welcomeSshKeyText());
whySshKey.setStyleName(Gerrit.RESOURCES.css().registerScreenExplain());
sshKeyGroup.add(whySshKey);
sshKeyGroup.add(new SshPanel() {
{
setKeyTableVisible(false);
}
});
formBody.add(sshKeyGroup);
}
final FlowPanel choices = new FlowPanel();
choices.setStyleName(Gerrit.RESOURCES.css().registerScreenNextLinks());
if (Gerrit.info().auth().useContributorAgreements()) {
final FlowPanel agreementGroup = new FlowPanel();
agreementGroup.setStyleName(Gerrit.RESOURCES.css().registerScreenSection());
agreementGroup.add(new SmallHeading(Util.C.welcomeAgreementHeading()));
final HTML whyAgreement = new HTML(Util.C.welcomeAgreementText());
whyAgreement.setStyleName(Gerrit.RESOURCES.css().registerScreenExplain());
agreementGroup.add(whyAgreement);
choices.add(new InlineHyperlink(Util.C.newAgreement(), PageLinks.SETTINGS_NEW_AGREEMENT));
choices.add(new InlineHyperlink(Util.C.welcomeAgreementLater(), nextToken));
formBody.add(agreementGroup);
} else {
choices.add(new InlineHyperlink(Util.C.welcomeContinue(), nextToken));
}
formBody.add(choices);
final FormPanel form = new FormPanel();
form.add(formBody);
add(form);
}
Aggregations