Пример #1
0
  public void testProcessValidators() throws Exception {

    result = false;
    ajaxForm.setSubmitted(true);
    child.setSubmittedValue(new String("test0"));
    ajaxForm.processValidators(facesContext);
    assertTrue(result);
  }
Пример #2
0
  // 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);
  }
Пример #3
0
  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);
  }
Пример #5
0
  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();
    }
  }