DialogBean is a ContainerBean and has a pageContent with regions. Its content and layout can be configured in conf/containers.xml. By default it has three regions: 0, 1, 2. Region 0 for query, region 1 for query results, and region 2 for multiple entity selections. Its layout code is:

For mobile, it can be border layout. For example, put region 0(query) in the left panel.

There are two ways to open a dialog:

	public DialogBean getDialogBean(boolean create)
	public DialogBean newDialogBean()
For example, open a new dialog from current containerBean, and add a bean into region 2:

	ContainerBean containerBean = ...;
	DialogBean dialogBean = containerBean.newDialogBean();
	EntityBackingBean bean = ContainerBean.createEntityBackingBean(..., dialogBean);
	dialogBean.showBean(bean, 2);
For ajax request, the created dialogBean will be automatically added into ajax update context.

A child dialog can be opened from a dialog in the same way.

	DialogBean dialogBean = ...;
	DialogBean childDialogBean = dialogBean.getDialogBean(true);
	QueryCriteria<Employee, Employee> queryCriteria = new QueryCriteria<Employee, Employee>(Employee.class);
	EntityDataSource<Employee> eds = new EntityDataSource<Employee>(queryCriteria);
	childDialogBean.showEntityList(Employee.class, eds, false);
By default, a dialog is modal. To create non-modal dialog,

	DialogView dialogView = dialogBean.getViewConfig().getDialogView(true);

Dialog Listener

A dialog listener will be notified when the dialog is closed.

  	DialogListener dialogListener = new DialogListener() {
		public PageNavigation dialogClosed(DialogBean dialogBean, Object data)	throws SystemException {
			// handle event
			return null;
  	BackingBeanContext context = BackingBeanContext.getInstance();
  	PersistenceEntityManager peManager = context.getPersistenceEntityManager();
  	Employee employee = peManager.getEntity(Employee.class, "123");
  	EntityDataSource eds = new EntityDataSource(employee);
  	return dialogBean.showEntity(Employee.class, eds, null, false);
To close dialog and notify the listener,

	dialogBean.close(true, data);
The data will be passed to the dialog listener.


For mobile, a dialog can be a popup or a page, and it is always modal. When creating a new dialog, its dialog type can be specified.

	public DialogBean getDialogBean(boolean create, DialogType type)
	public DialogBean newDialogBean(DialogType type)
By default, a page will be created for a REGULAR type dialog, and a popup will be created for other types. Since popup over popup is not supported for mobile, a parent popup will be hidden before showing its child popup, and will be shown when its child popup is closed.

To specify popup or page for dialog style explicitly,

	DialogView dialogView = dialogBean.getViewConfig().getDialogView(true);
	dialogView.setMobilePage(true); // false: use popup
A page can layout out larger content nicely than a popup, and it can have a left and/or right panel. Switch dialog style between popup and page at any time by clicking the style toggle icon in dialog header.

Confirm Dialog

To open a confirm dialog from a containerBean:

			messages, commands, commandVisibleNames,
After the confirm dialog is closed, the following methods can be used to check which command is clicked.


Message Dialog

To open a message dialog from a containerBean:

	containerBean.showMessageDialog(title, messages);

Progress Dialog

To open a progress dialog from a containerBean:

  	containerBean.showProgressDialog(menuNode, initialValue, 
  			labelTemplate, ajax, 
  			displayOnly, closeDialogOncomplete);