use of javax.faces.event.PostAddToViewEvent in project liferay-faces-alloy by liferay.
the class CommandLinkRenderer method processEvent.
@Override
public void processEvent(ComponentSystemEvent componentSystemEvent) throws AbortProcessingException {
CommandLink commandLink = (CommandLink) componentSystemEvent.getComponent();
// If the specified event indicates that the command link was added to the component tree, then
if (componentSystemEvent instanceof PostAddToViewEvent) {
// Add the default Ajax behavior in order to support the ajax attribute. This effectively simulates the
// presence of a child f:ajax tag.
RendererUtil.addDefaultAjaxBehavior(commandLink, commandLink.getExecute(), commandLink.getProcess(), "@all", commandLink.getRender(), commandLink.getUpdate(), "@none");
} else // Otherwise, the specified event indicates that the command link is about to be rendered. If the ajax
// attribute is true, then ensure that the AjaxBehavior is rendered. Otherwise, ensure that the AjaxBehavior is
// not rendered.
{
AjaxBehavior ajaxBehavior = RendererUtil.getDefaultAjaxBehavior(commandLink);
ajaxBehavior.setDisabled(!commandLink.isAjax());
}
}
use of javax.faces.event.PostAddToViewEvent in project liferay-faces-alloy by liferay.
the class CommandButtonRenderer method processEvent.
@Override
public void processEvent(ComponentSystemEvent componentSystemEvent) throws AbortProcessingException {
CommandButton commandButton = (CommandButton) componentSystemEvent.getComponent();
// If the specified event indicates that the command button was added to the component tree, then
if (componentSystemEvent instanceof PostAddToViewEvent) {
// Add the default Ajax behavior in order to support the ajax attribute. This effectively simulates the
// presence of a child f:ajax tag.
RendererUtil.addDefaultAjaxBehavior(commandButton, commandButton.getExecute(), commandButton.getProcess(), "@all", commandButton.getRender(), commandButton.getUpdate(), "@none");
} else // Otherwise, the specified event indicates that the command button is about to be rendered. If the ajax
// attribute is true, then ensure that the AjaxBehavior is rendered. Otherwise, ensure that the AjaxBehavior is
// not rendered.
{
AjaxBehavior ajaxBehavior = RendererUtil.getDefaultAjaxBehavior(commandButton);
ajaxBehavior.setDisabled(!commandButton.isAjax());
}
}
Aggregations