Beware of bugs in the above code; I have only proved it correct, not tried it.

Simple Grid Creation

The a4j:repeat component is the basic iteration component of RichFaces. It allows the creation of any markup based on iterative data. This example shows a simple grid produced from a list of capital cities.

Alabama
State Capital Montgomery
State TimeZone GMT-6
Alaska
State Capital Juneau
State TimeZone GMT-9
Arizona
State Capital Phoenix
State TimeZone GMT-7
Arkansas
State Capital Little Rock
State TimeZone GMT-6
California
State Capital Sacramento
State TimeZone GMT-8
Colorado
State Capital Denver
State TimeZone GMT-7
Connecticut
State Capital Hartford
State TimeZone GMT-5
Delaware
State Capital Dover
State TimeZone GMT-5
Florida
State Capital Tallahassee
State TimeZone GMT-5
Georgia
State Capital Atlanta
State TimeZone GMT-5
Hawaii
State Capital Honolulu
State TimeZone GMT-10
Idaho
State Capital Boise
State TimeZone GMT-8
Illinois
State Capital Springfield
State TimeZone GMT-6
Indiana
State Capital Indianapolis
State TimeZone GMT-5
Iowa
State Capital Des Moines
State TimeZone GMT-6
Kansas
State Capital Topeka
State TimeZone GMT-6
Kentucky
State Capital Frankfort
State TimeZone GMT-5
Louisiana
State Capital Baton Rouge
State TimeZone GMT-6
Maine
State Capital Augusta
State TimeZone GMT-5
Maryland
State Capital Annapolis
State TimeZone GMT-5

 

http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:a4j="http://richfaces.org/a4j"
    xmlns:rich="http://richfaces.org/rich">
    <h:form>
        <h:panelGrid columns="1">
            <a4j:outputPanel id="panel" layout="block">
                <a4j:repeat value="#{capitalsBean.capitals}" var="cap" rows="20"
                    id="repeat">
                    <rich:panel style="float:left; width:200px; padding:5px;">
                        <f:facet name="header">
                            <h:panelGroup>
                                <h:graphicImage value="#{cap.stateFlag}" />
                                <h:outputText value="#{cap.state}" style="font-weight:bold" />
                            h:panelGroup>
                        f:facet>
                        <h:panelGrid columns="2">
                            <h:outputText value="State Capital" style="font-weight:bold" />
                            <h:outputText value="#{cap.name}" />
                            <h:outputText value="State TimeZone" style="font-weight:bold" />
                            <h:outputText value="#{cap.timeZone}" />
                        h:panelGrid>
                    rich:panel>
                a4j:repeat>
            a4j:outputPanel>
            <a4j:outputPanel layout="block">
                <rich:dataScroller for="repeat" render="panel" />
            a4j:outputPanel>
        h:panelGrid>
    h:form>
ui:composition>
CapitalsBean .java
package org.richfaces.demo.tables;

import java.io.Serializable;
import java.util.List;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.SessionScoped;

import org.richfaces.demo.tables.model.capitals.Capital;

@ManagedBean
@SessionScoped
public class CapitalsBean implements Serializable{
    /**
     *
     */
    private static final long serialVersionUID = -1509108399715814302L;
    @ManagedProperty(value = "#{capitalsParser.capitalsList}")
    private List capitals;

    public CapitalsBean() {
        // TODO Auto-generated constructor stub
    }

    public List getCapitals() {
        return capitals;
    }

    public void setCapitals(List capitals) {
        this.capitals = capitals;
    }

}





  • Ajax Action

  •   a4j:ajax
      Command Button Simple
      Command Link Simple
      jsFunction Simple
      Poll Simple
      Param Simple Usage
      Parameters for non-Ajax components
      Parameters from client side

  • Ajax Queue

  •   Queue
      attachQueue

  • Ajax Output/Containers

  •   outputPanel Simple
      Auto update for h:messages component
      Common status for view
      Status Simple
      Referenced status
      Referenced status
      Region
      mediaOutput for image output
      Log usage

  • Validation

  •   Standard JSF Validators
      JSR-303 Validators
      Password Validation
      Simple rich:message sample
      Simple rich:messages sample

  • Data Iteration

  •   Simple Grid Creation
      Data Table Basic
      Data Table Styling
      Data Table Sorting
      Data Table Filtering
      Data Table Edit
      ExtendedData Table Basic Usage
      ExtendedData Table Selection usage
      rich:collapsibleSubTable Basic Usage
      DataScroller Basic Usage
      DataScroller API
      Data Lists Component
      Data Grid Component

  • Trees

  •   Simple tree from XML
      Simple treeModelRecursiveAdaptor usage

  • Output/Panels

  •   Simple Panels
      Look and feel customization
      Simple Toggle Panel
      Wizard creation
      Simple Tab Panels rich:tabPanel
      Selected Tab Management
      Simple Collapsible Panel rich:collapsiblePanel
      Simple Accordion rich:accordion
      Simple popup example rich:popupPanel
      Modal panel example
      Login panel positioning
      ProgressBar in ajax mode rich:progressBar
      ProgressBar in client mode
      Simple tooltips rich:tooltip

  • Menus

  •   Simple Panel Menu rich:panelMenu
      Simple Toolbar rich:toolbar
      Icons Customization
      Top Menu rich:dropDownMenu
      Side Menu rich:dropDownMenu

  • Inputs and Selects

  •   Autocomplete in Cached Ajax mode rich:autocomplete
      Custom client filter
      Simple Calendar rich:calendar
      Client Side Styling Disablement rich:calendar
      Data Model Support
      Different Sliders samples rich:inputNumberSlider
      Different Spinners samples rich:inputNumberSpinner
      Inplace Inputs samples rich:inplaceInput
      Inplace Selects samples rich:inplaceSelect
      Upload images rich:fileUpload
      Drag and Drop usage example rich:dragIndicator
      Drag Indicator usage example rich:dragIndicator

  • Miscellaneous

  •   Standard elements skinning feature
      RichFaces Functions
      Table Filtering using componentControl and API rich:componentControl
      Passing hash options to rich:popupPanel
      jQuery usage




    affiliate_link