Package com.google.gwt.user.client.ui
Class DisclosurePanel
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.DisclosurePanel
- All Implemented Interfaces:
HasAttachHandlers,HasCloseHandlers<DisclosurePanel>,HasOpenHandlers<DisclosurePanel>,HasHandlers,EventListener,FiresDisclosureEvents,HasAnimation,HasVisibility,HasWidgets,HasWidgets.ForIsWidget,IsRenderable,IsWidget,Iterable<Widget>
public final class DisclosurePanel
extends Composite
implements FiresDisclosureEvents, HasWidgets.ForIsWidget, HasAnimation, HasOpenHandlers<DisclosurePanel>, HasCloseHandlers<DisclosurePanel>
A widget that consists of a header and a content panel that discloses the
content when a user clicks on the header.
CSS Style Rules
- .gwt-DisclosurePanel
- the panel's primary style
- .gwt-DisclosurePanel-open
- dependent style set when panel is open
- .gwt-DisclosurePanel-closed
- dependent style set when panel is closed
The header and content sections can be easily selected using css with a child
selector:
.gwt-DisclosurePanel-open .header { ... }
Use in UiBinder Templates
DisclosurePanel elements in
UiBinder templates can
have one widget child and one of two types of header elements. A
<g:header> element can hold text (not html), or a <g:customHeader> element
can hold a widget. (Note that the tags of the header elements are not
capitalized. This is meant to signal that the header is not a runtime object,
and so cannot have a ui:field attribute.)
For example:
<g:DisclosurePanel>
<g:header>Text header</g:header>
<g:Label>Widget body</g:Label>
</g:DisclosurePanel>
<g:DisclosurePanel>
<g:customHeader>
<g:Label>Widget header</g:Label>
</g:customHeader>
<g:Label>Widget body</g:Label>
</g:DisclosurePanel>
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static interfaceNested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabledNested 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
eventsToSinkFields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX, MISSING_ELEMENT_ERROR, SETELEMENT_TWICE_ERROR -
Constructor Summary
ConstructorsConstructorDescriptionCreates an empty DisclosurePanel that is initially closed.DisclosurePanel(ImageResource openImage, ImageResource closedImage, String headerText) Creates a DisclosurePanel with the specified header text, an initial open/close state and a bundle of images to be used in the default header widget.DisclosurePanel(DisclosurePanelImages images, String headerText, boolean isOpen) Deprecated.DisclosurePanel(Widget header) Deprecated.useDisclosurePanel()andsetHeader(Widget)DisclosurePanel(Widget header, boolean isOpen) Deprecated.DisclosurePanel(String headerText) Creates a DisclosurePanel that will be initially closed using the specified text in the header.DisclosurePanel(String headerText, boolean isOpen) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionvoidOverloaded version for IsWidget.voidAdds a child widget.addCloseHandler(CloseHandler<DisclosurePanel> handler) Adds aCloseEventhandler.voidaddEventHandler(DisclosureHandler handler) Deprecated.UseaddOpenHandler(OpenHandler)andaddCloseHandler(CloseHandler)insteadaddOpenHandler(OpenHandler<DisclosurePanel> handler) Adds anOpenEventhandler.voidclear()Removes all child widgets.Gets the widget that was previously set insetContent(Widget).Gets the widget that is currently being used as a header.Gets aHasTextinstance to provide access to the headers's text, if the header widget does provide such access.booleanReturns true if animations are enabled, false if not.booleanisOpen()Determines whether the panel is open.iterator()Gets an iterator for the contained widgets.protected voidonEnsureDebugId(String baseID) Affected Elements: -header = the clickable header.booleanOverloaded version for IsWidget.booleanRemoves a child widget.voidremoveEventHandler(DisclosureHandler handler) Deprecated.Use theHandlerRegistration.removeHandler()method on the object returned by an add*Handler method insteadvoidsetAnimationEnabled(boolean enable) Enable or disable animations.voidsetContent(Widget content) Sets the content widget which can be opened and closed by this panel.voidSets the widget used as the header for the panel.voidsetOpen(boolean isOpen) Changes the visible state of thisDisclosurePanel.Methods inherited from class com.google.gwt.user.client.ui.Composite
claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidgetMethods 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, unsinkEventsMethods 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, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.google.gwt.event.shared.HasHandlers
fireEventMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
DisclosurePanel
public DisclosurePanel()Creates an empty DisclosurePanel that is initially closed. -
DisclosurePanel
Deprecated.Creates a DisclosurePanel with the specified header text, an initial open/close state and a bundle of images to be used in the default header widget.- Parameters:
images- a bundle that provides disclosure panel specific imagesheaderText- the text to be displayed in the headerisOpen- the initial open/close state of the content panel
-
DisclosurePanel
Creates a DisclosurePanel with the specified header text, an initial open/close state and a bundle of images to be used in the default header widget.- Parameters:
openImage- the open state image resourceclosedImage- the closed state image resourceheaderText- the text to be displayed in the header
-
DisclosurePanel
Creates a DisclosurePanel that will be initially closed using the specified text in the header.- Parameters:
headerText- the text to be displayed in the header
-
DisclosurePanel
Deprecated.Creates a DisclosurePanel with the specified header text and an initial open/close state.- Parameters:
headerText- the text to be displayed in the headerisOpen- the initial open/close state of the content panel
-
DisclosurePanel
Deprecated.useDisclosurePanel()andsetHeader(Widget)Creates a DisclosurePanel that will be initially closed using a widget as the header.- Parameters:
header- the widget to be used as a header
-
DisclosurePanel
Deprecated.Creates a DisclosurePanel using a widget as the header and an initial open/close state.- Parameters:
header- the widget to be used as a headerisOpen- the initial open/close state of the content panel
-
-
Method Details
-
add
Description copied from interface:HasWidgetsAdds a child widget.- Specified by:
addin interfaceHasWidgets- Parameters:
w- the widget to be added
-
add
Overloaded version for IsWidget.- Specified by:
addin interfaceHasWidgets.ForIsWidget- See Also:
-
addEventHandler
Deprecated.UseaddOpenHandler(OpenHandler)andaddCloseHandler(CloseHandler)insteadAttaches an event handler to the panel to receiveDisclosureEventnotification.- Specified by:
addEventHandlerin interfaceFiresDisclosureEvents- Parameters:
handler- the handler to be added (should not be null)
-
clear
public void clear()Description copied from interface:HasWidgetsRemoves all child widgets.- Specified by:
clearin interfaceHasWidgets
-
getContent
Gets the widget that was previously set insetContent(Widget).- Returns:
- the panel's current content widget
-
getHeader
Gets the widget that is currently being used as a header.- Returns:
- the widget currently being used as a header
-
getHeaderTextAccessor
Gets aHasTextinstance to provide access to the headers's text, if the header widget does provide such access.- Returns:
- a reference to the header widget if it implements
HasText,nullotherwise
-
isAnimationEnabled
public boolean isAnimationEnabled()Description copied from interface:HasAnimationReturns true if animations are enabled, false if not.- Specified by:
isAnimationEnabledin interfaceHasAnimation
-
isOpen
public boolean isOpen()Determines whether the panel is open.- Returns:
trueif panel is in open state
-
iterator
Description copied from interface:HasWidgetsGets an iterator for the contained widgets. This iterator is required to implementIterator.remove().- Specified by:
iteratorin interfaceHasWidgets- Specified by:
iteratorin interfaceIterable<Widget>
-
remove
Description copied from interface:HasWidgetsRemoves a child widget.- Specified by:
removein interfaceHasWidgets- Parameters:
w- the widget to be removed- Returns:
trueif the widget was present
-
remove
Overloaded version for IsWidget.- Specified by:
removein interfaceHasWidgets.ForIsWidget- See Also:
-
removeEventHandler
Deprecated.Use theHandlerRegistration.removeHandler()method on the object returned by an add*Handler method insteadRemoves an event handler from the panel.- Specified by:
removeEventHandlerin interfaceFiresDisclosureEvents- Parameters:
handler- the handler to be removed
-
setAnimationEnabled
public void setAnimationEnabled(boolean enable) Description copied from interface:HasAnimationEnable or disable animations.- Specified by:
setAnimationEnabledin interfaceHasAnimation- Parameters:
enable- true to enable, false to disable
-
setContent
Sets the content widget which can be opened and closed by this panel. If there is a preexisting content widget, it will be detached.- Parameters:
content- the widget to be used as the content panel
-
setHeader
Sets the widget used as the header for the panel.- Parameters:
headerWidget- the widget to be used as the header
-
setOpen
public void setOpen(boolean isOpen) Changes the visible state of thisDisclosurePanel.- Parameters:
isOpen-trueto open the panel,falseto close
-
onEnsureDebugId
Affected Elements:- -header = the clickable header.
- Overrides:
onEnsureDebugIdin classUIObject- Parameters:
baseID- the base ID used by the main element- See Also:
-
DisclosurePanel(ImageResource, ImageResource, String)andsetOpen(boolean)