org.cruxframework.crux.widgets.client.dialog
Class MessageDialog

java.lang.Object
  extended by org.cruxframework.crux.widgets.client.dialog.MessageDialog
All Implemented Interfaces:
com.google.gwt.event.logical.shared.HasCloseHandlers<MessageDialog>, com.google.gwt.event.logical.shared.HasOpenHandlers<MessageDialog>, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.ui.HasAnimation, com.google.gwt.user.client.ui.IsWidget, org.cruxframework.crux.core.client.screen.views.OrientationChangeHandler, HasOkHandlers

public class MessageDialog
extends Object
implements HasOkHandlers, com.google.gwt.user.client.ui.HasAnimation, com.google.gwt.user.client.ui.IsWidget, org.cruxframework.crux.core.client.screen.views.OrientationChangeHandler, com.google.gwt.event.logical.shared.HasCloseHandlers<MessageDialog>, com.google.gwt.event.logical.shared.HasOpenHandlers<MessageDialog>

A simple message dialog box

Author:
Thiago da Rosa de Bustamante

Field Summary
protected  WidgetMessages messages
           
 
Constructor Summary
MessageDialog()
          Constructor
 
Method Summary
 com.google.gwt.event.shared.HandlerRegistration addCloseHandler(com.google.gwt.event.logical.shared.CloseHandler<MessageDialog> handler)
           
static void addDefaultCloseHandler(com.google.gwt.event.logical.shared.CloseHandler<MessageDialog> defaultCloseHandler)
          Add a default close handler that will be appended to each created object
static void addDefaultOpenHandler(com.google.gwt.event.logical.shared.OpenHandler<MessageDialog> defaultOpenHandler)
          Add a default open handler that will be appended to each created object
 com.google.gwt.event.shared.HandlerRegistration addOkHandler(OkHandler handler)
          Adds a handler for the OK button click event
 com.google.gwt.event.shared.HandlerRegistration addOpenHandler(com.google.gwt.event.logical.shared.OpenHandler<MessageDialog> handler)
           
 com.google.gwt.user.client.ui.Widget asWidget()
           
 void fireEvent(com.google.gwt.event.shared.GwtEvent<?> event)
           
 String getDialogTitle()
          Get the dialog box title
 String getMessage()
          Gets the message to be displayed to the user
 String getTitle()
           
 void hide()
          Hides the message dialog
 boolean isAnimationEnabled()
           
 void onOrientationChange()
           
 void setAnimationEnabled(boolean animationEnabled)
           
 void setDialogTitle(String title)
          Set the dialog box title
 void setHeight(String height)
           
 void setMessage(com.google.gwt.safehtml.shared.SafeHtml message)
          Sets the message to be displayed to the user
 void setMessage(String message)
          Sets the message to be displayed to the user
 void setStyleName(String styleName)
           
 void setTitle(com.google.gwt.safehtml.shared.SafeHtml title)
           
 void setTitle(String title)
           
 void setWidth(String width)
           
 void show()
          Show message dilaog.
static MessageDialog show(String title, String message, OkHandler okHandler)
          Shows a message dialog
static MessageDialog show(String title, String message, OkHandler okHandler, String styleName, boolean animationEnabled)
          Shows a message dialog
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

messages

protected WidgetMessages messages
Constructor Detail

MessageDialog

public MessageDialog()
Constructor

Method Detail

getDialogTitle

public String getDialogTitle()
Get the dialog box title

Returns:

setDialogTitle

public void setDialogTitle(String title)
Set the dialog box title

Parameters:
title -

isAnimationEnabled

public boolean isAnimationEnabled()
Specified by:
isAnimationEnabled in interface com.google.gwt.user.client.ui.HasAnimation
See Also:
HasAnimation.isAnimationEnabled()

getMessage

public String getMessage()
Gets the message to be displayed to the user

Returns:
the message

setMessage

public void setMessage(com.google.gwt.safehtml.shared.SafeHtml message)
Sets the message to be displayed to the user

Parameters:
message -

setMessage

public void setMessage(String message)
Sets the message to be displayed to the user

Parameters:
message -

asWidget

public com.google.gwt.user.client.ui.Widget asWidget()
Specified by:
asWidget in interface com.google.gwt.user.client.ui.IsWidget

setStyleName

public void setStyleName(String styleName)
Parameters:
styleName -

setWidth

public void setWidth(String width)
Parameters:
width -

setHeight

public void setHeight(String height)
Parameters:
height -

setTitle

public void setTitle(com.google.gwt.safehtml.shared.SafeHtml title)
Parameters:
title -

setTitle

public void setTitle(String title)
Parameters:
title -

getTitle

public String getTitle()
Returns:

setAnimationEnabled

public void setAnimationEnabled(boolean animationEnabled)
Specified by:
setAnimationEnabled in interface com.google.gwt.user.client.ui.HasAnimation
See Also:
HasAnimation.setAnimationEnabled(boolean)

addOkHandler

public com.google.gwt.event.shared.HandlerRegistration addOkHandler(OkHandler handler)
Adds a handler for the OK button click event

Specified by:
addOkHandler in interface HasOkHandlers

show

public void show()
Show message dilaog. The dialog is centered and the screen is blocked for edition


hide

public void hide()
Hides the message dialog


show

public static MessageDialog show(String title,
                                 String message,
                                 OkHandler okHandler)
Shows a message dialog

Parameters:
title - the text to be displayed as the caption of the message box
message - the text to be displayed in the body of the message box
okHandler - a handler for the OK button click event

show

public static MessageDialog show(String title,
                                 String message,
                                 OkHandler okHandler,
                                 String styleName,
                                 boolean animationEnabled)
Shows a message dialog

Parameters:
title - the text to be displayed as the caption of the message box
message - the text to be displayed in the body of the message box
okHandler - a handler for the OK button click event
styleName - the name of the CSS class to be applied in the message box element
animationEnabled - true to enable animations while showing or hiding the message box

fireEvent

public void fireEvent(com.google.gwt.event.shared.GwtEvent<?> event)
Specified by:
fireEvent in interface com.google.gwt.event.shared.HasHandlers

onOrientationChange

public void onOrientationChange()
Specified by:
onOrientationChange in interface org.cruxframework.crux.core.client.screen.views.OrientationChangeHandler

addCloseHandler

public com.google.gwt.event.shared.HandlerRegistration addCloseHandler(com.google.gwt.event.logical.shared.CloseHandler<MessageDialog> handler)
Specified by:
addCloseHandler in interface com.google.gwt.event.logical.shared.HasCloseHandlers<MessageDialog>

addOpenHandler

public com.google.gwt.event.shared.HandlerRegistration addOpenHandler(com.google.gwt.event.logical.shared.OpenHandler<MessageDialog> handler)
Specified by:
addOpenHandler in interface com.google.gwt.event.logical.shared.HasOpenHandlers<MessageDialog>

addDefaultOpenHandler

public static void addDefaultOpenHandler(com.google.gwt.event.logical.shared.OpenHandler<MessageDialog> defaultOpenHandler)
Add a default open handler that will be appended to each created object

Parameters:
defaultOpenHandler -

addDefaultCloseHandler

public static void addDefaultCloseHandler(com.google.gwt.event.logical.shared.CloseHandler<MessageDialog> defaultCloseHandler)
Add a default close handler that will be appended to each created object

Parameters:
defaultCloseHandler -


Copyright © 2015. All rights reserved.