<?xml version="1.0" encoding="UTF-8"?>
<section id="register" xreflabel="register">
<?dbhtml filename="register.html"?>
	<sectioninfo>
		<keywordset>
			<keyword>register</keyword>
			<keyword>UI</keyword>
			<keyword>CDK</keyword>
			<keyword>Guide</keyword>
		</keywordset>
	</sectioninfo>
	<title>Component resources registration</title>
	<para>
		The <emphasis role="bold"><property>&lt;inputDate&gt;</property></emphasis> component has a number of resources that should be registered 
		in the <property>resource-config.xml</property> file. 
		If the resource is registered, the RichFaces filter will send a request to the <property>ResourceBuilder</property> class 
		in order to create and to deliver the resource. 
	</para>
	<para>
		Hence, you need to proceed to the <property>inputDate/src/main/config/resources</property> directory and
		register the following resources in the <property>resource-config.xml</property> file:
	</para>
	<itemizedlist>
		<listitem>
			<para>
				an icon
			</para>
			<programlisting role="XML"><![CDATA[...
<resource>
	<name>org/mycompany/renderkit/html/images/inputDate.png</name>
	<path>org/mycompany/renderkit/html/images/inputDate.png</path>
</resource>
...]]></programlisting>
		</listitem>
		<listitem>
			<para>
				the <property>inputDate.xcss</property> file
			</para>
			<programlisting role="XML"><![CDATA[...
<resource>
	<name>org/mycompany/renderkit/html/css/inputDate.xcss</name>
	<path>org/mycompany/renderkit/html/css/inputDate.xcss</path>
</resource>		
...]]></programlisting>
		</listitem>
	</itemizedlist>
	<para>
		<ulink url="examples/resource-config.xml">Here</ulink> you could find a complete example of the <property>resource-config.xml</property> 
		for the <emphasis role="bold"><property>&lt;inputDate&gt;</property></emphasis> component.
	</para>
	<section id="resconf">
		<title>resource-config.xml file format</title>
		<para>
			The <property>resource-config.xml</property> is a file for resources registration. 
			Note, that the <property>resource-config.xml</property> should appear in the <property>META-INF</property> folder after the
			component building.
		</para>
		<para>
			This file has the <emphasis role="bold"><property>&lt;resource-config&gt;</property></emphasis> root element 
			with nested <emphasis role="bold"><property>&lt;resource&gt;</property></emphasis> elements. 
		</para>
		<para>
			It is possible to register static resources (images, JavaScript , CSS, XCSS, SWF, (X)HTML, XML, Log files), dynamic created images,
			component-incapsulated, JAR resources, etc.
		</para>
		<para>
			Here is a simple example of the image registration:
		</para>
		<programlisting role="XML"><![CDATA[...
<resource>
	<name>org/mycompany/renderkit/html/images/inputDate.png</name>
	<path>org/mycompany/renderkit/html/images/inputDate.png</path>
</resource>
...]]></programlisting>
		<para>
			There are two elements in the example above:
			an obligatory <emphasis role="bold"><property>&lt;name&gt;</property></emphasis> element which defines resource name and 
			a <emphasis role="bold"><property>&lt;path&gt;</property></emphasis> element which defines the path to the resource.
			The <emphasis role="bold"><property>&lt;path&gt;</property></emphasis> element is optional as it is possible to register 
			dynamic resources with the <emphasis><property>&quot;class&quot;</property></emphasis> attribute.
			For example you could register a dynamically created image as it is shown in the following example:
		</para>
		<programlisting role="XML"><![CDATA[...
<resource class="org.mycompany.renderkit.html.images.inputDate">
	<name>org.mycompany.renderkit.html.images.inputDate</name>
</resource>
...]]></programlisting>
		<para>
			With the help of the <emphasis role="bold"><property>&lt;cacheable&gt;</property></emphasis> element 
			you could manage whether the resource is cached or not. 
			If the value of this element is &quot;true&quot;, the resource is cached on the server and also on the client sides:
		</para>
		<programlisting role="XML"><![CDATA[...
<resource class="org.mycompany.renderkit.html.images.inputDate">
	<name>org.mycompany.renderkit.html.images.inputDate</name>
	<cacheable>true</cacheable>
</resource>
...]]></programlisting>
		<para>
			You could start a session for the some resource 
			using <emphasis role="bold"><property>&lt;session-aware&gt;</property></emphasis> element set to &quot;true&quot;:
		</para>
		<programlisting role="XML"><![CDATA[...
<resource>
	<name>org/mycompany/renderkit/html/scripts/inputDate.js</name>
	<path>org/mycompany/renderkit/html/scripts/inputDate.js</path>
	<session-aware>true</session-aware>
</resource>
...]]></programlisting>
		<para>
			Sometimes the definition of a content type of the resource is needed, so it is possible to add 
			the <emphasis role="bold"><property>&lt;content-type&gt;</property></emphasis> element with the proper MIME type.
		</para>
		<para>
			You could also define a custom <property>renderer</property>  for the resource:
		</para>
		<programlisting role="XML"><![CDATA[...
<resource>
	<name>org/mycompany/renderkit/html/scripts/inputDate.js</name>
	<path>org/mycompany/renderkit/html/scripts/inputDate.js</path>
	<renderer class="org.ajax4jsf.resource.ScriptRenderer"/>
</resource>
...]]></programlisting>
		<para>
			It is possible to specify a MIME type for the resource <property>renderer</property> 
			using the <emphasis role="bold"><property>&lt;content-type&gt;</property></emphasis> element.
		</para>
	

<!--
TBD
	<property>
		<name></name>
	</property>
-->

	</section>
</section>