<?xml version="1.0" encoding="UTF-8"?>
<section id="ui_conf" xreflabel="ui_conf">
    <?dbhtml filename="ui_conf.html"?>
    <sectioninfo>
        <keywordset>
            <keyword>ui</keyword>
            <keyword>component</keyword>
            <keyword>CDK</keyword>
	<keyword>Guide</keyword>
        </keywordset>
    </sectioninfo>
	<title>Configuring component</title>
	<para>
		Well, it is almost the final step in the component creation process - component configuration.
	</para>
	<para>
		Note that you should register all the classes and attributes of the <emphasis role="bold"><property>&lt;inputDate&gt;</property></emphasis> component.
		If you will create the component dynamically on a page 
		you should register the component in the faces context configuration file - <property>faces-config.xml</property>.
		If you use a custom tag on a JSP page you need a TLD file for registration. 
		If you plan to use Facelets you need <property>inputDate.taglib.xml</property> descriptor.
	</para>
	<para>
		The <property>CDK</property> factory uses the <property>inputDate.xml</property> file 
		for generating not only the complete <code>UIInputDate</code> class, 
		but also a JSP Tag Handler, faces-config.xml and descriptors for JSP and Facelets.
	</para>
	<para>
		Please, proceed to the <property>src/main/config/component</property> directory,
		open the <ulink url="examples/inputDate_skeleton.xml">inputDate.xml</ulink> in your favorite text editor
		and take a look at the skeleton: there is a root element <emphasis role="bold"><property>&lt;components&gt;</property></emphasis>
		with the one nested <emphasis role="bold"><property>&lt;component&gt;</property></emphasis> element. 
	</para>
	<tip>
		<title>Tip:</title>
		<para>
			It is possible to create a number of components in the one project. 
			For example <emphasis role="bold"><property>&lt;rich:dataTable&gt;</property></emphasis> is a complex component that 
			includes a <emphasis role="bold"><property>&lt;rich:column&gt;</property></emphasis> 
			and/or <emphasis role="bold"><property>&lt;rich:columns&gt;</property></emphasis> components.
		</para>
	</tip>
	<para>
		Application instance stores resources defined in the descriptors at application start-up, so it is necessary to register 
		following classes:
	</para>
	<itemizedlist>
		<listitem>
			<para>
				the <code>UIInputDate</code> class 
			</para>
			<programlisting role="XML"><![CDATA[...
<name>org.mycompany.InputDate</name>
<family>org.mycompany.InputDate</family>
<classname>org.mycompany.component.html.HtmlInputDate</classname>
<superclass>org.mycompany.component.UIInputDate</superclass>
...]]></programlisting>
		</listitem>
		<listitem>
			<para>
				the <code>InputDateRenderer</code> class with the <code>htmlInputDate.jspx</code> template
			</para>
			<programlisting role="XML"><![CDATA[...
<renderer generate="true" override="true">
	<name>org.mycompany.InputDateRenderer</name>
	<template>org/mycompany/htmlInputDate.jspx</template>
</renderer>
...]]></programlisting>
		</listitem>
		<listitem>
			<para>
				the <code>InputDateTag</code> class (the JSP Tag Handler)
			</para>
			<programlisting role="XML"><![CDATA[...
<tag>
	<name>inputDate</name>
	<classname>org.mycompany.taglib.InputDateTag</classname>
	<superclass>
		org.ajax4jsf.webapp.taglib.HtmlComponentTagBase
	</superclass>
</tag>
...]]></programlisting>
		</listitem>
	</itemizedlist>
	<para>
		Note that you have not closed the <emphasis role="bold"><property>&lt;component&gt;</property></emphasis> element 
		because you are still going to add more metadata for your new component. 
		Lets to add attributes to the <property>inputDate.xml</property> configuration file as shown in the example below.
	</para>
	<para>
		<emphasis role="bold">Example:</emphasis>
	</para>
			<programlisting role="XML"><![CDATA[...
<property>
	<name>value</name>
	<classname>java.lang.Object</classname>
	<description>
		The value of the component
	</description>
</property>
<property>
	<name>title</name>
	<classname>java.lang.String</classname>
	<description>
		Defines a title of the component
	</description>
	<defaultvalue>&quot;inputDate&quot;</defaultvalue>
</property>
<property>
	<name>name</name>
	<classname>java.lang.String</classname>
	<description>
		Defines a name of the component
	</description>
</property>
<property>
	<name>styleClass</name>
	<classname>java.lang.String</classname>
	<description>
		Corresponds to the HTML class attribute
	</description>
</property>
<property>
	<name>inputStyle</name>
	<classname>java.lang.String</classname>
	<description>
		Style attribute for input field
	</description>
</property>
<property>
	<name>inputClass</name>
	<classname>java.lang.String</classname>
	<description>
		Style Class attribute for the input field
	</description>
</property>
<property>
	<name>iconClass</name>
	<classname>java.lang.String</classname>
	<description>
		Style Class attribute for the icon element
	</description>
</property>
<property>
	<name>iconStyle</name>
	<classname>java.lang.String</classname>
	<description>
		Style attribute for the icon element
	</description>
</property>
<property>
	<name>captionClass</name>
	<classname>java.lang.String</classname>
	<description>
		Style Class attribute for the Caption facet
	</description>
</property>
...]]></programlisting>
	<para>
		As you can see in the example above every attribute is defined with the help of the 
		<emphasis role="bold"><property>&lt;property&gt;</property></emphasis> element with the following nested elements: 
	</para>
	<itemizedlist>
		<listitem>
			<para>
				the <emphasis role="bold"><property>&lt;name&gt;</property></emphasis> element that defines the name of the attribute
			</para>
		</listitem>
		<listitem>
			<para>
				the <emphasis role="bold"><property>&lt;classname&gt;</property></emphasis> element that defines the class of the attribute&apos;s value
			</para>
		</listitem>
		<listitem>
			<para>
				the <emphasis role="bold"><property>&lt;description&gt;</property></emphasis> element that defines the description of the attribute.
				This description appears in the TLD file.
			</para>
		</listitem>
		<listitem>
			<para>
				the <emphasis role="bold"><property>&lt;defaultvalue&gt;</property></emphasis> element that defines the default value for the attribute
			</para>
		</listitem>
	</itemizedlist>
	<para>
		The last thing worth mentioning is the <property>common attributes</property> that are included through the named entities:
	</para>
		<programlisting role="XML"><![CDATA[...
&ui_component_attributes;
...]]></programlisting>
	<para>
		If you want to add <code>UIInput</code> components and HTML events common attributes for the 
		<emphasis role="bold"><property>&lt;inputDate&gt;</property></emphasis> component you should add the following entities:
	</para>
	
		<programlisting role="XML"><![CDATA[...
&ui_component_attributes;
&html_events;
&ui_input_attributes;
...]]></programlisting>
	<para>
		<ulink url="examples/inputDate.xml">Here</ulink> is a full example of the <property>inputDate.xml</property> for the 
		<emphasis role="bold"><property>&lt;inputDate&gt;</property></emphasis> component.
	</para>
	<para>
		More information about the <property>common attributes</property> you could find in the 
		<link linkend="attr_entity">Including common attributes</link> section.
	</para>
	<section id="attr_entity">
		<title>Including common attributes</title>
		<para>
			One of the useful features of the <property>CDK</property> is the possibility to include common attributes to the component.
			In order to facilitate development process, the <property>CDK</property> provides a set of entities 
			that contain custom attributes sets for components (events, action attributes, etc.). 
			This common attributes could be included with the predefined entities 
			(for example <property>&amp;ui_component_attributes;</property>, 
			<property>&amp;html_events;</property>,  <property>&amp;ui_input_attributes;</property>, etc.). 
		</para>
		<para>
			You could find all the entities <ulink url="http://anonsvn.jboss.org/repos/richfaces/trunk/cdk/generator/src/main/resources/META-INF/schema/entities">here</ulink>.
		</para>
		
		<!--
		TBD
		<para>
			There is a table with main entities and descriptions below:
		</para>
		-->
	</section>
</section>

