Package com.google.gwt.user.client.ui
Class CaptionPanel
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
- All Implemented Interfaces:
HasAttachHandlers
,HasHandlers
,EventListener
,HasVisibility
,HasWidgets
,HasWidgets.ForIsWidget
,IsRenderable
,IsWidget
,Iterable<Widget>
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.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Implementation class without browser-specific hacks.static class
Implementation class that handles Mozilla rendering issues.static class
Implementation class that handles Safari rendering issues.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.Widget
eventsToSink
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX, MISSING_ELEMENT_ERROR, SETELEMENT_TWICE_ERROR
-
Constructor Summary
ConstructorDescriptionConstructs 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. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Overloaded version for IsWidget.void
Adds a child widget.void
clear()
Removes the content widget.Returns the caption as HTML; note that if the caption was previously set usingsetCaptionText(String)
, the return value is undefined.Returns the caption as text; note that if the caption was previously set usingsetCaptionHTML(String)
, the return value is undefined.Accesses the content widget, if present.iterator()
Iterates over the singular content widget, if present.boolean
Overloaded version for IsWidget.boolean
Removes the specified widget, although in practice the specified widget must be the content widget.void
setCaptionHTML
(SafeHtml html) Sets the caption for the panel using a SafeHtml string.void
setCaptionHTML
(String html) Sets the caption for the panel using an HTML fragment.void
setCaptionText
(String text) Sets the caption for the panel using text that will be automatically escaped.void
Sets or replaces the content widget within the CaptionPanel.Methods inherited from class com.google.gwt.user.client.ui.Composite
claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidget
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, ensureHandlers, fireEvent, getHandlerCount, getHandlerManager, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, replaceElement, setLayoutData, setParent, sinkEvents, unsinkEvents
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, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
CaptionPanel
public CaptionPanel()Constructs a CaptionPanel with an empty caption. -
CaptionPanel
Constructs a CaptionPanel with specified caption text.- Parameters:
captionText
- the text of the caption, which is automatically escaped
-
CaptionPanel
Constructs a CaptionPanel having the specified caption.- Parameters:
caption
- the caption to displayasHTML
- iftrue
, thecaption
param is interpreted as HTML; otherwise,caption
is treated as text and automatically escaped
-
-
Method Details
-
add
Description copied from interface:HasWidgets
Adds a child widget.- Specified by:
add
in interfaceHasWidgets
- Parameters:
w
- the widget to be added
-
add
Overloaded version for IsWidget.- Specified by:
add
in interfaceHasWidgets.ForIsWidget
- See Also:
-
clear
public void clear()Removes the content widget.- Specified by:
clear
in interfaceHasWidgets
-
getCaptionHTML
Returns the caption as HTML; note that if the caption was previously set usingsetCaptionText(String)
, the return value is undefined. -
getCaptionText
Returns the caption as text; note that if the caption was previously set usingsetCaptionHTML(String)
, the return value is undefined. -
getContentWidget
Accesses the content widget, if present.- Returns:
- the content widget specified previously in
setContentWidget(Widget)
-
iterator
Iterates over the singular content widget, if present.- Specified by:
iterator
in interfaceHasWidgets
- Specified by:
iterator
in interfaceIterable<Widget>
-
remove
Removes the specified widget, although in practice the specified widget must be the content widget.- Specified by:
remove
in interfaceHasWidgets
- Parameters:
w
- the widget to remove; note that anything other than the Widget returned bygetContentWidget()
will have no effect- Returns:
true
if the widget was present
-
remove
Overloaded version for IsWidget.- Specified by:
remove
in interfaceHasWidgets.ForIsWidget
- See Also:
-
setCaptionHTML
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 benull
-
setCaptionText
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 benull
-
setContentWidget
Sets or replaces the content widget within the CaptionPanel.- Parameters:
w
- the content widget to be set
-