Search in sources :

Example 6 with Hyperlink

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

the class HyperlinkTest method constructor_HTML_Token.

@Test
public void constructor_HTML_Token() {
    // When
    Hyperlink link = new Hyperlink("<h1>foo</h1>", true, "test-history-token");
    // Then
    assertThat(link.getTargetHistoryToken()).isEqualTo("test-history-token");
    assertThat(link.getHTML()).isEqualTo("<h1>foo</h1>");
}
Also used : Hyperlink(com.google.gwt.user.client.ui.Hyperlink) Test(org.junit.Test)

Example 7 with Hyperlink

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

the class HyperlinkTest method click_ClickHandler.

@SuppressWarnings("deprecation")
@Test
public void click_ClickHandler() {
    // Given
    bool = false;
    Hyperlink link = new Hyperlink();
    link.addClickHandler(event -> bool = true);
    // When
    Browser.click(link);
    // Then
    assertThat(bool).isEqualTo(true);
}
Also used : Hyperlink(com.google.gwt.user.client.ui.Hyperlink) Test(org.junit.Test)

Example 8 with Hyperlink

use of com.google.gwt.user.client.ui.Hyperlink in project perun by CESNET.

the class MainMenuItem method build.

/**
 * Re-build main menu item
 * (check if item is selected)
 */
public void build() {
    Widget widget = new Widget();
    boolean enabled = (tabItem != null);
    // if menu item enabled - show hyperlink
    if (enabled) {
        widget = new Hyperlink(title, session.getTabManager().getLinkForTab(tabItem));
        widget.removeStyleName("mainMenuNotActive");
    // else show plain text
    } else {
        widget = new HTML(title);
        widget.addStyleName("mainMenuNotActive");
    }
    if (tabItem != null && session.getTabManager().getActiveTab() != null) {
        this.active = (tabItem.getUrlWithParameters().equals(((TabItemWithUrl) session.getTabManager().getActiveTab()).getUrlWithParameters()));
        // IF ACTIVE TAB IS GROUP ADMIN - GROUPS
        if (((TabItemWithUrl) session.getTabManager().getActiveTab()).getUrlWithParameters().startsWith(GroupsTabs.URL + UrlMapper.TAB_NAME_SEPARATOR + tabItem.getUrl() + "?vo=")) {
            this.active = ((TabItemWithUrl) tabItem).getUrlWithParameters().startsWith(GroupsTabs.URL + UrlMapper.TAB_NAME_SEPARATOR + tabItem.getUrl() + "?vo=");
        }
        // hack for services tabs
        if (((TabItemWithUrl) session.getTabManager().getActiveTab()).getUrlWithParameters().startsWith(String.valueOf(ServicesTabs.URL + UrlMapper.TAB_NAME_SEPARATOR + "list")) || ((TabItemWithUrl) session.getTabManager().getActiveTab()).getUrlWithParameters().startsWith(String.valueOf(ServicesTabs.URL + UrlMapper.TAB_NAME_SEPARATOR + "detail")) || ((TabItemWithUrl) session.getTabManager().getActiveTab()).getUrlWithParameters().startsWith(String.valueOf(ServicesTabs.URL + UrlMapper.TAB_NAME_SEPARATOR + "exec-view"))) {
            this.active = ((TabItemWithUrl) tabItem).getUrlWithParameters().startsWith(String.valueOf(ServicesTabs.URL + UrlMapper.TAB_NAME_SEPARATOR + "list")) || ((TabItemWithUrl) tabItem).getUrlWithParameters().startsWith(String.valueOf(ServicesTabs.URL + UrlMapper.TAB_NAME_SEPARATOR + "detail")) || ((TabItemWithUrl) tabItem).getUrlWithParameters().startsWith(String.valueOf(ServicesTabs.URL + UrlMapper.TAB_NAME_SEPARATOR + "exec-view"));
        }
    } else {
        this.active = false;
    }
    if (active) {
        widget.addStyleName("mainMenuActive");
    } else {
        widget.removeStyleName("mainMenuActive");
    }
    this.widget = widget;
}
Also used : Widget(com.google.gwt.user.client.ui.Widget) TabItemWithUrl(cz.metacentrum.perun.webgui.tabs.TabItemWithUrl) HTML(com.google.gwt.user.client.ui.HTML) Hyperlink(com.google.gwt.user.client.ui.Hyperlink)

Aggregations

Hyperlink (com.google.gwt.user.client.ui.Hyperlink)8 Test (org.junit.Test)6 HeadingElement (com.google.gwt.dom.client.HeadingElement)1 HTML (com.google.gwt.user.client.ui.HTML)1 Widget (com.google.gwt.user.client.ui.Widget)1 TabItemWithUrl (cz.metacentrum.perun.webgui.tabs.TabItemWithUrl)1 FacilityDetailTabItem (cz.metacentrum.perun.webgui.tabs.facilitiestabs.FacilityDetailTabItem)1