Search in sources :

Example 1 with ActionEvent

use of javax.faces.event.ActionEvent in project acs-community-packaging by Alfresco.

the class ActionLinkRenderer method decode.

// ------------------------------------------------------------------------------
// Renderer implementation
/**
 * @see javax.faces.render.Renderer#decode(javax.faces.context.FacesContext, javax.faces.component.UIComponent)
 */
public void decode(FacesContext context, UIComponent component) {
    Map requestMap = context.getExternalContext().getRequestParameterMap();
    String fieldId = Utils.getActionHiddenFieldName(context, component);
    String value = (String) requestMap.get(fieldId);
    // we are clicked if the hidden field contained our client id
    if (value != null && value.equals(component.getClientId(context))) {
        // get all the params for this actionlink, see if any values have been set
        // on the request which match our params and set them into the component
        UIActionLink link = (UIActionLink) component;
        Map<String, String> destParams = link.getParameterMap();
        Map<String, String> actionParams = getParameterComponents(link);
        if (actionParams != null) {
            for (String name : actionParams.keySet()) {
                String paramValue = (String) requestMap.get(name);
                destParams.put(name, paramValue);
            }
        }
        ActionEvent event = new ActionEvent(component);
        component.queueEvent(event);
    }
}
Also used : UIActionLink(org.alfresco.web.ui.common.component.UIActionLink) ActionEvent(javax.faces.event.ActionEvent) Map(java.util.Map)

Aggregations

Map (java.util.Map)1 ActionEvent (javax.faces.event.ActionEvent)1 UIActionLink (org.alfresco.web.ui.common.component.UIActionLink)1