JBoss.orgCommunity Documentation

Frequently Asked Questions

Based on RichFaces Users Forum


1. FAQ
1.1. Where could I find additional information on RichFaces?
1.2. Where are binary/source distribution for RichFaces?
1.3. How to build RichFaces snapshot manually?
1.4. How to configure Maven for RichFaces
1.5. What is the structure of RichFaces SVN repository?
1.6. How to build richfaces-samples applications?
1.7. Where could I find a demo for RichFaces components?
1.8. How to use Skinnability?
1.9. Why does a problem with prototypes in RichFaces 3.1.0 happen? The Prototype.Browser() function can't be found.
1.10. Why RichFaces library contains <rich:dataTable> component, though there is the standard <h:dataTable>?
1.11. How to organize wizards using the <rich:modalPanel> component?
1.12. How to prevent modalPanel from closing when the validation inside fails?
1.13. Why when I use suggestionBox inside the modalPanel content the popup suggestion list doesn't show since it is behind the modalPanel.
1.14. Does RichFaces work with facelets?
1.15. Is it possible to create dynamic menu using <rich:dropDownMenu> component?
1.16. Is it possible to customize the look of dataScroller (the forward/back buttons) and replace them with an images?
1.17. How to place simple links inside menu?
1.18. Can I use dropDownMenu as context menu?
1.19. How to pass own parameters during a modalPanel opening or closing?
1.20. How to add a simple link to the tree node?
1.21. Is it possible to place tabs upright in the tabPanel?
1.22. How to get a commandButton working within the modalPanel?
1.23. How to define the currently selected tab?
1.24. How to remember the current selected tab?
1.25. How to navigate from one tab to another using buttons (apart from tabPanel functionality)?
1.26. How to retrieve the current value from the inputNumberSlider?
1.27. How to apply skins to the standard input components?
1.28. Is there a way to capture the rowdata of dataTable and subTable?
1.29. Is it possible to use datascroller without its table border and styles (to show only links)?
1.30. How to use subTable in combination with dataTable?
1.31. How to do correct pagination using datascroller (load a part of data from database)?
1.32. How to make html scrollbars in modalPanel?
1.33. How to expand/collapse tree nodes from code?
1.34. How to use JavaScript API?
1.35. How to load the Scriptaculous library?
1.36. How to avoid a problem with text wrapping in <rich:tab> in Internet Explorer 7?
1.37. How to save <rich:effect> status?
1.38. How to send an additional parameter to server working with <rich:suggestionbox>?
1.39. How to set <rich:dataTable> border to 0px?
1.40. How to create <rich:suggestionBox> dynamically?
1.41. How to apply button lable for <rich: calendar>?
1.42. What should I change on the server side?
1.43. How to check sending request conditions? Custom JavaScript before request "OnSubmit" attribute.
1.44. What is differences of "onCompelete" attribute after release 1.0?
1.45. Is it possible to use InvokeOnComponent with JSF 1.2?
1.46. How to avoid generating exception for "keepAlive" component?
1.47. Why form isn't submitted or setter isn't called after AJAX request?
1.48. How to create "a4j delayed render zone"?
1.49. How to stop "a4j:poll"?
1.50. How to use IgnoreDupResponses and requestDelay?
1.51. How to refresh an image using <a4j:support> component?
1.52. How to use "EventQueue" attribute?
1.53. Is <a4j:page> component required or not?
1.54. Can I have several <a4j:status> components on one page?
1.55. Can I use <a4j:region> within <a4j:repeat>?
1.56. Why custom Ajax request does not work?
1.57. How to reRender single dataTable column?
1.58. How to disable skinability?
1.59. Why does reRendering fail? Hide/Show components using rendered.
1.60. How to prevent duplicate reRendering when using <a4j:poll>?
1.61. Why does JavaScript call don't work in <a4j:include>?
1.62. How to use <a4j:include> and navigation rules?
1.63. What does ResourceNotRegistered Exception mean?
1.64. How to reRender only particular row(s) of table?
1.65. How to get row selection in scrollableDataTable using one and multi-selection rows mode?
1.66. How to select several rows in a scrollableDataTable and Drag-and-Drop them on dataTable?
1.67. How to save the state of <rich:simpleTogglePanel>?
1.68. How to save the state of <rich:panelMenuGroup>?
1.69. How to highlight rows in a dataTable when the mouse is over?
1.70. How to select one row of a dataTable by clicking on it, even if clicked in an inputText of this row?
1.71. How to reRender table cells with <a4j:support>?
1.72. How to dynamic columns?
1.73. RichFaces with Trinidad?
1.74. Why does Java Script conflict?
1.75. <rich:fileUpload> with Seam
1.76. Optional object selection in <rich:suggestionbox>
1.77. How to handle ViewExpiredException?
1.1. Where could I find additional information on RichFaces?
1.2. Where are binary/source distribution for RichFaces?
1.3. How to build RichFaces snapshot manually?
1.4. How to configure Maven for RichFaces
1.5. What is the structure of RichFaces SVN repository?
1.6. How to build richfaces-samples applications?
1.7. Where could I find a demo for RichFaces components?
1.8. How to use Skinnability?
1.9. Why does a problem with prototypes in RichFaces 3.1.0 happen? The Prototype.Browser() function can't be found.
1.10. Why RichFaces library contains <rich:dataTable> component, though there is the standard <h:dataTable>?
1.11. How to organize wizards using the <rich:modalPanel> component?
1.12. How to prevent modalPanel from closing when the validation inside fails?
1.13. Why when I use suggestionBox inside the modalPanel content the popup suggestion list doesn't show since it is behind the modalPanel.
1.14. Does RichFaces work with facelets?
1.15. Is it possible to create dynamic menu using <rich:dropDownMenu> component?
1.16. Is it possible to customize the look of dataScroller (the forward/back buttons) and replace them with an images?
1.17. How to place simple links inside menu?
1.18. Can I use dropDownMenu as context menu?
1.19. How to pass own parameters during a modalPanel opening or closing?
1.20. How to add a simple link to the tree node?
1.21. Is it possible to place tabs upright in the tabPanel?
1.22. How to get a commandButton working within the modalPanel?
1.23. How to define the currently selected tab?
1.24. How to remember the current selected tab?
1.25. How to navigate from one tab to another using buttons (apart from tabPanel functionality)?
1.26. How to retrieve the current value from the inputNumberSlider?
1.27. How to apply skins to the standard input components?
1.28. Is there a way to capture the rowdata of dataTable and subTable?
1.29. Is it possible to use datascroller without its table border and styles (to show only links)?
1.30. How to use subTable in combination with dataTable?
1.31. How to do correct pagination using datascroller (load a part of data from database)?
1.32. How to make html scrollbars in modalPanel?
1.33. How to expand/collapse tree nodes from code?
1.34. How to use JavaScript API?
1.35. How to load the Scriptaculous library?
1.36. How to avoid a problem with text wrapping in <rich:tab> in Internet Explorer 7?
1.37. How to save <rich:effect> status?
1.38. How to send an additional parameter to server working with <rich:suggestionbox>?
1.39. How to set <rich:dataTable> border to 0px?
1.40. How to create <rich:suggestionBox> dynamically?
1.41. How to apply button lable for <rich: calendar>?
1.42. What should I change on the server side?
1.43. How to check sending request conditions? Custom JavaScript before request "OnSubmit" attribute.
1.44. What is differences of "onCompelete" attribute after release 1.0?
1.45. Is it possible to use InvokeOnComponent with JSF 1.2?
1.46. How to avoid generating exception for "keepAlive" component?
1.47. Why form isn't submitted or setter isn't called after AJAX request?
1.48. How to create "a4j delayed render zone"?
1.49. How to stop "a4j:poll"?
1.50. How to use IgnoreDupResponses and requestDelay?
1.51. How to refresh an image using <a4j:support> component?
1.52. How to use "EventQueue" attribute?
1.53. Is <a4j:page> component required or not?
1.54. Can I have several <a4j:status> components on one page?
1.55. Can I use <a4j:region> within <a4j:repeat>?
1.56. Why custom Ajax request does not work?
1.57. How to reRender single dataTable column?
1.58. How to disable skinability?
1.59. Why does reRendering fail? Hide/Show components using rendered.
1.60. How to prevent duplicate reRendering when using <a4j:poll>?
1.61. Why does JavaScript call don't work in <a4j:include>?
1.62. How to use <a4j:include> and navigation rules?
1.63. What does ResourceNotRegistered Exception mean?
1.64. How to reRender only particular row(s) of table?
1.65. How to get row selection in scrollableDataTable using one and multi-selection rows mode?
1.66. How to select several rows in a scrollableDataTable and Drag-and-Drop them on dataTable?
1.67. How to save the state of <rich:simpleTogglePanel>?
1.68. How to save the state of <rich:panelMenuGroup>?
1.69. How to highlight rows in a dataTable when the mouse is over?
1.70. How to select one row of a dataTable by clicking on it, even if clicked in an inputText of this row?
1.71. How to reRender table cells with <a4j:support>?
1.72. How to dynamic columns?
1.73. RichFaces with Trinidad?
1.74. Why does Java Script conflict?
1.75. <rich:fileUpload> with Seam
1.76. Optional object selection in <rich:suggestionbox>
1.77. How to handle ViewExpiredException?

There are two places where you can find binary/source distribution:

  • JBoss RichFaces Downloads area which can be found here. Source distribution you can see in the richfaces-ui-3.2.0-src.zip. Binary stored in richfaces-ui-3.2.0-bin.zip
  • If you use Maven, Maven knows the place where all distributions are stored. Actual links to the Maven repository can be found here

  • Download and install Maven if you have not it yet installed. Follow the instruction at http://maven.apache.org/download.html.

  • Open <Maven-Root>/conf/settings.xml file to edit

    Add into the <profile> section:

    
    
       <id>RichFaces</id>
       <repositories>
          <repository>
             <releases>
                <enabled>true</enabled>
             </releases>
             <snapshots>
                <enabled>false</enabled>
                <updatePolicy>never</updatePolicy>
             </snapshots>
             <id>repository.jboss.com</id>
             <name>Jboss Repository for Maven</name>
             <url>
                http://repository.jboss.com/maven2/
             </url>
             <layout>default</layout>
          </repository>
          <repository>
             <releases>
                <enabled>false</enabled>
             </releases>
             <snapshots>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
             </snapshots>
             <id>maven2-snapshots.jboss.com</id>
             <name>Jboss Repository for Maven Snapshots</name>
             <url>http://snapshots.jboss.com/</url>
             <layout>default</layout>
          </repository>
       </repositories>
     <pluginRepositories>
       <pluginRepository>
             <id>maven2-snapshots.jboss.com</id>
             <name>Jboss Repository for Maven Snapshots</name>
             <url>http://snapshots.jboss.com/</url>
         <releases>
           <enabled>false</enabled>
         </releases>
         <snapshots>
           <enabled>true</enabled>
           <updatePolicy>always</updatePolicy>
         </snapshots>
       </pluginRepository>
       <pluginRepository>
             <releases>
                <enabled>true</enabled>
             </releases>
             <snapshots>
                <enabled>false</enabled>
                <updatePolicy>never</updatePolicy>
             </snapshots>
             <id>repository.jboss.com</id>
             <name>Jboss Repository for Maven</name>
             <url>
                http://repository.jboss.com/maven2/
             </url>
             <layout>default</layout>
       </pluginRepository>
     </pluginRepositories>

    Add into the <activeProfiles> section:

    
    <activeProfile>RichFaces</activeProfile>

Here is an article that explains the Skinnability basics.

For information you can also see discussion about this problem on the RichFaces Users Forum

Also, the effect of predefined skins on the application whole look-and-feel could be seen here.

It's necessary to put <a4j:include> inside the <rich:modalPanel> and perform navigation inside it, as it's shown in the example below:

Example:


...
        <f:verbatim>
                <a href="javascript:Richfaces.showModalPanel('_panel',{left:'auto', top:'auto'})">Show Modal Panel</a>
        </f:verbatim>
        <rich:modalPanel id="_panel">
                <a4j:outputPanel id="view" >
                        <a4j:include viewId="/pages/included1.xhtml"></a4j:include>
                </a4j:outputPanel>
        </rich:modalPanel>
...

faces-config.xml:
...

        <navigation-rule>
                <from-view-id>/pages/included1.xhtml</from-view-id>
                <navigation-case>
                        <from-outcome>included2</from-outcome>
                        <to-view-id>/pages/included2.xhtml</to-view-id>
                </navigation-case>
        </navigation-rule>
...

included1.xhtml:
...
        <h:form>
                <h:outputText value="Go to the step 2"/>
                <a4j:commandButton value="next" action="included2" reRender="view"/>
        </h:form>
...

included2.xhtml

...
        <h:form>
                <h:outputText value="Close window"/>
                <h:commandButton type="button" value="Close" onclick="javascript:Richfaces.hideModalPanel('_panel')"/>
        </h:form>
...

The discussion about <a4j:include> and navigation rules can be found on the Ajax Users Forum.

Main demo of RichFaces is a facelets based application. Full Facelets support is one of the main features. Hence, the answer is yes.

This is a working example:

...

        org.apache.myfaces.component.html.ext.HtmlInputText searchBox = new org.apache.myfaces.component.html.ext.HtmlInputText();
        searchBox.setId( "inputQuery" );
        bar.getChildren().add( searchBox );
        org.richfaces.component.html.HtmlSuggestionBox suggestions = new org.richfaces.component.html.HtmlSuggestionBox();
        suggestions.setId( "sugg" );
        suggestions.setFor( "inputQuery" );
        suggestions.setTokens( ",[" );
        suggestions.setRules( "none" );
        javax.faces.el.MethodBinding mb = app.createMethodBinding( "#{suggestionBox.autocomplete}", new Class[] { Object.class } );
        suggestions.setSuggestionAction( mb );
        suggestions.setVar( "result" );
        suggestions.setRows( 0 );
        suggestions.setFirst( 0 );
        suggestions.setMinChars( "#{suggestionBox.minchars}" );
        suggestions.setShadowOpacity( "4" );
        suggestions.setBorder( "1" );
        suggestions.setWidth( "200" );
        suggestions.setHeight( "150" );
        suggestions.setShadowDepth( "4" );
        suggestions.setCellpadding( "2" );
        org.apache.myfaces.custom.column.HtmlSimpleColumn column = new org.apache.myfaces.custom.column.HtmlSimpleColumn();
        column.setId( "col1" );
        org.apache.myfaces.component.html.ext.HtmlOutputText text = new org.apache.myfaces.component.html.ext.HtmlOutputText();
        text.setId( "text1" );
        javax.faces.el.ValueBinding vb = app.createValueBinding( "#{result.text}" );
        text.setValueBinding( "value", vb );
        column.getChildren().add( text );
        suggestions.getChildren().add( column );
        bar.getChildren().add( suggestions );
...

See also RichFaces User Forum.

The "IgnoreDupResponses" attribute appeared from 1.0.4 RC1 version and is used on the client for response ignoring after an Ajax request if a newer request has been already sent.

The additional information could be found here.

"RequestDelay" attribute also defines the client behavior. It sets the time delay, after which another request could be sent, all other requests are taken away from a queue except the last one.

In order to get row selection in scrollableDataTable using one and multi-selection rows mode you should use the "selection" attribute.

In the following example when user submits the form current collection of objects selected by user is placed in the object's property. Then on complete action the <rich:modalPanel> with selected data will be shown.

Example:


...
<h:form>
        <rich:spacer height="30" />
        <rich:scrollableDataTable rowKeyVar="rkv" frozenColCount="1" height="200px" 
                width="300px" id="carList" rows="40" columnClasses="col"
                value="#{dataTableScrollerBean.allCars}" var="category" sortMode="single"
                selection="#{dataTableScrollerBean.selection}">
                        <rich:column id="make">
                                <f:facet name="header">
                                        <h:outputText styleClass="headerText" value="Make" />
                                </f:facet>
                                <h:outputText value="#{category.make}" />
                        </rich:column>
                        <rich:column id="model">
                                <f:facet name="header">
                                        <h:outputText styleClass="headerText" value="Model" />
                                </f:facet>
                                <h:outputText value="#{category.model}" />
                        </rich:column>
                        <rich:column id="price">
                                <f:facet name="header">
                                        <h:outputText styleClass="headerText" value="Price" />
                                </f:facet>
                                <h:outputText value="#{category.price}" />
                        </rich:column>
        </rich:scrollableDataTable>
        <rich:spacer height="20px"/>
        <a4j:commandButton value="Show Current Selection" reRender="table" 
                action="#{dataTableScrollerBean.takeSelection}" 
                oncomplete="javascript:Richfaces.showModalPanel('panel');"/>
</h:form>
<rich:modalPanel id="panel" autosized="true">
        <f:facet name="header">
                <h:outputText value="Selected Rows"/>
        </f:facet>
        <f:facet name="controls">
                <span style="cursor:pointer" onclick="javascript:Richfaces.hideModalPanel('panel')">X</span>
        </f:facet>
        <rich:dataTable value="#{dataTableScrollerBean.selectedCars}" var="sel" id="table">
                <rich:column>
                        <f:facet name="header">
                                <h:outputText value="Make" />
                        </f:facet>
                        <h:outputText value="#{sel.make}" />
                </rich:column>
                <rich:column id="model">
                        <f:facet name="header">
                                <h:outputText value="Model" />
                        </f:facet>
                        <h:outputText value="#{sel.model}" />
                </rich:column>
                <rich:column id="price">
                        <f:facet name="header">
                                <h:outputText value="Price" />
                        </f:facet>
                        <h:outputText value="#{sel.price}" />
                </rich:column>
        </rich:dataTable>
</rich:modalPanel>
...

In order to build this application, you can create a managed bean like this one. Function takeSelection() fills the array selectedCars with the data, got from the selection. Function getSelectedCars() returns the array selectedCars, which is used for filling <rich:dataTable> with selected row/rows data.

Example:


...
public class DataTableScrollerBean {
        private SimpleSelection selection = new SimpleSelection();
        private ArrayList<DemoInventoryItem> selectedCars = new ArrayList<DemoInventoryItem>(); 
        ...
        public SimpleSelection getSelection() {
                return selection;
        }
        public void setSelection(SimpleSelection selection) {
                System.out.println("Setting Started");
                this.selection = selection;
        System.out.println("Setting Complete");
        }
        public String takeSelection() {
                getSelectedCars().clear();
                Iterator<SimpleRowKey> iterator = getSelection().getKeys();
                while (iterator.hasNext()){
                        SimpleRowKey key = iterator.next();
                        getSelectedCars().add(getAllCars().get(key.intValue()));
                }
                return null;
        }
        public ArrayList<DemoInventoryItem> getSelectedCars() {
                return selectedCars;
        }
        public void setSelectedCars(ArrayList<DemoInventoryItem> selectedCars) {
                this.selectedCars = selectedCars;
        }
}
...

Some additional information about usage of one and multi-selection rows mode can be found here.

How to get row selection in scrollableDataTable using one and multi-selection rows mode you could see the section above.

In order to perform Drag-and-Drop of selected columns on a dataTable you could use <rich:dragSupport> and <rich:dropSupport> components as it is shown in the example below.

Example:


...
<rich:scrollableDataTable rowKeyVar="rkv" frozenColCount="1" height="400px" width="700px" id="carList" rows="40" columnClasses="col"
                                        value="#{dataTableScrollerBean.allCars}" var="category" sortMode="single" selection="#{dataTableScrollerBean.selection}">
        <rich:column id="make">
                <f:facet name="header">
                        <h:outputText styleClass="headerText" value="Make" />
                </f:facet>
                <a4j:outputPanel>
                        <rich:dragSupport dragType="selectionDrag" dragIndicator=":indicator"/>
                        <h:outputText value="#{category.make}" />
                </a4j:outputPanel>
        </rich:column>
        <rich:column id="model">
                <f:facet name="header">
                        <h:outputText styleClass="headerText" value="Model" />
                </f:facet>
                <h:outputText value="#{category.model}" />
        </rich:column>
        <rich:column id="price">
                <f:facet name="header">
                        <h:outputText styleClass="headerText" value="Price" />
                </f:facet>
                <h:outputText value="#{category.price}" />
        </rich:column>
        <rich:column id="mileage">
                <f:facet name="header">
                        <h:outputText styleClass="headerText" value="Mileage" />
                </f:facet>
                <h:outputText value="#{category.mileage}" />
        </rich:column>
        <rich:column width="200px" id="vin">
                <f:facet name="header">
                        <h:outputText styleClass="headerText" value="VIN" />
                </f:facet>
                <h:outputText value="#{category.vin}" />
        </rich:column>
        <rich:column id="stock">
                <f:facet name="header">
                        <h:outputText styleClass="headerText" value="Stock" />
                </f:facet>
                <h:outputText value="#{category.stock}" />
        </rich:column>
</rich:scrollableDataTable>
<rich:spacer height="20px"/>
<rich:panel style="width:300px; height:300px">
        <f:facet name="header">
                <h:outputText value="Drop Here"/>
        </f:facet>
        <rich:dropSupport acceptedTypes="selectionDrag" dropListener="#{dataTableScrollerBean.dropListener}" reRender="table"/>
        <rich:dataTable value="#{dataTableScrollerBean.droppedCars}" var="sel" id="table">
                <rich:column>
                        <f:facet name="header">
                                <h:outputText value="Make" />
                        </f:facet>
                        <h:outputText value="#{sel.make}" />
                </rich:column>
                <rich:column id="model">
                        <f:facet name="header">
                                <h:outputText value="Model" />
                        </f:facet>
                        <h:outputText value="#{sel.model}" />
                </rich:column>
                <rich:column id="price">
                        <f:facet name="header">
                                <h:outputText value="Price" />
                        </f:facet>
                        <h:outputText value="#{sel.price}" />
                </rich:column>
                <rich:column id="mileage">
                        <f:facet name="header">
                                <h:outputText value="Mileage" />
                        </f:facet>
                        <h:outputText value="#{sel.mileage}" />
                </rich:column> 
                <rich:column id="stock">
                        <f:facet name="header">
                                <h:outputText value="Stock" />
                        </f:facet>
                        <h:outputText value="#{sel.stock}" />
                </rich:column>
        </rich:dataTable>
</rich:panel>
...

This is the page from RichFaces LiveDemo site and also uses beans from RichFaces LiveDemo site. Only one method is added where the dropped selection is stored:

...

public void dropListener(DropEvent event) {
        System.out.println("Drop Listener Fired");
        getDroppedCars().clear();
        Iterator<SimpleRowKey> item = getSelection().getKeys();
        while (item.hasNext()){
                SimpleRowKey key = item.next();
                getDroppedCars().add(getAllCars().get(key.intValue()));
        }
}
...

In order to save the state (exapnd/collapse) of the <rich:simpleTogglePanel> component you could use "opened" attribute responsible for keeping a panel state and <a4j:support> binded to onexpand and oncollapse events.

In the following example when you click on the toggle icon <rich:simpleTogglePanel> appears and current state displays on <rich:modalPanel>. This state is remembered between page views.

Example:


...
<rich:simpleTogglePanel id="toggleP" label="simpleTogglePanel" switchType="client" width="600px" opened="#{bean.state}">
        <a4j:support event="onexpand" actionListener="#{bean.stateTrue}" reRender="repeater" oncomplete="Richfaces.showModalPanel('myFrom:panel')" />
        <a4j:support event="oncollapse" actionListener="#{bean.stateFalse}" reRender="repeater" oncomplete="Richfaces.showModalPanel('myFrom:panel')" />
        <h:panelGrid columns="2" border="0">
                <h:graphicImage url="pics/Canon.jpg" alt="" width="100px" height="100px" />
                <h:panelGroup>
                        <h:outputText style="font: 18px;font-weight: bold;" value="Canon EOS Digital Rebel XT" />
                        <f:verbatim>
                                <br />
                                8.2 Megapixels - SLR / Large Digital Camera - 1.8 in LCD Screen -
                                Storage: Compact Flash, Compact Flash Type II - Built In Flash
                        </f:verbatim>
                </h:panelGroup>
        </h:panelGrid>
</rich:simpleTogglePanel>
<rich:modalPanel id="panel" width="300" height="100">
        <f:facet name="header">
                <h:outputText value="States of simpleTogglePanel" />
        </f:facet>
        <f:facet name="controls">
                <span style="cursor: pointer" onclick="Richfaces.hibeandalPanel('myFrom:panel')">X</span>
        </f:facet>
        <h:outputText value="Expanded simpleTogglePanel: " style="font-weight:bold;" />
        <h:outputText value="#{bean.state}" id="repeater" />
</rich:modalPanel>
...

In order to build this application, you can create a managed bean like this one.

Example:


...
public class bean {

        private boolean  state = false;
        
        public boolean isState() {
                return state;
        }
        
        public void setState(boolean state) {
                this.state = state;
        }   
        
        public void stateTrue(ActionEvent event) {
                this.state = true;
        }
        
        public void stateFalse(ActionEvent event) {
                this.state = false;
        } 
}
...

With the help of the "expanded" attribute and <a4j:support> binded to onexpand and oncollapse events you could keep the state (exapnd/collapse) of the <rich:panelMenuGroup> component.

In the following example when you click on the toggle icon the <rich:panelMenuGroup> expands and current state displays on <rich:modalPanel>. This state is remembered between page views.

Example:


...
<h:form id="myFrom">
        <rich:panelMenu expandMode="ajax" iconExpandedTopGroup="chevronUp" iconCollapsedTopGroup="chevronDown">
                <rich:panelMenuGroup label="Group 1" expanded="#{bean.state}">
                        <a4j:support event="onexpand" actionListener="#{bean.stateTrue}" reRender="repeater" oncomplete="Richfaces.showModalPanel('myFrom:panel')" />
                        <a4j:support event="oncollapse" actionListener="#{bean.stateFalse}" reRender="repeater" oncomplete="Richfaces.showModalPanel('myFrom:panel')" />
                        <rich:panelMenuItem label="Item 1.1" />
                        <rich:panelMenuItem label="Item 1.2" />
                        <rich:panelMenuItem label="Item 1.3" />
                </rich:panelMenuGroup>  
        </rich:panelMenu>
        <rich:modalPanel id="panel" width="230" height="50">
                <f:facet name="header">
                        <h:outputText value="States of rich:panelMenuGroup" />
                </f:facet>
                <f:facet name="controls">
                        <span style="cursor: pointer" onclick="Richfaces.hideModalPanel('myFrom:panel')">X</span>
                </f:facet>
                <h:outputText value="Expanded rich:panelMenuGroup: " />
                <h:outputText value="#{bean.state}" id="repeater" />
        </rich:modalPanel>
</h:form>
...

In order to build this application, you can create a managed bean like this one.

In order to highlight rows in a dataTable when the mouse is over you should use "onRowMouseOver" and "onRowMouseOut" attributes.

Example:


...
<h:form>        
        <rich:dataTable onRowMouseOver="this.style.font = 'bold 20pt Arial'"
                                     onRowMouseOut="this.style.font='#{a4jSkin.tableFont}'"
                                     cellpadding="0" cellspacing="0" 
                                     width="700" border="0" var="record" value="#{report.expReport.records}" 
                                     onRowClick="#{dataTableBean.onRowClick}">
                <f:facet name="header">
                        <rich:columnGroup>
                                <rich:column rowspan="2">
                                        <rich:spacer />
                                </rich:column>
                                <rich:column colspan="3">
                                               <h:outputText value="Expenses" />
                                </rich:column>
                                <rich:column rowspan="2">
                                        <h:outputText value="subtotals" />
                                </rich:column>
                                <rich:column breakBefore="true">
                                        <h:outputText value="Meals" />
                                </rich:column>
                                <rich:column>
                                        <h:outputText value="Hotels" />
                                </rich:column>
                                <rich:column>
                                        <h:outputText value="Transport" />
                                </rich:column>
                        </rich:columnGroup>
                </f:facet>
                <rich:column  colspan="5">
                        <h:outputText value="#{record.city}" />
                </rich:column>
                <rich:subTable onRowMouseOver="this.style.font = 'bold 20pt Arial'"
                                            onRowMouseOut="this.style.font='#{a4jSkin.tableFont}'"
                                            var="expense" value="#{record.items}">
                        <rich:column>
                                <h:outputText value="#{expense.day}"></h:outputText>
                                <f:facet name="footer">
                                        <rich:spacer />
                                </f:facet>
                        </rich:column>
                        <rich:column>
                                <h:outputText value="#{expense.meals}"><f:convertNumber   pattern="$####.00"  /></h:outputText>
                                <f:facet name="footer">
                                        <h:outputText value="#{record.totalMeals}"><f:convertNumber  pattern="$####.00" /></h:outputText>
                                </f:facet>
                        </rich:column>
                        <rich:column>
                                        <h:outputText value="#{expense.hotels}"><f:convertNumber  pattern="$####.00"  /></h:outputText>
                                        <f:facet name="footer">
                                                        <h:outputText value="#{record.totalHotels}"><f:convertNumber   pattern="$####.00"  /></h:outputText>
                                        </f:facet>
                        </rich:column>
                        <rich:column>
                                        <h:outputText value="#{expense.transport}"><f:convertNumber   pattern="$####.00"  /></h:outputText>
                                        <f:facet name="footer">
                                                <h:outputText value="#{record.totalTransport}"><f:convertNumber   pattern="$####.00"  /></h:outputText>
                                        </f:facet>
                        </rich:column>
                        <rich:column>
                                <rich:spacer></rich:spacer>
                                <f:facet name="footer">
                                        <h:outputText value="#{record.total}"><f:convertNumber   pattern="$####.00"    /></h:outputText>
                                </f:facet>
                        </rich:column>                  
                </rich:subTable>
                <f:facet name="footer">
                <rich:columnGroup>
                        <rich:column>Totals</rich:column>
                        <rich:column>
                                <h:outputText value="#{report.expReport.totalMeals}"><f:convertNumber   pattern="$####.00"  /></h:outputText>
                        </rich:column>
                        <rich:column>
                                <h:outputText value="#{report.expReport.totalHotels}"><f:convertNumber   pattern="$####.00"  /></h:outputText>
                        </rich:column>
                        <rich:column>
                                <h:outputText value="#{report.expReport.totalTransport}"><f:convertNumber   pattern="$####.00"  /></h:outputText>
                        </rich:column>
                        <rich:column>
                                <h:outputText value="#{report.expReport.grandTotal}"><f:convertNumber   pattern="$####.00"  /></h:outputText>
                        </rich:column>
                </rich:columnGroup>
        </f:facet>
</rich:dataTable>
</h:form>
...

In order to reRender table cells with <a4j:support> you should set exact ids values for every updatable components and point this id to the "reRender" attribute.

Example:


...
<rich:column>
        <f:facet name="header">
                <h:outputText  value="Input1"/>
        </f:facet>
        <f:facet name="footer">
                <h:outputText  value="#{Controller.totalInput1}"/>
        </f:facet>
        <h:inputText id="input1" value="#{entry.input1}">
                <a4j:support actionListener="{Controller.updateEntry}"event="onblur" reRender="output1"/>
        </h:inputText>
</rich:column>
<rich:column>
        <f:facet name="header">
                <h:outputText value="Value2"/>
        </f:facet>
        <f:facet name="footer">
                <h:outputText value="#{Controller.totalOutput1}"/>
        </f:facet>
        <h:outputText id="output1" value="#{entry.output1}"/>
</rich:column>
...

As it could be seen in the example above, the footer with <h:outputText> reRenderes.

In order to create dynamic columns you could use the <rich:column> component with the"rendered" attribute. You should just set the value of defined dynamic cell to the "rendered" attribute field.

Example:


...
<ui:composition  template="/WEB-INF/layout/template.xhtml"> 
        <ui:define name="body">
                <h2>Table</h2>
                        <h:form>
                                <rich:dataTable id="aTable" onRowMouseOver="this.style.backgroundColor='#F1F1F1'"
                                 onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'" value="#{trb.tableData}" var="row">
                                        <f:facet name="header">
                                                <rich:columnGroup>
                                                        <rich:column colspan="2">
                                                                Testing
                                                        </rich:column>
                                                </rich:columnGroup>
                                        </f:facet>          
                                        <f:facet name="footer">
                                                <rich:columnGroup>
                                                        <rich:column colspan="2">
                                                                Footer
                                                        </rich:column>
                                                </rich:columnGroup>
                                        </f:facet>          
                                <rich:column rendered="#{trb.cellRendered['value1']}">
                                        <f:facet name="header"> 
                                                <s:div>
                                                        value1 <h:commandLink value="x" action="#{trb.hideColumn('value1')}"/>
                                                </s:div>                                        
                                        </f:facet>
                                        #{row.value1}
                                </rich:column>              
                                </rich:dataTable>
                                        Generate new table values:
                                <h:commandButton value="generate" action="#{trb.createData}"/>
                        </h:form>   
                        <h:form>
                                Select which columns are rendered.
                                <br/>
                                        <h:selectBooleanCheckbox title="value1" value="#{trb.cellRendered['value1']}"/>
                                <br/>
                                <h:commandButton value="Apply" action="rerender"/>
                        </h:form>
        </ui:define>
</ui:composition>
...

In order to build this application, you can create a managed bean like this one.

Example:



public class TableBackingRendered implements Serializable {
    private static final long serialVersionUID = 1L;
    private Random rand = new Random(System.currentTimeMillis());
    private List<TableItem> tableData;
    private Map<String, Boolean> cellRendered = new HashMap<String, Boolean>();
    public TableBackingRendered() {
        createData();
        allCellsRendered();
    }
    public String createData(){ 
            int count = rand.nextInt(25)+1;
            tableData = new ArrayList<TableItem>(count);
            for(int i=0; i<count; i++){
                tableData.add( new TableItem(
                        "value1_" +i,
                        ));
            }
            return null;
        }
    public String allCellsRendered() {
        cellRendered.put("value1", Boolean.TRUE);
        return null;
    }
    public String hideColumn(final String columnToHide) {
        cellRendered.put(columnToHide, Boolean.FALSE);
        return null;
    }
    public List<TableItem> getTableData() {
        return tableData;
    }
    public Map<String, Boolean> getCellRendered() {
        return cellRendered;
    }
    public void setCellRendered(Map<String, Boolean> cellRendered) {
        this.cellRendered = cellRendered;
    }
    public void setTableData(List<TableItem> tableData) {
        this.tableData = tableData;
    }
}
...

Here is a stripped down version of web.xml that integrates RichFaces and Trinidad.

Example:



<?xml version="1.0" ?>
<web-app 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_5.xsd" 
  version="2.5">
  
  <!-- Ajax4jsf -->
  <context-param>
    <param-name>org.ajax4jsf.SKIN</param-name>
    <param-value>blueSky</param-value>
  </context-param>
  
  <!-- Seam -->
  <listener>
    <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>
  </listener>
  <filter>
    <filter-name>Seam Filter</filter-name>
    <filter-class>org.jboss.seam.servlet.SeamFilter</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>Seam Filter</filter-name>
    <url-pattern>/*</url-pattern>
  </filter-mapping>
  <servlet>
    <servlet-name>Seam Resource Servlet</servlet-name>
    <servlet-class>org.jboss.seam.servlet.SeamResourceServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>Seam Resource Servlet</servlet-name>
    <url-pattern>/seam/resource/*</url-pattern>
  </servlet-mapping>
  
  <!-- Facelets -->
  <context-param>
    <param-name>facelets.DEVELOPMENT</param-name>
    <param-value>true</param-value>
  </context-param>
  
  <!-- JSF -->
  <context-param>
    <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
    <param-value>.xhtml</param-value>
  </context-param>
  <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>*.xhtml</url-pattern>
  </servlet-mapping>
  <context-param>        
    <param-name>javax.faces.STATE_SAVING_METHOD</param-name>        
    <param-value>server</param-value>    
  </context-param> 

  <!-- Trinidad - as suggested by a4j-trinidad example-->
  <context-param>
    <param-name>org.apache.myfaces.trinidad.ALTERNATE_VIEW_HANDLER</param-name>
    <param-value>com.sun.facelets.FaceletViewHandler</param-value>
  </context-param>
  <filter>
    <filter-name>Trinidad</filter-name>
    <filter-class>org.apache.myfaces.trinidad.webapp.TrinidadFilter</filter-class>
  </filter>
  <filter-mapping>
    <filter-name>Trinidad</filter-name>
    <url-pattern>*.xhtml</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>INCLUDE</dispatcher>
  </filter-mapping>
  <context-param>
    <param-name>org.apache.myfaces.trinidad.CACHE_VIEW_ROOT</param-name>
    <param-value>false</param-value>
  </context-param>
  <servlet>
    <servlet-name>Trinidad Resources</servlet-name>
    <servlet-class>org.apache.myfaces.trinidad.webapp.ResourceServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>Trinidad Resources</servlet-name>
    <url-pattern>/adf/*</url-pattern>
  </servlet-mapping>
  
  <!-- Security -->
  <security-constraint>
    <web-resource-collection>
      <web-resource-name>Secure Content</web-resource-name>
      <url-pattern>*.xhtml</url-pattern>
    </web-resource-collection>
    <auth-constraint>
      <role-name>AuthorizedUser</role-name>
    </auth-constraint>
    <user-data-constraint>
      <transport-guarantee>NONE</transport-guarantee>
    </user-data-constraint>
  </security-constraint>
  <login-config>
    <auth-method>BASIC</auth-method>
    <realm-name>The Restricted Zone</realm-name>
  </login-config>
  <security-role>
    <description>The role required to access restricted content</description>
    <role-name>AuthorizedUser</role-name>
  </security-role>
  
  <!-- Welcome files -->
  <welcome-file-list>
    <welcome-file>index.xhtml</welcome-file>
  </welcome-file-list>  
  
</web-app>