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

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.Label
              extended bycom.google.gwt.user.client.ui.HTML
All Implemented Interfaces:
EventListener, HasHorizontalAlignment, HasHTML, HasText, HasWordWrap, SourcesClickEvents, SourcesMouseEvents

public class HTML
extends Label
implements HasHTML

A widget that can contain arbitrary HTML.

If you only need a simple label (text, but not HTML), then the Label widget is more appropriate, as it disallows the use of HTML, which can lead to potential security issues if not used properly.

CSS Style Rules

Example

code


Nested Class Summary
 
Nested classes inherited from class com.google.gwt.user.client.ui.HasHorizontalAlignment
HasHorizontalAlignment.HorizontalAlignmentConstant
 
Field Summary
 
Fields inherited from class java.lang.Object
typeId, typeName
 
Fields inherited from interface com.google.gwt.user.client.ui.HasHorizontalAlignment
ALIGN_CENTER, ALIGN_LEFT, ALIGN_RIGHT
 
Constructor Summary
HTML()
          Creates an empty HTML widget.
HTML(String html)
          Creates an HTML widget with the specified HTML contents.
HTML(String html, boolean wordWrap)
          Creates an HTML widget with the specified contents, optionally treating it as HTML, and optionally disabling word wrapping.
 
Method Summary
 String getHTML()
          Gets this object's contents as HTML.
 void setHTML(String html)
          Sets this object's contents via HTML.
 
Methods inherited from class com.google.gwt.user.client.ui.Label
addClickListener, addMouseListener, getHorizontalAlignment, getText, getWordWrap, onBrowserEvent, removeClickListener, removeMouseListener, setHorizontalAlignment, setText, setWordWrap
 
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
 
Methods inherited from interface com.google.gwt.user.client.ui.HasText
getText, setText
 

Constructor Detail

HTML

public HTML()
Creates an empty HTML widget.


HTML

public HTML(String html)
Creates an HTML widget with the specified HTML contents.

Parameters:
html - the new widget's HTML contents

HTML

public HTML(String html,
            boolean wordWrap)
Creates an HTML widget with the specified contents, optionally treating it as HTML, and optionally disabling word wrapping.

Parameters:
html - the widget's contents
wordWrap - false to disable word wrapping
Method Detail

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

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


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