Search in sources :

Example 1 with InlineHyperlink

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);
}
Also used : InlineHyperlink(com.google.gerrit.client.ui.InlineHyperlink) ImageResourceRenderer(com.google.gwt.user.client.ui.ImageResourceRenderer) GlobalKey(com.google.gwtexpui.globalkey.client.GlobalKey)

Example 2 with InlineHyperlink

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());
        }
    }
}
Also used : InlineHyperlink(com.google.gerrit.client.ui.InlineHyperlink) RevisionInfo(com.google.gerrit.client.info.ChangeInfo.RevisionInfo) WebLinkInfo(com.google.gerrit.client.info.WebLinkInfo) PatchSet(com.google.gerrit.reviewdb.client.PatchSet)

Example 3 with InlineHyperlink

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));
}
Also used : InlineHyperlink(com.google.gerrit.client.ui.InlineHyperlink) DiffObject(com.google.gerrit.client.DiffObject)

Example 4 with InlineHyperlink

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);
}
Also used : InlineHyperlink(com.google.gerrit.client.ui.InlineHyperlink) FlowPanel(com.google.gwt.user.client.ui.FlowPanel)

Example 5 with InlineHyperlink

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);
}
Also used : SmallHeading(com.google.gerrit.client.ui.SmallHeading) InlineHyperlink(com.google.gerrit.client.ui.InlineHyperlink) FormPanel(com.google.gwt.user.client.ui.FormPanel) Grid(com.google.gwt.user.client.ui.Grid) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) HTML(com.google.gwt.user.client.ui.HTML) CellFormatter(com.google.gwt.user.client.ui.HTMLTable.CellFormatter) AccountInfo(com.google.gerrit.client.info.AccountInfo)

Aggregations

InlineHyperlink (com.google.gerrit.client.ui.InlineHyperlink)9 ImageResourceRenderer (com.google.gwt.user.client.ui.ImageResourceRenderer)3 WebLinkInfo (com.google.gerrit.client.info.WebLinkInfo)2 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)2 DiffObject (com.google.gerrit.client.DiffObject)1 AccountInfo (com.google.gerrit.client.info.AccountInfo)1 RevisionInfo (com.google.gerrit.client.info.ChangeInfo.RevisionInfo)1 SmallHeading (com.google.gerrit.client.ui.SmallHeading)1 PatchSet (com.google.gerrit.reviewdb.client.PatchSet)1 KeyPressEvent (com.google.gwt.event.dom.client.KeyPressEvent)1 FormPanel (com.google.gwt.user.client.ui.FormPanel)1 Grid (com.google.gwt.user.client.ui.Grid)1 HTML (com.google.gwt.user.client.ui.HTML)1 CellFormatter (com.google.gwt.user.client.ui.HTMLTable.CellFormatter)1 GlobalKey (com.google.gwtexpui.globalkey.client.GlobalKey)1 KeyCommand (com.google.gwtexpui.globalkey.client.KeyCommand)1