public class Modal extends Div implements IsClosable
<b:Modal title="Important information" b:id="modal1">
<b:ModalBody>
<g:HTML>Lorem ipsum...</g:HTML>
</b:ModalBody>
<b:ModalFooter>
<b:Button type="PRIMARY">Do something</b:Button>
<b:Button type="DANGER" dismiss="MODAL">Close</b:Button>
</b:ModalFooter>
</b:Modal>
<b:Button target="#modal1" toggle="MODAL">Show modal</b:Button>
It's also possible to specify a custom modal header:
<b:Modal>
<b:ModalHeader>
<g:HTML>
<h4>Custom header</h4>
</g:HTML>
</b:ModalHeader>
...
</b:Modal>
ModalHeader
,
ModalBody
,
ModalFooter
,
ModalShowEvent
,
ModalShownEvent
,
ModalHideEvent
,
ModalHiddenEvent
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
IndexedPanel.ForIsWidget
HasWidgets.ForIsWidget
DEBUG_ID_PREFIX
Constructor and Description |
---|
Modal() |
Modifier and Type | Method and Description |
---|---|
void |
add(Widget w) |
HandlerRegistration |
addHiddenHandler(ModalHiddenHandler modalHiddenHandler) |
HandlerRegistration |
addHideHandler(ModalHideHandler modalHideHandler) |
HandlerRegistration |
addShowHandler(ModalShowHandler modalShowHandler) |
HandlerRegistration |
addShownHandler(ModalShownHandler modalShownHandler) |
void |
hide() |
boolean |
isClosable() |
protected void |
onHidden(Event evt)
Can be override by subclasses to handle Modal's "hidden" event however
it's recommended to add an event handler to the modal.
|
protected void |
onHide(Event evt)
Can be override by subclasses to handle Modal's "hide" event however it's
recommended to add an event handler to the modal.
|
protected void |
onLoad() |
protected void |
onShow(Event evt)
Can be override by subclasses to handle Modal's "show" event however it's
recommended to add an event handler to the modal.
|
protected void |
onShown(Event evt)
Can be override by subclasses to handle Modal's "shown" event however
it's recommended to add an event handler to the modal.
|
protected void |
onUnload() |
void |
setClosable(boolean closable) |
void |
setDataBackdrop(ModalBackdrop backdrop)
Sets backdrop of modal.
|
void |
setDataKeyboard(boolean keyboard) |
void |
setFade(boolean fade)
If set Modal will fade in/out.
|
void |
setHideOtherModals(boolean hideOtherModals)
If set to true, when the modal is shown it will force hide all other modals
|
void |
setRemoveOnHide(boolean removeOnHide)
If set to true, will remove the modal from the DOM completely and unbind any events to the modal
|
void |
setSize(ModalSize size) |
void |
setTitle(String title) |
void |
setWidth(String width) |
void |
show() |
void |
toggle() |
getId, getPull, insert, insert, remove, setColor, setHiddenOn, setId, setMarginBottom, setMarginLeft, setMarginRight, setMarginTop, setPaddingBottom, setPaddingLeft, setPaddingRight, setPaddingTop, setPull, setVisibleOn
add, add, adjustIndex, checkIndexBoundsForAccess, checkIndexBoundsForInsertion, getChildren, getWidget, getWidgetCount, getWidgetIndex, getWidgetIndex, insert, iterator, remove
add, adopt, clear, doAttachChildren, doDetachChildren, orphan, remove
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onBrowserEvent, onDetach, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setVisible, setVisible, sinkBitlessEvent, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEach, spliterator
public Modal()
public void add(Widget w)
ComplexWidget
add
in interface HasWidgets
add
in class ComplexWidget
public void setClosable(boolean closable)
setClosable
in interface IsClosable
public boolean isClosable()
isClosable
in interface IsClosable
public void setHideOtherModals(boolean hideOtherModals)
hideOtherModals
- - true to force hide other modals, false to keep them shownpublic void setRemoveOnHide(boolean removeOnHide)
removeOnHide
- - true to remove modal and unbind events on hide, false to keep it in the DOMpublic void setFade(boolean fade)
fade
- If true
modal will fade in/outpublic void setDataBackdrop(ModalBackdrop backdrop)
backdrop
- Backdrop of modalModalBackdrop
public void setDataKeyboard(boolean keyboard)
public void toggle()
public void show()
public void hide()
public HandlerRegistration addShowHandler(ModalShowHandler modalShowHandler)
public HandlerRegistration addShownHandler(ModalShownHandler modalShownHandler)
public HandlerRegistration addHideHandler(ModalHideHandler modalHideHandler)
public HandlerRegistration addHiddenHandler(ModalHiddenHandler modalHiddenHandler)
protected void onShow(Event evt)
evt
- EventModalShowEvent
protected void onShown(Event evt)
evt
- EventModalShownEvent
protected void onHide(Event evt)
evt
- EventModalHideEvent
protected void onHidden(Event evt)
evt
- EventModalHiddenEvent
Copyright © 2017. All rights reserved.