Search in sources :

Example 1 with Anchor

use of com.google.gwt.user.client.ui.Anchor in project gerrit by GerritCodeReview.

the class PatchSetSelectBox method createEditIcon.

private Widget createEditIcon() {
    PatchSet.Id id = idActive.isBaseOrAutoMerge() ? other.idActive.asPatchSetId() : idActive.asPatchSetId();
    Anchor anchor = new Anchor(new ImageResourceRenderer().render(Gerrit.RESOURCES.edit()), "#" + Dispatcher.toEditScreen(id, path));
    anchor.setTitle(PatchUtil.C.edit());
    return anchor;
}
Also used : Anchor(com.google.gwt.user.client.ui.Anchor) PatchSet(com.google.gerrit.reviewdb.client.PatchSet) ImageResourceRenderer(com.google.gwt.user.client.ui.ImageResourceRenderer)

Example 2 with Anchor

use of com.google.gwt.user.client.ui.Anchor in project gerrit by GerritCodeReview.

the class PatchSetSelectBox method setUpBlame.

void setUpBlame(final CodeMirror cm, final boolean isBase, final PatchSet.Id rev, final String path) {
    if (!Patch.isMagic(path) && Gerrit.isSignedIn() && Gerrit.info().change().allowBlame()) {
        Anchor blameIcon = createBlameIcon();
        blameIcon.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent clickEvent) {
                if (cm.extras().getBlameInfo() != null) {
                    cm.extras().toggleAnnotation();
                } else {
                    ChangeApi.blame(rev, path, isBase).get(new GerritCallback<JsArray<BlameInfo>>() {

                        @Override
                        public void onSuccess(JsArray<BlameInfo> lines) {
                            cm.extras().toggleAnnotation(lines);
                        }
                    });
                }
            }
        });
        linkPanel.add(blameIcon);
    }
}
Also used : GerritCallback(com.google.gerrit.client.rpc.GerritCallback) Anchor(com.google.gwt.user.client.ui.Anchor) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) JsArray(com.google.gwt.core.client.JsArray) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) BlameInfo(com.google.gerrit.client.blame.BlameInfo)

Example 3 with Anchor

use of com.google.gwt.user.client.ui.Anchor in project gerrit by GerritCodeReview.

the class DownloadBox method insertPatch.

private void insertPatch() {
    String id = revision.substring(0, 7);
    Anchor patchBase64 = new Anchor(id + ".diff.base64");
    patchBase64.setHref(new RestApi("/changes/").id(psId.getParentKey().get()).view("revisions").id(revision).view("patch").addParameterTrue("download").url());
    Anchor patchZip = new Anchor(id + ".diff.zip");
    patchZip.setHref(new RestApi("/changes/").id(psId.getParentKey().get()).view("revisions").id(revision).view("patch").addParameterTrue("zip").url());
    HorizontalPanel p = new HorizontalPanel();
    p.add(patchBase64);
    InlineLabel spacer = new InlineLabel("|");
    spacer.setStyleName(Gerrit.RESOURCES.css().downloadBoxSpacer());
    p.add(spacer);
    p.add(patchZip);
    insertCommand("Patch-File", p);
}
Also used : Anchor(com.google.gwt.user.client.ui.Anchor) RestApi(com.google.gerrit.client.rpc.RestApi) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) InlineLabel(com.google.gwt.user.client.ui.InlineLabel)

Example 4 with Anchor

use of com.google.gwt.user.client.ui.Anchor in project gerrit by GerritCodeReview.

the class DownloadBox method insertArchive.

private void insertArchive() {
    List<String> activated = Gerrit.info().download().archives();
    if (activated.isEmpty()) {
        return;
    }
    List<Anchor> anchors = new ArrayList<>(activated.size());
    for (String f : activated) {
        Anchor archive = new Anchor(f);
        archive.setHref(new RestApi("/changes/").id(psId.getParentKey().get()).view("revisions").id(revision).view("archive").addParameter("format", f).url());
        anchors.add(archive);
    }
    HorizontalPanel p = new HorizontalPanel();
    Iterator<Anchor> it = anchors.iterator();
    while (it.hasNext()) {
        Anchor a = it.next();
        p.add(a);
        if (it.hasNext()) {
            InlineLabel spacer = new InlineLabel("|");
            spacer.setStyleName(Gerrit.RESOURCES.css().downloadBoxSpacer());
            p.add(spacer);
        }
    }
    insertCommand("Archive", p);
}
Also used : Anchor(com.google.gwt.user.client.ui.Anchor) RestApi(com.google.gerrit.client.rpc.RestApi) ArrayList(java.util.ArrayList) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) InlineLabel(com.google.gwt.user.client.ui.InlineLabel)

Example 5 with Anchor

use of com.google.gwt.user.client.ui.Anchor 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

Anchor (com.google.gwt.user.client.ui.Anchor)90 Test (org.junit.Test)63 GwtTestTest (com.googlecode.gwt.test.GwtTestTest)51 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)6 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)6 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)4 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)4 Image (com.google.gwt.user.client.ui.Image)4 InlineLabel (com.google.gwt.user.client.ui.InlineLabel)4 ImageResourceRenderer (com.google.gwt.user.client.ui.ImageResourceRenderer)3 Label (com.google.gwt.user.client.ui.Label)3 RestApi (com.google.gerrit.client.rpc.RestApi)2 FlexCellFormatter (com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter)2 Grid (com.google.gwt.user.client.ui.Grid)2 CellFormatter (com.google.gwt.user.client.ui.HTMLTable.CellFormatter)2 InlineHTML (com.google.gwt.user.client.ui.InlineHTML)2 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)2 CenterLayout (com.extjs.gxt.ui.client.widget.layout.CenterLayout)1 AvatarImage (com.google.gerrit.client.AvatarImage)1 DiffObject (com.google.gerrit.client.DiffObject)1