I've quickly glanced through the source code (well, it wasn't as quick
as I would have liked), and I think the attribute name you need to use
is "enabledOnUserRole".   I also think that you will get a facelets
warning because this is a generic attribute and not a component method
name.

However, it should work as near as I can tell.  There's nothing
special about the JSP tag for this value, and all components appear to
share the same code for setting it.

On 4/6/06, Travis Alexander <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I am trying to get the tomahawk tab component working in a myfaces
> project with facelets, I have it mostly working but I need access to
> the attribute enabledOnUserRole, but as you can see from the third
> warning below (I tried it with and without the fully qualified
> attribute name), that attribute isn't exposed(it works fine without
> facelets), I followed the directions here:
>
> http://wiki.apache.org/myfaces/Use_Facelets_with_Tomahawk
>
> and that made the tabs work with facelets, but not that attribute. I
> suspect that I need to implement a custom renderer to expose this
> attribute, but I'm pretty new to JSF and Facelets, can anybody give me
> some direction?
>
> A little more background info, I'm using exadel studio and I started a
> RI with facelets kickstart project, I then swapped out RI with
> MyFaces, and then added tomahawk, setup the tomahawk tag lib xml file,
> added some tabs to the greeting page, everything works fine except
> when I try to access the enabledOnUserRole property I get the 3rd
> warning below. The tabs render and work fine but I need that
> attribute, or some other way to disable but not  hide the tab.
>
> ************************************************************************************
> warnings
> ************************************************************************************
>
> Apr 6, 2006 1:24:11 PM com.sun.facelets.tag.jsf.ComponentRule warnAttr
> WARNING: /pages/inputname.xhtml @17,40 method="get" Property 'method'
> is not on type: javax.faces.component.html.HtmlForm
>
> Apr 6, 2006 1:24:11 PM com.sun.facelets.tag.jsf.ComponentRule warnAttr
> WARNING: /pages/inputname.xhtml @19,83 type="text" Property 'type' is
> not on type: javax.faces.component.html.HtmlInputText
>
> Apr 6, 2006 1:26:28 PM com.sun.facelets.tag.jsf.ComponentRule warnAttr
> WARNING: /pages/greeting.xhtml @23,110
> org.apache.myfaces.custom.panelTab.enabledOnUserRole="NOROLE" Property
> 'org.apache.myfaces.custom.panelTab.enabledOnUserRole' is not on type:
> org.apache.myfaces.custom.tabbedpane.HtmlPanelTab
>
> ******************************************************************************
> The actual tab calls
> ******************************************************************************
>
>                                 <t:panelTabbedPane selectedIndex="0" >
>                                 <!-- t:tabChangeListener 
> type="demo.TabChandedListenr"/ -->
>                                         <t:panelTab label="tab0" 
> rendered="true" >
>                                                 <f:subview id="tab0view" >
>                                                         <h:form>
>                                                                 test    0<br 
> />
>                                                         </h:form>
>                                                 </f:subview>
>                                         </t:panelTab>
>                                         <t:panelTab label="tab1" 
> rendered="true"
> org.apache.myfaces.custom.panelTab.enabledOnUserRole="NOROLE" >
>                                                 <f:subview id="tab1view">
>                                                         <h:form>
>                                                                 test    1<br 
> />
>                                                         </h:form>
>                                                 </f:subview>
>                                         </t:panelTab>
>                                         <t:panelTab label="tab2" 
> rendered="true" >
>                                                 <f:subview id="tab1view">
>                                                         <h:form>
>                                                                 test    2<br 
> />
>                                                         </h:form>
>                                                 </f:subview>
>                                         </t:panelTab>
>                                         <t:panelTab label="tab3" 
> rendered="true" >
>                                                 <f:subview id="tab1view">
>                                                         <h:form>
>                                                                 test    3<br 
> />
>                                                         </h:form>
>                                                 </f:subview>
>                                         </t:panelTab>
>                                         <t:panelTab label="tab4" 
> rendered="true" >
>                                                 <f:subview id="tab1view">
>                                                         <h:form>
>                                                                 test    4<br 
> />
>                                                         </h:form>
>                                                 </f:subview>
>                                         </t:panelTab>
>                                         <t:panelTab label="tab5" 
> rendered="true" >
>                                                 <f:subview id="tab1view">
>                                                         <h:form>
>                                                                 test    5<br 
> />
>                                                         </h:form>
>                                                 </f:subview>
>                                         </t:panelTab>
>                                 </t:panelTabbedPane>
>
> *******************************************************************************
> here are the relevant part of the tomahawk.taglib.xml file:
> ********************************************************************************
> <tag>
>         <tag-name>panelTab</tag-name>
>         <component>
>             <component-type>org.apache.myfaces.HtmlPanelTab</component-type>
>             <renderer-type>javax.faces.Group</renderer-type>
>         </component>
>     </tag>
>     <tag>
>         <tag-name>panelTabbedPane</tag-name>
>         <component>
>             
> <component-type>org.apache.myfaces.HtmlPanelTabbedPane</component-type>
>             <renderer-type>org.apache.myfaces.TabbedPane</renderer-type>
>         </component>
>     </tag>
>
> ******************************************************************************
> my web.xml
> ******************************************************************************
>
> <?xml version="1.0" encoding="UTF-8"?>
> <web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee";
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
> xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";>
>   <description>Facelets StarterKit</description>
>   <display-name>MyFacesFacelets</display-name>
>  <context-param>
>   <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
>   <param-value>.xhtml</param-value>
>  </context-param>
>  <context-param>
>   <param-name>facelets.REFRESH_PERIOD</param-name>
>   <param-value>2</param-value>
>  </context-param>
>  <context-param>
>   <param-name>facelets.DEVELOPMENT</param-name>
>   <param-value>true</param-value>
>  </context-param>
>  <context-param>
>   <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
>   <param-value>client</param-value>
>  </context-param>
>  <context-param>
>   <param-name>com.sun.faces.validateXml</param-name>
>   <param-value>true</param-value>
>  </context-param>
>  <context-param>
>   <param-name>com.sun.faces.verifyObjects</param-name>
>   <param-value>true</param-value>
>  </context-param>
>  <context-param>
>   <param-name>facelets.LIBRARIES</param-name>
>   <param-value>/WEB-INF/tomahawk.taglib.xml</param-value>
>  </context-param>
>
>  <filter>
>         <filter-name>extensionsFilter</filter-name>
>         <filter-class>
>                 org.apache.myfaces.component.html.util.ExtensionsFilter
>         </filter-class>
>         <init-param>
>                 <description>
>                         Set the size limit for uploaded files. Format: 10 - 10
>                         bytes 10k - 10 KB 10m - 10 MB 1g - 1 GB
>                 </description>
>                 <param-name>uploadMaxFileSize</param-name>
>                 <param-value>100m</param-value>
>
>         </init-param>
>         <init-param>
>                 <description>
>                         Set the threshold size - files below this limit are
>                         stored in memory, files above this limit are stored on
>                         disk.
>
>                         Format: 10 - 10 bytes 10k - 10 KB 10m - 10 MB 1g - 1 
> GB
>                 </description>
>                 <param-name>uploadThresholdSize</param-name>
>                 <param-value>100k</param-value>
>
>         </init-param>
> </filter>
>
> <filter-mapping>
>    <filter-name>extensionsFilter</filter-name>
>    <url-pattern>/faces/*</url-pattern>
> </filter-mapping>
> <filter-mapping>
>    <filter-name>extensionsFilter</filter-name>
>    <url-pattern>*.jsf</url-pattern>
> </filter-mapping>
> <filter-mapping>
>    <filter-name>extensionsFilter</filter-name>
>    <url-pattern>*.faces</url-pattern>
> </filter-mapping>
> <servlet>
>   <servlet-name>Faces Servlet</servlet-name>
>   <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
>   <load-on-startup>1</load-on-startup>
>  </servlet>
> <servlet-mapping>
>   <servlet-name>Faces Servlet</servlet-name>
>   <url-pattern>/faces/*</url-pattern>
> </servlet-mapping>
> </web-app>
>
>
> ********************************************************************************
> and my faces-config.xml
> ********************************************************************************
>
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD
> JavaServer Faces Config 1.1//EN"
>                               
> "http://java.sun.com/dtd/web-facesconfig_1_1.dtd";>
> <faces-config>
>  <managed-bean>
>   <managed-bean-name>person</managed-bean-name>
>   <managed-bean-class>demo.Person</managed-bean-class>
>   <managed-bean-scope>request</managed-bean-scope>
>   <managed-property>
>    <property-name>name</property-name>
>    <value/>
>   </managed-property>
>  </managed-bean>
>  <navigation-rule>
>   <from-view-id>/pages/inputname.xhtml</from-view-id>
>   <navigation-case>
>    <from-outcome>greeting</from-outcome>
>    <to-view-id>/pages/greeting.xhtml</to-view-id>
>   </navigation-case>
>  </navigation-rule>
>  <application>
>   <view-handler>com.sun.facelets.FaceletViewHandler</view-handler>
>   <locale-config>
>    <default-locale>en</default-locale>
>    <supported-locale>en</supported-locale>
>    <supported-locale>fr</supported-locale>
>   </locale-config>
>  </application>
> </faces-config>
>
> *************************************************************************************
>
>      Travis
>

Reply via email to