Example usage for com.google.gwt.user.client.ui Anchor getHref

List of usage examples for com.google.gwt.user.client.ui Anchor getHref

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui Anchor getHref.

Prototype

public String getHref() 

Source Link

Document

Gets the anchor's href (the url to which it links).

Usage

From source file:de.uni_koeln.spinfo.maalr.webapp.ui.user.client.User.java

License:Apache License

private void updateLanguageLinks(Element element) {
    String attribute = null;//from   w  ww .  ja va 2s .  c om
    try {
        attribute = element.getAttribute("class");
    } catch (Exception e1) {
        e1.printStackTrace();
    }
    if (attribute != null && attribute.contains("lang_select")) {
        final Anchor anchor = Anchor.wrap(element);
        final String langParam = anchor.getHref().substring(anchor.getHref().lastIndexOf('?'));
        HiJax.hijackAnchor(anchor, new Command() {

            @Override
            public void execute() {
                String url = Window.Location.getPath() + langParam + "#" + History.getToken();
                Window.Location.assign(url);
            }
        });
    } else {
        for (int i = 0; i < element.getChildCount(); i++) {
            Node child = element.getChild(i);
            Element e = child.cast();
            updateLanguageLinks(e);
        }
    }
}

From source file:jsef.poc2.host.client.local.pages.details.TabBar.java

License:Apache License

/**
 * @param tabId// w ww .  j a va2 s . com
 */
public void selectTab(String tabId) {
    String href = "#" + tabId;
    int count = getWidgetCount();
    for (int i = 0; i < count; i++) {
        Anchor a = (Anchor) getWidget(i);
        if (a.getHref().endsWith(href)) {
            selectTab(a.getElement());
            return;
        }
    }
}

From source file:org.silverpeas.mobile.client.pages.search.SearchResultPage.java

License:Open Source License

private void display() {
    for (final ResultDTO result : results) {
        final Anchor link = new Anchor();
        link.setStyleName("ui-btn ui-btn-icon-right ui-icon-carat-r");
        link.addClickHandler(new ClickHandler() {
            @Override/*from  w  w w.j  a v  a 2  s .c o  m*/
            public void onClick(final ClickEvent event) {
                ContentDTO content = new ContentDTO();
                content.setId(result.getId());
                content.setType(result.getType());
                content.setInstanceId(result.getComponentId());
                if (result.getType().equals(ContentsTypes.Attachment.toString())) {
                    Anchor l = ((Anchor) event.getSource());
                    if (l.getHref().isEmpty()) {
                        content.setLink(l);
                    }
                }
                EventBus.getInstance().fireEvent(new NavigationShowContentEvent(content));

            }
        });
        link.setText(result.getTitle());
        if (result.getType().equals(ContentsTypes.Publication.toString())) {
            list.add(link, "publication");
        } else if (result.getType().equals(ContentsTypes.Photo.toString())
                || result.getType().equals(ContentsTypes.Sound.toString())
                || result.getType().equals(ContentsTypes.Video.toString())
                || result.getType().equals(ContentsTypes.Streaming.toString())) {
            list.add(link, "media");
        } else {
            list.add(link);
        }
    }
}