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>");
}
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);
}
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;
}
Aggregations