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:
HasAttachHandlers, HasHandlers, EventListener, AcceptsOneWidget, HasOneWidget, HasVisibility, HasWidgets, HasWidgets.ForIsWidget, IsWidget, 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
 
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasWidgets
HasWidgets.ForIsWidget
 
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.
PlainHyperlink(String url, String content)
          A convenience constructor for creating a really plain link, whose content is just text.
PlainHyperlink(String url, Widget content)
          Creates a new PlainHyperlink to point to the specified URL and contain the specified widget.
 
Method Summary
 AnchorElement getAnchor()
          Returns the AnchorElement this PlainHyperlink wraps.
 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, getContainerElement, getWidget, iterator, remove, setWidget, setWidget
 
Methods inherited from class com.google.gwt.user.client.ui.Panel
add, adopt, adopt, clear, disown, doAttachChildren, doDetachChildren, orphan, remove
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, 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, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, 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.

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.

PlainHyperlink

public PlainHyperlink(String url,
                      Widget content)
Creates a new PlainHyperlink to point to the specified URL and contain the specified widget.

Method Detail

getAnchor

public AnchorElement getAnchor()
Returns the AnchorElement this PlainHyperlink wraps.


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.