[jboss-cvs] jboss-seam/src/ui/org/jboss/seam/ui/tag ...

Shane Bryzak Shane_Bryzak at symantec.com
Fri Oct 13 00:53:46 EDT 2006


  User: sbryzak2
  Date: 06/10/13 00:53:46

  Added:       src/ui/org/jboss/seam/ui/tag  SecureTag.java
  Log:
  Added <s:secure> JSF tag
  
  Revision  Changes    Path
  1.1      date: 2006/10/13 04:53:46;  author: sbryzak2;  state: Exp;jboss-seam/src/ui/org/jboss/seam/ui/tag/SecureTag.java
  
  Index: SecureTag.java
  ===================================================================
  package org.jboss.seam.ui.tag;
  
  import javax.faces.component.UIComponent;
  import javax.faces.context.FacesContext;
  import javax.faces.el.ValueBinding;
  import javax.faces.webapp.UIComponentTag;
  
  import org.jboss.seam.ui.UISecure;
  
  /**
   * UISecure tag
   *
   * @author Shane Bryzak
   */
  public class SecureTag extends UIComponentTag
  {
    private String roles;
  
    @Override
    public String getComponentType()
    {
      return UISecure.COMPONENT_TYPE;
    }
  
    @Override
    public String getRendererType()
    {
      return null;
    }
  
    protected void setProperties(UIComponent component)
    {
      super.setProperties(component);
      setStringProperty(component, "roles", roles);
    }
  
    public void setRoles(String roles)
    {
      this.roles = roles;
    }
  
    protected void setStringProperty(UIComponent component, String propName,
  
                                     String value)
  
    {
      setStringProperty(getFacesContext(), component, propName, value);
    }
  
    public static void setStringProperty(FacesContext context,
                                         UIComponent component,
                                         String propName, String value)
    {
      if (value != null)
      {
        if (isValueReference(value))
        {
          ValueBinding vb = context.getApplication().createValueBinding(value);
          component.setValueBinding(propName, vb);
        }
        else
        {
          // TODO: Warning if component has no such property (with reflection)
          component.getAttributes().put(propName, value);
        }
      }
    }
  }
  
  
  



More information about the jboss-cvs-commits mailing list