<?xml version="1.0" encoding="UTF-8"?>
<chapter>
  <chapterinfo>
    <keywordset>
      <keyword>a4j:loadStyle</keyword>
    </keywordset>
  </chapterinfo>
     <table>
	  <title>Component identification parameters </title>
      <tgroup cols="2">
	  <thead>
            <row>
                  <entry>Name</entry>
                  <entry>Value</entry>
            </row>
        </thead>
        <tbody>
          <row>
            <entry>component-type</entry>
            <entry>org.ajax4jsf.LoadStyle</entry>
          </row>
          <row>
            <entry>component-family</entry>
            <entry>org.ajax4jsf.LoadStyle</entry>
          </row>
          <row>
            <entry>component-class</entry>
            <entry>org.ajax4jsf.component.html.HtmlLoadStyle</entry>
          </row>
          <row>
            <entry>renderer-type</entry>
            <entry>org.ajax4jsf.LoadStyleRenderer</entry>
          </row>
        </tbody>
      </tgroup>
    </table>
  
  <section>
        <title>Creating the Component with a Page Tag</title>
    <para>To create the simplest variant on a page use the following syntax:</para>

  <para>
      <emphasis role="bold">Example:</emphasis>
 </para>
    <programlisting role="XML"><![CDATA[<a4j:loadStyle src="styles/style.css"/>
]]></programlisting>
  </section>
  <section>
    <title>Creating the Component Dynamically Using Java</title>

  <para>
      <emphasis role="bold">Example:</emphasis>
 </para>
    <programlisting role="JAVA"><![CDATA[import org.ajax4jsf.component.html.HtmlLoadStyle;
...
HtmlLoadScript myStyle = new HtmlLoadStyle();
...
]]></programlisting>
  </section>
  
      <section>
            <title>Details of usage</title>
            <para>
                  The main attribute of the <emphasis role="bold"><property>&lt;a4j:loadStylet&gt;</property></emphasis> is <emphasis><property>&quot;src&quot;</property></emphasis>, wich defines the context relative path to the script. 
                  The value of the attribute does not require a prefix of an application. 
                  Leading slash in the path means the root of the web context.
                  It is also possible to use <code>resource:///</code> prefix to access the script file using RichFaces resource framework.
            </para>
            <para>
                  <emphasis role="bold">Example:</emphasis>
            </para>
            <programlisting role="XML"><![CDATA[<a4j:loadStyle src="resource:///org/mycompany/assets/script/focus.js" />]]></programlisting>
            <para>
                  The <emphasis><property>&quot;src&quot;</property></emphasis> attribute passses value to the <code>getResourceURL()</code> method of the ViewHandler of the application, 
                  The result is passed through the <code>encodeResourceURL()</code> method of the ExternalContext. 
            </para>
            
      </section>
      
      <section>
            <title>Relevant resources links</title>
            <para>
                  Vizit the <ulink url="http://livedemo.exadel.com/richfaces-demo/richfaces/style.jsf?c=loadStyle">Script page at RichFaces LiveDemo</ulink> for examples of component usage abd their sources.
            </para>
      </section>
     
</chapter>   