use of org.linkki.core.ui.table.ContainerPmo in project linkki by linkki-framework.
the class PmoBasedDialogFactory method newOkCancelDialog.
/**
* Creates a new {@link OkCancelDialog}.
*
* @param title The dialog title.
* @param okHandler The called when OK is clicked.
* @param pmos The presentation model objects providing the data and the layout information.
* @return A dialog with the content defined by the given PMO.
*/
public OkCancelDialog newOkCancelDialog(String title, Handler okHandler, Object... pmos) {
OkCancelDialog dialog = new OkCancelDialog(title, okHandler, ButtonOption.OK_CANCEL);
DialogBindingManager bindingManager = new DialogBindingManager(dialog, validationService, propertyBehaviorProvider);
BindingContext bindingContext = bindingManager.startNewContext(dialog.getClass());
for (Object pmo : pmos) {
AbstractSection content;
if (pmo instanceof ContainerPmo) {
content = pmoBasedSectionFactory.createTableSection((ContainerPmo<?>) pmo, bindingContext);
} else {
content = pmoBasedSectionFactory.createSection(pmo, bindingContext);
}
float expRatio = 0f;
if (pmo == pmos[pmos.length - 1]) {
expRatio = 1f;
}
dialog.addContent(content, expRatio);
}
bindingContext.updateUI();
return dialog;
}
Aggregations