com.github.gwtbootstrap.client.ui
Class Modal

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.google.gwt.user.client.ui.Panel
              extended by com.google.gwt.user.client.ui.ComplexPanel
                  extended by com.google.gwt.user.client.ui.FlowPanel
                      extended by com.github.gwtbootstrap.client.ui.base.DivWidget
                          extended by com.github.gwtbootstrap.client.ui.Modal
All Implemented Interfaces:
HasStyle, HasVisibleHandlers, IsAnimated, IsResponsive, HasAttachHandlers, HasHandlers, EventListener, HasVisibility, HasWidgets, HasWidgets.ForIsWidget, IndexedPanel, IndexedPanel.ForIsWidget, InsertPanel, InsertPanel.ForIsWidget, IsWidget, Iterable<Widget>

public class Modal
extends DivWidget
implements HasVisibility, HasVisibleHandlers, IsAnimated

Popup dialog with optional header and footer.

By default, all other Modals are closed once a new one is opened. This setting can be overridden.

UiBinder Usage:

 <b:Modal title="My Modal" backdrop="STATIC">
     <g:Label>Modal Content!</g:Label>
     <b:ModalFooter>
         <b:Button icon="FILE">Save</b:Button>
     </b:ModalFooter>
 </b:Modal>
 
 
All arguments are optional.

Since:
2.0.4.0
Author:
Carlos Alexandro Becker, Dominik Mayer
See Also:
Bootstrap documentation, PopupPanel

Nested Class Summary
 
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.InsertPanel
InsertPanel.ForIsWidget
 
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.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
Modal()
          Creates an empty, hidden widget.
Modal(boolean animated)
          Creates an empty, hidden widget with specified show behavior.
Modal(boolean animated, boolean dynamicSafe)
          Creates an empty, hidden widget with specified show behavior.
 
Method Summary
 void add(Widget w)
          
 HandlerRegistration addHiddenHandler(HiddenHandler handler)
          Adds a HiddenEvent handler.
 HandlerRegistration addHideHandler(HideHandler handler)
          Adds a HideEvent handler.
 HandlerRegistration addShowHandler(ShowHandler handler)
          Adds a ShowEvent handler.
 HandlerRegistration addShownHandler(ShownHandler handler)
          Adds a ShownEvent handler.
 boolean getAnimation()
          Gets whether the widget is animated.
 BackdropType getBackdropType()
          Get backdrop type.
 void hide()
          Hides the widget if it was previously shown.
 void insert(Widget w, int beforeIndex)
          
 boolean isKeyboardEnable()
          Get Keyboard enable state
protected  void onAttach()
           
protected  void onHidden()
          This method is called once the widget is completely hidden.
protected  void onHide()
          This method is called immediately when the widget's hide() method is executed.
protected  void onShow()
          This method is called immediately when the widget's show() method is executed.
protected  void onShown()
          This method is called once the widget is completely shown.
protected  void reconfigure()
          Reconfigures the modal with changed settings.
 void setAnimation(boolean animated)
          Sets whether the Widget should be animated.
 void setBackdrop(BackdropType type)
          Sets the type of the backdrop.
 void setCloseVisible(boolean visible)
          Show/Hide close button.
 void setDynamicSafe(boolean dynamicSafe)
          Setup the modal to prevent memory leaks.
 void setHideOthers(boolean hideOthers)
          Sets whether this Modal appears on top of others or is the only one visible on screen.
 void setKeyboard(boolean keyboard)
          Sets whether the Modal is closed when the ESC is pressed.
 void setSize(String width, String height)
          Deprecated. modal do not support setSize method
 void setTitle(String title)
          Sets the title of the Modal.
 void show()
          Shows the widget if it was previously hidden.
 void toggle()
          Toggles the view state of the widget.
 
Methods inherited from class com.github.gwtbootstrap.client.ui.base.DivWidget
addStyle, pullRight, removeStyle, setHideOn, setShowOn, setStyle
 
Methods inherited from class com.google.gwt.user.client.ui.FlowPanel
clear, insert
 
Methods inherited from class com.google.gwt.user.client.ui.ComplexPanel
add, adjustIndex, checkIndexBoundsForAccess, checkIndexBoundsForInsertion, getChildren, getWidget, getWidgetCount, getWidgetIndex, getWidgetIndex, insert, insert, iterator, remove, remove
 
Methods inherited from class com.google.gwt.user.client.ui.Panel
add, adopt, adopt, disown, doAttachChildren, doDetachChildren, orphan, remove
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents
 
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, resolvePotentialElement, setElement, setElement, setHeight, setPixelSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setVisible, setVisible, setWidth, sinkBitlessEvent, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.google.gwt.user.client.ui.InsertPanel.ForIsWidget
add
 
Methods inherited from interface com.google.gwt.user.client.ui.IndexedPanel.ForIsWidget
getWidgetIndex
 
Methods inherited from interface com.google.gwt.user.client.ui.IndexedPanel
getWidget, getWidgetCount, getWidgetIndex, remove
 

Constructor Detail

Modal

public Modal()
Creates an empty, hidden widget.


Modal

public Modal(boolean animated)
Creates an empty, hidden widget with specified show behavior.

Parameters:
animated - true if the widget should be animated.

Modal

public Modal(boolean animated,
             boolean dynamicSafe)
Creates an empty, hidden widget with specified show behavior.

Parameters:
animated - true if the widget should be animated.
dynamicSafe - true removes from RootPanel when hidden
Method Detail

setDynamicSafe

public void setDynamicSafe(boolean dynamicSafe)
Setup the modal to prevent memory leaks. When modal is hidden, will remove all event handlers, and them remove the modal DOM from document DOM. Default is false.

Parameters:
dynamicSafe -

setTitle

public void setTitle(String title)
Sets the title of the Modal.

Overrides:
setTitle in class UIObject
Parameters:
title - the title of the Modal

setAnimation

public void setAnimation(boolean animated)
Sets whether the Widget should be animated.

Specified by:
setAnimation in interface IsAnimated
Parameters:
animated - true if the widget should be animated.

getAnimation

public boolean getAnimation()
Gets whether the widget is animated.

Specified by:
getAnimation in interface IsAnimated
Returns:
true if the widget is animated

setHideOthers

public void setHideOthers(boolean hideOthers)
Sets whether this Modal appears on top of others or is the only one visible on screen.

Parameters:
hideOthers - true to make sure that this modal is the only one shown. All others will be hidden. Default: true

setKeyboard

public void setKeyboard(boolean keyboard)
Sets whether the Modal is closed when the ESC is pressed.

Parameters:
keyboard - true if the Modal is closed by ESC key. Default: true

isKeyboardEnable

public boolean isKeyboardEnable()
Get Keyboard enable state

Returns:
true:enable false:disable

setBackdrop

public void setBackdrop(BackdropType type)
Sets the type of the backdrop.

Parameters:
type - the backdrop type

getBackdropType

public BackdropType getBackdropType()
Get backdrop type.

Returns:
backdrop type.

reconfigure

protected void reconfigure()
Reconfigures the modal with changed settings.


add

public void add(Widget w)

Specified by:
add in interface HasWidgets
Specified by:
add in interface InsertPanel
Overrides:
add in class FlowPanel

insert

public void insert(Widget w,
                   int beforeIndex)

Specified by:
insert in interface InsertPanel
Overrides:
insert in class FlowPanel

show

public void show()
Shows the widget if it was previously hidden.


onAttach

protected void onAttach()
Overrides:
onAttach in class Widget

hide

public void hide()
Hides the widget if it was previously shown.


toggle

public void toggle()
Toggles the view state of the widget.

It will be hidden if it was previously shown and shown if it was previously hidden.


onHide

protected void onHide()
This method is called immediately when the widget's hide() method is executed.


onHidden

protected void onHidden()
This method is called once the widget is completely hidden.


onShow

protected void onShow()
This method is called immediately when the widget's show() method is executed.


onShown

protected void onShown()
This method is called once the widget is completely shown.


addHideHandler

public HandlerRegistration addHideHandler(HideHandler handler)
Adds a HideEvent handler.

Specified by:
addHideHandler in interface HasVisibleHandlers
Parameters:
handler - the hide handler
Returns:
HandlerRegistration used to remove this handler

addHiddenHandler

public HandlerRegistration addHiddenHandler(HiddenHandler handler)
Adds a HiddenEvent handler.

Specified by:
addHiddenHandler in interface HasVisibleHandlers
Parameters:
handler - the hidden handler
Returns:
HandlerRegistration used to remove this handler

addShowHandler

public HandlerRegistration addShowHandler(ShowHandler handler)
Adds a ShowEvent handler.

Specified by:
addShowHandler in interface HasVisibleHandlers
Parameters:
handler - the show handler
Returns:
HandlerRegistration used to remove this handler

addShownHandler

public HandlerRegistration addShownHandler(ShownHandler handler)
Adds a ShownEvent handler.

Specified by:
addShownHandler in interface HasVisibleHandlers
Parameters:
handler - the shown handler
Returns:
HandlerRegistration used to remove this handler

setCloseVisible

public void setCloseVisible(boolean visible)
Show/Hide close button. The Modal must have a title.

Parameters:
visible - true for show and false to hide. Defaults is true.

setSize

public void setSize(String width,
                    String height)
Deprecated. modal do not support setSize method

Overrides:
setSize in class UIObject


Copyright © 2012 gwtbootstrap. All Rights Reserved.