Exemplo n.º 1
0
  /** @see javax.faces.context.PartialViewContext#getExecuteIds() */
  @Override
  public Collection<String> getExecuteIds() {

    assertNotReleased();
    if (executeIds != null) {
      return executeIds;
    }
    executeIds = populatePhaseClientIds(PARTIAL_EXECUTE_PARAM_NAME);

    // include the view parameter facet ID if there are other execute IDs
    // to process
    if (!executeIds.isEmpty()) {
      UIViewRoot root = ctx.getViewRoot();
      if (root.getFacetCount() > 0) {
        if (root.getFacet(UIViewRoot.METADATA_FACET_NAME) != null) {
          executeIds.add(0, UIViewRoot.METADATA_FACET_NAME);
        }
      }
    }
    return executeIds;
  }
Exemplo n.º 2
0
  public static ValidationProcessor getInstance(FacesContext context) {
    if (context == null) return null;

    UIViewRoot uiViewRoot = context.getViewRoot();
    if (uiViewRoot == null) return null;

    if (isOpenFacesValidationDisabled(context)) return null;

    ValidationProcessor processor =
        (ValidationProcessor) uiViewRoot.getFacet("_OpenFacesValidationProcessor_");
    if (processor == null) {
      UIViewRoot viewRoot = context.getViewRoot();
      if (viewRoot == null) throw new IllegalStateException("viewRoot shouldn't be null");

      processor = new ValidationProcessor();
      processor.setId(DEFAULT_ID);
      viewRoot.getFacets().put("_OpenFacesValidationProcessor_", processor);

      initProcessor(context, processor);
    }
    return processor;
  }