Package org.hdiv.components

Examples of org.hdiv.components.UIParameterExtension


   *            index that shows where it is the UICommand component inside a UIData
   * @return validation result
   */
  private ValidationError processParam(FacesContext context, UIParameter parameter, int rowIndex) {

    UIParameterExtension param = (UIParameterExtension) parameter;

    UIComponent parent = parameter.getParent();
    String parentClientId = parent.getClientId(context);

    Map<String, String> requestMap = context.getExternalContext().getRequestParameterMap();
    String requestValue = requestMap.get(param.getName());

    String realValue;

    if (rowIndex < 0) {

      // May be -1 when commandLink finds a facet in a table,
      // in the footer for example
      // In these cases value has been stored in the 0 position
      rowIndex = 0;
    }
    realValue = param.getValue(parentClientId).toString();

    if (log.isDebugEnabled()) {
      log.debug("requestValue:" + requestValue);
      log.debug("realValue:" + realValue);
    }

    if (requestValue == null) {
      ValidationError error = new ValidationError();
      error.setErrorKey(HDIVErrorCodes.REQUIRED_PARAMETERS);
      error.setErrorParam(param.getId());
      error.setErrorValue(requestValue);
      error.setErrorComponent(param.getClientId(context));
      return error;

    }
    if (!requestValue.equals(realValue)) {
      ValidationError error = new ValidationError();
      error.setErrorKey(HDIVErrorCodes.PARAMETER_VALUE_INCORRECT);
      error.setErrorParam(param.getId());
      error.setErrorValue(requestValue);
      error.setErrorComponent(param.getClientId(context));
      return error;
    }
    return null;
  }
View Full Code Here

TOP

Related Classes of org.hdiv.components.UIParameterExtension

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.