public final class DisclosurePanel extends Composite implements FiresDisclosureEvents, HasWidgets.ForIsWidget, HasAnimation, HasOpenHandlers<DisclosurePanel>, HasCloseHandlers<DisclosurePanel>
The header and content sections can be easily selected using css with a child
selector:
.gwt-DisclosurePanel-open .header { ... }
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>
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
HasWidgets.ForIsWidget
DEBUG_ID_PREFIX
Constructor and Description |
---|
DisclosurePanel()
Creates an empty DisclosurePanel that is initially closed.
|
DisclosurePanel(DisclosurePanelImages images,
String headerText,
boolean isOpen)
Deprecated.
|
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(String headerText)
Creates a DisclosurePanel that will be initially closed using the specified
text in the header.
|
DisclosurePanel(String headerText,
boolean isOpen)
Deprecated.
|
DisclosurePanel(Widget header)
Deprecated.
use
DisclosurePanel() and setHeader(Widget) |
DisclosurePanel(Widget header,
boolean isOpen)
Deprecated.
use
DisclosurePanel() , setOpen(boolean) and
setHeader(Widget) instead |
Modifier and Type | Method and Description |
---|---|
void |
add(IsWidget w)
Overloaded version for IsWidget.
|
void |
add(Widget w)
Adds a child widget.
|
HandlerRegistration |
addCloseHandler(CloseHandler<DisclosurePanel> handler)
Adds a
CloseEvent handler. |
void |
addEventHandler(DisclosureHandler handler)
Deprecated.
Use
addOpenHandler(OpenHandler) and
addCloseHandler(CloseHandler) instead |
HandlerRegistration |
addOpenHandler(OpenHandler<DisclosurePanel> handler)
Adds an
OpenEvent handler. |
void |
clear()
Removes all child widgets.
|
Widget |
getContent()
Gets the widget that was previously set in
setContent(Widget) . |
Widget |
getHeader()
Gets the widget that is currently being used as a header.
|
HasText |
getHeaderTextAccessor()
Gets a
HasText instance to provide access to the headers's text, if
the header widget does provide such access. |
boolean |
isAnimationEnabled()
Returns true if animations are enabled, false if not.
|
boolean |
isOpen()
Determines whether the panel is open.
|
Iterator<Widget> |
iterator()
Gets an iterator for the contained widgets.
|
protected void |
onEnsureDebugId(String baseID)
Affected Elements:
-header = the clickable header.
|
boolean |
remove(IsWidget w)
Overloaded version for IsWidget.
|
boolean |
remove(Widget w)
Removes a child widget.
|
void |
removeEventHandler(DisclosureHandler handler)
Deprecated.
Use the
HandlerRegistration.removeHandler() method on the
object returned by an add*Handler method instead |
void |
setAnimationEnabled(boolean enable)
Enable or disable animations.
|
void |
setContent(Widget content)
Sets the content widget which can be opened and closed by this panel.
|
void |
setHeader(Widget headerWidget)
Sets the widget used as the header for the panel.
|
void |
setOpen(boolean isOpen)
Changes the visible state of this
DisclosurePanel . |
claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
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, toString
fireEvent
public DisclosurePanel()
@Deprecated public DisclosurePanel(DisclosurePanelImages images, String headerText, boolean isOpen)
DisclosurePanel(ImageResource, ImageResource, String)
and setOpen(boolean)
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 panelpublic DisclosurePanel(ImageResource openImage, ImageResource closedImage, String headerText)
openImage
- the open state image resourceclosedImage
- the closed state image resourceheaderText
- the text to be displayed in the headerpublic DisclosurePanel(String headerText)
headerText
- the text to be displayed in the header@Deprecated public DisclosurePanel(String headerText, boolean isOpen)
DisclosurePanel(String)
and
setOpen(boolean)
headerText
- the text to be displayed in the headerisOpen
- the initial open/close state of the content panel@Deprecated public DisclosurePanel(Widget header)
DisclosurePanel()
and setHeader(Widget)
header
- the widget to be used as a header@Deprecated public DisclosurePanel(Widget header, boolean isOpen)
DisclosurePanel()
, setOpen(boolean)
and
setHeader(Widget)
insteadheader
- the widget to be used as a headerisOpen
- the initial open/close state of the content panelpublic void add(Widget w)
HasWidgets
add
in interface HasWidgets
w
- the widget to be addedpublic void add(IsWidget w)
add
in interface HasWidgets.ForIsWidget
add(Widget)
public HandlerRegistration addCloseHandler(CloseHandler<DisclosurePanel> handler)
HasCloseHandlers
CloseEvent
handler.addCloseHandler
in interface HasCloseHandlers<DisclosurePanel>
handler
- the handler@Deprecated public void addEventHandler(DisclosureHandler handler)
addOpenHandler(OpenHandler)
and
addCloseHandler(CloseHandler)
insteadDisclosureEvent
notification.addEventHandler
in interface FiresDisclosureEvents
handler
- the handler to be added (should not be null)public HandlerRegistration addOpenHandler(OpenHandler<DisclosurePanel> handler)
HasOpenHandlers
OpenEvent
handler.addOpenHandler
in interface HasOpenHandlers<DisclosurePanel>
handler
- the handlerpublic void clear()
HasWidgets
clear
in interface HasWidgets
public Widget getContent()
setContent(Widget)
.public Widget getHeader()
public HasText getHeaderTextAccessor()
HasText
instance to provide access to the headers's text, if
the header widget does provide such access.HasText
,
null
otherwisepublic boolean isAnimationEnabled()
HasAnimation
isAnimationEnabled
in interface HasAnimation
public boolean isOpen()
true
if panel is in open statepublic Iterator<Widget> iterator()
HasWidgets
Iterator.remove()
.iterator
in interface HasWidgets
iterator
in interface Iterable<Widget>
public boolean remove(Widget w)
HasWidgets
remove
in interface HasWidgets
w
- the widget to be removedtrue
if the widget was presentpublic boolean remove(IsWidget w)
remove
in interface HasWidgets.ForIsWidget
remove(Widget)
@Deprecated public void removeEventHandler(DisclosureHandler handler)
HandlerRegistration.removeHandler()
method on the
object returned by an add*Handler method insteadremoveEventHandler
in interface FiresDisclosureEvents
handler
- the handler to be removedpublic void setAnimationEnabled(boolean enable)
HasAnimation
setAnimationEnabled
in interface HasAnimation
enable
- true to enable, false to disablepublic void setContent(Widget content)
content
- the widget to be used as the content panelpublic void setHeader(Widget headerWidget)
headerWidget
- the widget to be used as the headerpublic void setOpen(boolean isOpen)
DisclosurePanel
.isOpen
- true
to open the panel, false
to
closeprotected void onEnsureDebugId(String baseID)
onEnsureDebugId
in class UIObject
baseID
- the base ID used by the main elementUIObject.onEnsureDebugId(String)
Copyright © 2018. All rights reserved.