Search in sources :

Example 46 with Anchor

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

the class Gerrit method anchor.

private static Anchor anchor(final String text, final String to) {
    final Anchor a = new Anchor(text, to);
    a.setStyleName(RESOURCES.css().menuItem());
    Roles.getMenuitemRole().set(a.getElement());
    return a;
}
Also used : Anchor(com.google.gwt.user.client.ui.Anchor)

Example 47 with Anchor

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

the class Gerrit method populateBottomMenu.

private static void populateBottomMenu(RootPanel btmmenu, HostPageData hpd) {
    String vs = hpd.version;
    if (vs == null || vs.isEmpty()) {
        vs = "dev";
    }
    btmmenu.add(new InlineHTML(M.poweredBy(vs)));
    if (info().gerrit().webUis().contains(UiType.POLYGERRIT)) {
        btmmenu.add(new InlineLabel(" | "));
        uiSwitcherLink = new Anchor(C.newUi(), getUiSwitcherUrl(History.getToken()));
        uiSwitcherLink.setStyleName("");
        btmmenu.add(uiSwitcherLink);
    }
    String reportBugUrl = info().gerrit().reportBugUrl();
    if (reportBugUrl != null) {
        String reportBugText = info().gerrit().reportBugText();
        Anchor a = new Anchor(reportBugText == null ? C.reportBug() : reportBugText, reportBugUrl);
        a.setTarget("_blank");
        a.setStyleName("");
        btmmenu.add(new InlineLabel(" | "));
        btmmenu.add(a);
    }
    btmmenu.add(new InlineLabel(" | "));
    btmmenu.add(new InlineLabel(C.keyHelp()));
}
Also used : Anchor(com.google.gwt.user.client.ui.Anchor) InlineHTML(com.google.gwt.user.client.ui.InlineHTML) InlineLabel(com.google.gwt.user.client.ui.InlineLabel)

Example 48 with Anchor

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

the class WebLinkInfo method toAnchor.

public final Anchor toAnchor() {
    Anchor a = new Anchor();
    a.setHref(url());
    if (target() != null && !target().isEmpty()) {
        a.setTarget(target());
    }
    if (imageUrl() != null && !imageUrl().isEmpty()) {
        Image img = new Image();
        img.setAltText(name());
        img.setUrl(imageUrl());
        img.setTitle(name());
        a.getElement().appendChild(img.getElement());
    } else {
        a.setText("(" + name() + ")");
    }
    return a;
}
Also used : Anchor(com.google.gwt.user.client.ui.Anchor) Image(com.google.gwt.user.client.ui.Image)

Example 49 with Anchor

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

the class ProjectAccessEditor method toAnchor.

private static Anchor toAnchor(WebLinkInfoCommon info) {
    Anchor a = new Anchor();
    a.setHref(info.url);
    if (info.target != null && !info.target.isEmpty()) {
        a.setTarget(info.target);
    }
    if (info.imageUrl != null && !info.imageUrl.isEmpty()) {
        Image img = new Image();
        img.setAltText(info.name);
        img.setUrl(info.imageUrl);
        img.setTitle(info.name);
        a.getElement().appendChild(img.getElement());
    } else {
        a.setText("(" + info.name + ")");
    }
    return a;
}
Also used : Anchor(com.google.gwt.user.client.ui.Anchor) Image(com.google.gwt.user.client.ui.Image)

Example 50 with Anchor

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

the class GroupTable method populate.

void populate(final int row, final GroupInfo k, final String toHighlight) {
    if (k.url() != null) {
        if (isInteralGroup(k)) {
            table.setWidget(row, 1, new HighlightingInlineHyperlink(k.name(), Dispatcher.toGroup(k.getGroupId()), toHighlight));
        } else {
            Anchor link = new Anchor();
            link.setHTML(Util.highlight(k.name(), toHighlight));
            link.setHref(k.url());
            table.setWidget(row, 1, link);
        }
    } else {
        table.setHTML(row, 1, Util.highlight(k.name(), toHighlight));
    }
    table.setText(row, 2, k.description());
    if (k.options().isVisibleToAll()) {
        table.setWidget(row, 3, new Image(Gerrit.RESOURCES.greenCheck()));
    }
    final FlexCellFormatter fmt = table.getFlexCellFormatter();
    fmt.addStyleName(row, 1, Gerrit.RESOURCES.css().groupName());
    for (int i = 1; i <= NUM_COLS; i++) {
        fmt.addStyleName(row, i, Gerrit.RESOURCES.css().dataCell());
    }
    setRowItem(row, k);
}
Also used : Anchor(com.google.gwt.user.client.ui.Anchor) FlexCellFormatter(com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter) Image(com.google.gwt.user.client.ui.Image) HighlightingInlineHyperlink(com.google.gerrit.client.ui.HighlightingInlineHyperlink)

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