Create new RichFaces Documentation Jira issue

This will launch the RichFaces Jira page - to complete your feedback please login if needed, and submit the Jira.

JBoss.orgCommunity Documentation

4.6. Extending a UIInput class

The base class for all JSF components is UIComponent. When you develop <inputDate> component you could see that you subclass UIComponentBase at first. This class extends UIComponent, and provides default implementations of the all of the abstract methods of UIComponent.

You could proceed to the src/main/java/org/mycompany/component directory and find a UIInputDate.java there:

package org.mycompany.component;

import javax.faces.component.UIComponentBase;
/**
 * JSF component class
 *
 */
public abstract class UIInputDate extends UIComponentBase {
    public static final String COMPONENT_TYPE = "org.mycompany.InputDate";
    public static final String COMPONENT_FAMILY = "org.mycompany.InputDate";
}

The <inputDate> is a simple input component therefore you should import javax.faces.component.UIInput class and extend it:

package org.mycompany.component;

import javax.faces.component.UIInput;
/**
 * JSF component class
 *
 */
public abstract class UIInputDate extends UIInput {
    public static final String COMPONENT_TYPE = "org.mycompany.InputDate";
    public static final String COMPONENT_FAMILY = "org.mycompany.InputDate";
}

Each component is associated with a component type, which is used as "JSF recognized" name of the <inputDate> component. We will refer to this later in our tag handler.

The component class is the actual class path address of our <inputDate> component.

As it was mentioned before, the <inputDate> component has some attributes that are bound to the properties in the UIInputDate class (for example title, name, type, etc.). The next thing to do is to save the component state by overriding saveState() and restoreState() component methods. But you do not have to do it in the UIInputDate class by hand!

You should configure the <inputDate> component in the inputDate.xml, and the CDK factory will generate the complete UIInputDate class. How to configure the component is explained in the "Configuring component" chapter.