/** * @param facesContext * @param uiCommand * @param parameters * @return */ protected static String getJavascriptHiddenFieldSetters( FacesContext facesContext, UICommand uiCommand, Map parameters) { StringBuffer buffer; buffer = new StringBuffer("var form=formOf(this);form['"); buffer.append(deriveCommonHiddenFieldName(facesContext, uiCommand)); buffer.append("'].value='"); buffer.append(uiCommand.getClientId(facesContext)); buffer.append("';"); Iterator parameterKeys = parameters.keySet().iterator(); while (parameterKeys.hasNext()) { String nextParamName = (String) parameterKeys.next(); Object nextParamValue = parameters.get(nextParamName); buffer.append("form['"); buffer.append(nextParamName); buffer.append("'].value='"); //ICE-8415: need to escape any single quotes in the value //of the parameter to ensure a valid JavaScript string. buffer.append(escapeQuote(nextParamValue)); buffer.append("';"); } return buffer.toString(); }
protected Clicked wasClicked(final ValidationContext context, final UICommand command) { String clientId = command.getClientId(context.getFacesContext()); String value = context.getFacesContext().getExternalContext().getRequestParameterMap().get(clientId); if (value != null && (value.equals(clientId) || value.equals(command.getValue()))) { return new Clicked(true, clientId); } Clicked clicked = wasComponentWithRowIdClicked(context, command, clientId); if (clicked.isClicked()) { return clicked; } PartialViewContext partialContext = context.getFacesContext().getPartialViewContext(); if (partialContext != null && partialContext.isPartialRequest()) { // Is an ajax call partially processing the component tree Collection<String> execIds = partialContext.getExecuteIds(); return new Clicked(execIds.contains(clientId)); } return new Clicked(false); }
protected void validateUICommand(final ValidationContext validationContext, final UICommand command, final Clicked clicked) { validationContext.acceptParameter(command.getClientId(validationContext.getFacesContext()), command.getValue()); if (clicked.getParamName() != null) { validationContext.acceptParameter(clicked.getParamName(), validationContext.getFacesContext().getExternalContext().getRequestParameterMap().get(clicked.getParamName())); } // Check CommandLink's parameters for (UIComponent childComp : command.getChildren()) { if (childComp instanceof UIParameter) { UIParameter param = (UIParameter) childComp; processParam(validationContext, param, clicked); } } }
boolean forceValidation = params.containsKey(forceValidationBtn.getClientId(context));