List of usage examples for com.google.gwt.user.client DOM createAnchor
public static Element createAnchor()
From source file:asquare.gwt.tk.client.ui.ExternalHyperLink.java
License:Apache License
/** * Constructs a new ExternalHyperLink//from ww w . ja v a 2 s . c om * * @param text a String to display in the link * @param asHtml <code>true</code> to treat <code>text</code> as HTML, * <code>false</code> to treat <code>text</code> as plain * text * @param url the url the link will open * @param target the case-sensitive name of a target frame or window, or one * of the reserved target constants */ public ExternalHyperLink(String text, boolean asHtml, String url, String target) { setElement(DOM.createAnchor()); setStyleName("tk-ExternalHyperLink"); if (text != null) { if (asHtml) { setHTML(text); } else { setText(text); } } if (url != null) { setUrl(url); } if (target != null) { setTarget(target); } }
From source file:asquare.gwt.tk.client.ui.SimpleHyperLink.java
License:Apache License
/** * Constructs a new SimpleHyperLink/*from w ww . j av a 2s .c o m*/ * * @param text a String or null * @param clickHandler a ClickHandler or <code>null</code> */ public SimpleHyperLink(String text, ClickHandler clickHandler) { setElement(DOM.createAnchor()); // prevents text selection by double-click DomUtil.setAttribute(this, "href", "#"); sinkEvents(Event.ONCLICK); setStyleName("tk-SimpleHyperLink"); if (text != null) { setText(text); } if (clickHandler != null) { addClickHandler(clickHandler); } }
From source file:cc.alcina.framework.gwt.client.widget.APanel.java
License:Apache License
public APanel() { setElement(DOM.createAnchor()); getElement().setPropertyString("href", "#"); sinkEvents(Event.ONCLICK); }
From source file:cc.alcina.framework.gwt.client.widget.BlockLink.java
License:Apache License
@Override protected void createElement() { setElement(DOM.createDiv()); DOM.appendChild(getElement(), anchorElem = DOM.createAnchor()); }
From source file:cc.alcina.framework.gwt.client.widget.Link.java
License:Apache License
/** * Creates an empty hyperlink./* w w w. ja v a2s . co m*/ */ public Link() { anchorElem = DOM.createAnchor(); createElement(); setStyleName("gwt-Hyperlink alcina-NoHistory"); setHref("#"); }
From source file:ch.systemsx.cisd.openbis.generic.client.web.client.application.renderer.InvalidableWithCodeRenderer.java
License:Apache License
public static String render(IInvalidationProvider entity, String code) { final Element anchor = DOM.createAnchor(); anchor.setInnerText(code);//from w w w .java2s . co m DOM.setElementProperty(anchor, "href", "#"); String link = DOM.toString(anchor); boolean isValid = entity.getInvalidation() == null; if (isValid) { return link; } Element div = DOM.createDiv(); div.setAttribute("class", "invalid"); div.setInnerHTML(link); return DOM.toString(div); }
From source file:ch.systemsx.cisd.openbis.generic.client.web.client.application.renderer.LinkRenderer.java
License:Apache License
/** renders a div with an inline anchor inside (hand cursor is on anchor - inline) */ public static String renderAsLinkWithAnchor(final String text, final String href, final boolean openInNewWindow) { final Element anchor = DOM.createAnchor(); DOM.setInnerText(anchor, text);/*from ww w .j a va 2s . c o m*/ DOM.setElementProperty(anchor, "href", href); if (openInNewWindow) { DOM.setElementProperty(anchor, "target", "blank"); } return DOM.toString(anchor); }
From source file:ch.systemsx.cisd.openbis.generic.client.web.client.application.util.DOMUtils.java
License:Apache License
/** * Creates an <i>HTML</i> link with given <var>href</var>, <var>styleClass</var> and given * <var>title</var>.// ww w . java 2 s. c o m * * @param href if <code>null</code> then no <code>href</code> attribute will be added. * @param styleClass if <code>null</code> then no <code>class</code> attribute will be * added. * @param title if <code>null</code> then no <code>title</code> attribute will be added. */ public final static Element createAnchorElement(final String styleClass, final String href, final String title) { final Element anchor = DOM.createAnchor(); if (styleClass != null) { DOM.setElementAttribute(anchor, "class", styleClass); } if (href != null) { DOM.setElementAttribute(anchor, "href", href); } if (title != null) { DOM.setElementAttribute(anchor, "title", title); } return anchor; }
From source file:com.apress.progwt.client.college.gui.ExternalLink.java
License:Apache License
/** * Creates an empty hyperlink./* www.j av a 2 s .com*/ */ public ExternalLink() { super(DOM.createDiv()); DOM.appendChild(getElement(), anchorElem = DOM.createAnchor()); setStyleName("H-External-Hyperlink"); }
From source file:com.edgenius.wiki.gwt.client.widgets.ClickLink.java
License:Open Source License
public ClickLink() { setElement(DOM.createDiv());/* www .jav a 2 s .c om*/ DOM.appendChild(getElement(), anchorElem = DOM.createAnchor()); sinkEvents(Event.ONCLICK); sinkEvents(Event.ONMOUSEMOVE); sinkEvents(Event.ONMOUSEOUT); sinkEvents(Event.ONMOUSEOVER); setStyleName("gwt-Hyperlink"); DOM.setElementAttribute(anchorElem, "href", "javascript:;"); }