Package org.richfaces.taglib

Source Code of org.richfaces.taglib.GraphValidatorHandler

/**
*
*/
package org.richfaces.taglib;

import java.util.Set;

import javax.faces.component.UIComponent;

import org.ajax4jsf.renderkit.AjaxRendererUtils;
import org.richfaces.component.UIGraphValidator;

import com.sun.facelets.FaceletContext;
import com.sun.facelets.tag.MetaRuleset;
import com.sun.facelets.tag.TagAttribute;
import com.sun.facelets.tag.jsf.ComponentConfig;
import com.sun.facelets.tag.jsf.ComponentHandler;

/**
* @author asmirnov
*
*/
public class GraphValidatorHandler extends ComponentHandler {

  private TagAttribute _profiles;

  /**
   * @param config
   */
  public GraphValidatorHandler(ComponentConfig config) {
    super(config);
    _profiles = getAttribute("profiles");
  }

  @Override
  protected MetaRuleset createMetaRuleset(Class type) {
    return super.createMetaRuleset(type).ignore("profiles");
  }
 
 
  @Override
  protected void onComponentCreated(FaceletContext ctx, UIComponent c,
      UIComponent parent) {
    super.onComponentCreated(ctx, c, parent);
    if (c instanceof UIGraphValidator) {
      UIGraphValidator graphValidator = (UIGraphValidator) c;
      if(null != _profiles){
        if (_profiles.isLiteral()) {
          graphValidator.setProfiles(AjaxRendererUtils.asSet(_profiles.getValue()));
        } else {
          graphValidator.setValueExpression("profiles", _profiles.getValueExpression(ctx, Set.class));
        }
      }
     
    }
  }
}
TOP

Related Classes of org.richfaces.taglib.GraphValidatorHandler

TOP
Copyright © 2018 www.massapi.com. 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.