You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sv...@apache.org on 2004/12/10 03:16:27 UTC

cvs commit: incubator-myfaces/src/components/org/apache/myfaces/custom/htmlEditor HtmlEditorRenderer.java HtmlEditorTag.java

svieujot    2004/12/09 18:16:27

  Modified:    src/components/org/apache/myfaces/custom/htmlEditor
                        HtmlEditorRenderer.java HtmlEditorTag.java
  Log:
  Start implementing UserRoleAware.
  
  Revision  Changes    Path
  1.15      +13 -2     incubator-myfaces/src/components/org/apache/myfaces/custom/htmlEditor/HtmlEditorRenderer.java
  
  Index: HtmlEditorRenderer.java
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/src/components/org/apache/myfaces/custom/htmlEditor/HtmlEditorRenderer.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- HtmlEditorRenderer.java	9 Dec 2004 05:19:12 -0000	1.14
  +++ HtmlEditorRenderer.java	10 Dec 2004 02:16:26 -0000	1.15
  @@ -24,6 +24,7 @@
   import javax.faces.context.ResponseWriter;
   import javax.faces.convert.ConverterException;
   
  +import org.apache.myfaces.component.UserRoleUtils;
   import org.apache.myfaces.component.html.util.AddResource;
   import org.apache.myfaces.renderkit.RendererUtils;
   import org.apache.myfaces.renderkit.html.HTML;
  @@ -35,6 +36,9 @@
    * @author Sylvain Vieujot (latest modification by $Author$)
    * @version $Revision$ $Date$
    * $Log$
  + * Revision 1.15  2004/12/10 02:16:26  svieujot
  + * Start implementing UserRoleAware.
  + *
    * Revision 1.14  2004/12/09 05:19:12  svieujot
    * Bugfix for submitted values that were not taken care of.
    *
  @@ -78,9 +82,16 @@
    * Add an x:htmlEditor based on the Kupu library.
    */
   public class HtmlEditorRenderer extends HtmlRenderer {
  -    // TODO : Disabled mode
  +    // TODO : Finish Disabled mode
       // TODO : Fallback on textarea whose content it converted to HTML for non kupu capable browsers (Safari, smartphones, non javascript, ...)
   
  +    protected boolean isDisabled(FacesContext facesContext, UIComponent uiComponent) {
  +        if( !UserRoleUtils.isEnabledOnUserRole(uiComponent) )
  +            return false;
  +
  +        return ((HtmlEditor)uiComponent).isDisabled();
  +    }
  +    
       public void encodeEnd(FacesContext context, UIComponent component) throws IOException {
           RendererUtils.checkParamValidity(context, component, HtmlEditor.class);
           HtmlEditor editor = (HtmlEditor) component;
  
  
  
  1.8       +19 -1     incubator-myfaces/src/components/org/apache/myfaces/custom/htmlEditor/HtmlEditorTag.java
  
  Index: HtmlEditorTag.java
  ===================================================================
  RCS file: /home/cvs/incubator-myfaces/src/components/org/apache/myfaces/custom/htmlEditor/HtmlEditorTag.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- HtmlEditorTag.java	8 Dec 2004 04:36:27 -0000	1.7
  +++ HtmlEditorTag.java	10 Dec 2004 02:16:26 -0000	1.8
  @@ -17,12 +17,16 @@
   
   import javax.faces.component.UIComponent;
   
  +import org.apache.myfaces.component.UserRoleAware;
   import org.apache.myfaces.taglib.UIComponentTagBase;
   
   /**
    * @author Sylvain Vieujot (latest modification by $Author$)
    * @version $Revision$ $Date$
    * $Log$
  + * Revision 1.8  2004/12/10 02:16:26  svieujot
  + * Start implementing UserRoleAware.
  + *
    * Revision 1.7  2004/12/08 04:36:27  svieujot
    * Cancel last *source attributes, and make style and styleClass more modular.
    *
  @@ -60,6 +64,9 @@
       private String showTablesToolBox;
       private String showDebugToolBox;
       
  +    private String enabledOnUserRole;
  +    private String visibleOnUserRole;
  +    
       protected void setProperties(UIComponent component) {
           super.setProperties(component);
           
  @@ -76,6 +83,9 @@
           setBooleanProperty(component, "showImagesToolBox", showImagesToolBox);
           setBooleanProperty(component, "showTablesToolBox", showTablesToolBox);
           setBooleanProperty(component, "showDebugToolBox", showDebugToolBox);
  +        
  +        setStringProperty(component, UserRoleAware.ENABLED_ON_USER_ROLE_ATTR, enabledOnUserRole);
  +        setStringProperty(component, UserRoleAware.VISIBLE_ON_USER_ROLE_ATTR, visibleOnUserRole);
       }
       
       public String getComponentType() {
  @@ -124,5 +134,13 @@
       
       public void setShowDebugToolBox(String showDebugToolBox){
           this.showDebugToolBox = showDebugToolBox;
  +    }
  +    
  +    public void setEnabledOnUserRole(String enabledOnUserRole){
  +        this.enabledOnUserRole = enabledOnUserRole;
  +    }
  +
  +    public void setVisibleOnUserRole(String visibleOnUserRole){
  +        this.visibleOnUserRole = visibleOnUserRole;
       }
   }