de.matthiasmann.twl
Class SimpleDialog

java.lang.Object
  extended by de.matthiasmann.twl.SimpleDialog

public class SimpleDialog
extends java.lang.Object

A simple modal popup dialog utility


Constructor Summary
SimpleDialog()
           
 
Method Summary
 java.lang.Runnable getCancelCallback()
           
 java.lang.Object getMessage()
           
 java.lang.Runnable getOkCallback()
           
 java.lang.String getTitle()
           
 boolean isFocusCancelButton()
           
 void setCancelCallback(java.lang.Runnable cbCancel)
          Sets the callback to call when "Cancel" was clicked.
 void setFocusCancelButton(boolean focusCancelButton)
          Should the cancel button be focused when the dialog is created? Default is false (eg focus the message or the OK button).
 void setMessage(java.lang.Object msg)
          Sets a message object which is displayed below the title.
 void setOkCallback(java.lang.Runnable cbOk)
          Sets the callback to call when "Ok" was clicked.
 void setTheme(java.lang.String theme)
           
 void setTitle(java.lang.String title)
          Sets the title for this dialog, can be null Default is null
 PopupWindow showDialog(Widget owner)
          Shows the dialog centered
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleDialog

public SimpleDialog()
Method Detail

setTheme

public void setTheme(java.lang.String theme)

getTitle

public java.lang.String getTitle()

setTitle

public void setTitle(java.lang.String title)
Sets the title for this dialog, can be null Default is null

Parameters:
title - the title

getMessage

public java.lang.Object getMessage()

setMessage

public void setMessage(java.lang.Object msg)
Sets a message object which is displayed below the title. Can be a String or a Widget. Default is null

Parameters:
msg - the message object, can be null

getOkCallback

public java.lang.Runnable getOkCallback()

setOkCallback

public void setOkCallback(java.lang.Runnable cbOk)
Sets the callback to call when "Ok" was clicked. The dialog is closed before the callback is fired.

Parameters:
cbOk - the callback or null

getCancelCallback

public java.lang.Runnable getCancelCallback()

setCancelCallback

public void setCancelCallback(java.lang.Runnable cbCancel)
Sets the callback to call when "Cancel" was clicked. The dialog is closed before the callback is fired.

Parameters:
cbCancel - the callback or null

isFocusCancelButton

public boolean isFocusCancelButton()

setFocusCancelButton

public void setFocusCancelButton(boolean focusCancelButton)
Should the cancel button be focused when the dialog is created? Default is false (eg focus the message or the OK button).

Parameters:
focusCancelButton - true to focus the cancel button

showDialog

public PopupWindow showDialog(Widget owner)
Shows the dialog centered

Parameters:
owner - The owner of the dialog
Returns:
the PopupWindow object to close the dialog ealier