public void testProcessValidators() throws Exception { result = false; ajaxForm.setSubmitted(true); child.setSubmittedValue(new String("test0")); ajaxForm.processValidators(facesContext); assertTrue(result); }
// TODO processUpdates test public void testProcessUpdates() throws Exception { facesContext.getExternalContext().getRequestParameterMap().put("form", "form"); child.setSubmittedValue(new String("test1")); ajaxForm.processDecodes(facesContext); ajaxForm.processValidators(facesContext); ajaxForm.processUpdates(facesContext); }
public static void switchAddImageIntoForm(String formName, String fileName) { FacesContext context = FacesContext.getCurrentInstance(); UIInput txtImageName = (UIInput) context.getViewRoot().findComponent(formName + ":txtImageName"); txtImageName.setValue(fileName); txtImageName.setSubmittedValue(fileName); context.renderResponse(); }
/** * decode method * * @param context * @param component */ public void decode(FacesContext context, UIComponent component) { // we haven't added these attributes--yet--defensive programming... if (RendererUtil.isDisabledOrReadonly(component)) { return; } String clientId = component.getClientId(context); Map requestParameterMap = context.getExternalContext().getRequestParameterMap(); String newValue = (String) requestParameterMap.get(clientId); UIInput comp = (UIInput) component; comp.setSubmittedValue(newValue); }
public static void clearSubmittedValues(UIComponent uiComponent) { if (uiComponent == null) { return; } Iterator<UIComponent> children = (uiComponent).getFacetsAndChildren(); while (children.hasNext()) { clearSubmittedValues(children.next()); } if (uiComponent instanceof UIInput) { ((UIInput) uiComponent).setSubmittedValue(null); ((UIInput) uiComponent).setValue(null); ((UIInput) uiComponent).setLocalValueSet(false); ((UIInput) uiComponent).resetValue(); } }