protected String getSubmitFunction(FacesContext facesContext, UIComponent component) { if (!isAjaxMode(component)) { return null; } AjaxFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(facesContext, component); AjaxOptions options = ajaxFunction.getOptions(); options.set("beforedomupdate", BEFORE_UPDATE_HANDLER); options.set("complete", AFTER_UPDATE_HANDLER); options.setClientParameters(PARAMS); return ajaxFunction.toScript(); }
/** * Create call to Ajax Submit function with first two parameters * * @param facesContext * @param component * @return */ public static AjaxFunction buildAjaxFunction(FacesContext facesContext, UIComponent component) { return new AjaxFunction(component.getClientId(facesContext), buildEventOptions(facesContext, component)); }
public void appendScript(Appendable target) throws IOException { if (options.getBeforesubmitHandler() == null) { appendAjaxFunctionCall(target); } else { StringBuilder ajaxCall = new StringBuilder(); appendAjaxFunctionCall(ajaxCall); ScriptUtils.appendScript(target, new JSChainJSFFunction(options.getBeforesubmitHandler(), ajaxCall.toString())); } } }
protected String getAjaxSubmitFunction(FacesContext context, UIComponent component) { AbstractTree tree = (AbstractTree) component; if (getToggleTypeOrDefault(tree) != SwitchType.ajax && getSelectionTypeOrDefault(tree) != SwitchType.ajax) { return null; } AjaxFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(context, component); ajaxFunction.setSource(SOURCE_JS_REF); AjaxOptions options = ajaxFunction.getOptions(); options.set("complete", COMPLETE_JS_REF); options.setClientParameters(PARAMS_JS_REF); return ajaxFunction.toScript(); }
ajaxFunction.setEvent(null); AjaxOptions options = ajaxFunction.getOptions(); func.addToBody(ajaxFunction.toScript()); func.appendScriptToStringBuilder(script);
@Override public Map<String, Object> getOptions(FacesContext facesContext, UIComponent component) { Map<String, Object> options = new HashMap<String, Object>(); if (component instanceof AbstractDropTarget) { JSReference dragSourceId = new JSReference("dragSourceId"); JSFunctionDefinition function = new JSFunctionDefinition(JSReference.EVENT, dragSourceId); AjaxFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(facesContext, component); ajaxFunction.getOptions().setParameter("dragSource", dragSourceId); ajaxFunction.getOptions().setParameter(component.getClientId(facesContext), component.getClientId(facesContext)); ajaxFunction.setSource(new JSReference("event", "target")); ajaxFunction.getOptions().setAjaxComponent(component.getClientId(facesContext)); function.addToBody(ajaxFunction); AbstractDropTarget dropTarget = (AbstractDropTarget) component; Set<String> acceptedTypes = Sets.asSet(dropTarget.getAcceptedTypes()); if (acceptedTypes != null) { if (acceptedTypes.contains("@none")) { acceptedTypes = NONE_SET; } else if (acceptedTypes.contains("@all")) { acceptedTypes = ALL_SET; } } options.put("acceptedTypes", acceptedTypes); options.put("ajaxFunction", function); options.put("parentId", getParentClientId(facesContext, component)); } return options; }
public String buildAjaxCommand(ClientBehaviorContext bContext, AjaxBehavior behavior) { return AjaxRendererUtils.buildAjaxFunction(bContext, behavior).toString(); } }
protected String getAjaxSubmitFunction(FacesContext context, UIComponent component) { AbstractTree tree = (AbstractTree) component; if (getToggleTypeOrDefault(tree) != SwitchType.ajax && getSelectionTypeOrDefault(tree) != SwitchType.ajax) { return null; } AjaxFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(context, component); ajaxFunction.setSource(SOURCE_JS_REF); AjaxOptions options = ajaxFunction.getOptions(); options.set("complete", COMPLETE_JS_REF); options.setClientParameters(PARAMS_JS_REF); return ajaxFunction.toScript(); }
ajaxFunction.setEvent(null); AjaxOptions options = ajaxFunction.getOptions(); func.addToBody(ajaxFunction.toScript()); func.appendScriptToStringBuilder(script);
@Override public Map<String, Object> getOptions(FacesContext facesContext, UIComponent component) { Map<String, Object> options = new HashMap<String, Object>(); if (component instanceof AbstractDropTarget) { JSReference dragSourceId = new JSReference("dragSourceId"); JSFunctionDefinition function = new JSFunctionDefinition(JSReference.EVENT, dragSourceId); AjaxFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(facesContext, component); ajaxFunction.getOptions().setParameter("dragSource", dragSourceId); ajaxFunction.getOptions().setParameter(component.getClientId(facesContext), component.getClientId(facesContext)); ajaxFunction.setSource(new JSReference("event", "target")); ajaxFunction.getOptions().setAjaxComponent(component.getClientId(facesContext)); function.addToBody(ajaxFunction); AbstractDropTarget dropTarget = (AbstractDropTarget) component; Set<String> acceptedTypes = CoreAjaxRendererUtils.asSimpleSet(dropTarget.getAcceptedTypes()); if (acceptedTypes != null) { if (acceptedTypes.contains("@none")) { acceptedTypes = NONE_SET; } else if (acceptedTypes.contains("@all")) { acceptedTypes = ALL_SET; } } options.put("acceptedTypes", acceptedTypes); options.put("ajaxFunction", function); options.put("parentId", getParentClientId(facesContext, component)); } return options; }
public String buildAjaxCommand(ClientBehaviorContext bContext, AjaxBehavior behavior) { return AjaxRendererUtils.buildAjaxFunction(bContext, behavior).toString(); } }
protected String getSubmitFunction(FacesContext facesContext, UIComponent component) { if (!isAjaxMode(component)) { return null; } AjaxFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(facesContext, component); AjaxOptions options = ajaxFunction.getOptions(); options.set("beforedomupdate", BEFORE_UPDATE_HANDLER); options.set("complete", AFTER_UPDATE_HANDLER); options.setClientParameters(PARAMS); return ajaxFunction.toScript(); }
protected String getAjaxSubmitFunction(FacesContext context, UIComponent component) { AbstractTree tree = (AbstractTree) component; if (getToggleTypeOrDefault(tree) != SwitchType.ajax && getSelectionTypeOrDefault(tree) != SwitchType.ajax) { return null; } AjaxFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(context, component); ajaxFunction.setSource(SOURCE_JS_REF); AjaxOptions options = ajaxFunction.getOptions(); options.set("complete", COMPLETE_JS_REF); options.setClientParameters(PARAMS_JS_REF); return ajaxFunction.toScript(); }
ajaxFunction.setEvent(null); AjaxOptions options = ajaxFunction.getOptions(); func.addToBody(ajaxFunction.toScript()); func.appendScriptToStringBuilder(script);
@Override public Map<String, Object> getOptions(FacesContext facesContext, UIComponent component) { Map<String, Object> options = new HashMap<String, Object>(); if (component instanceof AbstractDropTarget) { JSReference dragSourceId = new JSReference("dragSourceId"); JSFunctionDefinition function = new JSFunctionDefinition(JSReference.EVENT, dragSourceId); AjaxFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(facesContext, component); ajaxFunction.getOptions().setParameter("dragSource", dragSourceId); ajaxFunction.getOptions().setParameter(component.getClientId(facesContext), component.getClientId(facesContext)); ajaxFunction.setSource(new JSReference("event", "target")); ajaxFunction.getOptions().setAjaxComponent(component.getClientId(facesContext)); function.addToBody(ajaxFunction); AbstractDropTarget dropTarget = (AbstractDropTarget) component; Set<String> acceptedTypes = Sets.asSet(dropTarget.getAcceptedTypes()); if (acceptedTypes != null) { if (acceptedTypes.contains("@none")) { acceptedTypes = NONE_SET; } else if (acceptedTypes.contains("@all")) { acceptedTypes = ALL_SET; } } options.put("acceptedTypes", acceptedTypes); options.put("ajaxFunction", function); options.put("parentId", getParentClientId(facesContext, component)); } return options; }
/** * Create call to Ajax Submit function with first two parameters * * @param facesContext * @param component * @return */ public static AjaxFunction buildAjaxFunction(FacesContext facesContext, UIComponent component) { return new AjaxFunction(component.getClientId(facesContext), buildEventOptions(facesContext, component)); }
public void appendScript(Appendable target) throws IOException { if (options.getBeforesubmitHandler() == null) { appendAjaxFunctionCall(target); } else { StringBuilder ajaxCall = new StringBuilder(); appendAjaxFunctionCall(ajaxCall); ScriptUtils.appendScript(target, new JSChainJSFFunction(options.getBeforesubmitHandler(), ajaxCall.toString())); } } }
public String buildAjaxCommand(ClientBehaviorContext bContext, AjaxBehavior behavior) { return buildAjaxFunction(bContext, behavior).toString(); }
protected String getSubmitFunction(FacesContext facesContext, UIComponent component) { if (!isAjaxMode(component)) { return null; } AjaxFunction ajaxFunction = AjaxRendererUtils.buildAjaxFunction(facesContext, component); AjaxOptions options = ajaxFunction.getOptions(); options.set("beforedomupdate", BEFORE_UPDATE_HANDLER); options.set("complete", AFTER_UPDATE_HANDLER); options.setClientParameters(PARAMS); return ajaxFunction.toScript(); }
/** * Create call to Ajax Submit function with first two parameters */ public static AjaxFunction buildAjaxFunction(FacesContext facesContext, UIComponent component) { return new AjaxFunction(component.getClientId(facesContext), buildEventOptions(facesContext, component)); }