org.gwtbootstrap3.client.ui
Class Alert

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 org.gwtbootstrap3.client.ui.base.ComplexWidget
                      extended by org.gwtbootstrap3.client.ui.html.Div
                          extended by org.gwtbootstrap3.client.ui.Alert
All Implemented Interfaces:
HasAttachHandlers, HasHandlers, EventListener, HasText, HasVisibility, HasWidgets, HasWidgets.ForIsWidget, IndexedPanel, IndexedPanel.ForIsWidget, IsWidget, Iterable<Widget>, HasId, HasInlineStyle, HasPull, HasResponsiveness, HasType<AlertType>

public class Alert
extends Div
implements HasWidgets, HasText, HasType<AlertType>, HasResponsiveness

Alert block.

Use setDismissable(boolean) to add a close ("x") button.

Author:
Sven Jacobs, Joshua Godi
See Also:
AlertCloseEvent, AlertClosedEvent

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.HasWidgets
HasWidgets.ForIsWidget
 
Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.IndexedPanel
IndexedPanel.ForIsWidget
 
Field Summary
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
Alert()
          Builds a default alert
Alert(String text)
          Builds a default alert with the desired text
Alert(String text, AlertType type)
          Builds an alert with the desired text and type
 
Method Summary
 HandlerRegistration addClosedHandler(AlertClosedHandler handler)
          Add a handler to be used when the closed event is fired
 HandlerRegistration addCloseHandler(AlertCloseHandler handler)
          Add a handler to be used when the close event is fired
 void close()
          Closes alert.
 String getText()
          
 AlertType getType()
          Gets the type of the widget
 boolean isDismissable()
          Returns if the alert can be closed or not
protected  void onClose(Event evt)
          Event fired when the close is initiated on the alert
protected  void onClosed(Event evt)
          Event fired when the alert is fully closed (will wait for CSS transitions)
protected  void onLoad()
           
protected  void onUnload()
           
 void setDismissable(boolean dismissable)
          Adds a close button to the alert
 void setText(String text)
          
 void setType(AlertType type)
          Sets the type on the widget
 
Methods inherited from class org.gwtbootstrap3.client.ui.base.ComplexWidget
add, getId, getPull, insert, setColor, setHiddenOn, setId, setMarginBottom, setMarginLeft, setMarginRight, setMarginTop, setPaddingBottom, setPaddingLeft, setPaddingRight, setPaddingTop, setPull, setVisibleOn
 
Methods inherited from class com.google.gwt.user.client.ui.ComplexPanel
add, 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, clear, 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, onAttach, onBrowserEvent, onDetach, removeFromParent, setLayoutData, 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, resolvePotentialElement, 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 com.google.gwt.user.client.ui.HasWidgets
add, clear, iterator, remove
 
Methods inherited from interface org.gwtbootstrap3.client.ui.base.HasResponsiveness
setHiddenOn, setVisibleOn
 

Constructor Detail

Alert

public Alert()
Builds a default alert


Alert

public Alert(String text)
Builds a default alert with the desired text

Parameters:
text - text for the alert

Alert

public Alert(String text,
             AlertType type)
Builds an alert with the desired text and type

Parameters:
text - text for the alert
type - type for the alert
Method Detail

onLoad

protected void onLoad()
Overrides:
onLoad in class Widget

onUnload

protected void onUnload()
Overrides:
onUnload in class Widget

getText

public String getText()

Specified by:
getText in interface HasText

setText

public void setText(String text)

Specified by:
setText in interface HasText

setType

public void setType(AlertType type)
Sets the type on the widget

Specified by:
setType in interface HasType<AlertType>
Parameters:
type - T type

getType

public AlertType getType()
Gets the type of the widget

Specified by:
getType in interface HasType<AlertType>
Returns:
type of the widget

setDismissable

public void setDismissable(boolean dismissable)
Adds a close button to the alert

Parameters:
dismissable - Adds close button when true

isDismissable

public boolean isDismissable()
Returns if the alert can be closed or not

Returns:
true = alert can be closed, false = alert cannot be closed

close

public void close()
Closes alert.


onClose

protected void onClose(Event evt)
Event fired when the close is initiated on the alert

Parameters:
evt - event

onClosed

protected void onClosed(Event evt)
Event fired when the alert is fully closed (will wait for CSS transitions)

Parameters:
evt - event

addCloseHandler

public HandlerRegistration addCloseHandler(AlertCloseHandler handler)
Add a handler to be used when the close event is fired

Parameters:
handler - handler for event
Returns:
handler registration for the handler

addClosedHandler

public HandlerRegistration addClosedHandler(AlertClosedHandler handler)
Add a handler to be used when the closed event is fired

Parameters:
handler - handler for event
Returns:
handler registration for the handler


Copyright © 2015. All rights reserved.