SV: Tomahawk's enabledOnUserRole attribute and Clay

2007-03-27 Thread Hermod Opstvedt
Hi

But this is handled in the new version of TlD2ClayCfg tool, so it if you use
it against the tomahawk 1.3 jar you will get a correct config file.

Hermod

-Opprinnelig melding-
Fra: Gary VanMatre [mailto:[EMAIL PROTECTED] 
Sendt: 27. mars 2007 17:06
Til: user@shale.apache.org
Emne: 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/jav
a/org/apache/myfaces/shared/renderkit/html/HtmlCheckboxRendererBase.java?vie
w=markup
[2]
http://svn.apache.org/viewvc/myfaces/tomahawk/branches/1_1_3/core/src/main/j
ava/org/apache/myfaces/renderkit/html/ext/HtmlCheckboxRenderer.java?view=mar
kup


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: SV: Tomahawk's enabledOnUserRole attribute and Clay

2007-03-27 Thread Gary VanMatre
From: Hermod Opstvedt [EMAIL PROTECTED] 

 Hi 
 
 But this is handled in the new version of TlD2ClayCfg tool, so it if you use 
 it against the tomahawk 1.3 jar you will get a correct config file. 
 

Yeah, that's a good point.  

However, I'm still not convinced that we do not need to package the various 
library configs for the stateful converters, validators and listeners.


 Hermod 



Gary
 
 -Opprinnelig melding- 
 Fra: Gary VanMatre [mailto:[EMAIL PROTECTED] 
 Sendt: 27. mars 2007 17:06 
 Til: user@shale.apache.org 
 Emne: 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: 
  
   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  element, I tried changing the HTML 
 
 element to just a 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/jav 
 a/org/apache/myfaces/shared/renderkit/html/HtmlCheckboxRendererBase.java?vie 
 w=markup 
 [2] 
 http://svn.apache.org/viewvc/myfaces/tomahawk/branches/1_1_3/core/src/main/j 
 ava/org/apache/myfaces/renderkit/html/ext/HtmlCheckboxRenderer.java?view=mar 
 kup 
 
 
 Could you try the following test to help troubleshoot the problem? 
 
 Extend the base check box component definition: 
 
  extends=t:selectBooleanCheckbox 
 
  bindingType=VB / 
 
 
 
 In the html template, point to the override: 
 
  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