[richfaces-issues] [JBoss JIRA] (RF-12247) CDK: short-cuts for repetitious expressions

Lukáš Fryč (JIRA) jira-events at lists.jboss.org
Mon May 14 12:12:17 EDT 2012


    [ https://issues.jboss.org/browse/RF-12247?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12692721#comment-12692721 ] 

Lukáš Fryč commented on RF-12247:
---------------------------------

It can be simply covered by extending the {{[RendererKitUtils|https://github.com/richfaces/components/blob/develop/common/ui/src/main/java/org/richfaces/renderkit/RenderKitUtils.java]}} - all the static methods in this class are statically imported to each generated renderer.

Then you could have

{code}
<c:when test="#{hasAttribute(component, 'brand')}">
{code}

But I don't like that solution because of readability concerns.
                
> CDK: short-cuts for repetitious expressions
> -------------------------------------------
>
>                 Key: RF-12247
>                 URL: https://issues.jboss.org/browse/RF-12247
>             Project: RichFaces
>          Issue Type: Feature Request
>      Security Level: Public(Everyone can see) 
>          Components: cdk
>    Affects Versions: 4.2.0.Final
>            Reporter: Paul Dijou
>
> h3. 1) Test if an attribute is present :
> {code:xml}
> <c:when test="#{component.attributes['brand']!= null and not component.attributes['brand'].equals('')}">
> {code}
> Can become :
> {code:xml}
> <c:when test="#{component.hasAttribute('brand')}">
> {code}
> {code:java}
> public boolean hasAttribute(String attributeName) {
>     // TODO : test if the attribute is present
> }
> {code}
> h3. 2) Test if a facet is present
> Same as before but about JSF facets
> {code:xml}
> <c:when test="#{component.getFacet('brand') != null and component.getFacet('brand').rendered}">
> {code}
> Become
> {code:xml}
> <c:when test="#{component.hasFacet('brand')}">
> {code}
> {code:java}
> public boolean hasFacet(String facetName) {
>     // TODO : test if the facet is present and rendered
> }
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

       



More information about the richfaces-issues mailing list