示例#1
0
  protected String buildAjaxRequest(FacesContext context, AjaxSource source, UIComponent form) {
    UIComponent component = (UIComponent) source;
    String clientId = component.getClientId(context);

    AjaxRequestBuilder builder = new AjaxRequestBuilder();

    builder
        .source(clientId)
        .process(context, component, source.getProcess())
        .update(context, component, source.getUpdate())
        .async(source.isAsync())
        .global(source.isGlobal())
        .partialSubmit(source.isPartialSubmit(), source.isPartialSubmitSet())
        .onstart(source.getOnstart())
        .onerror(source.getOnerror())
        .onsuccess(source.getOnsuccess())
        .oncomplete(source.getOncomplete())
        .params(component);

    if (form != null) {
      builder.form(form.getClientId(context));
    }

    builder.preventDefault();

    return builder.build();
  }
示例#2
0
  protected String buildAjaxRequest(
      FacesContext context,
      AbstractMenu menu,
      AjaxSource source,
      UIComponent form,
      Map<String, List<String>> params) {
    String clientId = menu.getClientId(context);

    AjaxRequestBuilder builder = RequestContext.getCurrentInstance().getAjaxRequestBuilder();

    builder
        .init()
        .source(clientId)
        .process(menu, source.getProcess())
        .update(menu, source.getUpdate())
        .async(source.isAsync())
        .global(source.isGlobal())
        .delay(source.getDelay())
        .timeout(source.getTimeout())
        .partialSubmit(
            source.isPartialSubmit(), source.isPartialSubmitSet(), source.getPartialSubmitFilter())
        .resetValues(source.isResetValues(), source.isResetValuesSet())
        .ignoreAutoUpdate(source.isIgnoreAutoUpdate())
        .onstart(source.getOnstart())
        .onerror(source.getOnerror())
        .onsuccess(source.getOnsuccess())
        .oncomplete(source.getOncomplete())
        .params(params);

    if (form != null) {
      builder.form(form.getClientId(context));
    }

    builder.preventDefault();

    return builder.build();
  }