com.maryanovsky.gwtutils.client.ui
Class PlainHyperlink

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.google.gwt.user.client.ui.Panel
              extended by com.google.gwt.user.client.ui.SimplePanel
                  extended by com.maryanovsky.gwtutils.client.ui.PlainHyperlink
All Implemented Interfaces:
HasHandlers, EventListener, HasWidgets, Iterable<Widget>

public class PlainHyperlink
extends SimplePanel

A plain HTML hyperlink, you know, the normal kind, which opens a URL when clicked.

Author:
Maryanovsky Alexander

Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
 
Field Summary
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
PlainHyperlink()
          Creates a new PlainHyperlink, not yet pointing anywhere.
PlainHyperlink(String url)
          Creates a new PlainHyperlink pointing to the specified URL, with the specified content widget.
PlainHyperlink(String url, String content)
          A convenience constructor for creating a really plain link, whose content is just text.
 
Method Summary
protected  Element getContainerElement()
          Returns the anchor element.
 Widget getContent()
          Returns the content of the link - the widget which may be clicked to follow to the URL.
 String getUrl()
          Returns the URL the link points to.
 void setContent(String content)
          A convenience method which sets the content of the link to be a simple Label with the specified text.
 void setContent(Widget content)
          Sets the content of the link - the widget which may be clicked to follow to the URL.
 void setTarget(String target)
          Sets the target attribute of the hyperlink to the specified value.
 void setUrl(String url)
          Sets the URL the link points to (the href attribute of the anchor).
 
Methods inherited from class com.google.gwt.user.client.ui.SimplePanel
add, getWidget, iterator, remove, setWidget
 
Methods inherited from class com.google.gwt.user.client.ui.Panel
adopt, adopt, clear, disown, doAttachChildren, doDetachChildren, onLoad, onUnload, orphan
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addDomHandler, addHandler, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, removeFromParent, setLayoutData, sinkEvents
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PlainHyperlink

public PlainHyperlink()
Creates a new PlainHyperlink, not yet pointing anywhere.


PlainHyperlink

public PlainHyperlink(String url)
Creates a new PlainHyperlink pointing to the specified URL, with the specified content widget.

Parameters:
url - The URL to open when the hyperlink is clicked. May be null, in which case it should be set later.

PlainHyperlink

public PlainHyperlink(String url,
                      String content)
A convenience constructor for creating a really plain link, whose content is just text.

Parameters:
url - The URL to open when the hyperlink is clicked.
content - The linked text.
Method Detail

getContainerElement

protected Element getContainerElement()
Returns the anchor element.

Overrides:
getContainerElement in class SimplePanel

setUrl

public void setUrl(String url)
Sets the URL the link points to (the href attribute of the anchor). A null value removes the attribute.


getUrl

public String getUrl()
Returns the URL the link points to.


setContent

public void setContent(Widget content)
Sets the content of the link - the widget which may be clicked to follow to the URL.


setContent

public void setContent(String content)
A convenience method which sets the content of the link to be a simple Label with the specified text.


getContent

public Widget getContent()
Returns the content of the link - the widget which may be clicked to follow to the URL.


setTarget

public void setTarget(String target)
Sets the target attribute of the hyperlink to the specified value. Specifying null removes the attribute.