public JSReference getDayStyleClass(FacesContext context, UIComponent component) { AbstractCalendar calendar = (AbstractCalendar) component; String dayStyleClass = calendar.getDayClassFunction(); return ((dayStyleClass != null && dayStyleClass.trim().length() != 0)) ? new JSReference(dayStyleClass) : null; }
public JSReference getClientFilterFunction(UIComponent component) { AbstractAutocomplete autocomplete = (AbstractAutocomplete) component; String clientFilter = (String) autocomplete.getAttributes().get("clientFilterFunction"); if (clientFilter != null && clientFilter.length() != 0) { return new JSReference(clientFilter); } return null; }
public JSReference getDayStyleClass(FacesContext context, UIComponent component) { AbstractCalendar calendar = (AbstractCalendar) component; String dayStyleClass = calendar.getDayClassFunction(); return ((dayStyleClass != null && dayStyleClass.trim().length() != 0)) ? new JSReference(dayStyleClass) : null; }
public JSReference getDayEnabled(FacesContext facesContext, UIComponent component) { AbstractCalendar calendar = (AbstractCalendar) component; String dayEnabled = calendar.getDayDisableFunction(); return ((dayEnabled != null && dayEnabled.trim().length() != 0)) ? new JSReference(dayEnabled) : null; }
public JSReference getClientFilterFunction(UIComponent component) { AbstractAutocomplete autocomplete = (AbstractAutocomplete) component; String clientFilter = (String) autocomplete.getAttributes().get("clientFilterFunction"); if (clientFilter != null && clientFilter.length() != 0) { return new JSReference(clientFilter); } return null; }
public JSReference getClientFilterFunction(UIComponent component) { AbstractSelect select = (AbstractSelect) component; String clientFilter = (String) select.getAttributes().get("clientFilterFunction"); if (clientFilter != null && clientFilter.length() != 0) { return new JSReference(clientFilter); } return null; }
public JSReference getClientFilterFunction(UIComponent component) { AbstractSelect select = (AbstractSelect) component; String clientFilter = (String) select.getAttributes().get("clientFilterFunction"); if (clientFilter != null && clientFilter.length() != 0) { return new JSReference(clientFilter); } return null; }
public JSReference getDayEnabled(FacesContext facesContext, UIComponent component) { AbstractCalendar calendar = (AbstractCalendar) component; String dayEnabled = calendar.getDayDisableFunction(); return ((dayEnabled != null && dayEnabled.trim().length() != 0)) ? new JSReference(dayEnabled) : null; }
public String onSortAjaxUpdate(FacesContext context, UIScrollableDataTable grid){ JSReference sortColumn = new JSReference("event.column"); JSReference sortOrder = new JSReference("event.order"); JSReference sortStartRow = new JSReference("event.startRow"); JSReference sortIndex = new JSReference("event.index"); Map<String, Object> options = AjaxRendererUtils.buildEventOptions(context, grid); @SuppressWarnings("unchecked") Map<String, Object> parametersMap = (Map)options.get("parameters"); String id = grid.getClientId(context); parametersMap.put(id + ":sortColumn", sortColumn); parametersMap.put(id + ":sortOrder", sortOrder); parametersMap.put(id + ":sortStartRow", sortStartRow); parametersMap.put(id + ":sortIndex", sortIndex); options.put("parameters", parametersMap); JSFunction function = AjaxRendererUtils.buildAjaxFunction(grid, context); options.put("oncomplete", AjaxFunctionBuilder.getOnComplete(context, grid, AjaxFunctionBuilder.SORT)); function.addParameter(options); String completeFunction = function.toScript() + "; return false;"; return completeFunction; }
public JSFunctionDefinition getSubmitFunction(FacesContext facesContext, UIComponent component) { JSFunctionDefinition definition = new JSFunctionDefinition(JSReference.EVENT, new JSReference("element"), new JSReference("data")); AjaxFunction function = AjaxRendererUtils.buildAjaxFunction(facesContext, component); Map<String, Object> parameters = function.getOptions().getParameters(); parameters.put(component.getClientId(facesContext) + ":page", new JSLiteral("data.page")); definition.addToBody(function.toScript()); return definition; }
public JSFunctionDefinition getSubmitFunction(FacesContext facesContext, UIComponent component) { JSFunctionDefinition definition = new JSFunctionDefinition(JSReference.EVENT, new JSReference("element"), new JSReference("data")); AjaxFunction function = AjaxRendererUtils.buildAjaxFunction(facesContext, component); Map<String, Object> parameters = function.getOptions().getParameters(); parameters.put(component.getClientId(facesContext) + ":page", new JSLiteral("data.page")); definition.addToBody(function.toScript()); return definition; }
/** * Returns value of the parameter. If parameter is instance of <code>JavaScriptParameter</code>, <code>NoEcape</code> * attribute is applied. * * @param parameter instance of <code>UIParameter</code> * @return <code>Object</code> parameter value */ public Object createParameterValue(UIParameter parameter) { Object value = parameter.getValue(); boolean escape = true; if (parameter instanceof JavaScriptParameter) { JavaScriptParameter actionParam = (JavaScriptParameter) parameter; escape = !actionParam.isNoEscape(); } if (escape) { if (value == null) { value = ""; } } else { value = new JSReference(value.toString()); } return value; }
/** * Returns value of the parameter. If parameter is instance of <code>JavaScriptParameter</code>, <code>NoEcape</code> * attribute is applied. * * @param parameter instance of <code>UIParameter</code> * @return <code>Object</code> parameter value */ public Object createParameterValue(UIParameter parameter) { Object value = parameter.getValue(); boolean escape = true; if (parameter instanceof JavaScriptParameter) { JavaScriptParameter actionParam = (JavaScriptParameter) parameter; escape = !actionParam.isNoEscape(); } if (escape) { if (value == null) { value = ""; } } else { value = new JSReference(value.toString()); } return value; }
/** * Returns value of the parameter. If parameter is instance of <code>JavaScriptParameter</code>, <code>NoEcape</code> * attribute is applied. * * @param parameter instance of <code>UIParameter</code> * @return <code>Object</code> parameter value */ public Object createParameterValue(UIParameter parameter) { Object value = parameter.getValue(); boolean escape = true; if (parameter instanceof JavaScriptParameter) { JavaScriptParameter actionParam = (JavaScriptParameter) parameter; escape = !actionParam.isNoEscape(); } if (escape) { if (value == null) { value = ""; } } else { value = new JSReference(value.toString()); } return value; }
protected List getScriptPanelBarItems(FacesContext context,UIPanelBar panelBar){ List items = new ArrayList(); JSReference id_ref = new JSReference("id");
/** * @return JavaScript eventString. Rebuild on every call, since * can be in loop ( as in dataTable ) with different parameters. */ public String getEventString() { String targetId = HtmlUtil.idsToIdSelector(getFor()); targetId = HtmlUtil.expandIdSelector(targetId, this, FacesContext.getCurrentInstance()); JSFunction invocation = new JSFunction("Richfaces.componentControl.performOperation"); invocation.addParameter(new JSReference("event")); invocation.addParameter(targetId); invocation.addParameter(getOperation()); invocation.addParameter(new JSReference("{" + getEncodedParametersMap() + "}")); invocation.addParameter(Boolean.valueOf(isDisableDefault())); return invocation.toScript(); }
JSReference reference = new JSReference(name); reference = new JSReference(name + "||" + ScriptUtils.toScript(parameters.get(name)));
@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; }
@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; }
JSReference sortEvent = new JSReference("event"); functionDefinition.addParameter(sortEvent); functionDefinition.addToBody(onSortAjaxUpdate(context, grid));