public class

CaptionPanel

extends Composite
implements HasWidgets
java.lang.Object
   ↳ com.google.gwt.user.client.ui.UIObject
     ↳ com.google.gwt.user.client.ui.Widget
       ↳ com.google.gwt.user.client.ui.Composite
         ↳ com.google.gwt.user.client.ui.CaptionPanel

Class Overview

A panel that wraps its contents in a border with a caption that appears in the upper left corner of the border. This is an implementation of the fieldset HTML element.

Summary

Nested Classes
class CaptionPanel.CaptionPanelImpl Implementation class without browser-specific hacks. 
class CaptionPanel.CaptionPanelImplMozilla Implementation class that handles Mozilla rendering issues. 
class CaptionPanel.CaptionPanelImplSafari Implementation class that handles Safari rendering issues. 
[Expand]
Inherited Constants
From class com.google.gwt.user.client.ui.UIObject
Public Constructors
CaptionPanel()
Constructs a CaptionPanel with an empty caption.
CaptionPanel(SafeHtml caption)
Constructs a CaptionPanel with specified caption text.
CaptionPanel(String captionText)
Constructs a CaptionPanel with specified caption text.
CaptionPanel(String caption, boolean asHTML)
Constructs a CaptionPanel having the specified caption.
Public Methods
void add(Widget w)
Adds a child widget.
void clear()
Removes the content widget.
String getCaptionHTML()
Returns the caption as HTML; note that if the caption was previously set using setCaptionText(String), the return value is undefined.
String getCaptionText()
Returns the caption as text; note that if the caption was previously set using setCaptionHTML(String), the return value is undefined.
Widget getContentWidget()
Accesses the content widget, if present.
Iterator<Widget> iterator()
Iterates over the singular content widget, if present.
boolean remove(Widget w)
Removes the specified widget, although in practice the specified widget must be the content widget.
void setCaptionHTML(String html)
Sets the caption for the panel using an HTML fragment.
void setCaptionHTML(SafeHtml html)
Sets the caption for the panel using a SafeHtml string.
void setCaptionText(String text)
Sets the caption for the panel using text that will be automatically escaped.
void setContentWidget(Widget w)
Sets or replaces the content widget within the CaptionPanel.
[Expand]
Inherited Methods
From class com.google.gwt.user.client.ui.Composite
From class com.google.gwt.user.client.ui.Widget
From class com.google.gwt.user.client.ui.UIObject
From class java.lang.Object
From interface com.google.gwt.event.logical.shared.HasAttachHandlers
From interface com.google.gwt.event.shared.HasHandlers
From interface com.google.gwt.user.client.EventListener
From interface com.google.gwt.user.client.ui.HasWidgets
From interface com.google.gwt.user.client.ui.IsWidget
From interface java.lang.Iterable

Public Constructors

public CaptionPanel ()

Constructs a CaptionPanel with an empty caption.

public CaptionPanel (SafeHtml caption)

Constructs a CaptionPanel with specified caption text.

Parameters
caption the text of the caption

public CaptionPanel (String captionText)

Constructs a CaptionPanel with specified caption text.

Parameters
captionText the text of the caption, which is automatically escaped

public CaptionPanel (String caption, boolean asHTML)

Constructs a CaptionPanel having the specified caption.

Parameters
caption the caption to display
asHTML if true, the caption param is interpreted as HTML; otherwise, caption is treated as text and automatically escaped

Public Methods

public void add (Widget w)

Adds a child widget.

Parameters
w the widget to be added

public void clear ()

Removes the content widget.

public String getCaptionHTML ()

Returns the caption as HTML; note that if the caption was previously set using setCaptionText(String), the return value is undefined.

public String getCaptionText ()

Returns the caption as text; note that if the caption was previously set using setCaptionHTML(String), the return value is undefined.

public Widget getContentWidget ()

Accesses the content widget, if present.

Returns

public Iterator<Widget> iterator ()

Iterates over the singular content widget, if present.

public boolean remove (Widget w)

Removes the specified widget, although in practice the specified widget must be the content widget.

Parameters
w the widget to remove; note that anything other than the Widget returned by getContentWidget() will have no effect
Returns
  • true if the widget was present

public void setCaptionHTML (String html)

Sets the caption for the panel using an HTML fragment. Pass in empty string to remove the caption completely, leaving just the unadorned panel.

Parameters
html HTML for the new caption; must not be null

public void setCaptionHTML (SafeHtml html)

Sets the caption for the panel using a SafeHtml string.

Parameters
html HTML for the new caption; must not be null

public void setCaptionText (String text)

Sets the caption for the panel using text that will be automatically escaped. Pass in empty string to remove the caption completely, leaving just the unadorned panel.

Parameters
text text for the new caption; must not be null

public void setContentWidget (Widget w)

Sets or replaces the content widget within the CaptionPanel.

Parameters
w the content widget to be set