use of org.primefaces.behavior.confirm.ConfirmBehavior in project primefaces by primefaces.
the class MenuItemAwareRenderer method setConfirmationScript.
protected void setConfirmationScript(FacesContext context, MenuItem item) {
if (item instanceof ClientBehaviorHolder) {
Map<String, List<ClientBehavior>> behaviors = ((ClientBehaviorHolder) item).getClientBehaviors();
List<ClientBehavior> clickBehaviors = (behaviors == null) ? null : behaviors.get("click");
if (clickBehaviors != null && !clickBehaviors.isEmpty()) {
for (int i = 0; i < clickBehaviors.size(); i++) {
ClientBehavior clientBehavior = clickBehaviors.get(i);
if (clientBehavior instanceof ConfirmBehavior) {
ClientBehaviorContext cbc = ClientBehaviorContext.createClientBehaviorContext(context, (UIComponent) item, "click", item.getClientId(), Collections.emptyList());
clientBehavior.getScript(cbc);
break;
}
}
}
}
}
Aggregations