RE: Tomahawk's enabledOnUserRole attribute and Clay
Hi Which Clay tomahawk component config file are you using? Have you tried with 1.1.5-SNAPSHOT and the config file in the trunk? Hermod -Original Message- From: Richard Eggert [mailto:[EMAIL PROTECTED] Sent: Monday, March 26, 2007 11:37 PM To: user@shale.apache.org Subject: Tomahawk's enabledOnUserRole attribute and Clay Perhaps I'm overlooking something here, but from the testing I did this afternoon, it appears that the enabledOnUserRole attribute provided with most of Tomahawk's components doesn't work at all in Clay HTML templates. However, it does work properly when I use straight JSP/JSF without Clay (at least most of the time, anyway; t:commandButton seems to have issues with it). I have an HTML template that contains an element that looks something like the following: input type=checkbox jsfid=t:selectBooleanCheckbox value=#{mybean.myflag} enabledOnUserRole=myrole / When I view the page while logged in as a user that does not have the myrole role, the checkbox is still enabled, and I can use it to toggle the corresponding flag in the underlying bean. Thinking that it might be a problem with the implicit mapping of the input element, I tried changing the HTML element to just a span tag (with attributes set as above, minus the type=checkbox part), to no avail. I also tried setting enabledOnUserRole for a textarea, and it didn't work correctly there, either. visibleOnUserRole seems to work just fine, though. Any ideas on this, or should I post it to JIRA? For reference, I'm using MyFaces 1.1.4, Tomahawk 1.1.3, and Shale 1.0.4. Rich Eggert Member of Technical Staff Proteus Technologies, LLC http://www.proteus-technologies.com * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * This email with attachments is solely for the use of the individual or entity to whom it is addressed. Please also be aware that the DnB NOR Group cannot accept any payment orders or other legally binding correspondence with customers as a part of an email. This email message has been virus checked by the anti virus programs used in the DnB NOR Group. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Re: Tomahawk's enabledOnUserRole attribute and Clay
Perhaps I'm overlooking something here, but from the testing I did this afternoon, it appears that the enabledOnUserRole attribute provided with most of Tomahawk's components doesn't work at all in Clay HTML templates. However, it does work properly when I use straight JSP/JSF without Clay (at least most of the time, anyway; t:commandButton seems to have issues with it). I have an HTML template that contains an element that looks something like the following: input type=checkbox jsfid=t:selectBooleanCheckbox value=#{mybean.myflag} enabledOnUserRole=myrole / When I view the page while logged in as a user that does not have the myrole role, the checkbox is still enabled, and I can use it to toggle the corresponding flag in the underlying bean. Thinking that it might be a problem with the implicit mapping of the input element, I tried changing the HTML element to just a span tag (with attributes set as above, minus the type=checkbox part), to no avail. I also tried setting enabledOnUserRole for a textarea, and it didn't work correctly there, either. visibleOnUserRole seems to work just fine, though. Any ideas on this, or should I post it to JIRA? This looks like another case where we need to explicitly override the rendererType. The shared renderer [1] is the default for the runtime but in tomahawk, there is a renderer override [2]. [1] http://svn.apache.org/viewvc/myfaces/shared/branches/2_0_0/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlCheckboxRendererBase.java?view=markup [2] http://svn.apache.org/viewvc/myfaces/tomahawk/branches/1_1_3/core/src/main/java/org/apache/myfaces/renderkit/html/ext/HtmlCheckboxRenderer.java?view=markup Could you try the following test to help troubleshoot the problem? Extend the base check box component definition: component jsfid=mySelectBooleanCheckbox extends=t:selectBooleanCheckbox attributes set name=rendererType value=org.apache.myfaces.Checkbox bindingType=VB / /attributes /component In the html template, point to the override: input type=checkbox jsfid=mySelectBooleanCheckbox value=#{mybean.myflag} enabledOnUserRole=myrole / I think this should solve the problem but regardless, please create a JIRA ticket. For reference, I'm using MyFaces 1.1.4, Tomahawk 1.1.3, and Shale 1.0.4. Rich Eggert Member of Technical Staff Proteus Technologies, LLC http://www.proteus-technologies.com Gary
RE: Tomahawk's enabledOnUserRole attribute and Clay
That fixed the problem. I've submitted JIRA ticket # SHALE-431. Rich Eggert Member of Technical Staff Proteus Technologies, LLC http://www.proteus-technologies.com -Original Message- From: Gary VanMatre [mailto:[EMAIL PROTECTED] Sent: Tue 3/27/2007 11:05 AM To: user@shale.apache.org Subject: Re: Tomahawk's enabledOnUserRole attribute and Clay Perhaps I'm overlooking something here, but from the testing I did this afternoon, it appears that the enabledOnUserRole attribute provided with most of Tomahawk's components doesn't work at all in Clay HTML templates. However, it does work properly when I use straight JSP/JSF without Clay (at least most of the time, anyway; t:commandButton seems to have issues with it). I have an HTML template that contains an element that looks something like the following: input type=checkbox jsfid=t:selectBooleanCheckbox value=#{mybean.myflag} enabledOnUserRole=myrole / When I view the page while logged in as a user that does not have the myrole role, the checkbox is still enabled, and I can use it to toggle the corresponding flag in the underlying bean. Thinking that it might be a problem with the implicit mapping of the input element, I tried changing the HTML element to just a span tag (with attributes set as above, minus the type=checkbox part), to no avail. I also tried setting enabledOnUserRole for a textarea, and it didn't work correctly there, either. visibleOnUserRole seems to work just fine, though. Any ideas on this, or should I post it to JIRA? This looks like another case where we need to explicitly override the rendererType. The shared renderer [1] is the default for the runtime but in tomahawk, there is a renderer override [2]. [1] http://svn.apache.org/viewvc/myfaces/shared/branches/2_0_0/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlCheckboxRendererBase.java?view=markup [2] http://svn.apache.org/viewvc/myfaces/tomahawk/branches/1_1_3/core/src/main/java/org/apache/myfaces/renderkit/html/ext/HtmlCheckboxRenderer.java?view=markup Could you try the following test to help troubleshoot the problem? Extend the base check box component definition: component jsfid=mySelectBooleanCheckbox extends=t:selectBooleanCheckbox attributes set name=rendererType value=org.apache.myfaces.Checkbox bindingType=VB / /attributes /component In the html template, point to the override: input type=checkbox jsfid=mySelectBooleanCheckbox value=#{mybean.myflag} enabledOnUserRole=myrole / I think this should solve the problem but regardless, please create a JIRA ticket. For reference, I'm using MyFaces 1.1.4, Tomahawk 1.1.3, and Shale 1.0.4. Rich Eggert Member of Technical Staff Proteus Technologies, LLC http://www.proteus-technologies.com Gary
Re: Tomahawk's enabledOnUserRole attribute and Clay
Gary, I see this as a tomahawk bug. I'm pretty sure I looked at this a couple weeks ago and noticed that the renderer was being set inside the JSP tag handler rather than in the component. Seems like setting it from the taghandler is the wrong approach. Breaks anything other than the jsp viewhandler. On 3/27/07, Gary VanMatre [EMAIL PROTECTED] wrote: This looks like another case where we need to explicitly override the rendererType. The shared renderer [1] is the default for the runtime but in tomahawk, there is a renderer override [2]. [1] http://svn.apache.org/viewvc/myfaces/shared/branches/2_0_0/core/src/main/java/org/apache/myfaces/shared/renderkit/html/HtmlCheckboxRendererBase.java?view=markup [2] http://svn.apache.org/viewvc/myfaces/tomahawk/branches/1_1_3/core/src/main/java/org/apache/myfaces/renderkit/html/ext/HtmlCheckboxRenderer.java?view=markup
Re: Tomahawk's enabledOnUserRole attribute and Clay
Yes, I brought it up on the myfaces dev list, but didn't get any comments. I guess I'll open a JIRA issue and take a look at it the next time I have the code checked out. I don't think we have any instances of a new tag handler but not a new component subclass. Yes, the tenative plan is that Tomahawk2 might be based on Trinidad. First Trinidad needs to graduate and then hopefully we'll accept it as a MyFaces subproject and go from there. Nothing is definite at this point, but there's at least a couple of us that want to see this happen. On 3/27/07, Gary VanMatre [EMAIL PROTECTED] wrote: From: Mike Kienenberger [EMAIL PROTECTED] Gary, I see this as a tomahawk bug. I'm pretty sure I looked at this a couple weeks ago and noticed that the renderer was being set inside the JSP tag handler rather than in the component. Seems like setting it from the taghandler is the wrong approach. Breaks anything other than the jsp viewhandler. Cool. I thought it was too but I understand the reuse that tomahawk has with core. I can see why you wouldn't want to subclass a component just for the sake of changing the rendererType - more code to maintain. On the flip side, it wouldn't be right to override the RI's renderer-class using the same renderer-type and family. Only JSP is mandated by the specification. So, there is a gray area here (calling it a bug). Are you guys planning on using the Trinidad code generation for tomahawk it the future? On 3/27/07, Gary VanMatre wrote: This looks like another case where we need to explicitly override the rendererType. The shared renderer [1] is the default for the runtime but in tomahawk, there is a renderer override [2]. [1] http://svn.apache.org/viewvc/myfaces/shared/branches/2_0_0/core/src/main/java/or g/apache/myfaces/shared/renderkit/html/HtmlCheckboxRendererBase.java?view=markup [2] http://svn.apache.org/viewvc/myfaces/tomahawk/branches/1_1_3/core/src/main/java/ org/apache/myfaces/renderkit/html/ext/HtmlCheckboxRenderer.java?view=markup
Re: Tomahawk's enabledOnUserRole attribute and Clay
I've opened http://issues.apache.org/jira/browse/TOMAHAWK-942 on this. On 3/27/07, Gary VanMatre [EMAIL PROTECTED] wrote: From: Mike Kienenberger [EMAIL PROTECTED] Gary, I see this as a tomahawk bug. I'm pretty sure I looked at this a couple weeks ago and noticed that the renderer was being set inside the JSP tag handler rather than in the component. Seems like setting it from the taghandler is the wrong approach. Breaks anything other than the jsp viewhandler. Cool. I thought it was too but I understand the reuse that tomahawk has with core. I can see why you wouldn't want to subclass a component just for the sake of changing the rendererType - more code to maintain. On the flip side, it wouldn't be right to override the RI's renderer-class using the same renderer-type and family. Only JSP is mandated by the specification. So, there is a gray area here (calling it a bug). Are you guys planning on using the Trinidad code generation for tomahawk it the future? On 3/27/07, Gary VanMatre wrote: This looks like another case where we need to explicitly override the rendererType. The shared renderer [1] is the default for the runtime but in tomahawk, there is a renderer override [2]. [1] http://svn.apache.org/viewvc/myfaces/shared/branches/2_0_0/core/src/main/java/or g/apache/myfaces/shared/renderkit/html/HtmlCheckboxRendererBase.java?view=markup [2] http://svn.apache.org/viewvc/myfaces/tomahawk/branches/1_1_3/core/src/main/java/ org/apache/myfaces/renderkit/html/ext/HtmlCheckboxRenderer.java?view=markup