Search in sources :

Example 1 with CommandButton

use of com.liferay.faces.alloy.component.commandbutton.CommandButton 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());
    }
}
Also used : PostAddToViewEvent(javax.faces.event.PostAddToViewEvent) CommandButton(com.liferay.faces.alloy.component.commandbutton.CommandButton) AjaxBehavior(javax.faces.component.behavior.AjaxBehavior)

Aggregations

CommandButton (com.liferay.faces.alloy.component.commandbutton.CommandButton)1 AjaxBehavior (javax.faces.component.behavior.AjaxBehavior)1 PostAddToViewEvent (javax.faces.event.PostAddToViewEvent)1