com.google.gwt.user.client.ui
Class Hyperlink

java.lang.Object
  extended bycom.google.gwt.user.client.ui.UIObject
      extended bycom.google.gwt.user.client.ui.Widget
          extended bycom.google.gwt.user.client.ui.Hyperlink
All Implemented Interfaces:
EventListener, HasHTML, HasText, SourcesClickEvents

public class Hyperlink
extends Widget
implements HasHTML, SourcesClickEvents

A widget that serves as an "internal" hyperlink. That is, it is a link to another state of the running application. When clicked, it will create a new history frame using History.newItem(java.lang.String), but without reloading the page.

Being a true hyperlink, it is also possible for the user to "right-click, open link in new window", which will cause the application to be loaded in a new window at the state specified by the hyperlink.

CSS Style Rules

Example

code


Field Summary
 
Fields inherited from class java.lang.Object
typeId, typeName
 
Constructor Summary
Hyperlink()
          Creates an empty hyperlink.
Hyperlink(String text, boolean asHTML, String targetHistoryToken)
          Creates a hyperlink with its text and target history token specified.
Hyperlink(String text, String targetHistoryToken)
          Creates a hyperlink with its text and target history token specified.
 
Method Summary
 void addClickListener(ClickListener listener)
          Adds a listener interface to receive click events.
 String getHTML()
          Gets this object's contents as HTML.
 String getTargetHistoryToken()
          Gets the history token referenced by this hyperlink.
 String getText()
          Gets this object's text.
 void onBrowserEvent(Event event)
          Fired whenever a browser event is received.
 void removeClickListener(ClickListener listener)
          Removes a previously added listener interface.
 void setHTML(String html)
          Sets this object's contents via HTML.
 void setTargetHistoryToken(String targetHistoryToken)
          Sets the history token referenced by this hyperlink.
 void setText(String text)
          Sets this object's text.
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
getParent, isAttached, onAttach, onDetach, onLoad
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleName, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleName, isVisible, isVisible, removeStyleName, setElement, setHeight, setPixelSize, setSize, setStyleName, setStyleName, setVisible, setVisible, setWidth, sinkEvents, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
equals, finalize, hashCode
 

Constructor Detail

Hyperlink

public Hyperlink()
Creates an empty hyperlink.


Hyperlink

public Hyperlink(String text,
                 boolean asHTML,
                 String targetHistoryToken)
Creates a hyperlink with its text and target history token specified.

Parameters:
text - the hyperlink's text
asHTML - true to treat the specified text as html
targetHistoryToken - the history token to which it will link
See Also:
setTargetHistoryToken(java.lang.String)

Hyperlink

public Hyperlink(String text,
                 String targetHistoryToken)
Creates a hyperlink with its text and target history token specified.

Parameters:
text - the hyperlink's text
targetHistoryToken - the history token to which it will link
Method Detail

addClickListener

public void addClickListener(ClickListener listener)
Description copied from interface: SourcesClickEvents
Adds a listener interface to receive click events.

Specified by:
addClickListener in interface SourcesClickEvents
Parameters:
listener - the listener interface to add

getHTML

public String getHTML()
Description copied from interface: HasHTML
Gets this object's contents as HTML.

Specified by:
getHTML in interface HasHTML
Returns:
the object's HTML

getTargetHistoryToken

public String getTargetHistoryToken()
Gets the history token referenced by this hyperlink.

Returns:
the target history token
See Also:
setTargetHistoryToken(java.lang.String)

getText

public String getText()
Description copied from interface: HasText
Gets this object's text.

Specified by:
getText in interface HasText
Returns:
the object's text

onBrowserEvent

public void onBrowserEvent(Event event)
Description copied from interface: EventListener
Fired whenever a browser event is received.

Specified by:
onBrowserEvent in interface EventListener
Overrides:
onBrowserEvent in class Widget

removeClickListener

public void removeClickListener(ClickListener listener)
Description copied from interface: SourcesClickEvents
Removes a previously added listener interface.

Specified by:
removeClickListener in interface SourcesClickEvents
Parameters:
listener - the listener interface to remove

setHTML

public void setHTML(String html)
Description copied from interface: HasHTML
Sets this object's contents via HTML. Use care when setting an object's HTML; it is an easy way to expose script-based security problems. Consider using HasText.setText(java.lang.String) whenever possible.

Specified by:
setHTML in interface HasHTML
Parameters:
html - the object's new HTML

setTargetHistoryToken

public void setTargetHistoryToken(String targetHistoryToken)
Sets the history token referenced by this hyperlink. This is the history token that will be passed to History.newItem(java.lang.String) when this link is clicked.

Parameters:
targetHistoryToken - the new target history token

setText

public void setText(String text)
Description copied from interface: HasText
Sets this object's text.

Specified by:
setText in interface HasText


This javadoc distribution was not produced by Google. The official documentation is here.