Search in sources :

Example 26 with Anchor

use of com.google.gwt.user.client.ui.Anchor in project gwt-test-utils by gwt-test-utils.

the class AnchorTest method name.

@Test
public void name() {
    // Given
    Anchor a = new Anchor();
    // When
    a.setName("toto");
    // Then
    assertThat(a.getName()).isEqualTo("toto");
}
Also used : Anchor(com.google.gwt.user.client.ui.Anchor) Test(org.junit.Test)

Example 27 with Anchor

use of com.google.gwt.user.client.ui.Anchor in project gwt-test-utils by gwt-test-utils.

the class AnchorTest method tabIndex.

@Test
public void tabIndex() {
    // Given
    Anchor a = new Anchor();
    // When
    a.setTabIndex(1);
    // Then
    assertThat(a.getTabIndex()).isEqualTo(1);
}
Also used : Anchor(com.google.gwt.user.client.ui.Anchor) Test(org.junit.Test)

Example 28 with Anchor

use of com.google.gwt.user.client.ui.Anchor in project gwt-test-utils by gwt-test-utils.

the class AnchorTest method href.

@Test
public void href() {
    // Given
    Anchor a = new Anchor("toto", "href");
    // Preconditions
    assertThat(a.getText()).isEqualTo("toto");
    assertThat(a.getHref()).isEqualTo("href");
    // When
    a.setHref("new");
    // Then
    assertThat(a.getHref()).isEqualTo("new");
}
Also used : Anchor(com.google.gwt.user.client.ui.Anchor) Test(org.junit.Test)

Example 29 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)

Example 30 with Anchor

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

the class Gerrit method addDocLink.

private static void addDocLink(final LinkMenuBar m, final String text, final String href) {
    final Anchor atag = anchor(text, docUrl + href);
    atag.setTarget("_blank");
    m.add(atag);
}
Also used : Anchor(com.google.gwt.user.client.ui.Anchor)

Aggregations

Anchor (com.google.gwt.user.client.ui.Anchor)80 Test (org.junit.Test)59 GwtTestTest (com.googlecode.gwt.test.GwtTestTest)47 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)6 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)6 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 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 AvatarImage (com.google.gerrit.client.AvatarImage)1 DiffObject (com.google.gerrit.client.DiffObject)1 GerritUiExtensionPoint (com.google.gerrit.client.GerritUiExtensionPoint)1 BlameInfo (com.google.gerrit.client.blame.BlameInfo)1 ProjectInfo (com.google.gerrit.client.projects.ProjectInfo)1